- Blood: Floatify player inertia correction code.

This commit is contained in:
Mitchell Richters 2022-09-10 20:27:14 +10:00 committed by Christoph Oelckers
parent 32d49cf199
commit 06d0d9b5fd
5 changed files with 13 additions and 12 deletions

View file

@ -4917,13 +4917,13 @@ void MoveDude(DBloodActor* actor)
sfxPlay3DSound(actor, 719, 0, 0);
}
}
vec3_t const oldpos = actor->int_pos();
DVector3 const oldpos = actor->spr.pos;
int nLink = CheckLink(actor);
if (nLink)
{
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, wd, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
if (pPlayer)
playerCorrectInertia(pPlayer, &oldpos);
playerCorrectInertia(pPlayer, oldpos);
switch (nLink)
{
case kMarkerLowStack:

View file

@ -719,10 +719,11 @@ void playerResetInertia(PLAYER* pPlayer)
viewBackupView(pPlayer->nPlayer);
}
void playerCorrectInertia(PLAYER* pPlayer, vec3_t const* oldpos)
void playerCorrectInertia(PLAYER* pPlayer, const DVector3& oldpos)
{
pPlayer->zView += pPlayer->actor->int_pos().Z - oldpos->Z;
pPlayer->zWeapon += pPlayer->actor->int_pos().Z - oldpos->Z;
auto zAdj = (pPlayer->actor->spr.pos.Z - oldpos.Z) * zworldtoint;
pPlayer->zView += zAdj;
pPlayer->zWeapon += zAdj;
viewCorrectViewOffsets(pPlayer->nPlayer, oldpos);
}

View file

@ -220,12 +220,12 @@ bool packItemActive(PLAYER* pPlayer, int nPack);
void packUseItem(PLAYER* pPlayer, int nPack);
void packPrevItem(PLAYER* pPlayer);
void packNextItem(PLAYER* pPlayer);
bool playerSeqPlaying(PLAYER* pPlayer, int nSeq);
bool playerSeqPlaying(PLAYER* pPlayer, int nSeq);
void playerSetRace(PLAYER* pPlayer, int nLifeMode);
void playerSetGodMode(PLAYER* pPlayer, bool bGodMode);
void playerResetInertia(PLAYER* pPlayer);
void playerCorrectInertia(PLAYER* pPlayer, vec3_t const* oldpos);
void playerStart(int nPlayer, int bNewLevel = 0);
void playerCorrectInertia(PLAYER* pPlayer, const DVector3& oldpos);
void playerStart(int nPlayer, int bNewLevel = 0);
void playerReset(PLAYER* pPlayer);
void playerInit(int nPlayer, unsigned int a2);
void CheckPickUp(PLAYER* pPlayer);

View file

@ -84,12 +84,12 @@ void viewBackupView(int nPlayer)
//
//---------------------------------------------------------------------------
void viewCorrectViewOffsets(int nPlayer, vec3_t const* oldpos)
void viewCorrectViewOffsets(int nPlayer, const DVector3& oldpos)
{
PLAYER* pPlayer = &gPlayer[nPlayer];
VIEW* pView = &gPrevView[nPlayer];
pView->pos.XY() += pPlayer->actor->spr.pos.XY() - DVector2(oldpos->X, oldpos->Y) * inttoworld;
pView->viewz += pPlayer->actor->int_pos().Z - oldpos->Z;
pView->pos.XY() += pPlayer->actor->spr.pos.XY() - oldpos.XY();
pView->viewz += (pPlayer->actor->spr.pos.Z - oldpos.Z) * zworldtoint;
}
//---------------------------------------------------------------------------

View file

@ -137,7 +137,7 @@ void viewInitializePrediction(void);
void viewUpdatePrediction(InputPacket* pInput);
void viewCorrectPrediction(void);
void viewBackupView(int nPlayer);
void viewCorrectViewOffsets(int nPlayer, vec3_t const* oldpos);
void viewCorrectViewOffsets(int nPlayer, const DVector3& oldpos);
void InitStatusBar(void);
void UpdateStatusBar();
void viewInit(void);