From fc71b39d22e0ab1a4ba6d872dd84e528f54809ae Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sat, 10 Sep 2022 22:15:33 +1000 Subject: [PATCH] - Blood: Eliminate `VIEW::viewz`. --- source/games/blood/src/osdcmd.cpp | 2 +- source/games/blood/src/player.cpp | 3 ++- source/games/blood/src/player.h | 1 + source/games/blood/src/view.cpp | 18 ++---------------- source/games/blood/src/view.h | 2 -- 5 files changed, 6 insertions(+), 20 deletions(-) diff --git a/source/games/blood/src/osdcmd.cpp b/source/games/blood/src/osdcmd.cpp index 0ba323490..0e400500f 100644 --- a/source/games/blood/src/osdcmd.cpp +++ b/source/games/blood/src/osdcmd.cpp @@ -37,7 +37,7 @@ void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang, int h VIEW* pView = &gPrevView[myconnectindex]; pPlayer->actor->opos.XY() = pPlayer->actor->spr.pos.XY() = { x , y }; - pView->viewz = gView->zView = z; + pPlayer->ozView = pPlayer->zView = z; if (ang != DAngle::fromDeg(INT_MIN)) { diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index d1f0550a7..79a4f5805 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -724,7 +724,8 @@ void playerCorrectInertia(PLAYER* pPlayer, const DVector3& oldpos) auto zAdj = (pPlayer->actor->spr.pos.Z - oldpos.Z) * zworldtoint; pPlayer->zView += zAdj; pPlayer->zWeapon += zAdj; - viewCorrectViewOffsets(pPlayer->nPlayer, oldpos); + pPlayer->actor->opos.XY() += pPlayer->actor->spr.pos.XY() - oldpos.XY(); + pPlayer->ozView += (pPlayer->actor->spr.pos.Z - oldpos.Z) * zworldtoint; } void playerResetPowerUps(PLAYER* pPlayer) diff --git a/source/games/blood/src/player.h b/source/games/blood/src/player.h index e61d6c916..002f1ee27 100644 --- a/source/games/blood/src/player.h +++ b/source/games/blood/src/player.h @@ -104,6 +104,7 @@ struct PLAYER int lifeMode; int bloodlust; // ---> useless int zView; + int ozView; int zViewVel; int zWeapon; int zWeaponVel; diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index f0d13ecbd..ebdc470a7 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -61,7 +61,7 @@ void viewBackupView(int nPlayer) { PLAYER* pPlayer = &gPlayer[nPlayer]; VIEW* pView = &gPrevView[nPlayer]; - pView->viewz = pPlayer->zView; + pPlayer->ozView = pPlayer->zView; pView->weaponZ = pPlayer->zWeapon - pPlayer->zView - 0xc00; pView->horiz = pPlayer->horizon.horiz; pView->horizoff = pPlayer->horizon.horizoff; @@ -82,20 +82,6 @@ void viewBackupView(int nPlayer) // //--------------------------------------------------------------------------- -void viewCorrectViewOffsets(int nPlayer, const DVector3& oldpos) -{ - PLAYER* pPlayer = &gPlayer[nPlayer]; - VIEW* pView = &gPrevView[nPlayer]; - pPlayer->actor->opos.XY() += pPlayer->actor->spr.pos.XY() - oldpos.XY(); - pView->viewz += (pPlayer->actor->spr.pos.Z - oldpos.Z) * zworldtoint; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void viewDrawText(FFont* pFont, const char* pString, int x, int y, int nShade, int nPalette, int position, bool shadow) { if (!pString) return; @@ -515,7 +501,7 @@ static void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sec VIEW* pView = &gPrevView[gViewIndex]; cX = interpolatedvalue(gView->actor->opos.X, gView->actor->spr.pos.X, smoothratio * (1. / MaxSmoothRatio)) * worldtoint; cY = interpolatedvalue(gView->actor->opos.Y, gView->actor->spr.pos.Y, smoothratio * (1. / MaxSmoothRatio)) * worldtoint; - cZ = interpolatedvalue(pView->viewz, gView->zView, smoothratio * (1. / MaxSmoothRatio)); + cZ = interpolatedvalue(gView->ozView, gView->zView, smoothratio * (1. / MaxSmoothRatio)); zDelta = interpolatedvalue(pView->weaponZ, gView->zWeapon - gView->zView - (12 << 8), smoothratio * (1. / MaxSmoothRatio)); bobWidth = interpolatedvalue(pView->bobWidth, gView->bobWidth, smoothratio * (1. / MaxSmoothRatio)); bobHeight = interpolatedvalue(pView->bobHeight, gView->bobHeight, smoothratio * (1. / MaxSmoothRatio)); diff --git a/source/games/blood/src/view.h b/source/games/blood/src/view.h index 08f13e532..9e4fdb448 100644 --- a/source/games/blood/src/view.h +++ b/source/games/blood/src/view.h @@ -44,7 +44,6 @@ struct VIEW { fixedhoriz horizoff; // horizoff int slope; int weaponZ; // weapon z - int viewz; // view z int zViewVel; int zWeapon; int zWeaponVel; @@ -135,7 +134,6 @@ void viewInitializePrediction(void); void viewUpdatePrediction(InputPacket* pInput); void viewCorrectPrediction(void); void viewBackupView(int nPlayer); -void viewCorrectViewOffsets(int nPlayer, const DVector3& oldpos); void InitStatusBar(void); void UpdateStatusBar(); void viewInit(void);