OpenTTD Source 20250312-master-gcdcc6b491d
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
12static const DrawTileSeqStruct _road_depot_NE[] = {
13 TILE_SEQ_LINE(0x584 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 15, 16, 1)
14};
15
16static const DrawTileSeqStruct _road_depot_SE[] = {
17 TILE_SEQ_LINE(0x580 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 1, 16)
18 TILE_SEQ_LINE(0x581 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 15, 0, 1, 16)
19};
20
21static const DrawTileSeqStruct _road_depot_SW[] = {
22 TILE_SEQ_LINE(0x582 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 1)
23 TILE_SEQ_LINE(0x583 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 15, 16, 1)
24};
25
26static const DrawTileSeqStruct _road_depot_NW[] = {
27 TILE_SEQ_LINE(0x585 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 15, 0, 1, 16)
28};
29
30static const DrawTileSpriteSpan _road_depot[] = {
31 { {0xA4A, PAL_NONE}, _road_depot_NE },
32 { {0xA4A, PAL_NONE}, _road_depot_SE },
33 { {0xA4A, PAL_NONE}, _road_depot_SW },
34 { {0xA4A, PAL_NONE}, _road_depot_NW }
35};
36
37/* Sprite layout for level crossings. The SpriteIDs are actually offsets
38 * from the base SpriteID returned from the NewGRF sprite resolver. */
39static const DrawTileSeqStruct _crossing_layout_ALL[] = {
40 TILE_SEQ_LINE(2, PAL_NONE, 0, 0, 3, 3)
41 TILE_SEQ_LINE(4, PAL_NONE, 0, 13, 3, 3)
42 TILE_SEQ_LINE(6, PAL_NONE, 13, 0, 3, 3)
43 TILE_SEQ_LINE(8, PAL_NONE, 13, 13, 3, 3)
44};
45
46static const DrawTileSpriteSpan _crossing_layout = {
47 {0, PAL_NONE}, _crossing_layout_ALL
48};
49
50static const DrawTileSeqStruct _crossing_layout_SW_ALL[] = {
51 TILE_SEQ_LINE(6, PAL_NONE, 13, 0, 3, 3)
52 TILE_SEQ_LINE(8, PAL_NONE, 13, 13, 3, 3)
53};
54
55static const DrawTileSpriteSpan _crossing_layout_SW = {
56 {0, PAL_NONE}, _crossing_layout_SW_ALL
57};
58
59static const DrawTileSeqStruct _crossing_layout_NW_ALL[] = {
60 TILE_SEQ_LINE(2, PAL_NONE, 0, 0, 3, 3)
61 TILE_SEQ_LINE(6, PAL_NONE, 13, 0, 3, 3)
62};
63
64static const DrawTileSpriteSpan _crossing_layout_NW = {
65 {0, PAL_NONE}, _crossing_layout_NW_ALL
66};
67
68static const DrawTileSeqStruct _crossing_layout_NE_ALL[] = {
69 TILE_SEQ_LINE(2, PAL_NONE, 0, 0, 3, 3)
70 TILE_SEQ_LINE(4, PAL_NONE, 0, 13, 3, 3)
71};
72
73static const DrawTileSpriteSpan _crossing_layout_NE = {
74 {0, PAL_NONE}, _crossing_layout_NE_ALL
75};
76
77static const DrawTileSeqStruct _crossing_layout_SE_ALL[] = {
78 TILE_SEQ_LINE(4, PAL_NONE, 0, 13, 3, 3)
79 TILE_SEQ_LINE(8, PAL_NONE, 13, 13, 3, 3)
80};
81
82static const DrawTileSpriteSpan _crossing_layout_SE = {
83 {0, PAL_NONE}, _crossing_layout_SE_ALL
84};
85
86#undef TILE_SEQ_LINE
87
88
89static const SpriteID _road_tile_sprites_1[16] = {
90 0, 0x546, 0x545, 0x53B, 0x544, 0x534, 0x53E, 0x539,
91 0x543, 0x53C, 0x535, 0x538, 0x53D, 0x537, 0x53A, 0x536
92};
93
94static const SpriteID _road_backpole_sprites_1[16] = {
95 0, 0x54, 0x55, 0x5B, 0x54, 0x54, 0x5E, 0x5A, 0x55, 0x5C, 0x55, 0x58, 0x5D, 0x57, 0x59, 0x56
96};
97
98static const SpriteID _road_frontwire_sprites_1[16] = {
99 0, 0x38, 0x39, 0x40, 0x38, 0x38, 0x43, 0x3E, 0x39, 0x41, 0x39, 0x3C, 0x42, 0x3B, 0x3D, 0x3A
100};
101
102#define MAKELINE(a, b, c) { a, b, c },
103#define ENDLINE { 0, 0, 0 }
104
105static const DrawRoadTileStruct _roadside_nothing[] = {
106 ENDLINE
107};
108
109static const DrawRoadTileStruct _road_display_datas2_3[] = {
110 MAKELINE(0x57f, 1, 8)
111 ENDLINE
112};
113
114static const DrawRoadTileStruct _road_display_datas2_5[] = {
115 MAKELINE(0x57f, 1, 8)
116 MAKELINE(0x57e, 14, 8)
117 ENDLINE
118};
119
120static const DrawRoadTileStruct _road_display_datas2_6[] = {
121 MAKELINE(0x57e, 8, 1)
122 ENDLINE
123};
124
125static const DrawRoadTileStruct _road_display_datas2_7[] = {
126 MAKELINE(0x57f, 1, 8)
127 ENDLINE
128};
129
130static const DrawRoadTileStruct _road_display_datas2_9[] = {
131 MAKELINE(0x57f, 8, 14)
132 ENDLINE
133};
134
135static const DrawRoadTileStruct _road_display_datas2_10[] = {
136 MAKELINE(0x57f, 8, 14)
137 MAKELINE(0x57e, 8, 1)
138 ENDLINE
139};
140
141static const DrawRoadTileStruct _road_display_datas2_11[] = {
142 MAKELINE(0x57f, 8, 14)
143 ENDLINE
144};
145
146static const DrawRoadTileStruct _road_display_datas2_12[] = {
147 MAKELINE(0x57e, 8, 1)
148 ENDLINE
149};
150
151static const DrawRoadTileStruct _road_display_datas2_13[] = {
152 MAKELINE(0x57e, 14, 8)
153 ENDLINE
154};
155
156static const DrawRoadTileStruct _road_display_datas2_14[] = {
157 MAKELINE(0x57e, 8, 1)
158 ENDLINE
159};
160
161static const DrawRoadTileStruct _road_display_datas2_19[] = {
162 MAKELINE(0x1212, 0, 2)
163 MAKELINE(0x1212, 3, 9)
164 MAKELINE(0x1212, 10, 12)
165 ENDLINE
166};
167
168static const DrawRoadTileStruct _road_display_datas2_21[] = {
169 MAKELINE(0x1212, 0, 2)
170 MAKELINE(0x1212, 0, 10)
171 MAKELINE(0x1212, 12, 2)
172 MAKELINE(0x1212, 12, 10)
173 ENDLINE
174};
175
176static const DrawRoadTileStruct _road_display_datas2_22[] = {
177 MAKELINE(0x1212, 10, 0)
178 MAKELINE(0x1212, 3, 3)
179 MAKELINE(0x1212, 0, 10)
180 ENDLINE
181};
182
183static const DrawRoadTileStruct _road_display_datas2_23[] = {
184 MAKELINE(0x1212, 0, 2)
185 MAKELINE(0x1212, 0, 10)
186 ENDLINE
187};
188
189static const DrawRoadTileStruct _road_display_datas2_25[] = {
190 MAKELINE(0x1212, 12, 2)
191 MAKELINE(0x1212, 9, 9)
192 MAKELINE(0x1212, 2, 12)
193 ENDLINE
194};
195
196static const DrawRoadTileStruct _road_display_datas2_26[] = {
197 MAKELINE(0x1212, 2, 0)
198 MAKELINE(0x1212, 10, 0)
199 MAKELINE(0x1212, 2, 12)
200 MAKELINE(0x1212, 10, 12)
201 ENDLINE
202};
203
204static const DrawRoadTileStruct _road_display_datas2_27[] = {
205 MAKELINE(0x1212, 2, 12)
206 MAKELINE(0x1212, 10, 12)
207 ENDLINE
208};
209
210static const DrawRoadTileStruct _road_display_datas2_28[] = {
211 MAKELINE(0x1212, 2, 0)
212 MAKELINE(0x1212, 9, 3)
213 MAKELINE(0x1212, 12, 10)
214 ENDLINE
215};
216
217static const DrawRoadTileStruct _road_display_datas2_29[] = {
218 MAKELINE(0x1212, 12, 2)
219 MAKELINE(0x1212, 12, 10)
220 ENDLINE
221};
222
223static const DrawRoadTileStruct _road_display_datas2_30[] = {
224 MAKELINE(0x1212, 2, 0)
225 MAKELINE(0x1212, 10, 0)
226 ENDLINE
227};
228
229#undef MAKELINE
230#undef ENDLINE
231
232static const DrawRoadTileStruct * const _roadside_none[] = {
233 _roadside_nothing, _roadside_nothing,
234 _roadside_nothing, _roadside_nothing,
235 _roadside_nothing, _roadside_nothing,
236 _roadside_nothing, _roadside_nothing,
237 _roadside_nothing, _roadside_nothing,
238 _roadside_nothing, _roadside_nothing,
239 _roadside_nothing, _roadside_nothing,
240 _roadside_nothing, _roadside_nothing
241};
242
243static const DrawRoadTileStruct * const _roadside_lamps[] = {
244 _roadside_nothing,
245 _roadside_nothing,
246 _roadside_nothing,
247 _road_display_datas2_3,
248 _roadside_nothing,
249 _road_display_datas2_5,
250 _road_display_datas2_6,
251 _road_display_datas2_7,
252 _roadside_nothing,
253 _road_display_datas2_9,
254 _road_display_datas2_10,
255 _road_display_datas2_11,
256 _road_display_datas2_12,
257 _road_display_datas2_13,
258 _road_display_datas2_14,
259 _roadside_nothing,
260};
261
262static const DrawRoadTileStruct * const _roadside_trees[] = {
263 _roadside_nothing,
264 _roadside_nothing,
265 _roadside_nothing,
266 _road_display_datas2_19,
267 _roadside_nothing,
268 _road_display_datas2_21,
269 _road_display_datas2_22,
270 _road_display_datas2_23,
271
272 _roadside_nothing,
273 _road_display_datas2_25,
274 _road_display_datas2_26,
275 _road_display_datas2_27,
276 _road_display_datas2_28,
277 _road_display_datas2_29,
278 _road_display_datas2_30,
279 _roadside_nothing,
280};
281
282static const DrawRoadTileStruct * const * const _road_display_table[] = {
283 _roadside_none,
284 _roadside_none,
285 _roadside_none,
286 _roadside_lamps,
287 _roadside_none,
288 _roadside_trees,
289};
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition gfx_type.h:17
static constexpr uint8_t PALETTE_MODIFIER_COLOUR
this bit is set when a recolouring process is in action
Definition sprites.h:1552
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:61