- Blood: Floatify PLAYER::zView.

This commit is contained in:
Mitchell Richters 2022-09-11 22:09:19 +10:00 committed by Christoph Oelckers
parent 9eec69d810
commit f35fffdf3d
6 changed files with 18 additions and 18 deletions

View file

@ -173,7 +173,7 @@ void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, dou
drawElement(320, 237, 2358, 1, 1, 1, 1);
}
int zn = ((pPlayer->zWeapon - pPlayer->zView - (12 << 8)) >> 7) + 220;
int zn = (int(pPlayer->zWeapon - pPlayer->zView * zworldtoint - (12 << 8)) >> 7) + 220;
PLAYER* pPSprite = &gPlayer[pPlayer->actor->spr.type - kDudePlayer1];
if (pPlayer->actor->IsPlayerActor() && pPSprite->hand == 1)
{

View file

@ -713,18 +713,18 @@ void playerSetGodMode(PLAYER* pPlayer, bool bGodMode)
void playerResetInertia(PLAYER* pPlayer)
{
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
pPlayer->zView = pPlayer->actor->int_pos().Z - pPosture->eyeAboveZ;
pPlayer->zView = pPlayer->actor->spr.pos.Z - pPosture->eyeAboveZ * zinttoworld;
pPlayer->zWeapon = pPlayer->actor->int_pos().Z - pPosture->weaponAboveZ;
viewBackupView(pPlayer->nPlayer);
}
void playerCorrectInertia(PLAYER* pPlayer, const DVector3& oldpos)
{
auto zAdj = (pPlayer->actor->spr.pos.Z - oldpos.Z) * zworldtoint;
auto zAdj = pPlayer->actor->spr.pos.Z - oldpos.Z;
pPlayer->zView += zAdj;
pPlayer->zWeapon += zAdj;
pPlayer->zWeapon += zAdj * zworldtoint;
pPlayer->actor->opos.XY() += pPlayer->actor->spr.pos.XY() - oldpos.XY();
pPlayer->ozView += (pPlayer->actor->spr.pos.Z - oldpos.Z) * zworldtoint;
pPlayer->ozView += zAdj;
}
void playerResetPowerUps(PLAYER* pPlayer)
@ -1865,12 +1865,12 @@ void playerProcess(PLAYER* pPlayer)
ProcessInput(pPlayer);
int nSpeed = approxDist(actor->int_vel().X, actor->int_vel().Y);
pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, actor->int_vel().Z, FixedToFloat(0x7000));
int dz = pPlayer->actor->int_pos().Z - pPosture->eyeAboveZ - pPlayer->zView;
int dz = pPlayer->actor->int_pos().Z - pPosture->eyeAboveZ - pPlayer->zView * zworldtoint;
if (dz > 0)
pPlayer->zViewVel += MulScale(dz << 8, 0xa000, 16);
else
pPlayer->zViewVel += MulScale(dz << 8, 0x1800, 16);
pPlayer->zView += pPlayer->zViewVel >> 8;
pPlayer->zView += FixedToFloat(pPlayer->zViewVel);
pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, actor->int_vel().Z, FixedToFloat(0x5000));
dz = pPlayer->actor->int_pos().Z - pPosture->weaponAboveZ - pPlayer->zWeapon;
if (dz > 0)
@ -1930,7 +1930,7 @@ void playerProcess(PLAYER* pPlayer)
auto link = actor->sector()->lowerLink;
if (link && (link->spr.type == kMarkerLowGoo || link->spr.type == kMarkerLowWater))
{
if (getceilzofslopeptr(actor->sector(), actor->spr.pos) > pPlayer->zView)
if (getceilzofslopeptrf(actor->sector(), actor->spr.pos) > pPlayer->zView)
pPlayer->isUnderwater = 0;
}
}

View file

@ -107,8 +107,8 @@ struct PLAYER
int nPlayer; // Connect id
int lifeMode;
int bloodlust; // ---> useless
int zView;
int ozView;
double zView;
double ozView;
int zViewVel;
int zWeapon;
int ozWeapon;

View file

@ -60,7 +60,7 @@ void viewBackupView(int nPlayer)
{
PLAYER* pPlayer = &gPlayer[nPlayer];
pPlayer->ozView = pPlayer->zView;
pPlayer->ozWeapon = pPlayer->zWeapon - pPlayer->zView - 0xc00;
pPlayer->ozWeapon = pPlayer->zWeapon - pPlayer->zView * zworldtoint - 0xc00;
pPlayer->obobHeight = pPlayer->bobHeight;
pPlayer->obobWidth = pPlayer->bobWidth;
pPlayer->oswayHeight = pPlayer->swayHeight;
@ -491,8 +491,8 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, fixedhoriz& c
#endif
{
cPos.XY() = pPlayer->actor->interpolatedpos(interpfrac).XY();
cPos.Z = interpolatedvalue(pPlayer->ozView, pPlayer->zView, interpfrac) * zinttoworld;
zDelta = interpolatedvalue<double>(pPlayer->ozWeapon, pPlayer->zWeapon - pPlayer->zView - (12 << 8), interpfrac);
cPos.Z = interpolatedvalue(pPlayer->ozView, pPlayer->zView, interpfrac);
zDelta = interpolatedvalue<double>(pPlayer->ozWeapon, pPlayer->zWeapon - pPlayer->zView * zworldtoint - (12 << 8), interpfrac);
bobWidth = interpolatedvalue<double>(pPlayer->obobWidth, pPlayer->bobWidth, interpfrac);
bobHeight = interpolatedvalue<double>(pPlayer->obobHeight, pPlayer->bobHeight, interpfrac);
shakeX = interpolatedvalue<double>(pPlayer->oswayWidth, pPlayer->swayWidth, interpfrac);

View file

@ -247,16 +247,16 @@ static bool checkAmmo2(const PLAYER* pPlayer, int ammotype, int amount)
void SpawnBulletEject(PLAYER* pPlayer, int a2, int a3)
{
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
pPlayer->zView = pPlayer->actor->int_pos().Z - pPosture->eyeAboveZ;
int dz = pPlayer->zWeapon - (pPlayer->zWeapon - pPlayer->zView) / 2;
pPlayer->zView = pPlayer->actor->spr.pos.Z - pPosture->eyeAboveZ * zinttoworld;
int dz = pPlayer->zWeapon - (pPlayer->zWeapon - pPlayer->zView * zworldtoint) / 2;
fxSpawnEjectingBrass(pPlayer->actor, dz, a2, a3);
}
void SpawnShellEject(PLAYER* pPlayer, int a2, int a3)
{
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
pPlayer->zView = pPlayer->actor->int_pos().Z - pPosture->eyeAboveZ;
int t = pPlayer->zWeapon - pPlayer->zView;
pPlayer->zView = pPlayer->actor->spr.pos.Z - pPosture->eyeAboveZ * zinttoworld;
int t = pPlayer->zWeapon - pPlayer->zView * zworldtoint;
int dz = pPlayer->zWeapon - t + (t >> 2);
fxSpawnEjectingShell(pPlayer->actor, dz, a2, a3);
}

View file

@ -73,7 +73,7 @@ struct BloodPlayer native
native int nPlayer; // Connect id
//native int nSprite;
native int lifeMode;
native int zView;
native double zView;
native int zViewVel;
native int zWeapon;
native int zWeaponVel;