OpenTTD Source: src/newgrf_spritegroup.h Source File

OpenTTD Source 15.0-beta1

newgrf_spritegroup.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#ifndef NEWGRF_SPRITEGROUP_H
11#define NEWGRF_SPRITEGROUP_H
12
13#include "town_type.h"
14#include "engine_type.h"
15#include "house_type.h"
16#include "industry_type.h"
17
18#include "newgrf_callbacks.h"
19#include "newgrf_generic.h"
20#include "newgrf_storage.h"
21#include "newgrf_commons.h"
22
29 inline uint32_t GetRegister(uint i)
30{
31 extern TemporaryStorageArray<int32_t, 0x110> _temp_store;
32 return _temp_store.GetValue(i);
33}
34
35/* List of different sprite group types */
36enum SpriteGroupType : uint8_t {
37 SGT_REAL,
38 SGT_DETERMINISTIC,
39 SGT_RANDOMIZED,
40 SGT_CALLBACK,
41 SGT_RESULT,
42 SGT_TILELAYOUT,
43 SGT_INDUSTRY_PRODUCTION,
44};
45
46struct SpriteGroup;
47typedef uint32_t SpriteGroupID;
48struct ResolverObject;
49
50/* SPRITE_WIDTH is 24. ECS has roughly 30 sprite groups per real sprite.
51 * Adding an 'extra' margin would be assuming 64 sprite groups per real
52 * sprite. 64 = 2^6, so 2^30 should be enough (for now) */
53typedef Pool<SpriteGroup, SpriteGroupID, 1024, 1U << 30, PT_DATA> SpriteGroupPool;
54extern SpriteGroupPool _spritegroup_pool;
55
56/* Common wrapper for all the different sprite group types */
57 struct SpriteGroup : SpriteGroupPool::PoolItem<&_spritegroup_pool> {
58protected:
59 SpriteGroup(SpriteGroupType type) : nfo_line(0), type(type) {}
61 virtual const SpriteGroup *Resolve([[maybe_unused]] ResolverObject &object) const { return this; };
62
63public:
64 virtual ~SpriteGroup() = default;
65
66 uint32_t nfo_line;
67 SpriteGroupType type;
68
69 virtual SpriteID GetResult() const { return 0; }
70 virtual uint8_t GetNumResults() const { return 0; }
71 virtual uint16_t GetCallbackResult() const { return CALLBACK_FAILED; }
72
73 static const SpriteGroup *Resolve(const SpriteGroup *group, ResolverObject &object, bool top_level = true);
74};
75
76
77/* 'Real' sprite groups contain a list of other result or callback sprite
78 * groups. */
79 struct RealSpriteGroup : SpriteGroup {
80 RealSpriteGroup() : SpriteGroup(SGT_REAL) {}
81
82 /* Loaded = in motion, loading = not moving
83 * Each group contains several spritesets, for various loading stages */
84
85 /* XXX: For stations the meaning is different - loaded is for stations
86 * with small amount of cargo whilst loading is for stations with a lot
87 * of da stuff. */
88
89 std::vector<const SpriteGroup *> loaded;
90 std::vector<const SpriteGroup *> loading;
91
92protected:
93 const SpriteGroup *Resolve(ResolverObject &object) const override;
94};
95
96/* Shared by deterministic and random groups. */
97 enum VarSpriteGroupScope : uint8_t {
98 VSG_BEGIN,
99
100 VSG_SCOPE_SELF = VSG_BEGIN,
101 VSG_SCOPE_PARENT,
102 VSG_SCOPE_RELATIVE,
103
104 VSG_END
105};
106 DECLARE_POSTFIX_INCREMENT(VarSpriteGroupScope)
107
108enum DeterministicSpriteGroupSize : uint8_t {
109 DSG_SIZE_BYTE,
110 DSG_SIZE_WORD,
111 DSG_SIZE_DWORD,
112};
113
114enum DeterministicSpriteGroupAdjustType : uint8_t {
115 DSGA_TYPE_NONE,
116 DSGA_TYPE_DIV,
117 DSGA_TYPE_MOD,
118};
119
120 enum DeterministicSpriteGroupAdjustOperation : uint8_t {
121 DSGA_OP_ADD,
122 DSGA_OP_SUB,
123 DSGA_OP_SMIN,
124 DSGA_OP_SMAX,
125 DSGA_OP_UMIN,
126 DSGA_OP_UMAX,
127 DSGA_OP_SDIV,
128 DSGA_OP_SMOD,
129 DSGA_OP_UDIV,
130 DSGA_OP_UMOD,
131 DSGA_OP_MUL,
132 DSGA_OP_AND,
133 DSGA_OP_OR,
134 DSGA_OP_XOR,
135 DSGA_OP_STO,
136 DSGA_OP_RST,
137 DSGA_OP_STOP,
138 DSGA_OP_ROR,
139 DSGA_OP_SCMP,
140 DSGA_OP_UCMP,
141 DSGA_OP_SHL,
142 DSGA_OP_SHR,
143 DSGA_OP_SAR,
144};
145
146
147 struct DeterministicSpriteGroupAdjust {
148 DeterministicSpriteGroupAdjustOperation operation;
149 DeterministicSpriteGroupAdjustType type;
150 uint8_t variable;
151 uint8_t parameter;
152 uint8_t shift_num;
153 uint32_t and_mask;
154 uint32_t add_val;
155 uint32_t divmod_val;
156 const SpriteGroup *subroutine;
157};
158
159
160 struct DeterministicSpriteGroupRange {
161 const SpriteGroup *group;
162 uint32_t low;
163 uint32_t high;
164};
165
166
167 struct DeterministicSpriteGroup : SpriteGroup {
168 DeterministicSpriteGroup() : SpriteGroup(SGT_DETERMINISTIC) {}
169
170 VarSpriteGroupScope var_scope;
171 DeterministicSpriteGroupSize size;
172 bool calculated_result;
173 std::vector<DeterministicSpriteGroupAdjust> adjusts;
174 std::vector<DeterministicSpriteGroupRange> ranges; // Dynamically allocated
175
176 /* Dynamically allocated, this is the sole owner */
177 const SpriteGroup *default_group;
178
179 const SpriteGroup *error_group; // was first range, before sorting ranges
180
181protected:
182 const SpriteGroup *Resolve(ResolverObject &object) const override;
183};
184
185enum RandomizedSpriteGroupCompareMode : uint8_t {
186 RSG_CMP_ANY,
187 RSG_CMP_ALL,
188};
189
190 struct RandomizedSpriteGroup : SpriteGroup {
191 RandomizedSpriteGroup() : SpriteGroup(SGT_RANDOMIZED) {}
192
193 VarSpriteGroupScope var_scope;
194
195 RandomizedSpriteGroupCompareMode cmp_mode;
196 uint8_t triggers;
197 uint8_t count;
198
199 uint8_t lowest_randbit;
200
201 std::vector<const SpriteGroup *> groups;
202
203protected:
204 const SpriteGroup *Resolve(ResolverObject &object) const override;
205};
206
207
208/* This contains a callback result. A failed callback has a value of
209 * CALLBACK_FAILED */
210 struct CallbackResultSpriteGroup : SpriteGroup {
215 explicit CallbackResultSpriteGroup(uint16_t value) : SpriteGroup(SGT_CALLBACK), result(value) {}
216
217 uint16_t result;
218 uint16_t GetCallbackResult() const override { return this->result; }
219};
220
221
222/* A result sprite group returns the first SpriteID and the number of
223 * sprites in the set */
224 struct ResultSpriteGroup : SpriteGroup {
231 ResultSpriteGroup(SpriteID sprite, uint8_t num_sprites) :
232 SpriteGroup(SGT_RESULT),
233 num_sprites(num_sprites),
234 sprite(sprite)
235 {
236 }
237
238 uint8_t num_sprites;
239 SpriteID sprite;
240
241 SpriteID GetResult() const override { return this->sprite; }
242 uint8_t GetNumResults() const override { return this->num_sprites; }
243};
244
248 struct TileLayoutSpriteGroup : SpriteGroup {
249 TileLayoutSpriteGroup() : SpriteGroup(SGT_TILELAYOUT) {}
250 ~TileLayoutSpriteGroup() {}
251
252 NewGRFSpriteLayout dts;
253
254 const DrawTileSprites *ProcessRegisters(uint8_t *stage) const;
255};
256
257 struct IndustryProductionSpriteGroup : SpriteGroup {
258 IndustryProductionSpriteGroup() : SpriteGroup(SGT_INDUSTRY_PRODUCTION) {}
259
260 uint8_t version;
261 uint8_t num_input;
262 int16_t subtract_input[INDUSTRY_NUM_INPUTS];
263 CargoID cargo_input[INDUSTRY_NUM_INPUTS];
264 uint8_t num_output;
265 uint16_t add_output[INDUSTRY_NUM_OUTPUTS];
266 CargoID cargo_output[INDUSTRY_NUM_OUTPUTS];
267 uint8_t again;
268
269};
270
277 struct ScopeResolver {
278 ResolverObject &ro;
279
280 ScopeResolver(ResolverObject &ro) : ro(ro) {}
281 virtual ~ScopeResolver() = default;
282
283 virtual uint32_t GetRandomBits() const;
284 virtual uint32_t GetTriggers() const;
285
286 virtual uint32_t GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const;
287 virtual void StorePSA(uint reg, int32_t value);
288};
289
296 struct ResolverObject {
304 ResolverObject(const GRFFile *grffile, CallbackID callback = CBID_NO_CALLBACK, uint32_t callback_param1 = 0, uint32_t callback_param2 = 0)
305 : default_scope(*this), callback(callback), callback_param1(callback_param1), callback_param2(callback_param2), grffile(grffile), root_spritegroup(nullptr)
306 {
307 this->ResetState();
308 }
309
310 virtual ~ResolverObject() = default;
311
312 ScopeResolver default_scope;
313
314 CallbackID callback;
315 uint32_t callback_param1;
316 uint32_t callback_param2;
317
318 uint32_t last_value;
319
320 uint32_t waiting_triggers;
321 uint32_t used_triggers;
322 uint32_t reseed[VSG_END];
323
324 const GRFFile *grffile;
325 const SpriteGroup *root_spritegroup;
326
331 const SpriteGroup *Resolve()
332 {
333 return SpriteGroup::Resolve(this->root_spritegroup, *this);
334 }
335
340 uint16_t ResolveCallback()
341 {
342 const SpriteGroup *result = Resolve();
343 return result != nullptr ? result->GetCallbackResult() : CALLBACK_FAILED;
344 }
345
346 virtual const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const;
347
348 virtual ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, uint8_t relative = 0);
349
353 uint32_t GetRemainingTriggers() const
354 {
355 return this->waiting_triggers & ~this->used_triggers;
356 }
357
363 uint32_t GetReseedSum() const
364 {
365 uint32_t sum = 0;
366 for (VarSpriteGroupScope vsg = VSG_BEGIN; vsg < VSG_END; vsg++) {
367 sum |= this->reseed[vsg];
368 }
369 return sum;
370 }
371
376 void ResetState()
377 {
378 this->last_value = 0;
379 this->waiting_triggers = 0;
380 this->used_triggers = 0;
381 memset(this->reseed, 0, sizeof(this->reseed));
382 }
383
388 virtual GrfSpecFeature GetFeature() const { return GSF_INVALID; }
394 virtual uint32_t GetDebugID() const { return 0; }
395};
396
397#endif /* NEWGRF_SPRITEGROUP_H */
CargoID
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
Definition cargo_type.h:22
engine_type.h
Types related to engines.
DECLARE_POSTFIX_INCREMENT
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
Definition enum_type.hpp:18
SpriteID
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition gfx_type.h:18
house_type.h
declaration of basic house types and enums
industry_type.h
Types related to the industry.
INDUSTRY_NUM_OUTPUTS
static const int INDUSTRY_NUM_OUTPUTS
Number of cargo types an industry can produce.
Definition industry_type.h:39
INDUSTRY_NUM_INPUTS
static const int INDUSTRY_NUM_INPUTS
Number of cargo types an industry can accept.
Definition industry_type.h:38
GrfSpecFeature
GrfSpecFeature
Definition newgrf.h:67
GSF_INVALID
@ GSF_INVALID
An invalid spec feature.
Definition newgrf.h:94
newgrf_callbacks.h
Callbacks that NewGRFs could implement.
CallbackID
CallbackID
List of implemented NewGRF callbacks.
Definition newgrf_callbacks.h:20
CBID_NO_CALLBACK
@ CBID_NO_CALLBACK
Set when using the callback resolve system, but not to resolve a callback.
Definition newgrf_callbacks.h:22
CALLBACK_FAILED
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
Definition newgrf_callbacks.h:427
newgrf_commons.h
This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities.
newgrf_generic.h
Functions related to generic callbacks.
DeterministicSpriteGroupAdjustOperation
DeterministicSpriteGroupAdjustOperation
Definition newgrf_spritegroup.h:120
DSGA_OP_OR
@ DSGA_OP_OR
a | b
Definition newgrf_spritegroup.h:133
DSGA_OP_XOR
@ DSGA_OP_XOR
a ^ b
Definition newgrf_spritegroup.h:134
DSGA_OP_SUB
@ DSGA_OP_SUB
a - b
Definition newgrf_spritegroup.h:122
DSGA_OP_STOP
@ DSGA_OP_STOP
store a into persistent storage, indexed by b, return a
Definition newgrf_spritegroup.h:137
DSGA_OP_ROR
@ DSGA_OP_ROR
rotate a b positions to the right
Definition newgrf_spritegroup.h:138
DSGA_OP_SHL
@ DSGA_OP_SHL
a << b
Definition newgrf_spritegroup.h:141
DSGA_OP_UCMP
@ DSGA_OP_UCMP
(unsigned) comparison (a < b -> 0, a == b = 1, a > b = 2)
Definition newgrf_spritegroup.h:140
DSGA_OP_MUL
@ DSGA_OP_MUL
a * b
Definition newgrf_spritegroup.h:131
DSGA_OP_SAR
@ DSGA_OP_SAR
(signed) a >> b
Definition newgrf_spritegroup.h:143
DSGA_OP_STO
@ DSGA_OP_STO
store a into temporary storage, indexed by b. return a
Definition newgrf_spritegroup.h:135
DSGA_OP_SMOD
@ DSGA_OP_SMOD
(signed) a % b
Definition newgrf_spritegroup.h:128
DSGA_OP_UDIV
@ DSGA_OP_UDIV
(unsigned) a / b
Definition newgrf_spritegroup.h:129
DSGA_OP_UMAX
@ DSGA_OP_UMAX
(unsigned) max(a, b)
Definition newgrf_spritegroup.h:126
DSGA_OP_SMIN
@ DSGA_OP_SMIN
(signed) min(a, b)
Definition newgrf_spritegroup.h:123
DSGA_OP_ADD
@ DSGA_OP_ADD
a + b
Definition newgrf_spritegroup.h:121
DSGA_OP_UMOD
@ DSGA_OP_UMOD
(unsigned) a & b
Definition newgrf_spritegroup.h:130
DSGA_OP_SHR
@ DSGA_OP_SHR
(unsigned) a >> b
Definition newgrf_spritegroup.h:142
DSGA_OP_RST
@ DSGA_OP_RST
return b
Definition newgrf_spritegroup.h:136
DSGA_OP_AND
@ DSGA_OP_AND
a & b
Definition newgrf_spritegroup.h:132
DSGA_OP_SDIV
@ DSGA_OP_SDIV
(signed) a / b
Definition newgrf_spritegroup.h:127
DSGA_OP_SCMP
@ DSGA_OP_SCMP
(signed) comparison (a < b -> 0, a == b = 1, a > b = 2)
Definition newgrf_spritegroup.h:139
DSGA_OP_UMIN
@ DSGA_OP_UMIN
(unsigned) min(a, b)
Definition newgrf_spritegroup.h:125
DSGA_OP_SMAX
@ DSGA_OP_SMAX
(signed) max(a, b)
Definition newgrf_spritegroup.h:124
VarSpriteGroupScope
VarSpriteGroupScope
Definition newgrf_spritegroup.h:97
VSG_SCOPE_SELF
@ VSG_SCOPE_SELF
Resolved object itself.
Definition newgrf_spritegroup.h:100
VSG_SCOPE_PARENT
@ VSG_SCOPE_PARENT
Related object of the resolved one.
Definition newgrf_spritegroup.h:101
VSG_SCOPE_RELATIVE
@ VSG_SCOPE_RELATIVE
Relative position (vehicles only)
Definition newgrf_spritegroup.h:102
GetRegister
uint32_t GetRegister(uint i)
Gets the value of a so-called newgrf "register".
Definition newgrf_spritegroup.h:29
newgrf_storage.h
Functionality related to the temporary and persistent storage arrays for NewGRFs.
CallbackResultSpriteGroup
Definition newgrf_spritegroup.h:210
CallbackResultSpriteGroup::CallbackResultSpriteGroup
CallbackResultSpriteGroup(uint16_t value)
Creates a spritegroup representing a callback result.
Definition newgrf_spritegroup.h:215
DeterministicSpriteGroupAdjust
Definition newgrf_spritegroup.h:147
DeterministicSpriteGroupAdjust::parameter
uint8_t parameter
Used for variables between 0x60 and 0x7F inclusive.
Definition newgrf_spritegroup.h:151
DeterministicSpriteGroupRange
Definition newgrf_spritegroup.h:160
DeterministicSpriteGroup
Definition newgrf_spritegroup.h:167
DeterministicSpriteGroup::Resolve
const SpriteGroup * Resolve(ResolverObject &object) const override
Base sprite group resolver.
Definition newgrf_spritegroup.cpp:188
DrawTileSprites
Ground palette sprite of a tile, together with its sprite layout.
Definition sprite.h:58
GRFFile
Dynamic data of a loaded NewGRF.
Definition newgrf.h:108
IndustryProductionSpriteGroup
Definition newgrf_spritegroup.h:257
IndustryProductionSpriteGroup::add_output
uint16_t add_output[INDUSTRY_NUM_OUTPUTS]
Add this much output cargo when successful (unsigned, is indirect in cb version 1+)
Definition newgrf_spritegroup.h:265
IndustryProductionSpriteGroup::cargo_input
CargoID cargo_input[INDUSTRY_NUM_INPUTS]
Which input cargoes to take from (only cb version 2)
Definition newgrf_spritegroup.h:263
IndustryProductionSpriteGroup::num_input
uint8_t num_input
How many subtract_input values are valid.
Definition newgrf_spritegroup.h:261
IndustryProductionSpriteGroup::subtract_input
int16_t subtract_input[INDUSTRY_NUM_INPUTS]
Take this much of the input cargo (can be negative, is indirect in cb version 1+)
Definition newgrf_spritegroup.h:262
IndustryProductionSpriteGroup::version
uint8_t version
Production callback version used, or 0xFF if marked invalid.
Definition newgrf_spritegroup.h:260
IndustryProductionSpriteGroup::num_output
uint8_t num_output
How many add_output values are valid.
Definition newgrf_spritegroup.h:264
IndustryProductionSpriteGroup::cargo_output
CargoID cargo_output[INDUSTRY_NUM_OUTPUTS]
Which output cargoes to add to (only cb version 2)
Definition newgrf_spritegroup.h:266
NewGRFSpriteLayout
NewGRF supplied spritelayout.
Definition newgrf_commons.h:112
Pool::PoolItem
Base class for all PoolItems.
Definition pool_type.hpp:237
Pool
Base class for all pools.
Definition pool_type.hpp:80
RandomizedSpriteGroup
Definition newgrf_spritegroup.h:190
RandomizedSpriteGroup::lowest_randbit
uint8_t lowest_randbit
Look for this in the per-object randomized bitmask:
Definition newgrf_spritegroup.h:199
RandomizedSpriteGroup::var_scope
VarSpriteGroupScope var_scope
Take this object:
Definition newgrf_spritegroup.h:193
RandomizedSpriteGroup::Resolve
const SpriteGroup * Resolve(ResolverObject &object) const override
Base sprite group resolver.
Definition newgrf_spritegroup.cpp:256
RandomizedSpriteGroup::groups
std::vector< const SpriteGroup * > groups
Take the group with appropriate index:
Definition newgrf_spritegroup.h:201
RandomizedSpriteGroup::cmp_mode
RandomizedSpriteGroupCompareMode cmp_mode
Check for these triggers:
Definition newgrf_spritegroup.h:195
RealSpriteGroup
Definition newgrf_spritegroup.h:79
RealSpriteGroup::loaded
std::vector< const SpriteGroup * > loaded
List of loaded groups (can be SpriteIDs or Callback results)
Definition newgrf_spritegroup.h:89
RealSpriteGroup::loading
std::vector< const SpriteGroup * > loading
List of loading groups (can be SpriteIDs or Callback results)
Definition newgrf_spritegroup.h:90
RealSpriteGroup::Resolve
const SpriteGroup * Resolve(ResolverObject &object) const override
Base sprite group resolver.
Definition newgrf_spritegroup.cpp:277
ResolverObject
Interface for SpriteGroup-s to access the gamestate.
Definition newgrf_spritegroup.h:296
ResolverObject::grffile
const GRFFile * grffile
GRFFile the resolved SpriteGroup belongs to.
Definition newgrf_spritegroup.h:324
ResolverObject::GetDebugID
virtual uint32_t GetDebugID() const
Get an identifier for the item being resolved.
Definition newgrf_spritegroup.h:394
ResolverObject::Resolve
const SpriteGroup * Resolve()
Resolve SpriteGroup.
Definition newgrf_spritegroup.h:331
ResolverObject::used_triggers
uint32_t used_triggers
Subset of cur_triggers, which actually triggered some rerandomisation. (scope independent)
Definition newgrf_spritegroup.h:321
ResolverObject::waiting_triggers
uint32_t waiting_triggers
Waiting triggers to be used by any rerandomisation. (scope independent)
Definition newgrf_spritegroup.h:320
ResolverObject::callback_param2
uint32_t callback_param2
Second parameter (var 18) of the callback.
Definition newgrf_spritegroup.h:316
ResolverObject::ResolveReal
virtual const SpriteGroup * ResolveReal(const RealSpriteGroup *group) const
Get the real sprites of the grf.
Definition newgrf_spritegroup.cpp:123
ResolverObject::reseed
uint32_t reseed[VSG_END]
Collects bits to rerandomise while triggering triggers.
Definition newgrf_spritegroup.h:322
ResolverObject::GetRemainingTriggers
uint32_t GetRemainingTriggers() const
Returns the waiting triggers that did not trigger any rerandomisation.
Definition newgrf_spritegroup.h:353
ResolverObject::GetReseedSum
uint32_t GetReseedSum() const
Returns the OR-sum of all bits that need reseeding independent of the scope they were accessed with.
Definition newgrf_spritegroup.h:363
ResolverObject::ResetState
void ResetState()
Resets the dynamic state of the resolver object.
Definition newgrf_spritegroup.h:376
ResolverObject::ResolverObject
ResolverObject(const GRFFile *grffile, CallbackID callback=CBID_NO_CALLBACK, uint32_t callback_param1=0, uint32_t callback_param2=0)
Resolver constructor.
Definition newgrf_spritegroup.h:304
ResolverObject::default_scope
ScopeResolver default_scope
Default implementation of the grf scope.
Definition newgrf_spritegroup.h:312
ResolverObject::callback
CallbackID callback
Callback being resolved.
Definition newgrf_spritegroup.h:314
ResolverObject::callback_param1
uint32_t callback_param1
First parameter (var 10) of the callback.
Definition newgrf_spritegroup.h:315
ResolverObject::last_value
uint32_t last_value
Result of most recent DeterministicSpriteGroup (including procedure calls)
Definition newgrf_spritegroup.h:318
ResolverObject::ResolveCallback
uint16_t ResolveCallback()
Resolve callback.
Definition newgrf_spritegroup.h:340
ResolverObject::GetFeature
virtual GrfSpecFeature GetFeature() const
Get the feature number being resolved for.
Definition newgrf_spritegroup.h:388
ResolverObject::root_spritegroup
const SpriteGroup * root_spritegroup
Root SpriteGroup to use for resolving.
Definition newgrf_spritegroup.h:325
ResolverObject::GetScope
virtual ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, uint8_t relative=0)
Get a resolver for the scope.
Definition newgrf_spritegroup.cpp:135
ResultSpriteGroup
Definition newgrf_spritegroup.h:224
ResultSpriteGroup::ResultSpriteGroup
ResultSpriteGroup(SpriteID sprite, uint8_t num_sprites)
Creates a spritegroup representing a sprite number result.
Definition newgrf_spritegroup.h:231
ScopeResolver
Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope).
Definition newgrf_spritegroup.h:277
ScopeResolver::StorePSA
virtual void StorePSA(uint reg, int32_t value)
Store a value into the persistent storage area (PSA).
Definition newgrf_spritegroup.cpp:116
ScopeResolver::GetTriggers
virtual uint32_t GetTriggers() const
Get the triggers.
Definition newgrf_spritegroup.cpp:94
ScopeResolver::GetVariable
virtual uint32_t GetVariable(uint8_t variable, uint32_t parameter, bool &available) const
Get a variable value.
Definition newgrf_spritegroup.cpp:106
ScopeResolver::ro
ResolverObject & ro
Surrounding resolver object.
Definition newgrf_spritegroup.h:278
ScopeResolver::GetRandomBits
virtual uint32_t GetRandomBits() const
Get a few random bits.
Definition newgrf_spritegroup.cpp:85
SpriteGroup
Definition newgrf_spritegroup.h:57
SpriteGroup::Resolve
virtual const SpriteGroup * Resolve(ResolverObject &object) const
Base sprite group resolver.
Definition newgrf_spritegroup.h:61
TemporaryStorageArray
Class for temporary storage of data.
Definition newgrf_storage.h:133
TileLayoutSpriteGroup
Action 2 sprite layout for houses, industry tiles, objects and airport tiles.
Definition newgrf_spritegroup.h:248
TileLayoutSpriteGroup::ProcessRegisters
const DrawTileSprites * ProcessRegisters(uint8_t *stage) const
Process registers and the construction stage into the sprite layout.
Definition newgrf_spritegroup.cpp:289
town_type.h
Types related to towns.