227 {DIR_SW, DIR_NW, DIR_NE, DIR_SE, DIR_S, DIR_E, DIR_N, DIR_W}, /* odd - evn */ |
227 {DIR_SW, DIR_NW, DIR_NE, DIR_SE, DIR_S, DIR_E, DIR_N, DIR_W}, /* odd - evn */ |
228 {DIR_SW, DIR_SE, DIR_NE, DIR_NW, DIR_N, DIR_W, DIR_S, DIR_E}, /* odd - odd */ |
228 {DIR_SW, DIR_SE, DIR_NE, DIR_NW, DIR_N, DIR_W, DIR_S, DIR_E}, /* odd - odd */ |
229 } |
229 } |
230 }; |
230 }; |
231 /* Geometric placement of the PCP relative to the tile origin */ |
231 /* Geometric placement of the PCP relative to the tile origin */ |
232 static const int8 x_pcp_offsets[DIAGDIR_END] = {0, 8, 15, 8}; |
232 static const int8 x_pcp_offsets[DIAGDIR_END] = {0, 8, 16, 8}; |
233 static const int8 y_pcp_offsets[DIAGDIR_END] = {8, 15, 8, 0}; |
233 static const int8 y_pcp_offsets[DIAGDIR_END] = {8, 16, 8, 0}; |
234 /* Geometric placement of the PPP relative to the PCP*/ |
234 /* Geometric placement of the PPP relative to the PCP*/ |
235 static const int8 x_ppp_offsets[DIR_END] = {-3, -4, -3, 0, 3, 4, 3, 0}; |
235 static const int8 x_ppp_offsets[DIR_END] = {-2, -4, -2, 0, 2, 4, 2, 0}; |
236 static const int8 y_ppp_offsets[DIR_END] = {-3, 0, 3, 4, 3, 0, -3, -4}; |
236 static const int8 y_ppp_offsets[DIR_END] = {-2, 0, 2, 4, 2, 0, -2, -4}; |
237 /* The type of pylon to draw at each PPP */ |
237 /* The type of pylon to draw at each PPP */ |
238 static const SpriteID pylons_normal[] = { |
238 static const SpriteID pylon_sprites[] = { |
239 SPR_PYLON_EW_N, |
239 SPR_PYLON_EW_N, |
240 SPR_PYLON_Y_NE, |
240 SPR_PYLON_Y_NE, |
241 SPR_PYLON_NS_E, |
241 SPR_PYLON_NS_E, |
242 SPR_PYLON_X_SE, |
242 SPR_PYLON_X_SE, |
243 SPR_PYLON_EW_S, |
243 SPR_PYLON_EW_S, |
244 SPR_PYLON_Y_SW, |
244 SPR_PYLON_Y_SW, |
245 SPR_PYLON_NS_W, |
245 SPR_PYLON_NS_W, |
246 SPR_PYLON_X_NW |
246 SPR_PYLON_X_NW |
247 }; |
247 }; |
248 |
248 |
249 static const SpriteID pylons_bridge[] = { |
|
250 SPR_PYLON_X_NW, |
|
251 SPR_PYLON_X_SE, |
|
252 SPR_PYLON_Y_NE, |
|
253 SPR_PYLON_Y_SW |
|
254 }; |
|
255 |
|
256 struct SortableSpriteStruct { |
249 struct SortableSpriteStruct { |
257 SpriteID image; |
250 SpriteID image; |
258 int8 x_offset; |
251 int8 x_offset; |
259 int8 y_offset; |
252 int8 y_offset; |
260 int8 x_size; |
253 int8 x_size; |
263 int8 z_offset; |
256 int8 z_offset; |
264 }; |
257 }; |
265 |
258 |
266 enum { |
259 enum { |
267 /** Distance between wire and rail */ |
260 /** Distance between wire and rail */ |
268 ELRAIL_ELEVATION = 8, |
261 ELRAIL_ELEVATION = 10, |
269 /** Corrects an off-by-one error in some places (tileh 12 and 9) (TODO -- find source of error) */ |
|
270 ELRAIL_ELEV_CORR = ELRAIL_ELEVATION + 1, |
|
271 /** Wires that a draw one level higher than the north corner. */ |
262 /** Wires that a draw one level higher than the north corner. */ |
272 ELRAIL_ELEVRAISE = ELRAIL_ELEVATION + TILE_HEIGHT |
263 ELRAIL_ELEVRAISE = ELRAIL_ELEVATION + TILE_HEIGHT |
273 }; |
264 }; |
274 |
265 |
275 static const SortableSpriteStruct CatenarySpriteData[] = { |
266 static const SortableSpriteStruct CatenarySpriteData[] = { |
276 /* X direction */ |
267 /* X direction */ |
277 /* Flat tiles: */ |
268 /* Flat tiles: */ |
278 /* Wires */ |
269 /* Wires */ |
279 { SPR_WIRE_X_SW, 0, 8, 16, 1, 1, ELRAIL_ELEVATION }, //! 0: Wire in X direction, pylon on the SW end only |
270 { SPR_WIRE_X_SW, 0, 7, 15, 1, 1, ELRAIL_ELEVATION }, //! 0: Wire in X direction, pylon on the SW end only |
280 { SPR_WIRE_X_NE, 0, 8, 16, 1, 1, ELRAIL_ELEVATION }, //! 1: Wire in X direction, pylon on the NE end |
271 { SPR_WIRE_X_NE, 0, 7, 15, 1, 1, ELRAIL_ELEVATION }, //! 1: Wire in X direction, pylon on the NE end |
281 { SPR_WIRE_X_SHORT, 0, 8, 16, 1, 1, ELRAIL_ELEVATION }, //! 2: Wire in X direction, pylon on both ends |
272 { SPR_WIRE_X_SHORT, 0, 7, 15, 1, 1, ELRAIL_ELEVATION }, //! 2: Wire in X direction, pylon on both ends |
282 |
273 |
283 /* "up" tiles */ |
274 /* "up" tiles */ |
284 /* Wires */ |
275 /* Wires */ |
285 { SPR_WIRE_X_SW_UP, 0, 8, 16, 8, 1, ELRAIL_ELEVRAISE }, //! 3: Wire in X pitch up, pylon on the SW end only |
276 { SPR_WIRE_X_SW_UP, 0, 7, 15, 8, 1, ELRAIL_ELEVRAISE }, //! 3: Wire in X pitch up, pylon on the SW end only |
286 { SPR_WIRE_X_NE_UP, 0, 8, 16, 8, 1, ELRAIL_ELEVRAISE }, //! 4: Wire in X pitch up, pylon on the NE end |
277 { SPR_WIRE_X_NE_UP, 0, 7, 15, 8, 1, ELRAIL_ELEVRAISE }, //! 4: Wire in X pitch up, pylon on the NE end |
287 { SPR_WIRE_X_SHORT_UP, 0, 8, 16, 8, 1, ELRAIL_ELEVRAISE }, //! 5: Wire in X pitch up, pylon on both ends |
278 { SPR_WIRE_X_SHORT_UP, 0, 7, 15, 8, 1, ELRAIL_ELEVRAISE }, //! 5: Wire in X pitch up, pylon on both ends |
288 |
279 |
289 /* "down" tiles */ |
280 /* "down" tiles */ |
290 /* Wires */ |
281 /* Wires */ |
291 { SPR_WIRE_X_SW_DOWN, 0, 8, 16, 8, 1, ELRAIL_ELEV_CORR }, //! 6: Wire in X pitch down, pylon on the SW end |
282 { SPR_WIRE_X_SW_DOWN, 0, 7, 15, 8, 1, ELRAIL_ELEVATION }, //! 6: Wire in X pitch down, pylon on the SW end |
292 { SPR_WIRE_X_NE_DOWN, 0, 8, 16, 8, 1, ELRAIL_ELEV_CORR }, //! 7: Wire in X pitch down, pylon on the NE end |
283 { SPR_WIRE_X_NE_DOWN, 0, 7, 15, 8, 1, ELRAIL_ELEVATION }, //! 7: Wire in X pitch down, pylon on the NE end |
293 { SPR_WIRE_X_SHORT_DOWN, 0, 8, 16, 8, 1, ELRAIL_ELEV_CORR }, //! 8: Wire in X pitch down, pylon on both ends |
284 { SPR_WIRE_X_SHORT_DOWN, 0, 7, 15, 8, 1, ELRAIL_ELEVATION }, //! 8: Wire in X pitch down, pylon on both ends |
294 |
285 |
295 |
286 |
296 /* Y direction */ |
287 /* Y direction */ |
297 /* Flat tiles: */ |
288 /* Flat tiles: */ |
298 /* Wires */ |
289 /* Wires */ |
299 { SPR_WIRE_Y_SE, 8, 0, 1, 16, 1, ELRAIL_ELEVATION }, //! 9: Wire in Y direction, pylon on the SE end only |
290 { SPR_WIRE_Y_SE, 7, 0, 1, 15, 1, ELRAIL_ELEVATION }, //! 9: Wire in Y direction, pylon on the SE end only |
300 { SPR_WIRE_Y_NW, 8, 0, 1, 16, 1, ELRAIL_ELEVATION }, //!10: Wire in Y direction, pylon on the NW end |
291 { SPR_WIRE_Y_NW, 7, 0, 1, 15, 1, ELRAIL_ELEVATION }, //!10: Wire in Y direction, pylon on the NW end |
301 { SPR_WIRE_Y_SHORT, 8, 0, 1, 16, 1, ELRAIL_ELEVATION }, //!11: Wire in Y direction, pylon on both ends |
292 { SPR_WIRE_Y_SHORT, 7, 0, 1, 15, 1, ELRAIL_ELEVATION }, //!11: Wire in Y direction, pylon on both ends |
302 |
293 |
303 /* "up" tiles */ |
294 /* "up" tiles */ |
304 /* Wires */ |
295 /* Wires */ |
305 { SPR_WIRE_Y_SE_UP, 8, 0, 8, 16, 1, ELRAIL_ELEVRAISE }, //!12: Wire in Y pitch up, pylon on the SE end only |
296 { SPR_WIRE_Y_SE_UP, 7, 0, 8, 15, 1, ELRAIL_ELEVRAISE }, //!12: Wire in Y pitch up, pylon on the SE end only |
306 { SPR_WIRE_Y_NW_UP, 8, 0, 8, 16, 1, ELRAIL_ELEVRAISE }, //!13: Wire in Y pitch up, pylon on the NW end |
297 { SPR_WIRE_Y_NW_UP, 7, 0, 8, 15, 1, ELRAIL_ELEVRAISE }, //!13: Wire in Y pitch up, pylon on the NW end |
307 { SPR_WIRE_Y_SHORT_UP, 8, 0, 8, 16, 1, ELRAIL_ELEVRAISE }, //!14: Wire in Y pitch up, pylon on both ends |
298 { SPR_WIRE_Y_SHORT_UP, 7, 0, 8, 15, 1, ELRAIL_ELEVRAISE }, //!14: Wire in Y pitch up, pylon on both ends |
308 |
299 |
309 /* "down" tiles */ |
300 /* "down" tiles */ |
310 /* Wires */ |
301 /* Wires */ |
311 { SPR_WIRE_Y_SE_DOWN, 8, 0, 8, 16, 1, ELRAIL_ELEV_CORR }, //!15: Wire in Y pitch down, pylon on the SE end |
302 { SPR_WIRE_Y_SE_DOWN, 7, 0, 8, 15, 1, ELRAIL_ELEVATION }, //!15: Wire in Y pitch down, pylon on the SE end |
312 { SPR_WIRE_Y_NW_DOWN, 8, 0, 8, 16, 1, ELRAIL_ELEV_CORR }, //!16: Wire in Y pitch down, pylon on the NW end |
303 { SPR_WIRE_Y_NW_DOWN, 7, 0, 8, 15, 1, ELRAIL_ELEVATION }, //!16: Wire in Y pitch down, pylon on the NW end |
313 { SPR_WIRE_Y_SHORT_DOWN, 8, 0, 8, 16, 1, ELRAIL_ELEV_CORR }, //!17: Wire in Y pitch down, pylon on both ends |
304 { SPR_WIRE_Y_SHORT_DOWN, 7, 0, 8, 15, 1, ELRAIL_ELEVATION }, //!17: Wire in Y pitch down, pylon on both ends |
314 |
305 |
315 /* NS Direction */ |
306 /* NS Direction */ |
316 { SPR_WIRE_NS_SHORT, 8, 0, 8, 8, 1, ELRAIL_ELEVATION }, //!18: LEFT trackbit wire, pylon on both ends |
307 { SPR_WIRE_NS_SHORT, 8, 0, 8, 8, 1, ELRAIL_ELEVATION }, //!18: LEFT trackbit wire, pylon on both ends |
317 { SPR_WIRE_NS_SHORT, 0, 8, 8, 8, 1, ELRAIL_ELEVATION }, //!19: RIGHT trackbit wire, pylon on both ends |
308 { SPR_WIRE_NS_SHORT, 0, 8, 8, 8, 1, ELRAIL_ELEVATION }, //!19: RIGHT trackbit wire, pylon on both ends |
318 |
309 |
321 |
312 |
322 { SPR_WIRE_NS_S, 8, 0, 8, 8, 1, ELRAIL_ELEVATION }, //!22: LEFT trackbit wire, pylon on S end |
313 { SPR_WIRE_NS_S, 8, 0, 8, 8, 1, ELRAIL_ELEVATION }, //!22: LEFT trackbit wire, pylon on S end |
323 { SPR_WIRE_NS_S, 0, 8, 8, 8, 1, ELRAIL_ELEVATION }, //!23: RIGHT trackbit wire, pylon on S end |
314 { SPR_WIRE_NS_S, 0, 8, 8, 8, 1, ELRAIL_ELEVATION }, //!23: RIGHT trackbit wire, pylon on S end |
324 |
315 |
325 /* EW Direction */ |
316 /* EW Direction */ |
326 { SPR_WIRE_EW_SHORT, 8, 0, 8, 8, 1, ELRAIL_ELEVATION }, //!24: UPPER trackbit wire, pylon on both ends |
317 { SPR_WIRE_EW_SHORT, 7, 0, 1, 1, 1, ELRAIL_ELEVATION }, //!24: UPPER trackbit wire, pylon on both ends |
327 { SPR_WIRE_EW_SHORT, 16, 8, 8, 8, 1, ELRAIL_ELEVATION }, //!25: LOWER trackbit wire, pylon on both ends |
318 { SPR_WIRE_EW_SHORT, 15, 8, 3, 3, 1, ELRAIL_ELEVATION }, //!25: LOWER trackbit wire, pylon on both ends |
328 |
319 |
329 { SPR_WIRE_EW_W, 8, 0, 8, 8, 1, ELRAIL_ELEVATION }, //!28: UPPER trackbit wire, pylon on both ends |
320 { SPR_WIRE_EW_W, 7, 0, 1, 1, 1, ELRAIL_ELEVATION }, //!28: UPPER trackbit wire, pylon on both ends |
330 { SPR_WIRE_EW_W, 16, 8, 8, 8, 1, ELRAIL_ELEVATION }, //!29: LOWER trackbit wire, pylon on both ends |
321 { SPR_WIRE_EW_W, 15, 8, 3, 3, 1, ELRAIL_ELEVATION }, //!29: LOWER trackbit wire, pylon on both ends |
331 |
322 |
332 { SPR_WIRE_EW_E, 8, 0, 8, 8, 1, ELRAIL_ELEVATION }, //!32: UPPER trackbit wire, pylon on both ends |
323 { SPR_WIRE_EW_E, 7, 0, 1, 1, 1, ELRAIL_ELEVATION }, //!32: UPPER trackbit wire, pylon on both ends |
333 { SPR_WIRE_EW_E, 16, 8, 8, 8, 1, ELRAIL_ELEVATION } //!33: LOWER trackbit wire, pylon on both ends |
324 { SPR_WIRE_EW_E, 15, 8, 3, 3, 1, ELRAIL_ELEVATION } //!33: LOWER trackbit wire, pylon on both ends |
334 }; |
325 }; |
335 |
326 |
336 static const SortableSpriteStruct CatenarySpriteData_Depot[] = { |
327 static const SortableSpriteStruct CatenarySpriteData_Depot[] = { |
337 { SPR_WIRE_DEPOT_NE, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //! Wire for NE depot exit |
328 { SPR_WIRE_DEPOT_NE, 0, 7, 15, 1, 1, ELRAIL_ELEVATION }, //! Wire for NE depot exit |
338 { SPR_WIRE_DEPOT_SE, 8, 0, 1, 8, 1, ELRAIL_ELEVATION }, //! Wire for SE depot exit |
329 { SPR_WIRE_DEPOT_SE, 7, 0, 1, 15, 1, ELRAIL_ELEVATION }, //! Wire for SE depot exit |
339 { SPR_WIRE_DEPOT_SW, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //! Wire for SW depot exit |
330 { SPR_WIRE_DEPOT_SW, 0, 7, 15, 1, 1, ELRAIL_ELEVATION }, //! Wire for SW depot exit |
340 { SPR_WIRE_DEPOT_NW, 8, 0, 1, 8, 1, ELRAIL_ELEVATION } //! Wire for NW depot exit |
331 { SPR_WIRE_DEPOT_NW, 7, 0, 1, 15, 1, ELRAIL_ELEVATION } //! Wire for NW depot exit |
341 }; |
332 }; |
342 |
333 |
343 static const SortableSpriteStruct CatenarySpriteData_Tunnel[] = { |
334 static const SortableSpriteStruct CatenarySpriteData_Tunnel[] = { |
344 { SPR_WIRE_TUNNEL_NE, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //! Wire for NE tunnel exit |
335 { SPR_WIRE_TUNNEL_NE, 0, 7, 15, 1, 1, ELRAIL_ELEVATION }, //! Wire for NE tunnel exit |
345 { SPR_WIRE_TUNNEL_SE, 8, 0, 1, 8, 1, ELRAIL_ELEVATION }, //! Wire for SE tunnel exit |
336 { SPR_WIRE_TUNNEL_SE, 7, 0, 1, 15, 1, ELRAIL_ELEVATION }, //! Wire for SE tunnel exit |
346 { SPR_WIRE_TUNNEL_SW, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //! Wire for SW tunnel exit |
337 { SPR_WIRE_TUNNEL_SW, 0, 7, 15, 1, 1, ELRAIL_ELEVATION }, //! Wire for SW tunnel exit |
347 { SPR_WIRE_TUNNEL_NW, 8, 0, 1, 8, 1, ELRAIL_ELEVATION } //! Wire for NW tunnel exit |
338 { SPR_WIRE_TUNNEL_NW, 7, 0, 1, 15, 1, ELRAIL_ELEVATION } //! Wire for NW tunnel exit |
348 }; |
339 }; |
349 |
340 |
350 |
341 |
351 /** Refers to a certain element of the catenary. |
342 /** Refers to a certain element of the catenary. |
352 * Identifiers for Wires: |
343 * Identifiers for Wires: |