489 case MP_INDUSTRY: |
489 case MP_INDUSTRY: |
490 bits = IS_BYTE_INSIDE(_m[tile].m5, 0x10, 0x12) ? MKCOLOR(0xD0D0D0D0) : MKCOLOR(0xB5B5B5B5); |
490 bits = IS_BYTE_INSIDE(_m[tile].m5, 0x10, 0x12) ? MKCOLOR(0xD0D0D0D0) : MKCOLOR(0xB5B5B5B5); |
491 break; |
491 break; |
492 |
492 |
493 case MP_TREES: |
493 case MP_TREES: |
494 if ((_m[tile].m2 & 0x30) == 0x20) |
494 if ((_m[tile].m2 & 0x30) == 0x20) { |
495 bits = (_opt.landscape == LT_HILLY) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2); |
495 bits = (_opt.landscape == LT_HILLY) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2); |
496 else |
496 } else { |
497 bits = MKCOLOR(0x54575754); |
497 bits = MKCOLOR(0x54575754); |
|
498 } |
498 break; |
499 break; |
499 |
500 |
500 default: |
501 default: |
501 bits = ApplyMask(MKCOLOR(0x54545454), &_smallmap_vehicles_andor[t]); |
502 bits = ApplyMask(MKCOLOR(0x54545454), &_smallmap_vehicles_andor[t]); |
502 break; |
503 break; |
559 return b + (b << 8) + (b << 16) + (b << 24); |
560 return b + (b << 8) + (b << 16) + (b << 24); |
560 } |
561 } |
561 |
562 |
562 static void DrawVertMapIndicator(int x, int y, int x2, int y2) |
563 static void DrawVertMapIndicator(int x, int y, int x2, int y2) |
563 { |
564 { |
564 GfxFillRect(x, y, x2, y + 3, 69); |
565 GfxFillRect(x, y, x2, y + 3, 69); |
565 GfxFillRect(x, y2 - 3, x2, y2, 69); |
566 GfxFillRect(x, y2 - 3, x2, y2, 69); |
566 } |
567 } |
567 |
568 |
568 static void DrawHorizMapIndicator(int x, int y, int x2, int y2) |
569 static void DrawHorizMapIndicator(int x, int y, int x2, int y2) |
569 { |
570 { |
570 GfxFillRect(x, y, x + 3, y2, 69); |
571 GfxFillRect(x, y, x + 3, y2, 69); |
571 GfxFillRect(x2 - 3, y, x2, y2, 69); |
572 GfxFillRect(x2 - 3, y, x2, y2, 69); |
572 } |
573 } |
573 |
574 |
574 /** |
575 /** |
575 * Draws the small map. |
576 * Draws the small map. |
576 * |
577 * |
610 _owner_colors[OWNER_WATER] = MKCOLOR(0xCACACACA); |
611 _owner_colors[OWNER_WATER] = MKCOLOR(0xCACACACA); |
611 _owner_colors[OWNER_SPECTATOR] = MKCOLOR(0x20202020); /* industry */ |
612 _owner_colors[OWNER_SPECTATOR] = MKCOLOR(0x20202020); /* industry */ |
612 |
613 |
613 /* now fill with the player colors */ |
614 /* now fill with the player colors */ |
614 FOR_ALL_PLAYERS(p) { |
615 FOR_ALL_PLAYERS(p) { |
615 if (p->is_active) |
616 if (p->is_active) { |
616 _owner_colors[p->index] = |
617 _owner_colors[p->index] = |
617 dup_byte32(GetNonSprite(775 + p->player_color)[0xCB]); // XXX - magic pixel |
618 dup_byte32(GetNonSprite(775 + p->player_color)[0xCB]); // XXX - magic pixel |
|
619 } |
618 } |
620 } |
619 } |
621 } |
620 |
622 |
621 tile_x = WP(w,smallmap_d).scroll_x / 16; |
623 tile_x = WP(w,smallmap_d).scroll_x / 16; |
622 tile_y = WP(w,smallmap_d).scroll_y / 16; |
624 tile_y = WP(w,smallmap_d).scroll_y / 16; |
659 } |
661 } |
660 |
662 |
661 /* distance from right edge */ |
663 /* distance from right edge */ |
662 t = dpi->width - x; |
664 t = dpi->width - x; |
663 if (t < 4) { |
665 if (t < 4) { |
664 if (t <= 0) |
666 if (t <= 0) break; /* exit loop */ |
665 break; /* exit loop */ |
|
666 /* mask to use at the right edge */ |
667 /* mask to use at the right edge */ |
667 mask &= _smallmap_mask_right[t - 1]; |
668 mask &= _smallmap_mask_right[t - 1]; |
668 } |
669 } |
669 |
670 |
670 /* number of lines */ |
671 /* number of lines */ |
716 x -= WP(w,smallmap_d).subscroll + 3 + dpi->left; |
717 x -= WP(w,smallmap_d).subscroll + 3 + dpi->left; |
717 |
718 |
718 if (x < 0) { |
719 if (x < 0) { |
719 // if x+1 is 0, that means we're on the very left edge, |
720 // if x+1 is 0, that means we're on the very left edge, |
720 // and should thus only draw a single pixel |
721 // and should thus only draw a single pixel |
721 if (++x != 0) |
722 if (++x != 0) continue; |
722 continue; |
|
723 skip = true; |
723 skip = true; |
724 } else if (x >= dpi->width - 1) { |
724 } else if (x >= dpi->width - 1) { |
725 // Check if we're at the very right edge, and if so draw only a single pixel |
725 // Check if we're at the very right edge, and if so draw only a single pixel |
726 if (x != dpi->width - 1) |
726 if (x != dpi->width - 1) continue; |
727 continue; |
|
728 skip = true; |
727 skip = true; |
729 } |
728 } |
730 |
729 |
731 // Calculate pointer to pixel and the color |
730 // Calculate pointer to pixel and the color |
732 ptr = dpi->dst_ptr + y * dpi->pitch + x; |
731 ptr = dpi->dst_ptr + y * dpi->pitch + x; |
733 color = (type == 1) ? _vehicle_type_colors[v->type-0x10] : 0xF; |
732 color = (type == 1) ? _vehicle_type_colors[v->type-0x10] : 0xF; |
734 |
733 |
735 // And draw either one or two pixels depending on clipping |
734 // And draw either one or two pixels depending on clipping |
736 ptr[0] = color; |
735 ptr[0] = color; |
737 if (!skip) |
736 if (!skip) ptr[1] = color; |
738 ptr[1] = color; |
|
739 } |
737 } |
740 } |
738 } |
741 } |
739 } |
742 |
740 |
743 if (show_towns) { |
741 if (show_towns) { |
809 /* draw the legend */ |
807 /* draw the legend */ |
810 tbl = _legend_table[(_smallmap_type != 2) ? _smallmap_type : (_opt.landscape + IND_OFFS)]; |
808 tbl = _legend_table[(_smallmap_type != 2) ? _smallmap_type : (_opt.landscape + IND_OFFS)]; |
811 x = 4; |
809 x = 4; |
812 y_org = w->height - 44 - 11; |
810 y_org = w->height - 44 - 11; |
813 y = y_org; |
811 y = y_org; |
814 while (true) { |
812 for (;;) { |
815 GfxFillRect(x, y+1, x+8, y + 5, 0); |
813 GfxFillRect(x, y + 1, x + 8, y + 5, 0); |
816 GfxFillRect(x+1, y+2, x+7, y + 4, (byte)tbl[0]); |
814 GfxFillRect(x + 1, y + 2, x + 7, y + 4, (byte)tbl[0]); |
817 DrawString(x+11, y, tbl[1], 0); |
815 DrawString(x + 11, y, tbl[1], 0); |
818 |
816 |
819 tbl += 2; |
817 tbl += 2; |
820 y += 6; |
818 y += 6; |
821 |
819 |
822 if (tbl[0] == 0xFFFF) { |
820 if (tbl[0] == 0xFFFF) { |
871 } |
869 } |
872 break; |
870 break; |
873 |
871 |
874 case WE_RCLICK: |
872 case WE_RCLICK: |
875 if (e->click.widget == 4) { |
873 if (e->click.widget == 4) { |
876 if (_scrolling_viewport) |
874 if (_scrolling_viewport) return; |
877 return; |
|
878 _scrolling_viewport = true; |
875 _scrolling_viewport = true; |
879 _cursor.delta.x = 0; |
876 _cursor.delta.x = 0; |
880 _cursor.delta.y = 0; |
877 _cursor.delta.y = 0; |
881 } |
878 } |
882 break; |
879 break; |
883 |
880 |
884 case WE_MOUSELOOP: |
881 case WE_MOUSELOOP: |
885 /* update the window every now and then */ |
882 /* update the window every now and then */ |
886 if ((++w->vscroll.pos & 0x1F) == 0) |
883 if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w); |
887 SetWindowDirty(w); |
|
888 break; |
884 break; |
889 } |
885 } |
890 } |
886 } |
891 |
887 |
892 static const WindowDesc _smallmap_desc = { |
888 static const WindowDesc _smallmap_desc = { |
909 w->resize.width = 350; |
905 w->resize.width = 350; |
910 w->resize.height = 250; |
906 w->resize.height = 250; |
911 |
907 |
912 vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; |
908 vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; |
913 |
909 |
914 x = (((vp->virtual_width - (220*32)) / 2) + vp->virtual_left) / 4; |
910 x = ((vp->virtual_width - 220 * 32) / 2 + vp->virtual_left) / 4; |
915 y = ((((vp->virtual_height- (120*32)) / 2) + vp->virtual_top ) / 2) - 32; |
911 y = ((vp->virtual_height - 120 * 32) / 2 + vp->virtual_top ) / 2 - 32; |
916 WP(w,smallmap_d).scroll_x = (y-x) & ~0xF; |
912 WP(w,smallmap_d).scroll_x = (y - x) & ~0xF; |
917 WP(w,smallmap_d).scroll_y = (x+y) & ~0xF; |
913 WP(w,smallmap_d).scroll_y = (x + y) & ~0xF; |
918 WP(w,smallmap_d).subscroll = 0; |
914 WP(w,smallmap_d).subscroll = 0; |
919 } |
915 } |
920 } |
916 } |
921 |
917 |
922 /* Extra ViewPort Window Stuff */ |
918 /* Extra ViewPort Window Stuff */ |