30 template <
typename Tbase,
typename Tspec,
typename Tobj,
typename Textra, u
int16 (*GetCallback)(CallbackID callback, u
int32 param1, u
int32 param2, const Tspec *statspec, Tobj *st, TileIndex tile, Textra extra_data)>
41 static void AnimateTile(
const Tspec *spec, Tobj *obj,
TileIndex tile,
bool random_animation, Textra extra_data = 0)
46 uint8 animation_speed = spec->animation.speed;
47 if (
HasBit(spec->callback_mask, Tbase::cbm_animation_speed)) {
48 uint16 callback = GetCallback(Tbase::cb_animation_speed, 0, 0, spec, obj, tile, extra_data);
50 if (callback >= 0x100 && spec->grf_prop.grffile->grf_version >= 8)
ErrorUnknownCallbackResult(spec->grf_prop.grffile->grfid, Tbase::cb_animation_speed, callback);
51 animation_speed =
Clamp(callback & 0xFF, 0, 16);
62 uint8 num_frames = spec->animation.frames;
64 bool frame_set_by_callback =
false;
66 if (
HasBit(spec->callback_mask, Tbase::cbm_animation_next_frame)) {
67 uint16 callback = GetCallback(Tbase::cb_animation_next_frame, random_animation ? Random() : 0, 0, spec, obj, tile, extra_data);
70 frame_set_by_callback =
true;
72 switch (callback & 0xFF) {
78 frame_set_by_callback =
false;
82 frame = callback & 0xFF;
92 if (!frame_set_by_callback) {
93 if (frame < num_frames) {
122 uint16 callback = GetCallback(cb, random_bits, trigger, spec, obj, tile, extra_data);
125 switch (callback & 0xFF) {