Merge branch 'next' of http://git.magicalgirl.moe/STJr/SRB2.git into toast_slopes

# Conflicts:
#	src/p_user.c
This commit is contained in:
toasterbabe 2016-06-19 16:59:49 +01:00
commit fa58993bda
6 changed files with 88 additions and 188 deletions

View File

@ -1163,7 +1163,7 @@ void T_SpikeSector(levelspecthink_t *spikes)
node = spikes->sector->touching_thinglist; // things touching this sector node = spikes->sector->touching_thinglist; // things touching this sector
for (; node; node = node->m_snext) for (; node; node = node->m_thinglist_next)
{ {
thing = node->m_thing; thing = node->m_thing;
if (!thing->player) if (!thing->player)
@ -1316,7 +1316,7 @@ void T_BridgeThinker(levelspecthink_t *bridge)
controlsec = &sectors[k]; controlsec = &sectors[k];
// Is a player standing on me? // Is a player standing on me?
for (node = sector->touching_thinglist; node; node = node->m_snext) for (node = sector->touching_thinglist; node; node = node->m_thinglist_next)
{ {
thing = node->m_thing; thing = node->m_thing;
@ -1739,7 +1739,7 @@ wegotit:
static mobj_t *SearchMarioNode(msecnode_t *node) static mobj_t *SearchMarioNode(msecnode_t *node)
{ {
mobj_t *thing = NULL; mobj_t *thing = NULL;
for (; node; node = node->m_snext) for (; node; node = node->m_thinglist_next)
{ {
// Things which should NEVER be ejected from a MarioBlock, by type. // Things which should NEVER be ejected from a MarioBlock, by type.
switch (node->m_thing->type) switch (node->m_thing->type)
@ -2003,7 +2003,7 @@ void T_NoEnemiesSector(levelspecthink_t *nobaddies)
goto foundenemy; goto foundenemy;
} }
node = node->m_snext; node = node->m_thinglist_next;
} }
} }
} }
@ -2288,7 +2288,7 @@ void T_RaiseSector(levelspecthink_t *raise)
sector = &sectors[i]; sector = &sectors[i];
// Is a player standing on me? // Is a player standing on me?
for (node = sector->touching_thinglist; node; node = node->m_snext) for (node = sector->touching_thinglist; node; node = node->m_thinglist_next)
{ {
thing = node->m_thing; thing = node->m_thing;

View File

@ -3365,7 +3365,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
for (i = 0; i < sector->numattached; i++) for (i = 0; i < sector->numattached; i++)
{ {
sec = &sectors[sector->attached[i]]; sec = &sectors[sector->attached[i]];
for (n = sec->touching_thinglist; n; n = n->m_snext) for (n = sec->touching_thinglist; n; n = n->m_thinglist_next)
n->visited = false; n->visited = false;
sec->moved = true; sec->moved = true;
@ -3377,7 +3377,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
do do
{ {
for (n = sec->touching_thinglist; n; n = n->m_snext) for (n = sec->touching_thinglist; n; n = n->m_thinglist_next)
if (!n->visited) if (!n->visited)
{ {
n->visited = true; n->visited = true;
@ -3398,12 +3398,12 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
// Mark all things invalid // Mark all things invalid
sector->moved = true; sector->moved = true;
for (n = sector->touching_thinglist; n; n = n->m_snext) for (n = sector->touching_thinglist; n; n = n->m_thinglist_next)
n->visited = false; n->visited = false;
do do
{ {
for (n = sector->touching_thinglist; n; n = n->m_snext) // go through list for (n = sector->touching_thinglist; n; n = n->m_thinglist_next) // go through list
if (!n->visited) // unprocessed thing found if (!n->visited) // unprocessed thing found
{ {
n->visited = true; // mark thing as processed n->visited = true; // mark thing as processed
@ -3427,7 +3427,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
for (i = 0; i < sector->numattached; i++) for (i = 0; i < sector->numattached; i++)
{ {
sec = &sectors[sector->attached[i]]; sec = &sectors[sector->attached[i]];
for (n = sec->touching_thinglist; n; n = n->m_snext) for (n = sec->touching_thinglist; n; n = n->m_thinglist_next)
n->visited = false; n->visited = false;
sec->moved = true; sec->moved = true;
@ -3439,7 +3439,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
do do
{ {
for (n = sec->touching_thinglist; n; n = n->m_snext) for (n = sec->touching_thinglist; n; n = n->m_thinglist_next)
if (!n->visited) if (!n->visited)
{ {
n->visited = true; n->visited = true;
@ -3457,12 +3457,12 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
// Mark all things invalid // Mark all things invalid
sector->moved = true; sector->moved = true;
for (n = sector->touching_thinglist; n; n = n->m_snext) for (n = sector->touching_thinglist; n; n = n->m_thinglist_next)
n->visited = false; n->visited = false;
do do
{ {
for (n = sector->touching_thinglist; n; n = n->m_snext) // go through list for (n = sector->touching_thinglist; n; n = n->m_thinglist_next) // go through list
if (!n->visited) // unprocessed thing found if (!n->visited) // unprocessed thing found
{ {
n->visited = true; // mark thing as processed n->visited = true; // mark thing as processed
@ -3502,7 +3502,7 @@ static msecnode_t *P_GetSecnode(void)
if (headsecnode) if (headsecnode)
{ {
node = headsecnode; node = headsecnode;
headsecnode = headsecnode->m_snext; headsecnode = headsecnode->m_thinglist_next;
} }
else else
node = Z_Calloc(sizeof (*node), PU_LEVEL, NULL); node = Z_Calloc(sizeof (*node), PU_LEVEL, NULL);
@ -3516,7 +3516,7 @@ static mprecipsecnode_t *P_GetPrecipSecnode(void)
if (headprecipsecnode) if (headprecipsecnode)
{ {
node = headprecipsecnode; node = headprecipsecnode;
headprecipsecnode = headprecipsecnode->m_snext; headprecipsecnode = headprecipsecnode->m_thinglist_next;
} }
else else
node = Z_Calloc(sizeof (*node), PU_LEVEL, NULL); node = Z_Calloc(sizeof (*node), PU_LEVEL, NULL);
@ -3527,14 +3527,14 @@ static mprecipsecnode_t *P_GetPrecipSecnode(void)
static inline void P_PutSecnode(msecnode_t *node) static inline void P_PutSecnode(msecnode_t *node)
{ {
node->m_snext = headsecnode; node->m_thinglist_next = headsecnode;
headsecnode = node; headsecnode = node;
} }
// Tails 08-25-2002 // Tails 08-25-2002
static inline void P_PutPrecipSecnode(mprecipsecnode_t *node) static inline void P_PutPrecipSecnode(mprecipsecnode_t *node)
{ {
node->m_snext = headprecipsecnode; node->m_thinglist_next = headprecipsecnode;
headprecipsecnode = node; headprecipsecnode = node;
} }
@ -3555,7 +3555,7 @@ static msecnode_t *P_AddSecnode(sector_t *s, mobj_t *thing, msecnode_t *nextnode
node->m_thing = thing; // Yes. Setting m_thing says 'keep it'. node->m_thing = thing; // Yes. Setting m_thing says 'keep it'.
return nextnode; return nextnode;
} }
node = node->m_tnext; node = node->m_sectorlist_next;
} }
// Couldn't find an existing node for this sector. Add one at the head // Couldn't find an existing node for this sector. Add one at the head
@ -3568,17 +3568,17 @@ static msecnode_t *P_AddSecnode(sector_t *s, mobj_t *thing, msecnode_t *nextnode
node->m_sector = s; // sector node->m_sector = s; // sector
node->m_thing = thing; // mobj node->m_thing = thing; // mobj
node->m_tprev = NULL; // prev node on Thing thread node->m_sectorlist_prev = NULL; // prev node on Thing thread
node->m_tnext = nextnode; // next node on Thing thread node->m_sectorlist_next = nextnode; // next node on Thing thread
if (nextnode) if (nextnode)
nextnode->m_tprev = node; // set back link on Thing nextnode->m_sectorlist_prev = node; // set back link on Thing
// Add new node at head of sector thread starting at s->touching_thinglist // Add new node at head of sector thread starting at s->touching_thinglist
node->m_sprev = NULL; // prev node on sector thread node->m_thinglist_prev = NULL; // prev node on sector thread
node->m_snext = s->touching_thinglist; // next node on sector thread node->m_thinglist_next = s->touching_thinglist; // next node on sector thread
if (s->touching_thinglist) if (s->touching_thinglist)
node->m_snext->m_sprev = node; node->m_thinglist_next->m_thinglist_prev = node;
s->touching_thinglist = node; s->touching_thinglist = node;
return node; return node;
} }
@ -3596,7 +3596,7 @@ static mprecipsecnode_t *P_AddPrecipSecnode(sector_t *s, precipmobj_t *thing, mp
node->m_thing = thing; // Yes. Setting m_thing says 'keep it'. node->m_thing = thing; // Yes. Setting m_thing says 'keep it'.
return nextnode; return nextnode;
} }
node = node->m_tnext; node = node->m_sectorlist_next;
} }
// Couldn't find an existing node for this sector. Add one at the head // Couldn't find an existing node for this sector. Add one at the head
@ -3609,17 +3609,17 @@ static mprecipsecnode_t *P_AddPrecipSecnode(sector_t *s, precipmobj_t *thing, mp
node->m_sector = s; // sector node->m_sector = s; // sector
node->m_thing = thing; // mobj node->m_thing = thing; // mobj
node->m_tprev = NULL; // prev node on Thing thread node->m_sectorlist_prev = NULL; // prev node on Thing thread
node->m_tnext = nextnode; // next node on Thing thread node->m_sectorlist_next = nextnode; // next node on Thing thread
if (nextnode) if (nextnode)
nextnode->m_tprev = node; // set back link on Thing nextnode->m_sectorlist_prev = node; // set back link on Thing
// Add new node at head of sector thread starting at s->touching_thinglist // Add new node at head of sector thread starting at s->touching_thinglist
node->m_sprev = NULL; // prev node on sector thread node->m_thinglist_prev = NULL; // prev node on sector thread
node->m_snext = s->touching_preciplist; // next node on sector thread node->m_thinglist_next = s->touching_preciplist; // next node on sector thread
if (s->touching_preciplist) if (s->touching_preciplist)
node->m_snext->m_sprev = node; node->m_thinglist_next->m_thinglist_prev = node;
s->touching_preciplist = node; s->touching_preciplist = node;
return node; return node;
} }
@ -3641,24 +3641,24 @@ static msecnode_t *P_DelSecnode(msecnode_t *node)
// Unlink from the Thing thread. The Thing thread begins at // Unlink from the Thing thread. The Thing thread begins at
// sector_list and not from mobj_t->touching_sectorlist. // sector_list and not from mobj_t->touching_sectorlist.
tp = node->m_tprev; tp = node->m_sectorlist_prev;
tn = node->m_tnext; tn = node->m_sectorlist_next;
if (tp) if (tp)
tp->m_tnext = tn; tp->m_sectorlist_next = tn;
if (tn) if (tn)
tn->m_tprev = tp; tn->m_sectorlist_prev = tp;
// Unlink from the sector thread. This thread begins at // Unlink from the sector thread. This thread begins at
// sector_t->touching_thinglist. // sector_t->touching_thinglist.
sp = node->m_sprev; sp = node->m_thinglist_prev;
sn = node->m_snext; sn = node->m_thinglist_next;
if (sp) if (sp)
sp->m_snext = sn; sp->m_thinglist_next = sn;
else else
node->m_sector->touching_thinglist = sn; node->m_sector->touching_thinglist = sn;
if (sn) if (sn)
sn->m_sprev = sp; sn->m_thinglist_prev = sp;
// Return this node to the freelist // Return this node to the freelist
@ -3680,24 +3680,24 @@ static mprecipsecnode_t *P_DelPrecipSecnode(mprecipsecnode_t *node)
// Unlink from the Thing thread. The Thing thread begins at // Unlink from the Thing thread. The Thing thread begins at
// sector_list and not from mobj_t->touching_sectorlist. // sector_list and not from mobj_t->touching_sectorlist.
tp = node->m_tprev; tp = node->m_sectorlist_prev;
tn = node->m_tnext; tn = node->m_sectorlist_next;
if (tp) if (tp)
tp->m_tnext = tn; tp->m_sectorlist_next = tn;
if (tn) if (tn)
tn->m_tprev = tp; tn->m_sectorlist_prev = tp;
// Unlink from the sector thread. This thread begins at // Unlink from the sector thread. This thread begins at
// sector_t->touching_thinglist. // sector_t->touching_thinglist.
sp = node->m_sprev; sp = node->m_thinglist_prev;
sn = node->m_snext; sn = node->m_thinglist_next;
if (sp) if (sp)
sp->m_snext = sn; sp->m_thinglist_next = sn;
else else
node->m_sector->touching_preciplist = sn; node->m_sector->touching_preciplist = sn;
if (sn) if (sn)
sn->m_sprev = sp; sn->m_thinglist_prev = sp;
// Return this node to the freelist // Return this node to the freelist
@ -3812,7 +3812,7 @@ void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y)
while (node) while (node)
{ {
node->m_thing = NULL; node->m_thing = NULL;
node = node->m_tnext; node = node->m_sectorlist_next;
} }
P_SetTarget(&tmthing, thing); P_SetTarget(&tmthing, thing);
@ -3850,11 +3850,11 @@ void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y)
if (!node->m_thing) if (!node->m_thing)
{ {
if (node == sector_list) if (node == sector_list)
sector_list = node->m_tnext; sector_list = node->m_sectorlist_next;
node = P_DelSecnode(node); node = P_DelSecnode(node);
} }
else else
node = node->m_tnext; node = node->m_sectorlist_next;
} }
/* cph - /* cph -
@ -3895,7 +3895,7 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing,fixed_t x,fixed_t y)
while (node) while (node)
{ {
node->m_thing = NULL; node->m_thing = NULL;
node = node->m_tnext; node = node->m_sectorlist_next;
} }
tmprecipthing = thing; tmprecipthing = thing;
@ -3929,11 +3929,11 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing,fixed_t x,fixed_t y)
if (!node->m_thing) if (!node->m_thing)
{ {
if (node == precipsector_list) if (node == precipsector_list)
precipsector_list = node->m_tnext; precipsector_list = node->m_sectorlist_next;
node = P_DelPrecipSecnode(node); node = P_DelPrecipSecnode(node);
} }
else else
node = node->m_tnext; node = node->m_sectorlist_next;
} }
/* cph - /* cph -

View File

@ -1545,7 +1545,7 @@ static void P_PushableCheckBustables(mobj_t *mo)
mo->y += mo->momy; mo->y += mo->momy;
P_SetThingPosition(mo); P_SetThingPosition(mo);
for (node = mo->touching_sectorlist; node; node = node->m_snext) for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
if (!node->m_sector) if (!node->m_sector)
break; break;
@ -2717,7 +2717,7 @@ static void P_PlayerZMovement(mobj_t *mo)
msecnode_t *node; msecnode_t *node;
boolean stopmovecut = false; boolean stopmovecut = false;
for (node = mo->touching_sectorlist; node; node = node->m_snext) for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
sector_t *sec = node->m_sector; sector_t *sec = node->m_sector;
subsector_t *newsubsec; subsector_t *newsubsec;
@ -2894,7 +2894,7 @@ nightsdone:
if (CheckForMarioBlocks && !(netgame && mo->player->spectator)) // Only let the player punch if (CheckForMarioBlocks && !(netgame && mo->player->spectator)) // Only let the player punch
{ {
// Search the touching sectors, from side-to-side... // Search the touching sectors, from side-to-side...
for (node = mo->touching_sectorlist; node; node = node->m_snext) for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
ffloor_t *rover; ffloor_t *rover;
if (!node->m_sector->ffloors) if (!node->m_sector->ffloors)
@ -3662,7 +3662,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
if (!(netgame && mobj->player->spectator)) if (!(netgame && mobj->player->spectator))
{ {
// Crumbling platforms // Crumbling platforms
for (node = mobj->touching_sectorlist; node; node = node->m_snext) for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
fixed_t topheight, bottomheight; fixed_t topheight, bottomheight;
ffloor_t *rover; ffloor_t *rover;
@ -3687,7 +3687,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
{ {
boolean thereiswater = false; boolean thereiswater = false;
for (node = mobj->touching_sectorlist; node; node = node->m_snext) for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
if (node->m_sector->ffloors) if (node->m_sector->ffloors)
{ {
@ -3708,7 +3708,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
} }
if (thereiswater) if (thereiswater)
{ {
for (node = mobj->touching_sectorlist; node; node = node->m_snext) for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
if (node->m_sector->ffloors) if (node->m_sector->ffloors)
{ {
@ -3821,7 +3821,7 @@ void P_RecalcPrecipInSector(sector_t *sector)
sector->moved = true; // Recalc lighting and things too, maybe sector->moved = true; // Recalc lighting and things too, maybe
for (psecnode = sector->touching_preciplist; psecnode; psecnode = psecnode->m_snext) for (psecnode = sector->touching_preciplist; psecnode; psecnode = psecnode->m_thinglist_next)
CalculatePrecipFloor(psecnode->m_thing); CalculatePrecipFloor(psecnode->m_thing);
} }

View File

@ -1642,7 +1642,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
mo = node->m_thing; mo = node->m_thing;
if (mo->flags & MF_PUSHABLE) if (mo->flags & MF_PUSHABLE)
numpush++; numpush++;
node = node->m_snext; node = node->m_thinglist_next;
} }
if (triggerline->flags & ML_NOCLIMB) // Need at least or more if (triggerline->flags & ML_NOCLIMB) // Need at least or more
@ -3144,7 +3144,7 @@ void P_SetupSignExit(player_t *player)
thinker_t *think; thinker_t *think;
INT32 numfound = 0; INT32 numfound = 0;
for (; node; node = node->m_snext) for (; node; node = node->m_thinglist_next)
{ {
thing = node->m_thing; thing = node->m_thing;
if (thing->type != MT_SIGN) if (thing->type != MT_SIGN)
@ -3308,7 +3308,7 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n
return rover->master->frontsector; return rover->master->frontsector;
} }
for (node = player->mo->touching_sectorlist; node; node = node->m_snext) for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
if (GETSECSPECIAL(node->m_sector->special, section) == number) if (GETSECSPECIAL(node->m_sector->special, section) == number)
{ {
@ -4657,7 +4657,7 @@ void P_PlayerInSpecialSector(player_t *player)
P_RunSpecialSectorCheck(player, sector); P_RunSpecialSectorCheck(player, sector);
// Iterate through touching_sectorlist // Iterate through touching_sectorlist
for (node = player->mo->touching_sectorlist; node; node = node->m_snext) for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
sector = node->m_sector; sector = node->m_sector;
@ -5308,7 +5308,7 @@ void T_LaserFlash(laserthink_t *flash)
S_StartSound(&sector->soundorg, sfx_laser); S_StartSound(&sector->soundorg, sfx_laser);
// Seek out objects to DESTROY! MUAHAHHAHAHAA!!!*cough* // Seek out objects to DESTROY! MUAHAHHAHAHAA!!!*cough*
for (node = sector->touching_thinglist; node && node->m_thing; node = node->m_snext) for (node = sector->touching_thinglist; node && node->m_thing; node = node->m_thinglist_next)
{ {
thing = node->m_thing; thing = node->m_thing;
@ -6579,7 +6579,7 @@ void T_Scroll(scroll_t *s)
sector_t *psec; sector_t *psec;
psec = sectors + sect; psec = sectors + sect;
for (node = psec->touching_thinglist; node; node = node->m_snext) for (node = psec->touching_thinglist; node; node = node->m_thinglist_next)
{ {
thing = node->m_thing; thing = node->m_thing;
@ -6601,7 +6601,7 @@ void T_Scroll(scroll_t *s)
if (!is3dblock) if (!is3dblock)
{ {
for (node = sec->touching_thinglist; node; node = node->m_snext) for (node = sec->touching_thinglist; node; node = node->m_thinglist_next)
{ {
thing = node->m_thing; thing = node->m_thing;
@ -6642,7 +6642,7 @@ void T_Scroll(scroll_t *s)
sector_t *psec; sector_t *psec;
psec = sectors + sect; psec = sectors + sect;
for (node = psec->touching_thinglist; node; node = node->m_snext) for (node = psec->touching_thinglist; node; node = node->m_thinglist_next)
{ {
thing = node->m_thing; thing = node->m_thing;
@ -6664,7 +6664,7 @@ void T_Scroll(scroll_t *s)
if (!is3dblock) if (!is3dblock)
{ {
for (node = sec->touching_thinglist; node; node = node->m_snext) for (node = sec->touching_thinglist; node; node = node->m_thinglist_next)
{ {
thing = node->m_thing; thing = node->m_thing;
@ -7014,7 +7014,7 @@ void T_Friction(friction_t *f)
{ {
if (thing->floorz != P_GetSpecialTopZ(thing, referrer, sec)) if (thing->floorz != P_GetSpecialTopZ(thing, referrer, sec))
{ {
node = node->m_snext; node = node->m_thinglist_next;
continue; continue;
} }
@ -7032,7 +7032,7 @@ void T_Friction(friction_t *f)
thing->movefactor = f->movefactor; thing->movefactor = f->movefactor;
} }
} }
node = node->m_snext; node = node->m_thinglist_next;
} }
} }
@ -7372,7 +7372,7 @@ void T_Pusher(pusher_t *p)
// constant pushers p_wind and p_current // constant pushers p_wind and p_current
node = sec->touching_thinglist; // things touching this sector node = sec->touching_thinglist; // things touching this sector
for (; node; node = node->m_snext) for (; node; node = node->m_thinglist_next)
{ {
thing = node->m_thing; thing = node->m_thing;
if (thing->flags & (MF_NOGRAVITY | MF_NOCLIP) if (thing->flags & (MF_NOGRAVITY | MF_NOCLIP)

View File

@ -1684,7 +1684,7 @@ static void P_CheckBustableBlocks(player_t *player)
player->mo->y += player->mo->momy; player->mo->y += player->mo->momy;
P_SetThingPosition(player->mo); P_SetThingPosition(player->mo);
for (node = player->mo->touching_sectorlist; node; node = node->m_snext) for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
if (!node->m_sector) if (!node->m_sector)
break; break;
@ -1801,7 +1801,7 @@ static void P_CheckBouncySectors(player_t *player)
player->mo->z += player->mo->momz; player->mo->z += player->mo->momz;
P_SetThingPosition(player->mo); P_SetThingPosition(player->mo);
for (node = player->mo->touching_sectorlist; node; node = node->m_snext) for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
if (!node->m_sector) if (!node->m_sector)
break; break;
@ -2845,118 +2845,18 @@ static boolean PIT_CheckSolidsTeeter(mobj_t *thing)
// //
static void P_DoTeeter(player_t *player) static void P_DoTeeter(player_t *player)
{ {
msecnode_t *node;
boolean teeter = false; boolean teeter = false;
boolean roverfloor; // solid 3d floors? boolean roverfloor; // solid 3d floors?
boolean checkedforteeter = false;
fixed_t floorheight, ceilingheight; fixed_t floorheight, ceilingheight;
fixed_t topheight, bottomheight; // for 3d floor usage fixed_t topheight, bottomheight; // for 3d floor usage
const fixed_t tiptop = FixedMul(MAXSTEPMOVE, player->mo->scale); // Distance you have to be above the ground in order to teeter. const fixed_t tiptop = FixedMul(MAXSTEPMOVE, player->mo->scale); // Distance you have to be above the ground in order to teeter.
#define maxzdelta 1<<(FRACBITS-1) // 1/2 on the fixed scale if (player->mo->standingslope && player->mo->standingslope->zdelta >= (FRACUNIT/2)) // Always teeter if the slope is too steep.
if (player->mo->standingslope && player->mo->standingslope->zdelta >= maxzdelta) // Always teeter if the slope is too steep.
teeter = true; teeter = true;
#undef maxzdelta
else // Let's do some checks... else // Let's do some checks...
{ {
for (node = player->mo->touching_sectorlist; node; node = node->m_snext)
{
// Ledge teetering. Check if any nearby sectors are low enough from your current one.
checkedforteeter = true;
roverfloor = false;
ceilingheight = node->m_sector->ceilingheight;
floorheight = node->m_sector->floorheight;
#ifdef ESLOPE
if (node->m_sector->c_slope)
ceilingheight = P_GetZAt(node->m_sector->c_slope, player->mo->x, player->mo->y) + FixedMul(node->m_sector->c_slope->zdelta, tiptop);
if (node->m_sector->f_slope)
floorheight = P_GetZAt(node->m_sector->f_slope, player->mo->x, player->mo->y);
#endif
if (node->m_sector->ffloors)
{
ffloor_t *rover;
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS)) continue;
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y);
#endif
if (P_CheckSolidLava(player->mo, rover))
;
else if (!(rover->flags & FF_BLOCKPLAYER || rover->flags & FF_QUICKSAND))
continue; // intangible 3d floor
if (player->mo->eflags & MFE_VERTICALFLIP)
{
if (bottomheight > ceilingheight) // Above the ceiling
continue;
if (bottomheight > player->mo->z + player->mo->height + tiptop
|| (topheight < player->mo->z
&& player->mo->z + player->mo->height < ceilingheight - tiptop))
{
teeter = true;
roverfloor = true;
}
else
{
teeter = false;
roverfloor = true;
break;
}
}
else
{
if (topheight < floorheight) // Below the floor
continue;
if (topheight < player->mo->z - tiptop
|| (bottomheight > player->mo->z + player->mo->height
&& player->mo->z > floorheight + tiptop))
{
teeter = true;
roverfloor = true;
}
else
{
teeter = false;
roverfloor = true;
break;
}
}
}
}
if (!teeter && !roverfloor)
{
if (player->mo->eflags & MFE_VERTICALFLIP)
{
if (ceilingheight > player->mo->z + player->mo->height + tiptop)
teeter = true;
}
else
{
if (floorheight < player->mo->z - tiptop)
teeter = true;
}
}
}
}
if (checkedforteeter && !teeter) // Backup code
{
sector_t *sec;
UINT8 i; UINT8 i;
sector_t *sec;
fixed_t highestceilingheight = INT32_MIN; fixed_t highestceilingheight = INT32_MIN;
fixed_t lowestfloorheight = INT32_MAX; fixed_t lowestfloorheight = INT32_MAX;
@ -3193,7 +3093,7 @@ teeterdone:
if ((player->mo->state == &states[S_PLAY_STND] || player->mo->state == &states[S_PLAY_TAP1] || player->mo->state == &states[S_PLAY_TAP2] || player->mo->state == &states[S_PLAY_SUPERSTAND])) if ((player->mo->state == &states[S_PLAY_STND] || player->mo->state == &states[S_PLAY_TAP1] || player->mo->state == &states[S_PLAY_TAP2] || player->mo->state == &states[S_PLAY_SUPERSTAND]))
P_SetPlayerMobjState(player->mo, S_PLAY_TEETER1); P_SetPlayerMobjState(player->mo, S_PLAY_TEETER1);
} }
else if (checkedforteeter && (player->mo->state == &states[S_PLAY_TEETER1] || player->mo->state == &states[S_PLAY_TEETER2] || player->mo->state == &states[S_PLAY_SUPERTEETER])) else if ((player->mo->state == &states[S_PLAY_TEETER1] || player->mo->state == &states[S_PLAY_TEETER2] || player->mo->state == &states[S_PLAY_SUPERTEETER]))
P_SetPlayerMobjState(player->mo, S_PLAY_STND); P_SetPlayerMobjState(player->mo, S_PLAY_STND);
} }
@ -7083,7 +6983,7 @@ static void P_MovePlayer(player_t *player)
player->mo->y += player->mo->momy; player->mo->y += player->mo->momy;
P_SetThingPosition(player->mo); P_SetThingPosition(player->mo);
for (node = player->mo->touching_sectorlist; node; node = node->m_snext) for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
if (!node->m_sector) if (!node->m_sector)
break; break;

View File

@ -500,10 +500,10 @@ typedef struct subsector_s
// Sector list node showing all sectors an object appears in. // Sector list node showing all sectors an object appears in.
// //
// There are two threads that flow through these nodes. The first thread // There are two threads that flow through these nodes. The first thread
// starts at touching_thinglist in a sector_t and flows through the m_snext // starts at touching_thinglist in a sector_t and flows through the m_thinglist_next
// links to find all mobjs that are entirely or partially in the sector. // links to find all mobjs that are entirely or partially in the sector.
// The second thread starts at touching_sectorlist in an mobj_t and flows // The second thread starts at touching_sectorlist in an mobj_t and flows
// through the m_tnext links to find all sectors a thing touches. This is // through the m_sectorlist_next links to find all sectors a thing touches. This is
// useful when applying friction or push effects to sectors. These effects // useful when applying friction or push effects to sectors. These effects
// can be done as thinkers that act upon all objects touching their sectors. // can be done as thinkers that act upon all objects touching their sectors.
// As an mobj moves through the world, these nodes are created and // As an mobj moves through the world, these nodes are created and
@ -515,10 +515,10 @@ typedef struct msecnode_s
{ {
sector_t *m_sector; // a sector containing this object sector_t *m_sector; // a sector containing this object
struct mobj_s *m_thing; // this object struct mobj_s *m_thing; // this object
struct msecnode_s *m_tprev; // prev msecnode_t for this thing struct msecnode_s *m_sectorlist_prev; // prev msecnode_t for this thing
struct msecnode_s *m_tnext; // next msecnode_t for this thing struct msecnode_s *m_sectorlist_next; // next msecnode_t for this thing
struct msecnode_s *m_sprev; // prev msecnode_t for this sector struct msecnode_s *m_thinglist_prev; // prev msecnode_t for this sector
struct msecnode_s *m_snext; // next msecnode_t for this sector struct msecnode_s *m_thinglist_next; // next msecnode_t for this sector
boolean visited; // used in search algorithms boolean visited; // used in search algorithms
} msecnode_t; } msecnode_t;
@ -526,10 +526,10 @@ typedef struct mprecipsecnode_s
{ {
sector_t *m_sector; // a sector containing this object sector_t *m_sector; // a sector containing this object
struct precipmobj_s *m_thing; // this object struct precipmobj_s *m_thing; // this object
struct mprecipsecnode_s *m_tprev; // prev msecnode_t for this thing struct mprecipsecnode_s *m_sectorlist_prev; // prev msecnode_t for this thing
struct mprecipsecnode_s *m_tnext; // next msecnode_t for this thing struct mprecipsecnode_s *m_sectorlist_next; // next msecnode_t for this thing
struct mprecipsecnode_s *m_sprev; // prev msecnode_t for this sector struct mprecipsecnode_s *m_thinglist_prev; // prev msecnode_t for this sector
struct mprecipsecnode_s *m_snext; // next msecnode_t for this sector struct mprecipsecnode_s *m_thinglist_next; // next msecnode_t for this sector
boolean visited; // used in search algorithms boolean visited; // used in search algorithms
} mprecipsecnode_t; } mprecipsecnode_t;