Fix mobj list iteration oversights.

Signed-off-by: Nev3r <apophycens@gmail.com>
This commit is contained in:
Nev3r 2019-04-21 12:58:22 +02:00
parent aad78d4985
commit 696ccbd943
9 changed files with 44 additions and 41 deletions

View File

@ -4228,12 +4228,12 @@ static INT16 Consistancy(void)
ret += P_GetRandSeed();
#ifdef MOBJCONSISTANCY
if (!thlist[THINK_MAIN].next)
if (!thlist[THINK_MOBJ].next)
{
DEBFILE(va("Consistancy = %u\n", ret));
return ret;
}
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;

View File

@ -4260,7 +4260,7 @@ static void Command_Archivetest_f(void)
// assign mobjnum
i = 1;
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
((mobj_t *)th)->mobjnum = i++;

View File

@ -1661,7 +1661,7 @@ void F_TitleScreenTicker(boolean run)
mobj_t *mo2;
mobj_t *cameraref = NULL;
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
continue;

View File

@ -2557,7 +2557,7 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo)
I_Assert((oldmo != NULL) && (newmo != NULL));
// scan all thinkers
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -4455,7 +4455,7 @@ void G_ConsGhostTic(void)
demo_p += sizeof(angle_t); // angle, unnecessary for cons.
mobj = NULL;
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -5851,7 +5851,7 @@ void G_DoPlayMetal(void)
metalbuffer = metal_p = W_CacheLumpNum(l, PU_STATIC);
// find metal sonic
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;

View File

@ -1335,7 +1335,7 @@ static void HWR_SearchLightsInMobjs(void)
//mobj_t * mobj;
// search in the list of thinkers
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
// a mobj ?
if (th->function.acp1 == (actionf_p1)P_MobjThinker)

View File

@ -420,9 +420,9 @@ void LUA_InvalidateLevel(void)
ffloor_t *rover = NULL;
if (!gL)
return;
for (th = thlist[THINK_MAIN].next; th && th != &thlist[THINK_MAIN]; th = th->next)
LUA_InvalidateUserdata(th);
for (i = 0; i < NUM_THINKERLISTS; i++)
for (th = thlist[i].next; th && th != &thlist[i]; th = th->next)
LUA_InvalidateUserdata(th);
LUA_InvalidateMapthings();
@ -1127,13 +1127,15 @@ void LUA_Archive(void)
ArchiveExtVars(&players[i], "player");
}
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
{
// archive function will determine when to skip mobjs,
// and write mobjnum in otherwise.
ArchiveExtVars(th, "mobj");
}
for (i = 0; i < NUM_THINKERLISTS; i++)
for (th = thlist[i].next; th != &thlist[i]; th = th->next)
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
{
// archive function will determine when to skip mobjs,
// and write mobjnum in otherwise.
ArchiveExtVars(th, "mobj");
}
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum.
LUAh_NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode
@ -1161,9 +1163,10 @@ void LUA_UnArchive(void)
do {
mobjnum = READUINT32(save_p); // read a mobjnum
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
if (th->function.acp1 == (actionf_p1)P_MobjThinker
&& ((mobj_t *)th)->mobjnum == mobjnum) // find matching mobj
for (i = 0; i < NUM_THINKERLISTS; i++)
for (th = thlist[i].next; th != &thlist[i]; th = th->next)
if (th->function.acp1 == (actionf_p1)P_MobjThinker
&& ((mobj_t *)th)->mobjnum == mobjnum) // find matching mobj
UnArchiveExtVars(th); // apply variables
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.

View File

@ -577,7 +577,7 @@ void Command_Teleport_f(void)
INT32 starpostmax = 0;
intz = starpostpath; // variable reuse - counting down for selection purposes
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -600,7 +600,7 @@ void Command_Teleport_f(void)
break;
}
if (th == &thlist[THINK_MAIN])
if (th == &thlist[THINK_MOBJ])
{
if (intz == starpostpath)
CONS_Alert(CONS_NOTICE, M_GetText("No starpost of position %d found (%d max).\n"), starpostnum, starpostmax);
@ -1069,7 +1069,7 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
thinker_t *th;
mobj_t *mo;
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;

View File

@ -97,7 +97,7 @@ void P_ClearStarPost(INT32 postnum)
mobj_t *mo2;
// scan the thinkers
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -126,7 +126,7 @@ void P_ResetStarposts(void)
thinker_t *th;
mobj_t *post;
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -807,7 +807,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
// The player might have two Ideyas: toucher->tracer and toucher->tracer->hnext
// so handle their anchorpoints accordingly.
// scan the thinkers to find the corresponding anchorpoint
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -901,7 +901,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
count = 1;
// scan the remaining thinkers
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -951,7 +951,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
// Now we RE-scan all the thinkers to find close objects to pull
// in from the paraloop. Isn't this just so efficient?
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -1325,7 +1325,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
EV_DoElevator(&junk, bridgeFall, false);
// scan the remaining thinkers to find koopa
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -1424,7 +1424,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
thinker_t *th;
mobj_t *mo2;
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -2461,7 +2461,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
// scan the thinkers to make sure all the old pinch dummies are gone on death
// this can happen if the boss was hurt earlier than expected
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;

View File

@ -713,7 +713,7 @@ void P_EmeraldManager(void)
spawnpoints[i] = NULL;
}
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
{
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
continue; // not a mobj thinker
@ -3699,7 +3699,7 @@ void P_DestroyRobots(void)
mobj_t *mo;
thinker_t *think;
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
{
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
continue; // not a mobj thinker
@ -4483,7 +4483,7 @@ static void P_Boss3Thinker(mobj_t *mobj)
// scan the thinkers to make sure all the old pinch dummies are gone before making new ones
// this can happen if the boss was hurt earlier than expected
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -4574,7 +4574,7 @@ static void P_Boss3Thinker(mobj_t *mobj)
// scan the thinkers
// to find a point that matches
// the number
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -5195,7 +5195,7 @@ static void P_Boss7Thinker(mobj_t *mobj)
closestdist = INT32_MAX; // Just in case...
// Find waypoint he is closest to
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -5250,7 +5250,7 @@ static void P_Boss7Thinker(mobj_t *mobj)
// scan the thinkers to find
// the waypoint to use
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -5382,7 +5382,7 @@ static void P_Boss9Thinker(mobj_t *mobj)
// Run through the thinkers ONCE and find all of the MT_BOSS9GATHERPOINT in the map.
// Build a hoop linked list of 'em!
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -5848,7 +5848,7 @@ mobj_t *P_GetClosestAxis(mobj_t *source)
fixed_t dist1, dist2 = 0;
// scan the thinkers to find the closest axis point
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
@ -11085,7 +11085,7 @@ ML_EFFECT4 : Don't clip inside the ground
mobj->health = (mthing->angle / 360) + 1;
// See if other starposts exist in this level that have the same value.
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;