- Exhumed: Move bTouchFloor into Player struct.

* No need to save this out either, it's reset at the start of every tic.
This commit is contained in:
Mitchell Richters 2023-04-19 16:50:52 +10:00
parent bb19997a2c
commit 8255a23833
5 changed files with 13 additions and 11 deletions

View file

@ -206,7 +206,8 @@ static int BelowNear(DExhumedActor* pActor, double walldist, sectortype** overri
*overridesect = pSector; *overridesect = pSector;
pActor->vel.Z = 0; pActor->vel.Z = 0;
bTouchFloor = true; if (pActor->spr.statnum == 100)
PlayerList[GetPlayerFromActor(pActor)].bTouchFloor = true;
return kHitAux2; return kHitAux2;
} }
@ -230,6 +231,9 @@ Collision movespritez(DExhumedActor* pActor, double z, double height, double cli
*overridesect = pSector; *overridesect = pSector;
auto pSect2 = pSector; auto pSect2 = pSector;
if (pActor->spr.statnum == 100)
PlayerList[GetPlayerFromActor(pActor)].bTouchFloor = false;
// backup cstat // backup cstat
auto cstat = pActor->spr.cstat; auto cstat = pActor->spr.cstat;
@ -300,7 +304,8 @@ Collision movespritez(DExhumedActor* pActor, double z, double height, double cli
{ {
if (z > 0) if (z > 0)
{ {
bTouchFloor = true; if (pActor->spr.statnum == 100)
PlayerList[GetPlayerFromActor(pActor)].bTouchFloor = true;
if (loHit.type == kHitSprite) if (loHit.type == kHitSprite)
{ {
@ -417,8 +422,6 @@ DExhumedActor* insertActor(sectortype* s, int st)
Collision movesprite(DExhumedActor* pActor, DVector2 vect, double dz, double flordist, unsigned int clipmask) Collision movesprite(DExhumedActor* pActor, DVector2 vect, double dz, double flordist, unsigned int clipmask)
{ {
bTouchFloor = false;
auto spos = pActor->spr.pos; auto spos = pActor->spr.pos;
double nSpriteHeight = GetActorHeight(pActor); double nSpriteHeight = GetActorHeight(pActor);
auto pSector = pActor->sector(); auto pSector = pActor->sector();

View file

@ -1235,7 +1235,7 @@ static void updatePlayerAction(Player* const pPlayer, const bool bUnderwater)
pPlayerActor->vel.Z = -8; pPlayerActor->vel.Z = -8;
nextAction = 10; nextAction = 10;
} }
else if (bTouchFloor && (pPlayerActor->nAction < 6 || pPlayerActor->nAction > 8)) else if (pPlayer->bTouchFloor && (pPlayerActor->nAction < 6 || pPlayerActor->nAction > 8))
{ {
pPlayerActor->vel.Z = -14; pPlayerActor->vel.Z = -14;
nextAction = 3; nextAction = 3;
@ -1706,7 +1706,7 @@ static void doPlayerMovingBlocks(Player* const pPlayer, const Collision& nMove,
{ {
return; return;
} }
else if ((sect->hitag == 45) && bTouchFloor && absangle(nNormal, pPlayerActor->spr.Angles.Yaw + DAngle180) <= DAngle45) else if ((sect->hitag == 45) && pPlayer->bTouchFloor && absangle(nNormal, pPlayerActor->spr.Angles.Yaw + DAngle180) <= DAngle45)
{ {
pPlayer->pPlayerPushSect = sect; pPlayer->pPlayerPushSect = sect;
DVector2 vel = pPlayer->vel; DVector2 vel = pPlayer->vel;
@ -1794,7 +1794,7 @@ static bool doPlayerInput(Player* const pPlayer)
pPlayer->nThrust *= 0.5; pPlayer->nThrust *= 0.5;
// Trigger Ramses? // Trigger Ramses?
if ((pPlayerSect->Flag & 0x8000) && bTouchFloor) if ((pPlayerSect->Flag & 0x8000) && pPlayer->bTouchFloor)
return false; return false;
// update player yaw here as per the original workflow. // update player yaw here as per the original workflow.
@ -1805,7 +1805,7 @@ static bool doPlayerInput(Player* const pPlayer)
if (nMove.type || nMove.exbits) if (nMove.type || nMove.exbits)
{ {
if (bTouchFloor) if (pPlayer->bTouchFloor)
doPlayerFloorDamage(pPlayer, nStartVelZ); doPlayerFloorDamage(pPlayer, nStartVelZ);
if (nMove.type == kHitSector || nMove.type == kHitWall) if (nMove.type == kHitSector || nMove.type == kHitWall)
@ -1842,7 +1842,7 @@ static void doPlayerRunlistSignals(Player* const pPlayer, sectortype* const pSta
const auto pPlayerActor = pPlayer->pActor; const auto pPlayerActor = pPlayer->pActor;
const auto pPlayerSect = pPlayerActor->sector(); const auto pPlayerSect = pPlayerActor->sector();
if (bTouchFloor && pPlayerSect->lotag > 0) if (pPlayer->bTouchFloor && pPlayerSect->lotag > 0)
runlist_SignalRun(pPlayerSect->lotag - 1, pPlayer->nPlayer, &ExhumedAI::TouchFloor); runlist_SignalRun(pPlayerSect->lotag - 1, pPlayer->nPlayer, &ExhumedAI::TouchFloor);
if (pStartSect != pPlayerSect) if (pStartSect != pPlayerSect)

View file

@ -100,6 +100,7 @@ struct Player
int ototalvel; int ototalvel;
int totalvel; int totalvel;
bool crouch_toggle; bool crouch_toggle;
bool bTouchFloor;
TObjPtr<DExhumedActor*> pPlayerGrenade; TObjPtr<DExhumedActor*> pPlayerGrenade;
TObjPtr<DExhumedActor*> pPlayerFloorSprite; TObjPtr<DExhumedActor*> pPlayerFloorSprite;
TObjPtr<DExhumedActor*> pDoppleSprite; TObjPtr<DExhumedActor*> pDoppleSprite;

View file

@ -336,7 +336,6 @@ void SerializeView(FSerializer& arc)
if (arc.BeginObject("view")) if (arc.BeginObject("view"))
{ {
arc("camerapos", nCamerapos) arc("camerapos", nCamerapos)
("touchfloor", bTouchFloor)
("chunktotal", nChunkTotal) ("chunktotal", nChunkTotal)
("camera", bCamera) ("camera", bCamera)
.EndObject(); .EndObject();

View file

@ -29,7 +29,6 @@ void DrawView(double interpfrac, bool sceneonly = false);
void ResetView(); void ResetView();
extern DVector3 nCamerapos; extern DVector3 nCamerapos;
extern bool bTouchFloor;
extern int nChunkTotal; extern int nChunkTotal;
extern tspriteArray* mytspriteArray; extern tspriteArray* mytspriteArray;