mirror of
https://github.com/ZDoom/Raze.git
synced 2025-06-01 09:42:27 +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;
|
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 (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)) ||
|
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].sync.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()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
||||||
ps[p].GetActor()->backupvec2();
|
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)) )
|
// if( onfloorz && sectlotag == 1 && ps[p].pos.z > (sectp->floorz-(6<<8)) )
|
||||||
{
|
{
|
||||||
k = 1;
|
k = 1;
|
||||||
|
|
|
@ -306,8 +306,8 @@ void movetransports_r(void)
|
||||||
else break;
|
else break;
|
||||||
|
|
||||||
if (onfloorz == 0 && fabs(act->spr.pos.Z - ps[p].GetActor()->getOffsetZ()) < 24)
|
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)) ||
|
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].sync.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()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
||||||
ps[p].GetActor()->backupvec2();
|
ps[p].GetActor()->backupvec2();
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct GameInterface : public ::GameInterface
|
||||||
void SerializeGameState(FSerializer& arc) override;
|
void SerializeGameState(FSerializer& arc) override;
|
||||||
void ExitFromMenu() override;
|
void ExitFromMenu() override;
|
||||||
void DrawPlayerSprite(const DVector2& origin, bool onteam) 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;
|
void doPlayerMovement(const float scaleAdjust) override;
|
||||||
unsigned getCrouchState() override;
|
unsigned getCrouchState() override;
|
||||||
void UpdateSounds() override;
|
void UpdateSounds() override;
|
||||||
|
|
|
@ -326,9 +326,9 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
||||||
case PLAYER_HORIZ:
|
case PLAYER_HORIZ:
|
||||||
if (bSet)
|
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);
|
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;
|
break;
|
||||||
|
|
||||||
case PLAYER_RETURN_TO_CENTER:
|
case PLAYER_RETURN_TO_CENTER:
|
||||||
if (bSet) ps[iPlayer].sync.actions |= SB_CENTERVIEW;
|
if (bSet) ps[iPlayer].input.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);
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -65,7 +65,7 @@ void GameInterface::Ticker(const ticcmd_t* playercmds)
|
||||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||||
{
|
{
|
||||||
ps[i].Angles.resetCameraAngles();
|
ps[i].Angles.resetCameraAngles();
|
||||||
ps[i].sync = playercmds[i].ucmd;
|
ps[i].input = playercmds[i].ucmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable synchronised input if set by game.
|
// 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.
|
// 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)
|
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)
|
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)
|
inline void PlayerSetInput(int pl, ESyncBits bit)
|
||||||
{
|
{
|
||||||
ps[pl].sync.actions |= bit;
|
ps[pl].input.actions |= bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline int PlayerNewWeapon(int pl)
|
inline int PlayerNewWeapon(int pl)
|
||||||
{
|
{
|
||||||
return ps[pl].sync.getNewWeapon();
|
return ps[pl].input.getNewWeapon();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void PlayerSetItemUsed(int pl, int num)
|
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)
|
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)
|
inline float PlayerInputSideVel(int pl)
|
||||||
{
|
{
|
||||||
return ps[pl].sync.svel;
|
return ps[pl].input.svel;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float PlayerInputForwardVel(int pl)
|
inline float PlayerInputForwardVel(int pl)
|
||||||
{
|
{
|
||||||
return ps[pl].sync.fvel;
|
return ps[pl].input.fvel;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float PlayerInputAngVel(int pl)
|
inline float PlayerInputAngVel(int pl)
|
||||||
{
|
{
|
||||||
return ps[pl].sync.avel;
|
return ps[pl].input.avel;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline DAngle GetPlayerHorizon(int pl)
|
inline DAngle GetPlayerHorizon(int pl)
|
||||||
{
|
{
|
||||||
return DAngle::fromDeg(ps[pl].sync.horz);
|
return DAngle::fromDeg(ps[pl].input.horz);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void clearfriction()
|
inline void clearfriction()
|
||||||
|
@ -274,9 +274,9 @@ inline int monsterCheatCheck(DDukeActor* self)
|
||||||
inline void processinputvel(int snum)
|
inline void processinputvel(int snum)
|
||||||
{
|
{
|
||||||
const auto p = &ps[snum];
|
const auto p = &ps[snum];
|
||||||
const auto velvect = DVector2(p->sync.fvel, p->sync.svel).Rotated(p->GetActor()->spr.Angles.Yaw) + p->fric;
|
const auto velvect = DVector2(p->input.fvel, p->input.svel).Rotated(p->GetActor()->spr.Angles.Yaw) + p->fric;
|
||||||
p->sync.fvel = (float)velvect.X;
|
p->input.fvel = (float)velvect.X;
|
||||||
p->sync.svel = (float)velvect.Y;
|
p->input.svel = (float)velvect.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,17 +62,17 @@ void hud_input(int plnum)
|
||||||
i = p->aim_mode;
|
i = p->aim_mode;
|
||||||
p->aim_mode = !PlayerInput(plnum, SB_AIMMODE);
|
p->aim_mode = !PlayerInput(plnum, SB_AIMMODE);
|
||||||
if (p->aim_mode < i)
|
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.
|
// Backup weapon here as hud_input() is the first function where any one of the weapon variables can change.
|
||||||
p->backupweapon();
|
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))
|
if ((isRR() && p->drink_amt > 88))
|
||||||
p->sync.actions |= SB_LOOK_LEFT;
|
p->input.actions |= SB_LOOK_LEFT;
|
||||||
if ((isRR() && p->drink_amt > 99))
|
if ((isRR() && p->drink_amt > 99))
|
||||||
p->sync.actions |= SB_LOOK_DOWN;
|
p->input.actions |= SB_LOOK_DOWN;
|
||||||
|
|
||||||
if (isRR())
|
if (isRR())
|
||||||
{
|
{
|
||||||
|
@ -482,7 +482,7 @@ void hud_input(int plnum)
|
||||||
OnEvent(EVENT_TURNAROUND, plnum, nullptr, -1);
|
OnEvent(EVENT_TURNAROUND, plnum, nullptr, -1);
|
||||||
if (GetGameVarID(g_iReturnVarID, nullptr, plnum).value() != 0)
|
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.;
|
const auto ang = (DAngle22_5 - randomAngle(45)) / 2.;
|
||||||
|
|
||||||
p->GetActor()->spr.Angles.Pitch -= DAngle::fromDeg(26.566);
|
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.Yaw = ang;
|
||||||
p->Angles.ViewAngles.Roll = -ang;
|
p->Angles.ViewAngles.Roll = -ang;
|
||||||
}
|
}
|
||||||
|
@ -362,7 +362,7 @@ void dokneeattack(int snum)
|
||||||
p->oknee_incs = p->knee_incs;
|
p->oknee_incs = p->knee_incs;
|
||||||
p->knee_incs++;
|
p->knee_incs++;
|
||||||
pact->spr.Angles.Pitch = (pact->getPosWithOffsetZ() - p->actorsqu->spr.pos.plusZ(-4)).Pitch();
|
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)
|
if (p->knee_incs > 15)
|
||||||
{
|
{
|
||||||
p->oknee_incs = p->knee_incs = 0;
|
p->oknee_incs = p->knee_incs = 0;
|
||||||
|
@ -673,13 +673,13 @@ void playerCrouch(int snum)
|
||||||
{
|
{
|
||||||
const auto p = &ps[snum];
|
const auto p = &ps[snum];
|
||||||
const auto pact = p->GetActor();
|
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;
|
constexpr double vel = 8 + 3;
|
||||||
SetGameVarID(g_iReturnVarID, 0, pact, snum);
|
SetGameVarID(g_iReturnVarID, 0, pact, snum);
|
||||||
OnEvent(EVENT_CROUCH, snum, pact, -1);
|
OnEvent(EVENT_CROUCH, snum, pact, -1);
|
||||||
if (GetGameVarID(g_iReturnVarID, pact, snum).value() == 0)
|
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;
|
p->crack_time = CRACK_TIME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -856,13 +856,13 @@ void playerCenterView(int snum)
|
||||||
OnEvent(EVENT_RETURNTOCENTER, snum, p->GetActor(), -1);
|
OnEvent(EVENT_RETURNTOCENTER, snum, p->GetActor(), -1);
|
||||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
||||||
{
|
{
|
||||||
p->sync.actions |= SB_CENTERVIEW;
|
p->input.actions |= SB_CENTERVIEW;
|
||||||
p->sync.horz = 0;
|
p->input.horz = 0;
|
||||||
setForcedSyncInput(snum);
|
setForcedSyncInput(snum);
|
||||||
}
|
}
|
||||||
else
|
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);
|
OnEvent(EVENT_LOOKUP, snum, p->GetActor(), -1);
|
||||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
||||||
{
|
{
|
||||||
p->sync.actions |= SB_CENTERVIEW;
|
p->input.actions |= SB_CENTERVIEW;
|
||||||
}
|
}
|
||||||
else
|
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);
|
OnEvent(EVENT_LOOKDOWN, snum, p->GetActor(), -1);
|
||||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
||||||
{
|
{
|
||||||
p->sync.actions |= SB_CENTERVIEW;
|
p->input.actions |= SB_CENTERVIEW;
|
||||||
}
|
}
|
||||||
else
|
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);
|
OnEvent(EVENT_AIMUP, snum, p->GetActor(), -1);
|
||||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() != 0)
|
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.
|
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)
|
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();
|
const auto pact = p->GetActor();
|
||||||
constexpr double dist = (348. / 256.);
|
constexpr double dist = (348. / 256.);
|
||||||
const auto kbdDir = ((actions & SB_JUMP) && !p->OnMotorcycle) - ((actions & SB_CROUCH) || p->OnMotorcycle);
|
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->jumping_counter = 0;
|
||||||
p->pycount += 32;
|
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 pact = p->GetActor();
|
||||||
const auto kbdDir = !!(actions & SB_JUMP) - !!(actions & SB_CROUCH);
|
const auto kbdDir = !!(actions & SB_JUMP) - !!(actions & SB_CROUCH);
|
||||||
const double dist = shrunk ? 2 : 8;
|
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->on_ground = 0;
|
||||||
p->jumping_counter = 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;
|
p->on_warping_sector = 0;
|
||||||
|
|
||||||
if ((actions & SB_CROUCH) || p->sync.uvel < 0)
|
if ((actions & SB_CROUCH) || p->input.uvel < 0)
|
||||||
{
|
{
|
||||||
playerCrouch(snum);
|
playerCrouch(snum);
|
||||||
}
|
}
|
||||||
|
@ -1541,7 +1541,7 @@ void processinput_d(int snum)
|
||||||
p = &ps[snum];
|
p = &ps[snum];
|
||||||
auto pact = p->GetActor();
|
auto pact = p->GetActor();
|
||||||
|
|
||||||
ESyncBits& actions = p->sync.actions;
|
ESyncBits& actions = p->input.actions;
|
||||||
|
|
||||||
// Get strafe value before it's rotated by the angle.
|
// Get strafe value before it's rotated by the angle.
|
||||||
const auto strafeVel = PlayerInputSideVel(snum);
|
const auto strafeVel = PlayerInputSideVel(snum);
|
||||||
|
@ -1675,7 +1675,7 @@ void processinput_d(int snum)
|
||||||
doubvel = TICSPERFRAME;
|
doubvel = TICSPERFRAME;
|
||||||
|
|
||||||
checklook(snum,actions);
|
checklook(snum,actions);
|
||||||
p->Angles.doViewYaw(&p->sync);
|
p->Angles.doViewYaw(&p->input);
|
||||||
|
|
||||||
p->updatecentering(snum);
|
p->updatecentering(snum);
|
||||||
|
|
||||||
|
@ -1714,15 +1714,15 @@ void processinput_d(int snum)
|
||||||
doubvel = 0;
|
doubvel = 0;
|
||||||
p->vel.X = 0;
|
p->vel.X = 0;
|
||||||
p->vel.Y = 0;
|
p->vel.Y = 0;
|
||||||
p->sync.avel = 0;
|
p->input.avel = 0;
|
||||||
setForcedSyncInput(snum);
|
setForcedSyncInput(snum);
|
||||||
}
|
}
|
||||||
else
|
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);
|
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:
|
HORIZONLY:
|
||||||
|
|
||||||
|
@ -1943,7 +1943,7 @@ HORIZONLY:
|
||||||
playerAimDown(snum, actions);
|
playerAimDown(snum, actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
p->Angles.doPitchInput(&p->sync);
|
p->Angles.doPitchInput(&p->input);
|
||||||
|
|
||||||
p->checkhardlanding();
|
p->checkhardlanding();
|
||||||
|
|
||||||
|
|
|
@ -712,11 +712,11 @@ enum : unsigned
|
||||||
static unsigned outVehicleFlags(player_struct* p, ESyncBits& actions)
|
static unsigned outVehicleFlags(player_struct* p, ESyncBits& actions)
|
||||||
{
|
{
|
||||||
unsigned flags = 0;
|
unsigned flags = 0;
|
||||||
flags += VEH_FORWARD * (p->sync.fvel > 0);
|
flags += VEH_FORWARD * (p->input.fvel > 0);
|
||||||
flags += VEH_REVERSE * (p->sync.fvel < 0);
|
flags += VEH_REVERSE * (p->input.fvel < 0);
|
||||||
flags += VEH_TURNLEFT * (p->sync.avel < 0);
|
flags += VEH_TURNLEFT * (p->input.avel < 0);
|
||||||
flags += VEH_TURNRIGHT * (p->sync.avel > 0);
|
flags += VEH_TURNRIGHT * (p->input.avel > 0);
|
||||||
flags += VEH_BRAKING * (!!(actions & SB_CROUCH) || (p->sync.fvel < 0 && p->MotoSpeed > 0));
|
flags += VEH_BRAKING * (!!(actions & SB_CROUCH) || (p->input.fvel < 0 && p->MotoSpeed > 0));
|
||||||
actions &= ~SB_CROUCH;
|
actions &= ~SB_CROUCH;
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,7 @@ static unsigned outVehicleFlags(player_struct* p, ESyncBits& actions)
|
||||||
|
|
||||||
static void doVehicleTilting(player_struct* const p, const bool canTilt)
|
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 (p->OnMotorcycle) adj *= 5 * Sgn(p->MotoSpeed);
|
||||||
if (cl_rrvehicletilting) adj *= cl_viewtiltscale;
|
if (cl_rrvehicletilting) adj *= cl_viewtiltscale;
|
||||||
p->oTiltStatus = p->TiltStatus;
|
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)
|
else if ((flags & VEH_BRAKING) && p->MotoSpeed > 0)
|
||||||
{
|
{
|
||||||
const auto kbdBraking = brakeSpeed * !!(flags & VEH_BRAKING);
|
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);
|
p->MotoSpeed -= clamp<double>(kbdBraking - hidBraking, -brakeSpeed, brakeSpeed);
|
||||||
if (p->MotoSpeed < 0)
|
if (p->MotoSpeed < 0)
|
||||||
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->moto_bump_fast = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->MotoSpeed += fwdSpeed * p->sync.fvel;
|
p->MotoSpeed += fwdSpeed * p->input.fvel;
|
||||||
flags &= ~VEH_FORWARD;
|
flags &= ~VEH_FORWARD;
|
||||||
|
|
||||||
if (p->MotoSpeed > 120)
|
if (p->MotoSpeed > 120)
|
||||||
|
@ -952,7 +952,7 @@ static void doVehicleThrottling(player_struct* p, DDukeActor* pact, unsigned& fl
|
||||||
flags &= ~VEH_TURNRIGHT;
|
flags &= ~VEH_TURNRIGHT;
|
||||||
flags |= VEH_TURNLEFT;
|
flags |= VEH_TURNLEFT;
|
||||||
}
|
}
|
||||||
p->MotoSpeed = revSpeed * p->sync.fvel;
|
p->MotoSpeed = revSpeed * p->input.fvel;
|
||||||
flags &= ~VEH_REVERSE;
|
flags &= ~VEH_REVERSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -970,7 +970,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
||||||
auto pact = p->GetActor();
|
auto pact = p->GetActor();
|
||||||
|
|
||||||
unsigned flags = outVehicleFlags(p, actions);
|
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)
|
if (p->MotoSpeed < 0 || p->moto_underwater)
|
||||||
p->MotoSpeed = 0;
|
p->MotoSpeed = 0;
|
||||||
|
@ -1034,7 +1034,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
||||||
}
|
}
|
||||||
|
|
||||||
p->moto_on_mud = p->moto_on_oil = 0;
|
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;
|
p->MotoSpeed = 0;
|
||||||
|
|
||||||
unsigned flags = outVehicleFlags(p, actions);
|
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);
|
doVehicleSounds(p, pact, flags, 87, 88, 89, 90);
|
||||||
|
|
||||||
if (!p->NotOnWater)
|
if (!p->NotOnWater)
|
||||||
|
@ -1104,7 +1104,7 @@ static void onBoat(int snum, ESyncBits &actions)
|
||||||
if (p->NotOnWater && p->MotoSpeed > 50)
|
if (p->NotOnWater && p->MotoSpeed > 50)
|
||||||
p->MotoSpeed *= 0.5;
|
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;
|
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);
|
playerCrouch(snum);
|
||||||
}
|
}
|
||||||
|
@ -2271,7 +2271,7 @@ void processinput_r(int snum)
|
||||||
auto p = &ps[snum];
|
auto p = &ps[snum];
|
||||||
auto pact = p->GetActor();
|
auto pact = p->GetActor();
|
||||||
|
|
||||||
ESyncBits& actions = p->sync.actions;
|
ESyncBits& actions = p->input.actions;
|
||||||
|
|
||||||
// Get strafe value before it's rotated by the angle.
|
// Get strafe value before it's rotated by the angle.
|
||||||
const auto strafeVel = PlayerInputSideVel(snum);
|
const auto strafeVel = PlayerInputSideVel(snum);
|
||||||
|
@ -2486,7 +2486,7 @@ void processinput_r(int snum)
|
||||||
doubvel = TICSPERFRAME;
|
doubvel = TICSPERFRAME;
|
||||||
|
|
||||||
checklook(snum, actions);
|
checklook(snum, actions);
|
||||||
p->Angles.doViewYaw(&p->sync);
|
p->Angles.doViewYaw(&p->input);
|
||||||
p->apply_seasick();
|
p->apply_seasick();
|
||||||
|
|
||||||
p->updatecentering(snum);
|
p->updatecentering(snum);
|
||||||
|
@ -2541,15 +2541,15 @@ void processinput_r(int snum)
|
||||||
doubvel = 0;
|
doubvel = 0;
|
||||||
p->vel.X = 0;
|
p->vel.X = 0;
|
||||||
p->vel.Y = 0;
|
p->vel.Y = 0;
|
||||||
p->sync.avel = 0;
|
p->input.avel = 0;
|
||||||
setForcedSyncInput(snum);
|
setForcedSyncInput(snum);
|
||||||
}
|
}
|
||||||
else
|
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);
|
purplelavacheck(p);
|
||||||
|
|
||||||
|
@ -2708,7 +2708,7 @@ void processinput_r(int snum)
|
||||||
|
|
||||||
if (!p->OnMotorcycle && !p->OnBoat)
|
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:
|
HORIZONLY:
|
||||||
|
@ -2900,7 +2900,7 @@ HORIZONLY:
|
||||||
p->GetActor()->spr.Angles.Pitch += maphoriz(d);
|
p->GetActor()->spr.Angles.Pitch += maphoriz(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
p->Angles.doPitchInput(&p->sync);
|
p->Angles.doPitchInput(&p->input);
|
||||||
|
|
||||||
p->checkhardlanding();
|
p->checkhardlanding();
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ void resetplayerstats(int snum)
|
||||||
p->bobcounter = 0;
|
p->bobcounter = 0;
|
||||||
p->on_ground = 0;
|
p->on_ground = 0;
|
||||||
p->player_par = 0;
|
p->player_par = 0;
|
||||||
p->sync.actions |= SB_CENTERVIEW;
|
p->input.actions |= SB_CENTERVIEW;
|
||||||
p->airleft = 15*26;
|
p->airleft = 15*26;
|
||||||
p->rapid_fire_hold = 0;
|
p->rapid_fire_hold = 0;
|
||||||
p->toggle_key_flag = 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_oil", w.moto_on_oil)
|
||||||
("moto_on_mud", w.moto_on_mud)
|
("moto_on_mud", w.moto_on_mud)
|
||||||
// new stuff
|
// new stuff
|
||||||
("actions", w.sync.actions)
|
("actions", w.input.actions)
|
||||||
.Array("frags", w.frags, MAXPLAYERS)
|
.Array("frags", w.frags, MAXPLAYERS)
|
||||||
("uservars", w.uservars)
|
("uservars", w.uservars)
|
||||||
("fistsign", w.fistsign)
|
("fistsign", w.fistsign)
|
||||||
|
@ -273,7 +273,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
||||||
w.GetActor()->backuploc();
|
w.GetActor()->backuploc();
|
||||||
w.opyoff = w.pyoff;
|
w.opyoff = w.pyoff;
|
||||||
w.backupweapon();
|
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;
|
return arc;
|
||||||
|
|
|
@ -349,7 +349,7 @@ struct player_struct
|
||||||
TArray<GameVarValue> uservars;
|
TArray<GameVarValue> uservars;
|
||||||
|
|
||||||
// input stuff.
|
// input stuff.
|
||||||
InputPacket sync;
|
InputPacket input;
|
||||||
|
|
||||||
DDukeActor* GetActor();
|
DDukeActor* GetActor();
|
||||||
int GetPlayerNum();
|
int GetPlayerNum();
|
||||||
|
@ -382,20 +382,20 @@ struct player_struct
|
||||||
|
|
||||||
void updatecentering(const int snum)
|
void updatecentering(const int snum)
|
||||||
{
|
{
|
||||||
if (!(sync.actions & SB_CENTERVIEW))
|
if (!(input.actions & SB_CENTERVIEW))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const bool returnlock = cl_dukepitchmode & kDukePitchLockReturn;
|
const bool returnlock = cl_dukepitchmode & kDukePitchLockReturn;
|
||||||
const bool centertest = abs(GetActor()->spr.Angles.Pitch.Degrees()) > 2.2370; // Build horizon value of 5.
|
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);
|
setForcedSyncInput(snum);
|
||||||
sync.horz = 0;
|
input.horz = 0;
|
||||||
}
|
}
|
||||||
else
|
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)
|
void dukeplayer_centerview(player_struct* self)
|
||||||
{
|
{
|
||||||
self->sync.actions |= SB_CENTERVIEW;
|
self->input.actions |= SB_CENTERVIEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, centerview, dukeplayer_centerview)
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, centerview, dukeplayer_centerview)
|
||||||
{
|
{
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
self->sync.actions |= SB_CENTERVIEW;
|
self->input.actions |= SB_CENTERVIEW;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int DukePlayer_PlayerInput(player_struct* pl, int bit)
|
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)
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerinput, DukePlayer_PlayerInput)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue