mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-21 19:11:06 +00:00
- Exhumed: Split pitch and yaw input again.
* They need to be called in different places inside of `doPlayerMovement()`.
This commit is contained in:
parent
6aceb7bda3
commit
b5123ac69f
1 changed files with 24 additions and 8 deletions
|
@ -1460,23 +1460,38 @@ static void doPlayerGravity(DExhumedActor* const pPlayerActor)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static void doPlayerAngles(Player* const pPlayer)
|
static void doPlayerPitch(Player* const pPlayer)
|
||||||
{
|
{
|
||||||
const auto pPlayerActor = pPlayer->pActor;
|
|
||||||
const auto pInput = &pPlayer->input;
|
const auto pInput = &pPlayer->input;
|
||||||
const auto nDestVertPan = cl_slopetilting ? pPlayer->nDestVertPan : nullAngle;
|
const auto nDestVertPan = cl_slopetilting ? pPlayer->nDestVertPan : nullAngle;
|
||||||
const auto nVertPan = deltaangle(pPlayer->Angles.ViewAngles.Pitch, nDestVertPan).Tan() * 32.;
|
const auto nVertPan = deltaangle(pPlayer->Angles.ViewAngles.Pitch, nDestVertPan).Tan() * 32.;
|
||||||
|
|
||||||
if (SyncInput())
|
if (SyncInput())
|
||||||
{
|
{
|
||||||
pPlayerActor->spr.Angles.Yaw += DAngle::fromDeg(pInput->avel);
|
pPlayer->pActor->spr.Angles.Pitch += DAngle::fromDeg(pInput->horz);
|
||||||
pPlayerActor->spr.Angles.Pitch += DAngle::fromDeg(pInput->horz);
|
}
|
||||||
|
|
||||||
|
pPlayer->Angles.doPitchKeys(pInput);
|
||||||
|
pPlayer->Angles.ViewAngles.Pitch += maphoriz(abs(nVertPan) >= 4 ? Sgn(nVertPan) * 4. : nVertPan * 2.);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void doPlayerYaw(Player* const pPlayer)
|
||||||
|
{
|
||||||
|
const auto pInput = &pPlayer->input;
|
||||||
|
|
||||||
|
if (SyncInput())
|
||||||
|
{
|
||||||
|
pPlayer->pActor->spr.Angles.Yaw += DAngle::fromDeg(pInput->avel);
|
||||||
}
|
}
|
||||||
|
|
||||||
pPlayer->Angles.doYawKeys(pInput);
|
pPlayer->Angles.doYawKeys(pInput);
|
||||||
pPlayer->Angles.doViewYaw(pInput);
|
pPlayer->Angles.doViewYaw(pInput);
|
||||||
pPlayer->Angles.doPitchKeys(pInput);
|
|
||||||
pPlayer->Angles.ViewAngles.Pitch += maphoriz(abs(nVertPan) >= 4 ? Sgn(nVertPan) * 4. : nVertPan * 2.);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -1725,8 +1740,8 @@ static bool doPlayerMovement(Player* const pPlayer)
|
||||||
if ((pPlayerSect->Flag & 0x8000) && bTouchFloor)
|
if ((pPlayerSect->Flag & 0x8000) && bTouchFloor)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// update player angles here as per the original workflow.
|
// update player yaw here as per the original workflow.
|
||||||
doPlayerAngles(pPlayer);
|
doPlayerYaw(pPlayer);
|
||||||
|
|
||||||
if (nMove.type || nMove.exbits)
|
if (nMove.type || nMove.exbits)
|
||||||
{
|
{
|
||||||
|
@ -1742,6 +1757,7 @@ static bool doPlayerMovement(Player* const pPlayer)
|
||||||
pPlayer->ototalvel = pPlayer->totalvel;
|
pPlayer->ototalvel = pPlayer->totalvel;
|
||||||
pPlayer->totalvel = int((spr_pos.XY() - pPlayerActor->spr.pos.XY()).Length() * worldtoint);
|
pPlayer->totalvel = int((spr_pos.XY() - pPlayerActor->spr.pos.XY()).Length() * worldtoint);
|
||||||
|
|
||||||
|
doPlayerPitch(pPlayer);
|
||||||
updatePlayerViewSector(pPlayer, nMove, spr_pos, spr_vel, bUnderwater);
|
updatePlayerViewSector(pPlayer, nMove, spr_pos, spr_vel, bUnderwater);
|
||||||
|
|
||||||
pPlayer->nPlayerD = (pPlayerActor->spr.pos - spr_pos);
|
pPlayer->nPlayerD = (pPlayerActor->spr.pos - spr_pos);
|
||||||
|
|
Loading…
Reference in a new issue