Skip to content

Commit b47a3e9

Browse files
committed
Fix by SkyLoader: reload effector works not every time
1 parent 0c34678 commit b47a3e9

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/xrGame/player_hud.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include "static_cast_checked.hpp"
88
#include "actoreffector.h"
99
#include "xrEngine/IGame_Persistent.h"
10+
#include "xrCore/xrDebug_macros.h" // only for pragma todo
11+
1012

1113
player_hud* g_player_hud = nullptr;
1214
Fvector _ancor_pos;
@@ -366,20 +368,21 @@ u32 attachable_hud_item::anim_play(const shared_str& anm_name_b, BOOL bMixIn, co
366368
VERIFY(current_actor);
367369
CEffectorCam* ec = current_actor->Cameras().GetCamEffector(eCEWeaponAction);
368370

369-
if (nullptr == ec)
371+
if (ec)
372+
current_actor->Cameras().RemoveCamEffector(eCEWeaponAction);
373+
374+
string_path ce_path;
375+
string_path anm_name;
376+
#pragma todo("Xottab_DUTY: replace backslashes with slashes")
377+
strconcat(sizeof(anm_name), anm_name, "camera_effects\\weapon\\", M.name.c_str(), ".anm");
378+
if (FS.exist(ce_path, "$game_anims$", anm_name))
370379
{
371-
string_path ce_path;
372-
string_path anm_name;
373-
strconcat(sizeof(anm_name), anm_name, "camera_effects\\weapon\\", M.name.c_str(), ".anm");
374-
if (FS.exist(ce_path, "$game_anims$", anm_name))
375-
{
376-
CAnimatorCamEffector* e = new CAnimatorCamEffector();
377-
e->SetType(eCEWeaponAction);
378-
e->SetHudAffect(false);
379-
e->SetCyclic(false);
380-
e->Start(anm_name);
381-
current_actor->Cameras().AddCamEffector(e);
382-
}
380+
CAnimatorCamEffector* e = new CAnimatorCamEffector();
381+
e->SetType(eCEWeaponAction);
382+
e->SetHudAffect(false);
383+
e->SetCyclic(false);
384+
e->Start(anm_name);
385+
current_actor->Cameras().AddCamEffector(e);
383386
}
384387
}
385388
return ret;

0 commit comments

Comments
 (0)