From 20b8c4844068a11ef50f094a76c93072e5f66144 Mon Sep 17 00:00:00 2001 From: tron Date: Tue, 22 Feb 2005 18:27:57 +0000 Subject: (svn r1903) Replace some casts and macro magic with proper typing, similar to r1902 --- table/track_land.h | 20 +++--- table/water_land.h | 181 ++++++++++++++++++++++++++++------------------------- 2 files changed, 104 insertions(+), 97 deletions(-) (limited to 'table') diff --git a/table/track_land.h b/table/track_land.h index 440048058..41df8b21d 100644 --- a/table/track_land.h +++ b/table/track_land.h @@ -1,41 +1,41 @@ -#define TILE_SEQ_BEGIN(x) ADD_WORD(x), -#define TILE_SEQ_LINE(a,b,c,d,e) ADD_WORD(a), b,c,d,e, -#define TILE_SEQ_END() 0,0,0,0 +#define TILE_SEQ_BEGIN(x) { x, 0, 0, 0, 0 }, +#define TILE_SEQ_LINE(a, b, c, d, e) { a, b, c, d, e }, +#define TILE_SEQ_END() { 0, 0, 0, 0, 0 } -static const byte _track_depot_layout_table_0[] = { +static const DrawTrackSeqStruct _track_depot_layout_table_0[] = { TILE_SEQ_BEGIN(0xF8D) TILE_SEQ_LINE(0x842B, 2, 13, 13, 1) TILE_SEQ_END() }; -static const byte _track_depot_layout_table_1[] = { +static const DrawTrackSeqStruct _track_depot_layout_table_1[] = { TILE_SEQ_BEGIN(0x83F3) TILE_SEQ_LINE(0x8427, 2, 2, 1, 13) TILE_SEQ_LINE(0x8428, 13, 2, 1, 13) TILE_SEQ_END() }; -static const byte _track_depot_layout_table_2[] = { +static const DrawTrackSeqStruct _track_depot_layout_table_2[] = { TILE_SEQ_BEGIN(0x83F4) TILE_SEQ_LINE(0x8429, 2, 2, 13, 1) TILE_SEQ_LINE(0x842A, 2, 13, 13, 1) TILE_SEQ_END() }; -static const byte _track_depot_layout_table_3[] = { +static const DrawTrackSeqStruct _track_depot_layout_table_3[] = { TILE_SEQ_BEGIN(0xF8D) TILE_SEQ_LINE(0x842C, 13, 2, 1, 13) TILE_SEQ_END() }; -static const byte _track_waypoint_table_0[] = { +static const DrawTrackSeqStruct _track_waypoint_table_0[] = { TILE_SEQ_BEGIN(0x83F4) TILE_SEQ_LINE(0x8000 + SPR_OPENTTD_BASE+18, 0, 0, 16, 5) TILE_SEQ_LINE(0x8000 + SPR_OPENTTD_BASE+19, 0, 11, 16, 5) TILE_SEQ_END() }; -static const byte _track_waypoint_table_1[] = { +static const DrawTrackSeqStruct _track_waypoint_table_1[] = { TILE_SEQ_BEGIN(0x83F3) TILE_SEQ_LINE(0x8000 + SPR_OPENTTD_BASE+20, 0, 0, 5, 16) TILE_SEQ_LINE(0x8000 + SPR_OPENTTD_BASE+21, 11, 0, 5, 16) @@ -43,7 +43,7 @@ static const byte _track_waypoint_table_1[] = { }; -static const byte * const _track_depot_layout_table[6] = { +static const DrawTrackSeqStruct* const _track_depot_layout_table[] = { _track_depot_layout_table_0, _track_depot_layout_table_1, _track_depot_layout_table_2, diff --git a/table/water_land.h b/table/water_land.h index df11ecaa7..ab8aad1cd 100644 --- a/table/water_land.h +++ b/table/water_land.h @@ -1,130 +1,134 @@ -static const byte _shipdepot_display_seq_1[] = { - ADD_WORD(0xFDD), +typedef struct WaterDrawTileStruct { + byte delta_x; + byte delta_y; + byte delta_z; + byte width; + byte height; + byte unk; + SpriteID image; +} WaterDrawTileStruct; - 0,15,0,16,1,0x14, - ADD_WORD(0x8FE8), +#define BEGIN(image) { 0, 0, 0, 0, 0, 0, image } +#define END(y) { 0x80, y, 0, 0, 0, 0, 0 } - 0x80 +static const WaterDrawTileStruct _shipdepot_display_seq_1[] = { + BEGIN(0xFDD), + { 0, 15, 0, 16, 1, 0x14, 0x8FE8 }, + END(0) }; -static const byte _shipdepot_display_seq_2[] = { - ADD_WORD(0xFDD), - - 0,0,0,16,1,0x14, ADD_WORD(0xFEA), - 0,15,0,16,1,0x14, ADD_WORD(0x8FE6), - - 0x80 +static const WaterDrawTileStruct _shipdepot_display_seq_2[] = { + BEGIN(0xFDD), + { 0, 0, 0, 16, 1, 0x14, 0xFEA }, + { 0, 15, 0, 16, 1, 0x14, 0x8FE6 }, + END(0) }; -static const byte _shipdepot_display_seq_3[] = { - ADD_WORD(0xFDD), - - 15,0,0,1,0x10,0x14,ADD_WORD(0x8FE9), - - 0x80 +static const WaterDrawTileStruct _shipdepot_display_seq_3[] = { + BEGIN(0xFDD), + { 15, 0, 0, 1, 0x10, 0x14, 0x8FE9 }, + END(0) }; -static const byte _shipdepot_display_seq_4[] = { - ADD_WORD(0xFDD), - - 0,0,0,1,16,0x14, ADD_WORD(0xFEB), - 15,0,0,1,16,0x14, ADD_WORD(0x8FE7), - - 0x80 +static const WaterDrawTileStruct _shipdepot_display_seq_4[] = { + BEGIN(0xFDD), + { 0, 0, 0, 1, 16, 0x14, 0xFEB }, + { 15, 0, 0, 1, 16, 0x14, 0x8FE7 }, + END(0) }; -static const byte * const _shipdepot_display_seq[] = { +static const WaterDrawTileStruct* const _shipdepot_display_seq[] = { _shipdepot_display_seq_1, _shipdepot_display_seq_2, _shipdepot_display_seq_3, _shipdepot_display_seq_4, }; -static const byte _shiplift_display_seq_0[] = { - ADD_WORD(SPR_CANALS_BASE + 6), - 0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 0 + 1), - 0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 4 + 1), - 0x80, 0 +static const WaterDrawTileStruct _shiplift_display_seq_0[] = { + BEGIN(SPR_CANALS_BASE + 6), + { 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 0 + 1 }, + { 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 4 + 1 }, + END(0) }; -static const byte _shiplift_display_seq_1[] = { - ADD_WORD(SPR_CANALS_BASE + 5), - 0, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 0), - 0xF, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 4), - 0x80, 0 +static const WaterDrawTileStruct _shiplift_display_seq_1[] = { + BEGIN(SPR_CANALS_BASE + 5), + { 0, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 0 }, + { 0xF, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 4 }, + END(0) }; -static const byte _shiplift_display_seq_2[] = { - ADD_WORD(SPR_CANALS_BASE + 7), - 0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 0 + 2), - 0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 4 + 2), - 0x80, 0 +static const WaterDrawTileStruct _shiplift_display_seq_2[] = { + BEGIN(SPR_CANALS_BASE + 7), + { 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 0 + 2 }, + { 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 4 + 2 }, + END(0) }; -static const byte _shiplift_display_seq_3[] = { - ADD_WORD(SPR_CANALS_BASE + 8), - 0, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 0 + 3), - 0xF, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 4 + 3), - 0x80, 0 +static const WaterDrawTileStruct _shiplift_display_seq_3[] = { + BEGIN(SPR_CANALS_BASE + 8), + { 0, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 0 + 3 }, + { 0xF, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 4 + 3 }, + END(0) }; -static const byte _shiplift_display_seq_0b[] = { - ADD_WORD(0xFDD), - 0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 8 + 1), - 0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 12 + 1), - 0x80, 0 +static const WaterDrawTileStruct _shiplift_display_seq_0b[] = { + BEGIN(0xFDD), + { 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 8 + 1 }, + { 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 12 + 1 }, + END(0) }; -static const byte _shiplift_display_seq_1b[] = { - ADD_WORD(0xFDD), - 0, 0, 0, 0x1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 8), - 0xF, 0, 0, 0x1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 12), - 0x80, 0 +static const WaterDrawTileStruct _shiplift_display_seq_1b[] = { + BEGIN(0xFDD), + { 0, 0, 0, 0x1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 8 }, + { 0xF, 0, 0, 0x1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 12 }, + END(0) }; -static const byte _shiplift_display_seq_2b[] = { - ADD_WORD(0xFDD), - 0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 8 + 2), - 0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 12 + 2), - 0x80, 0 +static const WaterDrawTileStruct _shiplift_display_seq_2b[] = { + BEGIN(0xFDD), + { 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 8 + 2 }, + { 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 12 + 2 }, + END(0) }; -static const byte _shiplift_display_seq_3b[] = { - ADD_WORD(0xFDD), - 0, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 8 + 3), - 0xF, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 12 + 3), - 0x80, 0 +static const WaterDrawTileStruct _shiplift_display_seq_3b[] = { + BEGIN(0xFDD), + { 0, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 8 + 3 }, + { 0xF, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 12 + 3 }, + END(0) }; -static const byte _shiplift_display_seq_0t[] = { - ADD_WORD(0xFDD), - 0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 16 + 1), - 0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 20 + 1), - 0x80, 8 +static const WaterDrawTileStruct _shiplift_display_seq_0t[] = { + BEGIN(0xFDD), + { 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 16 + 1 }, + { 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 20 + 1 }, + END(8) }; -static const byte _shiplift_display_seq_1t[] = { - ADD_WORD(0xFDD), - 0, 0, 0, 0x1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 16), - 0xF, 0, 0, 0x1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 20), - 0x80, 8 +static const WaterDrawTileStruct _shiplift_display_seq_1t[] = { + BEGIN(0xFDD), + { 0, 0, 0, 0x1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 16 }, + { 0xF, 0, 0, 0x1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 20 }, + END(8) }; -static const byte _shiplift_display_seq_2t[] = { - ADD_WORD(0xFDD), - 0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 16 + 2), - 0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 20 + 2), - 0x80, 8 +static const WaterDrawTileStruct _shiplift_display_seq_2t[] = { + BEGIN(0xFDD), + { 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 16 + 2 }, + { 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 20 + 2 }, + END(8) }; -static const byte _shiplift_display_seq_3t[] = { - ADD_WORD(0xFDD), - 0, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 16 + 3), - 0xF, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 20 + 3), - 0x80, 8 +static const WaterDrawTileStruct _shiplift_display_seq_3t[] = { + BEGIN(0xFDD), + { 0, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 16 + 3 }, + { 0xF, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 20 + 3 }, + END(8) }; -static const byte * const _shiplift_display_seq[] = { +static const WaterDrawTileStruct* const _shiplift_display_seq[] = { _shiplift_display_seq_0, _shiplift_display_seq_1, _shiplift_display_seq_2, @@ -141,6 +145,9 @@ static const byte * const _shiplift_display_seq[] = { _shiplift_display_seq_3t, }; +#undef BEGIN +#undef END + static const SpriteID _water_shore_sprites[15] = { 0, 0xFDF, 0xFE0, 0xFE4, 0xFDE, 0, 0xFE2, 0, 0xFE1, 0xFE5, 0, 0, 0xFE3, 0, 0 -- cgit v1.2.3-54-g00ecf