mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 20:40:39 +00:00
- 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:
parent
b5a9085aed
commit
d45be79c24
2 changed files with 33 additions and 31 deletions
|
@ -1420,9 +1420,6 @@ static void doPlayerRamses(Player* const pPlayer)
|
|||
if (nTotalPlayers <= 1)
|
||||
{
|
||||
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();
|
||||
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)
|
||||
{
|
||||
if (nTotalPlayers > 1)
|
||||
|
@ -1650,6 +1672,9 @@ static void doPlayerMovingBlocks(Player* const pPlayer, const Collision& nMove,
|
|||
|
||||
static bool doPlayerMovement(Player* const pPlayer)
|
||||
{
|
||||
// update the player/actor's velocity before anything.
|
||||
updatePlayerVelocity(pPlayer);
|
||||
|
||||
const auto pPlayerActor = pPlayer->pActor;
|
||||
const auto spr_vel = DVector3(pPlayerActor->vel.XY() * (pPlayer->bIsMummified ? 0.5 : 1.), pPlayerActor->vel.Z);
|
||||
const auto spr_pos = pPlayerActor->spr.pos;
|
||||
|
@ -1699,6 +1724,9 @@ static bool doPlayerMovement(Player* const pPlayer)
|
|||
if ((pPlayerActor->sector()->Flag & 0x8000) && bTouchFloor)
|
||||
return false;
|
||||
|
||||
// update player angles here as per the original workflow.
|
||||
doPlayerAngles(pPlayer);
|
||||
|
||||
if (nMove.type || nMove.exbits)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (!(pPlayer->input.actions & SB_OPEN) || pPlayer->nAction < 16)
|
||||
|
@ -2043,9 +2046,6 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
|
||||
if (pPlayer->nHealth > 0)
|
||||
{
|
||||
updatePlayerVelocity(pPlayer);
|
||||
doPlayerAngles(pPlayer);
|
||||
|
||||
if (!doPlayerMovement(pPlayer))
|
||||
{
|
||||
doPlayerRamses(pPlayer);
|
||||
|
|
|
@ -197,6 +197,8 @@ void DoSpiritHead()
|
|||
|
||||
const auto pPlayer = &PlayerList[0];
|
||||
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;
|
||||
|
||||
switch (nHeadStage)
|
||||
|
|
Loading…
Reference in a new issue