author | truelight |
Tue, 22 Aug 2006 15:33:35 +0000 | |
changeset 4346 | 66105d4f6e83 |
parent 4344 | 7e123fec5b0b |
child 4356 | ec4e13f21cd0 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1815
diff
changeset
|
4 |
#include "openttd.h" |
3234
a2791a480b71
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents:
3184
diff
changeset
|
5 |
#include "bridge_map.h" |
3144
33e42feae531
(svn r3763) Adapt to the new 'map accessors go in foo_map.h'-scheme
tron
parents:
2989
diff
changeset
|
6 |
#include "clear_map.h" |
3391
3c8a6643ed15
(svn r4199) - Codechange: Use industry map accessors to get industry graphics type.
peter1138
parents:
3338
diff
changeset
|
7 |
#include "industry_map.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
8 |
#include "functions.h" |
1349
15979a2e9001
(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
|
9 |
#include "spritecache.h" |
3338
7cff208f0446
(svn r4120) Use the new station functions where appropriate
tron
parents:
3326
diff
changeset
|
10 |
#include "station_map.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
500
diff
changeset
|
11 |
#include "table/strings.h" |
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
12 |
#include "table/sprites.h" |
679
04ca2cd69420
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
541
diff
changeset
|
13 |
#include "map.h" |
1209
2e00193652b2
(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
|
14 |
#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
|
15 |
#include "gui.h" |
3144
33e42feae531
(svn r3763) Adapt to the new 'map accessors go in foo_map.h'-scheme
tron
parents:
2989
diff
changeset
|
16 |
#include "tree_map.h" |
3180
9c87ee130147
(svn r3820) Be a bit more strict with types: use special types instead of generic byte and don't fill arbitrary data into inappropriate types
tron
parents:
3144
diff
changeset
|
17 |
#include "tunnel_map.h" |
0 | 18 |
#include "window.h" |
19 |
#include "gfx.h" |
|
20 |
#include "viewport.h" |
|
21 |
#include "player.h" |
|
22 |
#include "vehicle.h" |
|
23 |
#include "town.h" |
|
337
cbe0c766c947
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
193
diff
changeset
|
24 |
#include "sound.h" |
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2062
diff
changeset
|
25 |
#include "variables.h" |
0 | 26 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
27 |
static const Widget _smallmap_widgets[] = { |
2725
775e3e14ca46
(svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents:
2635
diff
changeset
|
28 |
{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
29 |
{ WWT_CAPTION, RESIZE_RIGHT, 13, 11, 433, 0, 13, STR_00B0_MAP, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
30 |
{ WWT_STICKYBOX, RESIZE_LR, 13, 434, 445, 0, 13, 0x0, STR_STICKY_BUTTON}, |
2907
8adea2bdec1d
(svn r3462) - Fix: a one-off pixel alignment in the minimap window that "overflowed" its panel in the tropical climate (qball should be satisfied now)
Darkvater
parents:
2725
diff
changeset
|
31 |
{ WWT_PANEL, RESIZE_RB, 13, 0, 445, 14, 257, 0x0, STR_NULL}, |
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
32 |
{ WWT_6, RESIZE_RB, 13, 2, 443, 16, 255, 0x0, STR_NULL}, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
33 |
{ WWT_IMGBTN, RESIZE_LRTB, 13, 380, 401, 258, 279, SPR_IMG_SHOW_COUNTOURS, STR_0191_SHOW_LAND_CONTOURS_ON_MAP}, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
34 |
{ WWT_IMGBTN, RESIZE_LRTB, 13, 402, 423, 258, 279, SPR_IMG_SHOW_VEHICLES, STR_0192_SHOW_VEHICLES_ON_MAP}, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
35 |
{ WWT_IMGBTN, RESIZE_LRTB, 13, 424, 445, 258, 279, SPR_IMG_INDUSTRY, STR_0193_SHOW_INDUSTRIES_ON_MAP}, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
36 |
{ WWT_IMGBTN, RESIZE_LRTB, 13, 380, 401, 280, 301, SPR_IMG_SHOW_ROUTES, STR_0194_SHOW_TRANSPORT_ROUTES_ON}, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
37 |
{ WWT_IMGBTN, RESIZE_LRTB, 13, 402, 423, 280, 301, SPR_IMG_PLANTTREES, STR_0195_SHOW_VEGETATION_ON_MAP}, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
38 |
{ WWT_IMGBTN, RESIZE_LRTB, 13, 424, 445, 280, 301, SPR_IMG_COMPANY_GENERAL, STR_0196_SHOW_LAND_OWNERS_ON_MAP}, |
4339
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
39 |
{ WWT_IMGBTN, RESIZE_LRTB, 13, 358, 379, 258, 279, SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER}, |
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
40 |
{ WWT_IMGBTN, RESIZE_LRTB, 13, 358, 379, 280, 301, SPR_IMG_TOWN, STR_0197_TOGGLE_TOWN_NAMES_ON_OFF}, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
41 |
{ WWT_IMGBTN, RESIZE_RTB, 13, 0, 357, 258, 301, 0x0, STR_NULL}, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
42 |
{ WWT_PANEL, RESIZE_RTB, 13, 0, 433, 302, 313, 0x0, STR_NULL}, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
43 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 13, 434, 445, 302, 313, 0x0, STR_RESIZE_BUTTON}, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
44 |
{ WIDGETS_END}, |
0 | 45 |
}; |
46 |
||
47 |
static int _smallmap_type; |
|
48 |
static bool _smallmap_show_towns = true; |
|
49 |
||
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
50 |
#define MK(a,b) a, b |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
51 |
#define MKEND() 0xFFFF |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
52 |
#define MS(a,b) (a | 0x100), b |
0 | 53 |
|
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
54 |
/* Legend text giving the colours to look for on the minimap */ |
0 | 55 |
static const uint16 _legend_land_contours[] = { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
56 |
MK(0x5A, STR_00F0_100M), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
57 |
MK(0x5C, STR_00F1_200M), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
58 |
MK(0x5E, STR_00F2_300M), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
59 |
MK(0x1F, STR_00F3_400M), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
60 |
MK(0x27, STR_00F4_500M), |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
61 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
62 |
MS(0xD7, STR_00EB_ROADS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
63 |
MK(0x0A, STR_00EC_RAILROADS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
64 |
MK(0x98, STR_00ED_STATIONS_AIRPORTS_DOCKS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
65 |
MK(0xB5, STR_00EE_BUILDINGS_INDUSTRIES), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
66 |
MK(0x0F, STR_00EF_VEHICLES), |
0 | 67 |
MKEND() |
68 |
}; |
|
69 |
||
70 |
static const uint16 _legend_vehicles[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
71 |
MK(0xB8, STR_00F5_TRAINS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
72 |
MK(0xBF, STR_00F6_ROAD_VEHICLES), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
73 |
MK(0x98, STR_00F7_SHIPS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
74 |
MK(0x0F, STR_00F8_AIRCRAFT), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
75 |
MS(0xD7, STR_00F9_TRANSPORT_ROUTES), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
76 |
MK(0xB5, STR_00EE_BUILDINGS_INDUSTRIES), |
0 | 77 |
MKEND() |
78 |
}; |
|
79 |
||
80 |
static const uint16 _legend_industries_normal[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
81 |
MK(0xD7, STR_00FA_COAL_MINE), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
82 |
MK(0xB8, STR_00FB_POWER_STATION), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
83 |
MK(0x56, STR_00FC_FOREST), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
84 |
MK(0xC2, STR_00FD_SAWMILL), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
85 |
MK(0xBF, STR_00FE_OIL_REFINERY), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
86 |
MK(0x0F, STR_0105_BANK), |
0 | 87 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
88 |
MS(0x30, STR_00FF_FARM), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
89 |
MK(0xAE, STR_0100_FACTORY), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
90 |
MK(0x98, STR_0102_OIL_WELLS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
91 |
MK(0x37, STR_0103_IRON_ORE_MINE), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
92 |
MK(0x0A, STR_0104_STEEL_MILL), |
0 | 93 |
MKEND() |
94 |
}; |
|
95 |
||
96 |
static const uint16 _legend_industries_hilly[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
97 |
MK(0xD7, STR_00FA_COAL_MINE), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
98 |
MK(0xB8, STR_00FB_POWER_STATION), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
99 |
MK(0x56, STR_00FC_FOREST), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
100 |
MK(0x0A, STR_0106_PAPER_MILL), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
101 |
MK(0xBF, STR_00FE_OIL_REFINERY), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
102 |
MK(0x37, STR_0108_FOOD_PROCESSING_PLANT), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
103 |
MS(0x30, STR_00FF_FARM), |
0 | 104 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
105 |
MK(0xAE, STR_0101_PRINTING_WORKS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
106 |
MK(0x98, STR_0102_OIL_WELLS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
107 |
MK(0xC2, STR_0107_GOLD_MINE), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
108 |
MK(0x0F, STR_0105_BANK), |
0 | 109 |
MKEND() |
110 |
}; |
|
111 |
||
112 |
static const uint16 _legend_industries_desert[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
113 |
MK(0xBF, STR_00FE_OIL_REFINERY), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
114 |
MK(0x98, STR_0102_OIL_WELLS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
115 |
MK(0x0F, STR_0105_BANK), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
116 |
MK(0xB8, STR_0109_DIAMOND_MINE), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
117 |
MK(0x37, STR_0108_FOOD_PROCESSING_PLANT), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
118 |
MK(0x0A, STR_010A_COPPER_ORE_MINE), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
119 |
MK(0x30, STR_00FF_FARM), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
120 |
MS(0x56, STR_010B_FRUIT_PLANTATION), |
0 | 121 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
122 |
MK(0x27, STR_010C_RUBBER_PLANTATION), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
123 |
MK(0x25, STR_010D_WATER_SUPPLY), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
124 |
MK(0xD0, STR_010E_WATER_TOWER), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
125 |
MK(0xAE, STR_0100_FACTORY), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
126 |
MK(0xC2, STR_010F_LUMBER_MILL), |
0 | 127 |
MKEND() |
128 |
}; |
|
129 |
||
130 |
static const uint16 _legend_industries_candy[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
131 |
MK(0x30, STR_0110_COTTON_CANDY_FOREST), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
132 |
MK(0xAE, STR_0111_CANDY_FACTORY), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
133 |
MK(0x27, STR_0112_BATTERY_FARM), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
134 |
MK(0x37, STR_0113_COLA_WELLS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
135 |
MK(0xD0, STR_0114_TOY_SHOP), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
136 |
MK(0x0A, STR_0115_TOY_FACTORY), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
137 |
MS(0x25, STR_0116_PLASTIC_FOUNTAINS), |
0 | 138 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
139 |
MK(0xB8, STR_0117_FIZZY_DRINK_FACTORY), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
140 |
MK(0x98, STR_0118_BUBBLE_GENERATOR), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
141 |
MK(0xC2, STR_0119_TOFFEE_QUARRY), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
142 |
MK(0x0F, STR_011A_SUGAR_MINE), |
0 | 143 |
MKEND() |
144 |
}; |
|
145 |
||
146 |
static const uint16 _legend_routes[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
147 |
MK(0xD7, STR_00EB_ROADS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
148 |
MK(0x0A, STR_00EC_RAILROADS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
149 |
MK(0xB5, STR_00EE_BUILDINGS_INDUSTRIES), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
150 |
MS(0x56, STR_011B_RAILROAD_STATION), |
0 | 151 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
152 |
MK(0xC2, STR_011C_TRUCK_LOADING_BAY), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
153 |
MK(0xBF, STR_011D_BUS_STATION), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
154 |
MK(0xB8, STR_011E_AIRPORT_HELIPORT), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
155 |
MK(0x98, STR_011F_DOCK), |
0 | 156 |
MKEND() |
157 |
}; |
|
158 |
||
159 |
static const uint16 _legend_vegetation[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
160 |
MK(0x52, STR_0120_ROUGH_LAND), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
161 |
MK(0x54, STR_0121_GRASS_LAND), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
162 |
MK(0x37, STR_0122_BARE_LAND), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
163 |
MK(0x25, STR_0123_FIELDS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
164 |
MK(0x57, STR_0124_TREES), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
165 |
MK(0xD0, STR_00FC_FOREST), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
166 |
MS(0x0A, STR_0125_ROCKS), |
0 | 167 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
168 |
MK(0xC2, STR_012A_DESERT), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
169 |
MK(0x98, STR_012B_SNOW), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
170 |
MK(0xD7, STR_00F9_TRANSPORT_ROUTES), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
171 |
MK(0xB5, STR_00EE_BUILDINGS_INDUSTRIES), |
0 | 172 |
MKEND() |
173 |
}; |
|
174 |
||
175 |
static const uint16 _legend_land_owners[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
176 |
MK(0xCA, STR_0126_WATER), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
177 |
MK(0x54, STR_0127_NO_OWNER), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
178 |
MK(0xB4, STR_0128_TOWNS), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
179 |
MK(0x20, STR_0129_INDUSTRIES), |
0 | 180 |
MKEND() |
181 |
}; |
|
182 |
#undef MK |
|
183 |
#undef MS |
|
184 |
#undef MKEND |
|
185 |
||
186 |
||
187 |
enum { IND_OFFS = 6 }; |
|
188 |
static const uint16 * const _legend_table[] = { |
|
189 |
_legend_land_contours, |
|
190 |
_legend_vehicles, |
|
191 |
NULL, |
|
192 |
_legend_routes, |
|
193 |
_legend_vegetation, |
|
194 |
_legend_land_owners, |
|
195 |
||
196 |
_legend_industries_normal, |
|
197 |
_legend_industries_hilly, |
|
198 |
_legend_industries_desert, |
|
199 |
_legend_industries_candy, |
|
200 |
}; |
|
201 |
||
2966
661554d683cd
(svn r3529) - Fix: [ 1415782 ] crash in string code with openbsd/zaurus; alignment issues (thanks Tron for the help)
Darkvater
parents:
2955
diff
changeset
|
202 |
#if defined(OTTD_ALIGNMENT) |
2062 | 203 |
static inline void WRITE_PIXELS(Pixel* d, uint32 val) |
0 | 204 |
{ |
205 |
# if defined(TTD_BIG_ENDIAN) |
|
2635 | 206 |
d[0] = GB(val, 24, 8); |
207 |
d[1] = GB(val, 16, 8); |
|
208 |
d[2] = GB(val, 8, 8); |
|
209 |
d[3] = GB(val, 0, 8); |
|
0 | 210 |
# elif defined(TTD_LITTLE_ENDIAN) |
2635 | 211 |
d[0] = GB(val, 0, 8); |
212 |
d[1] = GB(val, 8, 8); |
|
213 |
d[2] = GB(val, 16, 8); |
|
214 |
d[3] = GB(val, 24, 8); |
|
0 | 215 |
# endif |
216 |
} |
|
217 |
||
218 |
/* need to use OR, otherwise we will overwrite the wrong pixels at the edges :( */ |
|
4171 | 219 |
static inline void WRITE_PIXELS_OR(Pixel *d, uint32 val) |
0 | 220 |
{ |
221 |
# if defined(TTD_BIG_ENDIAN) |
|
2635 | 222 |
d[0] |= GB(val, 24, 8); |
223 |
d[1] |= GB(val, 16, 8); |
|
224 |
d[2] |= GB(val, 8, 8); |
|
225 |
d[3] |= GB(val, 0, 8); |
|
0 | 226 |
# elif defined(TTD_LITTLE_ENDIAN) |
2635 | 227 |
d[0] |= GB(val, 0, 8); |
228 |
d[1] |= GB(val, 8, 8); |
|
229 |
d[2] |= GB(val, 16, 8); |
|
230 |
d[3] |= GB(val, 24, 8); |
|
0 | 231 |
# endif |
232 |
} |
|
233 |
#else |
|
234 |
# define WRITE_PIXELS(dst, val) *(uint32*)(dst) = (val); |
|
235 |
# define WRITE_PIXELS_OR(dst,val) *(uint32*)(dst) |= (val); |
|
236 |
#endif |
|
237 |
||
2984
f9d92e013486
(svn r3559) - CodeChange: simplify MKCOLOR(x) macro for smallmap_gui.c by adding a TO_LE32X() macro next to TO_BE32X(). The 'X' signifies them as macros and not-inline functions so they can be used in variable declarations.
Darkvater
parents:
2981
diff
changeset
|
238 |
#define MKCOLOR(x) TO_LE32X(x) |
0 | 239 |
|
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
240 |
/* Height encodings; 16 levels XXX - needs updating for more/finer heights! */ |
0 | 241 |
static const uint32 _map_height_bits[16] = { |
242 |
MKCOLOR(0x5A5A5A5A), |
|
243 |
MKCOLOR(0x5A5B5A5B), |
|
244 |
MKCOLOR(0x5B5B5B5B), |
|
245 |
MKCOLOR(0x5B5C5B5C), |
|
246 |
MKCOLOR(0x5C5C5C5C), |
|
247 |
MKCOLOR(0x5C5D5C5D), |
|
248 |
MKCOLOR(0x5D5D5D5D), |
|
249 |
MKCOLOR(0x5D5E5D5E), |
|
250 |
MKCOLOR(0x5E5E5E5E), |
|
251 |
MKCOLOR(0x5E5F5E5F), |
|
252 |
MKCOLOR(0x5F5F5F5F), |
|
253 |
MKCOLOR(0x5F1F5F1F), |
|
254 |
MKCOLOR(0x1F1F1F1F), |
|
255 |
MKCOLOR(0x1F271F27), |
|
256 |
MKCOLOR(0x27272727), |
|
257 |
MKCOLOR(0x27272727), |
|
258 |
}; |
|
259 |
||
1511
5917a04566df
(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 |
typedef struct AndOr { |
5917a04566df
(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 |
uint32 mor; |
5917a04566df
(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 |
uint32 mand; |
5917a04566df
(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 |
} AndOr; |
5917a04566df
(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
|
264 |
|
4171 | 265 |
static inline uint32 ApplyMask(uint32 colour, const AndOr *mask) |
1511
5917a04566df
(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
|
266 |
{ |
5917a04566df
(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
|
267 |
return (colour & mask->mand) | mask->mor; |
5917a04566df
(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
|
268 |
} |
5917a04566df
(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
|
269 |
|
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
270 |
|
1511
5917a04566df
(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
|
271 |
static const AndOr _smallmap_contours_andor[] = { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
272 |
{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
273 |
{MKCOLOR(0x000A0A00), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
274 |
{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
275 |
{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
276 |
{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
277 |
{MKCOLOR(0x98989898), MKCOLOR(0x00000000)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
278 |
{MKCOLOR(0xCACACACA), MKCOLOR(0x00000000)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
279 |
{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
280 |
{MKCOLOR(0xB5B5B5B5), MKCOLOR(0x00000000)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
281 |
{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
282 |
{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
283 |
{MKCOLOR(0x000A0A00), MKCOLOR(0xFF0000FF)}, |
0 | 284 |
}; |
285 |
||
1511
5917a04566df
(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
|
286 |
static const AndOr _smallmap_vehicles_andor[] = { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
287 |
{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
288 |
{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
289 |
{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
290 |
{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
291 |
{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
292 |
{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
293 |
{MKCOLOR(0xCACACACA), MKCOLOR(0x00000000)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
294 |
{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
295 |
{MKCOLOR(0xB5B5B5B5), MKCOLOR(0x00000000)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
296 |
{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
297 |
{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
298 |
{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, |
0 | 299 |
}; |
300 |
||
1511
5917a04566df
(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
|
301 |
static const AndOr _smallmap_vegetation_andor[] = { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
302 |
{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
303 |
{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
304 |
{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
305 |
{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
306 |
{MKCOLOR(0x00575700), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
307 |
{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
308 |
{MKCOLOR(0xCACACACA), MKCOLOR(0x00000000)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
309 |
{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
310 |
{MKCOLOR(0xB5B5B5B5), MKCOLOR(0x00000000)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
311 |
{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
312 |
{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
313 |
{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, |
0 | 314 |
}; |
315 |
||
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
316 |
typedef uint32 GetSmallMapPixels(TileIndex tile); // typedef callthrough function |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
317 |
|
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
318 |
/** |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
319 |
* Draws one column of the small map in a certain mode onto the screen buffer. This |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
320 |
* function looks exactly the same for all types |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
321 |
* |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
322 |
* @param dst Pointer to a part of the screen buffer to write to. |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
323 |
* @param xc The X coordinate of the first tile in the column. |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
324 |
* @param yc The Y coordinate of the first tile in the column |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
325 |
* @param pitch Number of pixels to advance in the screen buffer each time a pixel is written. |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
326 |
* @param reps Number of lines to draw |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
327 |
* @param mask ? |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
328 |
* @param proc Pointer to the colour function |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
329 |
* @see GetSmallMapPixels(TileIndex) |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
330 |
*/ |
2062 | 331 |
static void DrawSmallMapStuff(Pixel *dst, uint xc, uint yc, int pitch, int reps, uint32 mask, GetSmallMapPixels *proc) |
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
332 |
{ |
2062 | 333 |
Pixel *dst_ptr_end = _screen.dst_ptr + _screen.width * _screen.height - _screen.width; |
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
334 |
|
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
335 |
do { |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
336 |
// check if the tile (xc,yc) is within the map range |
1919
ca41cc314d40
(svn r2425) - Fix (regression): wrong sprite for level-land cursor (thx Tron)
Darkvater
parents:
1918
diff
changeset
|
337 |
if (xc < MapMaxX() && yc < MapMaxY()) { |
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
338 |
// check if the dst pointer points to a pixel inside the screen buffer |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
339 |
if (dst > _screen.dst_ptr && dst < dst_ptr_end) |
1981 | 340 |
WRITE_PIXELS_OR(dst, proc(TileXY(xc, yc)) & mask); |
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
341 |
} |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
342 |
// switch to next tile in the column |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
343 |
} while (xc++, yc++, dst += pitch, --reps != 0); |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
344 |
} |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
345 |
|
1516
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
346 |
|
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
347 |
static inline TileType GetEffectiveTileType(TileIndex tile) |
0 | 348 |
{ |
1516
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
349 |
TileType t = GetTileType(tile); |
0 | 350 |
|
351 |
if (t == MP_TUNNELBRIDGE) { |
|
3180
9c87ee130147
(svn r3820) Be a bit more strict with types: use special types instead of generic byte and don't fill arbitrary data into inappropriate types
tron
parents:
3144
diff
changeset
|
352 |
TransportType tt; |
9c87ee130147
(svn r3820) Be a bit more strict with types: use special types instead of generic byte and don't fill arbitrary data into inappropriate types
tron
parents:
3144
diff
changeset
|
353 |
|
3184
118a520164e4
(svn r3830) Move IsTunnelTile() from tile.h to tunnel_map.h and add IsTunnel(), which just checks for a tunnel, but not the tile type as IsTunnelTile() does
tron
parents:
3180
diff
changeset
|
354 |
if (IsTunnel(tile)) { |
118a520164e4
(svn r3830) Move IsTunnelTile() from tile.h to tunnel_map.h and add IsTunnel(), which just checks for a tunnel, but not the tile type as IsTunnelTile() does
tron
parents:
3180
diff
changeset
|
355 |
tt = GetTunnelTransportType(tile); |
118a520164e4
(svn r3830) Move IsTunnelTile() from tile.h to tunnel_map.h and add IsTunnel(), which just checks for a tunnel, but not the tile type as IsTunnelTile() does
tron
parents:
3180
diff
changeset
|
356 |
} else { |
3234
a2791a480b71
(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents:
3184
diff
changeset
|
357 |
tt = GetBridgeTransportType(tile); |
3180
9c87ee130147
(svn r3820) Be a bit more strict with types: use special types instead of generic byte and don't fill arbitrary data into inappropriate types
tron
parents:
3144
diff
changeset
|
358 |
} |
9c87ee130147
(svn r3820) Be a bit more strict with types: use special types instead of generic byte and don't fill arbitrary data into inappropriate types
tron
parents:
3144
diff
changeset
|
359 |
switch (tt) { |
9c87ee130147
(svn r3820) Be a bit more strict with types: use special types instead of generic byte and don't fill arbitrary data into inappropriate types
tron
parents:
3144
diff
changeset
|
360 |
case TRANSPORT_RAIL: t = MP_RAILWAY; break; |
9c87ee130147
(svn r3820) Be a bit more strict with types: use special types instead of generic byte and don't fill arbitrary data into inappropriate types
tron
parents:
3144
diff
changeset
|
361 |
case TRANSPORT_ROAD: t = MP_STREET; break; |
9c87ee130147
(svn r3820) Be a bit more strict with types: use special types instead of generic byte and don't fill arbitrary data into inappropriate types
tron
parents:
3144
diff
changeset
|
362 |
default: t = MP_WATER; break; |
0 | 363 |
} |
364 |
} |
|
1516
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
365 |
return t; |
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
366 |
} |
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
367 |
|
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
368 |
/** |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
369 |
* Return the color a tile would be displayed with in the small map in mode "Contour". |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
370 |
* @param tile The tile of which we would like to get the color. |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
371 |
* @return The color of tile in the small map in mode "Contour" |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
372 |
*/ |
1516
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
373 |
static inline uint32 GetSmallMapContoursPixels(TileIndex tile) |
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
374 |
{ |
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
375 |
TileType t = GetEffectiveTileType(tile); |
0 | 376 |
|
1511
5917a04566df
(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
|
377 |
return |
5917a04566df
(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
|
378 |
ApplyMask(_map_height_bits[TileHeight(tile)], &_smallmap_contours_andor[t]); |
0 | 379 |
} |
380 |
||
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
381 |
/** |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
382 |
* Return the color a tile would be displayed with in the small map in mode "Vehicles". |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
383 |
* |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
384 |
* @param t The tile of which we would like to get the color. |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
385 |
* @return The color of tile in the small map in mode "Vehicles" |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
386 |
*/ |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
387 |
static inline uint32 GetSmallMapVehiclesPixels(TileIndex tile) |
0 | 388 |
{ |
1516
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
389 |
TileType t = GetEffectiveTileType(tile); |
0 | 390 |
|
1511
5917a04566df
(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
|
391 |
return ApplyMask(MKCOLOR(0x54545454), &_smallmap_vehicles_andor[t]); |
0 | 392 |
} |
393 |
||
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
394 |
/* Industry colours... a total of 175 gfx - XXX - increase if more industries */ |
0 | 395 |
static const byte _industry_smallmap_colors[175] = { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
396 |
215, 215, 215, 215, 215, 215, 215, 184, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
397 |
184, 184, 184, 194, 194, 194, 194, 194, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
398 |
86, 86, 191, 191, 191, 191, 191, 191, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
399 |
152, 152, 152, 152, 152, 152, 152, 152, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
400 |
152, 48, 48, 48, 48, 48, 48, 174, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
401 |
174, 174, 174, 174, 174, 174, 174, 10, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
402 |
10, 10, 10, 10, 10, 10, 10, 10, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
403 |
10, 10, 15, 15, 55, 55, 55, 55, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
404 |
10, 10, 10, 10, 10, 10, 10, 10, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
405 |
194, 194, 194, 194, 194, 194, 194, 194, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
406 |
194, 194, 194, 194, 194, 194, 194, 194, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
407 |
194, 15, 15, 184, 184, 184, 184, 184, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
408 |
184, 184, 184, 184, 55, 55, 55, 55, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
409 |
55, 55, 55, 55, 55, 55, 55, 55, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
410 |
55, 55, 55, 55, 86, 39, 37, 37, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
411 |
208, 174, 174, 174, 174, 194, 194, 194, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
412 |
194, 48, 48, 174, 174, 174, 174, 39, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
413 |
39, 55, 208, 208, 208, 208, 10, 10, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
414 |
10, 10, 10, 10, 37, 37, 37, 37, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
415 |
37, 37, 37, 37, 184, 184, 184, 184, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
416 |
152, 152, 152, 152, 194, 194, 194, 15, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
417 |
15, 15, 15, 15, 15, 15, 15, |
0 | 418 |
}; |
419 |
||
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
420 |
/** |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
421 |
* Return the color a tile would be displayed with in the small map in mode "Industries". |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
422 |
* |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
423 |
* @param tile The tile of which we would like to get the color. |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
424 |
* @return The color of tile in the small map in mode "Industries" |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
425 |
*/ |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
426 |
static inline uint32 GetSmallMapIndustriesPixels(TileIndex tile) |
0 | 427 |
{ |
1516
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
428 |
TileType t = GetEffectiveTileType(tile); |
0 | 429 |
|
430 |
if (t == MP_INDUSTRY) { |
|
3391
3c8a6643ed15
(svn r4199) - Codechange: Use industry map accessors to get industry graphics type.
peter1138
parents:
3338
diff
changeset
|
431 |
byte color = _industry_smallmap_colors[GetIndustryGfx(tile)]; |
0 | 432 |
return color + (color << 8) + (color << 16) + (color << 24); |
433 |
} |
|
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
434 |
|
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
435 |
return ApplyMask(MKCOLOR(0x54545454), &_smallmap_vehicles_andor[t]); |
0 | 436 |
} |
437 |
||
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
438 |
/** |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
439 |
* Return the color a tile would be displayed with in the small map in mode "Routes". |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
440 |
* |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
441 |
* @param t The tile of which we would like to get the color. |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
442 |
* @return The color of tile in the small map in mode "Routes" |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
443 |
*/ |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
444 |
static inline uint32 GetSmallMapRoutesPixels(TileIndex tile) |
0 | 445 |
{ |
1516
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
446 |
TileType t = GetEffectiveTileType(tile); |
0 | 447 |
uint32 bits; |
448 |
||
449 |
if (t == MP_STATION) { |
|
3338
7cff208f0446
(svn r4120) Use the new station functions where appropriate
tron
parents:
3326
diff
changeset
|
450 |
switch (GetStationType(tile)) { |
7cff208f0446
(svn r4120) Use the new station functions where appropriate
tron
parents:
3326
diff
changeset
|
451 |
case STATION_RAIL: bits = MKCOLOR(0x56565656); break; |
7cff208f0446
(svn r4120) Use the new station functions where appropriate
tron
parents:
3326
diff
changeset
|
452 |
case STATION_AIRPORT: bits = MKCOLOR(0xB8B8B8B8); break; |
7cff208f0446
(svn r4120) Use the new station functions where appropriate
tron
parents:
3326
diff
changeset
|
453 |
case STATION_TRUCK: bits = MKCOLOR(0xC2C2C2C2); break; |
7cff208f0446
(svn r4120) Use the new station functions where appropriate
tron
parents:
3326
diff
changeset
|
454 |
case STATION_BUS: bits = MKCOLOR(0xBFBFBFBF); break; |
7cff208f0446
(svn r4120) Use the new station functions where appropriate
tron
parents:
3326
diff
changeset
|
455 |
case STATION_DOCK: bits = MKCOLOR(0x98989898); break; |
7cff208f0446
(svn r4120) Use the new station functions where appropriate
tron
parents:
3326
diff
changeset
|
456 |
default: bits = MKCOLOR(0xFFFFFFFF); break; |
7cff208f0446
(svn r4120) Use the new station functions where appropriate
tron
parents:
3326
diff
changeset
|
457 |
} |
0 | 458 |
} else { |
459 |
// ground color |
|
1511
5917a04566df
(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
|
460 |
bits = ApplyMask(MKCOLOR(0x54545454), &_smallmap_contours_andor[t]); |
0 | 461 |
} |
462 |
return bits; |
|
463 |
} |
|
464 |
||
465 |
||
2955
24de69e236d2
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
466 |
static const uint32 _vegetation_clear_bits[] = { |
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
467 |
MKCOLOR(0x54545454), ///< full grass |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
468 |
MKCOLOR(0x52525252), ///< rough land |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
469 |
MKCOLOR(0x0A0A0A0A), ///< rocks |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
470 |
MKCOLOR(0x25252525), ///< fields |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
471 |
MKCOLOR(0x98989898), ///< snow |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
472 |
MKCOLOR(0xC2C2C2C2), ///< desert |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
473 |
MKCOLOR(0x54545454), ///< unused |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
474 |
MKCOLOR(0x54545454), ///< unused |
0 | 475 |
}; |
476 |
||
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
477 |
static inline uint32 GetSmallMapVegetationPixels(TileIndex tile) |
0 | 478 |
{ |
1516
dc914162ad01
(svn r2020) Reduce code duplication in the minimap code a bit
tron
parents:
1515
diff
changeset
|
479 |
TileType t = GetEffectiveTileType(tile); |
0 | 480 |
uint32 bits; |
481 |
||
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
482 |
switch (t) { |
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
483 |
case MP_CLEAR: |
3447 | 484 |
if (IsClearGround(tile, CLEAR_GRASS) && GetClearDensity(tile) < 3) { |
2955
24de69e236d2
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
485 |
bits = MKCOLOR(0x37373737); |
24de69e236d2
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
486 |
} else { |
24de69e236d2
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
487 |
bits = _vegetation_clear_bits[GetClearGround(tile)]; |
24de69e236d2
(svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
2952
diff
changeset
|
488 |
} |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
489 |
break; |
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
490 |
|
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
491 |
case MP_INDUSTRY: |
3499
92f95849788c
(svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents:
3447
diff
changeset
|
492 |
bits = GetIndustryType(tile) == IT_FOREST ? MKCOLOR(0xD0D0D0D0) : MKCOLOR(0xB5B5B5B5); |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
493 |
break; |
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
494 |
|
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
495 |
case MP_TREES: |
3441
fead68bcb6a3
(svn r4271) s/\<TR_/TREE_/ resp. s/\<TR_/TREE_GROUND/
tron
parents:
3421
diff
changeset
|
496 |
if (GetTreeGround(tile) == TREE_GROUND_SNOW_DESERT) { |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
497 |
bits = (_opt.landscape == LT_HILLY) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2); |
2951 | 498 |
} else { |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
499 |
bits = MKCOLOR(0x54575754); |
2951 | 500 |
} |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
501 |
break; |
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
502 |
|
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
503 |
default: |
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
504 |
bits = ApplyMask(MKCOLOR(0x54545454), &_smallmap_vehicles_andor[t]); |
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
505 |
break; |
0 | 506 |
} |
507 |
||
508 |
return bits; |
|
509 |
} |
|
510 |
||
511 |
||
1092 | 512 |
static uint32 _owner_colors[256]; |
0 | 513 |
|
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
514 |
/** |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
515 |
* Return the color a tile would be displayed with in the small map in mode "Owner". |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
516 |
* |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
517 |
* @param t The tile of which we would like to get the color. |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
518 |
* @return The color of tile in the small map in mode "Owner" |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
519 |
*/ |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
520 |
static inline uint32 GetSmallMapOwnerPixels(TileIndex tile) |
0 | 521 |
{ |
2368
cb44b5c6953d
(svn r2894) Simplify colouring in owner-mode in the minimap regarding towns and get rid of some magic numbers
tron
parents:
2332
diff
changeset
|
522 |
Owner o; |
0 | 523 |
|
2368
cb44b5c6953d
(svn r2894) Simplify colouring in owner-mode in the minimap regarding towns and get rid of some magic numbers
tron
parents:
2332
diff
changeset
|
524 |
switch (GetTileType(tile)) { |
cb44b5c6953d
(svn r2894) Simplify colouring in owner-mode in the minimap regarding towns and get rid of some magic numbers
tron
parents:
2332
diff
changeset
|
525 |
case MP_INDUSTRY: o = OWNER_SPECTATOR; break; |
cb44b5c6953d
(svn r2894) Simplify colouring in owner-mode in the minimap regarding towns and get rid of some magic numbers
tron
parents:
2332
diff
changeset
|
526 |
case MP_HOUSE: o = OWNER_TOWN; break; |
cb44b5c6953d
(svn r2894) Simplify colouring in owner-mode in the minimap regarding towns and get rid of some magic numbers
tron
parents:
2332
diff
changeset
|
527 |
default: o = GetTileOwner(tile); break; |
0 | 528 |
} |
529 |
||
2368
cb44b5c6953d
(svn r2894) Simplify colouring in owner-mode in the minimap regarding towns and get rid of some magic numbers
tron
parents:
2332
diff
changeset
|
530 |
return _owner_colors[o]; |
0 | 531 |
} |
532 |
||
533 |
||
534 |
static const uint32 _smallmap_mask_left[3] = { |
|
535 |
MKCOLOR(0xFF000000), |
|
536 |
MKCOLOR(0xFFFF0000), |
|
537 |
MKCOLOR(0xFFFFFF00), |
|
538 |
}; |
|
539 |
||
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
540 |
static const uint32 _smallmap_mask_right[] = { |
0 | 541 |
MKCOLOR(0x000000FF), |
542 |
MKCOLOR(0x0000FFFF), |
|
543 |
MKCOLOR(0x00FFFFFF), |
|
544 |
}; |
|
545 |
||
546 |
/* each tile has 4 x pixels and 1 y pixel */ |
|
547 |
||
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
548 |
static GetSmallMapPixels *_smallmap_draw_procs[] = { |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
549 |
GetSmallMapContoursPixels, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
550 |
GetSmallMapVehiclesPixels, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
551 |
GetSmallMapIndustriesPixels, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
552 |
GetSmallMapRoutesPixels, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
553 |
GetSmallMapVegetationPixels, |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
554 |
GetSmallMapOwnerPixels, |
0 | 555 |
}; |
556 |
||
557 |
static const byte _vehicle_type_colors[6] = { |
|
558 |
184, 191, 152, 15, 215, 184 |
|
559 |
}; |
|
560 |
||
500
8e52f7797b48
(svn r793) Merge INLINE -> inline replacement (revision 376)
tron
parents:
337
diff
changeset
|
561 |
static inline uint32 dup_byte32(byte b) { |
0 | 562 |
return b + (b << 8) + (b << 16) + (b << 24); |
563 |
} |
|
564 |
||
565 |
static void DrawVertMapIndicator(int x, int y, int x2, int y2) |
|
566 |
{ |
|
2951 | 567 |
GfxFillRect(x, y, x2, y + 3, 69); |
568 |
GfxFillRect(x, y2 - 3, x2, y2, 69); |
|
0 | 569 |
} |
570 |
||
571 |
static void DrawHorizMapIndicator(int x, int y, int x2, int y2) |
|
572 |
{ |
|
2951 | 573 |
GfxFillRect(x, y, x + 3, y2, 69); |
574 |
GfxFillRect(x2 - 3, y, x2, y2, 69); |
|
0 | 575 |
} |
576 |
||
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
577 |
/** |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
578 |
* Draws the small map. |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
579 |
* |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
580 |
* Basically, the small map is draw column of pixels by column of pixels. The pixels |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
581 |
* are drawn directly into the screen buffer. The final map is drawn in multiple passes. |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
582 |
* The passes are: |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
583 |
* <ol><li>The colors of tiles in the different modes.</li> |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
584 |
* <li>Town names (optional)</li> |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
585 |
* |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
586 |
* @param dpi pointer to pixel to write onto |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
587 |
* @param w pointer to Window struct |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
588 |
* @param type type of map requested (vegetation, owners, routes, etc) |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
589 |
* @param show_towns true if the town names should be displayed, false if not. |
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
590 |
*/ |
0 | 591 |
static void DrawSmallMap(DrawPixelInfo *dpi, Window *w, int type, bool show_towns) |
592 |
{ |
|
593 |
DrawPixelInfo *old_dpi; |
|
594 |
int dx,dy, x, y, x2, y2; |
|
2062 | 595 |
Pixel *ptr; |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
596 |
int tile_x; |
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
597 |
int tile_y; |
0 | 598 |
ViewPort *vp; |
599 |
||
600 |
old_dpi = _cur_dpi; |
|
601 |
_cur_dpi = dpi; |
|
602 |
||
603 |
/* clear it */ |
|
604 |
GfxFillRect(dpi->left, dpi->top, dpi->left + dpi->width - 1, dpi->top + dpi->height - 1, 0); |
|
605 |
||
606 |
/* setup owner table */ |
|
607 |
if (type == 5) { |
|
4171 | 608 |
const Player *p; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
609 |
|
0 | 610 |
/* fill with some special colors */ |
2368
cb44b5c6953d
(svn r2894) Simplify colouring in owner-mode in the minimap regarding towns and get rid of some magic numbers
tron
parents:
2332
diff
changeset
|
611 |
_owner_colors[OWNER_TOWN] = MKCOLOR(0xB4B4B4B4); |
2332
73edb64097fb
(svn r2858) -Codechange: resolved some magic numbers (_Luca_)
truelight
parents:
2186
diff
changeset
|
612 |
_owner_colors[OWNER_NONE] = MKCOLOR(0x54545454); |
73edb64097fb
(svn r2858) -Codechange: resolved some magic numbers (_Luca_)
truelight
parents:
2186
diff
changeset
|
613 |
_owner_colors[OWNER_WATER] = MKCOLOR(0xCACACACA); |
73edb64097fb
(svn r2858) -Codechange: resolved some magic numbers (_Luca_)
truelight
parents:
2186
diff
changeset
|
614 |
_owner_colors[OWNER_SPECTATOR] = MKCOLOR(0x20202020); /* industry */ |
0 | 615 |
|
616 |
/* now fill with the player colors */ |
|
617 |
FOR_ALL_PLAYERS(p) { |
|
2951 | 618 |
if (p->is_active) { |
1092 | 619 |
_owner_colors[p->index] = |
3326
00cf690a7fe1
(svn r4092) CodeChange : Named sprites instead of magic numbers plus create/use helper macro/enum for recoloring scheme
belugas
parents:
3234
diff
changeset
|
620 |
dup_byte32(GetNonSprite(PALETTE_RECOLOR_START + p->player_color)[0xCB]); // XXX - magic pixel |
2951 | 621 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
622 |
} |
0 | 623 |
} |
624 |
||
3421
7968a4b5ff0a
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3391
diff
changeset
|
625 |
tile_x = WP(w,smallmap_d).scroll_x / TILE_SIZE; |
7968a4b5ff0a
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3391
diff
changeset
|
626 |
tile_y = WP(w,smallmap_d).scroll_y / TILE_SIZE; |
0 | 627 |
|
628 |
dx = dpi->left + WP(w,smallmap_d).subscroll; |
|
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
629 |
tile_x -= dx / 4; |
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
630 |
tile_y += dx / 4; |
0 | 631 |
dx &= 3; |
632 |
||
633 |
dy = dpi->top; |
|
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
634 |
tile_x += dy / 2; |
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
635 |
tile_y += dy / 2; |
0 | 636 |
|
637 |
if (dy & 1) { |
|
638 |
tile_x++; |
|
639 |
dx += 2; |
|
640 |
if (dx > 3) { |
|
641 |
dx -= 4; |
|
642 |
tile_x--; |
|
643 |
tile_y++; |
|
644 |
} |
|
645 |
} |
|
646 |
||
647 |
ptr = dpi->dst_ptr - dx - 4; |
|
648 |
x = - dx - 4; |
|
649 |
y = 0; |
|
650 |
||
2952 | 651 |
for (;;) { |
2989 | 652 |
uint32 mask = 0xFFFFFFFF; |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
653 |
int reps; |
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
654 |
int t; |
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
655 |
|
0 | 656 |
/* distance from left edge */ |
657 |
if (x < 0) { |
|
658 |
if (x < -3) goto skip_column; |
|
659 |
/* mask to use at the left edge */ |
|
660 |
mask = _smallmap_mask_left[x + 3]; |
|
661 |
} |
|
662 |
||
663 |
/* distance from right edge */ |
|
664 |
t = dpi->width - x; |
|
665 |
if (t < 4) { |
|
2951 | 666 |
if (t <= 0) break; /* exit loop */ |
0 | 667 |
/* mask to use at the right edge */ |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
668 |
mask &= _smallmap_mask_right[t - 1]; |
0 | 669 |
} |
670 |
||
671 |
/* number of lines */ |
|
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
672 |
reps = (dpi->height - y + 1) / 2; |
0 | 673 |
if (reps > 0) { |
674 |
// assert(ptr >= dpi->dst_ptr); |
|
4171 | 675 |
DrawSmallMapStuff(ptr, tile_x, tile_y, dpi->pitch * 2, reps, mask, _smallmap_draw_procs[type]); |
0 | 676 |
} |
677 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
678 |
skip_column: |
0 | 679 |
if (y == 0) { |
680 |
tile_y++; |
|
681 |
y++; |
|
682 |
ptr += dpi->pitch; |
|
683 |
} else { |
|
684 |
tile_x--; |
|
685 |
y--; |
|
686 |
ptr -= dpi->pitch; |
|
687 |
} |
|
688 |
ptr += 2; |
|
689 |
x += 2; |
|
690 |
} |
|
691 |
||
692 |
/* draw vehicles? */ |
|
693 |
if (type == 0 || type == 1) { |
|
694 |
Vehicle *v; |
|
695 |
bool skip; |
|
696 |
byte color; |
|
697 |
||
698 |
FOR_ALL_VEHICLES(v) { |
|
4346
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
699 |
if (v->type != VEH_Special && |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
700 |
(v->vehstatus & (VS_HIDDEN | VS_UNCLICKABLE)) == 0) { |
0 | 701 |
// Remap into flat coordinates. |
702 |
Point pt = RemapCoords( |
|
3421
7968a4b5ff0a
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3391
diff
changeset
|
703 |
(v->x_pos - WP(w,smallmap_d).scroll_x) / TILE_SIZE, |
7968a4b5ff0a
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3391
diff
changeset
|
704 |
(v->y_pos - WP(w,smallmap_d).scroll_y) / TILE_SIZE, |
0 | 705 |
0); |
706 |
x = pt.x; |
|
707 |
y = pt.y; |
|
708 |
||
709 |
// Check if y is out of bounds? |
|
710 |
y -= dpi->top; |
|
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
711 |
if (!IS_INT_INSIDE(y, 0, dpi->height)) continue; |
0 | 712 |
|
713 |
// Default is to draw both pixels. |
|
714 |
skip = false; |
|
715 |
||
716 |
// Offset X coordinate |
|
717 |
x -= WP(w,smallmap_d).subscroll + 3 + dpi->left; |
|
718 |
||
719 |
if (x < 0) { |
|
720 |
// if x+1 is 0, that means we're on the very left edge, |
|
721 |
// and should thus only draw a single pixel |
|
2951 | 722 |
if (++x != 0) continue; |
0 | 723 |
skip = true; |
724 |
} else if (x >= dpi->width - 1) { |
|
725 |
// Check if we're at the very right edge, and if so draw only a single pixel |
|
2951 | 726 |
if (x != dpi->width - 1) continue; |
0 | 727 |
skip = true; |
728 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
729 |
|
0 | 730 |
// Calculate pointer to pixel and the color |
731 |
ptr = dpi->dst_ptr + y * dpi->pitch + x; |
|
732 |
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
|
733 |
|
0 | 734 |
// And draw either one or two pixels depending on clipping |
735 |
ptr[0] = color; |
|
2951 | 736 |
if (!skip) ptr[1] = color; |
0 | 737 |
} |
738 |
} |
|
739 |
} |
|
740 |
||
741 |
if (show_towns) { |
|
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
742 |
const Town *t; |
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
743 |
|
0 | 744 |
FOR_ALL_TOWNS(t) { |
4346
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
745 |
// Remap the town coordinate |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
746 |
Point pt = RemapCoords( |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
747 |
(int)(TileX(t->xy) * TILE_SIZE - WP(w, smallmap_d).scroll_x) / TILE_SIZE, |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
748 |
(int)(TileY(t->xy) * TILE_SIZE - WP(w, smallmap_d).scroll_y) / TILE_SIZE, |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
749 |
0); |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
750 |
x = pt.x - WP(w,smallmap_d).subscroll + 3 - (t->sign.width_2 >> 1); |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
751 |
y = pt.y; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
752 |
|
4346
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
753 |
// Check if the town sign is within bounds |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
754 |
if (x + t->sign.width_2 > dpi->left && |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
755 |
x < dpi->left + dpi->width && |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
756 |
y + 6 > dpi->top && |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
757 |
y < dpi->top + dpi->height) { |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
758 |
// And draw it. |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
759 |
SetDParam(0, t->index); |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
760 |
DrawString(x, y, STR_2056, 12); |
0 | 761 |
} |
762 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
763 |
} |
0 | 764 |
|
765 |
// Draw map indicators |
|
766 |
{ |
|
767 |
Point pt; |
|
768 |
||
769 |
// Find main viewport. |
|
770 |
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
|
771 |
|
1515
071fe1565cb8
(svn r2019) Miscellaneous cleanups, like uint -> TileIndex, >> -> /, if cascade -> switch
tron
parents:
1511
diff
changeset
|
772 |
pt = RemapCoords(WP(w, smallmap_d).scroll_x, WP(w, smallmap_d).scroll_y, 0); |
0 | 773 |
|
774 |
x = vp->virtual_left - pt.x; |
|
775 |
y = vp->virtual_top - pt.y; |
|
3421
7968a4b5ff0a
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3391
diff
changeset
|
776 |
x2 = (x + vp->virtual_width) / TILE_SIZE; |
7968a4b5ff0a
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3391
diff
changeset
|
777 |
y2 = (y + vp->virtual_height) / TILE_SIZE; |
7968a4b5ff0a
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3391
diff
changeset
|
778 |
x /= TILE_SIZE; |
7968a4b5ff0a
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar
parents:
3391
diff
changeset
|
779 |
y /= TILE_SIZE; |
0 | 780 |
|
781 |
x -= WP(w,smallmap_d).subscroll; |
|
782 |
x2 -= WP(w,smallmap_d).subscroll; |
|
783 |
||
784 |
DrawVertMapIndicator(x, y, x, y2); |
|
785 |
DrawVertMapIndicator(x2, y, x2, y2); |
|
786 |
||
787 |
DrawHorizMapIndicator(x, y, x2, y); |
|
788 |
DrawHorizMapIndicator(x, y2, x2, y2); |
|
789 |
} |
|
790 |
_cur_dpi = old_dpi; |
|
791 |
} |
|
792 |
||
4339
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
793 |
void SmallMapCenterOnCurrentPos(Window *w) |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
794 |
{ |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
795 |
int x, y; |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
796 |
ViewPort *vp; |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
797 |
vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
798 |
|
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
799 |
x = ((vp->virtual_width - (w->widget[4].right - w->widget[4].left) * TILE_SIZE) / 2 + vp->virtual_left) / 4; |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
800 |
y = ((vp->virtual_height - (w->widget[4].bottom - w->widget[4].top ) * TILE_SIZE) / 2 + vp->virtual_top ) / 2 - TILE_SIZE * 2; |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
801 |
WP(w, smallmap_d).scroll_x = (y - x) & ~0xF; |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
802 |
WP(w, smallmap_d).scroll_y = (x + y) & ~0xF; |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
803 |
SetWindowDirty(w); |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
804 |
} |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
805 |
|
0 | 806 |
static void SmallMapWindowProc(Window *w, WindowEvent *e) |
807 |
{ |
|
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
808 |
switch (e->event) { |
0 | 809 |
case WE_PAINT: { |
810 |
const uint16 *tbl; |
|
811 |
int x,y,y_org; |
|
812 |
DrawPixelInfo new_dpi; |
|
813 |
||
814 |
/* draw the window */ |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
815 |
SetDParam(0, STR_00E5_CONTOURS + _smallmap_type); |
0 | 816 |
DrawWindowWidgets(w); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
817 |
|
0 | 818 |
/* draw the legend */ |
819 |
tbl = _legend_table[(_smallmap_type != 2) ? _smallmap_type : (_opt.landscape + IND_OFFS)]; |
|
820 |
x = 4; |
|
2907
8adea2bdec1d
(svn r3462) - Fix: a one-off pixel alignment in the minimap window that "overflowed" its panel in the tropical climate (qball should be satisfied now)
Darkvater
parents:
2725
diff
changeset
|
821 |
y_org = w->height - 44 - 11; |
0 | 822 |
y = y_org; |
2951 | 823 |
for (;;) { |
824 |
GfxFillRect(x, y + 1, x + 8, y + 5, 0); |
|
825 |
GfxFillRect(x + 1, y + 2, x + 7, y + 4, (byte)tbl[0]); |
|
826 |
DrawString(x + 11, y, tbl[1], 0); |
|
0 | 827 |
|
828 |
tbl += 2; |
|
829 |
y += 6; |
|
830 |
||
831 |
if (tbl[0] == 0xFFFF) { |
|
832 |
break; |
|
833 |
} else if (tbl[0] & 0x100) { |
|
834 |
x += 123; |
|
835 |
y = y_org; |
|
836 |
} |
|
837 |
} |
|
838 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
839 |
if (!FillDrawPixelInfo(&new_dpi, NULL, 3, 17, w->width - 28 + 22, w->height - 64 - 11)) |
0 | 840 |
return; |
841 |
||
842 |
DrawSmallMap(&new_dpi, w, _smallmap_type, _smallmap_show_towns); |
|
843 |
} break; |
|
844 |
||
845 |
case WE_CLICK: |
|
1918
fb72133270ac
(svn r2424) - Fix: backport the smallmap_gui.c changes from the map/ branch into trunk. This also implicitely fixes the bug where the game would crash in certain resolutions with certain minimap masks when dragged partly outside the game-area.
Darkvater
parents:
1901
diff
changeset
|
846 |
switch (e->click.widget) { |
4339
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
847 |
case 4: { // Map window |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
848 |
Window *w2 = FindWindowById(WC_MAIN_WINDOW, 0); |
0 | 849 |
Point pt; |
4339
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
850 |
int x, y; |
0 | 851 |
|
852 |
pt = RemapCoords(WP(w,smallmap_d).scroll_x, WP(w,smallmap_d).scroll_y, 0); |
|
4339
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
853 |
x = pt.x + ((_cursor.pos.x - w->left + 2) << 4) - (w2->viewport->virtual_width >> 1); |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
854 |
y = pt.y + ((_cursor.pos.y - w->top - 16) << 4) - (w2->viewport->virtual_height >> 1); |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
855 |
|
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
856 |
/* If you press twice on a place in the smallmap, center there */ |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
857 |
if (WP(w2, vp_d).scrollpos_x == x && WP(w2, vp_d).scrollpos_y == y) { |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
858 |
SmallMapCenterOnCurrentPos(w); |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
859 |
} else { |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
860 |
WP(w2, vp_d).scrollpos_x = x; |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
861 |
WP(w2, vp_d).scrollpos_y = y; |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
862 |
} |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
863 |
|
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
864 |
SetWindowDirty(w); |
0 | 865 |
} break; |
866 |
||
4339
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
867 |
case 5: // Show land contours |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
868 |
case 6: // Show vehicles |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
869 |
case 7: // Show industries |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
870 |
case 8: // Show transport routes |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
871 |
case 9: // Show vegetation |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
872 |
case 10: // Show land owners |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
873 |
w->click_state &= ~(1<<5|1<<6|1<<7|1<<8|1<<9|1<<10); |
0 | 874 |
w->click_state |= 1 << e->click.widget; |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
875 |
_smallmap_type = e->click.widget - 5; |
0 | 876 |
|
877 |
SetWindowDirty(w); |
|
541 | 878 |
SndPlayFx(SND_15_BEEP); |
0 | 879 |
break; |
880 |
||
4339
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
881 |
case 11: // Center the smallmap again |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
882 |
SmallMapCenterOnCurrentPos(w); |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
883 |
|
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
884 |
SetWindowDirty(w); |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
885 |
SndPlayFx(SND_15_BEEP); |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
886 |
break; |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
887 |
|
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
888 |
case 12: // Toggle town names |
758
423ae0bcba07
(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 |
w->click_state ^= (1 << 12); |
423ae0bcba07
(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 |
_smallmap_show_towns = (w->click_state >> 12) & 1; |
4339
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
891 |
|
0 | 892 |
SetWindowDirty(w); |
541 | 893 |
SndPlayFx(SND_15_BEEP); |
0 | 894 |
break; |
895 |
} |
|
896 |
break; |
|
897 |
||
898 |
case WE_RCLICK: |
|
867
dffd33233237
(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) { |
2951 | 900 |
if (_scrolling_viewport) return; |
0 | 901 |
_scrolling_viewport = true; |
902 |
_cursor.delta.x = 0; |
|
903 |
_cursor.delta.y = 0; |
|
904 |
} |
|
905 |
break; |
|
906 |
||
907 |
case WE_MOUSELOOP: |
|
908 |
/* update the window every now and then */ |
|
2951 | 909 |
if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w); |
0 | 910 |
break; |
4335
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
911 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
912 |
case WE_SCROLL: { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
913 |
int x; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
914 |
int y; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
915 |
int sub; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
916 |
int hx; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
917 |
int hy; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
918 |
int hvx; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
919 |
int hvy; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
920 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
921 |
_cursor.fix_at = true; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
922 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
923 |
x = WP(w, smallmap_d).scroll_x; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
924 |
y = WP(w, smallmap_d).scroll_y; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
925 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
926 |
sub = WP(w, smallmap_d).subscroll + e->scroll.delta.x; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
927 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
928 |
x -= (sub >> 2) << 4; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
929 |
y += (sub >> 2) << 4; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
930 |
sub &= 3; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
931 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
932 |
x += (e->scroll.delta.y >> 1) << 4; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
933 |
y += (e->scroll.delta.y >> 1) << 4; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
934 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
935 |
if (e->scroll.delta.y & 1) { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
936 |
x += TILE_SIZE; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
937 |
sub += 2; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
938 |
if (sub > 3) { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
939 |
sub -= 4; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
940 |
x -= TILE_SIZE; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
941 |
y += TILE_SIZE; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
942 |
} |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
943 |
} |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
944 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
945 |
hx = (w->widget[4].right - w->widget[4].left) / 2; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
946 |
hy = (w->widget[4].bottom - w->widget[4].top ) / 2; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
947 |
hvx = hx * -4 + hy * 8; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
948 |
hvy = hx * 4 + hy * 8; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
949 |
if (x < -hvx) { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
950 |
x = -hvx; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
951 |
sub = 0; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
952 |
} |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
953 |
if (x > (int)MapMaxX() * TILE_SIZE - hvx) { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
954 |
x = MapMaxX() * TILE_SIZE - hvx; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
955 |
sub = 0; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
956 |
} |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
957 |
if (y < -hvy) { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
958 |
y = -hvy; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
959 |
sub = 0; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
960 |
} |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
961 |
if (y > (int)MapMaxY() * TILE_SIZE - hvy) { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
962 |
y = MapMaxY() * TILE_SIZE - hvy; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
963 |
sub = 0; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
964 |
} |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
965 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
966 |
WP(w, smallmap_d).scroll_x = x; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
967 |
WP(w, smallmap_d).scroll_y = y; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
968 |
WP(w, smallmap_d).subscroll = sub; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
969 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
970 |
SetWindowDirty(w); |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
971 |
} break; |
0 | 972 |
} |
973 |
} |
|
974 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
975 |
static const WindowDesc _smallmap_desc = { |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
976 |
-1,-1, 446, 314, |
0 | 977 |
WC_SMALLMAP,0, |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
978 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
979 |
_smallmap_widgets, |
0 | 980 |
SmallMapWindowProc |
981 |
}; |
|
982 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1092
diff
changeset
|
983 |
void ShowSmallMap(void) |
0 | 984 |
{ |
985 |
Window *w; |
|
986 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
987 |
w = AllocateWindowDescFront(&_smallmap_desc, 0); |
4339
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
988 |
if (w == NULL) return; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
989 |
|
4339
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
990 |
w->click_state = ((1 << 5) << _smallmap_type) | (_smallmap_show_towns << 12); |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
991 |
w->resize.width = 350; |
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
992 |
w->resize.height = 250; |
0 | 993 |
|
4339
0b1c9f47e69b
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
truelight
parents:
4337
diff
changeset
|
994 |
SmallMapCenterOnCurrentPos(w); |
0 | 995 |
} |
996 |
||
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
|
997 |
/* Extra ViewPort Window Stuff */ |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
998 |
static const Widget _extra_view_port_widgets[] = { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
999 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
1000 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 287, 0, 13, STR_EXTRA_VIEW_PORT_TITLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
1001 |
{ WWT_STICKYBOX, RESIZE_LR, 14, 288, 299, 0, 13, 0x0, STR_STICKY_BUTTON}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
1002 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 299, 14, 233, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
1003 |
{ WWT_6, RESIZE_RB, 14, 2, 297, 16, 231, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
1004 |
{ WWT_PANEL, RESIZE_TB, 14, 0, 21, 234, 255, 0x2DF, STR_017F_ZOOM_THE_VIEW_IN}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
1005 |
{ WWT_PANEL, RESIZE_TB, 14, 22, 43, 234, 255, 0x2E0, STR_0180_ZOOM_THE_VIEW_OUT}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
1006 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 44, 171, 234, 255, STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW, STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
1007 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 172, 298, 234, 255, STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN, STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN_TT}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
1008 |
{ WWT_PANEL, RESIZE_RTB, 14, 299, 299, 234, 255, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
1009 |
{ WWT_PANEL, RESIZE_RTB, 14, 0, 287, 256, 267, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4339
diff
changeset
|
1010 |
{ 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
|
1011 |
{ 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
|
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 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
|
1015 |
{ |
1815
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1016 |
switch (e->event) { |
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1017 |
case WE_CREATE: /* Disable zoom in button */ |
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1018 |
w->disabled_state = (1 << 5); |
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1019 |
break; |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3882
diff
changeset
|
1020 |
|
1815
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1021 |
case WE_PAINT: |
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
|
1022 |
// set the number in the title bar |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3882
diff
changeset
|
1023 |
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
|
1024 |
|
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 |
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
|
1026 |
DrawWindowViewport(w); |
1815
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1027 |
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
|
1028 |
|
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3882
diff
changeset
|
1029 |
case WE_CLICK: |
1815
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1030 |
switch (e->click.widget) { |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3882
diff
changeset
|
1031 |
case 5: DoZoomInOutWindow(ZOOM_IN, w); break; |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3882
diff
changeset
|
1032 |
case 6: DoZoomInOutWindow(ZOOM_OUT, w); break; |
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3882
diff
changeset
|
1033 |
|
1815
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1034 |
case 7: { /* location button (move main view to same spot as this view) 'Paste Location' */ |
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1035 |
Window *w2 = FindWindowById(WC_MAIN_WINDOW, 0); |
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1036 |
int x = WP(w, vp_d).scrollpos_x; // Where is the main looking at |
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1037 |
int y = WP(w, vp_d).scrollpos_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
|
1038 |
|
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 |
// set this view to same location. Based on the center, adjusting for zoom |
1815
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1040 |
WP(w2, vp_d).scrollpos_x = x - (w2->viewport->virtual_width - w->viewport->virtual_width) / 2; |
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1041 |
WP(w2, vp_d).scrollpos_y = y - (w2->viewport->virtual_height - w->viewport->virtual_height) / 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
|
1042 |
} break; |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3882
diff
changeset
|
1043 |
|
1815
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1044 |
case 8: { /* inverse location button (move this view to same spot as main view) 'Copy Location' */ |
4171 | 1045 |
const Window *w2 = FindWindowById(WC_MAIN_WINDOW, 0); |
2548
49c8a096033f
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2368
diff
changeset
|
1046 |
int x = WP(w2, const vp_d).scrollpos_x; |
49c8a096033f
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2368
diff
changeset
|
1047 |
int y = WP(w2, const vp_d).scrollpos_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
|
1048 |
|
1815
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1049 |
WP(w, vp_d).scrollpos_x = x + (w2->viewport->virtual_width - w->viewport->virtual_width) / 2; |
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1050 |
WP(w, vp_d).scrollpos_y = y + (w2->viewport->virtual_height - w->viewport->virtual_height) / 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
|
1051 |
} break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1052 |
} |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3882
diff
changeset
|
1053 |
break; |
1815
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1054 |
|
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1055 |
case WE_RESIZE: |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
1056 |
w->viewport->width += e->sizing.diff.x; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
1057 |
w->viewport->height += e->sizing.diff.y; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
1058 |
w->viewport->virtual_width += e->sizing.diff.x; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
1059 |
w->viewport->virtual_height += e->sizing.diff.y; |
1815
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1060 |
break; |
4335
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1061 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1062 |
case WE_SCROLL: { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1063 |
ViewPort *vp = IsPtInWindowViewport(w, _cursor.pos.x, _cursor.pos.y); |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1064 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1065 |
if (vp == NULL) { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1066 |
_cursor.fix_at = false; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1067 |
_scrolling_viewport = false; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1068 |
} |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1069 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1070 |
WP(w, vp_d).scrollpos_x += e->scroll.delta.x << vp->zoom; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1071 |
WP(w, vp_d).scrollpos_y += e->scroll.delta.y << vp->zoom; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4171
diff
changeset
|
1072 |
} break; |
4337
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
1073 |
|
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
1074 |
case WE_MOUSEWHEEL: |
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
1075 |
ZoomInOrOutToCursorWindow(e->wheel.wheel < 0, w); |
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
1076 |
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
|
1077 |
} |
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 |
} |
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 |
|
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 |
static const WindowDesc _extra_view_port_desc = { |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
1081 |
-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
|
1082 |
WC_EXTRA_VIEW_PORT,0, |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
1083 |
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
|
1084 |
_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
|
1085 |
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
|
1086 |
}; |
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 |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1092
diff
changeset
|
1088 |
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
|
1089 |
{ |
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 |
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
|
1091 |
int i = 0; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1092 |
|
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
|
1093 |
// find next free window number for extra viewport |
2989 | 1094 |
while (FindWindowById(WC_EXTRA_VIEW_PORT, i) != NULL) 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
|
1095 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
1096 |
w = AllocateWindowDescFront(&_extra_view_port_desc, i); |
2989 | 1097 |
if (w != NULL) { |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
856
diff
changeset
|
1098 |
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
|
1099 |
// 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
|
1100 |
v = FindWindowById(WC_MAIN_WINDOW, 0); |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1101 |
// 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
|
1102 |
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
|
1103 |
|
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
|
1104 |
// center on same place as main window (zoom is maximum, no adjustment needed) |
1815
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1105 |
x = WP(v, vp_d).scrollpos_x; |
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1106 |
y = WP(v, vp_d).scrollpos_y; |
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1107 |
WP(w, vp_d).scrollpos_x = x + (v->viewport->virtual_width - (294)) / 2; |
733868a48ab3
(svn r2319) - Fix: copying/pasting from the extra viewport did not center on what you wanted to see if one of the windows (viewport or main) was zoomed out. Also fix the undisabled-zoom-in button upon creation.
Darkvater
parents:
1516
diff
changeset
|
1108 |
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
|
1109 |
} |
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
|
1110 |
} |