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