summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-01-14 19:57:49 +0000
committerpeter1138 <peter1138@openttd.org>2007-01-14 19:57:49 +0000
commitca9843424be6008d9b8019423f2ead65fdb75fe2 (patch)
treec62990da208a45b3bd1c7379a1835190458d5a49 /src/newgrf.cpp
parentc04c2b28245770aa7729b818fb876cd23c880620 (diff)
downloadopenttd-ca9843424be6008d9b8019423f2ead65fdb75fe2.tar.xz
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
This lets us increase the sprite width from 14 to up to 29 bits, effectively nulling the old sprite limit. Table changes in next commit.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 4d0982d93..0861970f3 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -885,8 +885,13 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
uint seq_count = 0;
dts->seq = NULL;
- dts->ground_sprite = grf_load_dword(&buf);
+ 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);
+ }
while (buf < *bufp + len) {
DrawTileSeqStruct *dtss;
@@ -902,16 +907,22 @@ 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_dword(&buf);
+ dtss->image = grf_load_word(&buf);
+ dtss->pal = grf_load_word(&buf);
/* Remap flags as ours collide */
- if (HASBIT(dtss->image, 31)) {
- CLRBIT(dtss->image, 31);
- SETBIT(dtss->image, 30);
+ if (HASBIT(dtss->pal, 15)) {
+ CLRBIT(dtss->pal, 15);
+ SETBIT(dtss->image, SPRITE_MODIFIER_USE_OFFSET);
+ }
+
+ if (HASBIT(dtss->image, 15)) {
+ CLRBIT(dtss->image, 15);
+ SETBIT(dtss->image, PALETTE_MODIFIER_COLOR);
}
if (HASBIT(dtss->image, 14)) {
CLRBIT(dtss->image, 14);
- SETBIT(dtss->image, 31);
+ SETBIT(dtss->image, PALETTE_MODIFIER_TRANSPARENT);
}
}
}
@@ -1092,8 +1103,20 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int
bridge->sprite_table[tableid] = MallocT<PalSpriteID>(32);
}
- for (sprite = 0; sprite < 32; sprite++)
- bridge->sprite_table[tableid][sprite] = grf_load_dword(&buf);
+ for (sprite = 0; sprite < 32; sprite++) {
+ SpriteID image = grf_load_word(&buf);
+ SpriteID pal = grf_load_word(&buf);
+
+ if (HASBIT(pal, 15)) {
+ SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
+ }
+
+ /* Clear old color modifer bit */
+ CLRBIT(image, 15);
+
+ bridge->sprite_table[tableid][sprite].sprite = image;
+ bridge->sprite_table[tableid][sprite].pal = pal;
+ }
}
}
break;
@@ -3777,3 +3800,4 @@ void LoadNewGRF(uint load_index, uint file_index)
+