Everywhere in the code that was doing things wrong has been changed.

Two interesting points of note:
* The touchspecial sector flag seems to actually do its job now.
* Detection of sectors with polyobjects in seems to have done this incorrectly, but this doesn't mess with anything about touching the polies themselves so it seems to really only handle edge cases where the polyobject was too close to the border of another sector (which would've likely made rendering glitches anyways).
* There was a whole swathe of teetering code that was basically never run properly because of this mistake. I did a simple fix at first, but you started teetering whenever you were slightly less than your radius away from a sector's edge, which was completely different and undesirable behaviour. Instead, I cut out the code that was never running, and just left the hacky method in instead since it was more accurate to what we want in general.
This commit is contained in:
toasterbabe 2016-06-09 14:56:24 +01:00
parent 17e0adcbac
commit 7af14c20ed
3 changed files with 8 additions and 84 deletions

View file

@ -2703,7 +2703,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_thinglist_next) 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;
@ -3648,7 +3648,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_thinglist_next) 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;
@ -3673,7 +3673,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
{ {
boolean thereiswater = false; boolean thereiswater = false;
for (node = mobj->touching_sectorlist; node; node = node->m_thinglist_next) for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
if (node->m_sector->ffloors) if (node->m_sector->ffloors)
{ {
@ -3694,7 +3694,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
} }
if (thereiswater) if (thereiswater)
{ {
for (node = mobj->touching_sectorlist; node; node = node->m_thinglist_next) for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
if (node->m_sector->ffloors) if (node->m_sector->ffloors)
{ {

View file

@ -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_thinglist_next) 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_thinglist_next) for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
sector = node->m_sector; sector = node->m_sector;

View file

@ -2849,86 +2849,10 @@ 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;
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.
for (node = player->mo->touching_sectorlist; node; node = node->m_thinglist_next)
{
// Ledge teetering. Check if any nearby sectors are low enough from your current one.
checkedforteeter = true;
roverfloor = false;
if (node->m_sector->ffloors)
{
ffloor_t *rover;
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS)) continue;
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 (*rover->bottomheight > node->m_sector->ceilingheight) // Above the ceiling
continue;
if (*rover->bottomheight > player->mo->z + player->mo->height + tiptop
|| (*rover->topheight < player->mo->z
&& player->mo->z + player->mo->height < node->m_sector->ceilingheight - tiptop))
{
teeter = true;
roverfloor = true;
}
else
{
teeter = false;
roverfloor = true;
break;
}
}
else
{
if (*rover->topheight < node->m_sector->floorheight) // Below the floor
continue;
if (*rover->topheight < player->mo->z - tiptop
|| (*rover->bottomheight > player->mo->z + player->mo->height
&& player->mo->z > node->m_sector->floorheight + tiptop))
{
teeter = true;
roverfloor = true;
}
else
{
teeter = false;
roverfloor = true;
break;
}
}
}
}
if (!teeter && !roverfloor)
{
if (player->mo->eflags & MFE_VERTICALFLIP)
{
if (node->m_sector->ceilingheight > player->mo->z + player->mo->height + tiptop)
teeter = true;
}
else
{
if (node->m_sector->floorheight < player->mo->z - tiptop)
teeter = true;
}
}
}
if (checkedforteeter && !teeter) // Backup code
{ {
subsector_t *subsec[4]; // changed abcd into array instead subsector_t *subsec[4]; // changed abcd into array instead
UINT8 i; UINT8 i;
@ -3147,7 +3071,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);
} }
@ -7037,7 +6961,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_thinglist_next) for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
if (!node->m_sector) if (!node->m_sector)
break; break;