- Blood: Eliminate VIEW::viewz.

This commit is contained in:
Mitchell Richters 2022-09-10 22:15:33 +10:00 committed by Christoph Oelckers
parent 85412a39e6
commit fc71b39d22
5 changed files with 6 additions and 20 deletions

View file

@ -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))
{

View file

@ -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)

View file

@ -104,6 +104,7 @@ struct PLAYER
int lifeMode;
int bloodlust; // ---> useless
int zView;
int ozView;
int zViewVel;
int zWeapon;
int zWeaponVel;

View file

@ -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<double>(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));

View file

@ -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);