summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp58
-rw-r--r--src/newgrf_house.cpp6
-rw-r--r--src/newgrf_industrytiles.cpp6
-rw-r--r--src/newgrf_station.cpp2
-rw-r--r--src/rail_cmd.cpp8
-rw-r--r--src/road_cmd.cpp8
-rw-r--r--src/sprite.h3
-rw-r--r--src/station_cmd.cpp6
-rw-r--r--src/table/road_land.h4
-rw-r--r--src/table/station_land.h6
-rw-r--r--src/table/track_land.h4
-rw-r--r--src/table/unmovable_land.h4
-rw-r--r--src/unmovable_cmd.cpp2
13 files changed, 58 insertions, 59 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 0a65e65d1..b054dba8e 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -963,26 +963,26 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
dtss->size_x = grf_load_byte(&buf);
dtss->size_y = grf_load_byte(&buf);
dtss->size_z = grf_load_byte(&buf);
- dtss->image = grf_load_word(&buf);
- dtss->pal = grf_load_word(&buf);
+ dtss->image.sprite = grf_load_word(&buf);
+ dtss->image.pal = grf_load_word(&buf);
/* Remap flags as ours collide */
- if (HasBit(dtss->pal, 15)) {
- ClrBit(dtss->pal, 15);
- SetBit(dtss->image, SPRITE_MODIFIER_USE_OFFSET);
+ if (HasBit(dtss->image.pal, 15)) {
+ ClrBit(dtss->image.pal, 15);
+ SetBit(dtss->image.sprite, SPRITE_MODIFIER_USE_OFFSET);
}
- if (HasBit(dtss->pal, 14)) {
- ClrBit(dtss->pal, 14);
- SetBit(dtss->image, SPRITE_MODIFIER_OPAQUE);
+ if (HasBit(dtss->image.pal, 14)) {
+ ClrBit(dtss->image.pal, 14);
+ SetBit(dtss->image.sprite, SPRITE_MODIFIER_OPAQUE);
}
- if (HasBit(dtss->image, 15)) {
- ClrBit(dtss->image, 15);
- SetBit(dtss->image, PALETTE_MODIFIER_COLOR);
+ if (HasBit(dtss->image.sprite, 15)) {
+ ClrBit(dtss->image.sprite, 15);
+ SetBit(dtss->image.sprite, PALETTE_MODIFIER_COLOR);
}
- if (HasBit(dtss->image, 14)) {
- ClrBit(dtss->image, 14);
- SetBit(dtss->image, PALETTE_MODIFIER_TRANSPARENT);
+ if (HasBit(dtss->image.sprite, 14)) {
+ ClrBit(dtss->image.sprite, 14);
+ SetBit(dtss->image.sprite, PALETTE_MODIFIER_TRANSPARENT);
}
}
}
@@ -2680,29 +2680,29 @@ static void NewSpriteGroup(byte *buf, int len)
for (i = 0; i < num_sprites; i++) {
DrawTileSeqStruct *seq = (DrawTileSeqStruct*)&group->g.layout.dts->seq[i];
- seq->image = grf_load_word(&buf);
- seq->pal = grf_load_word(&buf);
+ seq->image.sprite = grf_load_word(&buf);
+ seq->image.pal = grf_load_word(&buf);
seq->delta_x = grf_load_byte(&buf);
seq->delta_y = grf_load_byte(&buf);
- if (HasBit(seq->image, 14)) {
- ClrBit(seq->image, 14);
- SetBit(seq->image, PALETTE_MODIFIER_TRANSPARENT);
+ if (HasBit(seq->image.sprite, 14)) {
+ ClrBit(seq->image.sprite, 14);
+ SetBit(seq->image.sprite, PALETTE_MODIFIER_TRANSPARENT);
}
- if (HasBit(seq->image, 15)) {
- ClrBit(seq->image, 15);
- SetBit(seq->image, PALETTE_MODIFIER_COLOR);
+ if (HasBit(seq->image.sprite, 15)) {
+ ClrBit(seq->image.sprite, 15);
+ SetBit(seq->image.sprite, PALETTE_MODIFIER_COLOR);
}
- if (HasBit(seq->pal, 14)) {
- ClrBit(seq->pal, 14);
- SetBit(seq->image, SPRITE_MODIFIER_OPAQUE);
+ if (HasBit(seq->image.pal, 14)) {
+ ClrBit(seq->image.pal, 14);
+ SetBit(seq->image.sprite, SPRITE_MODIFIER_OPAQUE);
}
- if (HasBit(seq->pal, 15)) {
+ if (HasBit(seq->image.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(seq->image, 0, 14) * sprites;
- SB(seq->image, 0, SPRITE_WIDTH, sprite);
- ClrBit(seq->pal, 15);
+ SpriteID sprite = _cur_grffile->spriteset_start + GB(seq->image.sprite, 0, 14) * sprites;
+ SB(seq->image.sprite, 0, SPRITE_WIDTH, sprite);
+ ClrBit(seq->image.pal, 15);
}
if (type > 0) {
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index 44b615f2b..7202f80ac 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -297,10 +297,10 @@ void DrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte stage, Ho
if (GB(image, 0, SPRITE_WIDTH) != 0) DrawGroundSprite(image, pal);
foreach_draw_tile_seq(dtss, dts->seq) {
- if (GB(dtss->image, 0, SPRITE_WIDTH) == 0) continue;
+ if (GB(dtss->image.sprite, 0, SPRITE_WIDTH) == 0) continue;
- image = dtss->image;
- pal = dtss->pal;
+ image = dtss->image.sprite;
+ pal = dtss->image.pal;
if (IS_CUSTOM_SPRITE(image)) image += stage;
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index 0a964d115..3d6d5ae6e 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -185,10 +185,10 @@ void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte r
if (GB(image, 0, SPRITE_WIDTH) != 0) DrawGroundSprite(image, pal);
foreach_draw_tile_seq(dtss, dts->seq) {
- if (GB(dtss->image, 0, SPRITE_WIDTH) == 0) continue;
+ if (GB(dtss->image.sprite, 0, SPRITE_WIDTH) == 0) continue;
- image = dtss->image;
- pal = dtss->pal;
+ image = dtss->image.sprite;
+ pal = dtss->image.pal;
if (IS_CUSTOM_SPRITE(image)) image += stage;
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 626e50821..9909cba7e 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -784,7 +784,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
foreach_draw_tile_seq(seq, sprites->seq) {
Point pt;
- image = seq->image;
+ image = seq->image.sprite;
if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
image += rti->total_offset;
} else {
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index bb9e4805d..ffbbc1d3d 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -1821,7 +1821,7 @@ default_waypoint:
if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
foreach_draw_tile_seq(dtss, dts->seq) {
- SpriteID image = dtss->image;
+ SpriteID image = dtss->image.sprite;
SpriteID pal;
/* Unlike stations, our default waypoint has no variation for
@@ -1836,7 +1836,7 @@ default_waypoint:
if (!(!HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
pal = _drawtile_track_palette;
} else {
- pal = dtss->pal;
+ pal = dtss->image.pal;
}
if ((byte)dtss->delta_z != 0x80) {
@@ -1861,9 +1861,9 @@ static void DrawTileSequence(int x, int y, SpriteID ground, const DrawTileSeqStr
SpriteID palette = PLAYER_SPRITE_COLOR(_local_player);
DrawSprite(ground, PAL_NONE, x, y);
- for (; dtss->image != 0; dtss++) {
+ for (; dtss->image.sprite != 0; dtss++) {
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
- SpriteID image = dtss->image + offset;
+ SpriteID image = dtss->image.sprite + offset;
DrawSprite(image, HasBit(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE, x + pt.x, y + pt.y);
}
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index e26318b56..af3a4d558 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -1116,8 +1116,8 @@ static void DrawTile_Road(TileInfo *ti)
DrawGroundSprite(dts->ground_sprite, PAL_NONE);
- for (dtss = dts->seq; dtss->image != 0; dtss++) {
- SpriteID image = dtss->image;
+ for (dtss = dts->seq; dtss->image.sprite != 0; dtss++) {
+ SpriteID image = dtss->image.sprite;
SpriteID pal;
if (!IsTransparencySet(TO_BUILDINGS) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
@@ -1151,9 +1151,9 @@ void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
DrawSprite(dts->ground_sprite, PAL_NONE, x, y);
- for (dtss = dts->seq; dtss->image != 0; dtss++) {
+ for (dtss = dts->seq; dtss->image.sprite != 0; dtss++) {
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
- SpriteID image = dtss->image;
+ SpriteID image = dtss->image.sprite;
DrawSprite(image, HasBit(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE, x + pt.x, y + pt.y);
}
diff --git a/src/sprite.h b/src/sprite.h
index 686db5e75..23b95ed04 100644
--- a/src/sprite.h
+++ b/src/sprite.h
@@ -30,8 +30,7 @@ struct DrawTileSeqStruct {
byte size_x;
byte size_y;
byte size_z;
- SpriteID image;
- SpriteID pal;
+ PalSpriteID image;
};
struct DrawTileSprites {
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index b2219c1cb..95f7e4fd1 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2190,7 +2190,7 @@ static void DrawTile_Station(TileInfo *ti)
const DrawTileSeqStruct *dtss;
foreach_draw_tile_seq(dtss, t->seq) {
- SpriteID image = dtss->image;
+ SpriteID image = dtss->image.sprite;
if (relocation == 0 || HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
image += total_offset;
} else {
@@ -2201,7 +2201,7 @@ static void DrawTile_Station(TileInfo *ti)
if (!(!HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
pal = palette;
} else {
- pal = dtss->pal;
+ pal = dtss->image.pal;
}
if ((byte)dtss->delta_z != 0x80) {
@@ -2239,7 +2239,7 @@ void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, Ro
const DrawTileSeqStruct *dtss;
foreach_draw_tile_seq(dtss, t->seq) {
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
- DrawSprite(dtss->image + total_offset, pal, x + pt.x, y + pt.y);
+ DrawSprite(dtss->image.sprite + total_offset, pal, x + pt.x, y + pt.y);
}
}
diff --git a/src/table/road_land.h b/src/table/road_land.h
index 4b46cf3eb..32980606a 100644
--- a/src/table/road_land.h
+++ b/src/table/road_land.h
@@ -1,7 +1,7 @@
/* $Id$ */
-#define TILE_SEQ_LINE(img, pal, dx, dy, sx, sy) { dx, dy, 0, sx, sy, 20, img, pal },
-#define TILE_SEQ_END() { 0, 0, 0, 0, 0, 0, 0, 0 }
+#define TILE_SEQ_LINE(img, pal, dx, dy, sx, sy) { dx, dy, 0, sx, sy, 20, {img, pal} },
+#define TILE_SEQ_END() { 0, 0, 0, 0, 0, 0, {0, 0} }
static const DrawTileSeqStruct _road_depot_NE[] = {
TILE_SEQ_LINE(0x584 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 0, 15, 16, 1)
diff --git a/src/table/station_land.h b/src/table/station_land.h
index 1e8356e4d..87523d5f5 100644
--- a/src/table/station_land.h
+++ b/src/table/station_land.h
@@ -1,8 +1,8 @@
/* $Id$ */
-#define TILE_SEQ_LINE(dx, dy, dz, sx, sy, sz, img) { dx, dy, dz, sx, sy, sz, img, PAL_NONE },
-#define TILE_SEQ_LINE_PAL(dx, dy, dz, sx, sy, sz, img, pal) { dx, dy, dz, sx, sy, sz, img, pal },
-#define TILE_SEQ_END() { (byte)0x80, 0, 0, 0, 0, 0, 0, 0 }
+#define TILE_SEQ_LINE(dx, dy, dz, sx, sy, sz, img) { dx, dy, dz, sx, sy, sz, {img, PAL_NONE} },
+#define TILE_SEQ_LINE_PAL(dx, dy, dz, sx, sy, sz, img, pal) { dx, dy, dz, sx, sy, sz, {img, pal} },
+#define TILE_SEQ_END() { (byte)0x80, 0, 0, 0, 0, 0, {0, 0} }
static const DrawTileSeqStruct _station_display_nothing[] = {
TILE_SEQ_END()
diff --git a/src/table/track_land.h b/src/table/track_land.h
index d447778a1..176c35399 100644
--- a/src/table/track_land.h
+++ b/src/table/track_land.h
@@ -1,7 +1,7 @@
/* $Id$ */
-#define TILE_SEQ_LINE(img, dx, dy, sx, sy) { dx, dy, 0, sx, sy, 23, img, PAL_NONE },
-#define TILE_SEQ_END() { (byte)0x80, 0, 0, 0, 0, 0, 0, 0 }
+#define TILE_SEQ_LINE(img, dx, dy, sx, sy) { dx, dy, 0, sx, sy, 23, {img, PAL_NONE} },
+#define TILE_SEQ_END() { (byte)0x80, 0, 0, 0, 0, 0, {0, 0} }
static const DrawTileSeqStruct _depot_gfx_NE[] = {
diff --git a/src/table/unmovable_land.h b/src/table/unmovable_land.h
index d793a0979..123698181 100644
--- a/src/table/unmovable_land.h
+++ b/src/table/unmovable_land.h
@@ -15,8 +15,8 @@ static const DrawTileUnmovableStruct _draw_tile_unmovable_data[] = {
{0xA2A, 4, 4, 7, 7, 61, 0},
};
-#define TILE_SEQ_LINE(sz, img) { 0, 0, 0, 16, 16, sz, img, PAL_NONE },
-#define TILE_SEQ_END() { (byte)0x80, 0, 0, 0, 0, 0, 0, 0 }
+#define TILE_SEQ_LINE(sz, img) { 0, 0, 0, 16, 16, sz, {img, PAL_NONE} },
+#define TILE_SEQ_END() { (byte)0x80, 0, 0, 0, 0, 0, {0, 0} }
static const DrawTileSeqStruct _unmovable_display_nothing[] = {
TILE_SEQ_END()
diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp
index 32f6ff993..ef6d0f056 100644
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -216,7 +216,7 @@ static void DrawTile_Unmovable(TileInfo *ti)
foreach_draw_tile_seq(dtss, t->seq) {
AddSortableSpriteToDraw(
- dtss->image, palette,
+ dtss->image.sprite, palette,
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
dtss->size_x, dtss->size_y,
dtss->size_z, ti->z + dtss->delta_z,