mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-30 20:51:02 +00:00
- Exhumed: Remove Player::nDestVertPan
entirely.
* We can just pass the needed value into `doPlayerPitch()`. * For Ramses, no need to set `nDestVertPan` to the map value, just use the map value. * Avoids an excess `atan2()` call by way of `maphoriz()`.
This commit is contained in:
parent
b5123ac69f
commit
4bf2f70d7b
3 changed files with 5 additions and 10 deletions
|
@ -300,7 +300,6 @@ void RestartPlayer(int nPlayer)
|
|||
pPlayer->dVertPan = 0;
|
||||
pPlayer->vel.Zero();
|
||||
pPlayer->nThrust.Zero();
|
||||
pPlayer->nDestVertPan = nullAngle;
|
||||
pPlayer->nBreathTimer = 90;
|
||||
pPlayer->nTauntTimer = RandomSize(3) + 3;
|
||||
pPlayer->ototalvel = pPlayer->totalvel = 0;
|
||||
|
@ -1426,7 +1425,6 @@ static void doPlayerRamses(Player* const pPlayer)
|
|||
if (nFreeze < 1)
|
||||
{
|
||||
nFreeze = 1;
|
||||
pPlayer->nDestVertPan = currentLevel->ex_ramses_horiz;
|
||||
StopAllSounds();
|
||||
StopLocalSound();
|
||||
InitSpiritHead();
|
||||
|
@ -1460,11 +1458,10 @@ static void doPlayerGravity(DExhumedActor* const pPlayerActor)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void doPlayerPitch(Player* const pPlayer)
|
||||
static void doPlayerPitch(Player* const pPlayer, const double nDestVertPan)
|
||||
{
|
||||
const auto pInput = &pPlayer->input;
|
||||
const auto nDestVertPan = cl_slopetilting ? pPlayer->nDestVertPan : nullAngle;
|
||||
const auto nVertPan = deltaangle(pPlayer->Angles.ViewAngles.Pitch, nDestVertPan).Tan() * 32.;
|
||||
const auto nVertPan = (nDestVertPan * cl_slopetilting - pPlayer->Angles.ViewAngles.Pitch.Tan() * 128) * 0.25;
|
||||
|
||||
if (SyncInput())
|
||||
{
|
||||
|
@ -1752,12 +1749,11 @@ static bool doPlayerMovement(Player* const pPlayer)
|
|||
doPlayerMovingBlocks(pPlayer, nMove, spr_pos, spr_vel, spr_sect);
|
||||
}
|
||||
|
||||
// This should amplified 8x, not 2x, but it feels very heavy. Add a CVAR?
|
||||
pPlayer->nDestVertPan = maphoriz((pPlayerActor->spr.pos.Z - spr_pos.Z) * 2.);
|
||||
pPlayer->ototalvel = pPlayer->totalvel;
|
||||
pPlayer->totalvel = int((spr_pos.XY() - pPlayerActor->spr.pos.XY()).Length() * worldtoint);
|
||||
|
||||
doPlayerPitch(pPlayer);
|
||||
// This should amplified 8x, not 2x, but it feels very heavy. Add a CVAR?
|
||||
doPlayerPitch(pPlayer, (pPlayerActor->spr.pos.Z - spr_pos.Z) * 2.);
|
||||
updatePlayerViewSector(pPlayer, nMove, spr_pos, spr_vel, bUnderwater);
|
||||
|
||||
pPlayer->nPlayerD = (pPlayerActor->spr.pos - spr_pos);
|
||||
|
|
|
@ -76,7 +76,6 @@ struct Player
|
|||
int16_t nState;
|
||||
int16_t nLastWeapon;
|
||||
int16_t nRun;
|
||||
DAngle nDestVertPan;
|
||||
|
||||
InputPacket input;
|
||||
PlayerAngles Angles;
|
||||
|
|
|
@ -199,7 +199,7 @@ void DoSpiritHead()
|
|||
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, currentLevel->ex_ramses_horiz) * 0.25;
|
||||
|
||||
switch (nHeadStage)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue