mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 13:00:43 +00:00
RR: fix jittery view on moving sectors
This also fixes the interpolation for gamefunc_TurnAround and stomping on enemies. Replicates changes to Duke3D code from c30b21dcdc7dfbcd400abe0fad204f1c0bacdba1.
This commit is contained in:
parent
db5a4b49eb
commit
0822195ba2
5 changed files with 36 additions and 19 deletions
|
@ -1119,7 +1119,9 @@ ACTOR_STATIC void G_MovePlayers(void)
|
|||
{
|
||||
int const nextSprite = nextspritestat[spriteNum];
|
||||
spritetype *const pSprite = &sprite[spriteNum];
|
||||
DukePlayer_t *const pPlayer = g_player[P_GetP(pSprite)].ps;
|
||||
int const playerNum = P_GetP(pSprite);
|
||||
auto & thisPlayer = g_player[playerNum];
|
||||
auto const pPlayer = thisPlayer.ps;
|
||||
|
||||
if (pSprite->owner >= 0)
|
||||
{
|
||||
|
@ -1164,6 +1166,7 @@ ACTOR_STATIC void G_MovePlayers(void)
|
|||
if (G_HaveActor(sprite[spriteNum].picnum))
|
||||
A_Execute(spriteNum, P_GetP(pSprite), otherPlayerDist);
|
||||
|
||||
thisPlayer.smoothcamera = false;
|
||||
pPlayer->q16angvel = G_GetQ16AngleDelta(pPlayer->oq16ang, pPlayer->q16ang);
|
||||
pPlayer->oq16ang = pPlayer->q16ang;
|
||||
pPlayer->oq16horiz = pPlayer->q16horiz;
|
||||
|
@ -1185,6 +1188,14 @@ ACTOR_STATIC void G_MovePlayers(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (pPlayer->actorsqu >= 0)
|
||||
{
|
||||
thisPlayer.smoothcamera = true;
|
||||
pPlayer->q16ang += fix16_from_int(
|
||||
G_GetAngleDelta(fix16_to_int(pPlayer->q16ang), getangle(sprite[pPlayer->actorsqu].x - pPlayer->pos.x, sprite[pPlayer->actorsqu].y - pPlayer->pos.y))
|
||||
>> 2);
|
||||
}
|
||||
|
||||
if (ud.god)
|
||||
{
|
||||
pSprite->extra = pPlayer->max_player_health;
|
||||
|
@ -1211,6 +1222,7 @@ ACTOR_STATIC void G_MovePlayers(void)
|
|||
|
||||
if (pPlayer->wackedbyactor >= 0 && sprite[pPlayer->wackedbyactor].statnum < MAXSTATUS)
|
||||
{
|
||||
thisPlayer.smoothcamera = true;
|
||||
pPlayer->q16ang += fix16_from_int(G_GetAngleDelta(fix16_to_int(pPlayer->q16ang),
|
||||
getangle(sprite[pPlayer->wackedbyactor].x - pPlayer->pos.x,
|
||||
sprite[pPlayer->wackedbyactor].y - pPlayer->pos.y))
|
||||
|
@ -1639,6 +1651,7 @@ ACTOR_STATIC void G_MoveStandables(void)
|
|||
pSprite->owner = -2;
|
||||
g_player[p].ps->on_crane = spriteNum;
|
||||
A_PlaySound(RR ? 390 : DUKE_GRUNT,g_player[p].ps->i);
|
||||
g_player[p].smoothcamera = true;
|
||||
g_player[p].ps->q16ang = fix16_from_int(pSprite->ang+1024);
|
||||
}
|
||||
else
|
||||
|
@ -3277,7 +3290,8 @@ ACTOR_STATIC void G_MoveTransports(void)
|
|||
if (sprite[sectSprite].owner != -1)
|
||||
{
|
||||
int const playerNum = P_Get(sectSprite);
|
||||
DukePlayer_t *const pPlayer = g_player[playerNum].ps;
|
||||
auto & thisPlayer = g_player[playerNum];
|
||||
auto const pPlayer = thisPlayer.ps;
|
||||
|
||||
pPlayer->on_warping_sector = 1;
|
||||
|
||||
|
@ -3299,6 +3313,7 @@ ACTOR_STATIC void G_MoveTransports(void)
|
|||
}
|
||||
}
|
||||
|
||||
thisPlayer.smoothcamera = true;
|
||||
pPlayer->q16ang = fix16_from_int(sprite[OW(spriteNum)].ang);
|
||||
|
||||
if (sprite[OW(spriteNum)].owner != OW(spriteNum))
|
||||
|
@ -3328,12 +3343,12 @@ ACTOR_STATIC void G_MoveTransports(void)
|
|||
break;
|
||||
|
||||
if (onFloor == 0 && klabs(SZ(spriteNum) - pPlayer->pos.z) < 6144)
|
||||
if (!pPlayer->jetpack_on || TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_JUMP)
|
||||
|| (TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_CROUCH) ^ pPlayer->crouch_toggle))
|
||||
if (!pPlayer->jetpack_on || TEST_SYNC_KEY(thisPlayer.input->bits, SK_JUMP)
|
||||
|| (TEST_SYNC_KEY(thisPlayer.input->bits, SK_CROUCH) ^ pPlayer->crouch_toggle))
|
||||
{
|
||||
pPlayer->pos.x += sprite[OW(spriteNum)].x - SX(spriteNum);
|
||||
pPlayer->pos.y += sprite[OW(spriteNum)].y - SY(spriteNum);
|
||||
pPlayer->pos.z = (pPlayer->jetpack_on && (TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_JUMP)
|
||||
pPlayer->pos.z = (pPlayer->jetpack_on && (TEST_SYNC_KEY(thisPlayer.input->bits, SK_JUMP)
|
||||
|| pPlayer->jetpack_on < 11))
|
||||
? sprite[OW(spriteNum)].z - 6144
|
||||
: sprite[OW(spriteNum)].z + 6144;
|
||||
|
@ -7002,6 +7017,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
|
||||
if (pPlayer->cursectnum == pSprite->sectnum && pPlayer->on_ground == 1)
|
||||
{
|
||||
g_player[playerNum].smoothcamera = true;
|
||||
pPlayer->q16ang += fix16_from_int(l*q);
|
||||
pPlayer->q16ang &= 0x7FFFFFF;
|
||||
|
||||
|
@ -7266,6 +7282,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
pPlayer->bobpos.x += m;
|
||||
pPlayer->bobpos.y += x;
|
||||
|
||||
g_player[playerNum].smoothcamera = true;
|
||||
|
||||
pPlayer->q16ang += fix16_from_int(q);
|
||||
pPlayer->q16ang &= 0x7FFFFFF;
|
||||
|
||||
|
|
|
@ -822,7 +822,8 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t q16horiz
|
|||
|
||||
void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
||||
{
|
||||
DukePlayer_t *const pPlayer = g_player[playerNum].ps;
|
||||
auto const &thisPlayer = g_player[playerNum];
|
||||
auto const pPlayer = thisPlayer.ps;
|
||||
|
||||
int yxAspect = yxaspect;
|
||||
int viewingRange = viewingrange;
|
||||
|
@ -1028,7 +1029,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
|
||||
CAMERA(pos) = camVect;
|
||||
|
||||
if (pPlayer->wackedbyactor >= 0)
|
||||
if (thisPlayer.smoothcamera)
|
||||
{
|
||||
CAMERA(q16ang) = pPlayer->oq16ang
|
||||
+ mulscale16(((pPlayer->q16ang + F16(1024) - pPlayer->oq16ang) & 0x7FFFFFF) - F16(1024), smoothRatio)
|
||||
|
|
|
@ -9009,11 +9009,6 @@ HORIZONLY:;
|
|||
}
|
||||
pPlayer->actorsqu = -1;
|
||||
}
|
||||
else if (pPlayer->actorsqu >= 0)
|
||||
pPlayer->q16ang += fix16_from_int(
|
||||
G_GetAngleDelta(fix16_to_int(pPlayer->q16ang),
|
||||
getangle(sprite[pPlayer->actorsqu].x - pPlayer->pos.x, sprite[pPlayer->actorsqu].y - pPlayer->pos.y))
|
||||
>> 2);
|
||||
}
|
||||
|
||||
if (P_DoCounters(playerNum))
|
||||
|
|
|
@ -247,6 +247,7 @@ typedef struct
|
|||
// NOTE: wchoice[HANDREMOTE_WEAPON .. MAX_WEAPONS-1] unused
|
||||
uint8_t frags[MAXPLAYERS], wchoice[MAX_WEAPONS];
|
||||
|
||||
char smoothcamera;
|
||||
char vote, gotvote, playerreadyflag, playerquitflag, connected;
|
||||
char user_name[32];
|
||||
char syncval[SYNCFIFOSIZ][MAXSYNCBYTES];
|
||||
|
|
|
@ -837,7 +837,8 @@ void P_ResetPlayer(int playerNum)
|
|||
|
||||
void P_ResetStatus(int playerNum)
|
||||
{
|
||||
DukePlayer_t *const pPlayer = g_player[playerNum].ps;
|
||||
auto & thisPlayer = g_player[playerNum];
|
||||
auto const pPlayer = thisPlayer.ps;
|
||||
|
||||
gFullMap = 0;
|
||||
pPlayer->dead_flag = 0;
|
||||
|
@ -932,9 +933,10 @@ void P_ResetStatus(int playerNum)
|
|||
pPlayer->movement_lock = 0;
|
||||
pPlayer->frag_ps = playerNum;
|
||||
|
||||
g_player[playerNum].horizRecenter = 0;
|
||||
g_player[playerNum].horizSkew = 0;
|
||||
g_player[playerNum].horizAngleAdjust = 0;
|
||||
thisPlayer.smoothcamera = false;
|
||||
thisPlayer.horizRecenter = false;
|
||||
thisPlayer.horizSkew = 0;
|
||||
thisPlayer.horizAngleAdjust = 0;
|
||||
|
||||
P_UpdateScreenPal(pPlayer);
|
||||
|
||||
|
|
Loading…
Reference in a new issue