mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
- Duke: Rename player_struct::sync
to player_struct::input
to match the other games.
This commit is contained in:
parent
eeb9f48436
commit
719cc75fd2
14 changed files with 84 additions and 84 deletions
|
@ -334,8 +334,8 @@ void movetransports_d(void)
|
|||
else if (!(sectlotag == ST_1_ABOVE_WATER && ps[p].on_ground == 1)) break;
|
||||
|
||||
if (onfloorz == 0 && fabs(act->spr.pos.Z - ps[p].GetActor()->getOffsetZ()) < 24)
|
||||
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].sync.uvel > 0)) ||
|
||||
(ps[p].jetpack_on && (PlayerInput(p, SB_CROUCH) || ps[p].sync.uvel < 0)))
|
||||
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].input.uvel > 0)) ||
|
||||
(ps[p].jetpack_on && (PlayerInput(p, SB_CROUCH) || ps[p].input.uvel < 0)))
|
||||
{
|
||||
ps[p].GetActor()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
||||
ps[p].GetActor()->backupvec2();
|
||||
|
@ -375,7 +375,7 @@ void movetransports_d(void)
|
|||
}
|
||||
|
||||
|
||||
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].on_ground && ps[p].GetActor()->getOffsetZ() > (sectp->floorz - 16) && (PlayerInput(p, SB_CROUCH) || ps[p].sync.uvel < 0 || ps[p].vel.Z > 8))
|
||||
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].on_ground && ps[p].GetActor()->getOffsetZ() > (sectp->floorz - 16) && (PlayerInput(p, SB_CROUCH) || ps[p].input.uvel < 0 || ps[p].vel.Z > 8))
|
||||
// if( onfloorz && sectlotag == 1 && ps[p].pos.z > (sectp->floorz-(6<<8)) )
|
||||
{
|
||||
k = 1;
|
||||
|
|
|
@ -306,8 +306,8 @@ void movetransports_r(void)
|
|||
else break;
|
||||
|
||||
if (onfloorz == 0 && fabs(act->spr.pos.Z - ps[p].GetActor()->getOffsetZ()) < 24)
|
||||
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].sync.uvel > 0)) ||
|
||||
(ps[p].jetpack_on && (PlayerInput(p, SB_CROUCH) || ps[p].sync.uvel < 0)))
|
||||
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].input.uvel > 0)) ||
|
||||
(ps[p].jetpack_on && (PlayerInput(p, SB_CROUCH) || ps[p].input.uvel < 0)))
|
||||
{
|
||||
ps[p].GetActor()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
||||
ps[p].GetActor()->backupvec2();
|
||||
|
|
|
@ -39,7 +39,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 |= ps[myconnectindex].sync.actions & SB_CENTERVIEW; }
|
||||
void reapplyInputBits(InputPacket* const input) override { input->actions |= ps[myconnectindex].input.actions & SB_CENTERVIEW; }
|
||||
void doPlayerMovement(const float scaleAdjust) override;
|
||||
unsigned getCrouchState() override;
|
||||
void UpdateSounds() override;
|
||||
|
|
|
@ -326,9 +326,9 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
case PLAYER_HORIZ:
|
||||
if (bSet)
|
||||
{
|
||||
if (ps[iPlayer].sync.actions & SB_CENTERVIEW)
|
||||
if (ps[iPlayer].input.actions & SB_CENTERVIEW)
|
||||
{
|
||||
ps[iPlayer].sync.actions &= ~SB_CENTERVIEW;
|
||||
ps[iPlayer].input.actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
ps[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) ps[iPlayer].sync.actions |= SB_CENTERVIEW;
|
||||
else SetGameVarID(lVar2, ps[iPlayer].sync.actions & SB_CENTERVIEW ? int(abs((ps[iPlayer].GetActor()->spr.Angles.Pitch * (DAngle::fromDeg(9.) / GetMaxPitch())).Degrees())) : 0, sActor, sPlayer);
|
||||
if (bSet) ps[iPlayer].input.actions |= SB_CENTERVIEW;
|
||||
else SetGameVarID(lVar2, ps[iPlayer].input.actions & SB_CENTERVIEW ? int(abs((ps[iPlayer].GetActor()->spr.Angles.Pitch * (DAngle::fromDeg(9.) / GetMaxPitch())).Degrees())) : 0, sActor, sPlayer);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -65,7 +65,7 @@ void GameInterface::Ticker(const ticcmd_t* playercmds)
|
|||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
ps[i].Angles.resetCameraAngles();
|
||||
ps[i].sync = playercmds[i].ucmd;
|
||||
ps[i].input = playercmds[i].ucmd;
|
||||
}
|
||||
|
||||
// disable synchronised input if set by game.
|
||||
|
|
|
@ -103,53 +103,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 (!!((ps[pl].sync.actions) & bit));
|
||||
return (!!((ps[pl].input.actions) & bit));
|
||||
}
|
||||
|
||||
inline ESyncBits PlayerInputBits(int pl, ESyncBits bits)
|
||||
{
|
||||
return (ps[pl].sync.actions & bits);
|
||||
return (ps[pl].input.actions & bits);
|
||||
}
|
||||
|
||||
inline void PlayerSetInput(int pl, ESyncBits bit)
|
||||
{
|
||||
ps[pl].sync.actions |= bit;
|
||||
ps[pl].input.actions |= bit;
|
||||
}
|
||||
|
||||
|
||||
inline int PlayerNewWeapon(int pl)
|
||||
{
|
||||
return ps[pl].sync.getNewWeapon();
|
||||
return ps[pl].input.getNewWeapon();
|
||||
}
|
||||
|
||||
inline void PlayerSetItemUsed(int pl, int num)
|
||||
{
|
||||
ps[pl].sync.setItemUsed(num - 1);
|
||||
ps[pl].input.setItemUsed(num - 1);
|
||||
}
|
||||
|
||||
inline bool PlayerUseItem(int pl, int num)
|
||||
{
|
||||
return ps[pl].sync.isItemUsed(num - 1);
|
||||
return ps[pl].input.isItemUsed(num - 1);
|
||||
}
|
||||
|
||||
inline float PlayerInputSideVel(int pl)
|
||||
{
|
||||
return ps[pl].sync.svel;
|
||||
return ps[pl].input.svel;
|
||||
}
|
||||
|
||||
inline float PlayerInputForwardVel(int pl)
|
||||
{
|
||||
return ps[pl].sync.fvel;
|
||||
return ps[pl].input.fvel;
|
||||
}
|
||||
|
||||
inline float PlayerInputAngVel(int pl)
|
||||
{
|
||||
return ps[pl].sync.avel;
|
||||
return ps[pl].input.avel;
|
||||
}
|
||||
|
||||
inline DAngle GetPlayerHorizon(int pl)
|
||||
{
|
||||
return DAngle::fromDeg(ps[pl].sync.horz);
|
||||
return DAngle::fromDeg(ps[pl].input.horz);
|
||||
}
|
||||
|
||||
inline void clearfriction()
|
||||
|
@ -274,9 +274,9 @@ inline int monsterCheatCheck(DDukeActor* self)
|
|||
inline void processinputvel(int snum)
|
||||
{
|
||||
const auto p = &ps[snum];
|
||||
const auto velvect = DVector2(p->sync.fvel, p->sync.svel).Rotated(p->GetActor()->spr.Angles.Yaw) + p->fric;
|
||||
p->sync.fvel = (float)velvect.X;
|
||||
p->sync.svel = (float)velvect.Y;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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->sync.actions |= SB_CENTERVIEW;
|
||||
p->input.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->sync.actions & SB_CROUCH)) p->sync.actions &= ~SB_JUMP;
|
||||
if (isRR() && (p->input.actions & SB_CROUCH)) p->input.actions &= ~SB_JUMP;
|
||||
|
||||
if ((isRR() && p->drink_amt > 88))
|
||||
p->sync.actions |= SB_LOOK_LEFT;
|
||||
p->input.actions |= SB_LOOK_LEFT;
|
||||
if ((isRR() && p->drink_amt > 99))
|
||||
p->sync.actions |= SB_LOOK_DOWN;
|
||||
p->input.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->sync.actions &= ~SB_TURNAROUND;
|
||||
p->input.actions &= ~SB_TURNAROUND;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ void forceplayerangle(player_struct* p)
|
|||
const auto ang = (DAngle22_5 - randomAngle(45)) / 2.;
|
||||
|
||||
p->GetActor()->spr.Angles.Pitch -= DAngle::fromDeg(26.566);
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
p->input.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->sync.actions |= SB_CENTERVIEW;
|
||||
p->input.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 = &ps[snum];
|
||||
const auto pact = p->GetActor();
|
||||
const auto nVelMoveDown = abs(p->sync.uvel * (p->sync.uvel < 0));
|
||||
const auto nVelMoveDown = abs(p->input.uvel * (p->input.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->sync.actions & SB_CROUCH) + vel * nVelMoveDown, -vel, vel);
|
||||
pact->spr.pos.Z += clamp(vel * !!(p->input.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->sync.actions |= SB_CENTERVIEW;
|
||||
p->sync.horz = 0;
|
||||
p->input.actions |= SB_CENTERVIEW;
|
||||
p->input.horz = 0;
|
||||
setForcedSyncInput(snum);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->sync.actions &= ~SB_CENTERVIEW;
|
||||
p->input.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->sync.actions |= SB_CENTERVIEW;
|
||||
p->input.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
p->sync.actions &= ~SB_LOOK_UP;
|
||||
p->input.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->sync.actions |= SB_CENTERVIEW;
|
||||
p->input.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
p->sync.actions &= ~SB_LOOK_DOWN;
|
||||
p->input.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->sync.actions &= ~SB_AIM_UP;
|
||||
p->input.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->sync.actions &= ~SB_AIM_DOWN;
|
||||
p->input.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->sync.uvel, -dist, dist);
|
||||
const auto velZ = clamp(dist * kbdDir + dist * p->input.uvel, -dist, dist);
|
||||
|
||||
p->jumping_counter = 0;
|
||||
p->pycount += 32;
|
||||
|
|
|
@ -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->sync.uvel, -dist, dist);
|
||||
const double velZ = clamp(dist * kbdDir + dist * p->input.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->sync.uvel < 0)
|
||||
if ((actions & SB_CROUCH) || p->input.uvel < 0)
|
||||
{
|
||||
playerCrouch(snum);
|
||||
}
|
||||
|
@ -1541,7 +1541,7 @@ void processinput_d(int snum)
|
|||
p = &ps[snum];
|
||||
auto pact = p->GetActor();
|
||||
|
||||
ESyncBits& actions = p->sync.actions;
|
||||
ESyncBits& actions = p->input.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->sync);
|
||||
p->Angles.doViewYaw(&p->input);
|
||||
|
||||
p->updatecentering(snum);
|
||||
|
||||
|
@ -1714,15 +1714,15 @@ void processinput_d(int snum)
|
|||
doubvel = 0;
|
||||
p->vel.X = 0;
|
||||
p->vel.Y = 0;
|
||||
p->sync.avel = 0;
|
||||
p->input.avel = 0;
|
||||
setForcedSyncInput(snum);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->sync.avel = p->adjustavel(PlayerInputAngVel(snum));
|
||||
p->input.avel = p->adjustavel(PlayerInputAngVel(snum));
|
||||
}
|
||||
|
||||
p->Angles.doYawInput(&p->sync);
|
||||
p->Angles.doYawInput(&p->input);
|
||||
|
||||
purplelavacheck(p);
|
||||
|
||||
|
@ -1827,7 +1827,7 @@ void processinput_d(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
p->Angles.doRollInput(&p->sync, p->vel.XY(), maxVel, (psectlotag == 1) || (psectlotag == 2));
|
||||
p->Angles.doRollInput(&p->input, p->vel.XY(), maxVel, (psectlotag == 1) || (psectlotag == 2));
|
||||
|
||||
HORIZONLY:
|
||||
|
||||
|
@ -1943,7 +1943,7 @@ HORIZONLY:
|
|||
playerAimDown(snum, actions);
|
||||
}
|
||||
|
||||
p->Angles.doPitchInput(&p->sync);
|
||||
p->Angles.doPitchInput(&p->input);
|
||||
|
||||
p->checkhardlanding();
|
||||
|
||||
|
|
|
@ -712,11 +712,11 @@ enum : unsigned
|
|||
static unsigned outVehicleFlags(player_struct* p, ESyncBits& actions)
|
||||
{
|
||||
unsigned flags = 0;
|
||||
flags += VEH_FORWARD * (p->sync.fvel > 0);
|
||||
flags += VEH_REVERSE * (p->sync.fvel < 0);
|
||||
flags += VEH_TURNLEFT * (p->sync.avel < 0);
|
||||
flags += VEH_TURNRIGHT * (p->sync.avel > 0);
|
||||
flags += VEH_BRAKING * (!!(actions & SB_CROUCH) || (p->sync.fvel < 0 && p->MotoSpeed > 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));
|
||||
actions &= ~SB_CROUCH;
|
||||
return flags;
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ static unsigned outVehicleFlags(player_struct* p, ESyncBits& actions)
|
|||
|
||||
static void doVehicleTilting(player_struct* const p, const bool canTilt)
|
||||
{
|
||||
auto adj = DAngle::fromDeg(p->sync.avel * (545943. / 3200000.) * canTilt);
|
||||
auto adj = DAngle::fromDeg(p->input.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(player_struct* p, DDukeActor* pact, unsigned& fl
|
|||
else if ((flags & VEH_BRAKING) && p->MotoSpeed > 0)
|
||||
{
|
||||
const auto kbdBraking = brakeSpeed * !!(flags & VEH_BRAKING);
|
||||
const auto hidBraking = brakeSpeed * p->sync.fvel * (p->sync.fvel < 0);
|
||||
const auto hidBraking = brakeSpeed * p->input.fvel * (p->input.fvel < 0);
|
||||
p->MotoSpeed -= clamp<double>(kbdBraking - hidBraking, -brakeSpeed, brakeSpeed);
|
||||
if (p->MotoSpeed < 0)
|
||||
p->MotoSpeed = 0;
|
||||
|
@ -922,7 +922,7 @@ static void doVehicleThrottling(player_struct* p, DDukeActor* pact, unsigned& fl
|
|||
p->moto_bump_fast = 1;
|
||||
}
|
||||
|
||||
p->MotoSpeed += fwdSpeed * p->sync.fvel;
|
||||
p->MotoSpeed += fwdSpeed * p->input.fvel;
|
||||
flags &= ~VEH_FORWARD;
|
||||
|
||||
if (p->MotoSpeed > 120)
|
||||
|
@ -952,7 +952,7 @@ static void doVehicleThrottling(player_struct* p, DDukeActor* pact, unsigned& fl
|
|||
flags &= ~VEH_TURNRIGHT;
|
||||
flags |= VEH_TURNLEFT;
|
||||
}
|
||||
p->MotoSpeed = revSpeed * p->sync.fvel;
|
||||
p->MotoSpeed = revSpeed * p->input.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->sync.avel);
|
||||
doVehicleTilting(p, !p->on_ground || p->input.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->sync.fvel = clamp<float>((float)p->MotoSpeed, -15.f, 120.f) * (1.f / 40.f);
|
||||
p->input.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->sync.avel || p->moto_drink)) || !p->NotOnWater);
|
||||
doVehicleTilting(p, (p->MotoSpeed != 0 && (p->input.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->sync.fvel = clamp<float>((float)p->MotoSpeed, -15.f, 120.f) * (1.f / 40.f);
|
||||
p->input.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->sync.uvel < 0) && !p->OnMotorcycle)
|
||||
if (((actions & SB_CROUCH) || p->input.uvel < 0) && !p->OnMotorcycle)
|
||||
{
|
||||
playerCrouch(snum);
|
||||
}
|
||||
|
@ -2271,7 +2271,7 @@ void processinput_r(int snum)
|
|||
auto p = &ps[snum];
|
||||
auto pact = p->GetActor();
|
||||
|
||||
ESyncBits& actions = p->sync.actions;
|
||||
ESyncBits& actions = p->input.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->sync);
|
||||
p->Angles.doViewYaw(&p->input);
|
||||
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->sync.avel = 0;
|
||||
p->input.avel = 0;
|
||||
setForcedSyncInput(snum);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->sync.avel = p->adjustavel(PlayerInputAngVel(snum));
|
||||
p->input.avel = p->adjustavel(PlayerInputAngVel(snum));
|
||||
}
|
||||
|
||||
p->Angles.doYawInput(&p->sync);
|
||||
p->Angles.doYawInput(&p->input);
|
||||
|
||||
purplelavacheck(p);
|
||||
|
||||
|
@ -2708,7 +2708,7 @@ void processinput_r(int snum)
|
|||
|
||||
if (!p->OnMotorcycle && !p->OnBoat)
|
||||
{
|
||||
p->Angles.doRollInput(&p->sync, p->vel.XY(), maxVel, (psectlotag == 1) || (psectlotag == 2));
|
||||
p->Angles.doRollInput(&p->input, 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->sync);
|
||||
p->Angles.doPitchInput(&p->input);
|
||||
|
||||
p->checkhardlanding();
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ void resetplayerstats(int snum)
|
|||
p->bobcounter = 0;
|
||||
p->on_ground = 0;
|
||||
p->player_par = 0;
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
p->input.actions |= SB_CENTERVIEW;
|
||||
p->airleft = 15*26;
|
||||
p->rapid_fire_hold = 0;
|
||||
p->toggle_key_flag = 0;
|
||||
|
|
|
@ -261,7 +261,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
|||
("moto_on_oil", w.moto_on_oil)
|
||||
("moto_on_mud", w.moto_on_mud)
|
||||
// new stuff
|
||||
("actions", w.sync.actions)
|
||||
("actions", w.input.actions)
|
||||
.Array("frags", w.frags, MAXPLAYERS)
|
||||
("uservars", w.uservars)
|
||||
("fistsign", w.fistsign)
|
||||
|
@ -273,7 +273,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
|||
w.GetActor()->backuploc();
|
||||
w.opyoff = w.pyoff;
|
||||
w.backupweapon();
|
||||
w.sync.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve.
|
||||
w.input.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve.
|
||||
}
|
||||
}
|
||||
return arc;
|
||||
|
|
|
@ -349,7 +349,7 @@ struct player_struct
|
|||
TArray<GameVarValue> uservars;
|
||||
|
||||
// input stuff.
|
||||
InputPacket sync;
|
||||
InputPacket input;
|
||||
|
||||
DDukeActor* GetActor();
|
||||
int GetPlayerNum();
|
||||
|
@ -382,20 +382,20 @@ struct player_struct
|
|||
|
||||
void updatecentering(const int snum)
|
||||
{
|
||||
if (!(sync.actions & SB_CENTERVIEW))
|
||||
if (!(input.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) || !sync.horz)
|
||||
if ((centertest && returnlock) || !input.horz)
|
||||
{
|
||||
setForcedSyncInput(snum);
|
||||
sync.horz = 0;
|
||||
input.horz = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sync.actions &= ~SB_CENTERVIEW;
|
||||
input.actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1178,19 +1178,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addpos, dukeplayer_addpos)
|
|||
|
||||
void dukeplayer_centerview(player_struct* self)
|
||||
{
|
||||
self->sync.actions |= SB_CENTERVIEW;
|
||||
self->input.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, centerview, dukeplayer_centerview)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||
self->sync.actions |= SB_CENTERVIEW;
|
||||
self->input.actions |= SB_CENTERVIEW;
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int DukePlayer_PlayerInput(player_struct* pl, int bit)
|
||||
{
|
||||
return (!!((pl->sync.actions) & ESyncBits::FromInt(bit)));
|
||||
return (!!((pl->input.actions) & ESyncBits::FromInt(bit)));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerinput, DukePlayer_PlayerInput)
|
||||
|
|
Loading…
Reference in a new issue