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