summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-08-06 10:47:37 +0000
committerfrosch <frosch@openttd.org>2011-08-06 10:47:37 +0000
commit2e466cc184230cf9bce32391b63e5f26670625f0 (patch)
tree8a34575c2b930589013f14fdf30495f44ce7c020
parent03c1fd5c636fb037e4df2a45684c9f95dc2c8980 (diff)
downloadopenttd-2e466cc184230cf9bce32391b63e5f26670625f0.tar.xz
(svn r22721) -Fix (r22518): Conditionally hiding a sprite caused subsequent items of the spritelayout to use wrong registers.
-rw-r--r--src/newgrf_commons.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp
index 8f7841f8a..f4161fc82 100644
--- a/src/newgrf_commons.cpp
+++ b/src/newgrf_commons.cpp
@@ -647,26 +647,26 @@ void NewGRFSpriteLayout::ProcessRegisters(uint8 resolved_var10, uint32 resolved_
/* Apply registers */
if ((flags & TLF_DODRAW) && GetRegister(regs->dodraw) == 0) {
result->image.sprite = 0;
- continue;
- }
- if (HasBit(result->image.sprite, SPRITE_MODIFIER_CUSTOM_SPRITE)) result->image.sprite += resolved_sprite;
- if (flags & TLF_SPRITE) result->image.sprite += (int16)GetRegister(regs->sprite); // mask to 16 bits to avoid trouble
-
- if (result->IsParentSprite()) {
- if (flags & TLF_BB_XY_OFFSET) {
- result->delta_x += (int32)GetRegister(regs->delta.parent[0]);
- result->delta_y += (int32)GetRegister(regs->delta.parent[1]);
- }
- if (flags & TLF_BB_Z_OFFSET) result->delta_z += (int32)GetRegister(regs->delta.parent[2]);
} else {
- if (flags & TLF_CHILD_X_OFFSET) result->delta_x += (int32)GetRegister(regs->delta.child[0]);
- if (flags & TLF_CHILD_Y_OFFSET) result->delta_y += (int32)GetRegister(regs->delta.child[1]);
+ if (HasBit(result->image.sprite, SPRITE_MODIFIER_CUSTOM_SPRITE)) result->image.sprite += resolved_sprite;
+ if (flags & TLF_SPRITE) result->image.sprite += (int16)GetRegister(regs->sprite); // mask to 16 bits to avoid trouble
+
+ if (result->IsParentSprite()) {
+ if (flags & TLF_BB_XY_OFFSET) {
+ result->delta_x += (int32)GetRegister(regs->delta.parent[0]);
+ result->delta_y += (int32)GetRegister(regs->delta.parent[1]);
+ }
+ if (flags & TLF_BB_Z_OFFSET) result->delta_z += (int32)GetRegister(regs->delta.parent[2]);
+ } else {
+ if (flags & TLF_CHILD_X_OFFSET) result->delta_x += (int32)GetRegister(regs->delta.child[0]);
+ if (flags & TLF_CHILD_Y_OFFSET) result->delta_y += (int32)GetRegister(regs->delta.child[1]);
+ }
}
}
}
/* Is the palette affected by an action-1-2-3 chain? */
- if (HasBit(result->image.pal, SPRITE_MODIFIER_CUSTOM_SPRITE) || (flags & TLF_PALETTE_REG_FLAGS)) {
+ if (result->image.sprite != 0 && (HasBit(result->image.pal, SPRITE_MODIFIER_CUSTOM_SPRITE) || (flags & TLF_PALETTE_REG_FLAGS))) {
/* Does the var10 value apply to this sprite? */
uint8 var10 = (flags & TLF_PALETTE_VAR10) ? regs->palette_var10 : (ground && separate_ground ? 1 : 0);
if (var10 == resolved_var10) {