- gameinput.cpp: Remove crouch bool from applylook() since we can now just rely in the actions bitfield that's already incoming as required and default scaleAdjust in the prototype to 1.

This commit is contained in:
Mitchell Richters 2020-11-07 18:25:06 +11:00
parent 6e3d414b3c
commit ade1a80515
10 changed files with 16 additions and 16 deletions

View file

@ -54,7 +54,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
// Perform unsynchronised angle/horizon if not dead.
if (gView->pXSprite->health != 0)
{
applylook(&pPlayer->angle, input.avel, &pPlayer->input.actions, scaleAdjust, pPlayer->posture != 0);
applylook(&pPlayer->angle, input.avel, &pPlayer->input.actions, scaleAdjust);
sethorizon(&pPlayer->horizon.horiz, input.horz, &pPlayer->input.actions, scaleAdjust);
}

View file

@ -1445,7 +1445,7 @@ void ProcessInput(PLAYER *pPlayer)
if (cl_syncinput)
{
applylook(&pPlayer->angle, pInput->avel, &pInput->actions, 1, pPlayer->posture != 0);
applylook(&pPlayer->angle, pInput->avel, &pInput->actions);
UpdatePlayerSpriteAngle(pPlayer);
}
@ -1569,7 +1569,7 @@ void ProcessInput(PLAYER *pPlayer)
if (cl_syncinput)
{
sethorizon(&pPlayer->horizon.horiz, pInput->horz, &pInput->actions, 1);
sethorizon(&pPlayer->horizon.horiz, pInput->horz, &pInput->actions);
}
int nSector = pSprite->sectnum;

View file

@ -298,7 +298,7 @@ void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double
//
//---------------------------------------------------------------------------
void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust, bool const crouching)
void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust)
{
// return q16rotscrnang to 0 and set to 0 if less than a quarter of a unit
angle->rotscrnang -= bamlook(xs_CRoundToInt(scaleAdjust * angle->rotscrnang.asbam() * (15. / GameTicRate)));
@ -335,7 +335,7 @@ void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double
if (angle->spin.asbam() < 0)
{
// return spin to 0
lookangle add = bamlook(xs_CRoundToUInt(scaleAdjust * ((!crouching ? 3840. : 1920.) / GameTicRate) * BAMUNIT));
lookangle add = bamlook(xs_CRoundToUInt(scaleAdjust * ((!(*actions & SB_CROUCH) ? 3840. : 1920.) / GameTicRate) * BAMUNIT));
angle->spin += add;
if (angle->spin.asbam() > 0)
{

View file

@ -193,5 +193,5 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, Pl
FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w, PlayerHorizon* def);
void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlInfo* const hidInput, double const scaleAdjust, int const drink_amt = 0, bool const allowstrafe = true, double const turnscale = 1);
void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double const scaleAdjust);
void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust, bool const crouching);
void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double const scaleAdjust = 1);
void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust = 1);

View file

@ -124,7 +124,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
{
if (!nFreeze)
{
applylook(&pPlayer->angle, input.avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust, eyelevel[nLocalPlayer] > -14080);
applylook(&pPlayer->angle, input.avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
sethorizon(&pPlayer->horizon.horiz, input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
}

View file

@ -921,7 +921,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
if (cl_syncinput)
{
Player* pPlayer = &PlayerList[nPlayer];
applylook(&pPlayer->angle, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions, 1, eyelevel[nLocalPlayer] > -14080);
applylook(&pPlayer->angle, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions);
UpdatePlayerSpriteAngle(pPlayer);
}
@ -2640,7 +2640,7 @@ loc_1BD2E:
if (cl_syncinput)
{
Player* pPlayer = &PlayerList[nPlayer];
sethorizon(&pPlayer->horizon.horiz, sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions, 1);
sethorizon(&pPlayer->horizon.horiz, sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions);
}
}
else // else, player's health is less than 0

View file

@ -887,7 +887,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
// Do these in the same order as the old code.
calcviewpitch(p, scaleAdjust);
processavel(p, &input.avel);
applylook(&p->angle, input.avel, &p->sync.actions, scaleAdjust, p->sync.actions & SB_CROUCH);
applylook(&p->angle, input.avel, &p->sync.actions, scaleAdjust);
sethorizon(&p->horizon.horiz, input.horz, &p->sync.actions, scaleAdjust);
}

View file

@ -2892,7 +2892,7 @@ void processinput_d(int snum)
// may still be needed later for demo recording
processavel(p, &sb_avel);
applylook(&p->angle, sb_avel, &p->sync.actions, 1, actions & SB_CROUCH);
applylook(&p->angle, sb_avel, &p->sync.actions);
}
if (p->spritebridge == 0)
@ -3126,7 +3126,7 @@ HORIZONLY:
if (cl_syncinput)
{
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions, 1);
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
}
checkhardlanding(p);

View file

@ -3635,7 +3635,7 @@ void processinput_r(int snum)
// may still be needed later for demo recording
processavel(p, &sb_avel);
applylook(&p->angle, sb_avel, &p->sync.actions, 1, actions & SB_CROUCH);
applylook(&p->angle, sb_avel, &p->sync.actions);
apply_seasick(p, 1);
}
@ -3998,7 +3998,7 @@ HORIZONLY:
if (cl_syncinput)
{
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions, 1);
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
}
checkhardlanding(p);

View file

@ -1521,7 +1521,7 @@ UpdatePlayerSpriteAngle(PLAYERp pp)
void
DoPlayerTurn(PLAYERp pp, float const avel, double const scaleAdjust)
{
applylook(&pp->angle, avel, &pp->input.actions, scaleAdjust, pp->input.actions & SB_CROUCH);
applylook(&pp->angle, avel, &pp->input.actions, scaleAdjust);
UpdatePlayerSpriteAngle(pp);
}