- Exhumed: Tidy up nCamerapan.

This commit is contained in:
Mitchell Richters 2022-09-06 22:33:36 +10:00 committed by Christoph Oelckers
parent 7cbe3564ce
commit 91c0ff814f

View file

@ -45,7 +45,6 @@ int16_t nQuake[kMaxPlayers] = { 0 };
int nChunkTotal = 0; int nChunkTotal = 0;
DAngle nCameraa; DAngle nCameraa;
fixedhoriz nCamerapan;
int nViewTop; int nViewTop;
bool bCamera = false; bool bCamera = false;
@ -182,7 +181,7 @@ void DrawView(double smoothRatio, bool sceneonly)
int nEnemyPal = -1; int nEnemyPal = -1;
sectortype* pSector = nullptr; sectortype* pSector = nullptr;
DAngle nAngle, rotscrnang; DAngle nAngle, rotscrnang;
fixedhoriz pan = {}; fixedhoriz nCamerapan;
DoInterpolations(smoothRatio * (1. / MaxSmoothRatio)); DoInterpolations(smoothRatio * (1. / MaxSmoothRatio));
@ -224,13 +223,13 @@ void DrawView(double smoothRatio, bool sceneonly)
if (!SyncInput()) if (!SyncInput())
{ {
pan = PlayerList[nLocalPlayer].horizon.sum(); nCamerapan = PlayerList[nLocalPlayer].horizon.sum();
nAngle = PlayerList[nLocalPlayer].angle.sum(); nAngle = PlayerList[nLocalPlayer].angle.sum();
rotscrnang = PlayerList[nLocalPlayer].angle.rotscrnang; rotscrnang = PlayerList[nLocalPlayer].angle.rotscrnang;
} }
else else
{ {
pan = PlayerList[nLocalPlayer].horizon.interpolatedsum(smoothRatio); nCamerapan = PlayerList[nLocalPlayer].horizon.interpolatedsum(smoothRatio);
nAngle = PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio * (1. / MaxSmoothRatio)); nAngle = PlayerList[nLocalPlayer].angle.interpolatedsum(smoothRatio * (1. / MaxSmoothRatio));
rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(smoothRatio * (1. / MaxSmoothRatio)); rotscrnang = PlayerList[nLocalPlayer].angle.interpolatedrotscrn(smoothRatio * (1. / MaxSmoothRatio));
} }
@ -245,14 +244,14 @@ void DrawView(double smoothRatio, bool sceneonly)
pPlayerActor->spr.cstat |= CSTAT_SPRITE_TRANSLUCENT; pPlayerActor->spr.cstat |= CSTAT_SPRITE_TRANSLUCENT;
pDop->spr.cstat |= CSTAT_SPRITE_INVISIBLE; pDop->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
} }
pan = q16horiz(clamp(pan.asq16(), gi->playerHorizMin(), gi->playerHorizMax())); nCamerapan = q16horiz(clamp(nCamerapan.asq16(), gi->playerHorizMin(), gi->playerHorizMax()));
} }
nCameraa = nAngle; nCameraa = nAngle;
if (nSnakeCam >= 0 && !sceneonly) if (nSnakeCam >= 0 && !sceneonly)
{ {
pan = q16horiz(0); nCamerapan = q16horiz(0);
} }
else else
{ {
@ -262,10 +261,10 @@ void DrawView(double smoothRatio, bool sceneonly)
if (bCamera) if (bCamera)
{ {
nCamera.Z -= 10; nCamera.Z -= 10;
if (!calcChaseCamPos(nCamera, pPlayerActor, &pSector, nAngle, pan, smoothRatio)) if (!calcChaseCamPos(nCamera, pPlayerActor, &pSector, nAngle, nCamerapan, smoothRatio))
{ {
nCamera.Z += 10; nCamera.Z += 10;
calcChaseCamPos(nCamera, pPlayerActor, &pSector, nAngle, pan, smoothRatio); calcChaseCamPos(nCamera, pPlayerActor, &pSector, nAngle, nCamerapan, smoothRatio);
} }
} }
} }
@ -275,8 +274,6 @@ void DrawView(double smoothRatio, bool sceneonly)
nCamera.Z = min(max(nCamera.Z, pSector->ceilingz + 1), pSector->floorz - 1); // std::clamp may fail on this one if sectors are closed. nCamera.Z = min(max(nCamera.Z, pSector->ceilingz + 1), pSector->floorz - 1); // std::clamp may fail on this one if sectors are closed.
} }
nCamerapan = pan;
if (nFreeze == 2 || nFreeze == 1) if (nFreeze == 2 || nFreeze == 1)
{ {
nSnakeCam = -1; nSnakeCam = -1;
@ -428,7 +425,6 @@ void SerializeView(FSerializer& arc)
("touchfloor", bTouchFloor) ("touchfloor", bTouchFloor)
("chunktotal", nChunkTotal) ("chunktotal", nChunkTotal)
("cameraa", nCameraa) ("cameraa", nCameraa)
("camerapan", nCamerapan)
("camera", bCamera) ("camera", bCamera)
.Array("vertpan", dVertPan, countof(dVertPan)) .Array("vertpan", dVertPan, countof(dVertPan))
.Array("quake", nQuake, countof(nQuake)) .Array("quake", nQuake, countof(nQuake))