- Exhumed: Adjust yaw adjustment for Ramses to use the same formula as pitch.

* Rather than just snapping the angle, the player's yaw and pitch move evenly towards Ramses.
This commit is contained in:
Mitchell Richters 2023-03-26 22:12:16 +11:00
parent b5a9085aed
commit d45be79c24
2 changed files with 33 additions and 31 deletions

View file

@ -1420,9 +1420,6 @@ static void doPlayerRamses(Player* const pPlayer)
if (nTotalPlayers <= 1) if (nTotalPlayers <= 1)
{ {
const auto pPlayerActor = pPlayer->pActor; const auto pPlayerActor = pPlayer->pActor;
pPlayerActor->spr.Angles.Yaw = (pSpiritSprite->spr.pos.XY() - pPlayerActor->spr.pos.XY()).Angle();
pPlayerActor->spr.Angles.Pitch = pPlayerActor->PrevAngles.Pitch;
pPlayerActor->backupang();
pPlayerActor->vel.Zero(); pPlayerActor->vel.Zero();
pPlayer->vel.Zero(); pPlayer->vel.Zero();
@ -1463,6 +1460,31 @@ static void doPlayerGravity(DExhumedActor* const pPlayerActor)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void doPlayerAngles(Player* const pPlayer)
{
const auto pPlayerActor = pPlayer->pActor;
const auto pInput = &pPlayer->input;
const auto nDestVertPan = cl_slopetilting ? pPlayer->nDestVertPan : nullAngle;
const auto nVertPan = deltaangle(pPlayer->Angles.ViewAngles.Pitch, nDestVertPan).Tan() * 32.;
if (SyncInput())
{
pPlayerActor->spr.Angles.Yaw += DAngle::fromDeg(pInput->avel);
pPlayerActor->spr.Angles.Pitch += DAngle::fromDeg(pInput->horz);
}
pPlayer->Angles.doYawKeys(pInput);
pPlayer->Angles.doViewYaw(pInput);
pPlayer->Angles.doPitchKeys(pInput);
pPlayer->Angles.ViewAngles.Pitch += maphoriz(abs(nVertPan) >= 4 ? Sgn(nVertPan) * 4. : nVertPan * 2.);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static void updatePlayerFloorActor(Player* const pPlayer) static void updatePlayerFloorActor(Player* const pPlayer)
{ {
if (nTotalPlayers > 1) if (nTotalPlayers > 1)
@ -1650,6 +1672,9 @@ static void doPlayerMovingBlocks(Player* const pPlayer, const Collision& nMove,
static bool doPlayerMovement(Player* const pPlayer) static bool doPlayerMovement(Player* const pPlayer)
{ {
// update the player/actor's velocity before anything.
updatePlayerVelocity(pPlayer);
const auto pPlayerActor = pPlayer->pActor; const auto pPlayerActor = pPlayer->pActor;
const auto spr_vel = DVector3(pPlayerActor->vel.XY() * (pPlayer->bIsMummified ? 0.5 : 1.), pPlayerActor->vel.Z); const auto spr_vel = DVector3(pPlayerActor->vel.XY() * (pPlayer->bIsMummified ? 0.5 : 1.), pPlayerActor->vel.Z);
const auto spr_pos = pPlayerActor->spr.pos; const auto spr_pos = pPlayerActor->spr.pos;
@ -1699,6 +1724,9 @@ static bool doPlayerMovement(Player* const pPlayer)
if ((pPlayerActor->sector()->Flag & 0x8000) && bTouchFloor) if ((pPlayerActor->sector()->Flag & 0x8000) && bTouchFloor)
return false; return false;
// update player angles here as per the original workflow.
doPlayerAngles(pPlayer);
if (nMove.type || nMove.exbits) if (nMove.type || nMove.exbits)
{ {
if (bTouchFloor) if (bTouchFloor)
@ -1867,31 +1895,6 @@ static void updatePlayerAction(Player* const pPlayer)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void doPlayerAngles(Player* const pPlayer)
{
const auto pPlayerActor = pPlayer->pActor;
const auto pInput = &pPlayer->input;
const auto nDestVertPan = cl_slopetilting ? pPlayer->nDestVertPan : nullAngle;
const auto nVertPan = deltaangle(pPlayer->Angles.ViewAngles.Pitch, nDestVertPan).Tan() * 32.;
if (SyncInput())
{
pPlayerActor->spr.Angles.Yaw += DAngle::fromDeg(pInput->avel);
pPlayerActor->spr.Angles.Pitch += DAngle::fromDeg(pInput->horz);
}
pPlayer->Angles.doYawKeys(pInput);
pPlayer->Angles.doViewYaw(pInput);
pPlayer->Angles.doPitchKeys(pInput);
pPlayer->Angles.ViewAngles.Pitch += maphoriz(abs(nVertPan) >= 4 ? Sgn(nVertPan) * 4. : nVertPan * 2.);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static bool doPlayerDeathRestart(Player* const pPlayer) static bool doPlayerDeathRestart(Player* const pPlayer)
{ {
if (!(pPlayer->input.actions & SB_OPEN) || pPlayer->nAction < 16) if (!(pPlayer->input.actions & SB_OPEN) || pPlayer->nAction < 16)
@ -2043,9 +2046,6 @@ void AIPlayer::Tick(RunListEvent* ev)
if (pPlayer->nHealth > 0) if (pPlayer->nHealth > 0)
{ {
updatePlayerVelocity(pPlayer);
doPlayerAngles(pPlayer);
if (!doPlayerMovement(pPlayer)) if (!doPlayerMovement(pPlayer))
{ {
doPlayerRamses(pPlayer); doPlayerRamses(pPlayer);

View file

@ -197,6 +197,8 @@ void DoSpiritHead()
const auto pPlayer = &PlayerList[0]; const auto pPlayer = &PlayerList[0];
const auto pPlayerActor = pPlayer->pActor; const auto pPlayerActor = pPlayer->pActor;
const auto nSpiritAngle = (pSpiritSprite->spr.pos.XY() - pPlayerActor->spr.pos.XY()).Angle();
pPlayerActor->spr.Angles.Yaw += deltaangle(pPlayerActor->spr.Angles.Yaw, nSpiritAngle) * 0.25;
pPlayerActor->spr.Angles.Pitch += deltaangle(pPlayerActor->spr.Angles.Pitch, pPlayer->nDestVertPan) * 0.25; pPlayerActor->spr.Angles.Pitch += deltaangle(pPlayerActor->spr.Angles.Pitch, pPlayer->nDestVertPan) * 0.25;
switch (nHeadStage) switch (nHeadStage)