Skip to content

Commit

Permalink
[Bugfix] Crows fix
Browse files Browse the repository at this point in the history
1) After crow's death (from actor's hit or blowout) it falls to ground. But after game save\load it 'resurrects'. The problem is that it flying in semi-dead state (health is 0, but state is Flying). When you hits it, Die() methot is not called (dead object can't die twice), so physics shell isn't created. Crow freezes  at the last point in the sky.
2) Because of unitualized members flight of crows could be incorrect in some conditions.
  • Loading branch information
gunslingermod authored and Xottab-DUTY committed Aug 14, 2017
1 parent f97093b commit 33f0521
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/xrGame/ai/crow/ai_crow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ void CAI_Crow::init()
fIdleSoundDelta = 10.f;
fIdleSoundTime = fIdleSoundDelta;
bPlayDeathIdle = false;
o_workload_frame = 0;
o_workload_rframe = 0;
}

void CAI_Crow::Load(LPCSTR section)
Expand Down Expand Up @@ -143,8 +145,25 @@ BOOL CAI_Crow::net_Spawn(CSE_Abstract* DC)
m_Anims.m_fly.Load(M, "fly_fwd");
m_Anims.m_idle.Load(M, "fly_idle");

// disable UpdateCL, enable only on HIT
processing_deactivate();
o_workload_frame = 0;
o_workload_rframe = 0;

if (GetfHealth() > 0)
{
st_current = eFlyIdle;
st_target = eFlyIdle;
// disable UpdateCL, enable only on HIT
processing_deactivate();
}
else
{
st_current = eDeathFall;
st_target = eDeathDead;
// Crow is already dead, need to enable physics
processing_activate();
CreateSkeleton();
}

VERIFY2(valid_pos(Position()), dbg_valide_pos_string(Position(), this, "CAI_Crow::net_Spawn"));
return R;
}
Expand Down

0 comments on commit 33f0521

Please sign in to comment.