SRP icon indicating copy to clipboard operation
SRP copied to clipboard

Controller roars playing before a savegame is loaded persist into that savegame

Open SurDno opened this issue 7 years ago • 3 comments

Yes, I know that it is in 'Bugs still in the game' section of readme, I just wanted to say that it is listed as fixed in Shoker 1.9, just like #42.

SurDno avatar Nov 12 '18 10:11 SurDno

The ZRP has a work-around: kill any online controllers upon death of the player. That still leaves the bug present if the player reloads a save without dying. Perhaps the work-around could be extended to also trigger on net_destroy(). I'd rather have the bug fixed in the engine, though, since that's where it stems.

My analysis of the engine bug and a possible fix:

  • In xrGame\ai\monsters\controller\controller.cpp, we have:
void CController::net_Destroy()
{
	inherited::net_Destroy();

	m_aura->on_death	();
	FreeFromControl		();
}
  • CControllerAura::on_death() in xrGame\ai\monsters\controller\controller_psy_aura.cpp just calls m_effector->switch_off() and then nullifies pointer m_effector. But it doesn't actually terminate the looped controller roar sounds if they are playing when CController::net_Destroy() is called.

  • So I think the following modifications are required:

(1) Replace the m_aura->on_death() call in CController::net_Destroy() on xrGame\ai\monsters\controller\controller.cpp line 501 with:

m_aura->on_destroy();

(2) Add the following new public method declaration to class CControllerAura in xrGame\ai\monsters\controller\controller_psy_aura.h:

void on_destroy();

(3) Add the following new public method declaration to class CPPEffectorControllerAura in xrGame\ai\monsters\controller\controller_psy_aura.h:

void terminate();

(4) Add the following new method definitions to xrGame\ai\monsters\controller\controller_psy_aura.cpp:

void CPPEffectorControllerAura::terminate()
{
	if (m_snd_left._feedback()) m_snd_left.stop();
	if (m_snd_right._feedback()) m_snd_right.stop();
}
void CControllerAura::on_destroy()
{
	if (active()) {
		m_effector->terminate();
		m_effector = 0;
		m_hit_state = eNone;
	}
}

Decane avatar Mar 24 '19 19:03 Decane

I also wanted to mention that Shoker 1.9 has no fix either, the author just disabled the aura in engine and reimplemented it via scripts. He says that his implementation is not ideal and works wrong when there is a wall between the player and the controller.

SurDno avatar Mar 25 '19 14:03 SurDno