Skip to content

Commit 33f0521

Browse files
gunslingermodXottab-DUTY
authored andcommitted
[Bugfix] Crows fix
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.
1 parent f97093b commit 33f0521

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/xrGame/ai/crow/ai_crow.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ void CAI_Crow::init()
100100
fIdleSoundDelta = 10.f;
101101
fIdleSoundTime = fIdleSoundDelta;
102102
bPlayDeathIdle = false;
103+
o_workload_frame = 0;
104+
o_workload_rframe = 0;
103105
}
104106

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

146-
// disable UpdateCL, enable only on HIT
147-
processing_deactivate();
148+
o_workload_frame = 0;
149+
o_workload_rframe = 0;
150+
151+
if (GetfHealth() > 0)
152+
{
153+
st_current = eFlyIdle;
154+
st_target = eFlyIdle;
155+
// disable UpdateCL, enable only on HIT
156+
processing_deactivate();
157+
}
158+
else
159+
{
160+
st_current = eDeathFall;
161+
st_target = eDeathDead;
162+
// Crow is already dead, need to enable physics
163+
processing_activate();
164+
CreateSkeleton();
165+
}
166+
148167
VERIFY2(valid_pos(Position()), dbg_valide_pos_string(Position(), this, "CAI_Crow::net_Spawn"));
149168
return R;
150169
}

0 commit comments

Comments
 (0)