equal
deleted
inserted
replaced
46 /* Shared by deterministic and random groups. */ |
46 /* Shared by deterministic and random groups. */ |
47 enum VarSpriteGroupScope { |
47 enum VarSpriteGroupScope { |
48 VSG_SCOPE_SELF, |
48 VSG_SCOPE_SELF, |
49 /* Engine of consists for vehicles, city for stations. */ |
49 /* Engine of consists for vehicles, city for stations. */ |
50 VSG_SCOPE_PARENT, |
50 VSG_SCOPE_PARENT, |
|
51 /* Any vehicle in the consist (vehicles only) */ |
|
52 VSG_SCOPE_RELATIVE, |
51 }; |
53 }; |
52 |
54 |
53 enum DeterministicSpriteGroupSize { |
55 enum DeterministicSpriteGroupSize { |
54 DSG_SIZE_BYTE, |
56 DSG_SIZE_BYTE, |
55 DSG_SIZE_WORD, |
57 DSG_SIZE_WORD, |
126 struct RandomizedSpriteGroup { |
128 struct RandomizedSpriteGroup { |
127 VarSpriteGroupScope var_scope; ///< Take this object: |
129 VarSpriteGroupScope var_scope; ///< Take this object: |
128 |
130 |
129 RandomizedSpriteGroupCompareMode cmp_mode; ///< Check for these triggers: |
131 RandomizedSpriteGroupCompareMode cmp_mode; ///< Check for these triggers: |
130 byte triggers; |
132 byte triggers; |
|
133 byte count; |
131 |
134 |
132 byte lowest_randbit; ///< Look for this in the per-object randomized bitmask: |
135 byte lowest_randbit; ///< Look for this in the per-object randomized bitmask: |
133 byte num_groups; ///< must be power of 2 |
136 byte num_groups; ///< must be power of 2 |
134 |
137 |
135 const SpriteGroup **groups; ///< Take the group with appropriate index: |
138 const SpriteGroup **groups; ///< Take the group with appropriate index: |
196 |
199 |
197 struct ResolverObject { |
200 struct ResolverObject { |
198 CallbackID callback; |
201 CallbackID callback; |
199 uint32 callback_param1; |
202 uint32 callback_param1; |
200 uint32 callback_param2; |
203 uint32 callback_param2; |
|
204 bool procedure_call; ///< true if we are currently resolving a var 0x7E procedure result. |
201 |
205 |
202 byte trigger; |
206 byte trigger; |
|
207 byte count; |
203 uint32 last_value; |
208 uint32 last_value; |
204 uint32 reseed; |
209 uint32 reseed; |
205 VarSpriteGroupScope scope; |
210 VarSpriteGroupScope scope; |
206 |
211 |
207 bool info_view; ///< Indicates if the item is being drawn in an info window |
212 bool info_view; ///< Indicates if the item is being drawn in an info window |
252 uint32 (*GetRandomBits)(const struct ResolverObject*); |
257 uint32 (*GetRandomBits)(const struct ResolverObject*); |
253 uint32 (*GetTriggers)(const struct ResolverObject*); |
258 uint32 (*GetTriggers)(const struct ResolverObject*); |
254 void (*SetTriggers)(const struct ResolverObject*, int); |
259 void (*SetTriggers)(const struct ResolverObject*, int); |
255 uint32 (*GetVariable)(const struct ResolverObject*, byte, byte, bool*); |
260 uint32 (*GetVariable)(const struct ResolverObject*, byte, byte, bool*); |
256 const SpriteGroup *(*ResolveReal)(const struct ResolverObject*, const SpriteGroup*); |
261 const SpriteGroup *(*ResolveReal)(const struct ResolverObject*, const SpriteGroup*); |
|
262 |
|
263 ResolverObject() : procedure_call(false) { } |
257 }; |
264 }; |
258 |
265 |
259 |
266 |
260 /* Base sprite group resolver */ |
267 /* Base sprite group resolver */ |
261 const SpriteGroup *Resolve(const SpriteGroup *group, ResolverObject *object); |
268 const SpriteGroup *Resolve(const SpriteGroup *group, ResolverObject *object); |