summaryrefslogtreecommitdiff
path: root/src/newgrf_commons.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-09-11 15:10:09 +0000
committerfrosch <frosch@openttd.org>2011-09-11 15:10:09 +0000
commit7f228d6909f3132b9f50c403de0100d635392305 (patch)
tree7fce3f562daee3147d6299dbc6ebdaea3858373a /src/newgrf_commons.h
parentde27360549ec0afcc5090369cf05cfeafeda5868 (diff)
downloadopenttd-7f228d6909f3132b9f50c403de0100d635392305.tar.xz
(svn r22924) -Codechange: Enhance NewGRFSpriteLayout for drawing construction stages in spritelayouts with inconsistent number of sprites per spriteset.
Diffstat (limited to 'src/newgrf_commons.h')
-rw-r--r--src/newgrf_commons.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h
index a77da3cd2..7c55911a8 100644
--- a/src/newgrf_commons.h
+++ b/src/newgrf_commons.h
@@ -96,6 +96,8 @@ struct TileLayoutRegisters {
uint8 dodraw; ///< Register deciding whether the sprite shall be drawn at all. Non-zero means drawing.
uint8 sprite; ///< Register specifying a signed offset for the sprite.
uint8 palette; ///< Register specifying a signed offset for the palette.
+ uint16 max_sprite_offset; ///< Maximum offset to add to the sprite. (limited by size of the spriteset)
+ uint16 max_palette_offset; ///< Maximum offset to add to the palette. (limited by size of the spriteset)
union {
uint8 parent[3]; ///< Registers for signed offsets for the bounding box position of parent sprites.
uint8 child[2]; ///< Registers for signed offsets for the position of child sprites.
@@ -114,6 +116,12 @@ static const uint TLR_MAX_VAR10 = 7; ///< Maximum value for var 10.
struct NewGRFSpriteLayout : ZeroedMemoryAllocator, DrawTileSprites {
const TileLayoutRegisters *registers;
+ /**
+ * Number of sprites in all referenced spritesets.
+ * If these numbers are inconsistent, then this is 0 and the real values are in \c registers.
+ */
+ uint consistent_max_offset;
+
void Allocate(uint num_sprites);
void AllocateRegisters();
void Clone(const DrawTileSeqStruct *source);
@@ -147,7 +155,7 @@ struct NewGRFSpriteLayout : ZeroedMemoryAllocator, DrawTileSprites {
return this->registers != NULL;
}
- uint32 PrepareLayout(uint32 orig_offset, uint32 newgrf_ground_offset, uint32 newgrf_offset, bool separate_ground) const;
+ uint32 PrepareLayout(uint32 orig_offset, uint32 newgrf_ground_offset, uint32 newgrf_offset, uint constr_stage, bool separate_ground) const;
void ProcessRegisters(uint8 resolved_var10, uint32 resolved_sprite, bool separate_ground) const;
/**