(svn r22924) -Codechange: Enhance NewGRFSpriteLayout for drawing construction stages in spritelayouts with inconsistent number of sprites per spriteset.

This commit is contained in:
frosch
2011-09-11 15:10:09 +00:00
parent de27360549
commit 7f228d6909
7 changed files with 86 additions and 20 deletions

View File

@@ -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;
/**