summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-02-15 18:40:42 +0000
committerfrosch <frosch@openttd.org>2008-02-15 18:40:42 +0000
commita13899ee8eba04189d4057f7ccf6a9deeba13dc3 (patch)
tree2cd7d2f6b962e9d7a99091f185e1a5aa591f0784 /src
parentae996a270b4b13b1130249e9249b3fa92caed3d9 (diff)
downloadopenttd-a13899ee8eba04189d4057f7ccf6a9deeba13dc3.tar.xz
(svn r12149) -Codechange: Merge 'ground_sprite' and 'ground_pal' of DrawTileSprites into one PalSpriteID
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp60
-rw-r--r--src/newgrf_house.cpp4
-rw-r--r--src/newgrf_industrytiles.cpp4
-rw-r--r--src/newgrf_station.cpp2
-rw-r--r--src/rail_cmd.cpp10
-rw-r--r--src/road_cmd.cpp4
-rw-r--r--src/sprite.h3
-rw-r--r--src/station_cmd.cpp6
-rw-r--r--src/table/road_land.h16
-rw-r--r--src/table/station_land.h2
-rw-r--r--src/table/track_land.h12
-rw-r--r--src/table/unmovable_land.h2
-rw-r--r--src/unmovable_cmd.cpp2
13 files changed, 63 insertions, 64 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index b054dba8e..f18e900e2 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -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);
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index 7202f80ac..88494b33e 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -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;
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index 3d6d5ae6e..2ca61fd01 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -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;
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 9909cba7e..8c0b0ac29 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -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;
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index ffbbc1d3d..2f6c003f1 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -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)
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index af3a4d558..22c978ae3 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -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);
diff --git a/src/sprite.h b/src/sprite.h
index 23b95ed04..11054c6a4 100644
--- a/src/sprite.h
+++ b/src/sprite.h
@@ -34,8 +34,7 @@ struct DrawTileSeqStruct {
};
struct DrawTileSprites {
- SpriteID ground_sprite;
- SpriteID ground_pal;
+ PalSpriteID ground;
const DrawTileSeqStruct *seq;
};
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 95f7e4fd1..47c41087d 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -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;
diff --git a/src/table/road_land.h b/src/table/road_land.h
index 32980606a..2f8891692 100644
--- a/src/table/road_land.h
+++ b/src/table/road_land.h
@@ -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
diff --git a/src/table/station_land.h b/src/table/station_land.h
index 87523d5f5..b0fa4b366 100644
--- a/src/table/station_land.h
+++ b/src/table/station_land.h
@@ -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)
diff --git a/src/table/track_land.h b/src/table/track_land.h
index 176c35399..920595cb1 100644
--- a/src/table/track_land.h
+++ b/src/table/track_land.h
@@ -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
diff --git a/src/table/unmovable_land.h b/src/table/unmovable_land.h
index 123698181..887e432bf 100644
--- a/src/table/unmovable_land.h
+++ b/src/table/unmovable_land.h
@@ -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)
diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp
index ef6d0f056..f02eac7da 100644
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -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(