- Process scaled angle adjustments in each game's render function, not from the input function.

* Previous config had the potential to call `I_GetInputFrac()` nearly twice in a row, which would have resulted in some hitching.
* Calling from each game's render function avoids the above and means we can start applying scaled angle changes one frame faster.
This commit is contained in:
Mitchell Richters 2022-12-02 14:45:37 +11:00 committed by Christoph Oelckers
parent 2a284c73c9
commit 5a8612110d
11 changed files with 26 additions and 11 deletions

View file

@ -50,6 +50,7 @@ ESyncBits ActionsToSend = 0;
static int dpad_lock = 0;
bool sendPause;
bool crouch_toggle;
double inputScale;
// Mouse speeds
CVAR(Float, m_pitch, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)

View file

@ -105,6 +105,7 @@ void SetupGameButtons();
void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput, bool const crouchable = true, bool const disableToggle = false);
extern ESyncBits ActionsToSend;
extern bool gamesetinput;
extern double inputScale;
inline bool SyncInput()
{

View file

@ -134,7 +134,7 @@ void G_BuildTiccmd(ticcmd_t* cmd)
cmd->ucmd = {};
I_GetEvent();
auto input = CONTROL_GetInput();
gi->GetInput(&input, I_GetInputFrac(SyncInput()), &cmd->ucmd);
gi->GetInput(&input, inputScale, &cmd->ucmd);
cmd->consistency = consistency[myconnectindex][(maketic / ticdup) % BACKUPTICS];
}
@ -589,7 +589,7 @@ void TryRunTics (void)
{
I_GetEvent();
auto input = CONTROL_GetInput();
gi->GetInput(&input, I_GetInputFrac(SyncInput()));
gi->GetInput(&input, inputScale);
}
return;
}

View file

@ -62,8 +62,6 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
pPlayer->Angles.applyYaw(input.avel, &pPlayer->input.actions, scaleAdjust);
pPlayer->Angles.applyPitch(input.horz, &pPlayer->input.actions, scaleAdjust);
}
pPlayer->Angles.applyScaledAdjustments(scaleAdjust);
}
if (packet)

View file

@ -598,6 +598,10 @@ void viewDrawScreen(bool sceneonly)
{
PLAYER* pPlayer = &gPlayer[gViewIndex];
// process scaled actor adjustments prior to drawing.
if ((inputScale = I_GetInputFrac(SyncInput())) != 1.)
pPlayer->Angles.applyScaledAdjustments(inputScale);
if (testgotpic(2342, true))
{
FireProcess();

View file

@ -838,8 +838,6 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
p->Angles.applyYaw(p->adjustavel(input.avel), &p->sync.actions, scaleAdjust);
p->Angles.applyPitch(input.horz, &p->sync.actions, scaleAdjust);
}
p->Angles.applyScaledAdjustments(scaleAdjust);
}
if (packet)

View file

@ -221,6 +221,10 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
player_struct* p = &ps[snum];
// process scaled actor adjustments prior to drawing.
if ((inputScale = I_GetInputFrac(SyncInput())) != 1.)
p->Angles.applyScaledAdjustments(inputScale);
if (automapMode == am_full || !p->insector())
return;

View file

@ -95,7 +95,6 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
}
}
pPlayer->Angles.applyScaledAdjustments(scaleAdjust);
UpdatePlayerSpriteAngle(pPlayer);
}

View file

@ -195,11 +195,19 @@ void DrawView(double interpfrac, bool sceneonly)
DoInterpolations(interpfrac);
auto pPlayerActor = PlayerList[nLocalPlayer].pActor;
auto pPlayer = &PlayerList[nLocalPlayer];
auto pPlayerActor = pPlayer->pActor;
auto nPlayerOldCstat = pPlayerActor->spr.cstat;
auto pDop = PlayerList[nLocalPlayer].pDoppleSprite;
auto pDop = pPlayer->pDoppleSprite;
auto nDoppleOldCstat = pDop->spr.cstat;
// process scaled actor adjustments prior to drawing.
if ((inputScale = I_GetInputFrac(SyncInput())) != 1.)
{
pPlayer->Angles.applyScaledAdjustments(inputScale);
UpdatePlayerSpriteAngle(pPlayer);
}
if (nSnakeCam >= 0 && !sceneonly)
{
DExhumedActor* pActor = SnakeList[nSnakeCam].pSprites[0];

View file

@ -1237,6 +1237,10 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly)
if (cl_sointerpolation) so_dointerpolations(interpfrac);
}
// process scaled actor adjustments prior to drawing.
if ((inputScale = I_GetInputFrac(SyncInput())) != 1.)
pp->Angles.applyScaledAdjustments(inputScale);
// Get initial player position, interpolating if required.
DVector3 tpos = camerapp->actor->getRenderPos(interpfrac);
DRotator tangles = camerapp->Angles.getRenderAngles(interpfrac);

View file

@ -199,8 +199,6 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
{
DoPlayerTurnTurret(pp, input.avel);
}
pp->Angles.applyScaledAdjustments(scaleAdjust);
}
if (packet)