12 #ifndef NEWGRF_SPRITEGROUP_H 13 #define NEWGRF_SPRITEGROUP_H 37 enum SpriteGroupType {
44 SGT_INDUSTRY_PRODUCTION,
48 typedef uint32 SpriteGroupID;
69 virtual SpriteID GetResult()
const {
return 0; }
70 virtual byte GetNumResults()
const {
return 0; }
111 enum DeterministicSpriteGroupSize {
117 enum DeterministicSpriteGroupAdjustType {
152 DeterministicSpriteGroupAdjustType type;
175 DeterministicSpriteGroupSize size;
178 bool calculated_result;
191 enum RandomizedSpriteGroupCompareMode {
230 if (!grf_version8 && (this->result >> 8) == 0xFF) {
231 this->result &= ~0xFF00;
233 this->result &= ~0x8000;
238 uint16 GetCallbackResult()
const {
return this->result; }
254 num_sprites(num_sprites)
260 SpriteID GetResult()
const {
return this->sprite; }
261 byte GetNumResults()
const {
return this->num_sprites; }
280 int16 subtract_input[3];
281 uint16 add_output[2];
297 virtual uint32 GetRandomBits()
const;
298 virtual uint32 GetTriggers()
const;
300 virtual uint32 GetVariable(byte variable, uint32 parameter,
bool *available)
const;
301 virtual void StorePSA(uint reg, int32 value);
319 : default_scope(*this), callback(callback), callback_param1(callback_param1), callback_param2(callback_param2), grffile(grffile), root_spritegroup(NULL)
336 uint32 reseed[VSG_END];
369 return this->waiting_triggers & ~this->used_triggers;
381 sum |= this->reseed[vsg];
392 this->last_value = 0;
393 this->waiting_triggers = 0;
394 this->used_triggers = 0;
395 memset(this->reseed, 0,
sizeof(this->reseed));
rotate a b positions to the right
Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope)...
const SpriteGroup ** groups
Take the group with appropriate index:
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
ResolverObject & ro
Surrounding resolver object.
ScopeResolver default_scope
Default implementation of the grf scope.
ResultSpriteGroup(SpriteID sprite, byte num_sprites)
Creates a spritegroup representing a sprite number result.
Functionality related to the temporary and persistent storage arrays for NewGRFs. ...
Class for temporary storage of data.
Interface for SpriteGroup-s to access the gamestate.
Types related to engines.
declaration of basic house types and enums
Set when using the callback resolve system, but not to resolve a callback.
(unsigned) comparison (a < b -> 0, a == b = 1, a > b = 2)
Relative position (vehicles only)
byte num_loaded
Number of loaded groups.
const SpriteGroup * Resolve()
Resolve SpriteGroup.
Callbacks that NewGRFs could implement.
byte lowest_randbit
Look for this in the per-object randomized bitmask:
uint32 callback_param1
First parameter (var 10) of the callback.
const SpriteGroup * root_spritegroup
Root SpriteGroup to use for resolving.
uint32 callback_param2
Second parameter (var 18) of the callback.
static uint32 GetRegister(uint i)
Gets the value of a so-called newgrf "register".
virtual const SpriteGroup * Resolve(ResolverObject &object) const
Base sprite group resolver.
const SpriteGroup ** loaded
List of loaded groups (can be SpriteIDs or Callback results)
Ground palette sprite of a tile, together with its sprite layout.
CallbackResultSpriteGroup(uint16 value, bool grf_version8)
Creates a spritegroup representing a callback result.
DeterministicSpriteGroupAdjustOperation
uint32 waiting_triggers
Waiting triggers to be used by any rerandomisation. (scope independent)
ResolverObject(const GRFFile *grffile, CallbackID callback=CBID_NO_CALLBACK, uint32 callback_param1=0, uint32 callback_param2=0)
Resolver constructor.
uint32 used_triggers
Subset of cur_triggers, which actually triggered some rerandomisation. (scope independent) ...
const SpriteGroup ** loading
List of loading groups (can be SpriteIDs or Callback results)
store a into temporary storage, indexed by b. return a
uint32 GetReseedSum() const
Returns the OR-sum of all bits that need reseeding independent of the scope they were accessed with...
NewGRF supplied spritelayout.
Base class for all PoolItems.
uint32 last_value
Result of most recent DeterministicSpriteGroup (including procedure calls)
Base class for all pools.
byte num_loading
Number of loading groups.
const GRFFile * grffile
GRFFile the resolved SpriteGroup belongs to.
Functions related to generic callbacks.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
RandomizedSpriteGroupCompareMode cmp_mode
Check for these triggers:
uint32 GetRemainingTriggers() const
Returns the waiting triggers that did not trigger any rerandomisation.
Related object of the resolved one.
CallbackID callback
Callback being resolved.
(signed) comparison (a < b -> 0, a == b = 1, a > b = 2)
store a into persistent storage, indexed by b, return a
This file simplyfies and embeds a common mechanism of loading/saving and mapping of grf entities...
VarSpriteGroupScope var_scope
Take this object:
CallbackID
List of implemented NewGRF callbacks.
byte num_groups
must be power of 2
void ResetState()
Resets the dynamic state of the resolver object.
TYPE GetValue(uint pos) const
Gets the value from a given position.
byte parameter
Used for variables between 0x60 and 0x7F inclusive.
#define DECLARE_POSTFIX_INCREMENT(type)
Some enums need to have allowed incrementing (i.e.
Action 2 sprite layout for houses, industry tiles, objects and airport tiles.
uint16 ResolveCallback()
Resolve callback.
Dynamic data of a loaded NewGRF.