- SW: Remove camq16* variables from game and backend code that supported them.

* `cl_syncinput 0` is very raw at the moment.
This commit is contained in:
Mitchell Richters 2020-09-07 08:40:14 +10:00
parent d1d40c6982
commit 6e6373deda
9 changed files with 30 additions and 81 deletions

View file

@ -1021,8 +1021,6 @@ void NetUpdate (void)
int fvel;
int64_t q16avel;
int64_t q16horz;
int64_t q16horiz; // only used by SW
int64_t q16ang; // only used by SW
for (j = 0; j < ticdup; ++j)
{
@ -1031,16 +1029,12 @@ void NetUpdate (void)
fvel += localcmds[modp].ucmd.fvel;
q16avel += localcmds[modp].ucmd.q16avel;
q16horz += localcmds[modp].ucmd.q16horz;
q16horiz += localcmds[modp].ucmd.q16horiz;
q16ang += localcmds[modp].ucmd.q16ang;
}
svel /= ticdup;
fvel /= ticdup;
q16avel /= ticdup;
q16horz /= ticdup;
q16horiz /= ticdup;
q16ang /= ticdup;
for (j = 0; j < ticdup; ++j)
{
@ -1049,8 +1043,6 @@ void NetUpdate (void)
localcmds[modp].ucmd.fvel = fvel;
localcmds[modp].ucmd.q16avel = q16avel;
localcmds[modp].ucmd.q16horz = q16horz;
localcmds[modp].ucmd.q16horiz = q16horiz;
localcmds[modp].ucmd.q16ang = q16ang;
}
Net_NewMakeTic ();

View file

@ -167,10 +167,6 @@ int UnpackUserCmd (InputPacket *ucmd, const InputPacket *basis, uint8_t **stream
ucmd->fvel = ReadWord (stream);
if (flags & UCMDF_SIDEMOVE)
ucmd->svel = ReadWord (stream);
if (flags & UCMDF_UPMOVE)
ucmd->q16horiz = ReadLong (stream);
if (flags & UCMDF_ROLL)
ucmd->q16ang = ReadLong (stream);
}
return int(*stream - start);
@ -217,16 +213,6 @@ int PackUserCmd (const InputPacket *ucmd, const InputPacket *basis, uint8_t **st
flags |= UCMDF_SIDEMOVE;
WriteWord (ucmd->svel, stream);
}
if (ucmd->q16horiz != basis->q16horiz)
{
flags |= UCMDF_UPMOVE;
WriteLong (ucmd->q16horiz, stream);
}
if (ucmd->q16ang != basis->q16ang)
{
flags |= UCMDF_ROLL;
WriteLong (ucmd->q16ang, stream);
}
// Write the packing bits
WriteByte (flags, &temp);
@ -252,10 +238,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, InputPacket &cmd, Inpu
arc("actions", cmd.actions)
("horz", cmd.q16horz)
("avel", cmd.q16avel)
("ang", cmd.q16ang)
("fvel", cmd.fvel)
("svwl", cmd.svel)
("q16horiz", cmd.q16horiz)
.EndObject();
}
return arc;
@ -269,9 +253,7 @@ int WriteUserCmdMessage (InputPacket *ucmd, const InputPacket *basis, uint8_t **
ucmd->q16horz != 0 ||
ucmd->q16avel != 0 ||
ucmd->fvel != 0 ||
ucmd->svel != 0 ||
ucmd->q16horiz != 0 ||
ucmd->q16ang != 0)
ucmd->svel != 0)
{
WriteByte (DEM_USERCMD, stream);
return PackUserCmd (ucmd, basis, stream) + 1;
@ -282,9 +264,7 @@ int WriteUserCmdMessage (InputPacket *ucmd, const InputPacket *basis, uint8_t **
ucmd->q16horz != basis->q16horz ||
ucmd->q16avel != basis->q16avel ||
ucmd->fvel != basis->fvel ||
ucmd->svel != basis->svel ||
ucmd->q16horiz != basis->q16horiz ||
ucmd->q16ang != basis->q16ang)
ucmd->svel != basis->svel)
{
WriteByte (DEM_USERCMD, stream);
return PackUserCmd (ucmd, basis, stream) + 1;

View file

@ -74,8 +74,6 @@ struct InputPacket
int16_t fvel;
fixed_t q16avel;
fixed_t q16horz;
fixed_t q16horiz; // only used by SW
fixed_t q16ang; // only used by SW
ESyncBits actions;

View file

@ -1176,7 +1176,7 @@ FString GameInterface::GetCoordString()
out.AppendFormat("POSX:%d ", pp->posx);
out.AppendFormat("POSY:%d ", pp->posy);
out.AppendFormat("POSZ:%d ", pp->posz);
out.AppendFormat("ANG:%d\n", FixedToInt(pp->camq16ang));
out.AppendFormat("ANG:%d\n", FixedToInt(pp->q16ang));
return out;
}
@ -1656,15 +1656,10 @@ drawscreen(PLAYERp pp, double smoothratio)
tq16ang = camerapp->oq16ang + xs_CRoundToInt(fmulscale16(NORM_Q16ANGLE(camerapp->q16ang + IntToFixed(1024) - camerapp->oq16ang) - IntToFixed(1024), smoothratio));
tq16horiz = camerapp->oq16horiz + xs_CRoundToInt(fmulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio));
}
else if (cl_sointerpolation && !CommEnabled)
{
tq16ang = camerapp->oq16ang + xs_CRoundToInt(fmulscale16(((pp->camq16ang + IntToFixed(1024) - camerapp->oq16ang) & 0x7FFFFFF) - IntToFixed(1024), smoothratio));
tq16horiz = camerapp->oq16horiz + xs_CRoundToInt(fmulscale16(pp->camq16horiz - camerapp->oq16horiz, smoothratio));
}
else
{
tq16ang = pp->camq16ang;
tq16horiz = pp->camq16horiz;
tq16ang = pp->q16ang;
tq16horiz = pp->q16horiz;
}
tsectnum = camerapp->cursectnum;

View file

@ -883,7 +883,6 @@ struct PLAYERstruct
int hvel,tilt,tilt_dest;
bool centering;
fixed_t q16horiz, q16horizbase, q16horizoff, q16ang;
fixed_t camq16horiz, camq16ang;
short recoil_amt;
short recoil_speed;
short recoil_ndx;

View file

@ -280,15 +280,10 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool
if (!cl_syncinput)
{
fixed_t const prevcamq16ang = pp->camq16ang, prevcamq16horiz = pp->camq16horiz;
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN))
DoPlayerTurn(pp, &pp->camq16ang, q16avel, scaleAdjust);
DoPlayerTurn(pp, &pp->q16ang, q16avel, scaleAdjust);
if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM))
DoPlayerHorizon(pp, &pp->camq16horiz, q16horz, scaleAdjust);
pp->oq16ang += pp->camq16ang - prevcamq16ang;
pp->oq16horiz += pp->camq16horiz - prevcamq16horiz;
DoPlayerHorizon(pp, &pp->q16horiz, q16horz, scaleAdjust);
}
loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL);
@ -321,8 +316,6 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput)
packet->fvel = mulscale9(loc.fvel, sintable[NORM_ANGLE(ang + 512)]) + mulscale9(loc.svel, sintable[NORM_ANGLE(ang)]);
packet->svel = mulscale9(loc.fvel, sintable[NORM_ANGLE(ang)]) + mulscale9(loc.svel, sintable[NORM_ANGLE(ang + 1536)]);
packet->q16ang = pp->camq16ang;
packet->q16horiz = pp->camq16horiz;
loc = {};
}

View file

@ -60,12 +60,12 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
if (parm->numparms >= 4)
{
Player->oq16ang = Player->q16ang = Player->camq16ang = IntToFixed(atoi(parm->parms[3]));
Player->oq16ang = Player->q16ang = IntToFixed(atoi(parm->parms[3]));
}
if (parm->numparms == 5)
{
Player->oq16horiz = Player->q16horiz = Player->camq16horiz = IntToFixed(atoi(parm->parms[4]));
Player->oq16horiz = Player->q16horiz = IntToFixed(atoi(parm->parms[4]));
}
return CCMD_OK;

View file

@ -1339,8 +1339,7 @@ DoPlayerTeleportPause(PLAYERp pp)
void
DoPlayerTeleportToSprite(PLAYERp pp, SPRITEp sp)
{
pp->camq16ang = pp->q16ang = pp->oq16ang = IntToFixed(sp->ang);
pp->camq16horiz = pp->q16horiz; // Ensure horiz is initially locked
pp->q16ang = pp->oq16ang = IntToFixed(sp->ang);
pp->posx = pp->oposx = pp->oldposx = sp->x;
pp->posy = pp->oposy = pp->oldposy = sp->y;
@ -1547,7 +1546,7 @@ void
DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel, double const scaleAdjust = 1.)
{
#define TURN_SHIFT 2
#if 0
if (!cl_syncinput && (pq16ang == &pp->q16ang))
{
SET(pp->Flags2, PF2_INPUT_CAN_TURN);
@ -1562,7 +1561,7 @@ DoPlayerTurn(PLAYERp pp, fixed_t *pq16ang, fixed_t q16angvel, double const scale
}
return;
}
#endif
if (!TEST(pp->Flags, PF_TURN_180))
{
if (pp->input.actions & SB_TURNAROUND)
@ -1677,7 +1676,7 @@ DoPlayerTurnBoat(PLAYERp pp)
if (angvel != 0)
{
pp->camq16ang = pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel));
pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel));
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
}
}
@ -1709,7 +1708,7 @@ DoPlayerTurnTank(PLAYERp pp, int z, int floor_dist)
{
if (MultiClipTurn(pp, NORM_ANGLE(FixedToInt(pp->q16ang) + angvel), z, floor_dist))
{
pp->camq16ang = pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel));
pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel));
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
}
}
@ -1742,7 +1741,7 @@ DoPlayerTurnTankRect(PLAYERp pp, int *x, int *y, int *ox, int *oy)
{
if (RectClipTurn(pp, NORM_ANGLE(FixedToInt(pp->q16ang) + angvel), x, y, ox, oy))
{
pp->camq16ang = pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel));
pp->q16ang = IntToFixed(NORM_ANGLE(FixedToInt(pp->q16ang) + angvel));
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
}
}
@ -1799,7 +1798,7 @@ DoPlayerTurnTurret(PLAYERp pp)
}
}
pp->camq16ang = pp->q16ang = IntToFixed(new_ang);
pp->q16ang = IntToFixed(new_ang);
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
}
}
@ -1909,7 +1908,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double const sc
// //DSPRINTF(ds,"FixedToInt(pp->q16horizoff), %d", FixedToInt(pp->q16horizoff));
// MONO_PRINT(ds);
#if 0
if (!cl_syncinput && (pq16horiz == &pp->q16horiz))
{
SET(pp->Flags2, PF2_INPUT_CAN_AIM);
@ -1918,7 +1917,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t *pq16horiz, fixed_t q16horz, double const sc
pp->oq16horiz = pp->q16horiz;
return;
}
#endif
// Fixme: This should probably be made optional.
if (cl_slopetilting)
PlayerAutoLook(pp, scaleAdjust);
@ -3910,7 +3909,7 @@ DoPlayerClimb(PLAYERp pp)
pp->lx = lsp->x + nx * 5;
pp->ly = lsp->y + ny * 5;
pp->camq16ang = pp->q16ang = IntToFixed(pp->LadderAngle);
pp->q16ang = IntToFixed(pp->LadderAngle);
}
}
}
@ -4371,7 +4370,7 @@ PlayerOnLadder(PLAYERp pp)
pp->lx = lsp->x + nx * 5;
pp->ly = lsp->y + ny * 5;
pp->camq16ang = pp->q16ang = IntToFixed(pp->LadderAngle);
pp->q16ang = IntToFixed(pp->LadderAngle);
return TRUE;
}
@ -5611,7 +5610,7 @@ DoPlayerBeginOperate(PLAYERp pp)
pp->sop = pp->sop_control = sop;
sop->controller = pp->SpriteP;
pp->camq16ang = pp->q16ang = IntToFixed(sop->ang);
pp->q16ang = IntToFixed(sop->ang);
pp->posx = sop->xmid;
pp->posy = sop->ymid;
COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum);
@ -5696,7 +5695,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop)
save_sectnum = pp->cursectnum;
pp->camq16ang = pp->q16ang = IntToFixed(sop->ang);
pp->q16ang = IntToFixed(sop->ang);
pp->posx = sop->xmid;
pp->posy = sop->ymid;
COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum);
@ -5825,9 +5824,9 @@ DoPlayerStopOperate(PLAYERp pp)
if (pp->sop_remote)
{
if (TEST_BOOL1(pp->remote_sprite))
pp->camq16ang = pp->q16ang = pp->oq16ang = IntToFixed(pp->remote_sprite->ang);
pp->q16ang = pp->oq16ang = IntToFixed(pp->remote_sprite->ang);
else
pp->camq16ang = pp->q16ang = pp->oq16ang = IntToFixed(getangle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy));
pp->q16ang = pp->oq16ang = IntToFixed(getangle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy));
}
if (pp->sop_control)
@ -6187,10 +6186,6 @@ DoPlayerBeginDie(PLAYERp pp)
if (GodMode)
return;
// Ensure these are initially locked
pp->camq16ang = pp->q16ang;
pp->camq16horiz = pp->q16horiz;
StopPlayerSound(pp);
// Do the death scream
@ -6393,7 +6388,6 @@ DoPlayerDeathHoriz(PLAYERp pp, short target, short speed)
pp->q16horiz = IntToFixed(target);
}
pp->camq16horiz = pp->q16horiz;
return pp->q16horiz == IntToFixed(target);
}
@ -6492,7 +6486,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
q16ang2 = gethiq16angle(kp->x - pp->posx, kp->y - pp->posy);
delta_q16ang = GetDeltaQ16Angle(q16ang2, pp->q16ang);
pp->camq16ang = pp->q16ang = NORM_Q16ANGLE(pp->q16ang + (delta_q16ang >> 4));
pp->q16ang = NORM_Q16ANGLE(pp->q16ang + (delta_q16ang >> 4));
}
}
}
@ -6549,7 +6543,7 @@ void DoPlayerDeathCheckKeys(PLAYERp pp)
sp->yrepeat = PLAYER_NINJA_YREPEAT;
//pp->tilt = 0;
pp->camq16horiz = pp->q16horiz = pp->q16horizbase = IntToFixed(100);
pp->q16horiz = pp->q16horizbase = IntToFixed(100);
DoPlayerResetMovement(pp);
u->ID = NINJA_RUN_R0;
PlayerDeathReset(pp);
@ -7531,7 +7525,7 @@ domovethings(void)
// auto tracking mode for single player multi-game
if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex)
{
Player[screenpeek].camq16ang = Player[screenpeek].q16ang = IntToFixed(getangle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy));
Player[screenpeek].q16ang = IntToFixed(getangle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy));
}
if (!TEST(pp->Flags, PF_DEAD))
@ -7614,8 +7608,8 @@ InitAllPlayers(void)
pp->posx = pp->oposx = pfirst->posx;
pp->posy = pp->oposy = pfirst->posy;
pp->posz = pp->oposz = pfirst->posz;
pp->camq16ang = pp->q16ang = pp->oq16ang = pfirst->q16ang;
pp->camq16horiz = pp->q16horiz = pp->oq16horiz = pfirst->q16horiz;
pp->q16ang = pp->oq16ang = pfirst->q16ang;
pp->q16horiz = pp->oq16horiz = pfirst->q16horiz;
pp->cursectnum = pfirst->cursectnum;
// set like this so that player can trigger something on start of the level
pp->lastcursectnum = pfirst->cursectnum+1;
@ -7762,7 +7756,7 @@ PlayerSpawnPosition(PLAYERp pp)
pp->posx = pp->oposx = sp->x;
pp->posy = pp->oposy = sp->y;
pp->posz = pp->oposz = sp->z;
pp->camq16ang = pp->q16ang = pp->oq16ang = IntToFixed(sp->ang);
pp->q16ang = pp->oq16ang = IntToFixed(sp->ang);
pp->cursectnum = sp->sectnum;
getzsofslope(pp->cursectnum, pp->posx, pp->posy, &cz, &fz);

View file

@ -1676,8 +1676,6 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
// New angle is formed by taking last known angle and
// adjusting by the delta angle
pp->camq16ang += NORM_Q16ANGLE(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng)) - pp->q16ang;
pp->camq16ang = NORM_Q16ANGLE(pp->camq16ang);
pp->q16ang = NORM_Q16ANGLE(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng));
UpdatePlayerSprite(pp);