mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- Blood: Floatify player inertia correction code.
This commit is contained in:
parent
32d49cf199
commit
06d0d9b5fd
5 changed files with 13 additions and 12 deletions
|
@ -4917,13 +4917,13 @@ void MoveDude(DBloodActor* actor)
|
||||||
sfxPlay3DSound(actor, 719, 0, 0);
|
sfxPlay3DSound(actor, 719, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vec3_t const oldpos = actor->int_pos();
|
DVector3 const oldpos = actor->spr.pos;
|
||||||
int nLink = CheckLink(actor);
|
int nLink = CheckLink(actor);
|
||||||
if (nLink)
|
if (nLink)
|
||||||
{
|
{
|
||||||
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, wd, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
|
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, wd, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
|
||||||
if (pPlayer)
|
if (pPlayer)
|
||||||
playerCorrectInertia(pPlayer, &oldpos);
|
playerCorrectInertia(pPlayer, oldpos);
|
||||||
switch (nLink)
|
switch (nLink)
|
||||||
{
|
{
|
||||||
case kMarkerLowStack:
|
case kMarkerLowStack:
|
||||||
|
|
|
@ -719,10 +719,11 @@ void playerResetInertia(PLAYER* pPlayer)
|
||||||
viewBackupView(pPlayer->nPlayer);
|
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;
|
auto zAdj = (pPlayer->actor->spr.pos.Z - oldpos.Z) * zworldtoint;
|
||||||
pPlayer->zWeapon += pPlayer->actor->int_pos().Z - oldpos->Z;
|
pPlayer->zView += zAdj;
|
||||||
|
pPlayer->zWeapon += zAdj;
|
||||||
viewCorrectViewOffsets(pPlayer->nPlayer, oldpos);
|
viewCorrectViewOffsets(pPlayer->nPlayer, oldpos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,12 +220,12 @@ bool packItemActive(PLAYER* pPlayer, int nPack);
|
||||||
void packUseItem(PLAYER* pPlayer, int nPack);
|
void packUseItem(PLAYER* pPlayer, int nPack);
|
||||||
void packPrevItem(PLAYER* pPlayer);
|
void packPrevItem(PLAYER* pPlayer);
|
||||||
void packNextItem(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 playerSetRace(PLAYER* pPlayer, int nLifeMode);
|
||||||
void playerSetGodMode(PLAYER* pPlayer, bool bGodMode);
|
void playerSetGodMode(PLAYER* pPlayer, bool bGodMode);
|
||||||
void playerResetInertia(PLAYER* pPlayer);
|
void playerResetInertia(PLAYER* pPlayer);
|
||||||
void playerCorrectInertia(PLAYER* pPlayer, vec3_t const* oldpos);
|
void playerCorrectInertia(PLAYER* pPlayer, const DVector3& oldpos);
|
||||||
void playerStart(int nPlayer, int bNewLevel = 0);
|
void playerStart(int nPlayer, int bNewLevel = 0);
|
||||||
void playerReset(PLAYER* pPlayer);
|
void playerReset(PLAYER* pPlayer);
|
||||||
void playerInit(int nPlayer, unsigned int a2);
|
void playerInit(int nPlayer, unsigned int a2);
|
||||||
void CheckPickUp(PLAYER* pPlayer);
|
void CheckPickUp(PLAYER* pPlayer);
|
||||||
|
|
|
@ -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];
|
PLAYER* pPlayer = &gPlayer[nPlayer];
|
||||||
VIEW* pView = &gPrevView[nPlayer];
|
VIEW* pView = &gPrevView[nPlayer];
|
||||||
pView->pos.XY() += pPlayer->actor->spr.pos.XY() - DVector2(oldpos->X, oldpos->Y) * inttoworld;
|
pView->pos.XY() += pPlayer->actor->spr.pos.XY() - oldpos.XY();
|
||||||
pView->viewz += pPlayer->actor->int_pos().Z - oldpos->Z;
|
pView->viewz += (pPlayer->actor->spr.pos.Z - oldpos.Z) * zworldtoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
|
@ -137,7 +137,7 @@ void viewInitializePrediction(void);
|
||||||
void viewUpdatePrediction(InputPacket* pInput);
|
void viewUpdatePrediction(InputPacket* pInput);
|
||||||
void viewCorrectPrediction(void);
|
void viewCorrectPrediction(void);
|
||||||
void viewBackupView(int nPlayer);
|
void viewBackupView(int nPlayer);
|
||||||
void viewCorrectViewOffsets(int nPlayer, vec3_t const* oldpos);
|
void viewCorrectViewOffsets(int nPlayer, const DVector3& oldpos);
|
||||||
void InitStatusBar(void);
|
void InitStatusBar(void);
|
||||||
void UpdateStatusBar();
|
void UpdateStatusBar();
|
||||||
void viewInit(void);
|
void viewInit(void);
|
||||||
|
|
Loading…
Reference in a new issue