1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-05 19:31:04 +00:00

Support floating-point animation frame numbers

This commit is contained in:
Lars Mueller 2024-09-02 21:11:08 +02:00 committed by Lars Müller
parent 323fc0a798
commit 06907aa99b
22 changed files with 111 additions and 105 deletions

View file

@ -1052,7 +1052,7 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
walking = true;
}
v2s32 new_anim = v2s32(0,0);
v2f new_anim(0,0);
bool allow_update = false;
// increase speed if using fast or flying fast
@ -1799,10 +1799,9 @@ void GenericCAO::processMessage(const std::string &data)
phys.speed_walk = override_speed_walk;
}
} else if (cmd == AO_CMD_SET_ANIMATION) {
// TODO: change frames send as v2s32 value
v2f range = readV2F32(is);
if (!m_is_local_player) {
m_animation_range = v2s32((s32)range.X, (s32)range.Y);
m_animation_range = range;
m_animation_speed = readF32(is);
m_animation_blend = readF32(is);
// these are sent inverted so we get true when the server sends nothing
@ -1812,7 +1811,7 @@ void GenericCAO::processMessage(const std::string &data)
LocalPlayer *player = m_env->getLocalPlayer();
if(player->last_animation == LocalPlayerAnimation::NO_ANIM)
{
m_animation_range = v2s32((s32)range.X, (s32)range.Y);
m_animation_range = range;
m_animation_speed = readF32(is);
m_animation_blend = readF32(is);
// these are sent inverted so we get true when the server sends nothing

View file

@ -99,7 +99,7 @@ private:
v2s16 m_tx_basepos;
bool m_initial_tx_basepos_set = false;
bool m_tx_select_horiz_by_yawpitch = false;
v2s32 m_animation_range;
v2f m_animation_range;
float m_animation_speed = 15.0f;
float m_animation_blend = 0.0f;
bool m_animation_loop = true;