mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-30 07:50:54 +00:00
- Take better advantage of InputPacket::vel
's FVector3
status.
* Change it to a DVector3 as that's what the game is expecting. Too many narrowings against DAngle objects needed. * Utilise object methods where possible. * Do all math against the object where possible, not its members.
This commit is contained in:
parent
828e46a8da
commit
f88d435335
9 changed files with 42 additions and 59 deletions
|
@ -1522,6 +1522,12 @@ inline TVector2<T> clamp(const TVector2<T> &vec, const TVector2<T> &min, const T
|
||||||
return TVector2<T>(clamp(vec.X, min.X, max.X), clamp(vec.Y, min.Y, max.Y));
|
return TVector2<T>(clamp(vec.X, min.X, max.X), clamp(vec.Y, min.Y, max.Y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline TVector3<T> clamp(const TVector3<T> &vec, const TVector3<T> &min, const TVector3<T> &max)
|
||||||
|
{
|
||||||
|
return TVector3<T>(clamp(vec.X, min.X, max.X), clamp(vec.Y, min.Y, max.Y), clamp(vec.Z, min.Z, max.Z));
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline TAngle<T> interpolatedvalue(const TAngle<T> &oang, const TAngle<T> &ang, const double interpfrac)
|
inline TAngle<T> interpolatedvalue(const TAngle<T> &oang, const TAngle<T> &ang, const double interpfrac)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1032,9 +1032,7 @@ void NetUpdate (void)
|
||||||
int mod = maketic - ticdup;
|
int mod = maketic - ticdup;
|
||||||
int modp, tic;
|
int modp, tic;
|
||||||
|
|
||||||
float svel = 0;
|
DVector3 vel{};
|
||||||
float fvel = 0;
|
|
||||||
float uvel = 0;
|
|
||||||
float avel = 0;
|
float avel = 0;
|
||||||
float horz = 0;
|
float horz = 0;
|
||||||
float roll = 0;
|
float roll = 0;
|
||||||
|
@ -1042,17 +1040,13 @@ void NetUpdate (void)
|
||||||
for (tic = 0; tic < ticdup; ++tic)
|
for (tic = 0; tic < ticdup; ++tic)
|
||||||
{
|
{
|
||||||
modp = (mod + tic) % LOCALCMDTICS;
|
modp = (mod + tic) % LOCALCMDTICS;
|
||||||
fvel += localcmds[modp].ucmd.vel.X;
|
vel += localcmds[modp].ucmd.vel;
|
||||||
svel += localcmds[modp].ucmd.vel.Y;
|
|
||||||
uvel += localcmds[modp].ucmd.vel.Z;
|
|
||||||
avel += localcmds[modp].ucmd.avel;
|
avel += localcmds[modp].ucmd.avel;
|
||||||
horz += localcmds[modp].ucmd.horz;
|
horz += localcmds[modp].ucmd.horz;
|
||||||
roll += localcmds[modp].ucmd.roll;
|
roll += localcmds[modp].ucmd.roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
svel /= ticdup;
|
vel /= ticdup;
|
||||||
fvel /= ticdup;
|
|
||||||
uvel /= ticdup;
|
|
||||||
avel /= ticdup;
|
avel /= ticdup;
|
||||||
horz /= ticdup;
|
horz /= ticdup;
|
||||||
roll /= ticdup;
|
roll /= ticdup;
|
||||||
|
@ -1060,9 +1054,7 @@ void NetUpdate (void)
|
||||||
for (tic = 0; tic < ticdup; ++tic)
|
for (tic = 0; tic < ticdup; ++tic)
|
||||||
{
|
{
|
||||||
modp = (mod + tic) % LOCALCMDTICS;
|
modp = (mod + tic) % LOCALCMDTICS;
|
||||||
localcmds[modp].ucmd.vel.X = fvel;
|
localcmds[modp].ucmd.vel = vel;
|
||||||
localcmds[modp].ucmd.vel.Y = svel;
|
|
||||||
localcmds[modp].ucmd.vel.Z = uvel;
|
|
||||||
localcmds[modp].ucmd.avel = avel;
|
localcmds[modp].ucmd.avel = avel;
|
||||||
localcmds[modp].ucmd.horz = horz;
|
localcmds[modp].ucmd.horz = horz;
|
||||||
localcmds[modp].ucmd.roll = roll;
|
localcmds[modp].ucmd.roll = roll;
|
||||||
|
|
|
@ -210,17 +210,17 @@ int PackUserCmd (const InputPacket *ucmd, const InputPacket *basis, uint8_t **st
|
||||||
if (ucmd->vel.X != basis->vel.X)
|
if (ucmd->vel.X != basis->vel.X)
|
||||||
{
|
{
|
||||||
flags |= UCMDF_FORWARDMOVE;
|
flags |= UCMDF_FORWARDMOVE;
|
||||||
WriteFloat (ucmd->vel.X, stream);
|
WriteFloat ((float)ucmd->vel.X, stream);
|
||||||
}
|
}
|
||||||
if (ucmd->vel.Y != basis->vel.Y)
|
if (ucmd->vel.Y != basis->vel.Y)
|
||||||
{
|
{
|
||||||
flags |= UCMDF_SIDEMOVE;
|
flags |= UCMDF_SIDEMOVE;
|
||||||
WriteFloat (ucmd->vel.Y, stream);
|
WriteFloat ((float)ucmd->vel.Y, stream);
|
||||||
}
|
}
|
||||||
if (ucmd->vel.Z != basis->vel.Z)
|
if (ucmd->vel.Z != basis->vel.Z)
|
||||||
{
|
{
|
||||||
flags |= UCMDF_UPMOVE;
|
flags |= UCMDF_UPMOVE;
|
||||||
WriteFloat (ucmd->vel.Z, stream);
|
WriteFloat ((float)ucmd->vel.Z, stream);
|
||||||
}
|
}
|
||||||
if (ucmd->roll != basis->roll)
|
if (ucmd->roll != basis->roll)
|
||||||
{
|
{
|
||||||
|
@ -252,9 +252,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, InputPacket &cmd, Inpu
|
||||||
arc("actions", cmd.actions)
|
arc("actions", cmd.actions)
|
||||||
("horz", cmd.horz)
|
("horz", cmd.horz)
|
||||||
("avel", cmd.avel)
|
("avel", cmd.avel)
|
||||||
("fvel", cmd.vel.X)
|
("vel", cmd.vel)
|
||||||
("svel", cmd.vel.Y)
|
|
||||||
("uvel", cmd.vel.Z)
|
|
||||||
("roll", cmd.roll)
|
("roll", cmd.roll)
|
||||||
.EndObject();
|
.EndObject();
|
||||||
}
|
}
|
||||||
|
@ -268,9 +266,7 @@ int WriteUserCmdMessage (InputPacket *ucmd, const InputPacket *basis, uint8_t **
|
||||||
if (ucmd->actions != 0 ||
|
if (ucmd->actions != 0 ||
|
||||||
ucmd->horz != 0 ||
|
ucmd->horz != 0 ||
|
||||||
ucmd->avel != 0 ||
|
ucmd->avel != 0 ||
|
||||||
ucmd->vel.X != 0 ||
|
!ucmd->vel.isZero() ||
|
||||||
ucmd->vel.Y != 0 ||
|
|
||||||
ucmd->vel.Z != 0 ||
|
|
||||||
ucmd->roll != 0)
|
ucmd->roll != 0)
|
||||||
{
|
{
|
||||||
WriteByte (DEM_USERCMD, stream);
|
WriteByte (DEM_USERCMD, stream);
|
||||||
|
@ -281,9 +277,7 @@ int WriteUserCmdMessage (InputPacket *ucmd, const InputPacket *basis, uint8_t **
|
||||||
if (ucmd->actions != basis->actions ||
|
if (ucmd->actions != basis->actions ||
|
||||||
ucmd->horz != basis->horz ||
|
ucmd->horz != basis->horz ||
|
||||||
ucmd->avel != basis->avel ||
|
ucmd->avel != basis->avel ||
|
||||||
ucmd->vel.X != basis->vel.X ||
|
ucmd->vel != basis->vel ||
|
||||||
ucmd->vel.Y != basis->vel.Y ||
|
|
||||||
ucmd->vel.Z != basis->vel.Z ||
|
|
||||||
ucmd->roll != basis->roll)
|
ucmd->roll != basis->roll)
|
||||||
{
|
{
|
||||||
WriteByte (DEM_USERCMD, stream);
|
WriteByte (DEM_USERCMD, stream);
|
||||||
|
|
|
@ -167,9 +167,8 @@ void GameInput::processMovement(PlayerAngles* const plrAngles, const float scale
|
||||||
}
|
}
|
||||||
|
|
||||||
// add collected input to game's local input accumulation packet.
|
// add collected input to game's local input accumulation packet.
|
||||||
inputBuffer.vel.X = clamp(inputBuffer.vel.X + thisInput.vel.X, -(float)keymove, (float)keymove);
|
const DVector3 maxVel{ (double)keymove, (double)keymove, 1. };
|
||||||
inputBuffer.vel.Y = clamp(inputBuffer.vel.Y + thisInput.vel.Y, -(float)keymove, (float)keymove);
|
inputBuffer.vel = clamp(inputBuffer.vel + thisInput.vel, -maxVel, maxVel);
|
||||||
inputBuffer.vel.Z = clamp(inputBuffer.vel.Z + thisInput.vel.Z, -1.00f, 1.00f);
|
|
||||||
inputBuffer.avel = clamp(inputBuffer.avel + thisInput.avel, -179.f, 179.f);
|
inputBuffer.avel = clamp(inputBuffer.avel + thisInput.avel, -179.f, 179.f);
|
||||||
inputBuffer.horz = clamp(inputBuffer.horz + thisInput.horz, -179.f, 179.f);
|
inputBuffer.horz = clamp(inputBuffer.horz + thisInput.horz, -179.f, 179.f);
|
||||||
|
|
||||||
|
@ -203,7 +202,7 @@ void GameInput::processVehicle(PlayerAngles* const plrAngles, const float scaleA
|
||||||
const auto kbdForwards = buttonMap.ButtonDown(gamefunc_Move_Forward) || buttonMap.ButtonDown(gamefunc_Strafe);
|
const auto kbdForwards = buttonMap.ButtonDown(gamefunc_Move_Forward) || buttonMap.ButtonDown(gamefunc_Strafe);
|
||||||
const auto kbdBackward = buttonMap.ButtonDown(gamefunc_Move_Backward);
|
const auto kbdBackward = buttonMap.ButtonDown(gamefunc_Move_Backward);
|
||||||
thisInput.vel.X = kbdForwards - kbdBackward + joyAxes[JOYAXIS_Forward];
|
thisInput.vel.X = kbdForwards - kbdBackward + joyAxes[JOYAXIS_Forward];
|
||||||
inputBuffer.vel.X = clamp(inputBuffer.vel.X + thisInput.vel.X, -1.f, 1.f);
|
inputBuffer.vel.X = clamp(inputBuffer.vel.X + thisInput.vel.X, -1., 1.);
|
||||||
|
|
||||||
// This sync bit is the brake key.
|
// This sync bit is the brake key.
|
||||||
if (buttonMap.ButtonDown(gamefunc_Run)) inputBuffer.actions |= SB_CROUCH;
|
if (buttonMap.ButtonDown(gamefunc_Run)) inputBuffer.actions |= SB_CROUCH;
|
||||||
|
|
|
@ -70,7 +70,7 @@ enum
|
||||||
|
|
||||||
struct InputPacket
|
struct InputPacket
|
||||||
{
|
{
|
||||||
FVector3 vel;
|
DVector3 vel;
|
||||||
float avel;
|
float avel;
|
||||||
float horz;
|
float horz;
|
||||||
float roll;
|
float roll;
|
||||||
|
|
|
@ -859,8 +859,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
||||||
actor->vel.Zero();
|
actor->vel.Zero();
|
||||||
pInput->avel = 0;
|
pInput->avel = 0;
|
||||||
pInput->actions = 0;
|
pInput->actions = 0;
|
||||||
pInput->vel.X = 0;
|
pInput->vel.Zero();
|
||||||
pInput->vel.Y = 0;
|
|
||||||
pInput->horz = 0;
|
pInput->horz = 0;
|
||||||
pPlayer->flickerEffect = 0;
|
pPlayer->flickerEffect = 0;
|
||||||
pPlayer->quakeEffect = 0;
|
pPlayer->quakeEffect = 0;
|
||||||
|
@ -1526,7 +1525,7 @@ void ProcessInput(DBloodPlayer* pPlayer)
|
||||||
// Allow it to become true behind a CVAR to offer an alternate playing experience if desired.
|
// Allow it to become true behind a CVAR to offer an alternate playing experience if desired.
|
||||||
pPlayer->isRunning = !!(pInput->actions & SB_RUN) && !cl_bloodvanillarun;
|
pPlayer->isRunning = !!(pInput->actions & SB_RUN) && !cl_bloodvanillarun;
|
||||||
|
|
||||||
if ((pInput->actions & SB_BUTTON_MASK) || pInput->vel.X || pInput->vel.Y || pInput->avel)
|
if ((pInput->actions & SB_BUTTON_MASK) || !pInput->vel.XY().isZero() || pInput->avel)
|
||||||
pPlayer->restTime = 0;
|
pPlayer->restTime = 0;
|
||||||
else if (pPlayer->restTime >= 0)
|
else if (pPlayer->restTime >= 0)
|
||||||
pPlayer->restTime += 4;
|
pPlayer->restTime += 4;
|
||||||
|
@ -1573,7 +1572,7 @@ void ProcessInput(DBloodPlayer* pPlayer)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pInput->vel.X || pInput->vel.Y) && (pPlayer->posture == 1 || actor->xspr.height < 256))
|
if (!pInput->vel.XY().isZero() && (pPlayer->posture == 1 || actor->xspr.height < 256))
|
||||||
{
|
{
|
||||||
const double speed = pPlayer->posture == 1? 1. : 1. - (actor->xspr.height * (1. / 256.) * (actor->xspr.height < 256));
|
const double speed = pPlayer->posture == 1? 1. : 1. - (actor->xspr.height * (1. / 256.) * (actor->xspr.height < 256));
|
||||||
const double fvAccel = pInput->vel.X > 0 ? pPosture->frontAccel : pPosture->backAccel;
|
const double fvAccel = pInput->vel.X > 0 ? pPosture->frontAccel : pPosture->backAccel;
|
||||||
|
|
|
@ -137,12 +137,12 @@ inline bool PlayerUseItem(int pl, int num)
|
||||||
return getPlayer(pl)->cmd.ucmd.isItemUsed(num - 1);
|
return getPlayer(pl)->cmd.ucmd.isItemUsed(num - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float PlayerInputSideVel(int pl)
|
inline double PlayerInputSideVel(int pl)
|
||||||
{
|
{
|
||||||
return getPlayer(pl)->cmd.ucmd.vel.Y;
|
return getPlayer(pl)->cmd.ucmd.vel.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float PlayerInputForwardVel(int pl)
|
inline double PlayerInputForwardVel(int pl)
|
||||||
{
|
{
|
||||||
return getPlayer(pl)->cmd.ucmd.vel.X;
|
return getPlayer(pl)->cmd.ucmd.vel.X;
|
||||||
}
|
}
|
||||||
|
@ -264,12 +264,9 @@ inline int monsterCheatCheck(DDukeActor* self)
|
||||||
inline void processinputvel(int snum)
|
inline void processinputvel(int snum)
|
||||||
{
|
{
|
||||||
const auto p = getPlayer(snum);
|
const auto p = getPlayer(snum);
|
||||||
const auto velvect = DVector2(p->cmd.ucmd.vel.X, p->cmd.ucmd.vel.Y).Rotated(p->GetActor()->spr.Angles.Yaw) + p->fric;
|
p->cmd.ucmd.vel.XY() = p->cmd.ucmd.vel.XY().Rotated(p->GetActor()->spr.Angles.Yaw) + p->fric;
|
||||||
p->cmd.ucmd.vel.X = (float)velvect.X;
|
|
||||||
p->cmd.ucmd.vel.Y = (float)velvect.Y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const ActorInfo* DDukeActor::conInfo() const
|
inline const ActorInfo* DDukeActor::conInfo() const
|
||||||
{
|
{
|
||||||
auto tn = static_cast<PClassActor*>(GetClass())->ActorInfo()->TypeNum;
|
auto tn = static_cast<PClassActor*>(GetClass())->ActorInfo()->TypeNum;
|
||||||
|
|
|
@ -1102,7 +1102,7 @@ static void updatePlayerVelocity(DExhumedPlayer* const pPlayer)
|
||||||
if (pPlayer->nHealth > 0)
|
if (pPlayer->nHealth > 0)
|
||||||
{
|
{
|
||||||
const auto pInput = &pPlayer->cmd.ucmd;
|
const auto pInput = &pPlayer->cmd.ucmd;
|
||||||
const auto inputvect = DVector2(pInput->vel.X, pInput->vel.Y).Rotated(pPlayerActor->spr.Angles.Yaw) * 0.375;
|
const auto inputvect = pInput->vel.XY().Rotated(pPlayerActor->spr.Angles.Yaw) * 0.375;
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1864,8 +1864,7 @@ void DoPlayerMove(DSWPlayer* pp)
|
||||||
pp->ovect = pp->vect;
|
pp->ovect = pp->vect;
|
||||||
pp->Angles.PrevStrafeVel = pp->Angles.StrafeVel;
|
pp->Angles.PrevStrafeVel = pp->Angles.StrafeVel;
|
||||||
|
|
||||||
pp->vect.X += pp->cmd.ucmd.vel.X * INPUT_SCALE;
|
pp->vect += pp->cmd.ucmd.vel.XY() * INPUT_SCALE;
|
||||||
pp->vect.Y += pp->cmd.ucmd.vel.Y * INPUT_SCALE;
|
|
||||||
pp->Angles.StrafeVel += pp->svel * INPUT_SCALE;
|
pp->Angles.StrafeVel += pp->svel * INPUT_SCALE;
|
||||||
|
|
||||||
friction = pp->friction;
|
friction = pp->friction;
|
||||||
|
@ -2390,9 +2389,12 @@ void DoPlayerMoveVehicle(DSWPlayer* pp)
|
||||||
|
|
||||||
if (!Prediction)
|
if (!Prediction)
|
||||||
{
|
{
|
||||||
if (abs(pp->cmd.ucmd.vel.X + pp->cmd.ucmd.vel.Y) && !abs(pp->lastcmd.ucmd.vel.X + pp->lastcmd.ucmd.vel.Y))
|
const auto lastvel = pp->lastcmd.ucmd.vel.XY().Sum();
|
||||||
|
const auto thisvel = pp->cmd.ucmd.vel.XY().Sum();
|
||||||
|
|
||||||
|
if (thisvel && !lastvel)
|
||||||
PlaySOsound(pp->sop->mid_sector,SO_DRIVE_SOUND);
|
PlaySOsound(pp->sop->mid_sector,SO_DRIVE_SOUND);
|
||||||
else if (!abs(pp->cmd.ucmd.vel.X + pp->cmd.ucmd.vel.Y) && abs(pp->lastcmd.ucmd.vel.X + pp->lastcmd.ucmd.vel.Y))
|
else if (!thisvel && lastvel)
|
||||||
PlaySOsound(pp->sop->mid_sector,SO_IDLE_SOUND);
|
PlaySOsound(pp->sop->mid_sector,SO_IDLE_SOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2405,16 +2407,14 @@ void DoPlayerMoveVehicle(DSWPlayer* pp)
|
||||||
|
|
||||||
if (sop->drive_speed)
|
if (sop->drive_speed)
|
||||||
{
|
{
|
||||||
pp->vect.X = pp->cmd.ucmd.vel.X * sop->drive_speed * (70. / 1048576.);
|
pp->vect = pp->cmd.ucmd.vel.XY() * sop->drive_speed * (70. / 1048576.);
|
||||||
pp->vect.Y = pp->cmd.ucmd.vel.Y * sop->drive_speed * (70. / 1048576.);
|
|
||||||
|
|
||||||
// does sliding/momentum
|
// does sliding/momentum
|
||||||
pp->vect = (pp->vect + (pp->ovect * (sop->drive_slide-1)))/sop->drive_slide;
|
pp->vect = (pp->vect + (pp->ovect * (sop->drive_slide-1)))/sop->drive_slide;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pp->vect.X += pp->cmd.ucmd.vel.X * INPUT_SCALE;
|
pp->vect += pp->cmd.ucmd.vel.XY() * INPUT_SCALE;
|
||||||
pp->vect.Y += pp->cmd.ucmd.vel.Y * INPUT_SCALE;
|
|
||||||
pp->vect *= TANK_FRICTION;
|
pp->vect *= TANK_FRICTION;
|
||||||
|
|
||||||
pp->vect = (pp->vect + (pp->ovect*1))/2;
|
pp->vect = (pp->vect + (pp->ovect*1))/2;
|
||||||
|
@ -3079,8 +3079,7 @@ void DoPlayerClimb(DSWPlayer* pp)
|
||||||
if (Prediction)
|
if (Prediction)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pp->vect.X += pp->cmd.ucmd.vel.X * INPUT_SCALE;
|
pp->vect += pp->cmd.ucmd.vel.XY() * INPUT_SCALE;
|
||||||
pp->vect.Y += pp->cmd.ucmd.vel.Y * INPUT_SCALE;
|
|
||||||
pp->vect *= PLAYER_CLIMB_FRICTION;
|
pp->vect *= PLAYER_CLIMB_FRICTION;
|
||||||
if (abs(pp->vect.X) < 0.05 && abs(pp->vect.Y) < 0.05)
|
if (abs(pp->vect.X) < 0.05 && abs(pp->vect.Y) < 0.05)
|
||||||
pp->vect.X = pp->vect.Y = 0;
|
pp->vect.X = pp->vect.Y = 0;
|
||||||
|
@ -4957,7 +4956,7 @@ void DoPlayerBeginOperate(DSWPlayer* pp)
|
||||||
switch (sop->track)
|
switch (sop->track)
|
||||||
{
|
{
|
||||||
case SO_VEHICLE:
|
case SO_VEHICLE:
|
||||||
if (pp->cmd.ucmd.vel.X || pp->cmd.ucmd.vel.Y)
|
if (!pp->cmd.ucmd.vel.XY().isZero())
|
||||||
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
|
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
|
||||||
else
|
else
|
||||||
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
||||||
|
@ -4975,7 +4974,7 @@ void DoPlayerBeginOperate(DSWPlayer* pp)
|
||||||
break;
|
break;
|
||||||
#if 0
|
#if 0
|
||||||
case SO_SPEED_BOAT:
|
case SO_SPEED_BOAT:
|
||||||
if (pp->input.fvel || pp->input.svel)
|
if (!pp->cmd.ucmd.vel.XY().isZero())
|
||||||
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
|
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
|
||||||
else
|
else
|
||||||
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
||||||
|
@ -5050,7 +5049,7 @@ void DoPlayerBeginRemoteOperate(DSWPlayer* pp, SECTOR_OBJECT* sop)
|
||||||
switch (sop->track)
|
switch (sop->track)
|
||||||
{
|
{
|
||||||
case SO_VEHICLE:
|
case SO_VEHICLE:
|
||||||
if (pp->cmd.ucmd.vel.X || pp->cmd.ucmd.vel.Y)
|
if (!pp->cmd.ucmd.vel.XY().isZero())
|
||||||
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
|
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
|
||||||
else
|
else
|
||||||
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
|
||||||
|
@ -6551,7 +6550,7 @@ void ChopsCheck(DSWPlayer* pp)
|
||||||
{
|
{
|
||||||
if (!M_Active() && !(pp->Flags & PF_DEAD) && !pp->sop_riding && numplayers <= 1)
|
if (!M_Active() && !(pp->Flags & PF_DEAD) && !pp->sop_riding && numplayers <= 1)
|
||||||
{
|
{
|
||||||
if (pp->cmd.ucmd.actions & ~SB_RUN || pp->cmd.ucmd.vel.X || pp->cmd.ucmd.vel.Y || pp->cmd.ucmd.avel || pp->cmd.ucmd.horz ||
|
if (pp->cmd.ucmd.actions & ~SB_RUN || !pp->cmd.ucmd.vel.XY().isZero() || pp->cmd.ucmd.avel || pp->cmd.ucmd.horz ||
|
||||||
(pp->Flags & (PF_CLIMBING | PF_FALLING | PF_DIVING)))
|
(pp->Flags & (PF_CLIMBING | PF_FALLING | PF_DIVING)))
|
||||||
{
|
{
|
||||||
// Hit a input key or other reason to stop chops
|
// Hit a input key or other reason to stop chops
|
||||||
|
@ -6785,11 +6784,8 @@ void domovethings(void)
|
||||||
pp->svel = pp->cmd.ucmd.vel.Y;
|
pp->svel = pp->cmd.ucmd.vel.Y;
|
||||||
|
|
||||||
// convert fvel/svel into a vector before performing actions.
|
// convert fvel/svel into a vector before performing actions.
|
||||||
const auto fvel = pp->cmd.ucmd.vel.X + pp->cmd.ucmd.vel.Z * (pp->DoPlayerAction == DoPlayerClimb);
|
pp->cmd.ucmd.vel.X += pp->cmd.ucmd.vel.Z * (pp->DoPlayerAction == DoPlayerClimb);
|
||||||
const auto svel = pp->cmd.ucmd.vel.Y;
|
pp->cmd.ucmd.vel.XY() = pp->cmd.ucmd.vel.XY().Rotated(pp->GetActor()->spr.Angles.Yaw);
|
||||||
const auto velvect = DVector2(fvel, svel).Rotated(pp->GetActor()->spr.Angles.Yaw);
|
|
||||||
pp->cmd.ucmd.vel.X = (float)velvect.X;
|
|
||||||
pp->cmd.ucmd.vel.Y = (float)velvect.Y;
|
|
||||||
|
|
||||||
if (pp->DoPlayerAction) pp->DoPlayerAction(pp);
|
if (pp->DoPlayerAction) pp->DoPlayerAction(pp);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue