Skip to content

Commit

Permalink
Merge pull request #20 from Decane/controller
Browse files Browse the repository at this point in the history
Fixed controller roars persisting into loaded savegames
  • Loading branch information
Xottab-DUTY committed Apr 3, 2019
2 parents e24dad0 + 3fec6f6 commit e9597ec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cs/engine/xrGame/ai/monsters/controller/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ void CController::net_Destroy()
{
inherited::net_Destroy();

m_aura->on_death ();
m_aura->on_destroy ();
FreeFromControl ();
}

Expand Down
14 changes: 14 additions & 0 deletions cs/engine/xrGame/ai/monsters/controller/controller_psy_aura.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ void CPPEffectorControllerAura::switch_off()
m_time_state_started = Device.dwTimeGlobal;
}

void CPPEffectorControllerAura::terminate()
{
if (m_snd_left._feedback()) m_snd_left.stop();
if (m_snd_right._feedback()) m_snd_right.stop();
}

BOOL CPPEffectorControllerAura::update()
{
Expand Down Expand Up @@ -174,6 +179,15 @@ void CControllerAura::on_death()
}
}

void CControllerAura::on_destroy()
{
if (active()) {
m_effector->terminate ();
m_effector = 0;
m_hit_state = eNone;
}
}

void CControllerAura::load(LPCSTR section)
{
inherited::load (pSettings->r_string(section,"aura_effector"));
Expand Down
2 changes: 2 additions & 0 deletions cs/engine/xrGame/ai/monsters/controller/controller_psy_aura.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CPPEffectorControllerAura : public CPPEffectorCustom {
CPPEffectorControllerAura (const SPPInfo &ppi, u32 time_to_fade, const ref_sound &snd_left, const ref_sound &snd_right);
virtual BOOL update ();
void switch_off ();
void terminate ();
};

class CControllerAura : public CPPEffectorCustomController<CPPEffectorControllerAura>{
Expand Down Expand Up @@ -66,6 +67,7 @@ class CControllerAura : public CPPEffectorCustomController<CPPEffectorController
virtual void load (LPCSTR section);

void on_death ();
void on_destroy ();
void update_schedule ();
void update_frame ();
};
Expand Down

0 comments on commit e9597ec

Please sign in to comment.