From 15a362f9ac2913bf87fd91c34f865fd8fb90f4b8 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 18 Mar 2020 10:23:03 +1100 Subject: [PATCH] Manually merge EDuke32 SVN commit 8605. --- source/rr/src/actors.cpp | 22 ++++++++++++++++++++++ source/rr/src/player.cpp | 9 --------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/source/rr/src/actors.cpp b/source/rr/src/actors.cpp index b4a8b6fb5..7170a0286 100644 --- a/source/rr/src/actors.cpp +++ b/source/rr/src/actors.cpp @@ -1111,6 +1111,23 @@ static int P_Submerge(int, int, DukePlayer_t *, int, int); static int P_Emerge(int, int, DukePlayer_t *, int, int); static void P_FinishWaterChange(int, DukePlayer_t *, int, int, int); +static fix16_t P_GetQ16AngleDeltaForTic(DukePlayer_t const *pPlayer) +{ + auto oldAngle = pPlayer->oq16ang; + auto newAngle = pPlayer->q16ang; + + if (klabs(fix16_sub(oldAngle, newAngle)) < F16(1024)) + return fix16_sub(newAngle, oldAngle); + + if (newAngle > F16(1024)) + newAngle = fix16_sub(newAngle, F16(2048)); + + if (oldAngle > F16(1024)) + oldAngle = fix16_sub(oldAngle, F16(2048)); + + return fix16_sub(newAngle, oldAngle); +} + ACTOR_STATIC void G_MovePlayers(void) { int spriteNum = headspritestat[STAT_PLAYER]; @@ -1164,6 +1181,11 @@ ACTOR_STATIC void G_MovePlayers(void) if (G_HaveActor(sprite[spriteNum].picnum)) A_Execute(spriteNum, P_GetP(pSprite), otherPlayerDist); + pPlayer->q16angvel = P_GetQ16AngleDeltaForTic(pPlayer); + pPlayer->oq16ang = pPlayer->q16ang; + pPlayer->oq16horiz = pPlayer->q16horiz; + pPlayer->oq16horizoff = pPlayer->q16horizoff; + if (g_netServer || ud.multimode > 1) { if (sprite[g_player[otherp].ps->i].extra > 0) diff --git a/source/rr/src/player.cpp b/source/rr/src/player.cpp index 5322d90cb..1475b5791 100644 --- a/source/rr/src/player.cpp +++ b/source/rr/src/player.cpp @@ -7116,7 +7116,6 @@ static void P_Dead(int const playerNum, int const sectorLotag, int const floorZ, } Bmemcpy(&pPlayer->opos, &pPlayer->pos, sizeof(vec3_t)); - pPlayer->oq16ang = pPlayer->q16ang; pPlayer->opyoff = pPlayer->pyoff; pPlayer->q16horiz = F16(100); @@ -7772,9 +7771,6 @@ void P_ProcessInput(int playerNum) actor[pPlayer->i].floorz = floorZ; actor[pPlayer->i].ceilingz = ceilZ; - pPlayer->oq16horiz = pPlayer->q16horiz; - pPlayer->oq16horizoff = pPlayer->q16horizoff; - if (highZhit >= 0 && (highZhit&49152) == 49152) { highZhit &= (MAXSPRITES-1); @@ -8053,7 +8049,6 @@ check_enemy_sprite: pPlayer->bobpos.y = pPlayer->pos.y; pPlayer->opos.z = pPlayer->pos.z; pPlayer->opyoff = pPlayer->pyoff; - pPlayer->oq16ang = pPlayer->q16ang; if (pPlayer->one_eighty_count < 0) { @@ -9124,9 +9119,6 @@ void P_DHProcessInput(int playerNum) actor[pPlayer->i].floorz = floorZ; actor[pPlayer->i].ceilingz = ceilZ; - pPlayer->oq16horiz = pPlayer->q16horiz; - pPlayer->oq16horizoff = pPlayer->q16horizoff; - if (pPlayer->q16horizoff > 0) { pPlayer->q16horizoff -= ((pPlayer->q16horizoff >> 3) + fix16_one); @@ -9282,7 +9274,6 @@ void P_DHProcessInput(int playerNum) pPlayer->bobpos.y = pPlayer->pos.y; pPlayer->opos.z = pPlayer->pos.z; pPlayer->opyoff = pPlayer->pyoff; - pPlayer->oq16ang = pPlayer->q16ang; if (pPlayer->one_eighty_count < 0) {