- Exhumed: Clean up stack pointer names in RestartPlayer().

This commit is contained in:
Mitchell Richters 2023-03-25 19:48:29 +11:00
parent c79a979395
commit b4028cb250

View file

@ -188,25 +188,25 @@ int GetPlayerFromActor(DExhumedActor* pActor)
void RestartPlayer(int nPlayer) void RestartPlayer(int nPlayer)
{ {
auto plr = &PlayerList[nPlayer]; const auto pPlayer = &PlayerList[nPlayer];
auto pActor = plr->pActor; DExhumedActor* pPlayerActor = pPlayer->pActor;
DExhumedActor* pDopSprite = plr->pDoppleSprite; DExhumedActor* pDopSprite = pPlayer->pDoppleSprite;
DExhumedActor* floorsprt; DExhumedActor* pFloorSprite;
plr->nPlayer = nPlayer; pPlayer->nPlayer = nPlayer;
if (pActor) if (pPlayerActor)
{ {
runlist_DoSubRunRec(pActor->spr.intowner); runlist_DoSubRunRec(pPlayerActor->spr.intowner);
runlist_FreeRun(pActor->spr.lotag - 1); runlist_FreeRun(pPlayerActor->spr.lotag - 1);
ChangeActorStat(pActor, 0); ChangeActorStat(pPlayerActor, 0);
plr->pActor = nullptr; pPlayer->pActor = nullptr;
plr->Angles = {}; pPlayer->Angles = {};
DExhumedActor* pFloorSprite = plr->pPlayerFloorSprite; DExhumedActor* pFloorSprite = pPlayer->pPlayerFloorSprite;
if (pFloorSprite != nullptr) { if (pFloorSprite != nullptr) {
DeleteActor(pFloorSprite); DeleteActor(pFloorSprite);
} }
@ -219,13 +219,13 @@ void RestartPlayer(int nPlayer)
} }
} }
pActor = GrabBody(); pPlayerActor = GrabBody();
ChangeActorSect(pActor, plr->sPlayerSave.pSector); ChangeActorSect(pPlayerActor, pPlayer->sPlayerSave.pSector);
ChangeActorStat(pActor, 100); ChangeActorStat(pPlayerActor, 100);
auto pDActor = insertActor(pActor->sector(), 100); pDopSprite = insertActor(pPlayerActor->sector(), 100);
plr->pDoppleSprite = pDActor; pPlayer->pDoppleSprite = pDopSprite;
if (nTotalPlayers > 1) if (nTotalPlayers > 1)
{ {
@ -236,102 +236,102 @@ void RestartPlayer(int nPlayer)
nCurStartSprite = 0; nCurStartSprite = 0;
} }
pActor->spr.pos = nNStartSprite->spr.pos; pPlayerActor->spr.pos = nNStartSprite->spr.pos;
ChangeActorSect(pActor, nNStartSprite->sector()); ChangeActorSect(pPlayerActor, nNStartSprite->sector());
pActor->spr.Angles.Yaw = nNStartSprite->spr.Angles.Yaw; pPlayerActor->spr.Angles.Yaw = nNStartSprite->spr.Angles.Yaw;
floorsprt = insertActor(pActor->sector(), 0); pFloorSprite = insertActor(pPlayerActor->sector(), 0);
floorsprt->spr.pos = pActor->spr.pos; pFloorSprite->spr.pos = pPlayerActor->spr.pos;
floorsprt->spr.scale = DVector2(1, 1); pFloorSprite->spr.scale = DVector2(1, 1);
floorsprt->spr.cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR; pFloorSprite->spr.cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR;
floorsprt->spr.picnum = nPlayer + kTile3571; pFloorSprite->spr.picnum = nPlayer + kTile3571;
} }
else else
{ {
pActor->spr.pos.XY() = plr->sPlayerSave.pos.XY(); pPlayerActor->spr.pos.XY() = pPlayer->sPlayerSave.pos.XY();
pActor->spr.pos.Z = plr->sPlayerSave.pSector->floorz; pPlayerActor->spr.pos.Z = pPlayer->sPlayerSave.pSector->floorz;
pActor->spr.Angles.Yaw = plr->sPlayerSave.nAngle; pPlayerActor->spr.Angles.Yaw = pPlayer->sPlayerSave.nAngle;
floorsprt = nullptr; pFloorSprite = nullptr;
} }
pActor->backuploc(); pPlayerActor->backuploc();
plr->pPlayerFloorSprite = floorsprt; pPlayer->pPlayerFloorSprite = pFloorSprite;
pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; pPlayerActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
pActor->spr.shade = -12; pPlayerActor->spr.shade = -12;
pActor->clipdist = 14.5; pPlayerActor->clipdist = 14.5;
pActor->spr.pal = 0; pPlayerActor->spr.pal = 0;
pActor->spr.scale = DVector2(0.625, 0.625); pPlayerActor->spr.scale = DVector2(0.625, 0.625);
pActor->spr.xoffset = 0; pPlayerActor->spr.xoffset = 0;
pActor->spr.yoffset = 0; pPlayerActor->spr.yoffset = 0;
pActor->spr.picnum = seq_GetSeqPicnum(kSeqJoe, 18, 0); pPlayerActor->spr.picnum = seq_GetSeqPicnum(kSeqJoe, 18, 0);
pActor->vel.X = 0; pPlayerActor->vel.X = 0;
pActor->vel.Y = 0; pPlayerActor->vel.Y = 0;
pActor->vel.Z = 0; pPlayerActor->vel.Z = 0;
nStandHeight = GetActorHeight(pActor); nStandHeight = GetActorHeight(pPlayerActor);
pActor->spr.hitag = 0; pPlayerActor->spr.hitag = 0;
pActor->spr.extra = -1; pPlayerActor->spr.extra = -1;
pActor->spr.lotag = runlist_HeadRun() + 1; pPlayerActor->spr.lotag = runlist_HeadRun() + 1;
pDActor->spr.pos = pActor->spr.pos; pDopSprite->spr.pos = pPlayerActor->spr.pos;
pDActor->spr.scale = pActor->spr.scale; pDopSprite->spr.scale = pPlayerActor->spr.scale;
pDActor->spr.xoffset = 0; pDopSprite->spr.xoffset = 0;
pDActor->spr.yoffset = 0; pDopSprite->spr.yoffset = 0;
pDActor->spr.shade = pActor->spr.shade; pDopSprite->spr.shade = pPlayerActor->spr.shade;
pDActor->spr.Angles.Yaw = pActor->spr.Angles.Yaw; pDopSprite->spr.Angles.Yaw = pPlayerActor->spr.Angles.Yaw;
pDActor->spr.cstat = pActor->spr.cstat; pDopSprite->spr.cstat = pPlayerActor->spr.cstat;
pDActor->spr.lotag = runlist_HeadRun() + 1; pDopSprite->spr.lotag = runlist_HeadRun() + 1;
plr->nAction = 0; pPlayer->nAction = 0;
plr->nHealth = 800; // TODO - define pPlayer->nHealth = 800; // TODO - define
if (nNetPlayerCount) { if (nNetPlayerCount) {
plr->nHealth = 1600; // TODO - define pPlayer->nHealth = 1600; // TODO - define
} }
plr->nSeqSize = 0; pPlayer->nSeqSize = 0;
plr->pActor = pActor; pPlayer->pActor = pPlayerActor;
plr->Angles = {}; pPlayer->Angles = {};
plr->Angles.initialize(plr->pActor); pPlayer->Angles.initialize(pPlayer->pActor);
plr->bIsMummified = false; pPlayer->bIsMummified = false;
if (plr->invincibility >= 0) { if (pPlayer->invincibility >= 0) {
plr->invincibility = 0; pPlayer->invincibility = 0;
} }
plr->nTorch = 0; pPlayer->nTorch = 0;
plr->nMaskAmount = 0; pPlayer->nMaskAmount = 0;
SetTorch(nPlayer, 0); SetTorch(nPlayer, 0);
plr->nInvisible = 0; pPlayer->nInvisible = 0;
plr->bIsFiring = 0; pPlayer->bIsFiring = 0;
plr->nSeqSize2 = 0; pPlayer->nSeqSize2 = 0;
plr->pPlayerViewSect = plr->sPlayerSave.pSector; pPlayer->pPlayerViewSect = pPlayer->sPlayerSave.pSector;
plr->nState = 0; pPlayer->nState = 0;
plr->nDouble = 0; pPlayer->nDouble = 0;
plr->nSeq = kSeqJoe; pPlayer->nSeq = kSeqJoe;
plr->nPlayerPushSound = -1; pPlayer->nPlayerPushSound = -1;
plr->nNextWeapon = -1; pPlayer->nNextWeapon = -1;
if (plr->nCurrentWeapon == 7) { if (pPlayer->nCurrentWeapon == 7) {
plr->nCurrentWeapon = plr->nLastWeapon; pPlayer->nCurrentWeapon = pPlayer->nLastWeapon;
} }
plr->nLastWeapon = 0; pPlayer->nLastWeapon = 0;
plr->nAir = 100; pPlayer->nAir = 100;
if (!(currentLevel->gameflags & LEVEL_EX_MULTI)) if (!(currentLevel->gameflags & LEVEL_EX_MULTI))
{ {
@ -340,27 +340,27 @@ void RestartPlayer(int nPlayer)
else else
{ {
ResetPlayerWeapons(nPlayer); ResetPlayerWeapons(nPlayer);
plr->nMagic = 0; pPlayer->nMagic = 0;
} }
plr->pPlayerGrenade = nullptr; pPlayer->pPlayerGrenade = nullptr;
pActor->oviewzoffset = pActor->viewzoffset = -55.; pPlayerActor->oviewzoffset = pPlayerActor->viewzoffset = -55.;
plr->dVertPan = 0; pPlayer->dVertPan = 0;
nTemperature[nPlayer] = 0; nTemperature[nPlayer] = 0;
plr->nThrust.Zero(); pPlayer->nThrust.Zero();
plr->nDestVertPan = plr->pActor->PrevAngles.Pitch = plr->pActor->spr.Angles.Pitch = nullAngle; pPlayer->nDestVertPan = pPlayerActor->PrevAngles.Pitch = pPlayerActor->spr.Angles.Pitch = nullAngle;
plr->nBreathTimer = 90; pPlayer->nBreathTimer = 90;
plr->nTauntTimer = RandomSize(3) + 3; pPlayer->nTauntTimer = RandomSize(3) + 3;
pDActor->spr.intowner = runlist_AddRunRec(pDActor->spr.lotag - 1, nPlayer, 0xA0000); pDopSprite->spr.intowner = runlist_AddRunRec(pDopSprite->spr.lotag - 1, nPlayer, 0xA0000);
pActor->spr.intowner = runlist_AddRunRec(pActor->spr.lotag - 1, nPlayer, 0xA0000); pPlayerActor->spr.intowner = runlist_AddRunRec(pPlayerActor->spr.lotag - 1, nPlayer, 0xA0000);
if (plr->nRun < 0) { if (pPlayer->nRun < 0) {
plr->nRun = runlist_AddRunRec(NewRun, nPlayer, 0xA0000); pPlayer->nRun = runlist_AddRunRec(NewRun, nPlayer, 0xA0000);
} }
BuildRa(nPlayer); BuildRa(nPlayer);
@ -370,12 +370,12 @@ void RestartPlayer(int nPlayer)
RestoreGreenPal(); RestoreGreenPal();
} }
plr->ototalvel = plr->totalvel = 0; pPlayer->ototalvel = pPlayer->totalvel = 0;
PlayerList[nPlayer].nCurrentItem = -1; pPlayer->nCurrentItem = -1;
plr->nDeathType = 0; pPlayer->nDeathType = 0;
plr->nQuake = 0; pPlayer->nQuake = 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------