(svn r12149) -Codechange: Merge 'ground_sprite' and 'ground_pal' of DrawTileSprites into one PalSpriteID

pull/155/head
frosch 17 years ago
parent ae996a270b
commit a13899ee8e

@ -929,24 +929,24 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
uint seq_count = 0;
dts->seq = NULL;
dts->ground_sprite = grf_load_word(&buf);
dts->ground_pal = grf_load_word(&buf);
if (dts->ground_sprite == 0) continue;
if (HasBit(dts->ground_pal, 15)) {
ClrBit(dts->ground_pal, 15);
SetBit(dts->ground_sprite, SPRITE_MODIFIER_USE_OFFSET);
dts->ground.sprite = grf_load_word(&buf);
dts->ground.pal = grf_load_word(&buf);
if (dts->ground.sprite == 0) continue;
if (HasBit(dts->ground.pal, 15)) {
ClrBit(dts->ground.pal, 15);
SetBit(dts->ground.sprite, SPRITE_MODIFIER_USE_OFFSET);
}
if (HasBit(dts->ground_pal, 14)) {
ClrBit(dts->ground_pal, 14);
SetBit(dts->ground_sprite, SPRITE_MODIFIER_OPAQUE);
if (HasBit(dts->ground.pal, 14)) {
ClrBit(dts->ground.pal, 14);
SetBit(dts->ground.sprite, SPRITE_MODIFIER_OPAQUE);
}
if (HasBit(dts->ground_sprite, 15)) {
ClrBit(dts->ground_sprite, 15);
SetBit(dts->ground_sprite, PALETTE_MODIFIER_COLOR);
if (HasBit(dts->ground.sprite, 15)) {
ClrBit(dts->ground.sprite, 15);
SetBit(dts->ground.sprite, PALETTE_MODIFIER_COLOR);
}
if (HasBit(dts->ground_sprite, 14)) {
ClrBit(dts->ground_sprite, 14);
SetBit(dts->ground_sprite, PALETTE_MODIFIER_TRANSPARENT);
if (HasBit(dts->ground.sprite, 14)) {
ClrBit(dts->ground.sprite, 14);
SetBit(dts->ground.sprite, PALETTE_MODIFIER_TRANSPARENT);
}
while (buf < *bufp + len) {
@ -2652,27 +2652,27 @@ static void NewSpriteGroup(byte *buf, int len)
group->g.layout.dts = CallocT<DrawTileSprites>(1);
/* Groundsprite */
group->g.layout.dts->ground_sprite = grf_load_word(&buf);
group->g.layout.dts->ground_pal = grf_load_word(&buf);
group->g.layout.dts->ground.sprite = grf_load_word(&buf);
group->g.layout.dts->ground.pal = grf_load_word(&buf);
/* Remap transparent/colour modifier bits */
if (HasBit(group->g.layout.dts->ground_sprite, 14)) {
ClrBit(group->g.layout.dts->ground_sprite, 14);
SetBit(group->g.layout.dts->ground_sprite, PALETTE_MODIFIER_TRANSPARENT);
if (HasBit(group->g.layout.dts->ground.sprite, 14)) {
ClrBit(group->g.layout.dts->ground.sprite, 14);
SetBit(group->g.layout.dts->ground.sprite, PALETTE_MODIFIER_TRANSPARENT);
}
if (HasBit(group->g.layout.dts->ground_sprite, 15)) {
ClrBit(group->g.layout.dts->ground_sprite, 15);
SetBit(group->g.layout.dts->ground_sprite, PALETTE_MODIFIER_COLOR);
if (HasBit(group->g.layout.dts->ground.sprite, 15)) {
ClrBit(group->g.layout.dts->ground.sprite, 15);
SetBit(group->g.layout.dts->ground.sprite, PALETTE_MODIFIER_COLOR);
}
if (HasBit(group->g.layout.dts->ground_pal, 14)) {
ClrBit(group->g.layout.dts->ground_pal, 14);
SetBit(group->g.layout.dts->ground_sprite, SPRITE_MODIFIER_OPAQUE);
if (HasBit(group->g.layout.dts->ground.pal, 14)) {
ClrBit(group->g.layout.dts->ground.pal, 14);
SetBit(group->g.layout.dts->ground.sprite, SPRITE_MODIFIER_OPAQUE);
}
if (HasBit(group->g.layout.dts->ground_pal, 15)) {
if (HasBit(group->g.layout.dts->ground.pal, 15)) {
/* Bit 31 set means this is a custom sprite, so rewrite it to the
* last spriteset defined. */
SpriteID sprite = _cur_grffile->spriteset_start + GB(group->g.layout.dts->ground_sprite, 0, 14) * sprites;
SB(group->g.layout.dts->ground_sprite, 0, SPRITE_WIDTH, sprite);
ClrBit(group->g.layout.dts->ground_pal, 15);
SpriteID sprite = _cur_grffile->spriteset_start + GB(group->g.layout.dts->ground.sprite, 0, 14) * sprites;
SB(group->g.layout.dts->ground.sprite, 0, SPRITE_WIDTH, sprite);
ClrBit(group->g.layout.dts->ground.pal, 15);
}
group->g.layout.dts->seq = CallocT<DrawTileSeqStruct>(num_sprites + 1);

@ -289,8 +289,8 @@ void DrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte stage, Ho
const DrawTileSprites *dts = group->g.layout.dts;
const DrawTileSeqStruct *dtss;
SpriteID image = dts->ground_sprite;
SpriteID pal = dts->ground_pal;
SpriteID image = dts->ground.sprite;
SpriteID pal = dts->ground.pal;
if (IS_CUSTOM_SPRITE(image)) image += stage;

@ -177,8 +177,8 @@ void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte r
const DrawTileSprites *dts = group->g.layout.dts;
const DrawTileSeqStruct *dtss;
SpriteID image = dts->ground_sprite;
SpriteID pal = dts->ground_pal;
SpriteID image = dts->ground.sprite;
SpriteID pal = dts->ground.pal;
if (IS_CUSTOM_SPRITE(image)) image += stage;

@ -772,7 +772,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
sprites = &statspec->renderdata[(tile < statspec->tiles) ? tile + axis : (uint)axis];
}
image = sprites->ground_sprite;
image = sprites->ground.sprite;
if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
image += GetCustomStationGroundRelocation(statspec, NULL, INVALID_TILE);
image += rti->custom_ground_offset;

@ -1760,7 +1760,7 @@ static void DrawTile_Track(TileInfo *ti)
relocation = rti->total_offset;
image = dts->ground_sprite;
image = dts->ground.sprite;
if (image != SPR_FLAT_GRASS_TILE) image += rti->total_offset;
/* adjust ground tile for desert
@ -1796,7 +1796,7 @@ static void DrawTile_Track(TileInfo *ti)
if (dts != NULL && dts->seq != NULL) {
relocation = GetCustomStationRelocation(statspec, st, ti->tile);
image = dts->ground_sprite;
image = dts->ground.sprite;
if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
image += rti->custom_ground_offset;
@ -1811,7 +1811,7 @@ default_waypoint:
/* There is no custom layout, fall back to the default graphics */
dts = &_waypoint_gfx_table[GetWaypointAxis(ti->tile)];
relocation = 0;
image = dts->ground_sprite + rti->total_offset;
image = dts->ground.sprite + rti->total_offset;
if (IsSnowRailGround(ti->tile)) image += rti->snow_offset;
}
}
@ -1872,7 +1872,7 @@ static void DrawTileSequence(int x, int y, SpriteID ground, const DrawTileSeqStr
void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype)
{
const DrawTileSprites* dts = &_depot_gfx_table[dir];
SpriteID image = dts->ground_sprite;
SpriteID image = dts->ground.sprite;
uint32 offset = GetRailTypeInfo(railtype)->total_offset;
if (image != SPR_FLAT_GRASS_TILE) image += offset;
@ -1884,7 +1884,7 @@ void DrawDefaultWaypointSprite(int x, int y, RailType railtype)
uint32 offset = GetRailTypeInfo(railtype)->total_offset;
const DrawTileSprites* dts = &_waypoint_gfx_table[AXIS_X];
DrawTileSequence(x, y, dts->ground_sprite + offset, dts->seq, 0);
DrawTileSequence(x, y, dts->ground.sprite + offset, dts->seq, 0);
}
static uint GetSlopeZ_Track(TileIndex tile, uint x, uint y)

@ -1114,7 +1114,7 @@ static void DrawTile_Road(TileInfo *ti)
dts = &_road_depot[GetRoadDepotDirection(ti->tile)];
}
DrawGroundSprite(dts->ground_sprite, PAL_NONE);
DrawGroundSprite(dts->ground.sprite, PAL_NONE);
for (dtss = dts->seq; dtss->image.sprite != 0; dtss++) {
SpriteID image = dtss->image.sprite;
@ -1149,7 +1149,7 @@ void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
x += 33;
y += 17;
DrawSprite(dts->ground_sprite, PAL_NONE, x, y);
DrawSprite(dts->ground.sprite, PAL_NONE, x, y);
for (dtss = dts->seq; dtss->image.sprite != 0; dtss++) {
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);

@ -34,8 +34,7 @@ struct DrawTileSeqStruct {
};
struct DrawTileSprites {
SpriteID ground_sprite;
SpriteID ground_pal;
PalSpriteID ground;
const DrawTileSeqStruct *seq;
};

@ -2170,7 +2170,7 @@ static void DrawTile_Station(TileInfo *ti)
}
}
} else {
SpriteID image = t->ground_sprite;
SpriteID image = t->ground.sprite;
if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
image += custom_ground_offset;
@ -2229,11 +2229,11 @@ void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, Ro
total_offset = rti->total_offset;
}
SpriteID img = t->ground_sprite;
SpriteID img = t->ground.sprite;
DrawSprite(img + total_offset, HasBit(img, PALETTE_MODIFIER_COLOR) ? pal : PAL_NONE, x, y);
if (roadtype == ROADTYPE_TRAM) {
DrawSprite(SPR_TRAMWAY_TRAM + (t->ground_sprite == SPR_ROAD_PAVED_STRAIGHT_X ? 1 : 0), PAL_NONE, x, y);
DrawSprite(SPR_TRAMWAY_TRAM + (t->ground.sprite == SPR_ROAD_PAVED_STRAIGHT_X ? 1 : 0), PAL_NONE, x, y);
}
const DrawTileSeqStruct *dtss;

@ -26,10 +26,10 @@ static const DrawTileSeqStruct _road_depot_NW[] = {
};
static const DrawTileSprites _road_depot[] = {
{ 0xA4A, PAL_NONE, _road_depot_NE },
{ 0xA4A, PAL_NONE, _road_depot_SE },
{ 0xA4A, PAL_NONE, _road_depot_SW },
{ 0xA4A, PAL_NONE, _road_depot_NW }
{ {0xA4A, PAL_NONE}, _road_depot_NE },
{ {0xA4A, PAL_NONE}, _road_depot_SE },
{ {0xA4A, PAL_NONE}, _road_depot_SW },
{ {0xA4A, PAL_NONE}, _road_depot_NW }
};
static const DrawTileSeqStruct _tram_depot_NE[] = {
@ -55,10 +55,10 @@ static const DrawTileSeqStruct _tram_depot_NW[] = {
};
static const DrawTileSprites _tram_depot[] = {
{ 0xA4A, PAL_NONE, _tram_depot_NE },
{ 0xA4A, PAL_NONE, _tram_depot_SE },
{ 0xA4A, PAL_NONE, _tram_depot_SW },
{ 0xA4A, PAL_NONE, _tram_depot_NW }
{ {0xA4A, PAL_NONE}, _tram_depot_NE },
{ {0xA4A, PAL_NONE}, _tram_depot_SE },
{ {0xA4A, PAL_NONE}, _tram_depot_SW },
{ {0xA4A, PAL_NONE}, _tram_depot_NW }
};
#undef TILE_SEQ_LINE

@ -993,7 +993,7 @@ static const DrawTileSeqStruct _station_display_datas_0171[] = {
#undef TILE_SEQ_LINE
#undef TILE_SEQ_LINE_PAL
#define TILE_SPRITE_LINE(img, dtss) { img, PAL_NONE, dtss },
#define TILE_SPRITE_LINE(img, dtss) { {img, PAL_NONE}, dtss },
static const DrawTileSprites _station_display_datas_rail[] = {
TILE_SPRITE_LINE(SPR_RAIL_TRACK_X, _station_display_datas_0)

@ -27,10 +27,10 @@ static const DrawTileSeqStruct _depot_gfx_NW[] = {
};
static const DrawTileSprites _depot_gfx_table[] = {
{ SPR_FLAT_GRASS_TILE, PAL_NONE, _depot_gfx_NE },
{ SPR_RAIL_TRACK_Y, PAL_NONE, _depot_gfx_SE },
{ SPR_RAIL_TRACK_X, PAL_NONE, _depot_gfx_SW },
{ SPR_FLAT_GRASS_TILE, PAL_NONE, _depot_gfx_NW }
{ {SPR_FLAT_GRASS_TILE, PAL_NONE}, _depot_gfx_NE },
{ {SPR_RAIL_TRACK_Y, PAL_NONE}, _depot_gfx_SE },
{ {SPR_RAIL_TRACK_X, PAL_NONE}, _depot_gfx_SW },
{ {SPR_FLAT_GRASS_TILE, PAL_NONE}, _depot_gfx_NW }
};
@ -47,8 +47,8 @@ static const DrawTileSeqStruct _waypoint_gfx_Y[] = {
};
static const DrawTileSprites _waypoint_gfx_table[] = {
{ SPR_RAIL_TRACK_X, PAL_NONE, _waypoint_gfx_X },
{ SPR_RAIL_TRACK_Y, PAL_NONE, _waypoint_gfx_Y }
{ {SPR_RAIL_TRACK_X, PAL_NONE}, _waypoint_gfx_X },
{ {SPR_RAIL_TRACK_Y, PAL_NONE}, _waypoint_gfx_Y }
};
#undef TILE_SEQ_LINE

@ -70,7 +70,7 @@ static const DrawTileSeqStruct _unmovable_display_datas_18[] = {
#undef TILE_SEQ_LINE
#undef TILE_SEQ_END
#define TILE_SPRITE_LINE(img, dtss) { img | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, dtss },
#define TILE_SPRITE_LINE(img, dtss) { {img | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE}, dtss },
static const DrawTileSprites _unmovable_display_datas[] = {
TILE_SPRITE_LINE(0xA2B, _unmovable_display_nothing)

@ -212,7 +212,7 @@ static void DrawTile_Unmovable(TileInfo *ti)
palette = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
t = &_unmovable_display_datas[GetCompanyHQSection(ti->tile)];
DrawGroundSprite(t->ground_sprite, palette);
DrawGroundSprite(t->ground.sprite, palette);
foreach_draw_tile_seq(dtss, t->seq) {
AddSortableSpriteToDraw(

Loading…
Cancel
Save