mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-05 05:10:55 +00:00
- SW: Hook up angAdjust
and adjust all ticrate amendments of q16ang
via playerAddAngle()
/playerSetAngle()
.
* Promoted some uses of `getangle()` upscaled to Q16.16 with `gethiq16angle()` for higher precision.
This commit is contained in:
parent
1cc1c21029
commit
e36c9fc78c
4 changed files with 29 additions and 25 deletions
|
@ -1699,7 +1699,7 @@ drawscreen(PLAYERp pp, double smoothratio)
|
||||||
tx = tx + quake_x;
|
tx = tx + quake_x;
|
||||||
ty = ty + quake_y;
|
ty = ty + quake_y;
|
||||||
//tq16horiz = tq16horiz + IntToFixed(quake_x);
|
//tq16horiz = tq16horiz + IntToFixed(quake_x);
|
||||||
tq16ang = IntToFixed(NORM_ANGLE(FixedToInt(tq16ang) + quake_ang));
|
tq16ang = NORM_Q16ANGLE(tq16ang + quake_ang);
|
||||||
|
|
||||||
if (pp->sop_remote)
|
if (pp->sop_remote)
|
||||||
{
|
{
|
||||||
|
|
|
@ -278,7 +278,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool
|
||||||
if (!cl_syncinput)
|
if (!cl_syncinput)
|
||||||
{
|
{
|
||||||
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN))
|
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN))
|
||||||
DoPlayerTurn(pp, q16avel, scaleAdjust);
|
DoPlayerTurn(pp, !TEST(pp->Flags, PF_DEAD) || TEST(pp->Flags, PF_DEAD) && TEST(pp->Flags, PF_DEAD_HEAD|PF_HEAD_CONTROL) ? q16avel : 0, scaleAdjust);
|
||||||
if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM))
|
if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM))
|
||||||
DoPlayerHorizon(pp, q16horz, scaleAdjust);
|
DoPlayerHorizon(pp, q16horz, scaleAdjust);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1608,6 +1608,12 @@ DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust)
|
||||||
if (q16avel != 0)
|
if (q16avel != 0)
|
||||||
{
|
{
|
||||||
pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF;
|
pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cl_syncinput && pp->angAdjust)
|
||||||
|
{
|
||||||
|
pp->q16ang = (pp->q16ang + FloatToFixed(scaleAdjust * pp->angAdjust)) & 0x7FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
// update players sprite angle
|
// update players sprite angle
|
||||||
// NOTE: It's also updated in UpdatePlayerSprite, but needs to be
|
// NOTE: It's also updated in UpdatePlayerSprite, but needs to be
|
||||||
|
@ -1619,7 +1625,6 @@ DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust)
|
||||||
{
|
{
|
||||||
sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang);
|
sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -3826,7 +3831,7 @@ DoPlayerClimb(PLAYERp pp)
|
||||||
pp->lx = lsp->x + nx * 5;
|
pp->lx = lsp->x + nx * 5;
|
||||||
pp->ly = lsp->y + ny * 5;
|
pp->ly = lsp->y + ny * 5;
|
||||||
|
|
||||||
pp->q16ang = IntToFixed(pp->LadderAngle);
|
playerSetAngle(pp, pp->LadderAngle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4285,7 +4290,7 @@ PlayerOnLadder(PLAYERp pp)
|
||||||
pp->lx = lsp->x + nx * 5;
|
pp->lx = lsp->x + nx * 5;
|
||||||
pp->ly = lsp->y + ny * 5;
|
pp->ly = lsp->y + ny * 5;
|
||||||
|
|
||||||
pp->q16ang = IntToFixed(pp->LadderAngle);
|
playerSetAngle(pp, pp->LadderAngle);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -5522,7 +5527,7 @@ DoPlayerBeginOperate(PLAYERp pp)
|
||||||
pp->sop = pp->sop_control = sop;
|
pp->sop = pp->sop_control = sop;
|
||||||
sop->controller = pp->SpriteP;
|
sop->controller = pp->SpriteP;
|
||||||
|
|
||||||
pp->q16ang = IntToFixed(sop->ang);
|
playerSetAngle(pp, sop->ang);
|
||||||
pp->posx = sop->xmid;
|
pp->posx = sop->xmid;
|
||||||
pp->posy = sop->ymid;
|
pp->posy = sop->ymid;
|
||||||
COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum);
|
COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum);
|
||||||
|
@ -5607,7 +5612,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop)
|
||||||
|
|
||||||
save_sectnum = pp->cursectnum;
|
save_sectnum = pp->cursectnum;
|
||||||
|
|
||||||
pp->q16ang = IntToFixed(sop->ang);
|
playerSetAngle(pp, sop->ang);
|
||||||
pp->posx = sop->xmid;
|
pp->posx = sop->xmid;
|
||||||
pp->posy = sop->ymid;
|
pp->posy = sop->ymid;
|
||||||
COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum);
|
COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum);
|
||||||
|
@ -5738,7 +5743,7 @@ DoPlayerStopOperate(PLAYERp pp)
|
||||||
if (TEST_BOOL1(pp->remote_sprite))
|
if (TEST_BOOL1(pp->remote_sprite))
|
||||||
pp->q16ang = pp->oq16ang = IntToFixed(pp->remote_sprite->ang);
|
pp->q16ang = pp->oq16ang = IntToFixed(pp->remote_sprite->ang);
|
||||||
else
|
else
|
||||||
pp->q16ang = pp->oq16ang = IntToFixed(getangle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy));
|
pp->q16ang = pp->oq16ang = gethiq16angle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pp->sop_control)
|
if (pp->sop_control)
|
||||||
|
@ -6393,15 +6398,14 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
|
||||||
if (pp->Killer > -1)
|
if (pp->Killer > -1)
|
||||||
{
|
{
|
||||||
SPRITEp kp = &sprite[pp->Killer];
|
SPRITEp kp = &sprite[pp->Killer];
|
||||||
fixed_t q16ang2, delta_q16ang;
|
|
||||||
|
|
||||||
if (FAFcansee(kp->x, kp->y, SPRITEp_TOS(kp), kp->sectnum,
|
if (FAFcansee(kp->x, kp->y, SPRITEp_TOS(kp), kp->sectnum, pp->posx, pp->posy, pp->posz, pp->cursectnum))
|
||||||
pp->posx, pp->posy, pp->posz, pp->cursectnum))
|
|
||||||
{
|
{
|
||||||
q16ang2 = gethiq16angle(kp->x - pp->posx, kp->y - pp->posy);
|
if (!cl_syncinput)
|
||||||
|
{
|
||||||
delta_q16ang = GetDeltaQ16Angle(q16ang2, pp->q16ang);
|
SET(pp->Flags2, PF2_INPUT_CAN_TURN);
|
||||||
pp->q16ang = NORM_Q16ANGLE(pp->q16ang + (delta_q16ang >> 4));
|
}
|
||||||
|
playerAddAngle(pp, GetDeltaQ16Angle(gethiq16angle(kp->x - pp->posx, kp->y - pp->posy), pp->q16ang) / (double)(FRACUNIT << 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7439,7 +7443,7 @@ domovethings(void)
|
||||||
// auto tracking mode for single player multi-game
|
// auto tracking mode for single player multi-game
|
||||||
if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex)
|
if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex)
|
||||||
{
|
{
|
||||||
Player[screenpeek].q16ang = IntToFixed(getangle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy));
|
playerSetAngle(&Player[screenpeek], gethiq16angle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy) / (double)(FRACUNIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TEST(pp->Flags, PF_DEAD))
|
if (!TEST(pp->Flags, PF_DEAD))
|
||||||
|
|
|
@ -1676,7 +1676,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
||||||
|
|
||||||
// New angle is formed by taking last known angle and
|
// New angle is formed by taking last known angle and
|
||||||
// adjusting by the delta angle
|
// adjusting by the delta angle
|
||||||
pp->q16ang = NORM_Q16ANGLE(pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng));
|
playerSetAngle(pp, (pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng)) / (double)(FRACUNIT));
|
||||||
|
|
||||||
UpdatePlayerSprite(pp);
|
UpdatePlayerSprite(pp);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue