SW: Trim q16 angle and horiz during demo playback/recording.

This uses the newly introduced PEDANTIC_MODE macro.
This commit is contained in:
NY00123 2020-04-03 23:26:38 +03:00 committed by Christoph Oelckers
parent 8284fcba9a
commit 6faa73286f
3 changed files with 12 additions and 0 deletions

View file

@ -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))]);

View file

@ -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"
//

View file

@ -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