From 6faa73286fae5559b5d9626ba0064ac862bfa0a4 Mon Sep 17 00:00:00 2001 From: NY00123 Date: Fri, 3 Apr 2020 23:26:38 +0300 Subject: [PATCH] SW: Trim q16 angle and horiz during demo playback/recording. This uses the newly introduced PEDANTIC_MODE macro. --- source/sw/src/game.cpp | 5 +++++ source/sw/src/game.h | 5 +++++ source/sw/src/player.cpp | 2 ++ 3 files changed, 12 insertions(+) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index a5f8d4593..1a7ee4718 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -3250,6 +3250,11 @@ void getinput(SW_PACKET *loc) q16avel = fix16_clamp(q16avel, -fix16_from_int(MAXANGVEL), fix16_from_int(MAXANGVEL)); q16horz = fix16_clamp(q16horz, -fix16_from_int(MAXHORIZVEL), fix16_from_int(MAXHORIZVEL)); + if (PEDANTIC_MODE) + { + q16avel = fix16_floor(q16avel); + q16horz = fix16_floor(q16horz); + } momx = mulscale9(vel, sintable[NORM_ANGLE(fix16_to_int(newpp->q16ang) + 512)]); momy = mulscale9(vel, sintable[NORM_ANGLE(fix16_to_int(newpp->q16ang))]); diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 6fd4ceb62..cdcb85141 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -186,6 +186,11 @@ int krand1(void); #define PRINT(line,str) DebugPrint(line,str) +// Demo compatibility mode +extern SWBOOL DemoPlaying, DemoRecording, DemoEdit, DemoMode; +#define PEDANTIC_MODE (DemoPlaying || DemoRecording || DemoEdit || DemoMode) + +#include "pragmas.h" // diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 04e9a7bd5..2eb121bc9 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1603,6 +1603,8 @@ DoPlayerTurn(PLAYERp pp) pp->q16ang += fix16_sdiv(fix16_mul(q16avel, fix16_from_int(synctics)), fix16_from_int(32)); pp->q16ang = NORM_Q16ANGLE(pp->q16ang); + if (PEDANTIC_MODE) + pp->q16ang = fix16_floor(pp->q16ang); // update players sprite angle // NOTE: It's also updated in UpdatePlayerSprite, but needs to be