mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Fix segfault when calling P_RemoveMobj from MobjCollide hook
This commit is contained in:
parent
d7a84b967c
commit
ecf0c4b45a
1 changed files with 122 additions and 118 deletions
12
src/p_map.c
12
src/p_map.c
|
@ -4005,7 +4005,8 @@ void P_BounceMove(mobj_t *mo)
|
||||||
slidemo = mo;
|
slidemo = mo;
|
||||||
hitcount = 0;
|
hitcount = 0;
|
||||||
|
|
||||||
retry:
|
do
|
||||||
|
{
|
||||||
if (++hitcount == 3)
|
if (++hitcount == 3)
|
||||||
goto bounceback; // don't loop forever
|
goto bounceback; // don't loop forever
|
||||||
|
|
||||||
|
@ -4082,8 +4083,12 @@ bounceback:
|
||||||
newy = FixedMul(mmomy, bestslidefrac);
|
newy = FixedMul(mmomy, bestslidefrac);
|
||||||
|
|
||||||
if (!P_TryMove(mo, mo->x + newx, mo->y + newy, true))
|
if (!P_TryMove(mo, mo->x + newx, mo->y + newy, true))
|
||||||
|
{
|
||||||
|
if (P_MobjWasRemoved(mo))
|
||||||
|
return;
|
||||||
goto bounceback;
|
goto bounceback;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now continue along the wall.
|
// Now continue along the wall.
|
||||||
// First calculate remainder.
|
// First calculate remainder.
|
||||||
|
@ -4127,9 +4132,8 @@ bounceback:
|
||||||
mo->player->cmomx = tmxmove;
|
mo->player->cmomx = tmxmove;
|
||||||
mo->player->cmomy = tmymove;
|
mo->player->cmomy = tmymove;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true))
|
while (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true) && !P_MobjWasRemoved(mo));
|
||||||
goto retry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue