mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 13:40:45 +00:00
Merge branch 'thinkerlists-fix' into 'master'
Thinkerlists fix Closes #161 See merge request STJr/SRB2Internal!253
This commit is contained in:
commit
d30af084d7
26 changed files with 797 additions and 472 deletions
|
@ -4270,13 +4270,11 @@ static INT16 Consistancy(void)
|
|||
ret += P_GetRandSeed();
|
||||
|
||||
#ifdef MOBJCONSISTANCY
|
||||
if (!thlist[THINK_MOBJ].next)
|
||||
{
|
||||
DEBFILE(va("Consistancy = %u\n", ret));
|
||||
return ret;
|
||||
}
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
|
||||
if (mo->flags & (MF_SPECIAL | MF_SOLID | MF_PUSHABLE | MF_BOSS | MF_MISSILE | MF_SPRING | MF_MONITOR | MF_FIRE | MF_ENEMY | MF_PAIN | MF_STICKY))
|
||||
|
|
|
@ -4261,7 +4261,8 @@ static void Command_Archivetest_f(void)
|
|||
// assign mobjnum
|
||||
i = 1;
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
((mobj_t *)th)->mobjnum = i++;
|
||||
if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed)
|
||||
((mobj_t *)th)->mobjnum = i++;
|
||||
|
||||
// allocate buffer
|
||||
buf = save_p = ZZ_Alloc(1024);
|
||||
|
|
|
@ -1695,6 +1695,9 @@ void F_TitleScreenTicker(boolean run)
|
|||
{
|
||||
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)
|
||||
|
|
13
src/g_game.c
13
src/g_game.c
|
@ -2567,6 +2567,9 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo)
|
|||
// scan all thinkers
|
||||
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->flags & MF_MISSILE))
|
||||
|
@ -4466,12 +4469,13 @@ void G_ConsGhostTic(void)
|
|||
mobj = NULL;
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
mobj = (mobj_t *)th;
|
||||
if (mobj->type == (mobjtype_t)type && mobj->x == x && mobj->y == y && mobj->z == z)
|
||||
break;
|
||||
mobj = NULL; // wasn't this one, keep searching.
|
||||
}
|
||||
if (mobj && mobj->health != health) // Wasn't damaged?! This is desync! Fix it!
|
||||
if (th != &thlist[THINK_MOBJ] && mobj->health != health) // Wasn't damaged?! This is desync! Fix it!
|
||||
{
|
||||
if (demosynced)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n"));
|
||||
|
@ -5860,13 +5864,16 @@ void G_DoPlayMetal(void)
|
|||
// find metal sonic
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type != MT_METALSONIC_RACE)
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
if (!mo)
|
||||
if (th == &thlist[THINK_MOBJ])
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Failed to find bot entity.\n"));
|
||||
Z_Free(metalbuffer);
|
||||
|
|
|
@ -804,6 +804,14 @@ void HWR_WallLighting(FOutVector *wlVerts)
|
|||
FSurfaceInfo Surf;
|
||||
float dist_p2d, d[4], s;
|
||||
|
||||
if (!dynlights->mo[j])
|
||||
continue;
|
||||
if (P_MobjWasRemoved(dynlights->mo[j]))
|
||||
{
|
||||
P_SetTarget(&dynlights->mo[j], NULL);
|
||||
continue;
|
||||
}
|
||||
|
||||
// check bounding box first
|
||||
if (SphereTouchBBox3D(&wlVerts[2], &wlVerts[0], &LIGHT_POS(j), DL_RADIUS(j))==false)
|
||||
continue;
|
||||
|
@ -854,8 +862,6 @@ void HWR_WallLighting(FOutVector *wlVerts)
|
|||
#ifdef DL_HIGH_QUALITY
|
||||
Surf.FlatColor.s.alpha = (UINT8)((1-dist_p2d/DL_SQRRADIUS(j))*Surf.FlatColor.s.alpha);
|
||||
#endif
|
||||
if (!dynlights->mo[j]->state)
|
||||
return;
|
||||
// next state is null so fade out with alpha
|
||||
if (dynlights->mo[j]->state->nextstate == S_NULL)
|
||||
Surf.FlatColor.s.alpha = (UINT8)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha);
|
||||
|
@ -886,6 +892,14 @@ void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts)
|
|||
FSurfaceInfo Surf;
|
||||
float dist_p2d, s;
|
||||
|
||||
if (!dynlights->mo[j])
|
||||
continue;
|
||||
if (P_MobjWasRemoved(dynlights->mo[j]))
|
||||
{
|
||||
P_SetTarget(&dynlights->mo[j], NULL);
|
||||
continue;
|
||||
}
|
||||
|
||||
// BP: The kickass Optimization: check if light touch bounding box
|
||||
if (SphereTouchBBox3D(&p1, &p2, &dynlights->position[j], DL_RADIUS(j))==false)
|
||||
continue;
|
||||
|
@ -917,8 +931,6 @@ void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts)
|
|||
#ifdef DL_HIGH_QUALITY
|
||||
Surf.FlatColor.s.alpha = (unsigned char)((1 - dist_p2d/DL_SQRRADIUS(j))*Surf.FlatColor.s.alpha);
|
||||
#endif
|
||||
if (!dynlights->mo[j]->state)
|
||||
return;
|
||||
// next state is null so fade out with alpha
|
||||
if ((dynlights->mo[j]->state->nextstate == S_NULL))
|
||||
Surf.FlatColor.s.alpha = (unsigned char)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha);
|
||||
|
@ -1049,6 +1061,14 @@ void HWR_DrawCoronas(void)
|
|||
if (!(p_lspr->type & CORONA_SPR))
|
||||
continue;
|
||||
|
||||
if (!dynlights->mo[j])
|
||||
continue;
|
||||
if (P_MobjWasRemoved(dynlights->mo[j]))
|
||||
{
|
||||
P_SetTarget(&dynlights->mo[j], NULL);
|
||||
continue;
|
||||
}
|
||||
|
||||
transform(&cx,&cy,&cz);
|
||||
|
||||
// more realistique corona !
|
||||
|
@ -1110,7 +1130,8 @@ void HWR_DrawCoronas(void)
|
|||
// --------------------------------------------------------------------------
|
||||
void HWR_ResetLights(void)
|
||||
{
|
||||
dynlights->nb = 0;
|
||||
while (dynlights->nb)
|
||||
P_SetTarget(&dynlights->mo[--dynlights->nb], NULL);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
@ -1141,24 +1162,25 @@ void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch)
|
|||
return;
|
||||
#endif
|
||||
|
||||
if (dynlights->nb >= DL_MAX_LIGHT)
|
||||
return;
|
||||
|
||||
// check if sprite contain dynamic light
|
||||
p_lspr = t_lspr[spr->mobj->sprite];
|
||||
if ((p_lspr->type&DYNLIGHT_SPR)
|
||||
&& ((p_lspr->type != LIGHT_SPR) || cv_grstaticlighting.value)
|
||||
&& (dynlights->nb < DL_MAX_LIGHT)
|
||||
if (!(p_lspr->type & DYNLIGHT_SPR))
|
||||
return;
|
||||
if ((p_lspr->type != LIGHT_SPR) || cv_grstaticlighting.value)
|
||||
return;
|
||||
|
||||
&& spr->mobj->state)
|
||||
{
|
||||
LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x);
|
||||
LIGHT_POS(dynlights->nb).y = FIXED_TO_FLOAT(spr->mobj->z)+FIXED_TO_FLOAT(spr->mobj->height>>1)+p_lspr->light_yoffset;
|
||||
LIGHT_POS(dynlights->nb).z = FIXED_TO_FLOAT(spr->mobj->y);
|
||||
LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x);
|
||||
LIGHT_POS(dynlights->nb).y = FIXED_TO_FLOAT(spr->mobj->z)+FIXED_TO_FLOAT(spr->mobj->height>>1)+p_lspr->light_yoffset;
|
||||
LIGHT_POS(dynlights->nb).z = FIXED_TO_FLOAT(spr->mobj->y);
|
||||
|
||||
P_SetTarget(&dynlights->mo[dynlights->nb], spr->mobj);
|
||||
P_SetTarget(&dynlights->mo[dynlights->nb], spr->mobj);
|
||||
|
||||
dynlights->p_lspr[dynlights->nb] = p_lspr;
|
||||
dynlights->p_lspr[dynlights->nb] = p_lspr;
|
||||
|
||||
dynlights->nb++;
|
||||
}
|
||||
dynlights->nb++;
|
||||
}
|
||||
|
||||
static GLPatch_t lightmappatch;
|
||||
|
@ -1312,6 +1334,14 @@ static void HWR_CheckSubsector(size_t num, fixed_t *bbox)
|
|||
// if (CircleTouchBBox(&p1, &p2, &LIGHT_POS(lightnum), DL_RADIUS(lightnum))==false)
|
||||
// continue;
|
||||
|
||||
if (!dynlights->mo[lightnum])
|
||||
continue;
|
||||
if (P_MobjWasRemoved(dynlights->mo[lightnum]))
|
||||
{
|
||||
P_SetTarget(&dynlights->mo[lightnum], NULL);
|
||||
continue;
|
||||
}
|
||||
|
||||
count = sub->numlines; // how many linedefs
|
||||
line = &segs[sub->firstline]; // first line seg
|
||||
while (count--)
|
||||
|
@ -1329,18 +1359,20 @@ static void HWR_CheckSubsector(size_t num, fixed_t *bbox)
|
|||
// --------------------------------------------------------------------------
|
||||
static void HWR_AddMobjLights(mobj_t *thing)
|
||||
{
|
||||
if (t_lspr[thing->sprite]->type & CORONA_SPR)
|
||||
{
|
||||
LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(thing->x);
|
||||
LIGHT_POS(dynlights->nb).y = FIXED_TO_FLOAT(thing->z) + t_lspr[thing->sprite]->light_yoffset;
|
||||
LIGHT_POS(dynlights->nb).z = FIXED_TO_FLOAT(thing->y);
|
||||
if (dynlights->nb >= DL_MAX_LIGHT)
|
||||
return;
|
||||
if (!(t_lspr[thing->sprite]->type & CORONA_SPR))
|
||||
return;
|
||||
|
||||
dynlights->p_lspr[dynlights->nb] = t_lspr[thing->sprite];
|
||||
LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(thing->x);
|
||||
LIGHT_POS(dynlights->nb).y = FIXED_TO_FLOAT(thing->z) + t_lspr[thing->sprite]->light_yoffset;
|
||||
LIGHT_POS(dynlights->nb).z = FIXED_TO_FLOAT(thing->y);
|
||||
|
||||
dynlights->nb++;
|
||||
if (dynlights->nb > DL_MAX_LIGHT)
|
||||
dynlights->nb = DL_MAX_LIGHT;
|
||||
}
|
||||
P_SetTarget(&dynlights->mo[dynlights->nb], thing);
|
||||
|
||||
dynlights->p_lspr[dynlights->nb] = t_lspr[thing->sprite];
|
||||
|
||||
dynlights->nb++;
|
||||
}
|
||||
|
||||
//Hurdler: The goal of this function is to walk through all the bsp starting
|
||||
|
@ -1367,7 +1399,8 @@ static void HWR_SearchLightsInMobjs(void)
|
|||
|
||||
// search in the list of thinkers
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
HWR_AddMobjLights((mobj_t *)th);
|
||||
if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed)
|
||||
HWR_AddMobjLights((mobj_t *)th);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1379,7 +1412,7 @@ void HWR_CreateStaticLightmaps(int bspnum)
|
|||
#ifdef STATICLIGHT
|
||||
CONS_Debug(DBG_RENDER, "HWR_CreateStaticLightmaps\n");
|
||||
|
||||
dynlights->nb = 0;
|
||||
HWR_ResetLights();
|
||||
|
||||
// First: Searching for lights
|
||||
// BP: if i was you, I will make it in create mobj since mobj can be create
|
||||
|
@ -1390,8 +1423,6 @@ void HWR_CreateStaticLightmaps(int bspnum)
|
|||
// Second: Build all lightmap for walls covered by lights
|
||||
validcount++; // to be sure
|
||||
HWR_ComputeLightMapsInBSPNode(bspnum, NULL);
|
||||
|
||||
dynlights->nb = 0;
|
||||
#else
|
||||
(void)bspnum;
|
||||
#endif
|
||||
|
|
|
@ -539,7 +539,7 @@ static int lib_pSpawnLockOn(lua_State *L)
|
|||
if (P_IsLocalPlayer(player)) // Only display it on your own view.
|
||||
{
|
||||
mobj_t *visual = P_SpawnMobj(lockon->x, lockon->y, lockon->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker
|
||||
visual->target = lockon;
|
||||
P_SetTarget(&visual->target, lockon);
|
||||
visual->flags2 |= MF2_DONTDRAW;
|
||||
P_SetMobjStateNF(visual, state);
|
||||
}
|
||||
|
|
|
@ -54,10 +54,12 @@ static UINT8 lib_searchBlockmap_Objects(lua_State *L, INT32 x, INT32 y, mobj_t *
|
|||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
blockfuncerror = true;
|
||||
P_SetTarget(&bnext, NULL);
|
||||
return 0; // *shrugs*
|
||||
}
|
||||
if (!lua_isnil(gL, -1))
|
||||
{ // if nil, continue
|
||||
P_SetTarget(&bnext, NULL);
|
||||
if (lua_toboolean(gL, -1))
|
||||
return 2; // stop whole search
|
||||
else
|
||||
|
|
|
@ -274,10 +274,19 @@ static int mobj_get(lua_State *L)
|
|||
// bprev -- same deal as sprev above, but for the blockmap.
|
||||
return UNIMPLEMENTED;
|
||||
case mobj_hnext:
|
||||
if (mo->hnext && P_MobjWasRemoved(mo->hnext))
|
||||
{ // don't put invalid mobj back into Lua.
|
||||
P_SetTarget(&mo->hnext, NULL);
|
||||
return 0;
|
||||
}
|
||||
LUA_PushUserdata(L, mo->hnext, META_MOBJ);
|
||||
break;
|
||||
case mobj_hprev:
|
||||
// implimented differently from sprev and bprev because SSNTails.
|
||||
if (mo->hprev && P_MobjWasRemoved(mo->hprev))
|
||||
{ // don't put invalid mobj back into Lua.
|
||||
P_SetTarget(&mo->hprev, NULL);
|
||||
return 0;
|
||||
}
|
||||
LUA_PushUserdata(L, mo->hprev, META_MOBJ);
|
||||
break;
|
||||
case mobj_type:
|
||||
|
|
|
@ -476,7 +476,12 @@ static int player_set(lua_State *L)
|
|||
else if (fastcmp(field,"followitem"))
|
||||
plr->followitem = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"followmobj"))
|
||||
P_SetTarget(&plr->followmobj, *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)));
|
||||
{
|
||||
mobj_t *mo = NULL;
|
||||
if (!lua_isnil(L, 3))
|
||||
mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
P_SetTarget(&plr->followmobj, mo);
|
||||
}
|
||||
else if (fastcmp(field,"actionspd"))
|
||||
plr->actionspd = (INT32)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"mindash"))
|
||||
|
@ -560,9 +565,19 @@ static int player_set(lua_State *L)
|
|||
else if (fastcmp(field,"old_angle_pos"))
|
||||
plr->old_angle_pos = luaL_checkangle(L, 3);
|
||||
else if (fastcmp(field,"axis1"))
|
||||
P_SetTarget(&plr->axis1, *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)));
|
||||
{
|
||||
mobj_t *mo = NULL;
|
||||
if (!lua_isnil(L, 3))
|
||||
mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
P_SetTarget(&plr->axis1, mo);
|
||||
}
|
||||
else if (fastcmp(field,"axis2"))
|
||||
P_SetTarget(&plr->axis2, *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)));
|
||||
{
|
||||
mobj_t *mo = NULL;
|
||||
if (!lua_isnil(L, 3))
|
||||
mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
P_SetTarget(&plr->axis2, mo);
|
||||
}
|
||||
else if (fastcmp(field,"bumpertime"))
|
||||
plr->bumpertime = (tic_t)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"flyangle"))
|
||||
|
|
|
@ -1127,14 +1127,15 @@ void LUA_Archive(void)
|
|||
ArchiveExtVars(&players[i], "player");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
// 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.
|
||||
|
||||
|
@ -1163,11 +1164,14 @@ void LUA_UnArchive(void)
|
|||
|
||||
do {
|
||||
mobjnum = READUINT32(save_p); // read a mobjnum
|
||||
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
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
if (((mobj_t *)th)->mobjnum != mobjnum) // find matching mobj
|
||||
continue;
|
||||
UnArchiveExtVars(th); // apply variables
|
||||
}
|
||||
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
||||
|
||||
LUAh_NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode
|
||||
|
|
|
@ -579,6 +579,9 @@ void Command_Teleport_f(void)
|
|||
|
||||
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->type != MT_STARPOST)
|
||||
|
@ -1068,10 +1071,14 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
|||
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
// get offset from mt, which points to old mapthings, then add new location
|
||||
if (mo->spawnpoint)
|
||||
mo->spawnpoint = (mo->spawnpoint - mt) + mapthings;
|
||||
if (!mo->spawnpoint)
|
||||
continue;
|
||||
mo->spawnpoint = (mo->spawnpoint - mt) + mapthings;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1391,7 +1391,7 @@ void A_StatueBurst(mobj_t *actor)
|
|||
return;
|
||||
|
||||
new->angle = actor->angle;
|
||||
new->target = actor->target;
|
||||
P_SetTarget(&new->target, actor->target);
|
||||
if (locvar2)
|
||||
P_SetMobjState(new, (statenum_t)locvar2);
|
||||
S_StartSound(new, new->info->attacksound);
|
||||
|
@ -2155,7 +2155,7 @@ void A_CrushclawLaunch(mobj_t *actor)
|
|||
for (i = 0; (i < CSEGS); i++)
|
||||
{
|
||||
mobj_t *newchain = P_SpawnMobjFromMobj(actor, 0, 0, 0, actor->info->raisestate);
|
||||
prevchain->target = newchain;
|
||||
P_SetTarget(&prevchain->target, newchain);
|
||||
prevchain = newchain;
|
||||
}
|
||||
actor->target->angle = R_PointToAngle2(actor->target->x, actor->target->y, crab->target->x, crab->target->y);
|
||||
|
@ -3088,7 +3088,7 @@ void A_Boss1Laser(mobj_t *actor)
|
|||
if (z - floorz < mobjinfo[MT_EGGMOBILE_FIRE].height>>1)
|
||||
{
|
||||
point = P_SpawnMobj(x, y, floorz+1, MT_EGGMOBILE_FIRE);
|
||||
point->target = actor;
|
||||
P_SetTarget(&point->target, actor);
|
||||
point->destscale = 3*FRACUNIT;
|
||||
point->scalespeed = FRACUNIT>>2;
|
||||
point->fuse = TICRATE;
|
||||
|
@ -3488,9 +3488,11 @@ void A_1upThinker(mobj_t *actor)
|
|||
|
||||
if (closestplayer == -1 || skins[players[closestplayer].skin].sprites[SPR2_LIFE].numframes == 0)
|
||||
{ // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite.
|
||||
if (actor->tracer) {
|
||||
P_RemoveMobj(actor->tracer);
|
||||
actor->tracer = NULL;
|
||||
if (actor->tracer)
|
||||
{
|
||||
mobj_t *tracer = actor->tracer;
|
||||
P_SetTarget(&actor->tracer, NULL);
|
||||
P_RemoveMobj(tracer);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -3786,6 +3788,9 @@ void A_BossDeath(mobj_t *mo)
|
|||
// if all bosses are dead
|
||||
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 != mo && (mo2->flags & MF_BOSS) && mo2->health > 0)
|
||||
goto bossjustdie; // other boss not dead - just go straight to dying!
|
||||
|
@ -3884,6 +3889,9 @@ bossjustdie:
|
|||
// scan the thinkers to find the runaway point
|
||||
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->type != MT_BOSSFLYPOINT)
|
||||
|
@ -6137,6 +6145,9 @@ void A_RingExplode(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;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2 == actor) // Don't explode yourself! Endless loop!
|
||||
|
@ -7263,7 +7274,7 @@ void A_Boss2PogoTarget(mobj_t *actor)
|
|||
if (actor->info->missilestate) // spawn the pogo stick collision box
|
||||
{
|
||||
mobj_t *pogo = P_SpawnMobj(actor->x, actor->y, actor->z - mobjinfo[actor->info->missilestate].height, (mobjtype_t)actor->info->missilestate);
|
||||
pogo->target = actor;
|
||||
P_SetTarget(&pogo->target, actor);
|
||||
}
|
||||
|
||||
actor->reactiontime = 1;
|
||||
|
@ -7835,6 +7846,9 @@ void A_Boss3Path(mobj_t *actor)
|
|||
// the number
|
||||
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->type != MT_BOSS3WAYPOINT)
|
||||
continue;
|
||||
|
@ -8227,6 +8241,9 @@ void A_FindTarget(mobj_t *actor)
|
|||
// scan the thinkers
|
||||
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->type == (mobjtype_t)locvar1)
|
||||
|
@ -8289,6 +8306,9 @@ void A_FindTracer(mobj_t *actor)
|
|||
// scan the thinkers
|
||||
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->type == (mobjtype_t)locvar1)
|
||||
|
@ -8873,6 +8893,9 @@ void A_RemoteAction(mobj_t *actor)
|
|||
// scan the thinkers
|
||||
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->type == (mobjtype_t)locvar1)
|
||||
|
@ -9136,6 +9159,9 @@ void A_SetObjectTypeState(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;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == (mobjtype_t)loc2lw)
|
||||
|
@ -9771,6 +9797,9 @@ void A_CheckThingCount(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;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == (mobjtype_t)loc1up)
|
||||
|
@ -13061,9 +13090,10 @@ static boolean PIT_TNTExplode(mobj_t *nearby)
|
|||
if (barrel->target == nearby)
|
||||
{
|
||||
mobj_t *tar = barrel->target; // temporarily store barrel's target
|
||||
barrel->target = NULL;
|
||||
P_SetTarget(&barrel->target, NULL);
|
||||
P_DamageMobj(nearby, barrel, NULL, 1, 0);
|
||||
barrel->target = tar;
|
||||
if (!P_MobjWasRemoved(barrel))
|
||||
P_SetTarget(&barrel->target, tar);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -13565,7 +13595,7 @@ void A_SaloonDoorSpawn(mobj_t *actor)
|
|||
door->extravalue2 = 0;
|
||||
|
||||
// Origin door
|
||||
door->tracer = actor;
|
||||
P_SetTarget(&door->tracer, actor);
|
||||
|
||||
//Back
|
||||
door = P_SpawnMobj(x - c*d, y - s*d, z, MT_SALOONDOOR);
|
||||
|
@ -13578,7 +13608,7 @@ void A_SaloonDoorSpawn(mobj_t *actor)
|
|||
door->extravalue2 = 0;
|
||||
|
||||
// Origin door
|
||||
door->tracer = actor;
|
||||
P_SetTarget(&door->tracer, actor);
|
||||
}
|
||||
|
||||
// Function: A_MinecartSparkThink
|
||||
|
|
|
@ -1975,22 +1975,27 @@ void T_ThwompSector(levelspecthink_t *thwomp)
|
|||
}
|
||||
else // Not going anywhere, so look for players.
|
||||
{
|
||||
thinker_t *th;
|
||||
mobj_t *mo;
|
||||
|
||||
if (!rover || (rover->flags & FF_EXISTS))
|
||||
{
|
||||
// scan the thinkers to find players!
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
UINT8 i;
|
||||
// scan the players to find victims!
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type == MT_PLAYER && mo->health && mo->player && !mo->player->spectator
|
||||
&& mo->z <= thwomp->sector->ceilingheight
|
||||
&& P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT)
|
||||
{
|
||||
thwomp->direction = -1;
|
||||
break;
|
||||
}
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
if (players[i].spectator)
|
||||
continue;
|
||||
if (!players[i].mo)
|
||||
continue;
|
||||
if (!players[i].mo->health)
|
||||
continue;
|
||||
if (players[i].mo->z > thwomp->sector->ceilingheight)
|
||||
continue;
|
||||
if (P_AproxDistance(thwompx - players[i].mo->x, thwompy - players[i].mo->y) > 96 * FRACUNIT)
|
||||
continue;
|
||||
|
||||
thwomp->direction = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,6 +99,9 @@ void P_ClearStarPost(INT32 postnum)
|
|||
// scan the thinkers
|
||||
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->type != MT_STARPOST)
|
||||
|
@ -125,10 +128,15 @@ void P_ResetStarposts(void)
|
|||
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
post = (mobj_t *)th;
|
||||
|
||||
if (post->type == MT_STARPOST)
|
||||
P_SetMobjState(post, post->info->spawnstate);
|
||||
if (post->type != MT_STARPOST)
|
||||
continue;
|
||||
|
||||
P_SetMobjState(post, post->info->spawnstate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -828,19 +836,22 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
// scan the thinkers to find the corresponding anchorpoint
|
||||
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->type == MT_IDEYAANCHOR)
|
||||
{
|
||||
if (mo2->health == toucher->tracer->health) // do ideya numberes match?
|
||||
anchorpoint = mo2;
|
||||
else if (toucher->tracer->hnext && mo2->health == toucher->tracer->hnext->health)
|
||||
anchorpoint2 = mo2;
|
||||
if (mo2->type != MT_IDEYAANCHOR)
|
||||
continue;
|
||||
|
||||
if ((!toucher->tracer->hnext && anchorpoint)
|
||||
|| (toucher->tracer->hnext && anchorpoint && anchorpoint2))
|
||||
break;
|
||||
}
|
||||
if (mo2->health == toucher->tracer->health) // do ideya numberes match?
|
||||
anchorpoint = mo2;
|
||||
else if (toucher->tracer->hnext && mo2->health == toucher->tracer->hnext->health)
|
||||
anchorpoint2 = mo2;
|
||||
|
||||
if ((!toucher->tracer->hnext && anchorpoint)
|
||||
|| (toucher->tracer->hnext && anchorpoint && anchorpoint2))
|
||||
break;
|
||||
}
|
||||
|
||||
if (anchorpoint)
|
||||
|
@ -919,6 +930,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
// scan the remaining thinkers
|
||||
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 == special)
|
||||
|
@ -966,6 +980,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
// in from the paraloop. Isn't this just so efficient?
|
||||
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 (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > gatherradius)
|
||||
|
@ -1337,6 +1354,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
// scan the remaining thinkers to find koopa
|
||||
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->type != MT_KOOPA)
|
||||
|
@ -1434,6 +1454,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
|
||||
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->type != MT_STARPOST)
|
||||
|
@ -2572,9 +2595,11 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
UINT32 i = 0; // to check how many clones we've removed
|
||||
|
||||
// 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_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type != (mobjtype_t)target->info->mass)
|
||||
continue;
|
||||
|
|
|
@ -61,8 +61,8 @@
|
|||
#define P_GetPlayerHeight(player) FixedMul(player->height, player->mo->scale)
|
||||
#define P_GetPlayerSpinHeight(player) FixedMul(player->spinheight, player->mo->scale)
|
||||
|
||||
typedef enum{
|
||||
THINK_LIMBO,
|
||||
typedef enum
|
||||
{
|
||||
THINK_POLYOBJ,
|
||||
THINK_MAIN,
|
||||
THINK_MOBJ,
|
||||
|
|
|
@ -1093,7 +1093,10 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *))
|
|||
{
|
||||
P_SetTarget(&bnext, mobj->bnext); // We want to note our reference to bnext here incase it is MF_NOTHINK and gets removed!
|
||||
if (!func(mobj))
|
||||
{
|
||||
P_SetTarget(&bnext, NULL);
|
||||
return false;
|
||||
}
|
||||
if (P_MobjWasRemoved(tmthing) // func just popped our tmthing, cannot continue.
|
||||
|| (bnext && P_MobjWasRemoved(bnext))) // func just broke blockmap chain, cannot continue.
|
||||
{
|
||||
|
|
124
src/p_mobj.c
124
src/p_mobj.c
|
@ -716,6 +716,9 @@ void P_EmeraldManager(void)
|
|||
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (mo->type == MT_EMERALDSPAWN)
|
||||
|
@ -3694,6 +3697,9 @@ void P_DestroyRobots(void)
|
|||
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
if (mo->health <= 0 || !(mo->flags & (MF_ENEMY|MF_BOSS)))
|
||||
continue; // not a valid enemy
|
||||
|
@ -4426,6 +4432,9 @@ static void P_Boss3Thinker(mobj_t *mobj)
|
|||
// this can happen if the boss was hurt earlier than expected
|
||||
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->type != (mobjtype_t)mobj->info->mass)
|
||||
continue;
|
||||
|
@ -4524,6 +4533,9 @@ static void P_Boss3Thinker(mobj_t *mobj)
|
|||
// the number
|
||||
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->type != MT_BOSS3WAYPOINT)
|
||||
continue;
|
||||
|
@ -4832,8 +4844,8 @@ static void P_Boss4Thinker(mobj_t *mobj)
|
|||
P_SetTarget(&seg->target, mobj);
|
||||
for (i = 0; i < 9; i++)
|
||||
{
|
||||
seg->hnext = P_SpawnMobj(mobj->x, mobj->y, z, MT_EGGMOBILE4_MACE);
|
||||
seg->hnext->hprev = seg;
|
||||
P_SetTarget(&seg->hnext, P_SpawnMobj(mobj->x, mobj->y, z, MT_EGGMOBILE4_MACE));
|
||||
P_SetTarget(&seg->hnext->hprev, seg);
|
||||
seg = seg->hnext;
|
||||
}
|
||||
}
|
||||
|
@ -5245,6 +5257,9 @@ static void P_Boss7Thinker(mobj_t *mobj)
|
|||
// Find waypoint he is closest to
|
||||
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->type == MT_BOSS3WAYPOINT && mo2->spawnpoint)
|
||||
{
|
||||
|
@ -5297,6 +5312,9 @@ static void P_Boss7Thinker(mobj_t *mobj)
|
|||
// the waypoint to use
|
||||
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->type == MT_BOSS3WAYPOINT && mo2->spawnpoint && (mo2->spawnpoint->options & 7) == waypointNum)
|
||||
{
|
||||
|
@ -5427,14 +5445,17 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
|||
// Build a hoop linked list of 'em!
|
||||
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->type == MT_BOSS9GATHERPOINT)
|
||||
{
|
||||
if (last)
|
||||
last->hnext = mo2;
|
||||
P_SetTarget(&last->hnext, mo2);
|
||||
else
|
||||
mobj->hnext = mo2;
|
||||
mo2->hprev = last;
|
||||
P_SetTarget(&mobj->hnext, mo2);
|
||||
P_SetTarget(&mo2->hprev, last);
|
||||
last = mo2;
|
||||
}
|
||||
}
|
||||
|
@ -6072,6 +6093,9 @@ mobj_t *P_GetClosestAxis(mobj_t *source)
|
|||
// scan the thinkers to find the closest axis point
|
||||
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->type == MT_AXIS)
|
||||
|
@ -6841,12 +6865,14 @@ static void P_RemoveOverlay(mobj_t *thing)
|
|||
{
|
||||
mobj_t *mo;
|
||||
for (mo = overlaycap; mo; mo = mo->hnext)
|
||||
if (mo->hnext == thing)
|
||||
{
|
||||
P_SetTarget(&mo->hnext, thing->hnext);
|
||||
P_SetTarget(&thing->hnext, NULL);
|
||||
return;
|
||||
}
|
||||
{
|
||||
if (mo->hnext != thing)
|
||||
continue;
|
||||
|
||||
P_SetTarget(&mo->hnext, thing->hnext);
|
||||
P_SetTarget(&thing->hnext, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void A_BossDeath(mobj_t *mo);
|
||||
|
@ -9751,7 +9777,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
mobj->momx = 1; //stack hack
|
||||
break;
|
||||
case MT_MINECARTEND:
|
||||
mobj->tracer = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_MINECARTENDSOLID);
|
||||
P_SetTarget(&mobj->tracer, P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_MINECARTENDSOLID));
|
||||
mobj->tracer->angle = mobj->angle + ANGLE_90;
|
||||
break;
|
||||
default:
|
||||
|
@ -9960,37 +9986,28 @@ void P_RemoveMobj(mobj_t *mobj)
|
|||
|
||||
P_SetTarget(&mobj->hnext, P_SetTarget(&mobj->hprev, NULL));
|
||||
|
||||
// free block
|
||||
// DBG: set everything in mobj_t to 0xFF instead of leaving it. debug memory error.
|
||||
if (mobj->flags & MF_NOTHINK && !mobj->thinker.next)
|
||||
#ifdef SCRAMBLE_REMOVED
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
|
||||
#endif
|
||||
|
||||
// free block
|
||||
if (!mobj->thinker.next)
|
||||
{ // Uh-oh, the mobj doesn't think, P_RemoveThinker would never go through!
|
||||
INT32 prevreferences;
|
||||
if (!mobj->thinker.references)
|
||||
{
|
||||
#ifdef SCRAMBLE_REMOVED
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset(mobj, 0xff, sizeof(mobj_t));
|
||||
#endif
|
||||
Z_Free(mobj); // No refrences? Can be removed immediately! :D
|
||||
}
|
||||
else
|
||||
{ // Add thinker just to delay removing it until refrences are gone.
|
||||
mobj->flags &= ~MF_NOTHINK;
|
||||
P_AddThinker(THINK_MOBJ, (thinker_t *)mobj);
|
||||
#ifdef SCRAMBLE_REMOVED
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
|
||||
#endif
|
||||
P_RemoveThinker((thinker_t *)mobj);
|
||||
Z_Free(mobj); // No refrrences? Can be removed immediately! :D
|
||||
return;
|
||||
}
|
||||
|
||||
prevreferences = mobj->thinker.references;
|
||||
P_AddThinker(THINK_MOBJ, (thinker_t *)mobj);
|
||||
mobj->thinker.references = prevreferences;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef SCRAMBLE_REMOVED
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
|
||||
#endif
|
||||
P_RemoveThinker((thinker_t *)mobj);
|
||||
}
|
||||
|
||||
P_RemoveThinker((thinker_t *)mobj);
|
||||
}
|
||||
|
||||
// This does not need to be added to Lua.
|
||||
|
@ -11821,6 +11838,9 @@ ML_EFFECT5 : Don't stop thinking when too far away
|
|||
// See if other starposts exist in this level that have the same value.
|
||||
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 == mobj)
|
||||
|
@ -12124,11 +12144,11 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing, boolean bonustime)
|
|||
// Link all the sprites in the hoop together
|
||||
if (nextmobj)
|
||||
{
|
||||
mobj->hprev = nextmobj;
|
||||
mobj->hprev->hnext = mobj;
|
||||
P_SetTarget(&mobj->hprev, nextmobj);
|
||||
P_SetTarget(&mobj->hprev->hnext, mobj);
|
||||
}
|
||||
else
|
||||
mobj->hprev = mobj->hnext = NULL;
|
||||
P_SetTarget(&mobj->hprev, P_SetTarget(&mobj->hnext, NULL));
|
||||
|
||||
nextmobj = mobj;
|
||||
}
|
||||
|
@ -12154,9 +12174,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing, boolean bonustime)
|
|||
mobj->z -= mobj->height/2;
|
||||
|
||||
// Link all the collision sprites together.
|
||||
mobj->hnext = NULL;
|
||||
mobj->hprev = nextmobj;
|
||||
mobj->hprev->hnext = mobj;
|
||||
P_SetTarget(&mobj->hnext, NULL);
|
||||
P_SetTarget(&mobj->hprev, nextmobj);
|
||||
P_SetTarget(&mobj->hprev->hnext, mobj);
|
||||
|
||||
nextmobj = mobj;
|
||||
}
|
||||
|
@ -12181,9 +12201,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing, boolean bonustime)
|
|||
mobj->z -= mobj->height/2;
|
||||
|
||||
// Link all the collision sprites together.
|
||||
mobj->hnext = NULL;
|
||||
mobj->hprev = nextmobj;
|
||||
mobj->hprev->hnext = mobj;
|
||||
P_SetTarget(&mobj->hnext, NULL);
|
||||
P_SetTarget(&mobj->hprev, nextmobj);
|
||||
P_SetTarget(&mobj->hprev->hnext, mobj);
|
||||
|
||||
nextmobj = mobj;
|
||||
}
|
||||
|
@ -12266,11 +12286,11 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing, boolean bonustime)
|
|||
// Link all the sprites in the hoop together
|
||||
if (nextmobj)
|
||||
{
|
||||
mobj->hprev = nextmobj;
|
||||
mobj->hprev->hnext = mobj;
|
||||
P_SetTarget(&mobj->hprev, nextmobj);
|
||||
P_SetTarget(&mobj->hprev->hnext, mobj);
|
||||
}
|
||||
else
|
||||
mobj->hprev = mobj->hnext = NULL;
|
||||
P_SetTarget(&mobj->hprev, P_SetTarget(&mobj->hnext, NULL));
|
||||
|
||||
nextmobj = mobj;
|
||||
}
|
||||
|
@ -12307,9 +12327,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing, boolean bonustime)
|
|||
mobj->z -= mobj->height/2;
|
||||
|
||||
// Link all the collision sprites together.
|
||||
mobj->hnext = NULL;
|
||||
mobj->hprev = nextmobj;
|
||||
mobj->hprev->hnext = mobj;
|
||||
P_SetTarget(&mobj->hnext, NULL);
|
||||
P_SetTarget(&mobj->hprev, nextmobj);
|
||||
P_SetTarget(&mobj->hprev->hnext, mobj);
|
||||
|
||||
nextmobj = mobj;
|
||||
}
|
||||
|
|
171
src/p_polyobj.c
171
src/p_polyobj.c
|
@ -1510,6 +1510,9 @@ void Polyobj_InitLevel(void)
|
|||
// the mobj_t pointers on a queue for use below.
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mobj_t *mo = (mobj_t *)th;
|
||||
|
||||
if (mo->info->doomednum == POLYOBJ_SPAWN_DOOMEDNUM ||
|
||||
|
@ -1815,6 +1818,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
// We redo this each tic to make savegame compatibility easier.
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
|
@ -1893,28 +1899,31 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
// Find next waypoint
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (th->direction == -1)
|
||||
if (mo2->health == target->health - 1)
|
||||
{
|
||||
if (mo2->health == target->health - 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == target->health + 1)
|
||||
{
|
||||
if (mo2->health == target->health + 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1929,27 +1938,30 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (th->direction == -1)
|
||||
if (waypoint == NULL)
|
||||
waypoint = mo2;
|
||||
else if (mo2->health > waypoint->health)
|
||||
waypoint = mo2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
{
|
||||
if (waypoint == NULL)
|
||||
waypoint = mo2;
|
||||
else if (mo2->health > waypoint->health)
|
||||
waypoint = mo2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1963,28 +1975,31 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1)
|
||||
{
|
||||
if (th->direction == -1)
|
||||
if (mo2->health == target->health - 1)
|
||||
{
|
||||
if (mo2->health == target->health - 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == target->health + 1)
|
||||
{
|
||||
if (mo2->health == target->health + 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2511,36 +2526,39 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
|||
// Find the first waypoint we need to use
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
{
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
if (mo2->health == 0)
|
||||
last = mo2;
|
||||
else
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
last = mo2;
|
||||
else
|
||||
{
|
||||
if (first == NULL)
|
||||
first = mo2;
|
||||
else if (mo2->health > first->health)
|
||||
first = mo2;
|
||||
}
|
||||
}
|
||||
else // waypoint 0
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
if (first == NULL)
|
||||
first = mo2;
|
||||
else
|
||||
{
|
||||
if (last == NULL)
|
||||
last = mo2;
|
||||
else if (mo2->health > last->health)
|
||||
last = mo2;
|
||||
}
|
||||
else if (mo2->health > first->health)
|
||||
first = mo2;
|
||||
}
|
||||
}
|
||||
else // waypoint 0
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
first = mo2;
|
||||
else
|
||||
{
|
||||
if (last == NULL)
|
||||
last = mo2;
|
||||
else if (mo2->health > last->health)
|
||||
last = mo2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2579,28 +2597,31 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
|||
target = first;
|
||||
/*for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == th->sequence)
|
||||
if (mo2->threshold != th->sequence)
|
||||
continue;
|
||||
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
{
|
||||
if (th->direction == -1) // highest waypoint #
|
||||
if (mo2->health == first->health - 1)
|
||||
{
|
||||
if (mo2->health == first->health - 1)
|
||||
{
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
else // waypoint 0
|
||||
}
|
||||
else // waypoint 0
|
||||
{
|
||||
if (mo2->health == first->health + 1)
|
||||
{
|
||||
if (mo2->health == first->health + 1)
|
||||
{
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
target = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
|
|
@ -2174,7 +2174,6 @@ static void P_NetArchiveThinkers(void)
|
|||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
UINT32 numsaved = 0;
|
||||
|
||||
// save off the current thinkers
|
||||
for (th = thlist[i].next; th != &thlist[i]; th = th->next)
|
||||
{
|
||||
|
@ -2405,12 +2404,12 @@ static void P_NetArchiveThinkers(void)
|
|||
}
|
||||
#endif // ESLOPE
|
||||
#ifdef PARANOIA
|
||||
else if (th->function.acv != P_RemoveThinkerDelayed) // wait garbage collection
|
||||
else if (th->function.acp1 != P_RemoveThinkerDelayed) // wait garbage collection
|
||||
I_Error("unknown thinker type %p", th->function.acp1);
|
||||
#endif
|
||||
}
|
||||
|
||||
CONS_Debug(DBG_NETPLAY, "%u thinkers saved\n", numsaved);
|
||||
CONS_Debug(DBG_NETPLAY, "%u thinkers saved in list %d\n", numsaved, i);
|
||||
|
||||
WRITEUINT8(save_p, tc_end);
|
||||
}
|
||||
|
@ -2427,9 +2426,14 @@ mobj_t *P_FindNewPosition(UINT32 oldposition)
|
|||
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mobj = (mobj_t *)th;
|
||||
if (mobj->mobjnum == oldposition)
|
||||
return mobj;
|
||||
if (mobj->mobjnum != oldposition)
|
||||
continue;
|
||||
|
||||
return mobj;
|
||||
}
|
||||
CONS_Debug(DBG_GAMELOGIC, "mobj not found\n");
|
||||
return NULL;
|
||||
|
@ -3597,22 +3601,22 @@ static void P_NetUnArchiveThinkers(void)
|
|||
P_AddThinker(i, th);
|
||||
}
|
||||
|
||||
CONS_Debug(DBG_NETPLAY, "%u thinkers loaded\n", numloaded);
|
||||
CONS_Debug(DBG_NETPLAY, "%u thinkers loaded in list %d\n", numloaded, i);
|
||||
}
|
||||
|
||||
if (restoreNum)
|
||||
if (restoreNum)
|
||||
{
|
||||
executor_t *delay = NULL;
|
||||
UINT32 mobjnum;
|
||||
for (currentthinker = thlist[i].next; currentthinker != &thlist[i];
|
||||
currentthinker = currentthinker->next)
|
||||
{
|
||||
executor_t *delay = NULL;
|
||||
UINT32 mobjnum;
|
||||
for (currentthinker = thlist[i].next; currentthinker != &thlist[i];
|
||||
currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 == (actionf_p1)T_ExecutorDelay)
|
||||
{
|
||||
delay = (void *)currentthinker;
|
||||
if ((mobjnum = (UINT32)(size_t)delay->caller))
|
||||
delay->caller = P_FindNewPosition(mobjnum);
|
||||
}
|
||||
}
|
||||
if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay)
|
||||
continue;
|
||||
delay = (void *)currentthinker;
|
||||
if (!(mobjnum = (UINT32)(size_t)delay->caller))
|
||||
continue;
|
||||
delay->caller = P_FindNewPosition(mobjnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3723,6 +3727,9 @@ static inline void P_FinishMobjs(void)
|
|||
for (currentthinker = thlist[THINK_MOBJ].next; currentthinker != &thlist[THINK_MOBJ];
|
||||
currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mobj = (mobj_t *)currentthinker;
|
||||
mobj->info = &mobjinfo[mobj->type];
|
||||
}
|
||||
|
@ -3738,6 +3745,9 @@ static void P_RelinkPointers(void)
|
|||
for (currentthinker = thlist[THINK_MOBJ].next; currentthinker != &thlist[THINK_MOBJ];
|
||||
currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mobj = (mobj_t *)currentthinker;
|
||||
|
||||
if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)
|
||||
|
@ -4115,6 +4125,9 @@ void P_SaveNetGame(void)
|
|||
// Assign the mobjnumber for pointer tracking
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mobj = (mobj_t *)th;
|
||||
if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)
|
||||
continue;
|
||||
|
|
|
@ -817,6 +817,9 @@ void P_ReloadRings(void)
|
|||
// scan the thinkers to find rings/spheres/hoops to unset
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
|
||||
if (mo->type == MT_HOOPCENTER)
|
||||
|
@ -883,6 +886,9 @@ void P_SwitchSpheresBonusMode(boolean bonustime)
|
|||
// scan the thinkers to find spheres to switch
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
|
||||
if (mo->type != MT_BLUESPHERE && mo->type != MT_NIGHTSCHIP
|
||||
|
@ -2284,7 +2290,6 @@ static void P_LevelInitStuff(void)
|
|||
void P_LoadThingsOnly(void)
|
||||
{
|
||||
// Search through all the thinkers.
|
||||
mobj_t *mo;
|
||||
thinker_t *think;
|
||||
INT32 i, viewid = -1, centerid = -1; // for skyboxes
|
||||
|
||||
|
@ -2301,10 +2306,9 @@ void P_LoadThingsOnly(void)
|
|||
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (mo)
|
||||
P_RemoveMobj(mo);
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
P_RemoveMobj((mobj_t *)think);
|
||||
}
|
||||
|
||||
P_LevelInitStuff();
|
||||
|
|
78
src/p_spec.c
78
src/p_spec.c
|
@ -2260,7 +2260,7 @@ void P_SwitchWeather(INT32 weathernum)
|
|||
thinker_t *think;
|
||||
precipmobj_t *precipmobj;
|
||||
|
||||
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
|
||||
for (think = thlist[THINK_PRECIP].next; think != &thlist[THINK_PRECIP]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
||||
continue; // not a precipmobj thinker
|
||||
|
@ -2276,7 +2276,7 @@ void P_SwitchWeather(INT32 weathernum)
|
|||
precipmobj_t *precipmobj;
|
||||
state_t *st;
|
||||
|
||||
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
|
||||
for (think = thlist[THINK_PRECIP].next; think != &thlist[THINK_PRECIP]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
||||
continue; // not a precipmobj thinker
|
||||
|
@ -3992,6 +3992,9 @@ void P_SetupSignExit(player_t *player)
|
|||
// spin all signposts in the level then.
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
thing = (mobj_t *)think;
|
||||
if (thing->type != MT_SIGN)
|
||||
continue;
|
||||
|
@ -4017,20 +4020,18 @@ boolean P_IsFlagAtBase(mobjtype_t flag)
|
|||
{
|
||||
thinker_t *think;
|
||||
mobj_t *mo;
|
||||
INT32 specialnum = 0;
|
||||
INT32 specialnum = (flag == MT_REDFLAG) ? 3 : 4;
|
||||
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (mo->type != flag)
|
||||
continue;
|
||||
|
||||
if (mo->type == MT_REDFLAG)
|
||||
specialnum = 3;
|
||||
else if (mo->type == MT_BLUEFLAG)
|
||||
specialnum = 4;
|
||||
|
||||
if (GETSECSPECIAL(mo->subsector->sector->special, 4) == specialnum)
|
||||
return true;
|
||||
else if (mo->subsector->sector->ffloors) // Check the 3D floors
|
||||
|
@ -4045,9 +4046,11 @@ boolean P_IsFlagAtBase(mobjtype_t flag)
|
|||
if (GETSECSPECIAL(rover->master->frontsector->special, 4) != specialnum)
|
||||
continue;
|
||||
|
||||
if (mo->z <= P_GetSpecialTopZ(mo, sectors + rover->secnum, mo->subsector->sector)
|
||||
&& mo->z >= P_GetSpecialBottomZ(mo, sectors + rover->secnum, mo->subsector->sector))
|
||||
return true;
|
||||
if (!(mo->z <= P_GetSpecialTopZ(mo, sectors + rover->secnum, mo->subsector->sector)
|
||||
&& mo->z >= P_GetSpecialBottomZ(mo, sectors + rover->secnum, mo->subsector->sector)))
|
||||
continue;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4451,9 +4454,12 @@ 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->type == MT_EGGTRAP)
|
||||
P_KillMobj(mo2, NULL, player->mo, 0);
|
||||
if (mo2->type != MT_EGGTRAP)
|
||||
continue;
|
||||
P_KillMobj(mo2, NULL, player->mo, 0);
|
||||
}
|
||||
|
||||
// clear the special so you can't push the button twice.
|
||||
|
@ -4754,14 +4760,20 @@ DoneSection2:
|
|||
// to find the first waypoint
|
||||
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->type == MT_TUBEWAYPOINT && mo2->threshold == sequence
|
||||
&& mo2->health == 0)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
if (mo2->threshold != sequence)
|
||||
continue;
|
||||
if (mo2->health != 0)
|
||||
continue;
|
||||
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!waypoint)
|
||||
|
@ -4830,15 +4842,20 @@ DoneSection2:
|
|||
// to find the last waypoint
|
||||
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->type == MT_TUBEWAYPOINT && mo2->threshold == sequence)
|
||||
{
|
||||
if (!waypoint)
|
||||
waypoint = mo2;
|
||||
else if (mo2->health > waypoint->health)
|
||||
waypoint = mo2;
|
||||
}
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
if (mo2->threshold != sequence)
|
||||
continue;
|
||||
|
||||
if (!waypoint)
|
||||
waypoint = mo2;
|
||||
else if (mo2->health > waypoint->health)
|
||||
waypoint = mo2;
|
||||
}
|
||||
|
||||
if (!waypoint)
|
||||
|
@ -4979,6 +4996,9 @@ DoneSection2:
|
|||
// to find the first waypoint
|
||||
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->type != MT_TUBEWAYPOINT)
|
||||
|
@ -5014,6 +5034,9 @@ DoneSection2:
|
|||
// Find waypoint before this one (waypointlow)
|
||||
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->type != MT_TUBEWAYPOINT)
|
||||
|
@ -5038,6 +5061,9 @@ DoneSection2:
|
|||
// Find waypoint after this one (waypointhigh)
|
||||
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->type != MT_TUBEWAYPOINT)
|
||||
|
|
86
src/p_tick.c
86
src/p_tick.c
|
@ -44,6 +44,9 @@ void Command_Numthinkers_f(void)
|
|||
INT32 count = 0;
|
||||
actionf_p1 action;
|
||||
thinker_t *think;
|
||||
thinklistnum_t start = 0;
|
||||
thinklistnum_t end = NUM_THINKERLISTS - 1;
|
||||
thinklistnum_t i;
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
{
|
||||
|
@ -70,6 +73,7 @@ void Command_Numthinkers_f(void)
|
|||
switch (num)
|
||||
{
|
||||
case 1:
|
||||
start = end = THINK_MOBJ;
|
||||
action = (actionf_p1)P_MobjThinker;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "P_MobjThinker");
|
||||
break;
|
||||
|
@ -82,14 +86,17 @@ void Command_Numthinkers_f(void)
|
|||
CONS_Printf(M_GetText("Number of %s: "), "P_SnowThinker");
|
||||
break;*/
|
||||
case 2:
|
||||
start = end = THINK_PRECIP;
|
||||
action = (actionf_p1)P_NullPrecipThinker;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "P_NullPrecipThinker");
|
||||
break;
|
||||
case 3:
|
||||
start = end = THINK_MAIN;
|
||||
action = (actionf_p1)T_Friction;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "T_Friction");
|
||||
break;
|
||||
case 4:
|
||||
start = end = THINK_MAIN;
|
||||
action = (actionf_p1)T_Pusher;
|
||||
CONS_Printf(M_GetText("Number of %s: "), "T_Pusher");
|
||||
break;
|
||||
|
@ -102,12 +109,15 @@ void Command_Numthinkers_f(void)
|
|||
return;
|
||||
}
|
||||
|
||||
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
|
||||
for (i = start; i <= end; i++)
|
||||
{
|
||||
if (think->function.acp1 != action)
|
||||
continue;
|
||||
for (think = thlist[i].next; think != &thlist[i]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != action)
|
||||
continue;
|
||||
|
||||
count++;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Printf("%d\n", count);
|
||||
|
@ -141,6 +151,9 @@ void Command_CountMobjs_f(void)
|
|||
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
if (((mobj_t *)th)->type == i)
|
||||
count++;
|
||||
}
|
||||
|
@ -158,6 +171,9 @@ void Command_CountMobjs_f(void)
|
|||
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
if (((mobj_t *)th)->type == i)
|
||||
count++;
|
||||
}
|
||||
|
@ -180,6 +196,10 @@ void P_InitThinkers(void)
|
|||
// Adds a new thinker at the end of the list.
|
||||
void P_AddThinker(const thinklistnum_t n, thinker_t *thinker)
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
I_Assert(n >= 0 && n < NUM_THINKERLISTS);
|
||||
#endif
|
||||
|
||||
thlist[n].prev->next = thinker;
|
||||
thinker->next = &thlist[n];
|
||||
thinker->prev = thlist[n].prev;
|
||||
|
@ -206,22 +226,33 @@ static thinker_t *currentthinker;
|
|||
// remove it, and set currentthinker to one node preceeding it, so
|
||||
// that the next step in P_RunThinkers() will get its successor.
|
||||
//
|
||||
void P_RemoveThinkerDelayed(void *pthinker)
|
||||
void P_RemoveThinkerDelayed(thinker_t *thinker)
|
||||
{
|
||||
thinker_t *thinker = pthinker;
|
||||
if (!thinker->references)
|
||||
thinker_t *next;
|
||||
#ifdef PARANOIA
|
||||
#define BEENAROUNDBIT (0x40000000) // has to be sufficiently high that it's unlikely to happen in regular gameplay. If you change this, pay attention to the bit pattern of INT32_MIN.
|
||||
if (thinker->references & ~BEENAROUNDBIT)
|
||||
{
|
||||
{
|
||||
/* Remove from main thinker list */
|
||||
thinker_t *next = thinker->next;
|
||||
/* Note that currentthinker is guaranteed to point to us,
|
||||
* and since we're freeing our memory, we had better change that. So
|
||||
* point it to thinker->prev, so the iterator will correctly move on to
|
||||
* thinker->prev->next = thinker->next */
|
||||
(next->prev = currentthinker = thinker->prev)->next = next;
|
||||
}
|
||||
Z_Free(thinker);
|
||||
if (thinker->references & BEENAROUNDBIT) // Usually gets cleared up in one frame; what's going on here, then?
|
||||
CONS_Printf("Number of potentially faulty references: %d\n", (thinker->references & ~BEENAROUNDBIT));
|
||||
thinker->references |= BEENAROUNDBIT;
|
||||
return;
|
||||
}
|
||||
#undef BEENAROUNDBIT
|
||||
#else
|
||||
if (thinker->references)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* Remove from main thinker list */
|
||||
next = thinker->next;
|
||||
/* Note that currentthinker is guaranteed to point to us,
|
||||
* and since we're freeing our memory, we had better change that. So
|
||||
* point it to thinker->prev, so the iterator will correctly move on to
|
||||
* thinker->prev->next = thinker->next */
|
||||
(next->prev = currentthinker = thinker->prev)->next = next;
|
||||
|
||||
Z_Free(thinker);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -238,23 +269,10 @@ void P_RemoveThinkerDelayed(void *pthinker)
|
|||
//
|
||||
void P_RemoveThinker(thinker_t *thinker)
|
||||
{
|
||||
thinker_t *next = thinker->next;
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidateUserdata(thinker);
|
||||
#endif
|
||||
thinker->function.acp1 = P_RemoveThinkerDelayed;
|
||||
|
||||
if (currentthinker == thinker)
|
||||
currentthinker = thinker->prev;
|
||||
|
||||
// Remove thinker from its current list.
|
||||
(next->prev = thinker->prev)->next = next;
|
||||
|
||||
// Now add it to the limbo list
|
||||
thlist[THINK_LIMBO].prev->next = thinker;
|
||||
thinker->next = &thlist[THINK_LIMBO];
|
||||
thinker->prev = thlist[THINK_LIMBO].prev;
|
||||
thlist[THINK_LIMBO].prev = thinker;
|
||||
thinker->function.acp1 = (actionf_p1)P_RemoveThinkerDelayed;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -307,8 +325,10 @@ static inline void P_RunThinkers(void)
|
|||
{
|
||||
for (currentthinker = thlist[i].next; currentthinker != &thlist[i]; currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1)
|
||||
currentthinker->function.acp1(currentthinker);
|
||||
#ifdef PARANOIA
|
||||
I_Assert(currentthinker->function.acp1 != NULL)
|
||||
#endif
|
||||
currentthinker->function.acp1(currentthinker);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ void Command_CountMobjs_f(void);
|
|||
void P_Ticker(boolean run);
|
||||
void P_PreTicker(INT32 frames);
|
||||
void P_DoTeamscrambling(void);
|
||||
void P_RemoveThinkerDelayed(void *pthinker); //killed
|
||||
void P_RemoveThinkerDelayed(thinker_t *thinker); //killed
|
||||
mobj_t *P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98
|
||||
|
||||
#endif
|
||||
|
|
372
src/p_user.c
372
src/p_user.c
|
@ -345,9 +345,16 @@ UINT8 P_FindLowestMare(void)
|
|||
// to find the egg capsule with the lowest mare
|
||||
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->type == MT_EGGCAPSULE && mo2->health > 0)
|
||||
if (mo2->type != MT_EGGCAPSULE)
|
||||
continue;
|
||||
if (mo2->health <= 0)
|
||||
continue;
|
||||
|
||||
{
|
||||
const UINT8 threshold = (UINT8)mo2->threshold;
|
||||
if (mare == 255)
|
||||
|
@ -391,29 +398,32 @@ boolean P_TransferToNextMare(player_t *player)
|
|||
// to find the closest axis point
|
||||
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->type == MT_AXIS)
|
||||
{
|
||||
if (mo2->threshold == mare)
|
||||
{
|
||||
if (closestaxis == NULL)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
lowestaxisnum = mo2->health;
|
||||
dist2 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y)-mo2->radius;
|
||||
}
|
||||
else if (mo2->health < lowestaxisnum)
|
||||
{
|
||||
dist1 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y)-mo2->radius;
|
||||
if (mo2->type != MT_AXIS)
|
||||
continue;
|
||||
|
||||
if (dist1 < dist2)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
lowestaxisnum = mo2->health;
|
||||
dist2 = dist1;
|
||||
}
|
||||
}
|
||||
if (mo2->threshold != mare)
|
||||
continue;
|
||||
|
||||
if (closestaxis == NULL)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
lowestaxisnum = mo2->health;
|
||||
dist2 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y) - mo2->radius;
|
||||
}
|
||||
else if (mo2->health < lowestaxisnum)
|
||||
{
|
||||
dist1 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y) - mo2->radius;
|
||||
|
||||
if (dist1 < dist2)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
lowestaxisnum = mo2->health;
|
||||
dist2 = dist1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -439,17 +449,22 @@ static mobj_t *P_FindAxis(INT32 mare, INT32 axisnum)
|
|||
// to find the closest axis point
|
||||
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;
|
||||
|
||||
// Axis things are only at beginning of list.
|
||||
if (!(mo2->flags2 & MF2_AXIS))
|
||||
return NULL;
|
||||
|
||||
if (mo2->type == MT_AXIS)
|
||||
{
|
||||
if (mo2->health == axisnum && mo2->threshold == mare)
|
||||
return mo2;
|
||||
}
|
||||
if (mo2->type != MT_AXIS)
|
||||
continue;
|
||||
if (mo2->health != axisnum)
|
||||
continue;
|
||||
if (mo2->threshold != mare)
|
||||
continue;
|
||||
return mo2;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -469,17 +484,22 @@ static mobj_t *P_FindAxisTransfer(INT32 mare, INT32 axisnum, mobjtype_t type)
|
|||
// to find the closest axis point
|
||||
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;
|
||||
|
||||
// Axis things are only at beginning of list.
|
||||
if (!(mo2->flags2 & MF2_AXIS))
|
||||
return NULL;
|
||||
|
||||
if (mo2->type == type)
|
||||
{
|
||||
if (mo2->health == axisnum && mo2->threshold == mare)
|
||||
return mo2;
|
||||
}
|
||||
if (mo2->type != type)
|
||||
continue;
|
||||
if (mo2->health != axisnum)
|
||||
continue;
|
||||
if (mo2->threshold != mare)
|
||||
continue;
|
||||
return mo2;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -505,27 +525,31 @@ void P_TransferToAxis(player_t *player, INT32 axisnum)
|
|||
// to find the closest axis point
|
||||
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->type == MT_AXIS)
|
||||
{
|
||||
if (mo2->health == axisnum && mo2->threshold == mare)
|
||||
{
|
||||
if (closestaxis == NULL)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
dist2 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y)-mo2->radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
dist1 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y)-mo2->radius;
|
||||
if (mo2->type != MT_AXIS)
|
||||
continue;
|
||||
if (mo2->health != axisnum)
|
||||
continue;
|
||||
if (mo2->threshold != mare)
|
||||
continue;
|
||||
|
||||
if (dist1 < dist2)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
dist2 = dist1;
|
||||
}
|
||||
}
|
||||
if (closestaxis == NULL)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
dist2 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y) - mo2->radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
dist1 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y) - mo2->radius;
|
||||
|
||||
if (dist1 < dist2)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
dist2 = dist1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -602,6 +626,9 @@ static void P_DeNightserizePlayer(player_t *player)
|
|||
// Check to see if the player should be killed.
|
||||
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->type == MT_NIGHTSDRONE))
|
||||
continue;
|
||||
|
@ -1617,6 +1644,9 @@ void P_SpawnShieldOrb(player_t *player)
|
|||
// blaze through the thinkers to see if an orb already exists!
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
shieldobj = (mobj_t *)th;
|
||||
|
||||
if (shieldobj->type == orbtype && shieldobj->target == player->mo)
|
||||
|
@ -3625,7 +3655,8 @@ static void P_DoTeeter(player_t *player)
|
|||
if (teeter) // only bother with objects as a last resort if you were already teetering
|
||||
{
|
||||
mobj_t *oldtmthing = tmthing;
|
||||
tmthing = teeterer = player->mo;
|
||||
teeterer = player->mo;
|
||||
P_SetTarget(&tmthing, teeterer);
|
||||
teeterxl = teeterxh = player->mo->x;
|
||||
teeteryl = teeteryh = player->mo->y;
|
||||
couldteeter = false;
|
||||
|
@ -3639,7 +3670,7 @@ static void P_DoTeeter(player_t *player)
|
|||
}
|
||||
teeterdone:
|
||||
teeter = solidteeter;
|
||||
tmthing = oldtmthing; // restore old tmthing, goodness knows what the game does with this before mobj thinkers
|
||||
P_SetTarget(&tmthing, oldtmthing); // restore old tmthing, goodness knows what the game does with this before mobj thinkers
|
||||
}
|
||||
}
|
||||
if (teeter)
|
||||
|
@ -4314,7 +4345,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
|
|||
if (P_IsLocalPlayer(player)) // Only display it on your own view.
|
||||
{
|
||||
mobj_t *visual = P_SpawnMobj(lockon->x, lockon->y, lockon->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker
|
||||
visual->target = lockon;
|
||||
P_SetTarget(&visual->target, lockon);
|
||||
}
|
||||
}
|
||||
if ((cmd->buttons & BT_USE) && !(player->pflags & PF_USEDOWN))
|
||||
|
@ -4589,6 +4620,9 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range)
|
|||
|
||||
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 == player->mo)
|
||||
|
@ -4637,7 +4671,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
if (P_IsLocalPlayer(player)) // Only display it on your own view.
|
||||
{
|
||||
mobj_t *visual = P_SpawnMobj(lockon->x, lockon->y, lockon->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker
|
||||
visual->target = lockon;
|
||||
P_SetTarget(&visual->target, lockon);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5783,29 +5817,32 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad
|
|||
// Find next waypoint
|
||||
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;
|
||||
|
||||
// Axis things are only at beginning of list.
|
||||
if (!(mo2->flags2 & MF2_AXIS))
|
||||
break;
|
||||
if (!(mo2->type == MT_AXISTRANSFER || mo2->type == MT_AXISTRANSFERLINE))
|
||||
continue;
|
||||
if (mo2->threshold != sequence)
|
||||
continue;
|
||||
|
||||
if ((mo2->type == MT_AXISTRANSFER || mo2->type == MT_AXISTRANSFERLINE)
|
||||
&& mo2->threshold == sequence)
|
||||
if (player->pflags & PF_TRANSFERTOCLOSEST)
|
||||
{
|
||||
if (player->pflags & PF_TRANSFERTOCLOSEST)
|
||||
{
|
||||
if (mo2->health == player->axis1->health)
|
||||
transfer1 = mo2;
|
||||
else if (mo2->health == player->axis2->health)
|
||||
transfer2 = mo2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == player->mo->target->health)
|
||||
transfer1 = mo2;
|
||||
else if (mo2->health == player->mo->target->health + 1)
|
||||
transfer2 = mo2;
|
||||
}
|
||||
if (mo2->health == player->axis1->health)
|
||||
transfer1 = mo2;
|
||||
else if (mo2->health == player->axis2->health)
|
||||
transfer2 = mo2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mo2->health == player->mo->target->health)
|
||||
transfer1 = mo2;
|
||||
else if (mo2->health == player->mo->target->health + 1)
|
||||
transfer2 = mo2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5816,24 +5853,28 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad
|
|||
{
|
||||
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;
|
||||
|
||||
// Axis things are only at beginning of list.
|
||||
if (!(mo2->flags2 & MF2_AXIS))
|
||||
break;
|
||||
if (!(mo2->type == MT_AXISTRANSFER || mo2->type == MT_AXISTRANSFERLINE))
|
||||
continue;
|
||||
if (mo2->threshold != sequence)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == sequence && (mo2->type == MT_AXISTRANSFER || mo2->type == MT_AXISTRANSFERLINE))
|
||||
if (!transfer1)
|
||||
{
|
||||
if (!transfer1)
|
||||
{
|
||||
transfer1 = mo2;
|
||||
transfer1last = true;
|
||||
}
|
||||
else if (mo2->health > transfer1->health)
|
||||
{
|
||||
transfer1 = mo2;
|
||||
transfer1last = true;
|
||||
}
|
||||
transfer1 = mo2;
|
||||
transfer1last = true;
|
||||
}
|
||||
else if (mo2->health > transfer1->health)
|
||||
{
|
||||
transfer1 = mo2;
|
||||
transfer1last = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5841,24 +5882,28 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad
|
|||
{
|
||||
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;
|
||||
|
||||
// Axis things are only at beginning of list.
|
||||
if (!(mo2->flags2 & MF2_AXIS))
|
||||
break;
|
||||
if (!(mo2->type == MT_AXISTRANSFER || mo2->type == MT_AXISTRANSFERLINE))
|
||||
continue;
|
||||
if (mo2->threshold != sequence)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == sequence && (mo2->type == MT_AXISTRANSFER || mo2->type == MT_AXISTRANSFERLINE))
|
||||
if (!transfer2)
|
||||
{
|
||||
if (!transfer2)
|
||||
{
|
||||
transfer2 = mo2;
|
||||
transfer2last = true;
|
||||
}
|
||||
else if (mo2->health > transfer2->health)
|
||||
{
|
||||
transfer2 = mo2;
|
||||
transfer2last = true;
|
||||
}
|
||||
transfer2 = mo2;
|
||||
transfer2last = true;
|
||||
}
|
||||
else if (mo2->health > transfer2->health)
|
||||
{
|
||||
transfer2 = mo2;
|
||||
transfer2last = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6545,31 +6590,32 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
// to find the closest axis point
|
||||
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->type == MT_AXIS)
|
||||
{
|
||||
if (mo2->threshold == player->mare)
|
||||
{
|
||||
if (closestaxis == NULL)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
dist2 = R_PointToDist2(newx, newy, mo2->x, mo2->y)-mo2->radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
dist1 = R_PointToDist2(newx, newy, mo2->x, mo2->y)-mo2->radius;
|
||||
if (mo2->type != MT_AXIS)
|
||||
continue;
|
||||
if (mo2->threshold != player->mare)
|
||||
continue;
|
||||
|
||||
if (dist1 < dist2)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
dist2 = dist1;
|
||||
}
|
||||
}
|
||||
if (closestaxis == NULL)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
dist2 = R_PointToDist2(newx, newy, mo2->x, mo2->y) - mo2->radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
dist1 = R_PointToDist2(newx, newy, mo2->x, mo2->y) - mo2->radius;
|
||||
|
||||
if (dist1 < dist2)
|
||||
{
|
||||
closestaxis = mo2;
|
||||
dist2 = dist1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
P_SetTarget(&player->mo->target, closestaxis);
|
||||
}
|
||||
|
||||
|
@ -7352,6 +7398,9 @@ static void P_MovePlayer(player_t *player)
|
|||
|
||||
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->type == MT_EGGCAPSULE
|
||||
|
@ -7855,7 +7904,7 @@ static void P_MovePlayer(player_t *player)
|
|||
if (P_IsLocalPlayer(player)) // Only display it on your own view.
|
||||
{
|
||||
mobj_t *visual = P_SpawnMobj(lockon->x, lockon->y, lockon->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker
|
||||
visual->target = lockon;
|
||||
P_SetTarget(&visual->target, lockon);
|
||||
P_SetMobjStateNF(visual, visual->info->spawnstate+1);
|
||||
}
|
||||
}
|
||||
|
@ -8256,20 +8305,25 @@ static void P_DoZoomTube(player_t *player)
|
|||
// Find next waypoint
|
||||
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->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == sequence)
|
||||
{
|
||||
if ((reverse && mo2->health == player->mo->tracer->health - 1)
|
||||
|| (!reverse && mo2->health == player->mo->tracer->health + 1))
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mo2->threshold != sequence)
|
||||
continue;
|
||||
|
||||
if (reverse && mo2->health != player->mo->tracer->health - 1)
|
||||
continue;
|
||||
|
||||
if (!reverse && mo2->health != player->mo->tracer->health + 1)
|
||||
continue;
|
||||
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (waypoint)
|
||||
|
@ -8387,19 +8441,22 @@ static void P_DoRopeHang(player_t *player)
|
|||
// Find next waypoint
|
||||
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->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == sequence)
|
||||
{
|
||||
if (mo2->health == player->mo->tracer->health + 1)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mo2->threshold != sequence)
|
||||
continue;
|
||||
|
||||
if (mo2->health != player->mo->tracer->health + 1)
|
||||
continue;
|
||||
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(player->mo->tracer->flags & MF_SLIDEME) && !waypoint)
|
||||
|
@ -8409,19 +8466,22 @@ static void P_DoRopeHang(player_t *player)
|
|||
// Wrap around back to first waypoint
|
||||
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->type != MT_TUBEWAYPOINT)
|
||||
continue;
|
||||
|
||||
if (mo2->threshold == sequence)
|
||||
{
|
||||
if (mo2->health == 0)
|
||||
{
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mo2->threshold != sequence)
|
||||
continue;
|
||||
|
||||
if (mo2->health != 0)
|
||||
continue;
|
||||
|
||||
waypoint = mo2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8468,22 +8528,22 @@ static void P_DoRopeHang(player_t *player)
|
|||
static void P_NukeAllPlayers(player_t *player)
|
||||
{
|
||||
mobj_t *mo;
|
||||
thinker_t *think;
|
||||
UINT8 i;
|
||||
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (!mo->player)
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
if (players[i].spectator)
|
||||
continue;
|
||||
if (!players[i].mo)
|
||||
continue;
|
||||
if (players[i].mo == player->mo)
|
||||
continue;
|
||||
if (players[i].mo->health <= 0)
|
||||
continue;
|
||||
|
||||
if (mo->health <= 0) // dead
|
||||
continue;
|
||||
|
||||
if (mo == player->mo)
|
||||
continue;
|
||||
|
||||
P_DamageMobj(mo, player->mo, player->mo, 1, 0);
|
||||
P_DamageMobj(players[i].mo, player->mo, player->mo, 1, 0);
|
||||
}
|
||||
|
||||
CONS_Printf(M_GetText("%s caused a world of pain.\n"), player_names[player-players]);
|
||||
|
@ -8517,6 +8577,9 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
|
|||
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (!(mo->flags & MF_SHOOTABLE) && !(mo->type == MT_EGGGUARD || mo->type == MT_MINUS))
|
||||
|
@ -8565,6 +8628,9 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet)
|
|||
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
if (!((mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR) && (mo->flags & MF_SHOOTABLE)) || (mo->flags & MF_SPRING)) == !(mo->flags2 & MF2_INVERTAIMABLE)) // allows if it has the flags desired XOR it has the invert aimable flag
|
||||
continue; // not a valid target
|
||||
|
@ -8706,6 +8772,9 @@ void P_FindEmerald(void)
|
|||
// to find all emeralds
|
||||
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->type == MT_EMERHUNT)
|
||||
{
|
||||
|
@ -9931,6 +10000,9 @@ static mobj_t *P_GetAxis(INT32 num)
|
|||
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
continue;
|
||||
|
||||
mobj = (mobj_t *)th;
|
||||
|
||||
// NiGHTS axes spawn before anything else. If this mobj doesn't have MF2_AXIS, it means we reached the axes' end.
|
||||
|
@ -9943,6 +10015,7 @@ static mobj_t *P_GetAxis(INT32 num)
|
|||
|
||||
return mobj;
|
||||
}
|
||||
|
||||
CONS_Alert(CONS_WARNING, "P_GetAxis: Track segment %d is missing!\n", num);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -10569,6 +10642,9 @@ void P_PlayerThink(player_t *player)
|
|||
|
||||
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->type == MT_RING || mo2->type == MT_COIN
|
||||
|
|
|
@ -2276,7 +2276,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++)
|
||||
|
|
|
@ -2308,27 +2308,31 @@ static void ST_doItemFinderIconsAndSound(void)
|
|||
// Scan thinkers to find emblem mobj with these ids
|
||||
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->type == MT_EMBLEM)
|
||||
if (mo2->type != MT_EMBLEM)
|
||||
continue;
|
||||
|
||||
if (!(mo2->flags & MF_SPECIAL))
|
||||
continue;
|
||||
|
||||
for (i = 0; i < stemblems; ++i)
|
||||
{
|
||||
if (!(mo2->flags & MF_SPECIAL))
|
||||
continue;
|
||||
|
||||
for (i = 0; i < stemblems; ++i)
|
||||
if (mo2->health == emblems[i] + 1)
|
||||
{
|
||||
if (mo2->health == emblems[i]+1)
|
||||
{
|
||||
soffset = (i * 20) - ((stemblems-1) * 10);
|
||||
soffset = (i * 20) - ((stemblems - 1) * 10);
|
||||
|
||||
newinterval = ST_drawEmeraldHuntIcon(mo2, itemhoming, soffset);
|
||||
if (newinterval && (!interval || newinterval < interval))
|
||||
interval = newinterval;
|
||||
newinterval = ST_drawEmeraldHuntIcon(mo2, itemhoming, soffset);
|
||||
if (newinterval && (!interval || newinterval < interval))
|
||||
interval = newinterval;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!(P_AutoPause() || paused) && interval > 0 && leveltime && leveltime % interval == 0)
|
||||
|
|
Loading…
Reference in a new issue