OpenTTD Source 20250514-master-gecc3438519
|
Add dynamic register values to a sprite layout. More...
#include <newgrf_commons.h>
Public Member Functions | |
SpriteLayoutProcessor (const NewGRFSpriteLayout &raw_layout) | |
Constructor for spritelayout, which do not need preprocessing. | |
SpriteLayoutProcessor (const NewGRFSpriteLayout &raw_layout, uint32_t orig_offset, uint32_t newgrf_ground_offset, uint32_t newgrf_offset, uint constr_stage, bool separate_ground) | |
Prepares a sprite layout before resolving action-1-2-3 chains. | |
SetBitIterator< uint8_t, uint32_t > | Var10Values () const |
Get values for variable 10 to resolve sprites for. | |
void | ProcessRegisters (const struct ResolverObject &object, uint8_t resolved_var10, uint32_t resolved_sprite) |
Evaluates the register modifiers and integrates them into the preprocessed sprite layout. | |
DrawTileSpriteSpan | GetLayout () const |
Returns the result spritelayout after preprocessing. | |
Private Attributes | |
const NewGRFSpriteLayout * | raw_layout = nullptr |
std::vector< DrawTileSeqStruct > | result_seq |
uint32_t | var10_values = 0 |
bool | separate_ground = false |
Add dynamic register values to a sprite layout.
Definition at line 143 of file newgrf_commons.h.
|
inline |
Constructor for spritelayout, which do not need preprocessing.
Definition at line 152 of file newgrf_commons.h.
SpriteLayoutProcessor::SpriteLayoutProcessor | ( | const NewGRFSpriteLayout & | raw_layout, |
uint32_t | orig_offset, | ||
uint32_t | newgrf_ground_offset, | ||
uint32_t | newgrf_offset, | ||
uint | constr_stage, | ||
bool | separate_ground | ||
) |
Prepares a sprite layout before resolving action-1-2-3 chains.
Integrates offsets into the layout and determines which chains to resolve.
raw_layout | Sprite layout in need of preprocessing. |
orig_offset | Offset to apply to non-action-1 sprites. |
newgrf_ground_offset | Offset to apply to action-1 ground sprites. |
newgrf_offset | Offset to apply to action-1 non-ground sprites. |
constr_stage | Construction stage (0-3) to apply to all action-1 sprites. |
separate_ground | Whether the ground sprite shall be resolved by a separate action-1-2-3 chain by default. |
Definition at line 603 of file newgrf_commons.cpp.
References DrawTileSeqStruct::delta_z, TileLayoutRegisters::flags, GetConstructionStageOffset(), DrawTileSprites::ground, HasBit(), TileLayoutRegisters::max_palette_offset, TileLayoutRegisters::max_sprite_offset, TileLayoutRegisters::palette_var10, SetBit(), SPRITE_MODIFIER_CUSTOM_SPRITE, TileLayoutRegisters::sprite_var10, TLF_PALETTE, TLF_PALETTE_REG_FLAGS, TLF_PALETTE_VAR10, TLF_SPRITE, TLF_SPRITE_REG_FLAGS, and TLF_SPRITE_VAR10.
|
inline |
Returns the result spritelayout after preprocessing.
Definition at line 168 of file newgrf_commons.h.
References DrawTileSprites::ground.
Referenced by DrawNewObjectTile(), DrawNewObjectTileInGUI(), DrawRoadStopTile(), and DrawStationTile().
void SpriteLayoutProcessor::ProcessRegisters | ( | const struct ResolverObject & | object, |
uint8_t | resolved_var10, | ||
uint32_t | resolved_sprite | ||
) |
Evaluates the register modifiers and integrates them into the preprocessed sprite layout.
object | ResolverObject owning the temporary storage. |
resolved_var10 | The value of var10 the action-1-2-3 chain was evaluated for. |
resolved_sprite | Result sprite of the action-1-2-3 chain. |
Definition at line 665 of file newgrf_commons.cpp.
References TileLayoutRegisters::child, TileLayoutRegisters::dodraw, TileLayoutRegisters::flags, HasBit(), TileLayoutRegisters::max_palette_offset, TileLayoutRegisters::max_sprite_offset, TileLayoutRegisters::palette, TileLayoutRegisters::palette_var10, TileLayoutRegisters::parent, TileLayoutRegisters::sprite, SPRITE_MODIFIER_CUSTOM_SPRITE, TileLayoutRegisters::sprite_var10, TLF_BB_XY_OFFSET, TLF_BB_Z_OFFSET, TLF_CHILD_X_OFFSET, TLF_CHILD_Y_OFFSET, TLF_DODRAW, TLF_PALETTE, TLF_PALETTE_REG_FLAGS, TLF_PALETTE_VAR10, TLF_SPRITE, TLF_SPRITE_REG_FLAGS, and TLF_SPRITE_VAR10.
Referenced by TileLayoutSpriteGroup::ProcessRegisters().
|
inline |
Get values for variable 10 to resolve sprites for.
NewStations only.
Definition at line 160 of file newgrf_commons.h.
|
private |
Definition at line 144 of file newgrf_commons.h.
|
private |
Definition at line 145 of file newgrf_commons.h.
|
private |
Definition at line 147 of file newgrf_commons.h.
|
private |
Definition at line 146 of file newgrf_commons.h.