mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 05:30:48 +00:00
Merge branch 'fix-mobjcollide-removemobj-segfault' into 'next'
Fix segfault when calling P_RemoveMobj from MobjCollide hook See merge request STJr/SRB2!2041
This commit is contained in:
commit
99c95e2d7a
1 changed files with 122 additions and 118 deletions
12
src/p_map.c
12
src/p_map.c
|
@ -4009,7 +4009,8 @@ void P_BounceMove(mobj_t *mo)
|
|||
slidemo = mo;
|
||||
hitcount = 0;
|
||||
|
||||
retry:
|
||||
do
|
||||
{
|
||||
if (++hitcount == 3)
|
||||
goto bounceback; // don't loop forever
|
||||
|
||||
|
@ -4086,8 +4087,12 @@ bounceback:
|
|||
newy = FixedMul(mmomy, bestslidefrac);
|
||||
|
||||
if (!P_TryMove(mo, mo->x + newx, mo->y + newy, true))
|
||||
{
|
||||
if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
goto bounceback;
|
||||
}
|
||||
}
|
||||
|
||||
// Now continue along the wall.
|
||||
// First calculate remainder.
|
||||
|
@ -4131,9 +4136,8 @@ bounceback:
|
|||
mo->player->cmomx = tmxmove;
|
||||
mo->player->cmomy = tmymove;
|
||||
}
|
||||
|
||||
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true))
|
||||
goto retry;
|
||||
}
|
||||
while (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true) && !P_MobjWasRemoved(mo));
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue