Add PedanticQ16AngleFloor to sw/src/game.h and use it in DoPlayerTurn

This commit is contained in:
NY00123 2020-04-18 01:55:39 +03:00 committed by Christoph Oelckers
parent b84975e406
commit 36e6dee64c
2 changed files with 8 additions and 6 deletions

View file

@ -188,6 +188,8 @@ int krand1(void);
#include "pragmas.h" #include "pragmas.h"
extern SWBOOL PedanticMode;
extern SWBOOL InterpolateSectObj;
// //
// Map directions/degrees // Map directions/degrees
@ -453,6 +455,11 @@ static fix16_t FORCE_INLINE GetQ16AngleFromVect(int32_t xvect, int32_t yvect)
return (PedanticMode ? getq16angle : gethiq16angle)(xvect, yvect); return (PedanticMode ? getq16angle : gethiq16angle)(xvect, yvect);
} }
static fix16_t FORCE_INLINE PedanticQ16AngleFloor(fix16_t ang)
{
return PedanticMode ? fix16_floor(ang) : ang;
}
int StdRandomRange(int range); int StdRandomRange(int range);
#define STD_RANDOM_P2(pwr_of_2) (MOD_P2(rand(),(pwr_of_2))) #define STD_RANDOM_P2(pwr_of_2) (MOD_P2(rand(),(pwr_of_2)))
#define STD_RANDOM_RANGE(range) (StdRandomRange(range)) #define STD_RANDOM_RANGE(range) (StdRandomRange(range))
@ -889,9 +896,6 @@ extern int PlayerYellVocs[MAX_YELLSOUNDS];
void BossHealthMeter(void); void BossHealthMeter(void);
extern SWBOOL PedanticMode;
extern SWBOOL InterpolateSectObj;
// Global variables used for modifying variouse things from the Console // Global variables used for modifying variouse things from the Console
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -1626,9 +1626,7 @@ DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel)
q16angvel += fix16_sdiv(q16angvel, fix16_from_int(4)); q16angvel += fix16_sdiv(q16angvel, fix16_from_int(4));
*pq16ang += fix16_sdiv(fix16_mul(q16angvel, fix16_from_int(synctics)), fix16_from_int(32)); *pq16ang += fix16_sdiv(fix16_mul(q16angvel, fix16_from_int(synctics)), fix16_from_int(32));
*pq16ang = NORM_Q16ANGLE(*pq16ang); *pq16ang = PedanticQ16AngleFloor(NORM_Q16ANGLE(*pq16ang));
if (PedanticMode)
*pq16ang = fix16_floor(*pq16ang);
// 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