12 #ifndef NEWGRF_SPRITEGROUP_H 13 #define NEWGRF_SPRITEGROUP_H 38 enum SpriteGroupType {
45 SGT_INDUSTRY_PRODUCTION,
49 typedef uint32 SpriteGroupID;
70 virtual SpriteID GetResult()
const {
return 0; }
71 virtual byte GetNumResults()
const {
return 0; }
112 enum DeterministicSpriteGroupSize {
118 enum DeterministicSpriteGroupAdjustType {
153 DeterministicSpriteGroupAdjustType type;
176 DeterministicSpriteGroupSize size;
179 bool calculated_result;
192 enum RandomizedSpriteGroupCompareMode {
231 if (!grf_version8 && (this->result >> 8) == 0xFF) {
232 this->result &= ~0xFF00;
234 this->result &= ~0x8000;
239 uint16 GetCallbackResult()
const {
return this->result; }
255 num_sprites(num_sprites)
261 SpriteID GetResult()
const {
return this->sprite; }
262 byte GetNumResults()
const {
return this->num_sprites; }
303 virtual uint32 GetRandomBits()
const;
304 virtual uint32 GetTriggers()
const;
306 virtual uint32 GetVariable(byte variable, uint32 parameter,
bool *available)
const;
307 virtual void StorePSA(uint reg, int32 value);
325 : default_scope(*this), callback(callback), callback_param1(callback_param1), callback_param2(callback_param2), grffile(grffile), root_spritegroup(NULL)
342 uint32 reseed[VSG_END];
375 return this->waiting_triggers & ~this->used_triggers;
387 sum |= this->reseed[vsg];
398 this->last_value = 0;
399 this->waiting_triggers = 0;
400 this->used_triggers = 0;
401 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.
Types related to the industry.
static const int INDUSTRY_NUM_INPUTS
Number of cargo types an industry can accept.
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.
static const int INDUSTRY_NUM_OUTPUTS
Number of cargo types an industry can produce.
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.
uint8 num_output
How many add_output values are valid.
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.
uint8 version
Production callback version used, or 0xFF if marked invalid.
(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.
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
TYPE GetValue(uint pos) const
Gets the value from a given position.
byte CargoID
Cargo slots to indicate a cargo type within a game.
byte parameter
Used for variables between 0x60 and 0x7F inclusive.
uint8 num_input
How many subtract_input values are valid.
Action 2 sprite layout for houses, industry tiles, objects and airport tiles.
uint16 ResolveCallback()
Resolve callback.
Dynamic data of a loaded NewGRF.