Skip to content

Commit ced6e94

Browse files
joye-ramonexrSimpAI
authored andcommitted
play_hud_anm вернет продолжительность анимации
1 parent 078f291 commit ced6e94

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

ogsr_engine/xrGame/game_sv_base_script.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ float MotionLength(LPCSTR hud_section, LPCSTR anm_name, float speed) { return g_
5353

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

56-
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); }
56+
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); }
5757

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

ogsr_engine/xrGame/player_hud.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,7 @@ void player_hud::updateMovementLayerState()
18471847
}
18481848

18491849

1850-
void player_hud::PlayBlendAnm(LPCSTR name, u8 part, float speed, float power, bool bLooped, bool no_restart)
1850+
float player_hud::PlayBlendAnm(LPCSTR name, u8 part, float speed, float power, bool bLooped, bool no_restart)
18511851
{
18521852
for (script_layer* anm : m_script_layers)
18531853
{
@@ -1868,12 +1868,13 @@ void player_hud::PlayBlendAnm(LPCSTR name, u8 part, float speed, float power, bo
18681868
anm->anm->Speed() = speed;
18691869
anm->m_power = power;
18701870
anm->active = true;
1871-
return;
1871+
return (anm->anm->m_MParam.max_t - anm->anm->m_MParam.t) / anm->anm->Speed();
18721872
}
18731873
}
18741874

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

18791880
void player_hud::StopBlendAnm(LPCSTR name, bool bForce)

ogsr_engine/xrGame/player_hud.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ class player_hud
372372
xr_vector<hand_motions*> m_hand_motions;
373373
player_hud_motion_container* get_hand_motions(LPCSTR section, IKinematicsAnimated* animatedHudItem);
374374

375-
void PlayBlendAnm(LPCSTR name, u8 part = 0, float speed = 1.f, float power = 1.f, bool bLooped = true, bool no_restart = false);
375+
float PlayBlendAnm(LPCSTR name, u8 part = 0, float speed = 1.f, float power = 1.f, bool bLooped = true, bool no_restart = false);
376376
void StopBlendAnm(LPCSTR name, bool bForce = false);
377377
void StopAllBlendAnms(bool bForce);
378378
float SetBlendAnmTime(LPCSTR name, float time);

0 commit comments

Comments
 (0)