mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Fix thinker being added twice to mobj
This commit is contained in:
parent
b808fde260
commit
493a7db1ee
1 changed files with 3 additions and 6 deletions
|
@ -10867,9 +10867,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
||||||
)))
|
)))
|
||||||
mobj->flags2 |= MF2_DONTRESPAWN;
|
mobj->flags2 |= MF2_DONTRESPAWN;
|
||||||
|
|
||||||
if (!(mobj->flags & MF_NOTHINK))
|
|
||||||
P_AddThinker(THINK_MOBJ, &mobj->thinker);
|
|
||||||
|
|
||||||
if (type == MT_PLAYER)
|
if (type == MT_PLAYER)
|
||||||
{
|
{
|
||||||
// when spawning MT_PLAYER, set mobj->player before calling MobjSpawn hook to prevent P_RemoveMobj from succeeding on player mobj.
|
// when spawning MT_PLAYER, set mobj->player before calling MobjSpawn hook to prevent P_RemoveMobj from succeeding on player mobj.
|
||||||
|
@ -10879,12 +10876,12 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...)
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// increment mobj reference, so we don't get a dangling reference in case MobjSpawn calls P_RemoveMobj
|
|
||||||
mobj->thinker.references++;
|
|
||||||
|
|
||||||
if (!(mobj->flags & MF_NOTHINK) || (titlemapinaction && mobj->type == MT_ALTVIEWMAN))
|
if (!(mobj->flags & MF_NOTHINK) || (titlemapinaction && mobj->type == MT_ALTVIEWMAN))
|
||||||
P_AddThinker(THINK_MOBJ, &mobj->thinker);
|
P_AddThinker(THINK_MOBJ, &mobj->thinker);
|
||||||
|
|
||||||
|
// increment mobj reference, so we don't get a dangling reference in case MobjSpawn calls P_RemoveMobj
|
||||||
|
mobj->thinker.references++;
|
||||||
|
|
||||||
// DANGER! This can cause P_SpawnMobj to return NULL!
|
// DANGER! This can cause P_SpawnMobj to return NULL!
|
||||||
// Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks!
|
// Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks!
|
||||||
status = LUA_HookMobj(mobj, MOBJ_HOOK(MobjSpawn));
|
status = LUA_HookMobj(mobj, MOBJ_HOOK(MobjSpawn));
|
||||||
|
|
Loading…
Reference in a new issue