author | darkvater |
Wed, 22 Dec 2004 01:32:30 +0000 | |
changeset 758 | bd9e868b9fae |
parent 682 | 7f5de4abac85 |
child 856 | 07dc27d0503e |
permissions | -rw-r--r-- |
0 | 1 |
#include "stdafx.h" |
2 |
#include "ttd.h" |
|
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
500
diff
changeset
|
3 |
#include "table/strings.h" |
679
e959706a3e4d
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
541
diff
changeset
|
4 |
#include "map.h" |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
5 |
#include "gui.h" |
0 | 6 |
#include "window.h" |
7 |
#include "gfx.h" |
|
8 |
#include "viewport.h" |
|
9 |
#include "player.h" |
|
10 |
#include "vehicle.h" |
|
11 |
#include "town.h" |
|
337
66647f97e7c0
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
193
diff
changeset
|
12 |
#include "sound.h" |
0 | 13 |
|
14 |
static const Widget _smallmap_megabig_widgets[] = { |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
15 |
{ WWT_TEXTBTN, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
16 |
{ WWT_CAPTION, 13, 11, 580, 0, 13, STR_00B0_MAP,STR_018C_WINDOW_TITLE_DRAG_THIS}, |
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
17 |
{ WWT_STICKYBOX, 13, 581, 592, 0, 13, 0x0, STR_STICKY_BUTTON}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
18 |
{ WWT_IMGBTN, 13, 593, 606, 0, 13, 0x2AA, STR_01CC_TOGGLE_LARGE_SMALL_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
19 |
{ WWT_IMGBTN, 13, 0, 606, 14, 407, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
20 |
{ WWT_6, 13, 2, 604, 16, 405, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
21 |
{ WWT_IMGBTN, 13, 541, 562, 408, 429, 0x2E2, STR_0191_SHOW_LAND_CONTOURS_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
22 |
{ WWT_IMGBTN, 13, 563, 584, 408, 429, 0x2E3, STR_0192_SHOW_VEHICLES_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
23 |
{ WWT_IMGBTN, 13, 585, 606, 408, 429, 0x2E5, STR_0193_SHOW_INDUSTRIES_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
24 |
{ WWT_IMGBTN, 13, 519, 540, 430, 451, 0x2E4, STR_0194_SHOW_TRANSPORT_ROUTES_ON}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
25 |
{ WWT_IMGBTN, 13, 541, 562, 430, 451, 0x2E6, STR_0195_SHOW_VEGETATION_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
26 |
{ WWT_IMGBTN, 13, 563, 584, 430, 451, 0x2E7, STR_0196_SHOW_LAND_OWNERS_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
27 |
{ WWT_IMGBTN, 13, 585, 606, 430, 451, 0xFED, STR_0197_TOGGLE_TOWN_NAMES_ON_OFF}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
28 |
{ WWT_IMGBTN, 13, 0, 518, 408, 451, 0x0, STR_0197_TOGGLE_TOWN_NAMES_ON_OFF}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
29 |
{ WWT_IMGBTN, 13, 519, 540, 408, 429, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
30 |
{ WIDGETS_END}, |
0 | 31 |
}; |
32 |
||
33 |
static const Widget _smallmap_big_widgets[] = { |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
34 |
{ WWT_TEXTBTN, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
35 |
{ WWT_CAPTION, 13, 11, 419, 0, 13, STR_00B0_MAP,STR_018C_WINDOW_TITLE_DRAG_THIS}, |
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
36 |
{ WWT_STICKYBOX, 13, 420, 431, 0, 13, 0x0, STR_STICKY_BUTTON}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
37 |
{ WWT_IMGBTN, 13, 432, 445, 0, 13, 0x2AA, STR_01CC_TOGGLE_LARGE_SMALL_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
38 |
{ WWT_IMGBTN, 13, 0, 445, 14, 257, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
39 |
{ WWT_6, 13, 2, 443, 16, 255, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
40 |
{ WWT_IMGBTN, 13, 380, 401, 258, 279, 0x2E2, STR_0191_SHOW_LAND_CONTOURS_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
41 |
{ WWT_IMGBTN, 13, 402, 423, 258, 279, 0x2E3, STR_0192_SHOW_VEHICLES_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
42 |
{ WWT_IMGBTN, 13, 424, 445, 258, 279, 0x2E5, STR_0193_SHOW_INDUSTRIES_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
43 |
{ WWT_IMGBTN, 13, 380, 401, 280, 301, 0x2E4, STR_0194_SHOW_TRANSPORT_ROUTES_ON}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
44 |
{ WWT_IMGBTN, 13, 402, 423, 280, 301, 0x2E6, STR_0195_SHOW_VEGETATION_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
45 |
{ WWT_IMGBTN, 13, 424, 445, 280, 301, 0x2E7, STR_0196_SHOW_LAND_OWNERS_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
46 |
{ WWT_IMGBTN, 13, 358, 379, 280, 301, 0xFED, STR_0197_TOGGLE_TOWN_NAMES_ON_OFF}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
47 |
{ WWT_IMGBTN, 13, 0, 357, 258, 301, 0x0, STR_0197_TOGGLE_TOWN_NAMES_ON_OFF}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
48 |
{ WWT_IMGBTN, 13, 358, 379, 258, 279, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
49 |
{ WIDGETS_END}, |
0 | 50 |
}; |
51 |
||
52 |
||
53 |
static const Widget _smallmap_small_widgets[] = { |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
54 |
{ WWT_TEXTBTN, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
55 |
{ WWT_CAPTION, 13, 11, 221, 0, 13, STR_00B0_MAP,STR_018C_WINDOW_TITLE_DRAG_THIS}, |
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
56 |
{ WWT_STICKYBOX, 13, 222, 233, 0, 13, 0x0, STR_STICKY_BUTTON}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
57 |
{ WWT_IMGBTN, 13, 234, 247, 0, 13, 0x2AA, STR_01CC_TOGGLE_LARGE_SMALL_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
58 |
{ WWT_IMGBTN, 13, 0, 225, 14, 167, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
59 |
{ WWT_6, 13, 2, 223, 16, 165, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
60 |
{ WWT_IMGBTN, 13, 226, 247, 14, 35, 0x2E2, STR_0191_SHOW_LAND_CONTOURS_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
61 |
{ WWT_IMGBTN, 13, 226, 247, 36, 57, 0x2E3, STR_0192_SHOW_VEHICLES_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
62 |
{ WWT_IMGBTN, 13, 226, 247, 58, 79, 0x2E5, STR_0193_SHOW_INDUSTRIES_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
63 |
{ WWT_IMGBTN, 13, 226, 247, 80, 101, 0x2E4, STR_0194_SHOW_TRANSPORT_ROUTES_ON}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
64 |
{ WWT_IMGBTN, 13, 226, 247, 102, 123, 0x2E6, STR_0195_SHOW_VEGETATION_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
65 |
{ WWT_IMGBTN, 13, 226, 247, 124, 145, 0x2E7, STR_0196_SHOW_LAND_OWNERS_ON_MAP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
66 |
{ WWT_IMGBTN, 13, 226, 247, 146, 167, 0xFED, STR_0197_TOGGLE_TOWN_NAMES_ON_OFF}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
67 |
{ WWT_IMGBTN, 13, 0, 247, 168, 211, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
68 |
{ WIDGETS_END}, |
0 | 69 |
}; |
70 |
||
71 |
static int _smallmap_type; |
|
72 |
static byte _smallmap_size; |
|
73 |
static bool _smallmap_show_towns = true; |
|
74 |
||
75 |
static void DoShowSmallMap(int big); |
|
76 |
||
77 |
#define MK(a,b) a,b |
|
78 |
#define MKEND() 0xffff |
|
79 |
#define MS(a,b) (a|0x100),b |
|
80 |
||
81 |
static const uint16 _legend_land_contours[] = { |
|
82 |
MK(0x5A,STR_00F0_100M), |
|
83 |
MK(0x5C,STR_00F1_200M), |
|
84 |
MK(0x5E,STR_00F2_300M), |
|
85 |
MK(0x1F,STR_00F3_400M), |
|
86 |
MK(0x27,STR_00F4_500M), |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
87 |
|
0 | 88 |
MS(0xD7,STR_00EB_ROADS), |
89 |
MK(0x0A,STR_00EC_RAILROADS), |
|
90 |
MK(0x98,STR_00ED_STATIONS_AIRPORTS_DOCKS), |
|
91 |
MK(0xB5,STR_00EE_BUILDINGS_INDUSTRIES), |
|
92 |
MK(0x0F,STR_00EF_VEHICLES), |
|
93 |
MKEND() |
|
94 |
}; |
|
95 |
||
96 |
static const uint16 _legend_vehicles[] = { |
|
97 |
MK(0xB8,STR_00F5_TRAINS), |
|
98 |
MK(0xBF,STR_00F6_ROAD_VEHICLES), |
|
99 |
MK(0x98,STR_00F7_SHIPS), |
|
100 |
MK(0x0F,STR_00F8_AIRCRAFT), |
|
101 |
MS(0xD7,STR_00F9_TRANSPORT_ROUTES), |
|
102 |
MK(0xB5,STR_00EE_BUILDINGS_INDUSTRIES), |
|
103 |
MKEND() |
|
104 |
}; |
|
105 |
||
106 |
static const uint16 _legend_industries_normal[] = { |
|
107 |
MK(0xD7,STR_00FA_COAL_MINE), |
|
108 |
MK(0xB8,STR_00FB_POWER_STATION), |
|
109 |
MK(0x56,STR_00FC_FOREST), |
|
110 |
MK(0xC2,STR_00FD_SAWMILL), |
|
111 |
MK(0xBF,STR_00FE_OIL_REFINERY), |
|
112 |
MK(0x0F,STR_0105_BANK), |
|
113 |
||
114 |
MS(0x30,STR_00FF_FARM), |
|
115 |
MK(0xAE,STR_0100_FACTORY), |
|
116 |
MK(0x98,STR_0102_OIL_WELLS), |
|
117 |
MK(0x37,STR_0103_IRON_ORE_MINE), |
|
118 |
MK(0x0A,STR_0104_STEEL_MILL), |
|
119 |
MKEND() |
|
120 |
}; |
|
121 |
||
122 |
static const uint16 _legend_industries_hilly[] = { |
|
123 |
MK(0xD7,STR_00FA_COAL_MINE), |
|
124 |
MK(0xB8,STR_00FB_POWER_STATION), |
|
125 |
MK(0x56,STR_00FC_FOREST), |
|
126 |
MK(0x0A,STR_0106_PAPER_MILL), |
|
127 |
MK(0xBF,STR_00FE_OIL_REFINERY), |
|
128 |
MK(0x37,STR_0108_FOOD_PROCESSING_PLANT), |
|
129 |
MS(0x30,STR_00FF_FARM), |
|
130 |
||
131 |
MK(0xAE,STR_0101_PRINTING_WORKS), |
|
132 |
MK(0x98,STR_0102_OIL_WELLS), |
|
133 |
MK(0xC2,STR_0107_GOLD_MINE), |
|
134 |
MK(0x0F,STR_0105_BANK), |
|
135 |
MKEND() |
|
136 |
}; |
|
137 |
||
138 |
static const uint16 _legend_industries_desert[] = { |
|
139 |
MK(0xBF,STR_00FE_OIL_REFINERY), |
|
140 |
MK(0x98,STR_0102_OIL_WELLS), |
|
141 |
MK(0x0F,STR_0105_BANK), |
|
142 |
MK(0xB8,STR_0109_DIAMOND_MINE), |
|
143 |
MK(0x37,STR_0108_FOOD_PROCESSING_PLANT), |
|
144 |
MK(0x0A,STR_010A_COPPER_ORE_MINE), |
|
145 |
MK(0x30,STR_00FF_FARM), |
|
146 |
MS(0x56,STR_010B_FRUIT_PLANTATION), |
|
147 |
||
148 |
MK(0x27,STR_010C_RUBBER_PLANTATION), |
|
149 |
MK(0x25,STR_010D_WATER_SUPPLY), |
|
150 |
MK(0xD0,STR_010E_WATER_TOWER), |
|
151 |
MK(0xAE,STR_0100_FACTORY), |
|
152 |
MK(0xC2,STR_010F_LUMBER_MILL), |
|
153 |
MKEND() |
|
154 |
}; |
|
155 |
||
156 |
static const uint16 _legend_industries_candy[] = { |
|
157 |
MK(0x30,STR_0110_COTTON_CANDY_FOREST), |
|
158 |
MK(0xAE,STR_0111_CANDY_FACTORY), |
|
159 |
MK(0x27,STR_0112_BATTERY_FARM), |
|
160 |
MK(0x37,STR_0113_COLA_WELLS), |
|
161 |
MK(0xD0,STR_0114_TOY_SHOP), |
|
162 |
MK(0x0A,STR_0115_TOY_FACTORY), |
|
163 |
MS(0x25,STR_0116_PLASTIC_FOUNTAINS), |
|
164 |
||
165 |
MK(0xB8,STR_0117_FIZZY_DRINK_FACTORY), |
|
166 |
MK(0x98,STR_0118_BUBBLE_GENERATOR), |
|
167 |
MK(0xC2,STR_0119_TOFFEE_QUARRY), |
|
168 |
MK(0x0F,STR_011A_SUGAR_MINE), |
|
169 |
MKEND() |
|
170 |
}; |
|
171 |
||
172 |
static const uint16 _legend_routes[] = { |
|
173 |
MK(0xD7,STR_00EB_ROADS), |
|
174 |
MK(0x0A,STR_00EC_RAILROADS), |
|
175 |
MK(0xB5,STR_00EE_BUILDINGS_INDUSTRIES), |
|
176 |
MS(0x56,STR_011B_RAILROAD_STATION), |
|
177 |
||
178 |
MK(0xC2,STR_011C_TRUCK_LOADING_BAY), |
|
179 |
MK(0xBF,STR_011D_BUS_STATION), |
|
180 |
MK(0xB8,STR_011E_AIRPORT_HELIPORT), |
|
181 |
MK(0x98,STR_011F_DOCK), |
|
182 |
MKEND() |
|
183 |
}; |
|
184 |
||
185 |
static const uint16 _legend_vegetation[] = { |
|
186 |
MK(0x52,STR_0120_ROUGH_LAND), |
|
187 |
MK(0x54,STR_0121_GRASS_LAND), |
|
188 |
MK(0x37,STR_0122_BARE_LAND), |
|
189 |
MK(0x25,STR_0123_FIELDS), |
|
190 |
MK(0x57,STR_0124_TREES), |
|
191 |
MK(0xD0,STR_00FC_FOREST), |
|
192 |
MS(0x0A,STR_0125_ROCKS), |
|
193 |
||
194 |
MK(0xC2,STR_012A_DESERT), |
|
195 |
MK(0x98,STR_012B_SNOW), |
|
196 |
MK(0xD7,STR_00F9_TRANSPORT_ROUTES), |
|
197 |
MK(0xB5,STR_00EE_BUILDINGS_INDUSTRIES), |
|
198 |
MKEND() |
|
199 |
}; |
|
200 |
||
201 |
static const uint16 _legend_land_owners[] = { |
|
202 |
MK(0xCA,STR_0126_WATER), |
|
203 |
MK(0x54,STR_0127_NO_OWNER), |
|
204 |
MK(0xB4,STR_0128_TOWNS), |
|
205 |
MK(0x20,STR_0129_INDUSTRIES), |
|
206 |
MKEND() |
|
207 |
}; |
|
208 |
#undef MK |
|
209 |
#undef MS |
|
210 |
#undef MKEND |
|
211 |
||
212 |
||
213 |
enum { IND_OFFS = 6 }; |
|
214 |
static const uint16 * const _legend_table[] = { |
|
215 |
_legend_land_contours, |
|
216 |
_legend_vehicles, |
|
217 |
NULL, |
|
218 |
_legend_routes, |
|
219 |
_legend_vegetation, |
|
220 |
_legend_land_owners, |
|
221 |
||
222 |
_legend_industries_normal, |
|
223 |
_legend_industries_hilly, |
|
224 |
_legend_industries_desert, |
|
225 |
_legend_industries_candy, |
|
226 |
}; |
|
227 |
||
228 |
#if defined(TTD_ALIGNMENT_4) |
|
500
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
337
diff
changeset
|
229 |
static inline void WRITE_PIXELS(void *dst, uint32 val) |
0 | 230 |
{ |
231 |
byte *d = (byte*)dst; |
|
232 |
# if defined(TTD_BIG_ENDIAN) |
|
233 |
d[0] = (byte)(val >> 24); |
|
234 |
d[1] = (byte)(val >> 16); |
|
235 |
d[2] = (byte)(val >> 8); |
|
236 |
d[3] = (byte)(val >> 0); |
|
237 |
# elif defined(TTD_LITTLE_ENDIAN) |
|
238 |
d[0] = (byte)(val >> 0); |
|
239 |
d[1] = (byte)(val >> 8); |
|
240 |
d[2] = (byte)(val >> 16); |
|
241 |
d[3] = (byte)(val >> 24); |
|
242 |
# endif |
|
243 |
} |
|
244 |
||
245 |
/* need to use OR, otherwise we will overwrite the wrong pixels at the edges :( */ |
|
500
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
337
diff
changeset
|
246 |
static inline void WRITE_PIXELS_OR(void *dst, uint32 val) |
0 | 247 |
{ |
248 |
byte *d = (byte*)dst; |
|
249 |
# if defined(TTD_BIG_ENDIAN) |
|
250 |
d[0] |= (byte)(val >> 24); |
|
251 |
d[1] |= (byte)(val >> 16); |
|
252 |
d[2] |= (byte)(val >> 8); |
|
253 |
d[3] |= (byte)(val >> 0); |
|
254 |
# elif defined(TTD_LITTLE_ENDIAN) |
|
255 |
d[0] |= (byte)(val >> 0); |
|
256 |
d[1] |= (byte)(val >> 8); |
|
257 |
d[2] |= (byte)(val >> 16); |
|
258 |
d[3] |= (byte)(val >> 24); |
|
259 |
# endif |
|
260 |
} |
|
261 |
#else |
|
262 |
# define WRITE_PIXELS(dst, val) *(uint32*)(dst) = (val); |
|
263 |
# define WRITE_PIXELS_OR(dst,val) *(uint32*)(dst) |= (val); |
|
264 |
#endif |
|
265 |
||
266 |
#if defined(TTD_BIG_ENDIAN) |
|
267 |
# define MKCOLOR(x) BSWAP32(x) |
|
268 |
#elif defined(TTD_LITTLE_ENDIAN) |
|
269 |
# define MKCOLOR(x) (x) |
|
270 |
#endif |
|
271 |
||
272 |
static const uint32 _map_height_bits[16] = { |
|
273 |
MKCOLOR(0x5A5A5A5A), |
|
274 |
MKCOLOR(0x5A5B5A5B), |
|
275 |
MKCOLOR(0x5B5B5B5B), |
|
276 |
MKCOLOR(0x5B5C5B5C), |
|
277 |
MKCOLOR(0x5C5C5C5C), |
|
278 |
MKCOLOR(0x5C5D5C5D), |
|
279 |
MKCOLOR(0x5D5D5D5D), |
|
280 |
MKCOLOR(0x5D5E5D5E), |
|
281 |
MKCOLOR(0x5E5E5E5E), |
|
282 |
MKCOLOR(0x5E5F5E5F), |
|
283 |
MKCOLOR(0x5F5F5F5F), |
|
284 |
MKCOLOR(0x5F1F5F1F), |
|
285 |
MKCOLOR(0x1F1F1F1F), |
|
286 |
MKCOLOR(0x1F271F27), |
|
287 |
MKCOLOR(0x27272727), |
|
288 |
MKCOLOR(0x27272727), |
|
289 |
}; |
|
290 |
||
291 |
static const uint32 _smallmap_contours_andor[12][2] = { |
|
292 |
{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)}, |
|
293 |
{MKCOLOR(0x000A0A00),MKCOLOR(0xFF0000FF)}, |
|
294 |
{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)}, |
|
295 |
{MKCOLOR(0x00B5B500),MKCOLOR(0xFF0000FF)}, |
|
296 |
{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)}, |
|
297 |
{MKCOLOR(0x98989898),MKCOLOR(0x00000000)}, |
|
298 |
{MKCOLOR(0xCACACACA),MKCOLOR(0x00000000)}, |
|
299 |
{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)}, |
|
300 |
{MKCOLOR(0xB5B5B5B5),MKCOLOR(0x00000000)}, |
|
301 |
{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)}, |
|
302 |
{MKCOLOR(0x00B5B500),MKCOLOR(0xFF0000FF)}, |
|
303 |
{MKCOLOR(0x000A0A00),MKCOLOR(0xFF0000FF)}, |
|
304 |
}; |
|
305 |
||
306 |
static const uint32 _smallmap_vehicles_andor[12][2] = { |
|
307 |
{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)}, |
|
308 |
{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)}, |
|
309 |
{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)}, |
|
310 |
{MKCOLOR(0x00B5B500),MKCOLOR(0xFF0000FF)}, |
|
311 |
{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)}, |
|
312 |
{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)}, |
|
313 |
{MKCOLOR(0xCACACACA),MKCOLOR(0x00000000)}, |
|
314 |
{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)}, |
|
315 |
{MKCOLOR(0xB5B5B5B5),MKCOLOR(0x00000000)}, |
|
316 |
{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)}, |
|
317 |
{MKCOLOR(0x00B5B500),MKCOLOR(0xFF0000FF)}, |
|
318 |
{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)}, |
|
319 |
}; |
|
320 |
||
321 |
static const uint32 _smallmap_vegetation_andor[12][2] = { |
|
322 |
{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)}, |
|
323 |
{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)}, |
|
324 |
{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)}, |
|
325 |
{MKCOLOR(0x00B5B500),MKCOLOR(0xFF0000FF)}, |
|
326 |
{MKCOLOR(0x00575700),MKCOLOR(0xFF0000FF)}, |
|
327 |
{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)}, |
|
328 |
{MKCOLOR(0xCACACACA),MKCOLOR(0x00000000)}, |
|
329 |
{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)}, |
|
330 |
{MKCOLOR(0xB5B5B5B5),MKCOLOR(0x00000000)}, |
|
331 |
{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)}, |
|
332 |
{MKCOLOR(0x00B5B500),MKCOLOR(0xFF0000FF)}, |
|
333 |
{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)}, |
|
334 |
}; |
|
335 |
||
500
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
337
diff
changeset
|
336 |
static inline uint32 GetSmallMapCountoursPixels(uint tile) |
0 | 337 |
{ |
338 |
uint t; |
|
339 |
||
340 |
t = GET_TILETYPE(tile); |
|
341 |
if (t == MP_TUNNELBRIDGE) { |
|
342 |
t = _map5[tile]; |
|
343 |
if ((t & 0x80) == 0) t>>=1; |
|
344 |
if ((t & 6) == 0) { |
|
345 |
t = MP_RAILWAY; |
|
346 |
} else if ((t & 6) == 2) { |
|
347 |
t = MP_STREET; |
|
348 |
} else { |
|
349 |
t = MP_WATER; |
|
350 |
} |
|
351 |
} |
|
352 |
||
353 |
return (_map_height_bits[_map_type_and_height[tile] & 0xF] & _smallmap_contours_andor[t][1]) | _smallmap_contours_andor[t][0]; |
|
354 |
} |
|
355 |
||
356 |
static void DrawSmallMapContours(byte *dst, uint xc, uint yc, int pitch, int reps, uint32 mask) |
|
357 |
{ |
|
358 |
do { |
|
359 |
if (xc < TILE_X_MAX && yc < TILE_Y_MAX) |
|
12 | 360 |
if (dst > _screen.dst_ptr && dst < (_screen.dst_ptr + _screen.width * _screen.height - _screen.width) ) |
361 |
WRITE_PIXELS_OR( dst, GetSmallMapCountoursPixels(TILE_XY(xc,yc)) & mask ); |
|
0 | 362 |
} while (xc++,yc++,dst+=pitch,--reps != 0); |
363 |
} |
|
364 |
||
365 |
||
500
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
337
diff
changeset
|
366 |
static inline uint32 GetSmallMapVehiclesPixels(uint tile) |
0 | 367 |
{ |
368 |
uint t; |
|
369 |
||
370 |
t = GET_TILETYPE(tile); |
|
371 |
if (t == MP_TUNNELBRIDGE) { |
|
372 |
t = _map5[tile]; |
|
373 |
if ((t & 0x80) == 0) t>>=1; |
|
374 |
if ((t & 6) == 0) { |
|
375 |
t = MP_RAILWAY; |
|
376 |
} else if ((t & 6) == 2) { |
|
377 |
t = MP_STREET; |
|
378 |
} else { |
|
379 |
t = MP_WATER; |
|
380 |
} |
|
381 |
} |
|
382 |
return (MKCOLOR(0x54545454) & _smallmap_vehicles_andor[t][1]) | _smallmap_vehicles_andor[t][0]; |
|
383 |
} |
|
384 |
||
385 |
||
386 |
static void DrawSmallMapVehicles(byte *dst, uint xc, uint yc, int pitch, int reps, uint32 mask) |
|
387 |
{ |
|
388 |
do { |
|
389 |
if (xc < TILE_X_MAX && yc < TILE_Y_MAX) |
|
390 |
WRITE_PIXELS_OR( dst, GetSmallMapVehiclesPixels(TILE_XY(xc,yc)) & mask ); |
|
391 |
} while (xc++,yc++,dst+=pitch,--reps != 0); |
|
392 |
} |
|
393 |
||
394 |
static const byte _industry_smallmap_colors[175] = { |
|
395 |
215,215,215,215,215,215,215,184, |
|
396 |
184,184,184,194,194,194,194,194, |
|
397 |
86, 86,191,191,191,191,191,191, |
|
398 |
152,152,152,152,152,152,152,152, |
|
399 |
152, 48, 48, 48, 48, 48, 48,174, |
|
400 |
174,174,174,174,174,174,174, 10, |
|
401 |
10, 10, 10, 10, 10, 10, 10, 10, |
|
402 |
10, 10, 15, 15, 55, 55, 55, 55, |
|
403 |
10, 10, 10, 10, 10, 10, 10, 10, |
|
404 |
194,194,194,194,194,194,194,194, |
|
405 |
194,194,194,194,194,194,194,194, |
|
406 |
194, 15, 15,184,184,184,184,184, |
|
407 |
184,184,184,184, 55, 55, 55, 55, |
|
408 |
55, 55, 55, 55, 55, 55, 55, 55, |
|
409 |
55, 55, 55, 55, 86, 39, 37, 37, |
|
410 |
208,174,174,174,174,194,194,194, |
|
411 |
194, 48, 48,174,174,174,174, 39, |
|
412 |
39, 55,208,208,208,208, 10, 10, |
|
413 |
10, 10, 10, 10, 37, 37, 37, 37, |
|
414 |
37, 37, 37, 37,184,184,184,184, |
|
415 |
152,152,152,152,194,194,194, 15, |
|
416 |
15, 15, 15, 15, 15, 15, 15, |
|
417 |
}; |
|
418 |
||
500
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
337
diff
changeset
|
419 |
static inline uint32 GetSmallMapIndustriesPixels(uint tile) |
0 | 420 |
{ |
421 |
int t; |
|
422 |
||
423 |
t = GET_TILETYPE(tile); |
|
424 |
if (t == MP_INDUSTRY) { |
|
425 |
byte color = _industry_smallmap_colors[_map5[tile]]; |
|
426 |
return color + (color << 8) + (color << 16) + (color << 24); |
|
427 |
} else { |
|
428 |
if (t == MP_TUNNELBRIDGE) { |
|
429 |
t = _map5[tile]; |
|
430 |
if ((t & 0x80) == 0) t>>=1; |
|
431 |
if ((t & 6) == 0) { |
|
432 |
t = MP_RAILWAY; |
|
433 |
} else if ((t & 6) == 2) { |
|
434 |
t = MP_STREET; |
|
435 |
} else { |
|
436 |
t = MP_WATER; |
|
437 |
} |
|
438 |
} |
|
439 |
return ((MKCOLOR(0x54545454) & _smallmap_vehicles_andor[t][1]) | _smallmap_vehicles_andor[t][0]); |
|
440 |
} |
|
441 |
} |
|
442 |
||
443 |
static void DrawSmallMapIndustries(byte *dst, uint xc, uint yc, int pitch, int reps, uint32 mask) |
|
444 |
{ |
|
445 |
do { |
|
446 |
if (xc < TILE_X_MAX && yc < TILE_Y_MAX) |
|
447 |
WRITE_PIXELS_OR(dst, GetSmallMapIndustriesPixels(TILE_XY(xc,yc)) & mask); |
|
448 |
} while (xc++,yc++,dst+=pitch,--reps != 0); |
|
449 |
} |
|
450 |
||
500
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
337
diff
changeset
|
451 |
static inline uint32 GetSmallMapRoutesPixels(uint tile) |
0 | 452 |
{ |
453 |
int t; |
|
454 |
uint32 bits; |
|
455 |
||
456 |
t = GET_TILETYPE(tile); |
|
457 |
if (t == MP_STATION) { |
|
458 |
byte m5 = _map5[tile]; |
|
459 |
(bits = MKCOLOR(0x56565656), m5 < 8) || // 8 - railroad station (green) |
|
460 |
(bits = MKCOLOR(0xB8B8B8B8), m5 < 0x43) || // 67 - airport (red) |
|
461 |
(bits = MKCOLOR(0xC2C2C2C2), m5 < 0x47) || // 71 - truck loading bay (orange) |
|
462 |
(bits = MKCOLOR(0xBFBFBFBF), m5 < 0x4B) || // 75 - bus station (yellow) |
|
463 |
(bits = MKCOLOR(0x98989898), m5 < 0x53) || // 83 - docks (blue) |
|
464 |
(bits = MKCOLOR(0xB8B8B8B8), m5 < 0x73) || // 115 - airport (red) (new airports) |
|
465 |
(bits = MKCOLOR(0xFFFFFFFF), true); // all others |
|
466 |
} else { |
|
467 |
if (t == MP_TUNNELBRIDGE) { |
|
468 |
t = _map5[tile]; |
|
469 |
if ((t & 0x80) == 0) t>>=1; |
|
470 |
if ((t & 6) == 0) { |
|
471 |
t = MP_RAILWAY; |
|
472 |
} else if ((t & 6) == 2) { |
|
473 |
t = MP_STREET; |
|
474 |
} else { |
|
475 |
t = MP_WATER; |
|
476 |
} |
|
477 |
} |
|
478 |
// ground color |
|
479 |
bits = ((MKCOLOR(0x54545454) & _smallmap_contours_andor[t][1]) | _smallmap_contours_andor[t][0]); |
|
480 |
} |
|
481 |
return bits; |
|
482 |
} |
|
483 |
||
484 |
static void DrawSmallMapRoutes(byte *dst, uint xc, uint yc, int pitch, int reps, uint32 mask) |
|
485 |
{ |
|
486 |
do { |
|
487 |
if (xc < TILE_X_MAX && yc < TILE_Y_MAX) |
|
488 |
WRITE_PIXELS_OR(dst, GetSmallMapRoutesPixels(TILE_XY(xc,yc)) & mask); |
|
489 |
} while (xc++,yc++,dst+=pitch,--reps != 0); |
|
490 |
} |
|
491 |
||
492 |
static const uint32 _vegetation_clear_bits[4 + 7] = { |
|
493 |
MKCOLOR(0x37373737), |
|
494 |
MKCOLOR(0x37373737), |
|
495 |
MKCOLOR(0x37373737), |
|
496 |
MKCOLOR(0x54545454), |
|
497 |
||
498 |
MKCOLOR(0x52525252), |
|
499 |
MKCOLOR(0x0A0A0A0A), |
|
500 |
MKCOLOR(0x25252525), |
|
501 |
MKCOLOR(0x98989898), |
|
502 |
MKCOLOR(0xC2C2C2C2), |
|
503 |
MKCOLOR(0x54545454), |
|
504 |
MKCOLOR(0x54545454), |
|
505 |
}; |
|
506 |
||
500
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
337
diff
changeset
|
507 |
static inline uint32 GetSmallMapVegetationPixels(uint tile) |
0 | 508 |
{ |
509 |
int i,t; |
|
510 |
uint32 bits; |
|
511 |
||
512 |
t = GET_TILETYPE(tile); |
|
513 |
if (t == MP_CLEAR) { |
|
514 |
i = (_map5[tile] & 0x1F) - 4; |
|
515 |
if (i >= 0) i = (i >> 2); |
|
516 |
bits = _vegetation_clear_bits[i + 4]; |
|
517 |
} else if (t == MP_INDUSTRY) { |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
518 |
bits = IS_BYTE_INSIDE(_map5[tile], 0x10, 0x12) ? MKCOLOR(0xD0D0D0D0) : MKCOLOR(0xB5B5B5B5); |
0 | 519 |
} else if (t == MP_TREES) { |
520 |
bits = MKCOLOR(0x54575754); |
|
521 |
if ((_map2[tile] & 0x30) == 0x20) |
|
522 |
bits = (_opt.landscape == LT_HILLY) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2); |
|
523 |
} else { |
|
524 |
if (t == MP_TUNNELBRIDGE) { |
|
525 |
t = _map5[tile]; |
|
526 |
if ((t & 0x80) == 0) t>>=1; |
|
527 |
if ((t & 6) == 0) { |
|
528 |
t = MP_RAILWAY; |
|
529 |
} else if ((t & 6) == 2) { |
|
530 |
t = MP_STREET; |
|
531 |
} else { |
|
532 |
t = MP_WATER; |
|
533 |
} |
|
534 |
} |
|
535 |
bits = ((MKCOLOR(0x54545454) & _smallmap_vehicles_andor[t][1]) | _smallmap_vehicles_andor[t][0]); |
|
536 |
} |
|
537 |
||
538 |
return bits; |
|
539 |
} |
|
540 |
||
541 |
||
542 |
static void DrawSmallMapVegetation(byte *dst, uint xc, uint yc, int pitch, int reps, uint32 mask) |
|
543 |
{ |
|
544 |
do { |
|
545 |
if (xc < TILE_X_MAX && yc < TILE_Y_MAX) |
|
546 |
WRITE_PIXELS_OR(dst, GetSmallMapVegetationPixels(TILE_XY(xc,yc)) & mask); |
|
547 |
} while (xc++,yc++,dst+=pitch,--reps != 0); |
|
548 |
} |
|
549 |
||
550 |
||
551 |
static uint32 *_owner_colors; |
|
552 |
||
500
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
337
diff
changeset
|
553 |
static inline uint32 GetSmallMapOwnerPixels(uint tile) |
0 | 554 |
{ |
555 |
int t; |
|
556 |
||
557 |
t = GET_TILETYPE(tile); |
|
558 |
if (t == MP_HOUSE || _map_owner[tile] == OWNER_TOWN) { |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
559 |
t = 0x80; |
0 | 560 |
} else if (t == MP_INDUSTRY) { |
561 |
t = 0xff; |
|
562 |
} else { |
|
563 |
t = _map_owner[tile]; |
|
564 |
} |
|
565 |
||
566 |
return _owner_colors[t]; |
|
567 |
} |
|
568 |
||
569 |
||
570 |
static void DrawSmallMapOwners(byte *dst, uint xc, uint yc, int pitch, int reps, uint32 mask) |
|
571 |
{ |
|
572 |
do { |
|
573 |
if (xc < TILE_X_MAX && yc < TILE_Y_MAX) |
|
574 |
WRITE_PIXELS_OR(dst, GetSmallMapOwnerPixels(TILE_XY(xc,yc)) & mask); |
|
575 |
} while (xc++,yc++,dst+=pitch,--reps != 0); |
|
576 |
} |
|
577 |
||
578 |
||
579 |
static const uint32 _smallmap_mask_left[3] = { |
|
580 |
MKCOLOR(0xFF000000), |
|
581 |
MKCOLOR(0xFFFF0000), |
|
582 |
MKCOLOR(0xFFFFFF00), |
|
583 |
}; |
|
584 |
||
585 |
static const uint32 _smallmap_mask_right[4] = { |
|
586 |
MKCOLOR(0x00000000), |
|
587 |
MKCOLOR(0x000000FF), |
|
588 |
MKCOLOR(0x0000FFFF), |
|
589 |
MKCOLOR(0x00FFFFFF), |
|
590 |
}; |
|
591 |
||
592 |
/* each tile has 4 x pixels and 1 y pixel */ |
|
593 |
||
594 |
typedef void SmallmapDrawProc(byte *dst, uint xc, uint yc, int pitch, int reps, uint32 mask); |
|
595 |
||
596 |
static SmallmapDrawProc *_smallmap_draw_procs[] = { |
|
597 |
DrawSmallMapContours, |
|
598 |
DrawSmallMapVehicles, |
|
599 |
DrawSmallMapIndustries, |
|
600 |
DrawSmallMapRoutes, |
|
601 |
DrawSmallMapVegetation, |
|
602 |
DrawSmallMapOwners, |
|
603 |
}; |
|
604 |
||
605 |
static const byte _vehicle_type_colors[6] = { |
|
606 |
184, 191, 152, 15, 215, 184 |
|
607 |
}; |
|
608 |
||
500
ef288590e096
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
337
diff
changeset
|
609 |
static inline uint32 dup_byte32(byte b) { |
0 | 610 |
return b + (b << 8) + (b << 16) + (b << 24); |
611 |
} |
|
612 |
||
613 |
static void DrawVertMapIndicator(int x, int y, int x2, int y2) |
|
614 |
{ |
|
615 |
GfxFillRect(x, y, x2, y + 3, 69); |
|
616 |
GfxFillRect(x, y2 - 3, x2, y2, 69); |
|
617 |
} |
|
618 |
||
619 |
static void DrawHorizMapIndicator(int x, int y, int x2, int y2) |
|
620 |
{ |
|
621 |
GfxFillRect(x, y, x + 3, y2, 69); |
|
622 |
GfxFillRect(x2 - 3, y, x2, y2, 69); |
|
623 |
} |
|
624 |
||
625 |
static void DrawSmallMap(DrawPixelInfo *dpi, Window *w, int type, bool show_towns) |
|
626 |
{ |
|
627 |
DrawPixelInfo *old_dpi; |
|
628 |
int dx,dy, x, y, x2, y2; |
|
629 |
byte *ptr; |
|
630 |
uint tile_x, tile_y; |
|
631 |
uint32 mask; |
|
632 |
int t; |
|
633 |
int reps; |
|
634 |
SmallmapDrawProc *proc; |
|
635 |
ViewPort *vp; |
|
636 |
||
637 |
old_dpi = _cur_dpi; |
|
638 |
_cur_dpi = dpi; |
|
639 |
||
640 |
/* clear it */ |
|
641 |
GfxFillRect(dpi->left, dpi->top, dpi->left + dpi->width - 1, dpi->top + dpi->height - 1, 0); |
|
642 |
||
643 |
/* setup owner table */ |
|
644 |
if (type == 5) { |
|
645 |
Player *p; |
|
646 |
uint32 *tbl; |
|
647 |
||
648 |
/* setup owners ptr */ |
|
649 |
_owner_colors = tbl = alloca(256 * sizeof(*_owner_colors)); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
650 |
|
0 | 651 |
/* clear the town colors */ |
652 |
memset(tbl + 128, 0xB4, 128 * sizeof(*_owner_colors)); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
653 |
|
0 | 654 |
/* fill with some special colors */ |
655 |
tbl[0x10] = MKCOLOR(0x54545454); |
|
656 |
tbl[0x11] = MKCOLOR(0xCACACACA); |
|
657 |
tbl[0xff] = MKCOLOR(0x20202020); /* industry */ |
|
658 |
||
659 |
/* now fill with the player colors */ |
|
660 |
FOR_ALL_PLAYERS(p) { |
|
661 |
if (p->is_active) { |
|
662 |
tbl[p->index] = dup_byte32(GetSpritePtr(0x307 + p->player_color)[0xCB]); |
|
663 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
664 |
} |
0 | 665 |
} |
666 |
||
667 |
tile_x = (int)WP(w,smallmap_d).scroll_x >> 4; |
|
668 |
tile_y = (int)WP(w,smallmap_d).scroll_y >> 4; |
|
669 |
||
670 |
dx = dpi->left + WP(w,smallmap_d).subscroll; |
|
671 |
tile_x -= (dx >> 2); |
|
672 |
tile_y += (dx >> 2); |
|
673 |
dx &= 3; |
|
674 |
||
675 |
dy = dpi->top; |
|
676 |
tile_x += (dy >> 1); |
|
677 |
tile_y += (dy >> 1); |
|
678 |
||
679 |
if (dy & 1) { |
|
680 |
tile_x++; |
|
681 |
dx += 2; |
|
682 |
if (dx > 3) { |
|
683 |
dx -= 4; |
|
684 |
tile_x--; |
|
685 |
tile_y++; |
|
686 |
} |
|
687 |
} |
|
688 |
||
689 |
proc = _smallmap_draw_procs[type]; |
|
690 |
||
691 |
ptr = dpi->dst_ptr - dx - 4; |
|
692 |
x = - dx - 4; |
|
693 |
y = 0; |
|
694 |
||
695 |
for(;;) { |
|
696 |
mask = (uint32)-1; |
|
697 |
||
698 |
/* distance from left edge */ |
|
699 |
if (x < 0) { |
|
700 |
if (x < -3) goto skip_column; |
|
701 |
/* mask to use at the left edge */ |
|
702 |
mask = _smallmap_mask_left[x + 3]; |
|
703 |
} |
|
704 |
||
705 |
/* distance from right edge */ |
|
706 |
t = dpi->width - x; |
|
707 |
if (t < 4) { |
|
708 |
if (t < 0) |
|
709 |
break; /* exit loop */ |
|
710 |
/* mask to use at the right edge */ |
|
711 |
mask &= _smallmap_mask_right[t]; |
|
712 |
} |
|
713 |
||
714 |
/* number of lines */ |
|
715 |
reps = ((dpi->height - y + 1) >> 1); |
|
716 |
if (reps > 0) { |
|
717 |
// assert(ptr >= dpi->dst_ptr); |
|
718 |
proc(ptr, tile_x, tile_y, dpi->pitch*2, reps, mask); |
|
719 |
} |
|
720 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
721 |
skip_column: |
0 | 722 |
if (y == 0) { |
723 |
tile_y++; |
|
724 |
y++; |
|
725 |
ptr += dpi->pitch; |
|
726 |
} else { |
|
727 |
tile_x--; |
|
728 |
y--; |
|
729 |
ptr -= dpi->pitch; |
|
730 |
} |
|
731 |
ptr += 2; |
|
732 |
x += 2; |
|
733 |
} |
|
734 |
||
735 |
/* draw vehicles? */ |
|
736 |
if (type == 0 || type == 1) { |
|
737 |
Vehicle *v; |
|
738 |
bool skip; |
|
739 |
byte color; |
|
740 |
||
741 |
FOR_ALL_VEHICLES(v) { |
|
742 |
if (v->type != 0 && v->type != 0x14 && (v->vehstatus & (VS_HIDDEN|VS_UNCLICKABLE)) == 0) { |
|
743 |
// Remap into flat coordinates. |
|
744 |
Point pt = RemapCoords( |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
745 |
(int)(v->x_pos - WP(w,smallmap_d).scroll_x) >> 4, |
0 | 746 |
(int)(v->y_pos - WP(w,smallmap_d).scroll_y) >> 4, |
747 |
0); |
|
748 |
x = pt.x; |
|
749 |
y = pt.y; |
|
750 |
||
751 |
// Check if y is out of bounds? |
|
752 |
y -= dpi->top; |
|
753 |
if ((uint)y >= (uint)dpi->height) |
|
754 |
continue; |
|
755 |
||
756 |
// Default is to draw both pixels. |
|
757 |
skip = false; |
|
758 |
||
759 |
// Offset X coordinate |
|
760 |
x -= WP(w,smallmap_d).subscroll + 3 + dpi->left; |
|
761 |
||
762 |
if (x < 0) { |
|
763 |
// if x+1 is 0, that means we're on the very left edge, |
|
764 |
// and should thus only draw a single pixel |
|
765 |
if (++x != 0) |
|
766 |
continue; |
|
767 |
skip = true; |
|
768 |
} else if (x >= dpi->width - 1) { |
|
769 |
// Check if we're at the very right edge, and if so draw only a single pixel |
|
770 |
if (x != dpi->width - 1) |
|
771 |
continue; |
|
772 |
skip = true; |
|
773 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
774 |
|
0 | 775 |
// Calculate pointer to pixel and the color |
776 |
ptr = dpi->dst_ptr + y * dpi->pitch + x; |
|
777 |
color = (type == 1) ? _vehicle_type_colors[v->type-0x10] : 0xF; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
778 |
|
0 | 779 |
// And draw either one or two pixels depending on clipping |
780 |
ptr[0] = color; |
|
781 |
if (!skip) |
|
782 |
ptr[1] = color; |
|
783 |
} |
|
784 |
} |
|
785 |
} |
|
786 |
||
787 |
if (show_towns) { |
|
788 |
Town *t; |
|
789 |
FOR_ALL_TOWNS(t) { |
|
790 |
if (t->xy != 0) { |
|
791 |
// Remap the town coordinate |
|
792 |
Point pt = RemapCoords( |
|
793 |
(int)(GET_TILE_X(t->xy)*16 - WP(w,smallmap_d).scroll_x) >> 4, |
|
794 |
(int)(GET_TILE_Y(t->xy)*16 - WP(w,smallmap_d).scroll_y) >> 4, |
|
795 |
0); |
|
796 |
x = pt.x - WP(w,smallmap_d).subscroll + 3 - (t->sign.width_2 >> 1); |
|
797 |
y = pt.y; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
798 |
|
0 | 799 |
// Check if the town sign is within bounds |
800 |
if (x + t->sign.width_2 > dpi->left && |
|
801 |
x < dpi->left + dpi->width && |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
802 |
y + 6 > dpi->top && |
0 | 803 |
y < dpi->top + dpi->height) { |
804 |
// And draw it. |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
805 |
SetDParam(0, t->index); |
0 | 806 |
DrawString(x, y, STR_2056, 12); |
807 |
} |
|
808 |
} |
|
809 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
810 |
} |
0 | 811 |
|
812 |
// Draw map indicators |
|
813 |
{ |
|
814 |
Point pt; |
|
815 |
||
816 |
// Find main viewport. |
|
817 |
vp = FindWindowById(WC_MAIN_WINDOW,0)->viewport; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
818 |
|
0 | 819 |
pt = RemapCoords( |
820 |
WP(w,smallmap_d).scroll_x, |
|
821 |
WP(w,smallmap_d).scroll_y, |
|
822 |
0); |
|
823 |
||
824 |
x = vp->virtual_left - pt.x; |
|
825 |
y = vp->virtual_top - pt.y; |
|
826 |
x2 = (x + vp->virtual_width) >> 4; |
|
827 |
y2 = (y + vp->virtual_height) >> 4; |
|
828 |
x >>= 4; |
|
829 |
y >>= 4; |
|
830 |
||
831 |
x -= WP(w,smallmap_d).subscroll; |
|
832 |
x2 -= WP(w,smallmap_d).subscroll; |
|
833 |
||
834 |
DrawVertMapIndicator(x, y, x, y2); |
|
835 |
DrawVertMapIndicator(x2, y, x2, y2); |
|
836 |
||
837 |
DrawHorizMapIndicator(x, y, x2, y); |
|
838 |
DrawHorizMapIndicator(x, y2, x2, y2); |
|
839 |
} |
|
840 |
_cur_dpi = old_dpi; |
|
841 |
} |
|
842 |
||
843 |
static void SmallMapWindowProc(Window *w, WindowEvent *e) |
|
844 |
{ |
|
845 |
switch(e->event) { |
|
846 |
case WE_PAINT: { |
|
847 |
const uint16 *tbl; |
|
848 |
int x,y,y_org; |
|
849 |
DrawPixelInfo new_dpi; |
|
850 |
||
851 |
||
852 |
/* draw the window */ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
853 |
SetDParam(0, STR_00E5_CONTOURS + _smallmap_type); |
0 | 854 |
DrawWindowWidgets(w); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
855 |
|
0 | 856 |
/* draw the legend */ |
857 |
tbl = _legend_table[(_smallmap_type != 2) ? _smallmap_type : (_opt.landscape + IND_OFFS)]; |
|
858 |
x = 4; |
|
859 |
y_org = w->height - 43; |
|
860 |
y = y_org; |
|
861 |
while(1) { |
|
862 |
GfxFillRect(x, y+1, x+8, y + 5, 0); |
|
863 |
GfxFillRect(x+1, y+2, x+7, y + 4, (byte)tbl[0]); |
|
864 |
DrawString(x+11, y, tbl[1], 0); |
|
865 |
||
866 |
tbl += 2; |
|
867 |
y += 6; |
|
868 |
||
869 |
if (tbl[0] == 0xFFFF) { |
|
870 |
break; |
|
871 |
} else if (tbl[0] & 0x100) { |
|
872 |
x += 123; |
|
873 |
y = y_org; |
|
874 |
} |
|
875 |
} |
|
876 |
||
877 |
if (!FillDrawPixelInfo(&new_dpi, NULL, 3, 17, w->width - 28 + (w->widget == _smallmap_small_widgets ? 0 : 22), w->height - 64)) |
|
878 |
return; |
|
879 |
||
880 |
DrawSmallMap(&new_dpi, w, _smallmap_type, _smallmap_show_towns); |
|
881 |
} break; |
|
882 |
||
883 |
case WE_CLICK: |
|
884 |
switch(e->click.widget) { |
|
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
885 |
case 3: {/* big/small size */ |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
886 |
// const Widget *wi = w->widget; |
0 | 887 |
DeleteWindow(w); |
541 | 888 |
SndPlayFx(SND_15_BEEP); |
0 | 889 |
{ |
890 |
int i = _smallmap_size + 1; |
|
891 |
if (i == 3) i = 0; |
|
892 |
DoShowSmallMap(i); |
|
893 |
} |
|
894 |
} break; |
|
895 |
||
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
896 |
case 5: {/* main wnd */ |
0 | 897 |
Window *w2; |
898 |
Point pt; |
|
899 |
||
900 |
_left_button_clicked = false; |
|
901 |
||
902 |
w2 = FindWindowById(WC_MAIN_WINDOW, 0); |
|
903 |
||
904 |
pt = RemapCoords(WP(w,smallmap_d).scroll_x, WP(w,smallmap_d).scroll_y, 0); |
|
905 |
WP(w2,vp_d).scrollpos_x = pt.x + ((_cursor.pos.x - w->left + 2) << 4) - (w2->viewport->virtual_width >> 1); |
|
906 |
WP(w2,vp_d).scrollpos_y = pt.y + ((_cursor.pos.y - w->top - 16) << 4) - (w2->viewport->virtual_height >> 1); |
|
907 |
} break; |
|
908 |
||
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
909 |
case 6: /* show land contours */ |
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
910 |
case 7: /* show vehicles */ |
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
911 |
case 8: /* show industries */ |
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
912 |
case 9: /* show transport routes */ |
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
913 |
case 10: /* show vegetation */ |
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
914 |
case 11: /* show land owners */ |
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
915 |
w->click_state &= ~(1<<6|1<<7|1<<8|1<<9|1<<10|1<<11); |
0 | 916 |
w->click_state |= 1 << e->click.widget; |
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
917 |
_smallmap_type = e->click.widget - 6; |
0 | 918 |
|
919 |
SetWindowDirty(w); |
|
541 | 920 |
SndPlayFx(SND_15_BEEP); |
0 | 921 |
break; |
922 |
||
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
923 |
case 12: /* toggle town names */ |
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
924 |
w->click_state ^= (1 << 12); |
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
925 |
_smallmap_show_towns = (w->click_state >> 12) & 1; |
0 | 926 |
SetWindowDirty(w); |
541 | 927 |
SndPlayFx(SND_15_BEEP); |
0 | 928 |
break; |
929 |
} |
|
930 |
break; |
|
931 |
||
932 |
case WE_RCLICK: |
|
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
933 |
if (e->click.widget == 5) { |
0 | 934 |
if (_scrolling_viewport) |
935 |
return; |
|
936 |
_scrolling_viewport = true; |
|
937 |
_cursor.delta.x = 0; |
|
938 |
_cursor.delta.y = 0; |
|
939 |
} |
|
940 |
break; |
|
941 |
||
942 |
case WE_MOUSELOOP: |
|
943 |
/* update the window every now and then */ |
|
944 |
if ((++w->vscroll.pos & 0x1F) == 0) |
|
945 |
SetWindowDirty(w); |
|
946 |
break; |
|
947 |
} |
|
948 |
} |
|
949 |
||
950 |
static const WindowDesc _smallmap_small_desc = { |
|
951 |
-1,-1, 248, 212, |
|
952 |
WC_SMALLMAP,0, |
|
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
953 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 954 |
_smallmap_small_widgets, |
955 |
SmallMapWindowProc |
|
956 |
}; |
|
957 |
||
958 |
static const WindowDesc _smallmap_big_desc = { |
|
959 |
-1,-1, 446, 302, |
|
960 |
WC_SMALLMAP,0, |
|
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
961 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 962 |
_smallmap_big_widgets, |
963 |
SmallMapWindowProc |
|
964 |
}; |
|
965 |
||
966 |
static const WindowDesc _smallmap_megabig_desc = { |
|
967 |
-1,-1, 607, 452, |
|
968 |
WC_SMALLMAP,0, |
|
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
969 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 970 |
_smallmap_megabig_widgets, |
971 |
SmallMapWindowProc |
|
972 |
}; |
|
973 |
||
974 |
static const WindowDesc * const _smallmap_descs[3] = { |
|
975 |
&_smallmap_small_desc, |
|
976 |
&_smallmap_big_desc, |
|
977 |
&_smallmap_megabig_desc |
|
978 |
}; |
|
979 |
||
980 |
static void DoShowSmallMap(int big) |
|
981 |
{ |
|
982 |
Window *w; |
|
983 |
ViewPort *vp; |
|
984 |
int x,y; |
|
985 |
||
986 |
_smallmap_size = big; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
987 |
|
0 | 988 |
w = AllocateWindowDescFront(_smallmap_descs[big], 0); |
989 |
if (w) { |
|
758
bd9e868b9fae
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
682
diff
changeset
|
990 |
w->click_state = (1<<6) << _smallmap_type | _smallmap_show_towns << 12; |
0 | 991 |
vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; |
992 |
||
993 |
x = (((vp->virtual_width - (big?220*32:110*32)) >> 1) + vp->virtual_left) >> 2; |
|
994 |
y = ((((vp->virtual_height- (big?120*32:75*32)) >> 1) + vp->virtual_top) >> 1) - 32; |
|
995 |
WP(w,smallmap_d).scroll_x = (y-x) & ~0xF; |
|
996 |
WP(w,smallmap_d).scroll_y = (x+y) & ~0xF; |
|
997 |
WP(w,smallmap_d).subscroll = 0; |
|
998 |
} |
|
999 |
} |
|
1000 |
||
1001 |
void ShowSmallMap() |
|
1002 |
{ |
|
1003 |
DoShowSmallMap(_smallmap_size); |
|
1004 |
} |
|
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1005 |
|
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1006 |
/* Extra ViewPort Window Stuff */ |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1007 |
static Widget _extra_view_port_widgets[] = { |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
1008 |
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
682
7f5de4abac85
(svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents:
679
diff
changeset
|
1009 |
{ WWT_CAPTION, 14, 11, 287, 0, 13, STR_EXTRA_VIEW_PORT_TITLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7f5de4abac85
(svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents:
679
diff
changeset
|
1010 |
{ WWT_STICKYBOX, 14, 288, 299, 0, 13, 0x0, STR_STICKY_BUTTON}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
1011 |
{ WWT_PANEL, 14, 0, 299, 14, 233, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
1012 |
{ WWT_6, 14, 2, 297, 16, 231, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
1013 |
{ WWT_PANEL, 14, 0, 21, 234, 255, 0x2DF, STR_017F_ZOOM_THE_VIEW_IN}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
1014 |
{ WWT_PANEL, 14, 22, 43, 234, 255, 0x2E0, STR_0180_ZOOM_THE_VIEW_OUT}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
1015 |
{ WWT_PUSHTXTBTN, 14, 44, 171, 234, 255, STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW,STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
1016 |
{ WWT_PUSHTXTBTN, 14, 172, 299, 234, 255, STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN,STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN_TT}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
154
diff
changeset
|
1017 |
{ WIDGETS_END}, |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1018 |
}; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1019 |
|
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1020 |
static void ExtraViewPortWndProc(Window *w, WindowEvent *e) |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1021 |
{ |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1022 |
ViewPort *vp = w->viewport; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1023 |
|
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1024 |
switch(e->event) { |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1025 |
case WE_PAINT: { |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1026 |
// set the number in the title bar |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
1027 |
SetDParam(0, (w->window_number+1)); |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1028 |
|
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1029 |
DrawWindowWidgets(w); |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1030 |
DrawWindowViewport(w); |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1031 |
} break; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1032 |
case WE_CLICK: { |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1033 |
switch(e->click.widget) { |
682
7f5de4abac85
(svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents:
679
diff
changeset
|
1034 |
case 5: { /* zoom in */ |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1035 |
DoZoomInOutWindow(ZOOM_IN,w); |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1036 |
} break; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1037 |
|
682
7f5de4abac85
(svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents:
679
diff
changeset
|
1038 |
case 6: { /* zoom out */ |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1039 |
DoZoomInOutWindow(ZOOM_OUT,w); |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1040 |
} break; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1041 |
|
682
7f5de4abac85
(svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents:
679
diff
changeset
|
1042 |
case 7: { /* location button (move main view to same spot as this view) */ |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1043 |
Window * w2 = FindWindowById(WC_MAIN_WINDOW, 0); |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1044 |
int x = WP(w,vp_d).scrollpos_x; // Where is the main looking at |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1045 |
int y = WP(w,vp_d).scrollpos_y; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1046 |
|
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1047 |
// set this view to same location. Based on the center, adjusting for zoom |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1048 |
WP(w2,vp_d).scrollpos_x = x - (w2->viewport->virtual_width - (294 <<vp->zoom) )/2; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1049 |
WP(w2,vp_d).scrollpos_y = y - (w2->viewport->virtual_height - (214 << vp->zoom) )/2; |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1050 |
} break; |
682
7f5de4abac85
(svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents:
679
diff
changeset
|
1051 |
case 8: { /* inverse location button (move this view to same spot as main view) */ |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1052 |
Window * w2 = FindWindowById(WC_MAIN_WINDOW, 0); |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1053 |
int x = WP(w2,vp_d).scrollpos_x; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1054 |
int y = WP(w2,vp_d).scrollpos_y; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1055 |
|
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1056 |
WP(w,vp_d).scrollpos_x = x + (w2->viewport->virtual_width - (294 <<vp->zoom) )/2; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1057 |
WP(w,vp_d).scrollpos_y = y + (w2->viewport->virtual_height - (214 << vp->zoom) )/2; |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1058 |
} break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1059 |
} |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1060 |
} break; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1061 |
} |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1062 |
} |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1063 |
|
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1064 |
static const WindowDesc _extra_view_port_desc = { |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1065 |
-1,-1, 300, 256, |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1066 |
WC_EXTRA_VIEW_PORT,0, |
682
7f5de4abac85
(svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents:
679
diff
changeset
|
1067 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1068 |
_extra_view_port_widgets, |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1069 |
ExtraViewPortWndProc |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1070 |
}; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1071 |
|
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1072 |
void ShowExtraViewPortWindow() |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1073 |
{ |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1074 |
Window *w, *v; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1075 |
int i = 0; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1076 |
|
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1077 |
// find next free window number for extra viewport |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1078 |
while (FindWindowById(WC_EXTRA_VIEW_PORT,i) ) { |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1079 |
i++; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1080 |
} |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1081 |
|
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1082 |
w = AllocateWindowDescFront(&_extra_view_port_desc,i); |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1083 |
if (w) { |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1084 |
int x,y; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1085 |
// disable zoom in button |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1086 |
w->disabled_state = 1 << 4; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1087 |
// the main window with the main view |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1088 |
v = FindWindowById(WC_MAIN_WINDOW, 0); |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1089 |
// New viewport start ats (zero,zero) |
152
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1090 |
AssignWindowViewport(w, 3, 17, 294, 214, 0 , 0); |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1091 |
|
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1092 |
// center on same place as main window (zoom is maximum, no adjustment needed) |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1093 |
x = WP(v,vp_d).scrollpos_x; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1094 |
y = WP(v,vp_d).scrollpos_y; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1095 |
WP(w,vp_d).scrollpos_x = x + (v->viewport->virtual_width - (294) )/2; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1096 |
WP(w,vp_d).scrollpos_y = y + (v->viewport->virtual_height - (214) )/2; |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1097 |
} |
c3964b43943e
(svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents:
12
diff
changeset
|
1098 |
} |