- Directly store a ticcmd_t object within CorePlayer.

This commit is contained in:
Mitchell Richters 2023-10-02 16:00:10 +11:00
parent 7953fe7425
commit d90aca9640
32 changed files with 260 additions and 260 deletions

View file

@ -6,7 +6,7 @@
struct CorePlayer
{
InputPacket input;
ticcmd_t cmd;
PlayerAngles Angles;
DCoreActor* actor;

View file

@ -4898,7 +4898,7 @@ void MoveDude(DBloodActor* actor)
{
pPlayer->posture = 0;
pPlayer->bubbleTime = 0;
if (!pPlayer->cantJump && (pPlayer->input.actions & SB_JUMP))
if (!pPlayer->cantJump && (pPlayer->cmd.ucmd.actions & SB_JUMP))
{
actor->vel.Z = FixedToFloat(-0x6aaaa);
pPlayer->cantJump = 1;
@ -6055,7 +6055,7 @@ static void actCheckDudes()
nDrag -= Scale(nDrag, (double)actor->xspr.height, 256.);
constexpr auto maxVel = (36211. / 3000.);
pPlayer->Angles.doRollInput(&pPlayer->input, actor->vel.XY(), maxVel, false);
pPlayer->Angles.doRollInput(&pPlayer->cmd.ucmd, actor->vel.XY(), maxVel, false);
pPlayer->Angles.StrafeVel -= pPlayer->Angles.StrafeVel * nDrag;
}

View file

@ -428,7 +428,7 @@ void GameInterface::Ticker(const ticcmd_t* playercmds)
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
getPlayer(i)->input = playercmds[i].ucmd;
getPlayer(i)->cmd.ucmd = playercmds[i].ucmd;
getPlayer(i)->Angles.resetCameraAngles();
viewBackupView(i);
playerProcess(getPlayer(i));

View file

@ -136,7 +136,7 @@ struct GameInterface : public ::GameInterface
void AddQAVInterpProps(const int res_id, const FString& interptype, const bool loopable, const TMap<int, TArray<int>>&& ignoredata) override;
void RemoveQAVInterpProps(const int res_id) override;
void StartSoundEngine() override;
void reapplyInputBits(InputPacket* const input) override { input->actions |= getPlayer(myconnectindex)->input.actions & (~(SB_BUTTON_MASK | SB_RUN | SB_WEAPONMASK_BITS) | SB_CENTERVIEW); }
void reapplyInputBits(InputPacket* const input) override { input->actions |= getPlayer(myconnectindex)->cmd.ucmd.actions & (~(SB_BUTTON_MASK | SB_RUN | SB_WEAPONMASK_BITS) | SB_CENTERVIEW); }
void doPlayerMovement(const float scaleAdjust) override { gameInput.processMovement(&getPlayer(myconnectindex)->Angles, scaleAdjust); }
unsigned getCrouchState() override;
};

View file

@ -2917,7 +2917,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe
iactor->xspr.medium = kMediumNormal;
if (pPlayer)
{
pPlayer->posture = (!(pPlayer->input.actions & SB_CROUCH)) ? kPostureStand : kPostureCrouch;
pPlayer->posture = (!(pPlayer->cmd.ucmd.actions & SB_CROUCH)) ? kPostureStand : kPostureCrouch;
pPlayer->nWaterPal = 0;
}
@ -3205,7 +3205,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
actor->xspr.medium = kMediumNormal;
if (pPlayer)
{
pPlayer->posture = (!(pPlayer->input.actions & SB_CROUCH)) ? kPostureStand : kPostureCrouch;
pPlayer->posture = (!(pPlayer->cmd.ucmd.actions & SB_CROUCH)) ? kPostureStand : kPostureCrouch;
pPlayer->nWaterPal = 0;
}
@ -4354,15 +4354,15 @@ bool condCheckPlayer(DBloodActor* aCond, int cmpOp, bool PUSH)
return true;
case 10: // check keys pressed
switch (arg1) {
case 1: return (pPlayer->input.fvel > 0); // forward
case 2: return (pPlayer->input.fvel < 0); // backward
case 3: return (pPlayer->input.svel < 0); // left
case 4: return (pPlayer->input.svel > 0); // right
case 5: return !!(pPlayer->input.actions & SB_JUMP); // jump
case 6: return !!(pPlayer->input.actions & SB_CROUCH); // crouch
case 7: return !!(pPlayer->input.actions & SB_FIRE); // normal fire weapon
case 8: return !!(pPlayer->input.actions & SB_ALTFIRE); // alt fire weapon
case 9: return !!(pPlayer->input.actions & SB_OPEN); // use
case 1: return (pPlayer->cmd.ucmd.fvel > 0); // forward
case 2: return (pPlayer->cmd.ucmd.fvel < 0); // backward
case 3: return (pPlayer->cmd.ucmd.svel < 0); // left
case 4: return (pPlayer->cmd.ucmd.svel > 0); // right
case 5: return !!(pPlayer->cmd.ucmd.actions & SB_JUMP); // jump
case 6: return !!(pPlayer->cmd.ucmd.actions & SB_CROUCH); // crouch
case 7: return !!(pPlayer->cmd.ucmd.actions & SB_FIRE); // normal fire weapon
case 8: return !!(pPlayer->cmd.ucmd.actions & SB_ALTFIRE); // alt fire weapon
case 9: return !!(pPlayer->cmd.ucmd.actions & SB_OPEN); // use
default:
condError(aCond, "Specify a correct key!");
break;

View file

@ -758,7 +758,7 @@ void playerResetPosture(BloodPlayer* pPlayer) {
void playerStart(int nPlayer, int bNewLevel)
{
BloodPlayer* pPlayer = getPlayer(nPlayer);
InputPacket* pInput = &pPlayer->input;
InputPacket* pInput = &pPlayer->cmd.ucmd;
ZONE* pStartZone = NULL;
// normal start position
@ -1519,7 +1519,7 @@ void ProcessInput(BloodPlayer* pPlayer)
DBloodActor* actor = pPlayer->GetActor();
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
InputPacket* pInput = &pPlayer->input;
InputPacket* pInput = &pPlayer->cmd.ucmd;
// Originally, this was never able to be true due to sloppy input code in the original game.
// Allow it to become true behind a CVAR to offer an alternate playing experience if desired.
@ -2480,14 +2480,14 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, BloodPlayer& w, Bl
("quakeeffect", w.quakeEffect)
("player_par", w.player_par)
("waterpal", w.nWaterPal)
("actions", w.input.actions)
("actions", w.cmd.ucmd.actions)
.Array("posturedata", &w.pPosture[0][0], &gPostureDefaults[0][0], kModeMax * kPostureMax) // only save actual changes in this.
.EndObject();
if (arc.isReading())
{
playerResetPosture(&w);
w.input.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve.
w.cmd.ucmd.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve.
}
}
return arc;

View file

@ -2167,21 +2167,21 @@ static int WeaponFindLoaded(BloodPlayer* pPlayer, int* a2)
int processSprayCan(BloodPlayer* pPlayer)
{
const char bUseShootAsThrow = !VanillaMode() && (pPlayer->input.actions & SB_FIRE);
const char bUseShootAsThrow = !VanillaMode() && (pPlayer->cmd.ucmd.actions & SB_FIRE);
switch (pPlayer->weaponState)
{
case 5:
if (!(pPlayer->input.actions & SB_ALTFIRE) || bUseShootAsThrow)
if (!(pPlayer->cmd.ucmd.actions & SB_ALTFIRE) || bUseShootAsThrow)
pPlayer->weaponState = 6;
return 1;
case 6:
if ((pPlayer->input.actions & SB_ALTFIRE) && !bUseShootAsThrow)
if ((pPlayer->cmd.ucmd.actions & SB_ALTFIRE) && !bUseShootAsThrow)
{
pPlayer->weaponState = 3;
pPlayer->fuseTime = pPlayer->weaponTimer;
StartQAV(pPlayer, kQAVCANDROP, nClientDropCan);
}
else if (pPlayer->input.actions & SB_FIRE)
else if (pPlayer->cmd.ucmd.actions & SB_FIRE)
{
pPlayer->weaponState = 7;
pPlayer->fuseTime = 0;
@ -2191,7 +2191,7 @@ int processSprayCan(BloodPlayer* pPlayer)
case 7:
{
setThrowPower(pPlayer);
if (!(pPlayer->input.actions & SB_FIRE))
if (!(pPlayer->cmd.ucmd.actions & SB_FIRE))
{
if (!pPlayer->fuseTime)
pPlayer->fuseTime = pPlayer->weaponTimer;
@ -2212,21 +2212,21 @@ int processSprayCan(BloodPlayer* pPlayer)
static bool processTNT(BloodPlayer* pPlayer)
{
const char bUseShootAsThrow = !VanillaMode() && (pPlayer->input.actions & SB_FIRE);
const char bUseShootAsThrow = !VanillaMode() && (pPlayer->cmd.ucmd.actions & SB_FIRE);
switch (pPlayer->weaponState)
{
case 4:
if (!(pPlayer->input.actions & SB_ALTFIRE) || bUseShootAsThrow)
if (!(pPlayer->cmd.ucmd.actions & SB_ALTFIRE) || bUseShootAsThrow)
pPlayer->weaponState = 5;
return 1;
case 5:
if ((pPlayer->input.actions & SB_ALTFIRE) && !bUseShootAsThrow)
if ((pPlayer->cmd.ucmd.actions & SB_ALTFIRE) && !bUseShootAsThrow)
{
pPlayer->weaponState = 1;
pPlayer->fuseTime = pPlayer->weaponTimer;
StartQAV(pPlayer, kQAVBUNDROP, nClientDropBundle);
}
else if (pPlayer->input.actions & SB_FIRE)
else if (pPlayer->cmd.ucmd.actions & SB_FIRE)
{
pPlayer->weaponState = 6;
pPlayer->fuseTime = 0;
@ -2236,7 +2236,7 @@ static bool processTNT(BloodPlayer* pPlayer)
case 6:
{
setThrowPower(pPlayer);
if (!(pPlayer->input.actions & SB_FIRE))
if (!(pPlayer->cmd.ucmd.actions & SB_FIRE))
{
if (!pPlayer->fuseTime)
pPlayer->fuseTime = pPlayer->weaponTimer;
@ -2263,7 +2263,7 @@ static bool processProxy(BloodPlayer* pPlayer)
setThrowPower(pPlayer);
pPlayer->weaponTimer = 0;
pPlayer->qavTimer = 0;
if (!(pPlayer->input.actions & SB_FIRE))
if (!(pPlayer->cmd.ucmd.actions & SB_FIRE))
{
pPlayer->weaponState = 8;
StartQAV(pPlayer, kQAVPROXTHRO, nClientThrowProx);
@ -2285,7 +2285,7 @@ static bool processRemote(BloodPlayer* pPlayer)
{
case 13:
setThrowPower(pPlayer);
if (!(pPlayer->input.actions & SB_FIRE))
if (!(pPlayer->cmd.ucmd.actions & SB_FIRE))
{
pPlayer->weaponState = 11;
StartQAV(pPlayer, kQAVREMTHRO, nClientThrowRemote);
@ -2310,7 +2310,7 @@ static bool processLeech(BloodPlayer* pPlayer)
StartQAV(pPlayer, kQAVSTAFIRE1, nClientFireLifeLeech, 1);
return 1;
case 6:
if (!(pPlayer->input.actions & SB_ALTFIRE))
if (!(pPlayer->cmd.ucmd.actions & SB_ALTFIRE))
{
pPlayer->weaponState = 2;
StartQAV(pPlayer, kQAVSTAFPOST);
@ -2343,7 +2343,7 @@ static bool processTesla(BloodPlayer* pPlayer)
StartQAV(pPlayer, kQAVSGUNFIR1, nClientFireTesla, 1);
return 1;
case 5:
if (!(pPlayer->input.actions & SB_FIRE))
if (!(pPlayer->cmd.ucmd.actions & SB_FIRE))
{
pPlayer->weaponState = 2;
if (checkAmmo2(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
@ -2382,7 +2382,7 @@ void WeaponProcess(BloodPlayer* pPlayer) {
}
#endif
int newweap = pPlayer->input.getNewWeapon();
int newweap = pPlayer->cmd.ucmd.getNewWeapon();
if (newweap > 0 && newweap <= WeaponSel_MaxBlood) pPlayer->newWeapon = newweap;
if (pPlayer->GetActor()->xspr.health == 0)
@ -2413,9 +2413,9 @@ void WeaponProcess(BloodPlayer* pPlayer) {
WeaponPlay(pPlayer);
UpdateAimVector(pPlayer);
pPlayer->weaponTimer -= 4;
bool bShoot = pPlayer->input.actions & SB_FIRE;
bool bShoot2 = pPlayer->input.actions & SB_ALTFIRE;
const int prevNewWeaponVal = pPlayer->input.getNewWeapon(); // used to fix scroll issue for banned weapons
bool bShoot = pPlayer->cmd.ucmd.actions & SB_FIRE;
bool bShoot2 = pPlayer->cmd.ucmd.actions & SB_ALTFIRE;
const int prevNewWeaponVal = pPlayer->cmd.ucmd.getNewWeapon(); // used to fix scroll issue for banned weapons
if ((bShoot || bShoot2 || prevNewWeaponVal) && pPlayer->weaponQav == qavGetCorrectID(kQAVVDIDLE2)) pPlayer->weaponTimer = 0;
if (pPlayer->qavLoop && pPlayer->GetActor()->xspr.health > 0)
{
@ -2481,9 +2481,9 @@ void WeaponProcess(BloodPlayer* pPlayer) {
pPlayer->nextWeapon = kWeapNone;
}
}
if (pPlayer->input.getNewWeapon() == WeaponSel_Next)
if (pPlayer->cmd.ucmd.getNewWeapon() == WeaponSel_Next)
{
pPlayer->input.setNewWeapon(kWeapNone);
pPlayer->cmd.ucmd.setNewWeapon(kWeapNone);
if (VanillaMode())
{
pPlayer->weaponState = 0;
@ -2503,9 +2503,9 @@ void WeaponProcess(BloodPlayer* pPlayer) {
}
pPlayer->newWeapon = weapon;
}
else if (pPlayer->input.getNewWeapon() == WeaponSel_Prev)
else if (pPlayer->cmd.ucmd.getNewWeapon() == WeaponSel_Prev)
{
pPlayer->input.setNewWeapon(kWeapNone);
pPlayer->cmd.ucmd.setNewWeapon(kWeapNone);
if (VanillaMode())
{
pPlayer->weaponState = 0;
@ -2525,7 +2525,7 @@ void WeaponProcess(BloodPlayer* pPlayer) {
}
pPlayer->newWeapon = weapon;
}
else if (pPlayer->input.getNewWeapon() == WeaponSel_Alt)
else if (pPlayer->cmd.ucmd.getNewWeapon() == WeaponSel_Alt)
{
int weapon;
@ -2544,7 +2544,7 @@ void WeaponProcess(BloodPlayer* pPlayer) {
return;
}
pPlayer->input.setNewWeapon(kWeapNone);
pPlayer->cmd.ucmd.setNewWeapon(kWeapNone);
pPlayer->weaponState = 0;
pPlayer->nextWeapon = kWeapNone;
int t = 0;

View file

@ -334,8 +334,8 @@ void movetransports_d(void)
else if (!(sectlotag == ST_1_ABOVE_WATER && getPlayer(p)->on_ground == 1)) break;
if (onfloorz == 0 && fabs(act->spr.pos.Z - getPlayer(p)->GetActor()->getOffsetZ()) < 24)
if ((getPlayer(p)->jetpack_on == 0) || (getPlayer(p)->jetpack_on && (PlayerInput(p, SB_JUMP) || getPlayer(p)->input.uvel > 0)) ||
(getPlayer(p)->jetpack_on && (PlayerInput(p, SB_CROUCH) || getPlayer(p)->input.uvel < 0)))
if ((getPlayer(p)->jetpack_on == 0) || (getPlayer(p)->jetpack_on && (PlayerInput(p, SB_JUMP) || getPlayer(p)->cmd.ucmd.uvel > 0)) ||
(getPlayer(p)->jetpack_on && (PlayerInput(p, SB_CROUCH) || getPlayer(p)->cmd.ucmd.uvel < 0)))
{
getPlayer(p)->GetActor()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
getPlayer(p)->GetActor()->backupvec2();
@ -375,7 +375,7 @@ void movetransports_d(void)
}
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && getPlayer(p)->on_ground && getPlayer(p)->GetActor()->getOffsetZ() > (sectp->floorz - 16) && (PlayerInput(p, SB_CROUCH) || getPlayer(p)->input.uvel < 0 || getPlayer(p)->vel.Z > 8))
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && getPlayer(p)->on_ground && getPlayer(p)->GetActor()->getOffsetZ() > (sectp->floorz - 16) && (PlayerInput(p, SB_CROUCH) || getPlayer(p)->cmd.ucmd.uvel < 0 || getPlayer(p)->vel.Z > 8))
// if( onfloorz && sectlotag == 1 && ps[p].pos.z > (sectp->floorz-(6<<8)) )
{
k = 1;

View file

@ -306,8 +306,8 @@ void movetransports_r(void)
else break;
if (onfloorz == 0 && fabs(act->spr.pos.Z - getPlayer(p)->GetActor()->getOffsetZ()) < 24)
if ((getPlayer(p)->jetpack_on == 0) || (getPlayer(p)->jetpack_on && (PlayerInput(p, SB_JUMP) || getPlayer(p)->input.uvel > 0)) ||
(getPlayer(p)->jetpack_on && (PlayerInput(p, SB_CROUCH) || getPlayer(p)->input.uvel < 0)))
if ((getPlayer(p)->jetpack_on == 0) || (getPlayer(p)->jetpack_on && (PlayerInput(p, SB_JUMP) || getPlayer(p)->cmd.ucmd.uvel > 0)) ||
(getPlayer(p)->jetpack_on && (PlayerInput(p, SB_CROUCH) || getPlayer(p)->cmd.ucmd.uvel < 0)))
{
getPlayer(p)->GetActor()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
getPlayer(p)->GetActor()->backupvec2();

View file

@ -37,7 +37,7 @@ struct GameInterface : public ::GameInterface
void SerializeGameState(FSerializer& arc) override;
void ExitFromMenu() override;
void DrawPlayerSprite(const DVector2& origin, bool onteam) override;
void reapplyInputBits(InputPacket* const input) override { input->actions |= PlayerArray[myconnectindex]->input.actions & SB_CENTERVIEW; }
void reapplyInputBits(InputPacket* const input) override { input->actions |= PlayerArray[myconnectindex]->cmd.ucmd.actions & SB_CENTERVIEW; }
void doPlayerMovement(const float scaleAdjust) override;
unsigned getCrouchState() override;
void UpdateSounds() override;

View file

@ -326,9 +326,9 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
case PLAYER_HORIZ:
if (bSet)
{
if (getPlayer(iPlayer)->input.actions & SB_CENTERVIEW)
if (getPlayer(iPlayer)->cmd.ucmd.actions & SB_CENTERVIEW)
{
getPlayer(iPlayer)->input.actions &= ~SB_CENTERVIEW;
getPlayer(iPlayer)->cmd.ucmd.actions &= ~SB_CENTERVIEW;
}
getPlayer(iPlayer)->GetActor()->spr.Angles.Pitch = maphoriz(-lValue);
}
@ -880,8 +880,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case PLAYER_RETURN_TO_CENTER:
if (bSet) getPlayer(iPlayer)->input.actions |= SB_CENTERVIEW;
else SetGameVarID(lVar2, getPlayer(iPlayer)->input.actions & SB_CENTERVIEW ? int(abs((getPlayer(iPlayer)->GetActor()->spr.Angles.Pitch * (DAngle::fromDeg(9.) / GetMaxPitch())).Degrees())) : 0, sActor, sPlayer);
if (bSet) getPlayer(iPlayer)->cmd.ucmd.actions |= SB_CENTERVIEW;
else SetGameVarID(lVar2, getPlayer(iPlayer)->cmd.ucmd.actions & SB_CENTERVIEW ? int(abs((getPlayer(iPlayer)->GetActor()->spr.Angles.Pitch * (DAngle::fromDeg(9.) / GetMaxPitch())).Degrees())) : 0, sActor, sPlayer);
break;
default:

View file

@ -65,7 +65,7 @@ void GameInterface::Ticker(const ticcmd_t* playercmds)
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
getPlayer(i)->Angles.resetCameraAngles();
getPlayer(i)->input = playercmds[i].ucmd;
getPlayer(i)->cmd.ucmd = playercmds[i].ucmd;
}
// disable synchronised input if set by game.

View file

@ -108,53 +108,53 @@ inline bool isIn(int value, const std::initializer_list<int>& list)
// these are mainly here to avoid directly accessing the input data so that it can be more easily refactored later.
inline bool PlayerInput(int pl, ESyncBits bit)
{
return (!!((getPlayer(pl)->input.actions) & bit));
return (!!((getPlayer(pl)->cmd.ucmd.actions) & bit));
}
inline ESyncBits PlayerInputBits(int pl, ESyncBits bits)
{
return (getPlayer(pl)->input.actions & bits);
return (getPlayer(pl)->cmd.ucmd.actions & bits);
}
inline void PlayerSetInput(int pl, ESyncBits bit)
{
getPlayer(pl)->input.actions |= bit;
getPlayer(pl)->cmd.ucmd.actions |= bit;
}
inline int PlayerNewWeapon(int pl)
{
return getPlayer(pl)->input.getNewWeapon();
return getPlayer(pl)->cmd.ucmd.getNewWeapon();
}
inline void PlayerSetItemUsed(int pl, int num)
{
getPlayer(pl)->input.setItemUsed(num - 1);
getPlayer(pl)->cmd.ucmd.setItemUsed(num - 1);
}
inline bool PlayerUseItem(int pl, int num)
{
return getPlayer(pl)->input.isItemUsed(num - 1);
return getPlayer(pl)->cmd.ucmd.isItemUsed(num - 1);
}
inline float PlayerInputSideVel(int pl)
{
return getPlayer(pl)->input.svel;
return getPlayer(pl)->cmd.ucmd.svel;
}
inline float PlayerInputForwardVel(int pl)
{
return getPlayer(pl)->input.fvel;
return getPlayer(pl)->cmd.ucmd.fvel;
}
inline float PlayerInputAngVel(int pl)
{
return getPlayer(pl)->input.avel;
return getPlayer(pl)->cmd.ucmd.avel;
}
inline DAngle GetPlayerHorizon(int pl)
{
return DAngle::fromDeg(getPlayer(pl)->input.horz);
return DAngle::fromDeg(getPlayer(pl)->cmd.ucmd.horz);
}
inline void clearfriction()
@ -279,9 +279,9 @@ inline int monsterCheatCheck(DDukeActor* self)
inline void processinputvel(int snum)
{
const auto p = getPlayer(snum);
const auto velvect = DVector2(p->input.fvel, p->input.svel).Rotated(p->GetActor()->spr.Angles.Yaw) + p->fric;
p->input.fvel = (float)velvect.X;
p->input.svel = (float)velvect.Y;
const auto velvect = DVector2(p->cmd.ucmd.fvel, p->cmd.ucmd.svel).Rotated(p->GetActor()->spr.Angles.Yaw) + p->fric;
p->cmd.ucmd.fvel = (float)velvect.X;
p->cmd.ucmd.svel = (float)velvect.Y;
}

View file

@ -62,17 +62,17 @@ void hud_input(int plnum)
i = p->aim_mode;
p->aim_mode = !PlayerInput(plnum, SB_AIMMODE);
if (p->aim_mode < i)
p->input.actions |= SB_CENTERVIEW;
p->cmd.ucmd.actions |= SB_CENTERVIEW;
// Backup weapon here as hud_input() is the first function where any one of the weapon variables can change.
p->backupweapon();
if (isRR() && (p->input.actions & SB_CROUCH)) p->input.actions &= ~SB_JUMP;
if (isRR() && (p->cmd.ucmd.actions & SB_CROUCH)) p->cmd.ucmd.actions &= ~SB_JUMP;
if ((isRR() && p->drink_amt > 88))
p->input.actions |= SB_LOOK_LEFT;
p->cmd.ucmd.actions |= SB_LOOK_LEFT;
if ((isRR() && p->drink_amt > 99))
p->input.actions |= SB_LOOK_DOWN;
p->cmd.ucmd.actions |= SB_LOOK_DOWN;
if (isRR())
{
@ -482,7 +482,7 @@ void hud_input(int plnum)
OnEvent(EVENT_TURNAROUND, plnum, nullptr, -1);
if (GetGameVarID(g_iReturnVarID, nullptr, plnum).value() != 0)
{
p->input.actions &= ~SB_TURNAROUND;
p->cmd.ucmd.actions &= ~SB_TURNAROUND;
}
}
}

View file

@ -118,7 +118,7 @@ void forceplayerangle(DukePlayer* p)
const auto ang = (DAngle22_5 - randomAngle(45)) / 2.;
p->GetActor()->spr.Angles.Pitch -= DAngle::fromDeg(26.566);
p->input.actions |= SB_CENTERVIEW;
p->cmd.ucmd.actions |= SB_CENTERVIEW;
p->Angles.ViewAngles.Yaw = ang;
p->Angles.ViewAngles.Roll = -ang;
}
@ -362,7 +362,7 @@ void dokneeattack(int snum)
p->oknee_incs = p->knee_incs;
p->knee_incs++;
pact->spr.Angles.Pitch = (pact->getPosWithOffsetZ() - p->actorsqu->spr.pos.plusZ(-4)).Pitch();
p->input.actions |= SB_CENTERVIEW;
p->cmd.ucmd.actions |= SB_CENTERVIEW;
if (p->knee_incs > 15)
{
p->oknee_incs = p->knee_incs = 0;
@ -673,13 +673,13 @@ void playerCrouch(int snum)
{
const auto p = getPlayer(snum);
const auto pact = p->GetActor();
const auto nVelMoveDown = abs(p->input.uvel * (p->input.uvel < 0));
const auto nVelMoveDown = abs(p->cmd.ucmd.uvel * (p->cmd.ucmd.uvel < 0));
constexpr double vel = 8 + 3;
SetGameVarID(g_iReturnVarID, 0, pact, snum);
OnEvent(EVENT_CROUCH, snum, pact, -1);
if (GetGameVarID(g_iReturnVarID, pact, snum).value() == 0)
{
pact->spr.pos.Z += clamp(vel * !!(p->input.actions & SB_CROUCH) + vel * nVelMoveDown, -vel, vel);
pact->spr.pos.Z += clamp(vel * !!(p->cmd.ucmd.actions & SB_CROUCH) + vel * nVelMoveDown, -vel, vel);
p->crack_time = CRACK_TIME;
}
}
@ -856,13 +856,13 @@ void playerCenterView(int snum)
OnEvent(EVENT_RETURNTOCENTER, snum, p->GetActor(), -1);
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
{
p->input.actions |= SB_CENTERVIEW;
p->input.horz = 0;
p->cmd.ucmd.actions |= SB_CENTERVIEW;
p->cmd.ucmd.horz = 0;
setForcedSyncInput(snum);
}
else
{
p->input.actions &= ~SB_CENTERVIEW;
p->cmd.ucmd.actions &= ~SB_CENTERVIEW;
}
}
@ -873,11 +873,11 @@ void playerLookUp(int snum, ESyncBits actions)
OnEvent(EVENT_LOOKUP, snum, p->GetActor(), -1);
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
{
p->input.actions |= SB_CENTERVIEW;
p->cmd.ucmd.actions |= SB_CENTERVIEW;
}
else
{
p->input.actions &= ~SB_LOOK_UP;
p->cmd.ucmd.actions &= ~SB_LOOK_UP;
}
}
@ -888,11 +888,11 @@ void playerLookDown(int snum, ESyncBits actions)
OnEvent(EVENT_LOOKDOWN, snum, p->GetActor(), -1);
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
{
p->input.actions |= SB_CENTERVIEW;
p->cmd.ucmd.actions |= SB_CENTERVIEW;
}
else
{
p->input.actions &= ~SB_LOOK_DOWN;
p->cmd.ucmd.actions &= ~SB_LOOK_DOWN;
}
}
@ -903,7 +903,7 @@ void playerAimUp(int snum, ESyncBits actions)
OnEvent(EVENT_AIMUP, snum, p->GetActor(), -1);
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() != 0)
{
p->input.actions &= ~SB_AIM_UP;
p->cmd.ucmd.actions &= ~SB_AIM_UP;
}
}
@ -914,7 +914,7 @@ void playerAimDown(int snum, ESyncBits actions)
OnEvent(EVENT_AIMDOWN, snum, p->GetActor(), -1); // due to a typo in WW2GI's CON files this is the same as EVENT_AIMUP.
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() != 0)
{
p->input.actions &= ~SB_AIM_DOWN;
p->cmd.ucmd.actions &= ~SB_AIM_DOWN;
}
}
@ -1582,7 +1582,7 @@ void underwater(int snum, ESyncBits actions, double floorz, double ceilingz)
const auto pact = p->GetActor();
constexpr double dist = (348. / 256.);
const auto kbdDir = ((actions & SB_JUMP) && !p->OnMotorcycle) - ((actions & SB_CROUCH) || p->OnMotorcycle);
const auto velZ = clamp(dist * kbdDir + dist * p->input.uvel, -dist, dist);
const auto velZ = clamp(dist * kbdDir + dist * p->cmd.ucmd.uvel, -dist, dist);
p->jumping_counter = 0;
p->pycount += 32;

View file

@ -581,7 +581,7 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, double f
const auto pact = p->GetActor();
const auto kbdDir = !!(actions & SB_JUMP) - !!(actions & SB_CROUCH);
const double dist = shrunk ? 2 : 8;
const double velZ = clamp(dist * kbdDir + dist * p->input.uvel, -dist, dist);
const double velZ = clamp(dist * kbdDir + dist * p->cmd.ucmd.uvel, -dist, dist);
p->on_ground = 0;
p->jumping_counter = 0;
@ -766,7 +766,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
p->on_warping_sector = 0;
if ((actions & SB_CROUCH) || p->input.uvel < 0)
if ((actions & SB_CROUCH) || p->cmd.ucmd.uvel < 0)
{
playerCrouch(snum);
}
@ -1541,7 +1541,7 @@ void processinput_d(int snum)
p = getPlayer(snum);
auto pact = p->GetActor();
ESyncBits& actions = p->input.actions;
ESyncBits& actions = p->cmd.ucmd.actions;
// Get strafe value before it's rotated by the angle.
const auto strafeVel = PlayerInputSideVel(snum);
@ -1675,7 +1675,7 @@ void processinput_d(int snum)
doubvel = TICSPERFRAME;
checklook(snum,actions);
p->Angles.doViewYaw(&p->input);
p->Angles.doViewYaw(&p->cmd.ucmd);
p->updatecentering(snum);
@ -1714,15 +1714,15 @@ void processinput_d(int snum)
doubvel = 0;
p->vel.X = 0;
p->vel.Y = 0;
p->input.avel = 0;
p->cmd.ucmd.avel = 0;
setForcedSyncInput(snum);
}
else
{
p->input.avel = p->adjustavel(PlayerInputAngVel(snum));
p->cmd.ucmd.avel = p->adjustavel(PlayerInputAngVel(snum));
}
p->Angles.doYawInput(&p->input);
p->Angles.doYawInput(&p->cmd.ucmd);
purplelavacheck(p);
@ -1827,7 +1827,7 @@ void processinput_d(int snum)
}
}
p->Angles.doRollInput(&p->input, p->vel.XY(), maxVel, (psectlotag == 1) || (psectlotag == 2));
p->Angles.doRollInput(&p->cmd.ucmd, p->vel.XY(), maxVel, (psectlotag == 1) || (psectlotag == 2));
HORIZONLY:
@ -1943,7 +1943,7 @@ HORIZONLY:
playerAimDown(snum, actions);
}
p->Angles.doPitchInput(&p->input);
p->Angles.doPitchInput(&p->cmd.ucmd);
p->checkhardlanding();

View file

@ -712,11 +712,11 @@ enum : unsigned
static unsigned outVehicleFlags(DukePlayer* p, ESyncBits& actions)
{
unsigned flags = 0;
flags += VEH_FORWARD * (p->input.fvel > 0);
flags += VEH_REVERSE * (p->input.fvel < 0);
flags += VEH_TURNLEFT * (p->input.avel < 0);
flags += VEH_TURNRIGHT * (p->input.avel > 0);
flags += VEH_BRAKING * (!!(actions & SB_CROUCH) || (p->input.fvel < 0 && p->MotoSpeed > 0));
flags += VEH_FORWARD * (p->cmd.ucmd.fvel > 0);
flags += VEH_REVERSE * (p->cmd.ucmd.fvel < 0);
flags += VEH_TURNLEFT * (p->cmd.ucmd.avel < 0);
flags += VEH_TURNRIGHT * (p->cmd.ucmd.avel > 0);
flags += VEH_BRAKING * (!!(actions & SB_CROUCH) || (p->cmd.ucmd.fvel < 0 && p->MotoSpeed > 0));
actions &= ~SB_CROUCH;
return flags;
}
@ -729,7 +729,7 @@ static unsigned outVehicleFlags(DukePlayer* p, ESyncBits& actions)
static void doVehicleTilting(DukePlayer* const p, const bool canTilt)
{
auto adj = DAngle::fromDeg(p->input.avel * (545943. / 3200000.) * canTilt);
auto adj = DAngle::fromDeg(p->cmd.ucmd.avel * (545943. / 3200000.) * canTilt);
if (p->OnMotorcycle) adj *= 5 * Sgn(p->MotoSpeed);
if (cl_rrvehicletilting) adj *= cl_viewtiltscale;
p->oTiltStatus = p->TiltStatus;
@ -907,7 +907,7 @@ static void doVehicleThrottling(DukePlayer* p, DDukeActor* pact, unsigned& flags
else if ((flags & VEH_BRAKING) && p->MotoSpeed > 0)
{
const auto kbdBraking = brakeSpeed * !!(flags & VEH_BRAKING);
const auto hidBraking = brakeSpeed * p->input.fvel * (p->input.fvel < 0);
const auto hidBraking = brakeSpeed * p->cmd.ucmd.fvel * (p->cmd.ucmd.fvel < 0);
p->MotoSpeed -= clamp<double>(kbdBraking - hidBraking, -brakeSpeed, brakeSpeed);
if (p->MotoSpeed < 0)
p->MotoSpeed = 0;
@ -922,7 +922,7 @@ static void doVehicleThrottling(DukePlayer* p, DDukeActor* pact, unsigned& flags
p->moto_bump_fast = 1;
}
p->MotoSpeed += fwdSpeed * p->input.fvel;
p->MotoSpeed += fwdSpeed * p->cmd.ucmd.fvel;
flags &= ~VEH_FORWARD;
if (p->MotoSpeed > 120)
@ -952,7 +952,7 @@ static void doVehicleThrottling(DukePlayer* p, DDukeActor* pact, unsigned& flags
flags &= ~VEH_TURNRIGHT;
flags |= VEH_TURNLEFT;
}
p->MotoSpeed = revSpeed * p->input.fvel;
p->MotoSpeed = revSpeed * p->cmd.ucmd.fvel;
flags &= ~VEH_REVERSE;
}
}
@ -970,7 +970,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
auto pact = p->GetActor();
unsigned flags = outVehicleFlags(p, actions);
doVehicleTilting(p, !p->on_ground || p->input.avel);
doVehicleTilting(p, !p->on_ground || p->cmd.ucmd.avel);
if (p->MotoSpeed < 0 || p->moto_underwater)
p->MotoSpeed = 0;
@ -1034,7 +1034,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
}
p->moto_on_mud = p->moto_on_oil = 0;
p->input.fvel = clamp<float>((float)p->MotoSpeed, -15.f, 120.f) * (1.f / 40.f);
p->cmd.ucmd.fvel = clamp<float>((float)p->MotoSpeed, -15.f, 120.f) * (1.f / 40.f);
}
//---------------------------------------------------------------------------
@ -1066,7 +1066,7 @@ static void onBoat(int snum, ESyncBits &actions)
p->MotoSpeed = 0;
unsigned flags = outVehicleFlags(p, actions);
doVehicleTilting(p, (p->MotoSpeed != 0 && (p->input.avel || p->moto_drink)) || !p->NotOnWater);
doVehicleTilting(p, (p->MotoSpeed != 0 && (p->cmd.ucmd.avel || p->moto_drink)) || !p->NotOnWater);
doVehicleSounds(p, pact, flags, 87, 88, 89, 90);
if (!p->NotOnWater)
@ -1104,7 +1104,7 @@ static void onBoat(int snum, ESyncBits &actions)
if (p->NotOnWater && p->MotoSpeed > 50)
p->MotoSpeed *= 0.5;
p->input.fvel = clamp<float>((float)p->MotoSpeed, -15.f, 120.f) * (1.f / 40.f);
p->cmd.ucmd.fvel = clamp<float>((float)p->MotoSpeed, -15.f, 120.f) * (1.f / 40.f);
}
//---------------------------------------------------------------------------
@ -1282,7 +1282,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
p->on_warping_sector = 0;
if (((actions & SB_CROUCH) || p->input.uvel < 0) && !p->OnMotorcycle)
if (((actions & SB_CROUCH) || p->cmd.ucmd.uvel < 0) && !p->OnMotorcycle)
{
playerCrouch(snum);
}
@ -2271,7 +2271,7 @@ void processinput_r(int snum)
auto p = getPlayer(snum);
auto pact = p->GetActor();
ESyncBits& actions = p->input.actions;
ESyncBits& actions = p->cmd.ucmd.actions;
// Get strafe value before it's rotated by the angle.
const auto strafeVel = PlayerInputSideVel(snum);
@ -2486,7 +2486,7 @@ void processinput_r(int snum)
doubvel = TICSPERFRAME;
checklook(snum, actions);
p->Angles.doViewYaw(&p->input);
p->Angles.doViewYaw(&p->cmd.ucmd);
p->apply_seasick();
p->updatecentering(snum);
@ -2541,15 +2541,15 @@ void processinput_r(int snum)
doubvel = 0;
p->vel.X = 0;
p->vel.Y = 0;
p->input.avel = 0;
p->cmd.ucmd.avel = 0;
setForcedSyncInput(snum);
}
else
{
p->input.avel = p->adjustavel(PlayerInputAngVel(snum));
p->cmd.ucmd.avel = p->adjustavel(PlayerInputAngVel(snum));
}
p->Angles.doYawInput(&p->input);
p->Angles.doYawInput(&p->cmd.ucmd);
purplelavacheck(p);
@ -2708,7 +2708,7 @@ void processinput_r(int snum)
if (!p->OnMotorcycle && !p->OnBoat)
{
p->Angles.doRollInput(&p->input, p->vel.XY(), maxVel, (psectlotag == 1) || (psectlotag == 2));
p->Angles.doRollInput(&p->cmd.ucmd, p->vel.XY(), maxVel, (psectlotag == 1) || (psectlotag == 2));
}
HORIZONLY:
@ -2900,7 +2900,7 @@ HORIZONLY:
p->GetActor()->spr.Angles.Pitch += maphoriz(d);
}
p->Angles.doPitchInput(&p->input);
p->Angles.doPitchInput(&p->cmd.ucmd);
p->checkhardlanding();

View file

@ -127,7 +127,7 @@ void resetplayerstats(int snum)
p->bobcounter = 0;
p->on_ground = 0;
p->player_par = 0;
p->input.actions |= SB_CENTERVIEW;
p->cmd.ucmd.actions |= SB_CENTERVIEW;
p->airleft = 15*26;
p->rapid_fire_hold = 0;
p->toggle_key_flag = 0;

View file

@ -261,7 +261,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, DukePlayer& w, Duk
("moto_on_oil", w.moto_on_oil)
("moto_on_mud", w.moto_on_mud)
// new stuff
("actions", w.input.actions)
("actions", w.cmd.ucmd.actions)
.Array("frags", w.frags, MAXPLAYERS)
("uservars", w.uservars)
("fistsign", w.fistsign)
@ -273,7 +273,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, DukePlayer& w, Duk
w.GetActor()->backuploc();
w.opyoff = w.pyoff;
w.backupweapon();
w.input.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve.
w.cmd.ucmd.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve.
}
}
return arc;

View file

@ -375,20 +375,20 @@ struct DukePlayer final : public CorePlayer
void updatecentering(const int snum)
{
if (!(input.actions & SB_CENTERVIEW))
if (!(cmd.ucmd.actions & SB_CENTERVIEW))
return;
const bool returnlock = cl_dukepitchmode & kDukePitchLockReturn;
const bool centertest = abs(GetActor()->spr.Angles.Pitch.Degrees()) > 2.2370; // Build horizon value of 5.
if ((centertest && returnlock) || !input.horz)
if ((centertest && returnlock) || !cmd.ucmd.horz)
{
setForcedSyncInput(snum);
input.horz = 0;
cmd.ucmd.horz = 0;
}
else
{
input.actions &= ~SB_CENTERVIEW;
cmd.ucmd.actions &= ~SB_CENTERVIEW;
}
}
};

View file

@ -1178,19 +1178,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addpos, dukeplayer_addpos)
void dukeplayer_centerview(DukePlayer* self)
{
self->input.actions |= SB_CENTERVIEW;
self->cmd.ucmd.actions |= SB_CENTERVIEW;
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, centerview, dukeplayer_centerview)
{
PARAM_SELF_STRUCT_PROLOGUE(DukePlayer);
self->input.actions |= SB_CENTERVIEW;
self->cmd.ucmd.actions |= SB_CENTERVIEW;
return 0;
}
inline int DukePlayer_PlayerInput(DukePlayer* pl, int bit)
{
return (!!((pl->input.actions) & ESyncBits::FromInt(bit)));
return (!!((pl->cmd.ucmd.actions) & ESyncBits::FromInt(bit)));
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerinput, DukePlayer_PlayerInput)

View file

@ -325,7 +325,7 @@ void GameInterface::Ticker(const ticcmd_t* playercmds)
{
const auto pPlayer = getPlayer(i);
pPlayer->Angles.resetCameraAngles();
pPlayer->input = playercmds[i].ucmd;
pPlayer->cmd.ucmd = playercmds[i].ucmd;
updatePlayerTarget(pPlayer);
}

View file

@ -239,7 +239,7 @@ struct GameInterface : public ::GameInterface
void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double interpfrac) override;
int GetCurrentSkill() override;
void StartSoundEngine() override;
void reapplyInputBits(InputPacket* const input) override { input->actions |= getPlayer(nLocalPlayer)->input.actions & SB_CENTERVIEW; }
void reapplyInputBits(InputPacket* const input) override { input->actions |= getPlayer(nLocalPlayer)->cmd.ucmd.actions & SB_CENTERVIEW; }
void doPlayerMovement(const float scaleAdjust) override { gameInput.processMovement(&getPlayer(nLocalPlayer)->Angles, scaleAdjust); }
unsigned getCrouchState() override;
};

View file

@ -933,8 +933,8 @@ void DrawWeapons(ExhumedPlayer* const pPlayer, double interpfrac)
double xPos = 160 + weaponOffsets.first.X;
double yPos = 100 + weaponOffsets.first.Y;
double nFlameAng = interpolatedvalue(lastavel, pPlayer->input.avel, interpfrac);
lastavel = pPlayer->input.avel;
double nFlameAng = interpolatedvalue(lastavel, pPlayer->cmd.ucmd.avel, interpfrac);
lastavel = pPlayer->cmd.ucmd.avel;
if (cl_weaponsway)
{

View file

@ -1109,7 +1109,7 @@ static void updatePlayerVelocity(ExhumedPlayer* const pPlayer)
if (pPlayer->nHealth > 0)
{
const auto pInput = &pPlayer->input;
const auto pInput = &pPlayer->cmd.ucmd;
const auto inputvect = DVector2(pInput->fvel, pInput->svel).Rotated(pPlayerActor->spr.Angles.Yaw) * 0.375;
for (int i = 0; i < 4; i++)
@ -1137,7 +1137,7 @@ static void updatePlayerVelocity(ExhumedPlayer* const pPlayer)
static void updatePlayerInventory(ExhumedPlayer* const pPlayer)
{
if (const auto invDir = !!(pPlayer->input.actions & SB_INVNEXT) - !!(pPlayer->input.actions & SB_INVPREV))
if (const auto invDir = !!(pPlayer->cmd.ucmd.actions & SB_INVNEXT) - !!(pPlayer->cmd.ucmd.actions & SB_INVPREV))
{
int nItem = pPlayer->nItem;
@ -1153,14 +1153,14 @@ static void updatePlayerInventory(ExhumedPlayer* const pPlayer)
if (i > 0) pPlayer->nItem = nItem;
}
if ((pPlayer->input.actions & SB_INVUSE) && pPlayer->nItem != -1)
pPlayer->input.setItemUsed(pPlayer->nItem);
if ((pPlayer->cmd.ucmd.actions & SB_INVUSE) && pPlayer->nItem != -1)
pPlayer->cmd.ucmd.setItemUsed(pPlayer->nItem);
for (int i = 0; i < 6; i++)
{
if (pPlayer->input.isItemUsed(i))
if (pPlayer->cmd.ucmd.isItemUsed(i))
{
pPlayer->input.clearItemUsed(i);
pPlayer->cmd.ucmd.clearItemUsed(i);
if (pPlayer->items[i] > 0 && nItemMagic[i] <= pPlayer->nMagic)
{
@ -1179,7 +1179,7 @@ static void updatePlayerInventory(ExhumedPlayer* const pPlayer)
static void updatePlayerWeapon(ExhumedPlayer* const pPlayer)
{
const bool bIsFiring = pPlayer->input.actions & SB_FIRE;
const bool bIsFiring = pPlayer->cmd.ucmd.actions & SB_FIRE;
if (pPlayer->bIsMummified)
{
@ -1189,7 +1189,7 @@ static void updatePlayerWeapon(ExhumedPlayer* const pPlayer)
}
pPlayer->bIsFiring = bIsFiring;
const auto newWeap = pPlayer->input.getNewWeapon();
const auto newWeap = pPlayer->cmd.ucmd.getNewWeapon();
if (const auto weapDir = (newWeap == WeaponSel_Next) - (newWeap == WeaponSel_Prev))
{
@ -1236,7 +1236,7 @@ unsigned GameInterface::getCrouchState()
static void updatePlayerAction(ExhumedPlayer* const pPlayer)
{
const auto pPlayerActor = pPlayer->GetActor();
const auto pInput = &pPlayer->input;
const auto pInput = &pPlayer->cmd.ucmd;
const auto kbdDir = !!(pInput->actions & SB_CROUCH) - !!(pInput->actions & SB_JUMP);
const double dist = pPlayer->bUnderwater ? 8 : 14;
const double velZ = clamp(dist * kbdDir - dist * pInput->uvel, -dist, dist);
@ -1577,7 +1577,7 @@ static void doPlayerCameraEffects(ExhumedPlayer* const pPlayer, const double nDe
doPlayerVertPanning(pPlayer, nDestVertPan * cl_slopetilting);
// Roll tilting effect, either console or Quake-style.
pPlayer->Angles.doRollInput(&pPlayer->input, pPlayerActor->vel.XY(), maxVel, nUnderwater);
pPlayer->Angles.doRollInput(&pPlayer->cmd.ucmd, pPlayerActor->vel.XY(), maxVel, nUnderwater);
// Update Z bobbing.
if (cl_viewbob)
@ -1835,7 +1835,7 @@ static bool doPlayerInput(ExhumedPlayer* const pPlayer)
return false;
// update player yaw here as per the original workflow.
const auto pInput = &pPlayer->input;
const auto pInput = &pPlayer->cmd.ucmd;
pPlayer->Angles.doViewYaw(pInput);
pPlayer->Angles.doYawInput(pInput);
pPlayer->Angles.doPitchInput(pInput);
@ -1891,9 +1891,9 @@ static void doPlayerRunlistSignals(ExhumedPlayer* const pPlayer, sectortype* con
runlist_SignalRun(pPlayerSect->lotag - 1, pPlayer->nPlayer, &ExhumedAI::LeaveSector);
}
if (!pPlayer->bIsMummified && (pPlayer->input.actions & SB_OPEN))
if (!pPlayer->bIsMummified && (pPlayer->cmd.ucmd.actions & SB_OPEN))
{
pPlayer->input.actions &= ~SB_OPEN;
pPlayer->cmd.ucmd.actions &= ~SB_OPEN;
// neartag finds the nearest sector, wall, and sprite which has its hitag and/or lotag set to a value.
HitInfo near;
@ -1915,10 +1915,10 @@ static void doPlayerRunlistSignals(ExhumedPlayer* const pPlayer, sectortype* con
static bool doPlayerDeathRestart(ExhumedPlayer* const pPlayer)
{
if (!(pPlayer->input.actions & SB_OPEN) || pPlayer->GetActor()->nAction < 16)
if (!(pPlayer->cmd.ucmd.actions & SB_OPEN) || pPlayer->GetActor()->nAction < 16)
return true;
pPlayer->input.actions &= ~SB_OPEN;
pPlayer->cmd.ucmd.actions &= ~SB_OPEN;
if (pPlayer->nPlayer == nLocalPlayer)
{
@ -2150,12 +2150,12 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, ExhumedPlayer& w,
("totalvel", w.totalvel)
("grenade", w.pPlayerGrenade)
("bUnderwater", w.bUnderwater)
("actions", w.input.actions)
("actions", w.cmd.ucmd.actions)
.EndObject();
if (arc.isReading())
{
w.input.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve.
w.cmd.ucmd.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve.
}
}
return arc;

View file

@ -1904,7 +1904,7 @@ struct GameInterface : public ::GameInterface
int GetCurrentSkill() override;
void StartSoundEngine() override;
unsigned getCrouchState() override;
void reapplyInputBits(InputPacket* const input) override { input->actions |= getPlayer(myconnectindex)->input.actions & SB_CENTERVIEW; }
void reapplyInputBits(InputPacket* const input) override { input->actions |= getPlayer(myconnectindex)->cmd.ucmd.actions & SB_CENTERVIEW; }
void doPlayerMovement(const float scaleAdjust) override
{
const auto pp = getPlayer(myconnectindex);

View file

@ -76,7 +76,7 @@ void processWeapon(SWPlayer* const pp)
if (plActor == nullptr) return;
int i;
if (pp->input.getNewWeapon() == WeaponSel_Next)
if (pp->cmd.ucmd.getNewWeapon() == WeaponSel_Next)
{
int next_weapon = plActor->user.WeaponNum + 1;
int start_weapon;
@ -109,9 +109,9 @@ void processWeapon(SWPlayer* const pp)
}
}
pp->input.setNewWeapon(next_weapon + 1);
pp->cmd.ucmd.setNewWeapon(next_weapon + 1);
}
else if (pp->input.getNewWeapon() == WeaponSel_Prev)
else if (pp->cmd.ucmd.getNewWeapon() == WeaponSel_Prev)
{
int prev_weapon = plActor->user.WeaponNum - 1;
int start_weapon;
@ -141,12 +141,12 @@ void processWeapon(SWPlayer* const pp)
}
}
}
pp->input.setNewWeapon(prev_weapon + 1);
pp->cmd.ucmd.setNewWeapon(prev_weapon + 1);
}
else if (pp->input.getNewWeapon() == WeaponSel_Alt)
else if (pp->cmd.ucmd.getNewWeapon() == WeaponSel_Alt)
{
int which_weapon = plActor->user.WeaponNum + 1;
pp->input.setNewWeapon(which_weapon);
pp->cmd.ucmd.setNewWeapon(which_weapon);
}
}

View file

@ -417,7 +417,7 @@ void StopInventoryNightVision(SWPlayer* pp, short InventoryNum)
void InventoryKeys(SWPlayer* pp)
{
// scroll SPELLs left
if (pp->input.actions & SB_INVPREV)
if (pp->cmd.ucmd.actions & SB_INVPREV)
{
if (pp->KeyPressBits & SB_INVPREV)
{
@ -433,7 +433,7 @@ void InventoryKeys(SWPlayer* pp)
}
// scroll SPELLs right
if (pp->input.actions & SB_INVNEXT)
if (pp->cmd.ucmd.actions & SB_INVNEXT)
{
if (pp->KeyPressBits & SB_INVNEXT)
{
@ -448,7 +448,7 @@ void InventoryKeys(SWPlayer* pp)
pp->KeyPressBits |= SB_INVNEXT;
}
if (pp->input.actions & SB_INVUSE)
if (pp->cmd.ucmd.actions & SB_INVUSE)
{
if (pp->KeyPressBits & SB_INVUSE)
{
@ -476,7 +476,7 @@ void InventoryKeys(SWPlayer* pp)
for (int i = 0; i <= 7; i++)
{
ESyncBits bit = ESyncBits::FromInt(SB_ITEM_BIT_1 << i);
if (pp->input.isItemUsed(i))
if (pp->cmd.ucmd.isItemUsed(i))
{
if (pp->KeyPressBits & bit)
{

View file

@ -518,7 +518,7 @@ int WeaponOperate(SWPlayer* pp)
if (!(pp->sop->flags & SOBJ_HAS_WEAPON))
break;
if (pp->input.actions & SB_FIRE)
if (pp->cmd.ucmd.actions & SB_FIRE)
{
if (pp->KeyPressBits & SB_FIRE)
{
@ -533,7 +533,7 @@ int WeaponOperate(SWPlayer* pp)
}
}
weapon = pp->input.getNewWeapon();
weapon = pp->cmd.ucmd.getNewWeapon();
if (weapon)
{
@ -1163,7 +1163,7 @@ void pSwordSlideDown(PANEL_SPRITE* psp)
if (psp->pos.X < -40)
{
// if still holding down the fire key - continue swinging
if (psp->PlayerP->input.actions & SB_FIRE)
if (psp->PlayerP->cmd.ucmd.actions & SB_FIRE)
{
if (psp->PlayerP->KeyPressBits & SB_FIRE)
{
@ -1229,7 +1229,7 @@ void pSwordSlideDownR(PANEL_SPRITE* psp)
if (psp->pos.X > 350)
{
// if still holding down the fire key - continue swinging
if (psp->PlayerP->input.actions & SB_FIRE)
if (psp->PlayerP->cmd.ucmd.actions & SB_FIRE)
{
if (psp->PlayerP->KeyPressBits & SB_FIRE)
{
@ -1318,7 +1318,7 @@ void pSwordRest(PANEL_SPRITE* psp)
force = !!(psp->flags & PANF_UNHIDE_SHOOT);
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -1462,7 +1462,7 @@ PANEL_STATE ps_RetractStar[] =
void pStarRestTest(PANEL_SPRITE* psp)
{
if (psp->PlayerP->input.actions & SB_FIRE)
if (psp->PlayerP->cmd.ucmd.actions & SB_FIRE)
{
if (psp->PlayerP->KeyPressBits & SB_FIRE)
{
@ -1638,7 +1638,7 @@ void pStarRest(PANEL_SPRITE* psp)
pStarBobSetup(psp);
pWeaponBob(psp, PLAYER_MOVING(psp->PlayerP));
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -2499,7 +2499,7 @@ void pUziRest(PANEL_SPRITE* psp)
SetVisNorm();
shooting = (psp->PlayerP->input.actions & SB_FIRE) && (psp->PlayerP->KeyPressBits & SB_FIRE);
shooting = (psp->PlayerP->cmd.ucmd.actions & SB_FIRE) && (psp->PlayerP->KeyPressBits & SB_FIRE);
shooting |= force;
pUziBobSetup(psp);
@ -2528,7 +2528,7 @@ void pUziAction(PANEL_SPRITE* psp)
{
static int alternate = 0;
bool shooting = (psp->PlayerP->input.actions & SB_FIRE) && (psp->PlayerP->KeyPressBits & SB_FIRE);
bool shooting = (psp->PlayerP->cmd.ucmd.actions & SB_FIRE) && (psp->PlayerP->KeyPressBits & SB_FIRE);
if (shooting)
{
@ -3239,7 +3239,7 @@ void pShotgunRest(PANEL_SPRITE* psp)
pWeaponBob(psp, PLAYER_MOVING(psp->PlayerP));
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -3288,7 +3288,7 @@ void pShotgunRestTest(PANEL_SPRITE* psp)
pShotgunBobSetup(psp);
pWeaponBob(psp, PLAYER_MOVING(psp->PlayerP));
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -3676,7 +3676,7 @@ void pRailRest(PANEL_SPRITE* psp)
pRailBobSetup(psp);
pWeaponBob(psp, PLAYER_MOVING(psp->PlayerP));
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -3714,7 +3714,7 @@ void pRailRestTest(PANEL_SPRITE* psp)
pRailBobSetup(psp);
pWeaponBob(psp, PLAYER_MOVING(psp->PlayerP));
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -4030,7 +4030,7 @@ void InitWeaponHothead(SWPlayer* pp)
void pHotheadRestTest(PANEL_SPRITE* psp)
{
if (psp->PlayerP->input.actions & SB_FIRE)
if (psp->PlayerP->cmd.ucmd.actions & SB_FIRE)
{
if (psp->PlayerP->KeyPressBits & SB_FIRE)
{
@ -4146,7 +4146,7 @@ void pHotheadRest(PANEL_SPRITE* psp)
pHotheadBobSetup(psp);
pWeaponBob(psp, PLAYER_MOVING(psp->PlayerP));
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -4183,7 +4183,7 @@ void pHotheadRest(PANEL_SPRITE* psp)
void pHotheadAction(PANEL_SPRITE* psp)
{
bool shooting = (psp->PlayerP->input.actions & SB_FIRE) && (psp->PlayerP->KeyPressBits & SB_FIRE);
bool shooting = (psp->PlayerP->cmd.ucmd.actions & SB_FIRE) && (psp->PlayerP->KeyPressBits & SB_FIRE);
if (shooting)
{
@ -4771,7 +4771,7 @@ void pMicroRest(PANEL_SPRITE* psp)
}
}
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -5124,7 +5124,7 @@ void pHeartRest(PANEL_SPRITE* psp)
pHeartBobSetup(psp);
pWeaponBob(psp, PLAYER_MOVING(psp->PlayerP));
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -5738,7 +5738,7 @@ void pGrenadeRest(PANEL_SPRITE* psp)
pGrenadeBobSetup(psp);
pWeaponBob(psp, PLAYER_MOVING(psp->PlayerP));
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -6031,7 +6031,7 @@ void pMineRest(PANEL_SPRITE* psp)
pMineBobSetup(psp);
pWeaponBob(psp, PLAYER_MOVING(psp->PlayerP));
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -6758,7 +6758,7 @@ void pFistSlideDown(PANEL_SPRITE* psp)
if (psp->pos.Y > 440)
{
// if still holding down the fire key - continue swinging
if (psp->PlayerP->input.actions & SB_FIRE)
if (psp->PlayerP->cmd.ucmd.actions & SB_FIRE)
{
if (psp->PlayerP->KeyPressBits & SB_FIRE)
{
@ -6861,7 +6861,7 @@ void pFistSlideDownR(PANEL_SPRITE* psp)
if (psp->pos.Y > 440)
{
// if still holding down the fire key - continue swinging
if (psp->PlayerP->input.actions & SB_FIRE)
if (psp->PlayerP->cmd.ucmd.actions & SB_FIRE)
{
if (psp->PlayerP->KeyPressBits & SB_FIRE)
{
@ -6976,7 +6976,7 @@ void pFistRest(PANEL_SPRITE* psp)
// Reset move to default
psp->PlayerP->WpnKungFuMove = 0;
if ((psp->PlayerP->input.actions & SB_FIRE) || force)
if ((psp->PlayerP->cmd.ucmd.actions & SB_FIRE) || force)
{
if ((psp->PlayerP->KeyPressBits & SB_FIRE) || force)
{
@ -7051,7 +7051,7 @@ void pFistBlock(PANEL_SPRITE* psp)
pFistBobSetup(psp);
pWeaponBob(psp, PLAYER_MOVING(psp->PlayerP));
if (!(psp->PlayerP->input.actions & SB_OPEN))
if (!(psp->PlayerP->cmd.ucmd.actions & SB_OPEN))
{
pStatePlusOne(psp);
}
@ -7097,7 +7097,7 @@ bool pWeaponUnHideKeys(PANEL_SPRITE* psp, PANEL_STATE* state)
return false;
}
if (psp->PlayerP->input.actions & SB_HOLSTER)
if (psp->PlayerP->cmd.ucmd.actions & SB_HOLSTER)
{
if (psp->PlayerP->KeyPressBits & SB_HOLSTER)
{
@ -7111,7 +7111,7 @@ bool pWeaponUnHideKeys(PANEL_SPRITE* psp, PANEL_STATE* state)
psp->PlayerP->KeyPressBits |= SB_HOLSTER;
}
if (psp->PlayerP->input.actions & SB_FIRE)
if (psp->PlayerP->cmd.ucmd.actions & SB_FIRE)
{
if (psp->PlayerP->KeyPressBits & SB_FIRE)
{
@ -7146,7 +7146,7 @@ bool pWeaponHideKeys(PANEL_SPRITE* psp, PANEL_STATE* state)
return true;
}
if (psp->PlayerP->input.actions & SB_HOLSTER)
if (psp->PlayerP->cmd.ucmd.actions & SB_HOLSTER)
{
if (psp->PlayerP->KeyPressBits & SB_HOLSTER)
{

View file

@ -1429,18 +1429,18 @@ void DoPlayerTurnVehicle(SWPlayer* pp, double zz, double floordist)
if (sop->drive_angspeed)
{
float drive_oavel = pp->drive_avel;
pp->drive_avel = float((pp->input.avel * sop->drive_angspeed + (drive_oavel * (sop->drive_angslide - 1))) / sop->drive_angslide);
pp->drive_avel = float((pp->cmd.ucmd.avel * sop->drive_angspeed + (drive_oavel * (sop->drive_angslide - 1))) / sop->drive_angslide);
pp->input.avel = pp->drive_avel;
pp->cmd.ucmd.avel = pp->drive_avel;
}
else
{
pp->input.avel *= synctics * 0.125f;
pp->cmd.ucmd.avel *= synctics * 0.125f;
}
if (pp->input.avel != 0)
if (pp->cmd.ucmd.avel != 0)
{
auto sum = pp->GetActor()->spr.Angles.Yaw + DAngle::fromDeg(pp->input.avel);
auto sum = pp->GetActor()->spr.Angles.Yaw + DAngle::fromDeg(pp->cmd.ucmd.avel);
if (MultiClipTurn(pp, sum, zz, floordist))
{
pp->GetActor()->spr.Angles.Yaw = sum;
@ -1462,13 +1462,13 @@ void DoPlayerTurnVehicleRect(SWPlayer* pp, DVector2* pos, DVector2* opos)
if (sop->drive_angspeed)
{
float drive_oavel = pp->drive_avel;
pp->drive_avel = float((pp->input.avel * sop->drive_angspeed + (drive_oavel * (sop->drive_angslide - 1))) / sop->drive_angslide);
pp->drive_avel = float((pp->cmd.ucmd.avel * sop->drive_angspeed + (drive_oavel * (sop->drive_angslide - 1))) / sop->drive_angslide);
avel = pp->drive_avel;
}
else
{
avel = pp->input.avel * synctics * 0.125f;
avel = pp->cmd.ucmd.avel * synctics * 0.125f;
}
if (avel != 0)
@ -1495,18 +1495,18 @@ void DoPlayerTurnTurret(SWPlayer* pp)
if (sop->drive_angspeed)
{
float drive_oavel = pp->drive_avel;
pp->drive_avel = float((pp->input.avel * sop->drive_angspeed + (drive_oavel * (sop->drive_angslide - 1))) / sop->drive_angslide);
pp->drive_avel = float((pp->cmd.ucmd.avel * sop->drive_angspeed + (drive_oavel * (sop->drive_angslide - 1))) / sop->drive_angslide);
pp->input.avel = pp->drive_avel;
pp->cmd.ucmd.avel = pp->drive_avel;
}
else
{
pp->input.avel = pp->input.avel * synctics * 0.25f;
pp->cmd.ucmd.avel = pp->cmd.ucmd.avel * synctics * 0.25f;
}
if (fabs(pp->input.avel) >= FLT_EPSILON)
if (fabs(pp->cmd.ucmd.avel) >= FLT_EPSILON)
{
new_ang = pp->GetActor()->spr.Angles.Yaw + DAngle::fromDeg(pp->input.avel);
new_ang = pp->GetActor()->spr.Angles.Yaw + DAngle::fromDeg(pp->cmd.ucmd.avel);
if (sop->limit_ang_center >= nullAngle)
{
@ -1556,7 +1556,7 @@ void SlipSlope(SWPlayer* pp)
void DoPlayerSlopeTilting(SWPlayer* pp)
{
const bool canslopetilt = (pp->input.actions & SB_AIMMODE) && !(pp->Flags & (PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING));
const bool canslopetilt = (pp->cmd.ucmd.actions & SB_AIMMODE) && !(pp->Flags & (PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING));
pp->Angles.doViewPitch(canslopetilt, pp->Flags & PF_CLIMBING);
}
@ -1576,7 +1576,7 @@ void DoPlayerBob(SWPlayer* pp)
dist = 0;
// if running make a longer stride
if (pp->input.actions & SB_RUN)
if (pp->cmd.ucmd.actions & SB_RUN)
{
amt = dist * (12. / 16.);
dist *= FixedToFloat(26000);
@ -1917,8 +1917,8 @@ void DoPlayerMove(SWPlayer* pp)
SlipSlope(pp);
pp->Angles.doViewYaw(&pp->input);
pp->Angles.doYawInput(&pp->input);
pp->Angles.doViewYaw(&pp->cmd.ucmd);
pp->Angles.doYawInput(&pp->cmd.ucmd);
UpdatePlayerSpriteAngle(pp);
pp->lastcursector = pp->cursector;
@ -1933,8 +1933,8 @@ void DoPlayerMove(SWPlayer* pp)
pp->ovect = pp->vect;
pp->Angles.PrevStrafeVel = pp->Angles.StrafeVel;
pp->vect.X += pp->input.fvel * INPUT_SCALE;
pp->vect.Y += pp->input.svel * INPUT_SCALE;
pp->vect.X += pp->cmd.ucmd.fvel * INPUT_SCALE;
pp->vect.Y += pp->cmd.ucmd.svel * INPUT_SCALE;
pp->Angles.StrafeVel += pp->svel * INPUT_SCALE;
friction = pp->friction;
@ -1968,7 +1968,7 @@ void DoPlayerMove(SWPlayer* pp)
actor->vel.X = pp->vect.Length();
constexpr auto maxVel = (380401538. / 36022361.);
pp->Angles.doRollInput(&pp->input, pp->vect, maxVel, pp->Flags & (PF_SWIMMING|PF_DIVING));
pp->Angles.doRollInput(&pp->cmd.ucmd, pp->vect, maxVel, pp->Flags & (PF_SWIMMING|PF_DIVING));
if (pp->Flags & (PF_CLIP_CHEAT))
{
@ -2049,7 +2049,7 @@ void DoPlayerMove(SWPlayer* pp)
DoPlayerSetWadeDepth(pp);
DoPlayerSlopeTilting(pp);
pp->Angles.doPitchInput(&pp->input);
pp->Angles.doPitchInput(&pp->cmd.ucmd);
if (pp->insector() && (pp->cursector->extra & SECTFX_DYNAMIC_AREA))
{
@ -2301,7 +2301,7 @@ void DriveCrush(SWPlayer* pp, DVector2* quad)
return;
// not moving - don't crush
if ((pp->vect.isZero()) == 0 && pp->input.avel == 0)
if ((pp->vect.isZero()) == 0 && pp->cmd.ucmd.avel == 0)
return;
// main sector
@ -2459,9 +2459,9 @@ void DoPlayerMoveVehicle(SWPlayer* pp)
if (!Prediction)
{
if (abs(pp->input.fvel + pp->input.svel) && !abs(pp->lastinput.fvel + pp->lastinput.svel))
if (abs(pp->cmd.ucmd.fvel + pp->cmd.ucmd.svel) && !abs(pp->lastinput.fvel + pp->lastinput.svel))
PlaySOsound(pp->sop->mid_sector,SO_DRIVE_SOUND);
else if (!abs(pp->input.fvel + pp->input.svel) && abs(pp->lastinput.fvel + pp->lastinput.svel))
else if (!abs(pp->cmd.ucmd.fvel + pp->cmd.ucmd.svel) && abs(pp->lastinput.fvel + pp->lastinput.svel))
PlaySOsound(pp->sop->mid_sector,SO_IDLE_SOUND);
}
@ -2474,16 +2474,16 @@ void DoPlayerMoveVehicle(SWPlayer* pp)
if (sop->drive_speed)
{
pp->vect.X = pp->input.fvel * sop->drive_speed * (70. / 1048576.);
pp->vect.Y = pp->input.svel * sop->drive_speed * (70. / 1048576.);
pp->vect.X = pp->cmd.ucmd.fvel * sop->drive_speed * (70. / 1048576.);
pp->vect.Y = pp->cmd.ucmd.svel * sop->drive_speed * (70. / 1048576.);
// does sliding/momentum
pp->vect = (pp->vect + (pp->ovect * (sop->drive_slide-1)))/sop->drive_slide;
}
else
{
pp->vect.X += pp->input.fvel * INPUT_SCALE;
pp->vect.Y += pp->input.svel * INPUT_SCALE;
pp->vect.X += pp->cmd.ucmd.fvel * INPUT_SCALE;
pp->vect.Y += pp->cmd.ucmd.svel * INPUT_SCALE;
pp->vect *= TANK_FRICTION;
pp->vect = (pp->vect + (pp->ovect*1))/2;
@ -2616,7 +2616,7 @@ void DoPlayerMoveVehicle(SWPlayer* pp)
pp->cursector = save_sect; // for speed
DoPlayerSlopeTilting(pp);
pp->Angles.doPitchInput(&pp->input);
pp->Angles.doPitchInput(&pp->cmd.ucmd);
DoTankTreads(pp);
}
@ -2631,9 +2631,9 @@ void DoPlayerMoveTurret(SWPlayer* pp)
{
if (!Prediction)
{
if (pp->input.avel && !pp->lastinput.avel)
if (pp->cmd.ucmd.avel && !pp->lastinput.avel)
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
else if (!pp->input.avel && pp->lastinput.avel)
else if (!pp->cmd.ucmd.avel && pp->lastinput.avel)
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
}
@ -2646,7 +2646,7 @@ void DoPlayerMoveTurret(SWPlayer* pp)
pp->Flags |= (PF_PLAYER_MOVED);
DoPlayerSlopeTilting(pp);
pp->Angles.doPitchInput(&pp->input);
pp->Angles.doPitchInput(&pp->cmd.ucmd);
}
//---------------------------------------------------------------------------
@ -2738,7 +2738,7 @@ void DoPlayerJump(SWPlayer* pp)
short i;
// reset flag key for double jumps
if (!(pp->input.actions & SB_JUMP))
if (!(pp->cmd.ucmd.actions & SB_JUMP))
{
pp->KeyPressBits |= SB_JUMP;
}
@ -2747,7 +2747,7 @@ void DoPlayerJump(SWPlayer* pp)
for (i = 0; i < synctics; i++)
{
// PlayerGravity += synctics; // See how increase gravity as we go?
if (pp->input.actions & SB_JUMP)
if (pp->cmd.ucmd.actions & SB_JUMP)
{
if (pp->JumpDuration > 0)
{
@ -2919,7 +2919,7 @@ void DoPlayerFall(SWPlayer* pp)
double depth;
// reset flag key for double jumps
if (!(pp->input.actions & SB_JUMP))
if (!(pp->cmd.ucmd.actions & SB_JUMP))
{
pp->KeyPressBits |= SB_JUMP;
}
@ -2947,9 +2947,9 @@ void DoPlayerFall(SWPlayer* pp)
}
else if (pp->jump_speed > 1300)
{
if (!(pp->input.actions & SB_CENTERVIEW))
if (!(pp->cmd.ucmd.actions & SB_CENTERVIEW))
{
pp->input.actions |= SB_CENTERVIEW;
pp->cmd.ucmd.actions |= SB_CENTERVIEW;
}
}
@ -2996,7 +2996,7 @@ void DoPlayerFall(SWPlayer* pp)
StopPlayerSound(pp, DIGI_FALLSCREAM);
// i any kind of crawl key get rid of recoil
if (DoPlayerTestCrawl(pp) || (pp->input.actions & SB_CROUCH))
if (DoPlayerTestCrawl(pp) || (pp->cmd.ucmd.actions & SB_CROUCH))
{
pp->posZset(pp->loz - PLAYER_CRAWL_HEIGHTF);
}
@ -3033,7 +3033,7 @@ void DoPlayerFall(SWPlayer* pp)
return;
}
if ((pp->input.actions & SB_CROUCH) || pp->input.uvel < 0)
if ((pp->cmd.ucmd.actions & SB_CROUCH) || pp->cmd.ucmd.uvel < 0)
{
StackedWaterSplash(pp);
DoPlayerBeginCrawl(pp);
@ -3104,8 +3104,8 @@ void DoPlayerClimb(SWPlayer* pp)
if (Prediction)
return;
pp->vect.X += pp->input.fvel * INPUT_SCALE;
pp->vect.Y += pp->input.svel * INPUT_SCALE;
pp->vect.X += pp->cmd.ucmd.fvel * INPUT_SCALE;
pp->vect.Y += pp->cmd.ucmd.svel * INPUT_SCALE;
pp->vect *= PLAYER_CLIMB_FRICTION;
if (abs(pp->vect.X) < 0.05 && abs(pp->vect.Y) < 0.05)
pp->vect.X = pp->vect.Y = 0;
@ -3118,7 +3118,7 @@ void DoPlayerClimb(SWPlayer* pp)
// need to rewrite this for FAF stuff
// Jump off of the ladder
if (pp->input.actions & SB_JUMP)
if (pp->cmd.ucmd.actions & SB_JUMP)
{
pp->Flags &= ~(PF_CLIMBING|PF_WEAPON_DOWN);
plActor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
@ -3232,7 +3232,7 @@ void DoPlayerClimb(SWPlayer* pp)
ChangeActorSect(pp->GetActor(), pp->cursector);
DoPlayerSlopeTilting(pp);
pp->Angles.doPitchInput(&pp->input);
pp->Angles.doPitchInput(&pp->cmd.ucmd);
if (FAF_ConnectArea(pp->cursector))
{
@ -3407,7 +3407,7 @@ void DoPlayerCrawl(SWPlayer* pp)
return;
}
if ((!(pp->input.actions & SB_CROUCH) || pp->input.uvel > 0) && abs(pp->loz - pp->hiz) >= PLAYER_STANDING_ROOM)
if ((!(pp->cmd.ucmd.actions & SB_CROUCH) || pp->cmd.ucmd.uvel > 0) && abs(pp->loz - pp->hiz) >= PLAYER_STANDING_ROOM)
{
// Let off of crawl to get up
pp->Flags &= ~PF_CRAWLING;
@ -3509,8 +3509,8 @@ void DoPlayerFly(SWPlayer* pp)
return;
}
const auto kbdDir = !!(pp->input.actions & SB_CROUCH) - !!(pp->input.actions & SB_JUMP);
const double velZ = clamp(PLAYER_FLY_INC * kbdDir - PLAYER_FLY_INC * pp->input.uvel, -PLAYER_FLY_INC, PLAYER_FLY_INC);
const auto kbdDir = !!(pp->cmd.ucmd.actions & SB_CROUCH) - !!(pp->cmd.ucmd.actions & SB_JUMP);
const double velZ = clamp(PLAYER_FLY_INC * kbdDir - PLAYER_FLY_INC * pp->cmd.ucmd.uvel, -PLAYER_FLY_INC, PLAYER_FLY_INC);
pp->z_speed = clamp(pp->z_speed + velZ, -PLAYER_FLY_MAX_SPEED, PLAYER_FLY_MAX_SPEED) * FixedToFloat(58000);
pp->GetActor()->spr.pos.Z += pp->z_speed;
@ -3709,7 +3709,7 @@ int PlayerCanDive(SWPlayer* pp)
if (Prediction)
return false;
const double velZ = clamp(20. * !!(pp->input.actions & SB_CROUCH) - 20. * pp->input.uvel, -20., 20.);
const double velZ = clamp(20. * !!(pp->cmd.ucmd.actions & SB_CROUCH) - 20. * pp->cmd.ucmd.uvel, -20., 20.);
// Crawl - check for diving
if (velZ > 0 || pp->jump_speed > 0)
@ -4387,8 +4387,8 @@ void DoPlayerDive(SWPlayer* pp)
}
}
const auto kbdDir = !!(pp->input.actions & SB_CROUCH) - !!(pp->input.actions & SB_JUMP);
const double velZ = clamp(PLAYER_DIVE_INC * kbdDir - PLAYER_DIVE_INC * pp->input.uvel, -PLAYER_DIVE_INC, PLAYER_DIVE_INC);
const auto kbdDir = !!(pp->cmd.ucmd.actions & SB_CROUCH) - !!(pp->cmd.ucmd.actions & SB_JUMP);
const double velZ = clamp(PLAYER_DIVE_INC * kbdDir - PLAYER_DIVE_INC * pp->cmd.ucmd.uvel, -PLAYER_DIVE_INC, PLAYER_DIVE_INC);
pp->z_speed = clamp(pp->z_speed + velZ, -PLAYER_DIVE_MAX_SPEED, PLAYER_DIVE_MAX_SPEED) * FixedToFloat(58000);
if (abs(pp->z_speed) < 1./16)
@ -4674,7 +4674,7 @@ void DoPlayerWade(SWPlayer* pp)
if (DebugOperate)
{
if (pp->input.actions & SB_OPEN)
if (pp->cmd.ucmd.actions & SB_OPEN)
{
if (pp->KeyPressBits & SB_OPEN)
{
@ -4702,13 +4702,13 @@ void DoPlayerWade(SWPlayer* pp)
}
// Crawl Commanded
if (((pp->input.actions & SB_CROUCH) || pp->input.uvel < 0) && pp->WadeDepth <= PLAYER_CRAWL_WADE_DEPTH)
if (((pp->cmd.ucmd.actions & SB_CROUCH) || pp->cmd.ucmd.uvel < 0) && pp->WadeDepth <= PLAYER_CRAWL_WADE_DEPTH)
{
DoPlayerBeginCrawl(pp);
return;
}
if (pp->input.actions & SB_JUMP)
if (pp->cmd.ucmd.actions & SB_JUMP)
{
if (pp->KeyPressBits & SB_JUMP)
{
@ -4982,7 +4982,7 @@ void DoPlayerBeginOperate(SWPlayer* pp)
switch (sop->track)
{
case SO_VEHICLE:
if (pp->input.fvel || pp->input.svel)
if (pp->cmd.ucmd.fvel || pp->cmd.ucmd.svel)
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
else
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
@ -4991,7 +4991,7 @@ void DoPlayerBeginOperate(SWPlayer* pp)
break;
case SO_TURRET_MGUN:
case SO_TURRET:
if (pp->input.avel)
if (pp->cmd.ucmd.avel)
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
else
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
@ -5075,7 +5075,7 @@ void DoPlayerBeginRemoteOperate(SWPlayer* pp, SECTOR_OBJECT* sop)
switch (sop->track)
{
case SO_VEHICLE:
if (pp->input.fvel || pp->input.svel)
if (pp->cmd.ucmd.fvel || pp->cmd.ucmd.svel)
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
else
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
@ -5084,7 +5084,7 @@ void DoPlayerBeginRemoteOperate(SWPlayer* pp, SECTOR_OBJECT* sop)
break;
case SO_TURRET_MGUN:
case SO_TURRET:
if (pp->input.avel)
if (pp->cmd.ucmd.avel)
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
else
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
@ -5190,7 +5190,7 @@ void DoPlayerStopOperate(SWPlayer* pp)
void DoPlayerOperateTurret(SWPlayer* pp)
{
if (pp->input.actions & SB_OPEN)
if (pp->cmd.ucmd.actions & SB_OPEN)
{
if (pp->KeyPressBits & SB_OPEN)
{
@ -5234,7 +5234,7 @@ void DoPlayerOperateTurret(SWPlayer* pp)
void DoPlayerOperateVehicle(SWPlayer* pp)
{
if (pp->input.actions & SB_OPEN)
if (pp->cmd.ucmd.actions & SB_OPEN)
{
if (pp->KeyPressBits & SB_OPEN)
{
@ -5601,7 +5601,7 @@ void DoPlayerBeginDie(SWPlayer* pp)
// Get rid of all panel spells that are currently working
KillAllPanelInv(pp);
pp->input.actions &= ~SB_CENTERVIEW;
pp->cmd.ucmd.actions &= ~SB_CENTERVIEW;
pp->friction = PLAYER_RUN_FRICTION;
pp->slide_vect.Zero();
@ -5756,7 +5756,7 @@ void DoPlayerDeathHurl(SWPlayer* pp)
{
if (numplayers > 1)
{
if (pp->input.actions & SB_FIRE)
if (pp->cmd.ucmd.actions & SB_FIRE)
{
if (pp->KeyPressBits & SB_FIRE)
{
@ -5795,7 +5795,7 @@ void DoPlayerDeathFollowKiller(SWPlayer* pp)
// allow turning
if (pp->Flags & (PF_DEAD_HEAD|PF_HEAD_CONTROL))
{
pp->GetActor()->spr.Angles.Yaw += DAngle::fromDeg(pp->input.avel);
pp->GetActor()->spr.Angles.Yaw += DAngle::fromDeg(pp->cmd.ucmd.avel);
UpdatePlayerSpriteAngle(pp);
}
@ -5820,7 +5820,7 @@ void DoPlayerDeathCheckKeys(SWPlayer* pp)
{
DSWActor* plActor = pp->GetActor();
if (pp->input.actions & SB_OPEN)
if (pp->cmd.ucmd.actions & SB_OPEN)
{
// Spawn a dead LoWang body for non-head deaths
// Hey Frank, if you think of a better check, go ahead and put it in.
@ -6308,14 +6308,14 @@ void DoPlayerRun(SWPlayer* pp)
}
// Crawl Commanded
if ((pp->input.actions & SB_CROUCH) || pp->input.uvel < 0)
if ((pp->cmd.ucmd.actions & SB_CROUCH) || pp->cmd.ucmd.uvel < 0)
{
DoPlayerBeginCrawl(pp);
return;
}
// Jump
if (pp->input.actions & SB_JUMP)
if (pp->cmd.ucmd.actions & SB_JUMP)
{
if (pp->KeyPressBits & SB_JUMP)
{
@ -6341,7 +6341,7 @@ void DoPlayerRun(SWPlayer* pp)
{
if (!(pp->Flags & PF_DEAD) && !Prediction)
{
if (pp->input.actions & SB_OPEN)
if (pp->cmd.ucmd.actions & SB_OPEN)
{
if ((pp->KeyPressBits & SB_OPEN) && pp->insector())
{
@ -6576,7 +6576,7 @@ void ChopsCheck(SWPlayer* pp)
{
if (!M_Active() && !(pp->Flags & PF_DEAD) && !pp->sop_riding && numplayers <= 1)
{
if (pp->input.actions & ~SB_RUN || pp->input.fvel || pp->input.svel || pp->input.avel || pp->input.horz ||
if (pp->cmd.ucmd.actions & ~SB_RUN || pp->cmd.ucmd.fvel || pp->cmd.ucmd.svel || pp->cmd.ucmd.avel || pp->cmd.ucmd.horz ||
(pp->Flags & (PF_CLIMBING | PF_FALLING | PF_DIVING)))
{
// Hit a input key or other reason to stop chops
@ -6776,8 +6776,8 @@ void domovethings(const ticcmd_t* playercmds)
pp = getPlayer(pnum);
GlobPlayerP = pp;
pp->lastinput = pp->input;
pp->input = playercmds[pnum].ucmd;
pp->lastinput = pp->cmd.ucmd;
pp->cmd.ucmd = playercmds[pnum].ucmd;
if (pp->cookieTime)
{
@ -6810,14 +6810,14 @@ void domovethings(const ticcmd_t* playercmds)
ChopsCheck(pp);
// Get strafe value before it's rotated by the angle.
pp->svel = pp->input.svel;
pp->svel = pp->cmd.ucmd.svel;
// convert fvel/svel into a vector before performing actions.
const auto fvel = pp->input.fvel + pp->input.uvel * (pp->DoPlayerAction == DoPlayerClimb);
const auto svel = pp->input.svel;
const auto fvel = pp->cmd.ucmd.fvel + pp->cmd.ucmd.uvel * (pp->DoPlayerAction == DoPlayerClimb);
const auto svel = pp->cmd.ucmd.svel;
const auto velvect = DVector2(fvel, svel).Rotated(pp->GetActor()->spr.Angles.Yaw);
pp->input.fvel = (float)velvect.X;
pp->input.svel = (float)velvect.Y;
pp->cmd.ucmd.fvel = (float)velvect.X;
pp->cmd.ucmd.svel = (float)velvect.Y;
if (pp->DoPlayerAction) pp->DoPlayerAction(pp);

View file

@ -566,7 +566,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SWPlayer& w, SWPla
{
w.ovect = w.vect;
w.obob_z = w.bob_z;
w.input.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve.
w.cmd.ucmd.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve.
memset(w.cookieQuote, 0, sizeof(w.cookieQuote)); // no need to remember this.
w.StartColor = 0;

View file

@ -2356,7 +2356,7 @@ void PlayerOperateEnv(SWPlayer* pp)
// Switch & door activations
//
if (pp->input.actions & SB_OPEN)
if (pp->cmd.ucmd.actions & SB_OPEN)
{
if (pp->KeyPressBits & SB_OPEN)
{