- Always clear object in PlayerAngles::initialize() rather than expecting the caller to do it.

This commit is contained in:
Mitchell Richters 2023-09-27 21:14:58 +10:00
parent 59acdde9c9
commit 8f9b413d38
5 changed files with 3 additions and 5 deletions

View file

@ -112,7 +112,9 @@ struct PlayerAngles
// General methods.
void initialize(DCoreActor* const actor, const DAngle viewyaw = nullAngle)
{
if ((pActor = actor)) CameraAngles = PrevLerpAngles = pActor->spr.Angles;
*this = {};
pActor = actor;
CameraAngles = PrevLerpAngles = pActor->spr.Angles;
PrevViewAngles.Yaw = ViewAngles.Yaw = viewyaw;
}
DAngle getPitchWithView()

View file

@ -801,7 +801,6 @@ void playerStart(int nPlayer, int bNewLevel)
auto actor = actSpawnSprite(pStartZone->sector, pStartZone->pos, 6, 1);
assert(actor->hasX());
pPlayer->actor = actor;
pPlayer->Angles = {};
pPlayer->Angles.initialize(pPlayer->actor);
DUDEINFO* pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase];
pPlayer->pDudeInfo = pDudeInfo;

View file

@ -603,7 +603,6 @@ void resetpspritevars(int g, const DVector3& startpos, const DAngle startang)
act->spr.pal = ps[j].palookup = ud.user_pals[j];
ps[j].actor = act;
ps[j].Angles = {};
ps[j].Angles.initialize(ps[j].actor, (currentLevel->levelNumber & 1)? DAngle90 : -DAngle90);
ps[j].frag_ps = j;
act->SetOwner(act);

View file

@ -285,7 +285,6 @@ void RestartPlayer(int nPlayer)
pPlayer->pPlayerViewSect = pPlayer->sPlayerSave.pSector;
pPlayer->nPlayer = nPlayer;
pPlayer->nHealth = 800; // TODO - define
pPlayer->Angles = {};
pPlayer->Angles.initialize(pPlayerActor);
pPlayer->bIsMummified = false;
pPlayer->nTorch = 0;

View file

@ -2344,7 +2344,6 @@ void InitPlayerSprite(PLAYER* pp, const DVector3& spawnpos, const DAngle startan
pp->actor = actor;
pp->pnum = pnum;
pp->Angles = {};
pp->Angles.initialize(pp->actor);
actor->spr.cstat |= (CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);