diff options
author | frosch <frosch@openttd.org> | 2011-05-29 16:56:22 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-05-29 16:56:22 +0000 |
commit | a241a4ce97ffe3f519ecf656ad10c518d646d423 (patch) | |
tree | b6319bc947c6ae62a4822ed0368228f3e5f4e2ca /src/newgrf_spritegroup.cpp | |
parent | 5b449145f7983d44d73195b8a18e4a2da721ee71 (diff) | |
download | openttd-a241a4ce97ffe3f519ecf656ad10c518d646d423.tar.xz |
(svn r22518) -Feature: [NewGRF] Advanced sprite layouts with register modifiers.
Diffstat (limited to 'src/newgrf_spritegroup.cpp')
-rw-r--r-- | src/newgrf_spritegroup.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index b36df7016..3b1693b4e 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -226,3 +226,26 @@ const SpriteGroup *RealSpriteGroup::Resolve(ResolverObject *object) const { return object->ResolveReal(object, this); } + +/** + * Process registers and the construction stage into the sprite layout. + * The passed construction stage might get reset to zero, if it gets incorporated into the layout + * during the preprocessing. + * @param [in, out] stage Construction stage (0-3), or NULL if not applicable. + * @return sprite layout to draw. + */ +const DrawTileSprites *TileLayoutSpriteGroup::ProcessRegisters(uint8 *stage) const +{ + if (!this->dts.NeedsPreprocessing()) return &this->dts; + + static DrawTileSprites result; + uint8 actual_stage = stage != NULL ? *stage : 0; + this->dts.PrepareLayout(0, actual_stage, actual_stage, false); + this->dts.ProcessRegisters(0, 0, false); + result.seq = this->dts.GetLayout(&result.ground); + + /* Stage has been processed by PrepareLayout(), set it to zero. */ + if (stage != NULL) *stage = 0; + + return &result; +} |