Skip to content

Commit

Permalink
play_hud_anm вернет продолжительность анимации
Browse files Browse the repository at this point in the history
  • Loading branch information
joye-ramone authored and xrSimpodin committed Dec 24, 2023
1 parent 078f291 commit ced6e94
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ogsr_engine/xrGame/game_sv_base_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ float MotionLength(LPCSTR hud_section, LPCSTR anm_name, float speed) { return g_

bool AllowHudMotion() { return g_player_hud->allow_script_anim(); }

void PlayBlendAnm(LPCSTR name, u8 part, float speed, float power, bool bLooped, bool no_restart) { g_player_hud->PlayBlendAnm(name, part, speed, power, bLooped, no_restart); }
float PlayBlendAnm(LPCSTR name, u8 part, float speed, float power, bool bLooped, bool no_restart) { return g_player_hud->PlayBlendAnm(name, part, speed, power, bLooped, no_restart); }

void StopBlendAnm(LPCSTR name, bool bForce) { g_player_hud->StopBlendAnm(name, bForce); }

Expand Down
5 changes: 3 additions & 2 deletions ogsr_engine/xrGame/player_hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ void player_hud::updateMovementLayerState()
}


void player_hud::PlayBlendAnm(LPCSTR name, u8 part, float speed, float power, bool bLooped, bool no_restart)
float player_hud::PlayBlendAnm(LPCSTR name, u8 part, float speed, float power, bool bLooped, bool no_restart)
{
for (script_layer* anm : m_script_layers)
{
Expand All @@ -1868,12 +1868,13 @@ void player_hud::PlayBlendAnm(LPCSTR name, u8 part, float speed, float power, bo
anm->anm->Speed() = speed;
anm->m_power = power;
anm->active = true;
return;
return (anm->anm->m_MParam.max_t - anm->anm->m_MParam.t) / anm->anm->Speed();
}
}

script_layer* anm = xr_new<script_layer>(name, part, speed, power, bLooped);
m_script_layers.push_back(anm);
return (anm->anm->m_MParam.max_t - anm->anm->m_MParam.t) / anm->anm->Speed();
}

void player_hud::StopBlendAnm(LPCSTR name, bool bForce)
Expand Down
2 changes: 1 addition & 1 deletion ogsr_engine/xrGame/player_hud.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ class player_hud
xr_vector<hand_motions*> m_hand_motions;
player_hud_motion_container* get_hand_motions(LPCSTR section, IKinematicsAnimated* animatedHudItem);

void PlayBlendAnm(LPCSTR name, u8 part = 0, float speed = 1.f, float power = 1.f, bool bLooped = true, bool no_restart = false);
float PlayBlendAnm(LPCSTR name, u8 part = 0, float speed = 1.f, float power = 1.f, bool bLooped = true, bool no_restart = false);
void StopBlendAnm(LPCSTR name, bool bForce = false);
void StopAllBlendAnms(bool bForce);
float SetBlendAnmTime(LPCSTR name, float time);
Expand Down

0 comments on commit ced6e94

Please sign in to comment.