seperate thinkerlist for precip

i sure hope i handled everything right lmao
This commit is contained in:
Alug committed 2024-12-12 02:32:07 +01:00
1 parent ebbedc558d
commit 2c94ae8bb4
7 files changed
+68 -20

No files matched your search

+10 -4
View File
@@ -577,8 +577,7 @@ static void PS_CountThinkers(void)
ps_removecount.value.i = 0;
for (thinker = thinkercap.next; thinker != &thinkercap; thinker = thinker->next)
{
if (thinker->function.acp1 != (actionf_p1)P_NullPrecipThinker)
ps_thinkercount.value.i++;
ps_thinkercount.value.i++;
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
ps_removecount.value.i++;
@@ -593,11 +592,18 @@ static void PS_CountThinkers(void)
else
ps_regularcount.value.i++;
}
else if (thinker->function.acp1 == (actionf_p1)P_NullPrecipThinker)
ps_precipcount.value.i++;
else
ps_otherthcount.value.i++;
}
for (thinker = precipcap.next; thinker != &precipcap; thinker = thinker->next)
{
if (thinker->function.acp1 != (actionf_p1)P_NullPrecipThinker)
continue; // not a precipmobj thinker
ps_precipcount.value.i++;
}
/*for (i = 0; i < NUM_THINKERLISTS; i++)
{
for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next)
+2
View File
@@ -63,10 +63,12 @@
// both the head and tail of the thinker list
extern thinker_t thinkercap;
extern thinker_t precipcap;
extern mobj_t *mobjcache;
void P_InitThinkers(void);
void P_AddThinker(thinker_t *thinker);
void P_AddPrecipThinker(thinker_t *thinker);
void P_RemoveThinker(thinker_t *thinker);
void P_UnlinkThinker(thinker_t *thinker);
+1 -1
View File
@@ -9982,7 +9982,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
mobj->momz = cv_mobjscaleprecip.value ? FixedMul(info->speed, mapobjectscale) : info->speed;
mobj->thinker.function.acp1 = (actionf_p1)P_NullPrecipThinker;
P_AddThinker(&mobj->thinker);
P_AddPrecipThinker(&mobj->thinker);
CalculatePrecipFloor(mobj);
+17 -6
View File
@@ -1680,8 +1680,7 @@ static void P_NetArchiveThinkers(savebuffer_t *save)
// save off the current thinkers
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (!(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed
|| th->function.acp1 == (actionf_p1)P_NullPrecipThinker))
if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed)
numsaved++;
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
@@ -1689,9 +1688,6 @@ static void P_NetArchiveThinkers(savebuffer_t *save)
SaveMobjThinker(save, th, tc_mobj);
continue;
}
#ifdef PARANOIA
else if (th->function.acp1 == (actionf_p1)P_NullPrecipThinker);
#endif
else if (th->function.acp1 == (actionf_p1)T_MoveCeiling)
{
SaveCeilingThinker(save, th, tc_ceiling);
@@ -2685,7 +2681,22 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
{
next = currentthinker->next;
if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker || currentthinker->function.acp1 == (actionf_p1)P_NullPrecipThinker)
if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker)
P_RemoveSavegameMobj((mobj_t *)currentthinker); // item isn't saved, don't remove it
else
{
(next->prev = currentthinker->prev)->next = next;
R_DestroyLevelInterpolators(currentthinker);
Z_Free(currentthinker);
}
}
currentthinker = precipcap.next;
for (currentthinker = precipcap.next; currentthinker != &precipcap; currentthinker = next)
{
next = currentthinker->next;
if (currentthinker->function.acp1 == (actionf_p1)P_NullPrecipThinker)
P_RemoveSavegameMobj((mobj_t *)currentthinker); // item isn't saved, don't remove it
else
{
+2 -2
View File
@@ -1783,7 +1783,7 @@ void P_SwitchWeather(INT32 weathernum)
thinker_t *next;
precipmobj_t *precipmobj;
for (think = thinkercap.next; think != &thinkercap; think = next)
for (think = precipcap.next; think != &precipcap; think = next)
{
next = think->next;
@@ -1800,7 +1800,7 @@ void P_SwitchWeather(INT32 weathernum)
precipmobj_t *precipmobj;
state_t *st;
for (think = thinkercap.next; think != &thinkercap; think = think->next)
for (think = precipcap.next; think != &precipcap; think = think->next)
{
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
continue; // not a precipmobj thinker
+35 -6
View File
@@ -49,6 +49,7 @@ tic_t leveltime;
// Both the head and tail of the thinker list.
thinker_t thinkercap;
thinker_t precipcap;
void Command_Numthinkers_f(void)
{
@@ -104,12 +105,25 @@ void Command_Numthinkers_f(void)
return;
}
for (think = thinkercap.next; think != &thinkercap; think = think->next)
if (num == 2) // P_NullPrecipThinker
{
if (think->function.acp1 != action)
continue;
for (think = precipcap.next; think != &precipcap; think = think->next)
{
if (think->function.acp1 != action)
continue;
count++;
count++;
}
}
else
{
for (think = thinkercap.next; think != &thinkercap; think = think->next)
{
if (think->function.acp1 != action)
continue;
count++;
}
}
CONS_Printf("%d\n", count);
@@ -181,6 +195,7 @@ void Command_CountMobjs_f(void)
void P_InitThinkers(void)
{
thinkercap.prev = thinkercap.next = &thinkercap;
precipcap.prev = precipcap.next = &precipcap;
waypointcap = NULL;
}
@@ -200,6 +215,22 @@ void P_AddThinker(thinker_t *thinker)
thinker->cachable = (thinker->function.acp1 == (actionf_p1)P_MobjThinker);
}
//
// P_AddPrecipThinker
// Adds a new precip thinker at the end of the list.
//
void P_AddPrecipThinker(thinker_t *thinker)
{
precipcap.prev->next = thinker;
thinker->next = &precipcap;
thinker->prev = precipcap.prev;
precipcap.prev = thinker;
thinker->references = 0; // killough 11/98: init reference counter to 0
thinker->cachable = false;
}
//
// killough 11/98:
//
@@ -341,8 +372,6 @@ static inline void P_RunThinkers(void)
{
for (currentthinker = thinkercap.next; currentthinker != &thinkercap; currentthinker = currentthinker->next)
{
if (currentthinker->function.acp1 == (actionf_p1)P_NullPrecipThinker)
continue;
#ifdef PARANOIA
I_Assert(currentthinker->function.acp1 != NULL)
#endif
+1 -1
View File
@@ -310,7 +310,7 @@ static void Precipstuff_OnChange(void)
thinker_t *next;
precipmobj_t *precipmobj;
for (think = thinkercap.next; think != &thinkercap; think = next)
for (think = precipcap.next; think != &precipcap; think = next)
{
next = think->next;