- InputPacket: Change q16avel to avel, changing type from fixed_t to float.

This commit is contained in:
Mitchell Richters 2020-10-08 14:47:30 +11:00
parent e53d58bd42
commit 9bcdeae6cd
20 changed files with 96 additions and 96 deletions

View file

@ -55,7 +55,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
// Perform unsynchronised angle/horizon if not dead. // Perform unsynchronised angle/horizon if not dead.
if (gView->pXSprite->health != 0) if (gView->pXSprite->health != 0)
{ {
applylook(&pPlayer->angle, input.q16avel, &pPlayer->input.actions, scaleAdjust, pPlayer->posture != 0); applylook(&pPlayer->angle, input.avel, &pPlayer->input.actions, scaleAdjust, pPlayer->posture != 0);
sethorizon(&pPlayer->horizon.horiz, input.horz, &pPlayer->input.actions, scaleAdjust); sethorizon(&pPlayer->horizon.horiz, input.horz, &pPlayer->input.actions, scaleAdjust);
} }

View file

@ -762,7 +762,7 @@ void playerStart(int nPlayer, int bNewLevel)
pPlayer->deathTime = 0; pPlayer->deathTime = 0;
pPlayer->nextWeapon = 0; pPlayer->nextWeapon = 0;
xvel[pSprite->index] = yvel[pSprite->index] = zvel[pSprite->index] = 0; xvel[pSprite->index] = yvel[pSprite->index] = zvel[pSprite->index] = 0;
pInput->q16avel = 0; pInput->avel = 0;
pInput->actions = 0; pInput->actions = 0;
pInput->fvel = 0; pInput->fvel = 0;
pInput->svel = 0; pInput->svel = 0;
@ -1347,7 +1347,7 @@ void ProcessInput(PLAYER *pPlayer)
InputPacket *pInput = &pPlayer->input; InputPacket *pInput = &pPlayer->input;
pPlayer->isRunning = !!(pInput->actions & SB_RUN); pPlayer->isRunning = !!(pInput->actions & SB_RUN);
if ((pInput->actions & SB_BUTTON_MASK) || pInput->fvel || pInput->svel || pInput->q16avel) if ((pInput->actions & SB_BUTTON_MASK) || pInput->fvel || pInput->svel || pInput->avel)
pPlayer->restTime = 0; pPlayer->restTime = 0;
else if (pPlayer->restTime >= 0) else if (pPlayer->restTime >= 0)
pPlayer->restTime += 4; pPlayer->restTime += 4;
@ -1445,7 +1445,7 @@ void ProcessInput(PLAYER *pPlayer)
if (cl_syncinput) if (cl_syncinput)
{ {
applylook(&pPlayer->angle, pInput->q16avel, &pInput->actions, 1, pPlayer->posture != 0); applylook(&pPlayer->angle, pInput->avel, &pInput->actions, 1, pPlayer->posture != 0);
UpdatePlayerSpriteAngle(pPlayer); UpdatePlayerSpriteAngle(pPlayer);
} }

View file

@ -169,8 +169,8 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
predict.at60 -= mulscale30(strafe, x); predict.at60 -= mulscale30(strafe, x);
} }
} }
if (pInput->q16avel) if (pInput->avel)
predict.at30 = degang(FixedToFloat(pInput->q16avel)); predict.at30 = degang(pInput->avel);
if (pInput->actions & SB_TURNAROUND) if (pInput->actions & SB_TURNAROUND)
if (!predict.at4c.asbuild()) if (!predict.at4c.asbuild())
predict.at4c = buildlook(-1024); predict.at4c = buildlook(-1024);

View file

@ -1036,7 +1036,7 @@ void NetUpdate (void)
int svel = 0; int svel = 0;
int fvel = 0; int fvel = 0;
int64_t q16avel = 0; float avel = 0;
float horz = 0; float horz = 0;
for (j = 0; j < ticdup; ++j) for (j = 0; j < ticdup; ++j)
@ -1044,13 +1044,13 @@ void NetUpdate (void)
modp = (mod + j) % LOCALCMDTICS; modp = (mod + j) % LOCALCMDTICS;
svel += localcmds[modp].ucmd.svel; svel += localcmds[modp].ucmd.svel;
fvel += localcmds[modp].ucmd.fvel; fvel += localcmds[modp].ucmd.fvel;
q16avel += localcmds[modp].ucmd.q16avel; avel += localcmds[modp].ucmd.avel;
horz += localcmds[modp].ucmd.horz; horz += localcmds[modp].ucmd.horz;
} }
svel /= ticdup; svel /= ticdup;
fvel /= ticdup; fvel /= ticdup;
q16avel /= ticdup; avel /= ticdup;
horz /= ticdup; horz /= ticdup;
for (j = 0; j < ticdup; ++j) for (j = 0; j < ticdup; ++j)
@ -1058,7 +1058,7 @@ void NetUpdate (void)
modp = (mod + j) % LOCALCMDTICS; modp = (mod + j) % LOCALCMDTICS;
localcmds[modp].ucmd.svel = svel; localcmds[modp].ucmd.svel = svel;
localcmds[modp].ucmd.fvel = fvel; localcmds[modp].ucmd.fvel = fvel;
localcmds[modp].ucmd.q16avel = q16avel; localcmds[modp].ucmd.avel = avel;
localcmds[modp].ucmd.horz = horz; localcmds[modp].ucmd.horz = horz;
} }

View file

@ -162,7 +162,7 @@ int UnpackUserCmd (InputPacket *ucmd, const InputPacket *basis, uint8_t **stream
if (flags & UCMDF_PITCH) if (flags & UCMDF_PITCH)
ucmd->horz = ReadLong(stream); ucmd->horz = ReadLong(stream);
if (flags & UCMDF_YAW) if (flags & UCMDF_YAW)
ucmd->q16avel = ReadLong(stream); ucmd->avel = ReadLong(stream);
if (flags & UCMDF_FORWARDMOVE) if (flags & UCMDF_FORWARDMOVE)
ucmd->fvel = ReadWord (stream); ucmd->fvel = ReadWord (stream);
if (flags & UCMDF_SIDEMOVE) if (flags & UCMDF_SIDEMOVE)
@ -198,10 +198,10 @@ int PackUserCmd (const InputPacket *ucmd, const InputPacket *basis, uint8_t **st
flags |= UCMDF_PITCH; flags |= UCMDF_PITCH;
WriteLong (ucmd->horz, stream); WriteLong (ucmd->horz, stream);
} }
if (ucmd->q16avel != basis->q16avel) if (ucmd->avel != basis->avel)
{ {
flags |= UCMDF_YAW; flags |= UCMDF_YAW;
WriteLong (ucmd->q16avel, stream); WriteLong (ucmd->avel, stream);
} }
if (ucmd->fvel != basis->fvel) if (ucmd->fvel != basis->fvel)
{ {
@ -237,7 +237,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.q16avel) ("avel", cmd.avel)
("fvel", cmd.fvel) ("fvel", cmd.fvel)
("svwl", cmd.svel) ("svwl", cmd.svel)
.EndObject(); .EndObject();
@ -251,7 +251,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->q16avel != 0 || ucmd->avel != 0 ||
ucmd->fvel != 0 || ucmd->fvel != 0 ||
ucmd->svel != 0) ucmd->svel != 0)
{ {
@ -262,7 +262,7 @@ int WriteUserCmdMessage (InputPacket *ucmd, const InputPacket *basis, uint8_t **
else else
if (ucmd->actions != basis->actions || if (ucmd->actions != basis->actions ||
ucmd->horz != basis->horz || ucmd->horz != basis->horz ||
ucmd->q16avel != basis->q16avel || ucmd->avel != basis->avel ||
ucmd->fvel != basis->fvel || ucmd->fvel != basis->fvel ||
ucmd->svel != basis->svel) ucmd->svel != basis->svel)
{ {

View file

@ -1454,7 +1454,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
if (buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe) if (buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe)
currInput->svel -= xs_CRoundToInt(hidInput->mousemovex * mousevelscale + (scaleAdjust * (hidInput->dyaw / 60) * keymove * cntrlvelscale)); currInput->svel -= xs_CRoundToInt(hidInput->mousemovex * mousevelscale + (scaleAdjust * (hidInput->dyaw / 60) * keymove * cntrlvelscale));
else else
currInput->q16avel += FloatToFixed(hidInput->mouseturnx + (scaleAdjust * hidInput->dyaw)); currInput->avel += hidInput->mouseturnx + (scaleAdjust * hidInput->dyaw);
if (!(inputBuffer->actions & SB_AIMMODE)) if (!(inputBuffer->actions & SB_AIMMODE))
currInput->horz -= hidInput->mouseturny; currInput->horz -= hidInput->mouseturny;
@ -1465,7 +1465,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
currInput->horz = -currInput->horz; currInput->horz = -currInput->horz;
if (invertmousex) if (invertmousex)
currInput->q16avel = -currInput->q16avel; currInput->avel = -currInput->avel;
// process remaining controller input. // process remaining controller input.
currInput->horz -= scaleAdjust * hidInput->dpitch; currInput->horz -= scaleAdjust * hidInput->dpitch;
@ -1501,12 +1501,12 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !allowstrafe)) if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !allowstrafe))
{ {
turnheldtime += scaleAdjust * turnheldamt; turnheldtime += scaleAdjust * turnheldamt;
currInput->q16avel -= FloatToFixed(scaleAdjust * (turnheldtime >= turboturntime ? turnamount : preambleturn)); currInput->avel -= scaleAdjust * (turnheldtime >= turboturntime ? turnamount : preambleturn);
} }
else if (buttonMap.ButtonDown(gamefunc_Turn_Right) || (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !allowstrafe)) else if (buttonMap.ButtonDown(gamefunc_Turn_Right) || (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !allowstrafe))
{ {
turnheldtime += scaleAdjust * turnheldamt; turnheldtime += scaleAdjust * turnheldamt;
currInput->q16avel += FloatToFixed(scaleAdjust * (turnheldtime >= turboturntime ? turnamount : preambleturn)); currInput->avel += scaleAdjust * (turnheldtime >= turboturntime ? turnamount : preambleturn);
} }
else else
{ {
@ -1558,7 +1558,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
// add collected input to game's local input accumulation packet. // add collected input to game's local input accumulation packet.
inputBuffer->fvel = clamp(inputBuffer->fvel + currInput->fvel, -keymove, keymove); inputBuffer->fvel = clamp(inputBuffer->fvel + currInput->fvel, -keymove, keymove);
inputBuffer->svel = clamp(inputBuffer->svel + currInput->svel, -keymove, keymove); inputBuffer->svel = clamp(inputBuffer->svel + currInput->svel, -keymove, keymove);
inputBuffer->q16avel += currInput->q16avel; inputBuffer->avel += currInput->avel;
inputBuffer->horz += currInput->horz; inputBuffer->horz += currInput->horz;
} }
@ -1635,7 +1635,7 @@ void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void applylook(PlayerAngle* angle, fixed_t const q16avel, ESyncBits* actions, double const scaleAdjust, bool const crouching) void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust, bool const crouching)
{ {
// return q16rotscrnang to 0 and set to 0 if less than a quarter of a unit // return q16rotscrnang to 0 and set to 0 if less than a quarter of a unit
angle->rotscrnang -= q16look(xs_CRoundToInt(scaleAdjust * (angle->rotscrnang.asq16() * (15. / GameTicRate)))); angle->rotscrnang -= q16look(xs_CRoundToInt(scaleAdjust * (angle->rotscrnang.asq16() * (15. / GameTicRate))));
@ -1683,9 +1683,9 @@ void applylook(PlayerAngle* angle, fixed_t const q16avel, ESyncBits* actions, do
angle->ang += q16ang(add); angle->ang += q16ang(add);
} }
if (q16avel) if (avel)
{ {
// add player's input // add player's input
angle->ang += degang(FixedToFloat(q16avel)); angle->ang += degang(avel);
} }
} }

View file

@ -237,7 +237,7 @@ struct PlayerAngle
void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlInfo* const hidInput, double const scaleAdjust, int const drink_amt = 0, bool const allowstrafe = true, double const turnscale = 1); void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlInfo* const hidInput, double const scaleAdjust, int const drink_amt = 0, bool const allowstrafe = true, double const turnscale = 1);
void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double const scaleAdjust); void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double const scaleAdjust);
void applylook(PlayerAngle* angle, fixed_t const q16avel, ESyncBits* actions, double const scaleAdjust, bool const crouching); void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust, bool const crouching);
struct UserConfig struct UserConfig
{ {

View file

@ -72,7 +72,7 @@ struct InputPacket
{ {
int16_t svel; int16_t svel;
int16_t fvel; int16_t fvel;
fixed_t q16avel; float avel;
float horz; float horz;
ESyncBits actions; ESyncBits actions;

View file

@ -428,7 +428,7 @@ void GameInterface::Ticker()
sPlayerInput[nLocalPlayer].actions = localInput.actions; sPlayerInput[nLocalPlayer].actions = localInput.actions;
if (oldactions & SB_CENTERVIEW) sPlayerInput[nLocalPlayer].actions |= SB_CENTERVIEW; if (oldactions & SB_CENTERVIEW) sPlayerInput[nLocalPlayer].actions |= SB_CENTERVIEW;
sPlayerInput[nLocalPlayer].nAngle = localInput.q16avel; sPlayerInput[nLocalPlayer].nAngle = localInput.avel;
sPlayerInput[nLocalPlayer].pan = localInput.horz; sPlayerInput[nLocalPlayer].pan = localInput.horz;
Ra[nLocalPlayer].nTarget = besttarget; Ra[nLocalPlayer].nTarget = besttarget;

View file

@ -128,7 +128,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
if (!nFreeze) if (!nFreeze)
{ {
applylook(&pPlayer->angle, input.q16avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust, eyelevel[nLocalPlayer] > -14080); applylook(&pPlayer->angle, input.avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust, eyelevel[nLocalPlayer] > -14080);
sethorizon(&pPlayer->horizon.horiz, input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust); sethorizon(&pPlayer->horizon.horiz, input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
} }

View file

@ -38,8 +38,8 @@ struct PlayerInput
int yVel; int yVel;
uint16_t buttons; uint16_t buttons;
short nTarget; short nTarget;
fixed_t nAngle; float nAngle;
fixed_t pan; float pan;
int8_t nItem; int8_t nItem;
ESyncBits actions; ESyncBits actions;

View file

@ -109,7 +109,7 @@ void footprints(int snum);
int makepainsounds(int snum, int type); int makepainsounds(int snum, int type);
void playerCrouch(int snum); void playerCrouch(int snum);
void playerJump(int snum, int fz, int cz); void playerJump(int snum, int fz, int cz);
void processq16avel(player_struct* p, fixed_t* q16avel); void processavel(player_struct* p, float* avel);
void checklook(int snum, ESyncBits actions); void checklook(int snum, ESyncBits actions);
void playerCenterView(int snum); void playerCenterView(int snum);
void playerLookUp(int snum, ESyncBits actions); void playerLookUp(int snum, ESyncBits actions);

View file

@ -159,9 +159,9 @@ inline int PlayerInputForwardVel(int pl)
return ps[pl].sync.fvel; return ps[pl].sync.fvel;
} }
inline fixed_t PlayerInputAngVel(int pl) inline float PlayerInputAngVel(int pl)
{ {
return ps[pl].sync.q16avel; return ps[pl].sync.avel;
} }
inline float PlayerHorizon(int pl) inline float PlayerHorizon(int pl)

View file

@ -805,7 +805,7 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I
turnvel *= clamp(turnspeed * turnspeed, 0., 1.); turnvel *= clamp(turnspeed * turnspeed, 0., 1.);
input.fvel = p->MotoSpeed; input.fvel = p->MotoSpeed;
input.q16avel = FloatToFixed(turnvel); input.avel = turnvel;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -823,8 +823,8 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
{ {
// neutralize all movement when blocked or in automap follow mode // neutralize all movement when blocked or in automap follow mode
loc.fvel = loc.svel = 0; loc.fvel = loc.svel = 0;
loc.q16avel = loc.horz = 0; loc.avel = loc.horz = 0;
input.q16avel = input.horz = 0; input.avel = input.horz = 0;
} }
else else
{ {
@ -846,16 +846,16 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
if (p->on_crane < 0 && p->newowner == -1) if (p->on_crane < 0 && p->newowner == -1)
{ {
// input.q16avel already added to loc in processMovement() // input.avel already added to loc in processMovement()
loc.q16avel = clamp(loc.q16avel, IntToFixed(-MAXANGVEL), IntToFixed(MAXANGVEL)); loc.avel = clamp(loc.avel, -MAXANGVEL, MAXANGVEL);
if (!cl_syncinput && input.q16avel) if (!cl_syncinput && input.avel)
{ {
p->angle.spin = bamlook(0); p->angle.spin = bamlook(0);
} }
} }
else else
{ {
loc.q16avel = input.q16avel = 0; loc.avel = input.avel = 0;
} }
if (p->newowner == -1 && !(p->sync.actions & SB_CENTERVIEW)) if (p->newowner == -1 && !(p->sync.actions & SB_CENTERVIEW))
@ -921,8 +921,8 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
{ {
// Do these in the same order as the old code. // Do these in the same order as the old code.
calcviewpitch(p, scaleAdjust); calcviewpitch(p, scaleAdjust);
processq16avel(p, &input.q16avel); processavel(p, &input.avel);
applylook(&p->angle, input.q16avel, &p->sync.actions, scaleAdjust, p->crouch_toggle || p->sync.actions & SB_CROUCH); applylook(&p->angle, input.avel, &p->sync.actions, scaleAdjust, p->crouch_toggle || p->sync.actions & SB_CROUCH);
sethorizon(&p->horizon.horiz, input.horz, &p->sync.actions, scaleAdjust); sethorizon(&p->horizon.horiz, input.horz, &p->sync.actions, scaleAdjust);
} }

View file

@ -785,16 +785,16 @@ void apply_seasick(player_struct* p, double factor)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void processq16avel(player_struct* p, fixed_t* q16avel) void processavel(player_struct* p, float* avel)
{ {
// Taken from processinput() for use with applying look while cl_syncinput is 0. // Taken from processinput() for use with applying look while cl_syncinput is 0.
if (p->psectlotag == ST_2_UNDERWATER) if (p->psectlotag == ST_2_UNDERWATER)
{ {
*q16avel = (*q16avel - (*q16avel >> 3)) * sgn(TICSPERFRAME); *avel = (*avel - (*avel / 8.f)) * sgn(TICSPERFRAME);
} }
else else
{ {
*q16avel = *q16avel * sgn(TICSPERFRAME); *avel = *avel * sgn(TICSPERFRAME);
} }
} }

View file

@ -2839,7 +2839,7 @@ void processinput_d(int snum)
//ENGINE calculates angvel for you //ENGINE calculates angvel for you
// may still be needed later for demo recording // may still be needed later for demo recording
processq16avel(p, &sb_avel); processavel(p, &sb_avel);
applylook(&p->angle, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH); applylook(&p->angle, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH);
} }

View file

@ -3740,7 +3740,7 @@ void processinput_r(int snum)
//ENGINE calculates angvel for you //ENGINE calculates angvel for you
// may still be needed later for demo recording // may still be needed later for demo recording
processq16avel(p, &sb_avel); processavel(p, &sb_avel);
applylook(&p->angle, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH); applylook(&p->angle, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH);
apply_seasick(p, 1); apply_seasick(p, 1);
} }

View file

@ -861,7 +861,7 @@ struct PLAYERstruct
int slide_xvect, slide_yvect; int slide_xvect, slide_yvect;
short slide_ang; short slide_ang;
int slide_dec; int slide_dec;
int drive_q16avel; float drive_avel;

View file

@ -35,9 +35,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
void DoPlayerHorizon(PLAYERp pp, float const horz, double const scaleAdjust); void DoPlayerHorizon(PLAYERp pp, float const horz, double const scaleAdjust);
void DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust); void DoPlayerTurn(PLAYERp pp, float const avel, double const scaleAdjust);
void DoPlayerTurnVehicle(PLAYERp pp, fixed_t q16avel, int z, int floor_dist); void DoPlayerTurnVehicle(PLAYERp pp, float avel, int z, int floor_dist);
void DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel); void DoPlayerTurnTurret(PLAYERp pp, float avel);
static InputPacket loc; static InputPacket loc;
static int32_t turnheldtime; static int32_t turnheldtime;
@ -217,17 +217,17 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput)
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL)) if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_GENERAL))
{ {
DoPlayerTurn(pp, input.q16avel, scaleAdjust); DoPlayerTurn(pp, input.avel, scaleAdjust);
} }
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_VEHICLE)) if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_VEHICLE))
{ {
DoPlayerTurnVehicle(pp, input.q16avel, pp->posz + Z(10), labs(pp->posz + Z(10) - pp->sop->floor_loz)); DoPlayerTurnVehicle(pp, input.avel, pp->posz + Z(10), labs(pp->posz + Z(10) - pp->sop->floor_loz));
} }
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_TURRET)) if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN_TURRET))
{ {
DoPlayerTurnTurret(pp, input.q16avel); DoPlayerTurnTurret(pp, input.avel);
} }
pp->angle.processhelpers(scaleAdjust); pp->angle.processhelpers(scaleAdjust);

View file

@ -1281,7 +1281,7 @@ DoPlayerResetMovement(PLAYERp pp)
pp->yvect = pp->oxvect = 0; pp->yvect = pp->oxvect = 0;
pp->slide_xvect = 0; pp->slide_xvect = 0;
pp->slide_yvect = 0; pp->slide_yvect = 0;
pp->drive_q16avel = 0; pp->drive_avel = 0;
RESET(pp->Flags, PF_PLAYER_MOVED); RESET(pp->Flags, PF_PLAYER_MOVED);
} }
@ -1528,58 +1528,58 @@ UpdatePlayerSpriteAngle(PLAYERp pp)
} }
void void
DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust) DoPlayerTurn(PLAYERp pp, float const avel, double const scaleAdjust)
{ {
applylook(&pp->angle, q16avel, &pp->input.actions, scaleAdjust, pp->input.actions & (SB_CROUCH|SB_CROUCH_LOCK)); applylook(&pp->angle, avel, &pp->input.actions, scaleAdjust, pp->input.actions & (SB_CROUCH|SB_CROUCH_LOCK));
UpdatePlayerSpriteAngle(pp); UpdatePlayerSpriteAngle(pp);
} }
#if 0 #if 0
void void
DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel) DoPlayerTurnBoat(PLAYERp pp, float avel)
{ {
SECTOR_OBJECTp sop = pp->sop; SECTOR_OBJECTp sop = pp->sop;
if (sop->drive_angspeed) if (sop->drive_angspeed)
{ {
fixed_t drive_oq16avel = pp->drive_q16avel; float drive_oavel = pp->drive_avel;
pp->drive_q16avel = (mulscale16(q16avel, sop->drive_angspeed) + (drive_oq16avel * (sop->drive_angslide - 1))) / sop->drive_angslide; pp->drive_avel = (fmulscale16(avel, sop->drive_angspeed) + (drive_oavel * (sop->drive_angslide - 1))) / sop->drive_angslide;
q16avel = pp->drive_q16avel; avel = pp->drive_avel;
} }
else else
{ {
q16avel = xs_CRoundToInt(q16avel * 1.4); avel *= 1.4;
} }
if (q16avel != 0) if (avel != 0)
{ {
pp->angle.ang += degang(q16avel); pp->angle.ang += degang(avel);
sprite[pp->PlayerSprite].ang = pp->angle.ang.asbuild(); sprite[pp->PlayerSprite].ang = pp->angle.ang.asbuild();
} }
} }
#endif #endif
void void
DoPlayerTurnVehicle(PLAYERp pp, fixed_t q16avel, int z, int floor_dist) DoPlayerTurnVehicle(PLAYERp pp, float avel, int z, int floor_dist)
{ {
SECTOR_OBJECTp sop = pp->sop; SECTOR_OBJECTp sop = pp->sop;
if (sop->drive_angspeed) if (sop->drive_angspeed)
{ {
fixed_t drive_oq16avel = pp->drive_q16avel; float drive_oavel = pp->drive_avel;
pp->drive_q16avel = (mulscale16(q16avel, sop->drive_angspeed) + (drive_oq16avel * (sop->drive_angslide - 1))) / sop->drive_angslide; pp->drive_avel = (fmulscale16(avel, sop->drive_angspeed) + (drive_oavel * (sop->drive_angslide - 1))) / sop->drive_angslide;
q16avel = pp->drive_q16avel; avel = pp->drive_avel;
} }
else else
{ {
q16avel = DIV8(q16avel * synctics); avel = avel * synctics * 0.125;
} }
if (q16avel != 0) if (avel != 0)
{ {
auto sum = pp->angle.ang + degang(q16avel); auto sum = pp->angle.ang + degang(avel);
if (MultiClipTurn(pp, NORM_ANGLE(sum.asbuild()), z, floor_dist)) if (MultiClipTurn(pp, NORM_ANGLE(sum.asbuild()), z, floor_dist))
{ {
pp->angle.ang = sum; pp->angle.ang = sum;
@ -1591,24 +1591,24 @@ DoPlayerTurnVehicle(PLAYERp pp, fixed_t q16avel, int z, int floor_dist)
void void
DoPlayerTurnVehicleRect(PLAYERp pp, int *x, int *y, int *ox, int *oy) DoPlayerTurnVehicleRect(PLAYERp pp, int *x, int *y, int *ox, int *oy)
{ {
fixed_t q16avel; float avel;
SECTOR_OBJECTp sop = pp->sop; SECTOR_OBJECTp sop = pp->sop;
if (sop->drive_angspeed) if (sop->drive_angspeed)
{ {
fixed_t drive_oq16avel = pp->drive_q16avel; float drive_oavel = pp->drive_avel;
pp->drive_q16avel = (mulscale16(pp->input.q16avel, sop->drive_angspeed) + (drive_oq16avel * (sop->drive_angslide - 1))) / sop->drive_angslide; pp->drive_avel = (fmulscale16(pp->input.avel, sop->drive_angspeed) + (drive_oavel * (sop->drive_angslide - 1))) / sop->drive_angslide;
q16avel = pp->drive_q16avel; avel = pp->drive_avel;
} }
else else
{ {
q16avel = DIV8(pp->input.q16avel * synctics); avel = pp->input.avel * synctics * 0.125;
} }
if (q16avel != 0) if (avel != 0)
{ {
auto sum = pp->angle.ang + degang(q16avel); auto sum = pp->angle.ang + degang(avel);
if (RectClipTurn(pp, NORM_ANGLE(sum.asbuild()), x, y, ox, oy)) if (RectClipTurn(pp, NORM_ANGLE(sum.asbuild()), x, y, ox, oy))
{ {
pp->angle.ang = sum; pp->angle.ang = sum;
@ -1618,7 +1618,7 @@ DoPlayerTurnVehicleRect(PLAYERp pp, int *x, int *y, int *ox, int *oy)
} }
void void
DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel) DoPlayerTurnTurret(PLAYERp pp, float avel)
{ {
fixed_t diff; fixed_t diff;
binangle new_ang; binangle new_ang;
@ -1626,19 +1626,19 @@ DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel)
if (sop->drive_angspeed) if (sop->drive_angspeed)
{ {
fixed_t drive_oq16avel = pp->drive_q16avel; float drive_oavel = pp->drive_avel;
pp->drive_q16avel = (mulscale16(q16avel, sop->drive_angspeed) + (drive_oq16avel * (sop->drive_angslide - 1))) / sop->drive_angslide; pp->drive_avel = (fmulscale16(avel, sop->drive_angspeed) + (drive_oavel * (sop->drive_angslide - 1))) / sop->drive_angslide;
q16avel = pp->drive_q16avel; avel = pp->drive_avel;
} }
else else
{ {
q16avel = DIV4(q16avel * synctics); avel = avel * synctics * 0.25;
} }
if (q16avel != 0) if (avel != 0)
{ {
new_ang = pp->angle.ang + degang(q16avel); new_ang = pp->angle.ang + degang(avel);
if (sop->limit_ang_center >= 0) if (sop->limit_ang_center >= 0)
{ {
@ -2173,7 +2173,7 @@ DoPlayerMove(PLAYERp pp)
} }
else else
{ {
DoPlayerTurn(pp, pp->input.q16avel, 1); DoPlayerTurn(pp, pp->input.avel, 1);
} }
pp->oldposx = pp->posx; pp->oldposx = pp->posx;
@ -2462,7 +2462,7 @@ DoPlayerMoveBoat(PLAYERp pp)
} }
else else
{ {
DoPlayerTurnBoat(pp, pp->input.q16avel); DoPlayerTurnBoat(pp, pp->input.avel);
} }
if (PLAYER_MOVING(pp) == 0) if (PLAYER_MOVING(pp) == 0)
@ -2657,7 +2657,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
return; return;
// not moving - don't crush // not moving - don't crush
if ((pp->xvect|pp->yvect) == 0 && pp->input.q16avel == 0) if ((pp->xvect|pp->yvect) == 0 && pp->input.avel == 0)
return; return;
// main sector // main sector
@ -2966,7 +2966,7 @@ DoPlayerMoveVehicle(PLAYERp pp)
} }
else else
{ {
DoPlayerTurnVehicle(pp, pp->input.q16avel, z, floor_dist); DoPlayerTurnVehicle(pp, pp->input.avel, z, floor_dist);
} }
save_cstat = pp->SpriteP->cstat; save_cstat = pp->SpriteP->cstat;
@ -3022,9 +3022,9 @@ DoPlayerMoveTurret(PLAYERp pp)
{ {
if (!Prediction) if (!Prediction)
{ {
if (pp->input.q16avel && !pp->lastinput.q16avel) if (pp->input.avel && !pp->lastinput.avel)
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND); PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
else if (!pp->input.q16avel && pp->lastinput.q16avel) else if (!pp->input.avel && pp->lastinput.avel)
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND); PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
} }
@ -3034,7 +3034,7 @@ DoPlayerMoveTurret(PLAYERp pp)
} }
else else
{ {
DoPlayerTurnTurret(pp, pp->input.q16avel); DoPlayerTurnTurret(pp, pp->input.avel);
} }
if (PLAYER_MOVING(pp) == 0) if (PLAYER_MOVING(pp) == 0)
@ -5403,7 +5403,7 @@ DoPlayerBeginOperate(PLAYERp pp)
break; break;
case SO_TURRET_MGUN: case SO_TURRET_MGUN:
case SO_TURRET: case SO_TURRET:
if (pp->input.q16avel) if (pp->input.avel)
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);
@ -5493,7 +5493,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop)
break; break;
case SO_TURRET_MGUN: case SO_TURRET_MGUN:
case SO_TURRET: case SO_TURRET:
if (pp->input.q16avel) if (pp->input.avel)
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);
@ -6234,7 +6234,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
} }
else else
{ {
DoPlayerTurn(pp, pp->input.q16avel, 1); DoPlayerTurn(pp, pp->input.avel, 1);
} }
} }
@ -7039,7 +7039,7 @@ void ChopsCheck(PLAYERp pp)
{ {
if (!M_Active() && !TEST(pp->Flags, PF_DEAD) && !pp->sop_riding && numplayers <= 1) if (!M_Active() && !TEST(pp->Flags, PF_DEAD) && !pp->sop_riding && numplayers <= 1)
{ {
if (pp->input.actions & ~SB_RUN || pp->input.fvel || pp->input.svel || pp->input.q16avel || pp->input.horz || if (pp->input.actions & ~SB_RUN || pp->input.fvel || pp->input.svel || pp->input.avel || pp->input.horz ||
TEST(pp->Flags, PF_CLIMBING | PF_FALLING | PF_DIVING)) TEST(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