@@ -41,7 +41,7 @@ struct TileAnimationFrameAnimationHelper {
|
||||
* @tparam GetCallback The callback function pointer.
|
||||
* @tparam Tframehelper The animation frame get/set helper.
|
||||
*/
|
||||
template <typename Tbase, typename Tspec, typename Tobj, typename Textra, uint16 (*GetCallback)(CallbackID callback, uint32 param1, uint32 param2, const Tspec *statspec, Tobj *st, TileIndex tile, Textra extra_data), typename Tframehelper>
|
||||
template <typename Tbase, typename Tspec, typename Tobj, typename Textra, uint16_t (*GetCallback)(CallbackID callback, uint32_t param1, uint32_t param2, const Tspec *statspec, Tobj *st, TileIndex tile, Textra extra_data), typename Tframehelper>
|
||||
struct AnimationBase {
|
||||
/**
|
||||
* Animate a single tile.
|
||||
@@ -56,9 +56,9 @@ struct AnimationBase {
|
||||
assert(spec != nullptr);
|
||||
|
||||
/* Acquire the animation speed from the NewGRF. */
|
||||
uint8 animation_speed = spec->animation.speed;
|
||||
uint8_t animation_speed = spec->animation.speed;
|
||||
if (HasBit(spec->callback_mask, Tbase::cbm_animation_speed)) {
|
||||
uint16 callback = GetCallback(Tbase::cb_animation_speed, 0, 0, spec, obj, tile, extra_data);
|
||||
uint16_t callback = GetCallback(Tbase::cb_animation_speed, 0, 0, spec, obj, tile, extra_data);
|
||||
if (callback != CALLBACK_FAILED) {
|
||||
if (callback >= 0x100 && spec->grf_prop.grffile->grf_version >= 8) ErrorUnknownCallbackResult(spec->grf_prop.grffile->grfid, Tbase::cb_animation_speed, callback);
|
||||
animation_speed = Clamp(callback & 0xFF, 0, 16);
|
||||
@@ -69,15 +69,15 @@ struct AnimationBase {
|
||||
* increasing this value by one doubles the wait. 0 is the minimum value
|
||||
* allowed for animation_speed, which corresponds to 30ms, and 16 is the
|
||||
* maximum, corresponding to around 33 minutes. */
|
||||
if ((((uint32)_scaled_tick_counter) & ((1 << animation_speed) - 1)) != 0) return;
|
||||
if ((((uint32_t)_scaled_tick_counter) & ((1 << animation_speed) - 1)) != 0) return;
|
||||
|
||||
uint8 frame = Tframehelper::Get(obj, tile);
|
||||
uint8 num_frames = spec->animation.frames;
|
||||
uint8_t frame = Tframehelper::Get(obj, tile);
|
||||
uint8_t num_frames = spec->animation.frames;
|
||||
|
||||
bool frame_set_by_callback = false;
|
||||
|
||||
if (HasBit(spec->callback_mask, Tbase::cbm_animation_next_frame)) {
|
||||
uint16 callback = GetCallback(Tbase::cb_animation_next_frame, random_animation ? Random() : 0, 0, spec, obj, tile, extra_data);
|
||||
uint16_t callback = GetCallback(Tbase::cb_animation_next_frame, random_animation ? Random() : 0, 0, spec, obj, tile, extra_data);
|
||||
|
||||
if (callback != CALLBACK_FAILED) {
|
||||
frame_set_by_callback = true;
|
||||
@@ -131,9 +131,9 @@ struct AnimationBase {
|
||||
* @param trigger What triggered this update? To be passed as parameter to the NewGRF.
|
||||
* @param extra_data Custom extra data for callback processing.
|
||||
*/
|
||||
static void ChangeAnimationFrame(CallbackID cb, const Tspec *spec, Tobj *obj, TileIndex tile, uint32 random_bits, uint32 trigger, Textra extra_data = 0)
|
||||
static void ChangeAnimationFrame(CallbackID cb, const Tspec *spec, Tobj *obj, TileIndex tile, uint32_t random_bits, uint32_t trigger, Textra extra_data = 0)
|
||||
{
|
||||
uint16 callback = GetCallback(cb, random_bits, trigger, spec, obj, tile, extra_data);
|
||||
uint16_t callback = GetCallback(cb, random_bits, trigger, spec, obj, tile, extra_data);
|
||||
if (callback == CALLBACK_FAILED) return;
|
||||
|
||||
switch (callback & 0xFF) {
|
||||
@@ -157,7 +157,7 @@ struct AnimationBase {
|
||||
if (GB(callback, 8, 7) != 0 && _settings_client.sound.ambient) PlayTileSound(spec->grf_prop.grffile, GB(callback, 8, 7), tile);
|
||||
}
|
||||
|
||||
static uint8 GetAnimationSpeed(const Tspec *spec)
|
||||
static uint8_t GetAnimationSpeed(const Tspec *spec)
|
||||
{
|
||||
if (HasBit(spec->callback_mask, Tbase::cbm_animation_speed)) return 0;
|
||||
return spec->animation.speed;
|
||||
|
Reference in New Issue
Block a user