OpenTTD Source  20241108-master-g80f628063a
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_t)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 static const DrawTileSeqStruct _crossing_layout_SW_ALL[] = {
57  TILE_SEQ_LINE(6, PAL_NONE, 13, 0, 3, 3)
58  TILE_SEQ_LINE(8, PAL_NONE, 13, 13, 3, 3)
59  TILE_SEQ_END()
60 };
61 
62 static const DrawTileSprites _crossing_layout_SW = {
63  {0, PAL_NONE}, _crossing_layout_SW_ALL
64 };
65 
66 static const DrawTileSeqStruct _crossing_layout_NW_ALL[] = {
67  TILE_SEQ_LINE(2, PAL_NONE, 0, 0, 3, 3)
68  TILE_SEQ_LINE(6, PAL_NONE, 13, 0, 3, 3)
69  TILE_SEQ_END()
70 };
71 
72 static const DrawTileSprites _crossing_layout_NW = {
73  {0, PAL_NONE}, _crossing_layout_NW_ALL
74 };
75 
76 static const DrawTileSeqStruct _crossing_layout_NE_ALL[] = {
77  TILE_SEQ_LINE(2, PAL_NONE, 0, 0, 3, 3)
78  TILE_SEQ_LINE(4, PAL_NONE, 0, 13, 3, 3)
79  TILE_SEQ_END()
80 };
81 
82 static const DrawTileSprites _crossing_layout_NE = {
83  {0, PAL_NONE}, _crossing_layout_NE_ALL
84 };
85 
86 static const DrawTileSeqStruct _crossing_layout_SE_ALL[] = {
87  TILE_SEQ_LINE(4, PAL_NONE, 0, 13, 3, 3)
88  TILE_SEQ_LINE(8, PAL_NONE, 13, 13, 3, 3)
89  TILE_SEQ_END()
90 };
91 
92 static const DrawTileSprites _crossing_layout_SE = {
93  {0, PAL_NONE}, _crossing_layout_SE_ALL
94 };
95 
96 #undef TILE_SEQ_LINE
97 #undef TILE_SEQ_END
98 
99 
100 static const SpriteID _road_tile_sprites_1[16] = {
101  0, 0x546, 0x545, 0x53B, 0x544, 0x534, 0x53E, 0x539,
102  0x543, 0x53C, 0x535, 0x538, 0x53D, 0x537, 0x53A, 0x536
103 };
104 
105 static const SpriteID _road_backpole_sprites_1[16] = {
106  0, 0x54, 0x55, 0x5B, 0x54, 0x54, 0x5E, 0x5A, 0x55, 0x5C, 0x55, 0x58, 0x5D, 0x57, 0x59, 0x56
107 };
108 
109 static const SpriteID _road_frontwire_sprites_1[16] = {
110  0, 0x38, 0x39, 0x40, 0x38, 0x38, 0x43, 0x3E, 0x39, 0x41, 0x39, 0x3C, 0x42, 0x3B, 0x3D, 0x3A
111 };
112 
113 #define MAKELINE(a, b, c) { a, b, c },
114 #define ENDLINE { 0, 0, 0 }
115 
116 static const DrawRoadTileStruct _roadside_nothing[] = {
117  ENDLINE
118 };
119 
120 static const DrawRoadTileStruct _road_display_datas2_3[] = {
121  MAKELINE(0x57f, 1, 8)
122  ENDLINE
123 };
124 
125 static const DrawRoadTileStruct _road_display_datas2_5[] = {
126  MAKELINE(0x57f, 1, 8)
127  MAKELINE(0x57e, 14, 8)
128  ENDLINE
129 };
130 
131 static const DrawRoadTileStruct _road_display_datas2_6[] = {
132  MAKELINE(0x57e, 8, 1)
133  ENDLINE
134 };
135 
136 static const DrawRoadTileStruct _road_display_datas2_7[] = {
137  MAKELINE(0x57f, 1, 8)
138  ENDLINE
139 };
140 
141 static const DrawRoadTileStruct _road_display_datas2_9[] = {
142  MAKELINE(0x57f, 8, 14)
143  ENDLINE
144 };
145 
146 static const DrawRoadTileStruct _road_display_datas2_10[] = {
147  MAKELINE(0x57f, 8, 14)
148  MAKELINE(0x57e, 8, 1)
149  ENDLINE
150 };
151 
152 static const DrawRoadTileStruct _road_display_datas2_11[] = {
153  MAKELINE(0x57f, 8, 14)
154  ENDLINE
155 };
156 
157 static const DrawRoadTileStruct _road_display_datas2_12[] = {
158  MAKELINE(0x57e, 8, 1)
159  ENDLINE
160 };
161 
162 static const DrawRoadTileStruct _road_display_datas2_13[] = {
163  MAKELINE(0x57e, 14, 8)
164  ENDLINE
165 };
166 
167 static const DrawRoadTileStruct _road_display_datas2_14[] = {
168  MAKELINE(0x57e, 8, 1)
169  ENDLINE
170 };
171 
172 static const DrawRoadTileStruct _road_display_datas2_19[] = {
173  MAKELINE(0x1212, 0, 2)
174  MAKELINE(0x1212, 3, 9)
175  MAKELINE(0x1212, 10, 12)
176  ENDLINE
177 };
178 
179 static const DrawRoadTileStruct _road_display_datas2_21[] = {
180  MAKELINE(0x1212, 0, 2)
181  MAKELINE(0x1212, 0, 10)
182  MAKELINE(0x1212, 12, 2)
183  MAKELINE(0x1212, 12, 10)
184  ENDLINE
185 };
186 
187 static const DrawRoadTileStruct _road_display_datas2_22[] = {
188  MAKELINE(0x1212, 10, 0)
189  MAKELINE(0x1212, 3, 3)
190  MAKELINE(0x1212, 0, 10)
191  ENDLINE
192 };
193 
194 static const DrawRoadTileStruct _road_display_datas2_23[] = {
195  MAKELINE(0x1212, 0, 2)
196  MAKELINE(0x1212, 0, 10)
197  ENDLINE
198 };
199 
200 static const DrawRoadTileStruct _road_display_datas2_25[] = {
201  MAKELINE(0x1212, 12, 2)
202  MAKELINE(0x1212, 9, 9)
203  MAKELINE(0x1212, 2, 12)
204  ENDLINE
205 };
206 
207 static const DrawRoadTileStruct _road_display_datas2_26[] = {
208  MAKELINE(0x1212, 2, 0)
209  MAKELINE(0x1212, 10, 0)
210  MAKELINE(0x1212, 2, 12)
211  MAKELINE(0x1212, 10, 12)
212  ENDLINE
213 };
214 
215 static const DrawRoadTileStruct _road_display_datas2_27[] = {
216  MAKELINE(0x1212, 2, 12)
217  MAKELINE(0x1212, 10, 12)
218  ENDLINE
219 };
220 
221 static const DrawRoadTileStruct _road_display_datas2_28[] = {
222  MAKELINE(0x1212, 2, 0)
223  MAKELINE(0x1212, 9, 3)
224  MAKELINE(0x1212, 12, 10)
225  ENDLINE
226 };
227 
228 static const DrawRoadTileStruct _road_display_datas2_29[] = {
229  MAKELINE(0x1212, 12, 2)
230  MAKELINE(0x1212, 12, 10)
231  ENDLINE
232 };
233 
234 static const DrawRoadTileStruct _road_display_datas2_30[] = {
235  MAKELINE(0x1212, 2, 0)
236  MAKELINE(0x1212, 10, 0)
237  ENDLINE
238 };
239 
240 #undef MAKELINE
241 #undef ENDLINE
242 
243 static const DrawRoadTileStruct * const _roadside_none[] = {
244  _roadside_nothing, _roadside_nothing,
245  _roadside_nothing, _roadside_nothing,
246  _roadside_nothing, _roadside_nothing,
247  _roadside_nothing, _roadside_nothing,
248  _roadside_nothing, _roadside_nothing,
249  _roadside_nothing, _roadside_nothing,
250  _roadside_nothing, _roadside_nothing,
251  _roadside_nothing, _roadside_nothing
252 };
253 
254 static const DrawRoadTileStruct * const _roadside_lamps[] = {
255  _roadside_nothing,
256  _roadside_nothing,
257  _roadside_nothing,
258  _road_display_datas2_3,
259  _roadside_nothing,
260  _road_display_datas2_5,
261  _road_display_datas2_6,
262  _road_display_datas2_7,
263  _roadside_nothing,
264  _road_display_datas2_9,
265  _road_display_datas2_10,
266  _road_display_datas2_11,
267  _road_display_datas2_12,
268  _road_display_datas2_13,
269  _road_display_datas2_14,
270  _roadside_nothing,
271 };
272 
273 static const DrawRoadTileStruct * const _roadside_trees[] = {
274  _roadside_nothing,
275  _roadside_nothing,
276  _roadside_nothing,
277  _road_display_datas2_19,
278  _roadside_nothing,
279  _road_display_datas2_21,
280  _road_display_datas2_22,
281  _road_display_datas2_23,
282 
283  _roadside_nothing,
284  _road_display_datas2_25,
285  _road_display_datas2_26,
286  _road_display_datas2_27,
287  _road_display_datas2_28,
288  _road_display_datas2_29,
289  _road_display_datas2_30,
290  _roadside_nothing,
291 };
292 
293 static const DrawRoadTileStruct * const * const _road_display_table[] = {
294  _roadside_none,
295  _roadside_none,
296  _roadside_none,
297  _roadside_lamps,
298  _roadside_none,
299  _roadside_trees,
300 };
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:18
static constexpr uint8_t PALETTE_MODIFIER_COLOUR
this bit is set when a recolouring process is in action
Definition: sprites.h:1548
A tile child sprite and palette to draw for stations etc, with 3D bounding box.
Definition: sprite.h:25
Ground palette sprite of a tile, together with its sprite layout.
Definition: sprite.h:58