throw mobjcache allocation shit into a inline function

This commit is contained in:
Alug committed 2025-04-12 19:42:31 +02:00
1 parent fb15cfe9f0
commit fa757c6695
1 file changed
+16 -16
+16 -16
View File
@@ -9386,13 +9386,8 @@ void P_SceneryThinker(mobj_t *mobj)
// GAME SPAWN FUNCTIONS
//
//
// P_SpawnMobj
//
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
FUNCINLINE static ATTRINLINE mobj_t *P_AllocMobj(void)
{
const mobjinfo_t *info = &mobjinfo[type];
state_t *st;
mobj_t *mobj;
if (mobjcache != NULL)
@@ -9406,6 +9401,20 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL);
}
return mobj;
}
//
// P_SpawnMobj
//
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
{
const mobjinfo_t *info = &mobjinfo[type];
state_t *st;
mobj_t *mobj;
mobj = P_AllocMobj();
// this is officially a mobj, declared as soon as possible.
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker;
mobj->type = type;
@@ -9870,16 +9879,7 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster)
state_t *st;
mobj_t *mobj;
if (mobjcache != NULL)
{
mobj = mobjcache;
mobjcache = mobjcache->hnext;
memset(mobj, 0, sizeof(*mobj));
}
else
{
mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL);
}
mobj = P_AllocMobj();
// this is officially a mobj, declared as soon as possible.
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker;