move sprite reset stuff into R_ResetMobjInterpolationState

this also gets called at the start of the tic
and sets a bunch of rendering crap eitherways
so we can save another thinker loop and a bunch of checks with this
bit of perf gain, 3-4fps on that awful hadal trench timedemo
This commit is contained in:
Alug committed 2025-08-19 11:49:29 +02:00
1 parent 684a43a95c
commit 145eecf8a4
3 files changed
+17 -36

No files matched your search

+4 -2
View File
@@ -9854,7 +9854,6 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster)
mobj->radius = info->radius;
mobj->height = info->height;
mobj->flags = info->flags;
mobj->blendmode = AST_TRANSLUCENT;
mobj->health = info->spawnhealth;
@@ -9890,7 +9889,10 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster)
}
// Sprite rendering
mobj->spritexscale = mobj->spriteyscale = mobj->scale;
mobj->blendmode = AST_TRANSLUCENT;
mobj->realxscale = mobj->realyscale = mobj->scale;
mobj->spritexscale = mobj->realxscale;
mobj->spriteyscale = mobj->realyscale;
// set subsector and/or block links
P_SetThingPosition(mobj);
-34
View File
@@ -614,38 +614,6 @@ static void P_RunQuakes(void)
--quake.time;
}
// Reset our Sprite scales and offsets
// at the start of our tic
// this is just to make things simpler
// as we dont have to reset it ourselves after use
// done at the start so lua can still overwrite everything
static inline void P_ResetSpriteStuff(void)
{
thinker_t *th;
if (rendermode == render_none)
return;
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
mobj_t *mo;
if (th->function != (actionf_p1)P_MobjThinker) // not a mobj
continue;
mo = (mobj_t *)th;
if (!mo || (mo->sprite == SPR_NULL)
|| (mo->flags2 & MF2_DONTDRAW) || (mo->type == MT_SHADOW))
continue;
mo->spritexscale = mo->realxscale;
mo->spriteyscale = mo->realyscale;
mo->spritexoffset = mo->realxoffset;
mo->spriteyoffset = mo->realyoffset;
}
}
//
// P_Ticker
//
@@ -747,8 +715,6 @@ void P_Ticker(boolean run)
ps_lua_mobjhooks.value.i = 0;
ps_checkposition_calls.value.i = 0;
P_ResetSpriteStuff();
PS_START_TIMING(ps_lua_prethinkframe_time);
LUA_HookPreThinkFrame();
PS_STOP_TIMING(ps_lua_prethinkframe_time);
+13
View File
@@ -860,6 +860,19 @@ void R_ResetMobjInterpolationState(mobj_t *mobj)
mobj->player->old_frameangle = mobj->player->frameangle;
}
// Reset our Sprite scales and offsets
// at the start of the tic
// this is just to make things simpler
// as we dont have to reset it ourselves after use
// done at the start so lua can still overwrite everything
// technically not interpolation related
// but this saves us another thinkerloop and multiple checks lel
mobj->spritexscale = mobj->realxscale;
mobj->spriteyscale = mobj->realyscale;
mobj->spritexoffset = mobj->realxoffset;
mobj->spriteyoffset = mobj->realyoffset;
mobj->resetinterp = false;
}