From 3f236b7630c38bb2ced6a8b8b1760b33be30339c Mon Sep 17 00:00:00 2001 From: Ilya Shurumov Date: Wed, 9 Dec 2020 15:50:50 +0600 Subject: [PATCH] - misc math stuff --- src_rebuild/GAME/DR2MATH.H | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src_rebuild/GAME/DR2MATH.H b/src_rebuild/GAME/DR2MATH.H index 29a7b50b..67f542e1 100644 --- a/src_rebuild/GAME/DR2MATH.H +++ b/src_rebuild/GAME/DR2MATH.H @@ -4,6 +4,7 @@ #include "ABS.H" // Driver 2 math definitions +extern short rcossin_tbl[8192]; #define ONE 4096 #define ONE_BITS 12 @@ -12,22 +13,14 @@ #define PH_ONE_BITS 8 // math constants -#if 0 - -// DO NOT USE IT unless you don't care about replays and chases -#define FIXED(a) (int(a) / ONE) -#define HFIXED(a) (int(a) / (ONE*2)) -#define PH_FIXED(a) (int(a) / (PH_ONE)) - -#else - #define FixHalfRound(x, bits) (((x) + (1 << (bits-1))) >> bits) #define FixFloorSigned(x, bits) ((x) / (1 << bits)) // in disassembly: ((int(x) < 0 ? int(x) + (1 << bits)-1 : int(x)) >> bits) #define FIXEDH(a) FixHalfRound(a, ONE_BITS) // Fixed Half Round number #define FIXED(a) ((a) >> ONE_BITS) // Fixed number (unsigned) -#endif +#define RSIN(a) rcossin_tbl[(a & 0xFFFU) * 2] +#define RCOS(a) rcossin_tbl[(a & 0xFFFU) * 2 + 1] #define SetVec(_v, _x, _y, _z) \ { \