OpenTTD Source  12.0-beta2
road_land.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #define TILE_SEQ_LINE(img, pal, dx, dy, sx, sy) { dx, dy, 0, sx, sy, 20, {img, pal} },
11 #define TILE_SEQ_END() { (int8)0x80, 0, 0, 0, 0, 0, {0, 0} }
12 
13 static const DrawTileSeqStruct _road_depot_NE[] = {
14  TILE_SEQ_LINE(0x584 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 15, 16, 1)
15  TILE_SEQ_END()
16 };
17 
18 static const DrawTileSeqStruct _road_depot_SE[] = {
19  TILE_SEQ_LINE(0x580 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 1, 16)
20  TILE_SEQ_LINE(0x581 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 15, 0, 1, 16)
21  TILE_SEQ_END()
22 };
23 
24 static const DrawTileSeqStruct _road_depot_SW[] = {
25  TILE_SEQ_LINE(0x582 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 1)
26  TILE_SEQ_LINE(0x583 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 15, 16, 1)
27  TILE_SEQ_END()
28 };
29 
30 static const DrawTileSeqStruct _road_depot_NW[] = {
31  TILE_SEQ_LINE(0x585 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 15, 0, 1, 16)
32  TILE_SEQ_END()
33 };
34 
35 static const DrawTileSprites _road_depot[] = {
36  { {0xA4A, PAL_NONE}, _road_depot_NE },
37  { {0xA4A, PAL_NONE}, _road_depot_SE },
38  { {0xA4A, PAL_NONE}, _road_depot_SW },
39  { {0xA4A, PAL_NONE}, _road_depot_NW }
40 };
41 
42 /* Sprite layout for level crossings. The SpriteIDs are actually offsets
43  * from the base SpriteID returned from the NewGRF sprite resolver. */
44 static const DrawTileSeqStruct _crossing_layout_ALL[] = {
45  TILE_SEQ_LINE(2, PAL_NONE, 0, 0, 3, 3)
46  TILE_SEQ_LINE(4, PAL_NONE, 0, 13, 3, 3)
47  TILE_SEQ_LINE(6, PAL_NONE, 13, 0, 3, 3)
48  TILE_SEQ_LINE(8, PAL_NONE, 13, 13, 3, 3)
49  TILE_SEQ_END()
50 };
51 
52 static const DrawTileSprites _crossing_layout = {
53  {0, PAL_NONE}, _crossing_layout_ALL
54 };
55 
56 #undef TILE_SEQ_LINE
57 #undef TILE_SEQ_END
58 
59 
60 static const SpriteID _road_tile_sprites_1[16] = {
61  0, 0x546, 0x545, 0x53B, 0x544, 0x534, 0x53E, 0x539,
62  0x543, 0x53C, 0x535, 0x538, 0x53D, 0x537, 0x53A, 0x536
63 };
64 
65 static const SpriteID _road_backpole_sprites_1[16] = {
66  0, 0x54, 0x55, 0x5B, 0x54, 0x54, 0x5E, 0x5A, 0x55, 0x5C, 0x55, 0x58, 0x5D, 0x57, 0x59, 0x56
67 };
68 
69 static const SpriteID _road_frontwire_sprites_1[16] = {
70  0, 0x38, 0x39, 0x40, 0x38, 0x38, 0x43, 0x3E, 0x39, 0x41, 0x39, 0x3C, 0x42, 0x3B, 0x3D, 0x3A
71 };
72 
73 #define MAKELINE(a, b, c) { a, b, c },
74 #define ENDLINE { 0, 0, 0 }
75 
76 static const DrawRoadTileStruct _roadside_nothing[] = {
77  ENDLINE
78 };
79 
80 static const DrawRoadTileStruct _road_display_datas2_3[] = {
81  MAKELINE(0x57f, 1, 8)
82  ENDLINE
83 };
84 
85 static const DrawRoadTileStruct _road_display_datas2_5[] = {
86  MAKELINE(0x57f, 1, 8)
87  MAKELINE(0x57e, 14, 8)
88  ENDLINE
89 };
90 
91 static const DrawRoadTileStruct _road_display_datas2_6[] = {
92  MAKELINE(0x57e, 8, 1)
93  ENDLINE
94 };
95 
96 static const DrawRoadTileStruct _road_display_datas2_7[] = {
97  MAKELINE(0x57f, 1, 8)
98  ENDLINE
99 };
100 
101 static const DrawRoadTileStruct _road_display_datas2_9[] = {
102  MAKELINE(0x57f, 8, 14)
103  ENDLINE
104 };
105 
106 static const DrawRoadTileStruct _road_display_datas2_10[] = {
107  MAKELINE(0x57f, 8, 14)
108  MAKELINE(0x57e, 8, 1)
109  ENDLINE
110 };
111 
112 static const DrawRoadTileStruct _road_display_datas2_11[] = {
113  MAKELINE(0x57f, 8, 14)
114  ENDLINE
115 };
116 
117 static const DrawRoadTileStruct _road_display_datas2_12[] = {
118  MAKELINE(0x57e, 8, 1)
119  ENDLINE
120 };
121 
122 static const DrawRoadTileStruct _road_display_datas2_13[] = {
123  MAKELINE(0x57e, 14, 8)
124  ENDLINE
125 };
126 
127 static const DrawRoadTileStruct _road_display_datas2_14[] = {
128  MAKELINE(0x57e, 8, 1)
129  ENDLINE
130 };
131 
132 static const DrawRoadTileStruct _road_display_datas2_19[] = {
133  MAKELINE(0x1212, 0, 2)
134  MAKELINE(0x1212, 3, 9)
135  MAKELINE(0x1212, 10, 12)
136  ENDLINE
137 };
138 
139 static const DrawRoadTileStruct _road_display_datas2_21[] = {
140  MAKELINE(0x1212, 0, 2)
141  MAKELINE(0x1212, 0, 10)
142  MAKELINE(0x1212, 12, 2)
143  MAKELINE(0x1212, 12, 10)
144  ENDLINE
145 };
146 
147 static const DrawRoadTileStruct _road_display_datas2_22[] = {
148  MAKELINE(0x1212, 10, 0)
149  MAKELINE(0x1212, 3, 3)
150  MAKELINE(0x1212, 0, 10)
151  ENDLINE
152 };
153 
154 static const DrawRoadTileStruct _road_display_datas2_23[] = {
155  MAKELINE(0x1212, 0, 2)
156  MAKELINE(0x1212, 0, 10)
157  ENDLINE
158 };
159 
160 static const DrawRoadTileStruct _road_display_datas2_25[] = {
161  MAKELINE(0x1212, 12, 2)
162  MAKELINE(0x1212, 9, 9)
163  MAKELINE(0x1212, 2, 12)
164  ENDLINE
165 };
166 
167 static const DrawRoadTileStruct _road_display_datas2_26[] = {
168  MAKELINE(0x1212, 2, 0)
169  MAKELINE(0x1212, 10, 0)
170  MAKELINE(0x1212, 2, 12)
171  MAKELINE(0x1212, 10, 12)
172  ENDLINE
173 };
174 
175 static const DrawRoadTileStruct _road_display_datas2_27[] = {
176  MAKELINE(0x1212, 2, 12)
177  MAKELINE(0x1212, 10, 12)
178  ENDLINE
179 };
180 
181 static const DrawRoadTileStruct _road_display_datas2_28[] = {
182  MAKELINE(0x1212, 2, 0)
183  MAKELINE(0x1212, 9, 3)
184  MAKELINE(0x1212, 12, 10)
185  ENDLINE
186 };
187 
188 static const DrawRoadTileStruct _road_display_datas2_29[] = {
189  MAKELINE(0x1212, 12, 2)
190  MAKELINE(0x1212, 12, 10)
191  ENDLINE
192 };
193 
194 static const DrawRoadTileStruct _road_display_datas2_30[] = {
195  MAKELINE(0x1212, 2, 0)
196  MAKELINE(0x1212, 10, 0)
197  ENDLINE
198 };
199 
200 #undef MAKELINE
201 #undef ENDLINE
202 
203 static const DrawRoadTileStruct * const _roadside_none[] = {
204  _roadside_nothing, _roadside_nothing,
205  _roadside_nothing, _roadside_nothing,
206  _roadside_nothing, _roadside_nothing,
207  _roadside_nothing, _roadside_nothing,
208  _roadside_nothing, _roadside_nothing,
209  _roadside_nothing, _roadside_nothing,
210  _roadside_nothing, _roadside_nothing,
211  _roadside_nothing, _roadside_nothing
212 };
213 
214 static const DrawRoadTileStruct * const _roadside_lamps[] = {
215  _roadside_nothing,
216  _roadside_nothing,
217  _roadside_nothing,
218  _road_display_datas2_3,
219  _roadside_nothing,
220  _road_display_datas2_5,
221  _road_display_datas2_6,
222  _road_display_datas2_7,
223  _roadside_nothing,
224  _road_display_datas2_9,
225  _road_display_datas2_10,
226  _road_display_datas2_11,
227  _road_display_datas2_12,
228  _road_display_datas2_13,
229  _road_display_datas2_14,
230  _roadside_nothing,
231 };
232 
233 static const DrawRoadTileStruct * const _roadside_trees[] = {
234  _roadside_nothing,
235  _roadside_nothing,
236  _roadside_nothing,
237  _road_display_datas2_19,
238  _roadside_nothing,
239  _road_display_datas2_21,
240  _road_display_datas2_22,
241  _road_display_datas2_23,
242 
243  _roadside_nothing,
244  _road_display_datas2_25,
245  _road_display_datas2_26,
246  _road_display_datas2_27,
247  _road_display_datas2_28,
248  _road_display_datas2_29,
249  _road_display_datas2_30,
250  _roadside_nothing,
251 };
252 
253 static const DrawRoadTileStruct * const * const _road_display_table[] = {
254  _roadside_none,
255  _roadside_none,
256  _roadside_none,
257  _roadside_lamps,
258  _roadside_none,
259  _roadside_trees,
260 };
PALETTE_MODIFIER_COLOUR
@ PALETTE_MODIFIER_COLOUR
this bit is set when a recolouring process is in action
Definition: sprites.h:1540
SpriteID
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:17
DrawTileSprites
Ground palette sprite of a tile, together with its sprite layout.
Definition: sprite.h:58
DrawRoadTileStruct
Definition: road_cmd.cpp:1284
DrawTileSeqStruct
A tile child sprite and palette to draw for stations etc, with 3D bounding box.
Definition: sprite.h:25