mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r1903) Replace some casts and macro magic with proper typing, similar to r1902
This commit is contained in:
parent
c2a6d182d7
commit
20b8c48440
21
rail_cmd.c
21
rail_cmd.c
|
@ -1620,7 +1620,6 @@ static void DrawTile_Track(TileInfo *ti)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* draw depots / waypoints */
|
/* draw depots / waypoints */
|
||||||
const byte *s;
|
|
||||||
const DrawTrackSeqStruct *drss;
|
const DrawTrackSeqStruct *drss;
|
||||||
byte type = m5 & 0x3F; // 0-3: depots, 4-5: waypoints
|
byte type = m5 & 0x3F; // 0-3: depots, 4-5: waypoints
|
||||||
|
|
||||||
|
@ -1664,9 +1663,9 @@ static void DrawTile_Track(TileInfo *ti)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s = _track_depot_layout_table[type];
|
drss = _track_depot_layout_table[type];
|
||||||
|
|
||||||
image = *(const uint16*)s;
|
image = drss++->image;
|
||||||
if (image & 0x8000) image = (image & 0x7FFF) + tracktype_offs;
|
if (image & 0x8000) image = (image & 0x7FFF) + tracktype_offs;
|
||||||
|
|
||||||
// adjust ground tile for desert
|
// adjust ground tile for desert
|
||||||
|
@ -1681,8 +1680,6 @@ static void DrawTile_Track(TileInfo *ti)
|
||||||
|
|
||||||
DrawGroundSprite(image);
|
DrawGroundSprite(image);
|
||||||
|
|
||||||
drss = (const DrawTrackSeqStruct*)(s + sizeof(uint16));
|
|
||||||
|
|
||||||
while ((image=drss->image) != 0) {
|
while ((image=drss->image) != 0) {
|
||||||
DrawSpecialBuilding(image, type < 4 ? tracktype_offs : 0, ti,
|
DrawSpecialBuilding(image, type < 4 ? tracktype_offs : 0, ti,
|
||||||
drss->subcoord_x, drss->subcoord_y, 0,
|
drss->subcoord_x, drss->subcoord_y, 0,
|
||||||
|
@ -1696,23 +1693,22 @@ void DrawTrainDepotSprite(int x, int y, int image, int railtype)
|
||||||
{
|
{
|
||||||
uint32 ormod, img;
|
uint32 ormod, img;
|
||||||
const DrawTrackSeqStruct *dtss;
|
const DrawTrackSeqStruct *dtss;
|
||||||
const byte *t;
|
|
||||||
|
|
||||||
/* baseimage */
|
/* baseimage */
|
||||||
railtype *= TRACKTYPE_SPRITE_PITCH;
|
railtype *= TRACKTYPE_SPRITE_PITCH;
|
||||||
|
|
||||||
ormod = PLAYER_SPRITE_COLOR(_local_player);
|
ormod = PLAYER_SPRITE_COLOR(_local_player);
|
||||||
|
|
||||||
t = _track_depot_layout_table[image];
|
dtss = _track_depot_layout_table[image];
|
||||||
|
|
||||||
x+=33;
|
x+=33;
|
||||||
y+=17;
|
y+=17;
|
||||||
|
|
||||||
img = *(const uint16*)t;
|
img = dtss++->image;
|
||||||
if (img & 0x8000) img = (img & 0x7FFF) + railtype;
|
if (img & 0x8000) img = (img & 0x7FFF) + railtype;
|
||||||
DrawSprite(img, x, y);
|
DrawSprite(img, x, y);
|
||||||
|
|
||||||
for(dtss = (const DrawTrackSeqStruct *)(t + sizeof(uint16)); dtss->image != 0; dtss++) {
|
for (; dtss->image != 0; dtss++) {
|
||||||
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
||||||
image = dtss->image;
|
image = dtss->image;
|
||||||
if (image & 0x8000) image |= ormod;
|
if (image & 0x8000) image |= ormod;
|
||||||
|
@ -1735,14 +1731,13 @@ void DrawWaypointSprite(int x, int y, int stat_id, int railtype)
|
||||||
|
|
||||||
// draw default waypoint graphics of ID 0
|
// draw default waypoint graphics of ID 0
|
||||||
if (stat_id == 0) {
|
if (stat_id == 0) {
|
||||||
const byte *t = _track_depot_layout_table[4];
|
const DrawTrackSeqStruct *dtss = _track_depot_layout_table[4];
|
||||||
const DrawTrackSeqStruct *dtss;
|
|
||||||
|
|
||||||
img = *(const uint16*)t;
|
img = dtss++->image;
|
||||||
if (img & 0x8000) img = (img & 0x7FFF) + railtype*TRACKTYPE_SPRITE_PITCH;
|
if (img & 0x8000) img = (img & 0x7FFF) + railtype*TRACKTYPE_SPRITE_PITCH;
|
||||||
DrawSprite(img, x, y);
|
DrawSprite(img, x, y);
|
||||||
|
|
||||||
for (dtss = (const DrawTrackSeqStruct *)(t + sizeof(uint16)); dtss->image != 0; dtss++) {
|
for (; dtss->image != 0; dtss++) {
|
||||||
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
||||||
img = dtss->image;
|
img = dtss->image;
|
||||||
if (img & 0x8000) img |= ormod;
|
if (img & 0x8000) img |= ormod;
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
#define TILE_SEQ_BEGIN(x) ADD_WORD(x),
|
#define TILE_SEQ_BEGIN(x) { x, 0, 0, 0, 0 },
|
||||||
#define TILE_SEQ_LINE(a,b,c,d,e) ADD_WORD(a), b,c,d,e,
|
#define TILE_SEQ_LINE(a, b, c, d, e) { a, b, c, d, e },
|
||||||
#define TILE_SEQ_END() 0,0,0,0
|
#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_BEGIN(0xF8D)
|
||||||
TILE_SEQ_LINE(0x842B, 2, 13, 13, 1)
|
TILE_SEQ_LINE(0x842B, 2, 13, 13, 1)
|
||||||
TILE_SEQ_END()
|
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_BEGIN(0x83F3)
|
||||||
TILE_SEQ_LINE(0x8427, 2, 2, 1, 13)
|
TILE_SEQ_LINE(0x8427, 2, 2, 1, 13)
|
||||||
TILE_SEQ_LINE(0x8428, 13, 2, 1, 13)
|
TILE_SEQ_LINE(0x8428, 13, 2, 1, 13)
|
||||||
TILE_SEQ_END()
|
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_BEGIN(0x83F4)
|
||||||
TILE_SEQ_LINE(0x8429, 2, 2, 13, 1)
|
TILE_SEQ_LINE(0x8429, 2, 2, 13, 1)
|
||||||
TILE_SEQ_LINE(0x842A, 2, 13, 13, 1)
|
TILE_SEQ_LINE(0x842A, 2, 13, 13, 1)
|
||||||
TILE_SEQ_END()
|
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_BEGIN(0xF8D)
|
||||||
TILE_SEQ_LINE(0x842C, 13, 2, 1, 13)
|
TILE_SEQ_LINE(0x842C, 13, 2, 1, 13)
|
||||||
TILE_SEQ_END()
|
TILE_SEQ_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _track_waypoint_table_0[] = {
|
static const DrawTrackSeqStruct _track_waypoint_table_0[] = {
|
||||||
TILE_SEQ_BEGIN(0x83F4)
|
TILE_SEQ_BEGIN(0x83F4)
|
||||||
TILE_SEQ_LINE(0x8000 + SPR_OPENTTD_BASE+18, 0, 0, 16, 5)
|
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_LINE(0x8000 + SPR_OPENTTD_BASE+19, 0, 11, 16, 5)
|
||||||
TILE_SEQ_END()
|
TILE_SEQ_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _track_waypoint_table_1[] = {
|
static const DrawTrackSeqStruct _track_waypoint_table_1[] = {
|
||||||
TILE_SEQ_BEGIN(0x83F3)
|
TILE_SEQ_BEGIN(0x83F3)
|
||||||
TILE_SEQ_LINE(0x8000 + SPR_OPENTTD_BASE+20, 0, 0, 5, 16)
|
TILE_SEQ_LINE(0x8000 + SPR_OPENTTD_BASE+20, 0, 0, 5, 16)
|
||||||
TILE_SEQ_LINE(0x8000 + SPR_OPENTTD_BASE+21, 11, 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_0,
|
||||||
_track_depot_layout_table_1,
|
_track_depot_layout_table_1,
|
||||||
_track_depot_layout_table_2,
|
_track_depot_layout_table_2,
|
||||||
|
|
|
@ -1,130 +1,134 @@
|
||||||
static const byte _shipdepot_display_seq_1[] = {
|
typedef struct WaterDrawTileStruct {
|
||||||
ADD_WORD(0xFDD),
|
byte delta_x;
|
||||||
|
byte delta_y;
|
||||||
|
byte delta_z;
|
||||||
|
byte width;
|
||||||
|
byte height;
|
||||||
|
byte unk;
|
||||||
|
SpriteID image;
|
||||||
|
} WaterDrawTileStruct;
|
||||||
|
|
||||||
0,15,0,16,1,0x14,
|
#define BEGIN(image) { 0, 0, 0, 0, 0, 0, image }
|
||||||
ADD_WORD(0x8FE8),
|
#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[] = {
|
static const WaterDrawTileStruct _shipdepot_display_seq_2[] = {
|
||||||
ADD_WORD(0xFDD),
|
BEGIN(0xFDD),
|
||||||
|
{ 0, 0, 0, 16, 1, 0x14, 0xFEA },
|
||||||
0,0,0,16,1,0x14, ADD_WORD(0xFEA),
|
{ 0, 15, 0, 16, 1, 0x14, 0x8FE6 },
|
||||||
0,15,0,16,1,0x14, ADD_WORD(0x8FE6),
|
END(0)
|
||||||
|
|
||||||
0x80
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shipdepot_display_seq_3[] = {
|
static const WaterDrawTileStruct _shipdepot_display_seq_3[] = {
|
||||||
ADD_WORD(0xFDD),
|
BEGIN(0xFDD),
|
||||||
|
{ 15, 0, 0, 1, 0x10, 0x14, 0x8FE9 },
|
||||||
15,0,0,1,0x10,0x14,ADD_WORD(0x8FE9),
|
END(0)
|
||||||
|
|
||||||
0x80
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shipdepot_display_seq_4[] = {
|
static const WaterDrawTileStruct _shipdepot_display_seq_4[] = {
|
||||||
ADD_WORD(0xFDD),
|
BEGIN(0xFDD),
|
||||||
|
{ 0, 0, 0, 1, 16, 0x14, 0xFEB },
|
||||||
0,0,0,1,16,0x14, ADD_WORD(0xFEB),
|
{ 15, 0, 0, 1, 16, 0x14, 0x8FE7 },
|
||||||
15,0,0,1,16,0x14, ADD_WORD(0x8FE7),
|
END(0)
|
||||||
|
|
||||||
0x80
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte * const _shipdepot_display_seq[] = {
|
static const WaterDrawTileStruct* const _shipdepot_display_seq[] = {
|
||||||
_shipdepot_display_seq_1,
|
_shipdepot_display_seq_1,
|
||||||
_shipdepot_display_seq_2,
|
_shipdepot_display_seq_2,
|
||||||
_shipdepot_display_seq_3,
|
_shipdepot_display_seq_3,
|
||||||
_shipdepot_display_seq_4,
|
_shipdepot_display_seq_4,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_0[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_0[] = {
|
||||||
ADD_WORD(SPR_CANALS_BASE + 6),
|
BEGIN(SPR_CANALS_BASE + 6),
|
||||||
0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 0 + 1),
|
{ 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 0 + 1 },
|
||||||
0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 4 + 1),
|
{ 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 4 + 1 },
|
||||||
0x80, 0
|
END(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_1[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_1[] = {
|
||||||
ADD_WORD(SPR_CANALS_BASE + 5),
|
BEGIN(SPR_CANALS_BASE + 5),
|
||||||
0, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 0),
|
{ 0, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 0 },
|
||||||
0xF, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 4),
|
{ 0xF, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 4 },
|
||||||
0x80, 0
|
END(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_2[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_2[] = {
|
||||||
ADD_WORD(SPR_CANALS_BASE + 7),
|
BEGIN(SPR_CANALS_BASE + 7),
|
||||||
0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 0 + 2),
|
{ 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 0 + 2 },
|
||||||
0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 4 + 2),
|
{ 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 4 + 2 },
|
||||||
0x80, 0
|
END(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_3[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_3[] = {
|
||||||
ADD_WORD(SPR_CANALS_BASE + 8),
|
BEGIN(SPR_CANALS_BASE + 8),
|
||||||
0, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 0 + 3),
|
{ 0, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 0 + 3 },
|
||||||
0xF, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 4 + 3),
|
{ 0xF, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 4 + 3 },
|
||||||
0x80, 0
|
END(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_0b[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_0b[] = {
|
||||||
ADD_WORD(0xFDD),
|
BEGIN(0xFDD),
|
||||||
0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 8 + 1),
|
{ 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 8 + 1 },
|
||||||
0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 12 + 1),
|
{ 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 12 + 1 },
|
||||||
0x80, 0
|
END(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_1b[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_1b[] = {
|
||||||
ADD_WORD(0xFDD),
|
BEGIN(0xFDD),
|
||||||
0, 0, 0, 0x1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 8),
|
{ 0, 0, 0, 0x1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 8 },
|
||||||
0xF, 0, 0, 0x1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 12),
|
{ 0xF, 0, 0, 0x1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 12 },
|
||||||
0x80, 0
|
END(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_2b[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_2b[] = {
|
||||||
ADD_WORD(0xFDD),
|
BEGIN(0xFDD),
|
||||||
0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 8 + 2),
|
{ 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 8 + 2 },
|
||||||
0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 12 + 2),
|
{ 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 12 + 2 },
|
||||||
0x80, 0
|
END(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_3b[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_3b[] = {
|
||||||
ADD_WORD(0xFDD),
|
BEGIN(0xFDD),
|
||||||
0, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 8 + 3),
|
{ 0, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 8 + 3 },
|
||||||
0xF, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 12 + 3),
|
{ 0xF, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 12 + 3 },
|
||||||
0x80, 0
|
END(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_0t[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_0t[] = {
|
||||||
ADD_WORD(0xFDD),
|
BEGIN(0xFDD),
|
||||||
0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 16 + 1),
|
{ 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 16 + 1 },
|
||||||
0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 20 + 1),
|
{ 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 20 + 1 },
|
||||||
0x80, 8
|
END(8)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_1t[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_1t[] = {
|
||||||
ADD_WORD(0xFDD),
|
BEGIN(0xFDD),
|
||||||
0, 0, 0, 0x1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 16),
|
{ 0, 0, 0, 0x1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 16 },
|
||||||
0xF, 0, 0, 0x1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 20),
|
{ 0xF, 0, 0, 0x1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 20 },
|
||||||
0x80, 8
|
END(8)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_2t[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_2t[] = {
|
||||||
ADD_WORD(0xFDD),
|
BEGIN(0xFDD),
|
||||||
0, 0, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 16 + 2),
|
{ 0, 0, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 16 + 2 },
|
||||||
0, 0xF, 0, 0x10, 1, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 20 + 2),
|
{ 0, 0xF, 0, 0x10, 1, 0x14, SPR_CANALS_BASE + 9 + 20 + 2 },
|
||||||
0x80, 8
|
END(8)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte _shiplift_display_seq_3t[] = {
|
static const WaterDrawTileStruct _shiplift_display_seq_3t[] = {
|
||||||
ADD_WORD(0xFDD),
|
BEGIN(0xFDD),
|
||||||
0, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 16 + 3),
|
{ 0, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 16 + 3 },
|
||||||
0xF, 0, 0, 1, 0x10, 0x14, ADD_WORD(SPR_CANALS_BASE + 9 + 20 + 3),
|
{ 0xF, 0, 0, 1, 0x10, 0x14, SPR_CANALS_BASE + 9 + 20 + 3 },
|
||||||
0x80, 8
|
END(8)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const byte * const _shiplift_display_seq[] = {
|
static const WaterDrawTileStruct* const _shiplift_display_seq[] = {
|
||||||
_shiplift_display_seq_0,
|
_shiplift_display_seq_0,
|
||||||
_shiplift_display_seq_1,
|
_shiplift_display_seq_1,
|
||||||
_shiplift_display_seq_2,
|
_shiplift_display_seq_2,
|
||||||
|
@ -141,6 +145,9 @@ static const byte * const _shiplift_display_seq[] = {
|
||||||
_shiplift_display_seq_3t,
|
_shiplift_display_seq_3t,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#undef BEGIN
|
||||||
|
#undef END
|
||||||
|
|
||||||
|
|
||||||
static const SpriteID _water_shore_sprites[15] = {
|
static const SpriteID _water_shore_sprites[15] = {
|
||||||
0, 0xFDF, 0xFE0, 0xFE4, 0xFDE, 0, 0xFE2, 0, 0xFE1, 0xFE5, 0, 0, 0xFE3, 0, 0
|
0, 0xFDF, 0xFE0, 0xFE4, 0xFDE, 0, 0xFE2, 0, 0xFE1, 0xFE5, 0, 0, 0xFE3, 0, 0
|
||||||
|
|
33
water_cmd.c
33
water_cmd.c
|
@ -364,16 +364,6 @@ void DrawCanalWater(uint tile)
|
||||||
else if ((wa & 9) == 9 && !IsWateredTile(TILE_ADDXY(tile, -1, -1))) DrawGroundSprite(SPR_CANALS_BASE + 57 + 11);
|
else if ((wa & 9) == 9 && !IsWateredTile(TILE_ADDXY(tile, -1, -1))) DrawGroundSprite(SPR_CANALS_BASE + 57 + 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct WaterDrawTileStruct {
|
|
||||||
int8 delta_x;
|
|
||||||
int8 delta_y;
|
|
||||||
int8 delta_z;
|
|
||||||
byte width;
|
|
||||||
byte height;
|
|
||||||
byte unk;
|
|
||||||
SpriteID image;
|
|
||||||
} WaterDrawTileStruct;
|
|
||||||
|
|
||||||
typedef struct LocksDrawTileStruct {
|
typedef struct LocksDrawTileStruct {
|
||||||
int8 delta_x, delta_y, delta_z;
|
int8 delta_x, delta_y, delta_z;
|
||||||
byte width, height, depth;
|
byte width, height, depth;
|
||||||
|
@ -382,15 +372,15 @@ typedef struct LocksDrawTileStruct {
|
||||||
|
|
||||||
#include "table/water_land.h"
|
#include "table/water_land.h"
|
||||||
|
|
||||||
static void DrawWaterStuff(TileInfo *ti, const byte *t, uint32 palette, uint base)
|
static void DrawWaterStuff(TileInfo *ti, const WaterDrawTileStruct *wdts,
|
||||||
|
uint32 palette, uint base
|
||||||
|
)
|
||||||
{
|
{
|
||||||
const WaterDrawTileStruct *wdts;
|
|
||||||
uint32 image;
|
uint32 image;
|
||||||
|
|
||||||
DrawGroundSprite(*(const uint16*)t);
|
DrawGroundSprite(wdts++->image);
|
||||||
t += sizeof(uint16);
|
|
||||||
|
|
||||||
for(wdts = (const WaterDrawTileStruct *)t; (byte)wdts->delta_x != 0x80; wdts++) {
|
for (; wdts->delta_x != 0x80; wdts++) {
|
||||||
image = wdts->image + base;
|
image = wdts->image + base;
|
||||||
if (_display_opt & DO_TRANS_BUILDINGS) {
|
if (_display_opt & DO_TRANS_BUILDINGS) {
|
||||||
image = (image & 0x3FFF) | 0x03224000;
|
image = (image & 0x3FFF) | 0x03224000;
|
||||||
|
@ -419,8 +409,8 @@ static void DrawTile_Water(TileInfo *ti)
|
||||||
|
|
||||||
// draw shiplift
|
// draw shiplift
|
||||||
if ((ti->map5 & 0xF0) == 0x10) {
|
if ((ti->map5 & 0xF0) == 0x10) {
|
||||||
const byte *t = _shiplift_display_seq[ti->map5 & 0xF];
|
const WaterDrawTileStruct *t = _shiplift_display_seq[ti->map5 & 0xF];
|
||||||
DrawWaterStuff(ti, t, 0, ti->z > t[19] ? 24 : 0);
|
DrawWaterStuff(ti, t, 0, ti->z > t[3].delta_y ? 24 : 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,14 +419,11 @@ static void DrawTile_Water(TileInfo *ti)
|
||||||
|
|
||||||
void DrawShipDepotSprite(int x, int y, int image)
|
void DrawShipDepotSprite(int x, int y, int image)
|
||||||
{
|
{
|
||||||
const byte *t;
|
const WaterDrawTileStruct *wdts = _shipdepot_display_seq[image];
|
||||||
const WaterDrawTileStruct *wdts;
|
|
||||||
|
|
||||||
t = _shipdepot_display_seq[image];
|
DrawSprite(wdts++->image, x, y);
|
||||||
DrawSprite(*(const uint16*)t, x, y);
|
|
||||||
t += sizeof(uint16);
|
|
||||||
|
|
||||||
for(wdts = (const WaterDrawTileStruct *)t; (byte)wdts->delta_x != 0x80; wdts++) {
|
for (; wdts->delta_x != 0x80; wdts++) {
|
||||||
Point pt = RemapCoords(wdts->delta_x, wdts->delta_y, wdts->delta_z);
|
Point pt = RemapCoords(wdts->delta_x, wdts->delta_y, wdts->delta_z);
|
||||||
DrawSprite(wdts->image + PLAYER_SPRITE_COLOR(_local_player), x + pt.x, y + pt.y);
|
DrawSprite(wdts->image + PLAYER_SPRITE_COLOR(_local_player), x + pt.x, y + pt.y);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue