79 TemporaryStorageArray<uint32, 0x110> _temp_store; |
80 TemporaryStorageArray<uint32, 0x110> _temp_store; |
80 |
81 |
81 |
82 |
82 static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) |
83 static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) |
83 { |
84 { |
84 /* Return common variables */ |
85 /* First handle variables common with Action7/9/D */ |
|
86 uint32 value; |
|
87 if (GetGlobalVariable(variable, &value)) return value; |
|
88 |
|
89 /* Non-common variable */ |
85 switch (variable) { |
90 switch (variable) { |
86 case 0x00: return max(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0); |
|
87 case 0x01: return Clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR; |
|
88 case 0x02: return _cur_month; |
|
89 case 0x03: return _opt.landscape; |
|
90 case 0x09: return _date_fract; |
|
91 case 0x0A: return _tick_counter; |
|
92 case 0x0C: return object->callback; |
91 case 0x0C: return object->callback; |
93 case 0x10: return object->callback_param1; |
92 case 0x10: return object->callback_param1; |
94 case 0x11: return 0; |
|
95 case 0x12: return _game_mode; |
|
96 case 0x18: return object->callback_param2; |
93 case 0x18: return object->callback_param2; |
97 case 0x1A: return UINT_MAX; |
|
98 case 0x1B: return GB(_display_opt, 0, 6); |
|
99 case 0x1C: return object->last_value; |
94 case 0x1C: return object->last_value; |
100 case 0x20: return _opt.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF; |
|
101 |
95 |
102 case 0x7D: return _temp_store.Get(parameter); |
96 case 0x7D: return _temp_store.Get(parameter); |
103 |
97 |
104 /* Not a common variable, so evalute the feature specific variables */ |
98 /* Not a common variable, so evalute the feature specific variables */ |
105 default: return object->GetVariable(object, variable, parameter, available); |
99 default: return object->GetVariable(object, variable, parameter, available); |