some cleanup
This commit is contained in:
1 parent
7e895f82b2
commit
332135fc6f
8 files changed
+79
-71
No files matched your search
+24
-13
@@ -50,14 +50,17 @@ ps_metric_t ps_tictime = {0};
|
||||
ps_metric_t ps_playerthink_time = {0};
|
||||
ps_metric_t ps_thinkertime = {0};
|
||||
|
||||
//ps_metric_t ps_thlist_times[NUM_THINKERLISTS];
|
||||
ps_metric_t ps_thlist_times[NUM_THINKERLISTS];
|
||||
|
||||
static ps_metric_t ps_thinkercount = {0};
|
||||
static ps_metric_t ps_polythcount = {0};
|
||||
static ps_metric_t ps_mainthcount = {0};
|
||||
static ps_metric_t ps_mobjcount = {0};
|
||||
static ps_metric_t ps_regularcount = {0};
|
||||
static ps_metric_t ps_scenerycount = {0};
|
||||
static ps_metric_t ps_nothinkcount = {0};
|
||||
static ps_metric_t ps_otherthcount = {0};
|
||||
//static ps_metric_t ps_otherthcount = {0};
|
||||
//static ps_metric_t ps_dynslopethcount = {0};
|
||||
static ps_metric_t ps_precipcount = {0};
|
||||
static ps_metric_t ps_removecount = {0};
|
||||
|
||||
@@ -154,11 +157,11 @@ perfstatrow_t gamelogic_rows[] = {
|
||||
{"logic ", "Game logic: ", &ps_tictime, PS_TIME},
|
||||
{" plrthnk", " P_PlayerThink: ", &ps_playerthink_time, PS_TIME|PS_LEVEL},
|
||||
{" thnkers", " P_RunThinkers: ", &ps_thinkertime, PS_TIME|PS_LEVEL},
|
||||
/* {" plyobjs", " Polyobjects: ", &ps_thlist_times[THINK_POLYOBJ], PS_TIME|PS_LEVEL},
|
||||
{" plyobjs", " Polyobjects: ", &ps_thlist_times[THINK_POLYOBJ], PS_TIME|PS_LEVEL},
|
||||
{" main ", " Main: ", &ps_thlist_times[THINK_MAIN], PS_TIME|PS_LEVEL},
|
||||
{" mobjs ", " Mobjs: ", &ps_thlist_times[THINK_MOBJ], PS_TIME|PS_LEVEL},
|
||||
{" dynslop", " Dynamic slopes: ", &ps_thlist_times[THINK_DYNSLOPE], PS_TIME|PS_LEVEL},
|
||||
{" precip ", " Precipitation: ", &ps_thlist_times[THINK_PRECIP], PS_TIME|PS_LEVEL},*/
|
||||
//{" dynslop", " Dynamic slopes: ", &ps_thlist_times[THINK_DYNSLOPE], PS_TIME|PS_LEVEL},
|
||||
{" precip ", " Precipitation: ", &ps_thlist_times[THINK_PRECIP], PS_TIME|PS_LEVEL},
|
||||
{" lprethinkf", " LUAh_PreThinkFrame:", &ps_lua_prethinkframe_time, PS_TIME|PS_LEVEL},
|
||||
{" lthinkf", " LUAh_ThinkFrame:", &ps_lua_thinkframe_time, PS_TIME|PS_LEVEL},
|
||||
{" lpostthinkf", " LUAh_PostThinkFrame:", &ps_lua_postthinkframe_time, PS_TIME|PS_LEVEL},
|
||||
@@ -168,11 +171,14 @@ perfstatrow_t gamelogic_rows[] = {
|
||||
|
||||
perfstatrow_t thinkercount_rows[] = {
|
||||
{"thnkers", "Thinkers: ", &ps_thinkercount, PS_LEVEL},
|
||||
{" plyobjs", " Polyobjects: ", &ps_polythcount, PS_LEVEL},
|
||||
{" main ", " Main: ", &ps_mainthcount, PS_LEVEL},
|
||||
{" mobjs ", " Mobjs: ", &ps_mobjcount, PS_LEVEL},
|
||||
{" regular", " Regular: ", &ps_regularcount, PS_LEVEL},
|
||||
{" scenery", " Scenery: ", &ps_scenerycount, PS_LEVEL},
|
||||
{" nothink", " Nothink: ", &ps_nothinkcount, PS_HIDE_ZERO|PS_LEVEL},
|
||||
{" other ", " Other: ", &ps_otherthcount, PS_LEVEL},
|
||||
//{" dynslop", " Dynamic slopes: ", &ps_dynslopethcount, PS_LEVEL},
|
||||
//{" other ", " Other: ", &ps_otherthcount, PS_LEVEL},
|
||||
{" precip ", " Precipitation: ", &ps_precipcount, PS_LEVEL},
|
||||
{" remove ", " Pending removal:", &ps_removecount, PS_LEVEL},
|
||||
{0}
|
||||
@@ -567,14 +573,18 @@ static void PS_CountThinkers(void)
|
||||
thinker_t *thinker;
|
||||
|
||||
ps_thinkercount.value.i = 0;
|
||||
ps_polythcount.value.i = 0;
|
||||
ps_mainthcount.value.i = 0;
|
||||
ps_mobjcount.value.i = 0;
|
||||
ps_regularcount.value.i = 0;
|
||||
ps_scenerycount.value.i = 0;
|
||||
ps_nothinkcount.value.i = 0;
|
||||
ps_otherthcount.value.i = 0;
|
||||
//ps_otherthcount.value.i = 0;
|
||||
//ps_dynslopethcount.value.i = 0;
|
||||
ps_precipcount.value.i = 0;
|
||||
ps_removecount.value.i = 0;
|
||||
for (thinker = thlist[THINK_MAIN].next; thinker != &thlist[THINK_MAIN]; thinker = thinker->next)
|
||||
|
||||
/*for (thinker = thlist[THINK_MAIN].next; thinker != &thlist[THINK_MAIN]; thinker = thinker->next)
|
||||
{
|
||||
ps_thinkercount.value.i++;
|
||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
@@ -594,8 +604,9 @@ static void PS_CountThinkers(void)
|
||||
ps_precipcount.value.i++;
|
||||
else
|
||||
ps_otherthcount.value.i++;
|
||||
}
|
||||
/*for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
}*/
|
||||
|
||||
for (int i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next)
|
||||
{
|
||||
@@ -620,12 +631,12 @@ static void PS_CountThinkers(void)
|
||||
ps_regularcount.value.i++;
|
||||
}
|
||||
}
|
||||
else if (i == THINK_DYNSLOPE)
|
||||
ps_dynslopethcount.value.i++;
|
||||
//else if (i == THINK_DYNSLOPE)
|
||||
//ps_dynslopethcount.value.i++;
|
||||
else if (i == THINK_PRECIP)
|
||||
ps_precipcount.value.i++;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
// Update all metrics that are calculated on every tick.
|
||||
|
||||
+7
-3
@@ -2417,6 +2417,7 @@ void A_1upThinker(mobj_t *actor)
|
||||
|
||||
if (closestplayer == -1 || skins[players[closestplayer].skin].spritedef.numframes <= states[S_PLAY_BOX1].frame)
|
||||
{ // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite.
|
||||
actor->frame = 0;
|
||||
if (actor->tracer)
|
||||
{
|
||||
mobj_t *tracer = actor->tracer;
|
||||
@@ -2636,7 +2637,10 @@ void A_BossDeath(mobj_t *mo)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2 != mo && (mo2->flags & MF_BOSS) && mo2->health > 0)
|
||||
if (mo2 == mo)
|
||||
continue;
|
||||
|
||||
if ((mo2->flags & MF_BOSS) && mo2->health > 0)
|
||||
goto bossjustdie; // other boss not dead - just go straight to dying!
|
||||
}
|
||||
|
||||
@@ -2691,7 +2695,7 @@ bossjustdie:
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
@@ -6866,7 +6870,7 @@ void A_Boss3Path(mobj_t *actor)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
|
||||
+14
-11
@@ -1211,11 +1211,12 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_KOOPA)
|
||||
{
|
||||
mo2->momz = 5*FRACUNIT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mo2->type != MT_KOOPA)
|
||||
continue;
|
||||
|
||||
mo2->momz = 5*FRACUNIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2369,12 +2370,14 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type == (mobjtype_t)target->info->mass && mo->tracer == target)
|
||||
{
|
||||
P_RemoveMobj(mo);
|
||||
i++;
|
||||
}
|
||||
if (i == 2) // we've already removed 2 of these, let's stop now
|
||||
if (mo->type != (mobjtype_t)target->info->mass)
|
||||
continue;
|
||||
if (mo->tracer != target)
|
||||
continue;
|
||||
|
||||
P_RemoveMobj(mo);
|
||||
|
||||
if (++i == 2) // we've already removed 2 of these, let's stop now
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+16
-9
@@ -3706,16 +3706,23 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
||||
continue;
|
||||
|
||||
crumbler = (elevator_t *)think;
|
||||
|
||||
if (!crumbler->player)
|
||||
continue;
|
||||
if (!crumbler->player->mo)
|
||||
continue;
|
||||
if (crumbler->player->mo == thing)
|
||||
continue;
|
||||
if (crumbler->actionsector != thing->subsector->sector)
|
||||
continue;
|
||||
if (crumbler->sector != rover->master->frontsector)
|
||||
continue;
|
||||
if (crumbler->type != elevateBounce)
|
||||
continue;
|
||||
if (crumbler->type != elevateContinuous)
|
||||
continue;
|
||||
|
||||
if (crumbler->player && crumbler->player->mo
|
||||
&& crumbler->player->mo != thing
|
||||
&& crumbler->actionsector == thing->subsector->sector
|
||||
&& crumbler->sector == rover->master->frontsector
|
||||
&& (crumbler->type == elevateBounce
|
||||
|| crumbler->type == elevateContinuous))
|
||||
{
|
||||
killer = crumbler->player->mo;
|
||||
}
|
||||
killer = crumbler->player->mo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4119,8 +4119,6 @@ static void P_Boss3Thinker(mobj_t *mobj)
|
||||
continue;
|
||||
if (mo2->spawnpoint->angle != mobj->threshold)
|
||||
continue;
|
||||
if (mo2->spawnpoint->extrainfo != mobj->cusval)
|
||||
continue;
|
||||
|
||||
P_SetTarget(&mobj->tracer, mo2);
|
||||
break;
|
||||
|
||||
+8
-2
@@ -3759,11 +3759,17 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
// The chimps are my friends.. heeheeheheehehee..... - LouisJM
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (!mo2)
|
||||
continue;
|
||||
|
||||
if (mo2->type != MT_EGGTRAP)
|
||||
continue;
|
||||
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
P_KillMobj(mo2, NULL, player->mo);
|
||||
}
|
||||
|
||||
|
||||
+8
-30
@@ -237,32 +237,7 @@ void P_RemoveThinkerDelayed(thinker_t *thinker)
|
||||
thinker_t *next;
|
||||
|
||||
if (thinker->references != 0)
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
if (thinker->debug_time > leveltime)
|
||||
{
|
||||
thinker->debug_time = leveltime + 2; // do not print errors again
|
||||
}
|
||||
// Removed mobjs can be the target of another mobj. In
|
||||
// that case, the other mobj will manage its reference
|
||||
// to the removed mobj in P_MobjThinker. However, if
|
||||
// the removed mobj is removed after the other object
|
||||
// thinks, the reference management is delayed by one
|
||||
// tic.
|
||||
else if (thinker->debug_time < leveltime)
|
||||
{
|
||||
CONS_Printf(
|
||||
"PARANOIA/P_RemoveThinkerDelayed: %p %s references=%d\n",
|
||||
(void*)thinker,
|
||||
MobjTypeName((mobj_t*)thinker),
|
||||
thinker->references
|
||||
);
|
||||
|
||||
thinker->debug_time = leveltime + 2; // do not print this error again
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/* Remove from main thinker list */
|
||||
next = thinker->next;
|
||||
@@ -283,7 +258,6 @@ void P_RemoveThinkerDelayed(thinker_t *thinker)
|
||||
{
|
||||
Z_Free(thinker);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@@ -318,13 +292,18 @@ void P_RemoveThinker(thinker_t *thinker)
|
||||
|
||||
mobj_t *P_SetTarget(mobj_t **mop, mobj_t *targ)
|
||||
{
|
||||
if (*mop) // If there was a target already, decrease its refcount
|
||||
if (*mop) // If there was a target already, decrease its refcount
|
||||
(*mop)->thinker.references--;
|
||||
if ((*mop = targ) != NULL) // Set new target and if non-NULL, increase its counter
|
||||
targ->thinker.references++;
|
||||
|
||||
if (targ != NULL) // Set new target and if non-NULL, increase its counter
|
||||
targ->thinker.references++;
|
||||
|
||||
*mop = targ;
|
||||
|
||||
return targ;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_RunThinkers
|
||||
//
|
||||
@@ -360,7 +339,6 @@ static inline void P_RunThinkers(void)
|
||||
currentthinker->function.acp1(currentthinker);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+2
-1
@@ -1771,7 +1771,8 @@ void R_PrecacheLevel(void)
|
||||
if (spritepresent == NULL) I_Error("%s: Out of memory looking up sprites", "R_PrecacheLevel");
|
||||
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
spritepresent[((mobj_t *)th)->sprite] = 1;
|
||||
if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed)
|
||||
spritepresent[((mobj_t *)th)->sprite] = 1;
|
||||
|
||||
spritememory = 0;
|
||||
for (i = 0; i < numsprites; i++)
|
||||
|
||||
Reference in new issue
Block a user