Skip to content

Commit

Permalink
Fix by SkyLoader: reload effector works not every time
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Aug 13, 2017
1 parent 0c34678 commit b47a3e9
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/xrGame/player_hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "static_cast_checked.hpp"
#include "actoreffector.h"
#include "xrEngine/IGame_Persistent.h"
#include "xrCore/xrDebug_macros.h" // only for pragma todo


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

if (nullptr == ec)
if (ec)
current_actor->Cameras().RemoveCamEffector(eCEWeaponAction);

string_path ce_path;
string_path anm_name;
#pragma todo("Xottab_DUTY: replace backslashes with slashes")
strconcat(sizeof(anm_name), anm_name, "camera_effects\\weapon\\", M.name.c_str(), ".anm");
if (FS.exist(ce_path, "$game_anims$", anm_name))
{
string_path ce_path;
string_path anm_name;
strconcat(sizeof(anm_name), anm_name, "camera_effects\\weapon\\", M.name.c_str(), ".anm");
if (FS.exist(ce_path, "$game_anims$", anm_name))
{
CAnimatorCamEffector* e = new CAnimatorCamEffector();
e->SetType(eCEWeaponAction);
e->SetHudAffect(false);
e->SetCyclic(false);
e->Start(anm_name);
current_actor->Cameras().AddCamEffector(e);
}
CAnimatorCamEffector* e = new CAnimatorCamEffector();
e->SetType(eCEWeaponAction);
e->SetHudAffect(false);
e->SetCyclic(false);
e->Start(anm_name);
current_actor->Cameras().AddCamEffector(e);
}
}
return ret;
Expand Down

0 comments on commit b47a3e9

Please sign in to comment.