mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-23 03:12:38 +00:00
Fix segfault when P_RemoveMobj is called within A_FaceTarget action
This commit is contained in:
parent
e5a1fee759
commit
901c7362ed
1 changed files with 57 additions and 0 deletions
|
@ -1571,6 +1571,8 @@ void A_PointyThink(mobj_t *actor)
|
|||
// Okay, we found the closest player. Let's move based on his movement.
|
||||
P_SetTarget(&actor->target, player->mo);
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
if (P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y) < P_AproxDistance(player->mo->x + player->mo->momx - actor->x, player->mo->y + player->mo->momy - actor->y))
|
||||
sign = -1; // Player is moving away
|
||||
|
@ -1686,6 +1688,8 @@ void A_HoodFire(mobj_t *actor)
|
|||
}
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
if (!(arrow = P_SpawnMissile(actor, actor->target, (mobjtype_t)locvar1)))
|
||||
return;
|
||||
|
@ -2266,6 +2270,8 @@ void A_VultureVtol(mobj_t *actor)
|
|||
actor->flags |= MF_FLOAT;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
S_StopSound(actor);
|
||||
|
||||
|
@ -2364,6 +2370,9 @@ void A_VultureHover(mobj_t *actor)
|
|||
P_VultureHoverParticle(actor);
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
targetz = actor->target->z + actor->target->height / 2;
|
||||
for (i = -1; i <= 1; i++)
|
||||
{
|
||||
|
@ -2680,6 +2689,8 @@ void A_LobShot(mobj_t *actor)
|
|||
return;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
|
@ -2775,6 +2786,8 @@ void A_FireShot(mobj_t *actor)
|
|||
return;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
z = actor->z + actor->height - FixedMul(48*FRACUNIT + locvar2*FRACUNIT, actor->scale);
|
||||
|
@ -2813,6 +2826,8 @@ void A_SuperFireShot(mobj_t *actor)
|
|||
return;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
z = actor->z + actor->height - FixedMul(48*FRACUNIT + locvar2*FRACUNIT, actor->scale);
|
||||
|
@ -2860,6 +2875,8 @@ void A_BossFireShot(mobj_t *actor)
|
|||
return;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
switch (locvar2)
|
||||
{
|
||||
|
@ -2947,6 +2964,8 @@ void A_Boss7FireMissiles(mobj_t *actor)
|
|||
}
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
S_StartSound(NULL, locvar2);
|
||||
|
||||
|
@ -3331,6 +3350,8 @@ void A_SkullAttack(mobj_t *actor)
|
|||
if (actor->info->activesound)
|
||||
S_StartSound(actor, actor->info->activesound);
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
dist = P_AproxDistance(dest->x - actor->x, dest->y - actor->y);
|
||||
|
||||
|
@ -3442,6 +3463,9 @@ void A_BossZoom(mobj_t *actor)
|
|||
if (actor->info->attacksound)
|
||||
S_StartAttackSound(actor, actor->info->attacksound);
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
an = actor->angle >> ANGLETOFINESHIFT;
|
||||
actor->momx = FixedMul(FixedMul(actor->info->speed*5*FRACUNIT, actor->scale), FINECOSINE(an));
|
||||
actor->momy = FixedMul(FixedMul(actor->info->speed*5*FRACUNIT, actor->scale), FINESINE(an));
|
||||
|
@ -5539,6 +5563,9 @@ void A_JetgShoot(mobj_t *actor)
|
|||
return;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
P_SpawnMissile(actor, actor->target, (mobjtype_t)actor->info->raisestate);
|
||||
|
||||
if (ultimatemode)
|
||||
|
@ -5573,6 +5600,9 @@ void A_ShootBullet(mobj_t *actor)
|
|||
return;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
P_SpawnMissile(actor, actor->target, (mobjtype_t)actor->info->raisestate);
|
||||
|
||||
if (actor->info->attacksound)
|
||||
|
@ -7431,6 +7461,8 @@ void A_Boss7Chase(mobj_t *actor)
|
|||
&& (actor->target->player->powers[pw_carry] == CR_GENERIC))
|
||||
{
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
P_SetMobjState(actor, S_BLACKEGG_SHOOT1);
|
||||
actor->movecount = TICRATE + P_RandomByte()/2;
|
||||
return;
|
||||
|
@ -7448,6 +7480,8 @@ void A_Boss7Chase(mobj_t *actor)
|
|||
if (actor->z < 1056*FRACUNIT)
|
||||
{
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
P_SetMobjState(actor, actor->info->xdeathstate);
|
||||
actor->movecount = 7*TICRATE + P_RandomByte();
|
||||
break;
|
||||
|
@ -7456,6 +7490,8 @@ void A_Boss7Chase(mobj_t *actor)
|
|||
/* FALLTHRU */
|
||||
case 1: // Chaingun Goop
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
P_SetMobjState(actor, S_BLACKEGG_SHOOT1);
|
||||
|
||||
if (actor->health > actor->info->damage)
|
||||
|
@ -7465,6 +7501,8 @@ void A_Boss7Chase(mobj_t *actor)
|
|||
break;
|
||||
case 2: // Homing Missile
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
P_SetMobjState(actor, actor->info->missilestate);
|
||||
S_StartSound(0, sfx_beflap);
|
||||
break;
|
||||
|
@ -8182,6 +8220,9 @@ void A_Boss3Path(mobj_t *actor)
|
|||
P_SetTarget(&actor->target, actor->tracer->target);
|
||||
var1 = 0, var2 = 0;
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
if (actor->tracer->state == &states[actor->tracer->info->missilestate])
|
||||
P_SetMobjState(actor, actor->info->missilestate);
|
||||
return;
|
||||
|
@ -9856,6 +9897,8 @@ void A_SplitShot(mobj_t *actor)
|
|||
return;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
{
|
||||
const angle_t an = (actor->angle + ANGLE_90) >> ANGLETOFINESHIFT;
|
||||
const fixed_t fasin = FINESINE(an);
|
||||
|
@ -9920,6 +9963,9 @@ void A_MultiShot(mobj_t *actor)
|
|||
if (actor->target)
|
||||
A_FaceTarget(actor);
|
||||
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
if(loc1lw > 90)
|
||||
ad = FixedMul(90*FRACUNIT, actor->scale);
|
||||
else
|
||||
|
@ -11064,6 +11110,8 @@ void A_VileTarget(mobj_t *actor)
|
|||
return;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
// Determine object to spawn
|
||||
if (locvar1 <= 0 || locvar1 >= NUMMOBJTYPES)
|
||||
|
@ -11151,6 +11199,8 @@ void A_VileAttack(mobj_t *actor)
|
|||
return;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
if (locvar1 <= 0 || locvar1 >= NUMSFX)
|
||||
soundtoplay = sfx_brakrx;
|
||||
|
@ -11469,6 +11519,8 @@ void A_BrakFireShot(mobj_t *actor)
|
|||
return;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
x = actor->x
|
||||
+ P_ReturnThrustX(actor, actor->angle, FixedMul(64*FRACUNIT, actor->scale))
|
||||
|
@ -11586,6 +11638,9 @@ void A_BrakLobShot(mobj_t *actor)
|
|||
|
||||
// Okay, complicated math done. Let's fire our object already, sheesh.
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
if (locvar1 <= 0 || locvar1 >= NUMMOBJTYPES)
|
||||
typeOfShot = MT_CANNONBALL;
|
||||
else typeOfShot = (mobjtype_t)locvar1;
|
||||
|
@ -12670,6 +12725,8 @@ void A_WhoCaresIfYourSonIsABee(mobj_t *actor)
|
|||
return;
|
||||
|
||||
A_FaceTarget(actor);
|
||||
if (P_MobjWasRemoved(actor))
|
||||
return;
|
||||
|
||||
if (actor->extravalue1)
|
||||
actor->extravalue1--;
|
||||
|
|
Loading…
Reference in a new issue