- Blood: Floatify VIEW::pos and remove old union.

This commit is contained in:
Mitchell Richters 2022-09-08 22:09:25 +10:00 committed by Christoph Oelckers
parent 5c23e29c15
commit b13a9e69eb
4 changed files with 9 additions and 19 deletions

View file

@ -38,8 +38,7 @@ void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang, int h
gView->actor->spr.pos.XY() = { x , y };
pPlayer->actor->spr.pos.XY() = gView->actor->spr.pos.XY();
pView->x = gView->actor->int_pos().X;
pView->y = gView->actor->int_pos().Y;
pView->pos.XY() = gView->actor->spr.pos.XY();
pPlayer->zView = pView->viewz = gView->zView = z;
if (ang != DAngle::fromDeg(INT_MIN))

View file

@ -101,8 +101,8 @@ void viewUpdatePrediction(InputPacket* pInput)
static void sub_158B4(PLAYER* pPlayer)
{
predict.viewz = predict.z - pPlayer->pPosture[pPlayer->lifeMode][predict.posture].eyeAboveZ;
predict.zWeapon = predict.z - pPlayer->pPosture[pPlayer->lifeMode][predict.posture].weaponAboveZ;
predict.viewz = predict.pos.Z * worldtoint - pPlayer->pPosture[pPlayer->lifeMode][predict.posture].eyeAboveZ;
predict.zWeapon = predict.pos.Z * worldtoint - pPlayer->pPosture[pPlayer->lifeMode][predict.posture].weaponAboveZ;
}
static void fakeProcessInput(PLAYER* pPlayer, InputPacket* pInput)

View file

@ -62,8 +62,7 @@ void viewBackupView(int nPlayer)
PLAYER* pPlayer = &gPlayer[nPlayer];
VIEW* pView = &gPrevView[nPlayer];
pView->angle = pPlayer->angle.ang;
pView->x = pPlayer->actor->int_pos().X;
pView->y = pPlayer->actor->int_pos().Y;
pView->pos.XY() = pPlayer->actor->spr.pos.XY();
pView->viewz = pPlayer->zView;
pView->weaponZ = pPlayer->zWeapon - pPlayer->zView - 0xc00;
pView->horiz = pPlayer->horizon.horiz;
@ -89,8 +88,7 @@ void viewCorrectViewOffsets(int nPlayer, vec3_t const* oldpos)
{
PLAYER* pPlayer = &gPlayer[nPlayer];
VIEW* pView = &gPrevView[nPlayer];
pView->x += pPlayer->actor->int_pos().X - oldpos->X;
pView->y += pPlayer->actor->int_pos().Y - oldpos->Y;
pView->pos.XY() += pPlayer->actor->spr.pos.XY() - DVector2(oldpos->X, oldpos->Y) * inttoworld;
pView->viewz += pPlayer->actor->int_pos().Z - oldpos->Z;
}
@ -470,9 +468,8 @@ static void DrawMap(DBloodActor* view, const double smoothratio)
tm = 1;
}
VIEW* pView = &gPrevView[gViewIndex];
auto xy = DVector2(interpolatedvalue(pView->x, view->int_pos().X, smoothratio * (1. / MaxSmoothRatio)), interpolatedvalue(pView->y, view->int_pos().Y, smoothratio * (1. / MaxSmoothRatio))) * inttoworld;
auto ang = !SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(smoothratio * (1. / MaxSmoothRatio));
DrawOverheadMap(xy, ang, smoothratio * (1. / MaxSmoothRatio));
DrawOverheadMap(interpolatedvalue(pView->pos, view->spr.pos, smoothratio * (1. / MaxSmoothRatio)).XY(), ang, smoothratio * (1. / MaxSmoothRatio));
if (tm)
setViewport(hud_size);
}
@ -518,8 +515,8 @@ static void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sec
#endif
{
VIEW* pView = &gPrevView[gViewIndex];
cX = interpolatedvalue(pView->x, gView->actor->int_pos().X, smoothratio * (1. / MaxSmoothRatio));
cY = interpolatedvalue(pView->y, gView->actor->int_pos().Y, smoothratio * (1. / MaxSmoothRatio));
cX = interpolatedvalue(pView->pos.X, gView->actor->spr.pos.X, smoothratio * (1. / MaxSmoothRatio)) * worldtoint;
cY = interpolatedvalue(pView->pos.Y, gView->actor->spr.pos.Y, smoothratio * (1. / MaxSmoothRatio)) * worldtoint;
cZ = interpolatedvalue(pView->viewz, 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));

View file

@ -51,13 +51,7 @@ struct VIEW {
int zWeaponVel;
int posture; // posture
double spin; // spin
union {
struct
{
int32_t x, y, z;
};
vec3_t pos;
};
DVector3 pos;
int xvel; //xvel
int yvel; //yvel
int zvel; //zvel