mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Init mobj references before mobj specific spawning in P_SpawnMobj
Fixes MT_MONITOR leaking references due to Obj_MonitorSpawnParts called before P_AddThinker. Thanks to toaster
This commit is contained in:
parent
d0719ef5ba
commit
a396ffe676
1 changed files with 3 additions and 3 deletions
|
|
@ -10464,6 +10464,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
// Set shadowscale here, before spawn hook so that Lua can change it
|
||||
P_DefaultMobjShadowScale(mobj);
|
||||
|
||||
if (!(mobj->flags & MF_NOTHINK))
|
||||
P_AddThinker(THINK_MOBJ, &mobj->thinker);
|
||||
|
||||
// DANGER! This can cause P_SpawnMobj to return NULL!
|
||||
// Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks!
|
||||
if (LUA_HookMobj(mobj, MOBJ_HOOK(MobjSpawn)))
|
||||
|
|
@ -10926,9 +10929,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(mobj->flags & MF_NOTHINK))
|
||||
P_AddThinker(THINK_MOBJ, &mobj->thinker);
|
||||
|
||||
if (mobj->skin) // correct inadequecies above.
|
||||
{
|
||||
mobj->sprite2 = P_GetSkinSprite2(mobj->skin, (mobj->frame & FF_FRAMEMASK), NULL);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue