mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- wrap all checks of cl_syncinput in an inline function.
This commit is contained in:
parent
f429871cc6
commit
ae36ea88c3
20 changed files with 57 additions and 52 deletions
|
@ -49,7 +49,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
ApplyGlobalInput(gInput, hidInput);
|
||||
processMovement(&input, &gInput, hidInput, scaleAdjust);
|
||||
|
||||
if (!cl_syncinput && gamestate == GS_LEVEL)
|
||||
if (!SyncInput() && gamestate == GS_LEVEL)
|
||||
{
|
||||
// Perform unsynchronised angle/horizon if not dead.
|
||||
if (gView->pXSprite->health != 0)
|
||||
|
|
|
@ -1433,7 +1433,7 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
}
|
||||
}
|
||||
|
||||
if (cl_syncinput)
|
||||
if (SyncInput())
|
||||
{
|
||||
applylook(&pPlayer->angle, pInput->avel, &pInput->actions);
|
||||
}
|
||||
|
@ -1560,7 +1560,7 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
pInput->actions &= ~SB_OPEN;
|
||||
}
|
||||
|
||||
if (cl_syncinput)
|
||||
if (SyncInput())
|
||||
{
|
||||
sethorizon(&pPlayer->horizon.horiz, pInput->horz, &pInput->actions);
|
||||
}
|
||||
|
|
|
@ -568,7 +568,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
v4c = finterpolate(predictOld.at1c, predict.at1c, gInterpolate);
|
||||
v48 = finterpolate(predictOld.at18, predict.at18, gInterpolate);
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
cA = bamang(predict.at30.asbam() + predict.look_ang.asbam());
|
||||
cH = predict.at24;
|
||||
|
@ -596,7 +596,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
v4c = finterpolate(pView->at1c, gView->swayWidth, gInterpolate);
|
||||
v48 = finterpolate(pView->at18, gView->swayHeight, gInterpolate);
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
cA = gView->angle.sum();
|
||||
cH = gView->horizon.horiz;
|
||||
|
|
|
@ -29,7 +29,7 @@ struct PlayerHorizon
|
|||
|
||||
void addadjustment(double value)
|
||||
{
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value * FRACUNIT;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ struct PlayerHorizon
|
|||
|
||||
void settarget(double value, bool backup = false)
|
||||
{
|
||||
if (!cl_syncinput && !backup)
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = value * FRACUNIT;
|
||||
if (target == 0) target += 1;
|
||||
|
@ -117,7 +117,7 @@ struct PlayerAngle
|
|||
|
||||
void addadjustment(int value)
|
||||
{
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += BAngToBAM(value);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ struct PlayerAngle
|
|||
|
||||
void addadjustment(double value)
|
||||
{
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value * BAMUNIT;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ struct PlayerAngle
|
|||
|
||||
void addadjustment(lookangle value)
|
||||
{
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value.asbam();
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ struct PlayerAngle
|
|||
|
||||
void addadjustment(binangle value)
|
||||
{
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value.asbam();
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ struct PlayerAngle
|
|||
|
||||
void settarget(int value, bool backup = false)
|
||||
{
|
||||
if (!cl_syncinput && !backup)
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = (ang + getincanglebam(ang, buildang(value))).asbam();
|
||||
if (target == 0) target += 1;
|
||||
|
@ -184,7 +184,7 @@ struct PlayerAngle
|
|||
|
||||
void settarget(double value, bool backup = false)
|
||||
{
|
||||
if (!cl_syncinput && !backup)
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = (ang + getincanglebam(ang, buildfang(value))).asbam();
|
||||
if (target == 0) target += 1;
|
||||
|
@ -198,7 +198,7 @@ struct PlayerAngle
|
|||
|
||||
void settarget(binangle value, bool backup = false)
|
||||
{
|
||||
if (!cl_syncinput && !backup)
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = (ang + getincanglebam(ang, value)).asbam();
|
||||
if (target == 0) target += 1;
|
||||
|
@ -261,7 +261,7 @@ struct PlayerAngle
|
|||
|
||||
double look_anghalf(double const smoothratio)
|
||||
{
|
||||
return (!cl_syncinput ? look_ang : interpolatedlookang(smoothratio)).asbam() * (0.5 / BAMUNIT); // Used within draw code for weapon and crosshair when looking left/right.
|
||||
return (!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).asbam() * (0.5 / BAMUNIT); // Used within draw code for weapon and crosshair when looking left/right.
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -460,7 +460,7 @@ void ApplyGlobalInput(InputPacket& input, ControlInfo* hidInput, bool const crou
|
|||
|
||||
double InputScale()
|
||||
{
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
double now = I_msTimeF();
|
||||
double elapsedInputTicks = lastCheck > 0 ? min(now - lastCheck, 1000.0 / GameTicRate) : 1;
|
||||
|
|
|
@ -105,3 +105,8 @@ void SetupGameButtons();
|
|||
void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput, bool const crouchable = true, bool const disableToggle = false);
|
||||
extern ESyncBits ActionsToSend;
|
||||
double InputScale();
|
||||
|
||||
inline bool SyncInput()
|
||||
{
|
||||
return cl_syncinput;
|
||||
}
|
|
@ -519,7 +519,7 @@ void TryRunTics (void)
|
|||
gi->Predict(myconnectindex);
|
||||
#endif
|
||||
}
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
I_GetEvent();
|
||||
auto input = CONTROL_GetInput();
|
||||
|
|
|
@ -120,7 +120,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
processMovement(&input, &localInput, hidInput, scaleAdjust);
|
||||
}
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
if (!nFreeze)
|
||||
{
|
||||
|
|
|
@ -918,7 +918,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
}
|
||||
|
||||
// loc_1A494:
|
||||
if (cl_syncinput)
|
||||
if (SyncInput())
|
||||
{
|
||||
Player* pPlayer = &PlayerList[nPlayer];
|
||||
applylook(&pPlayer->angle, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions);
|
||||
|
@ -2637,7 +2637,7 @@ loc_1BD2E:
|
|||
PlayerList[nPlayer].field_2 = 0;
|
||||
}
|
||||
|
||||
if (cl_syncinput)
|
||||
if (SyncInput())
|
||||
{
|
||||
Player* pPlayer = &PlayerList[nPlayer];
|
||||
sethorizon(&pPlayer->horizon.horiz, sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions);
|
||||
|
|
|
@ -239,7 +239,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
nSector = nPlayerViewSect[nLocalPlayer];
|
||||
updatesector(playerX, playerY, &nSector);
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
nAngle = PlayerList[nLocalPlayer].angle.sum();
|
||||
rotscrnang = PlayerList[nLocalPlayer].angle.rotscrnang;
|
||||
|
@ -273,7 +273,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
viewz = playerZ + nQuake[nLocalPlayer];
|
||||
int floorZ = sector[sprite[nPlayerSprite].sectnum].floorz;
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
pan = PlayerList[nLocalPlayer].horizon.sum();
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
|
||||
o = 0;
|
||||
|
||||
horiz16th = get16thOfHoriz(snum, cl_syncinput, smoothratio);
|
||||
horiz16th = get16thOfHoriz(snum, SyncInput(), smoothratio);
|
||||
look_anghalf = p->angle.look_anghalf(smoothratio);
|
||||
looking_arc = fabs(look_anghalf) / 4.5;
|
||||
weapon_sway = p->oweapon_sway + fmulscale16(p->weapon_sway - p->oweapon_sway, smoothratio);
|
||||
|
|
|
@ -128,7 +128,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
look_anghalf = p->angle.look_anghalf(smoothratio);
|
||||
looking_arc = fabs(look_anghalf) / 4.5;
|
||||
weapon_sway = p->oweapon_sway + fmulscale16((p->weapon_sway - p->oweapon_sway), smoothratio);
|
||||
TiltStatus = !cl_syncinput ? p->TiltStatus : p->oTiltStatus + fmulscale16((p->TiltStatus - p->oTiltStatus), smoothratio);
|
||||
TiltStatus = !SyncInput() ? p->TiltStatus : p->oTiltStatus + fmulscale16((p->TiltStatus - p->oTiltStatus), smoothratio);
|
||||
|
||||
if (shadedsector[p->cursectnum] == 1)
|
||||
shade = 16;
|
||||
|
|
|
@ -815,7 +815,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
|
|||
{
|
||||
// input.avel already added to loc in processMovement()
|
||||
loc.avel = clamp(loc.avel, -MAXANGVEL, MAXANGVEL);
|
||||
if (!cl_syncinput && input.avel)
|
||||
if (!SyncInput() && input.avel)
|
||||
{
|
||||
p->angle.spin = bamlook(0);
|
||||
}
|
||||
|
@ -863,7 +863,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
processVehicleInput(p, hidInput, input, scaleAdjust);
|
||||
FinalizeInput(myconnectindex, input, true);
|
||||
|
||||
if (!cl_syncinput && p->GetActor()->s.extra > 0)
|
||||
if (!SyncInput() && p->GetActor()->s.extra > 0)
|
||||
{
|
||||
p->apply_seasick(scaleAdjust);
|
||||
}
|
||||
|
@ -875,7 +875,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
FinalizeInput(myconnectindex, input, false);
|
||||
}
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
if (p->GetActor()->s.extra > 0)
|
||||
{
|
||||
|
|
|
@ -2760,7 +2760,7 @@ void processinput_d(int snum)
|
|||
pact->floorz = fz;
|
||||
pact->ceilingz = cz;
|
||||
|
||||
if (cl_syncinput)
|
||||
if (SyncInput())
|
||||
{
|
||||
p->horizon.backup();
|
||||
calcviewpitch(p, 1);
|
||||
|
@ -2883,7 +2883,7 @@ void processinput_d(int snum)
|
|||
p->posxv = 0;
|
||||
p->posyv = 0;
|
||||
}
|
||||
else if (cl_syncinput)
|
||||
else if (SyncInput())
|
||||
{
|
||||
//p->ang += syncangvel * constant
|
||||
//ENGINE calculates angvel for you
|
||||
|
@ -3121,7 +3121,7 @@ HORIZONLY:
|
|||
playerAimDown(snum, actions);
|
||||
}
|
||||
|
||||
if (cl_syncinput)
|
||||
if (SyncInput())
|
||||
{
|
||||
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
|
||||
}
|
||||
|
|
|
@ -3429,7 +3429,7 @@ void processinput_r(int snum)
|
|||
pact->floorz = fz;
|
||||
pact->ceilingz = cz;
|
||||
|
||||
if (cl_syncinput)
|
||||
if (SyncInput())
|
||||
{
|
||||
p->horizon.backup();
|
||||
calcviewpitch(p, 1);
|
||||
|
@ -3623,7 +3623,7 @@ void processinput_r(int snum)
|
|||
p->posxv = 0;
|
||||
p->posyv = 0;
|
||||
}
|
||||
else if (cl_syncinput)
|
||||
else if (SyncInput())
|
||||
{
|
||||
//p->ang += syncangvel * constant
|
||||
//ENGINE calculates angvel for you
|
||||
|
@ -3991,7 +3991,7 @@ HORIZONLY:
|
|||
p->horizon.addadjustment(-d);
|
||||
}
|
||||
|
||||
if (cl_syncinput)
|
||||
if (SyncInput())
|
||||
{
|
||||
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
|
||||
}
|
||||
|
|
|
@ -538,14 +538,14 @@ void displayrooms(int snum, double smoothratio)
|
|||
setgamepalette(setpal(p));
|
||||
|
||||
// set screen rotation.
|
||||
rotscrnang = !cl_syncinput ? p->angle.rotscrnang : p->angle.interpolatedrotscrn(smoothratio);
|
||||
rotscrnang = !SyncInput() ? p->angle.rotscrnang : p->angle.interpolatedrotscrn(smoothratio);
|
||||
|
||||
if ((snum == myconnectindex) && (numplayers > 1))
|
||||
{
|
||||
cposx = omyx + xs_CRoundToInt(fmulscale16(myx - omyx, smoothratio));
|
||||
cposy = omyy + xs_CRoundToInt(fmulscale16(myy - omyy, smoothratio));
|
||||
cposz = omyz + xs_CRoundToInt(fmulscale16(myz - omyz, smoothratio));
|
||||
if (cl_syncinput)
|
||||
if (SyncInput())
|
||||
{
|
||||
fixed_t ohorz = (omyhoriz + omyhorizoff).asq16();
|
||||
fixed_t horz = (myhoriz + myhorizoff).asq16();
|
||||
|
@ -564,7 +564,7 @@ void displayrooms(int snum, double smoothratio)
|
|||
cposx = p->oposx + xs_CRoundToInt(fmulscale16(p->posx - p->oposx, smoothratio));
|
||||
cposy = p->oposy + xs_CRoundToInt(fmulscale16(p->posy - p->oposy, smoothratio));
|
||||
cposz = p->oposz + xs_CRoundToInt(fmulscale16(p->posz - p->oposz, smoothratio));
|
||||
if (cl_syncinput)
|
||||
if (SyncInput())
|
||||
{
|
||||
// Original code for when the values are passed through the sync struct
|
||||
choriz = p->horizon.interpolatedsum(smoothratio);
|
||||
|
|
|
@ -1652,7 +1652,7 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
|
||||
// Interpolate the player's angle while on a sector object, just like VoidSW.
|
||||
// This isn't needed for the turret as it was fixable, but moving sector objects are problematic.
|
||||
if (cl_syncinput || pp != Player+myconnectindex)
|
||||
if (SyncInput() || pp != Player+myconnectindex)
|
||||
{
|
||||
tang = camerapp->angle.interpolatedsum(smoothratio);
|
||||
thoriz = camerapp->horizon.interpolatedsum(smoothratio);
|
||||
|
|
|
@ -203,7 +203,7 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput)
|
|||
processMovement(&input, &loc, hidInput, scaleAdjust, 0, !pp->sop, pp->sop_control ? 3. / 1.40625 : 1.);
|
||||
processWeapon(pp);
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM))
|
||||
{
|
||||
|
|
|
@ -252,7 +252,7 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings
|
|||
for (sop = SectorObject, interp = so_interpdata;
|
||||
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
|
||||
{
|
||||
bool skip = !cl_syncinput && (sop->track == SO_TURRET);
|
||||
bool skip = !SyncInput() && (sop->track == SO_TURRET);
|
||||
if (SO_EMPTY(sop) || skip)
|
||||
continue;
|
||||
if (interp->tic < interp->lasttic)
|
||||
|
@ -291,7 +291,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
|
|||
for (sop = SectorObject, interp = so_interpdata;
|
||||
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
|
||||
{
|
||||
bool skip = !cl_syncinput && (sop->track == SO_TURRET);
|
||||
bool skip = !SyncInput() && (sop->track == SO_TURRET);
|
||||
if (SO_EMPTY(sop) || skip)
|
||||
continue;
|
||||
|
||||
|
@ -318,7 +318,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
|
|||
for (sop = SectorObject, interp = so_interpdata;
|
||||
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
|
||||
{
|
||||
bool skip = !cl_syncinput && (sop->track == SO_TURRET);
|
||||
bool skip = !SyncInput() && (sop->track == SO_TURRET);
|
||||
if (SO_EMPTY(sop) || skip)
|
||||
continue;
|
||||
|
||||
|
@ -378,7 +378,7 @@ void so_restoreinterpolations(void) // Stick at end of drawscree
|
|||
for (sop = SectorObject, interp = so_interpdata;
|
||||
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
|
||||
{
|
||||
bool skip = !cl_syncinput && (sop->track == SO_TURRET);
|
||||
bool skip = !SyncInput() && (sop->track == SO_TURRET);
|
||||
if (SO_EMPTY(sop) || skip)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -2142,7 +2142,7 @@ DoPlayerMove(PLAYERp pp)
|
|||
|
||||
SlipSlope(pp);
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL);
|
||||
}
|
||||
|
@ -2270,7 +2270,7 @@ DoPlayerMove(PLAYERp pp)
|
|||
|
||||
DoPlayerSetWadeDepth(pp);
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_AIM);
|
||||
}
|
||||
|
@ -2433,7 +2433,7 @@ DoPlayerMoveBoat(PLAYERp pp)
|
|||
PlaySOsound(pp->sop->mid_sector,SO_IDLE_SOUND);
|
||||
}
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN_BOAT);
|
||||
}
|
||||
|
@ -2488,7 +2488,7 @@ DoPlayerMoveBoat(PLAYERp pp)
|
|||
OperateSectorObject(pp->sop, pp->angle.ang.asbuild(), pp->posx, pp->posy);
|
||||
pp->cursectnum = save_sectnum; // for speed
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_AIM);
|
||||
}
|
||||
|
@ -2939,7 +2939,7 @@ DoPlayerMoveVehicle(PLAYERp pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN_VEHICLE);
|
||||
}
|
||||
|
@ -2984,7 +2984,7 @@ DoPlayerMoveVehicle(PLAYERp pp)
|
|||
OperateSectorObject(pp->sop, pp->angle.ang.asbuild(), pp->posx, pp->posy);
|
||||
pp->cursectnum = save_sectnum; // for speed
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_AIM);
|
||||
}
|
||||
|
@ -3007,7 +3007,7 @@ DoPlayerMoveTurret(PLAYERp pp)
|
|||
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
||||
}
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN_TURRET);
|
||||
}
|
||||
|
@ -3021,7 +3021,7 @@ DoPlayerMoveTurret(PLAYERp pp)
|
|||
else
|
||||
SET(pp->Flags, PF_PLAYER_MOVED);
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_AIM);
|
||||
}
|
||||
|
@ -3600,7 +3600,7 @@ DoPlayerClimb(PLAYERp pp)
|
|||
sp->z = pp->posz + PLAYER_HEIGHT;
|
||||
changespritesect(pp->PlayerSprite, pp->cursectnum);
|
||||
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_AIM);
|
||||
}
|
||||
|
@ -6169,7 +6169,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
|
|||
// allow turning
|
||||
if (TEST(pp->Flags, PF_DEAD_HEAD|PF_HEAD_CONTROL))
|
||||
{
|
||||
if (!cl_syncinput)
|
||||
if (!SyncInput())
|
||||
{
|
||||
SET(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue