Mercurial > hg > openttd
changeset 8570:2b1397dd930a draft
(svn r12148) -Codechange: Merge 'image' and 'pal' of DrawTileSeqStruct into one PalSpriteID
author | frosch <frosch@openttd.org> |
---|---|
date | Fri, 15 Feb 2008 18:34:26 +0000 |
parents | b003fa8b1ca3 |
children | b611278e4fed |
files | src/newgrf.cpp src/newgrf_house.cpp src/newgrf_industrytiles.cpp src/newgrf_station.cpp src/rail_cmd.cpp src/road_cmd.cpp src/sprite.h src/station_cmd.cpp src/table/road_land.h src/table/station_land.h src/table/track_land.h src/table/unmovable_land.h src/unmovable_cmd.cpp |
diffstat | 13 files changed, 58 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -963,26 +963,26 @@ 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 @@ 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) {
--- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -297,10 +297,10 @@ 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;
--- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -185,10 +185,10 @@ 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;
--- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -784,7 +784,7 @@ 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 {
--- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -1821,7 +1821,7 @@ 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 @@ 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 @@ 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); }
--- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1116,8 +1116,8 @@ 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 @@ 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); }
--- a/src/sprite.h +++ b/src/sprite.h @@ -30,8 +30,7 @@ byte size_x; byte size_y; byte size_z; - SpriteID image; - SpriteID pal; + PalSpriteID image; }; struct DrawTileSprites {
--- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2190,7 +2190,7 @@ 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 @@ 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 @@ 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); } }
--- 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)
--- 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()
--- 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[] = {
--- a/src/table/unmovable_land.h +++ b/src/table/unmovable_land.h @@ -15,8 +15,8 @@ {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()
--- a/src/unmovable_cmd.cpp +++ b/src/unmovable_cmd.cpp @@ -216,7 +216,7 @@ 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,