- Consolidate Exhumed's nCamerapos and SW's DSWPlayer::si into something inside DCorePlayer.

This commit is contained in:
Mitchell Richters 2023-10-31 15:10:15 +11:00 committed by Christoph Oelckers
parent 1c725377ea
commit fcc09afa18
7 changed files with 12 additions and 12 deletions

View file

@ -15,6 +15,7 @@ protected:
CameraAngles = PrevLerpAngles = PrevViewAngles = ViewAngles = {};
PrevStrafeVel = StrafeVel = 0;
YawSpin = nullAngle;
CameraPos = {};
memset(&lastcmd, 0, sizeof(lastcmd));
memset(&cmd, 0, sizeof(cmd));
actor = nullptr;
@ -26,6 +27,7 @@ public:
DRotator PrevViewAngles, ViewAngles;
double PrevStrafeVel, StrafeVel;
DAngle YawSpin;
DVector3 CameraPos;
ticcmd_t lastcmd, cmd;
DCoreActor* actor;
uint8_t pnum;

View file

@ -409,7 +409,7 @@ void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t
{
tspritetype* pTSprite = mytspriteArray->get(nSprite);
const DAngle nAngle = (nCamerapos.XY() - pTSprite->pos.XY()).Angle();
const DAngle nAngle = (getPlayer(nLocalPlayer)->CameraPos.XY() - pTSprite->pos.XY()).Angle();
const int seqOffset = (((pTSprite->Angles.Yaw + DAngle90 + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8;
const auto& seqFrame = getSequence(seqFile, seqIndex + seqOffset)->frames[frameIndex];
@ -453,12 +453,13 @@ void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t
void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int16_t frameIndex, const int16_t nFlags)
{
tspritetype* pTSprite = mytspriteArray->get(nSprite);
const auto pPlayer = getPlayer(nLocalPlayer);
int seqOffset = 0;
if (!(nFlags & 1))
{
const DAngle nAngle = (nCamerapos.XY() - pTSprite->pos.XY()).Angle();
const DAngle nAngle = (pPlayer->CameraPos.XY() - pTSprite->pos.XY()).Angle();
seqOffset = (((pTSprite->Angles.Yaw + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8;
}
@ -508,7 +509,7 @@ void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqI
const auto pSector = pTSprite->sectp;
const double nFloorZ = pSector->floorz;
if (nFloorZ <= getPlayer(nLocalPlayer)->GetActor()->getOffsetZ())
if (nFloorZ <= pPlayer->GetActor()->getOffsetZ())
{
pTSprite->ownerActor = nullptr;
}

View file

@ -34,7 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS
bool bSubTitles = true;
DVector3 nCamerapos;
bool bTouchFloor;
int nChunkTotal = 0;
int nViewTop;
@ -77,6 +76,7 @@ void DrawView(double interpfrac, bool sceneonly)
auto nPlayerOldCstat = pPlayerActor->spr.cstat;
auto pDop = pPlayer->pDoppleSprite;
auto nDoppleOldCstat = pDop->spr.cstat;
DVector3 nCamerapos;
// update render angles.
pPlayer->updateCameraAngles(interpfrac);
@ -125,6 +125,7 @@ void DrawView(double interpfrac, bool sceneonly)
}
}
pPlayer->CameraPos = nCamerapos;
const auto ampos = nCamerapos.XY();
if (nSnakeCam >= 0 && !sceneonly)
@ -339,8 +340,7 @@ void SerializeView(FSerializer& arc)
{
if (arc.BeginObject("view"))
{
arc("camerapos", nCamerapos)
("chunktotal", nChunkTotal)
arc("chunktotal", nChunkTotal)
("camera", bCamera)
.EndObject();
}

View file

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

View file

@ -362,7 +362,7 @@ void DoShadows(tspriteArray& tsprites, tspritetype* tsp, double viewz)
else
{
// Alter the shadow's position so that it appears behind the sprite itself.
auto look = (tSpr->pos.XY() - getPlayer(screenpeek)->si.XY()).Angle();
auto look = (tSpr->pos.XY() - getPlayer(screenpeek)->CameraPos.XY()).Angle();
tSpr->pos.XY() += look.ToVector() * 2;
}
@ -783,7 +783,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
if (pp->Flags & (PF_VIEW_FROM_OUTSIDE))
tsp->cstat |= (CSTAT_SPRITE_TRANSLUCENT);
auto pos = pp->si.plusZ(tsp->pos.Z);
auto pos = pp->CameraPos.plusZ(tsp->pos.Z);
if (pp->Flags & (PF_CLIMBING))
{
@ -1253,7 +1253,7 @@ void drawscreen(DSWPlayer* pp, double interpfrac, bool sceneonly)
updatesectorz(tpos, &tsect);
}
pp->si = tpos.plusZ(-pp->GetActor()->getOffsetZ());
pp->CameraPos = tpos.plusZ(-pp->GetActor()->getOffsetZ());
QuakeViewChange(camerapp, tpos, tangles.Yaw);
int vis = g_visibility;

View file

@ -1712,7 +1712,6 @@ public:
sectortype* hi_sectp, *lo_sectp;
double circle_camera_dist;
DVector3 si; // save player interp position for PlayerSprite
DVector2 vect, ovect, slide_vect; // these need floatification, but must be done together. vect is in 14.18 format!

View file

@ -334,7 +334,6 @@ void DSWPlayer::Serialize(FSerializer& arc)
("lo_sp", lowActor)
("last_camera_sp", last_camera_act)
("circle_camera_dist", circle_camera_dist)
("si", si)
("vect", vect)
("friction", friction)
("slide_vect", slide_vect)