From f0be96c3852fa77da307a37786fece0ffce1019f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 15 Nov 2020 20:45:58 +1100 Subject: [PATCH] - buildutils: Replace `sintable[]` use within SW's game.h with `bsin()`/`bcos()`. --- source/sw/src/game.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index e0a150b9b..76794b26c 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -267,8 +267,8 @@ int StdRandomRange(int range); #define RANDOM_NEG(x,y) ((RANDOM_P2(((x)<<(y))<<1) - (x))<<(y)) -#define MOVEx(vel,ang) (((int)(vel) * (int)sintable[NORM_ANGLE((ang) + 512)]) >> 14) -#define MOVEy(vel,ang) (((int)(vel) * (int)sintable[NORM_ANGLE((ang))]) >> 14) +#define MOVEx(vel,ang) (mulscale14(vel, bcos(ang))) +#define MOVEy(vel,ang) (mulscale14(vel, bsin(ang))) #define DIST(x1, y1, x2, y2) ksqrt( SQ((x1) - (x2)) + SQ((y1) - (y2)) ) @@ -353,7 +353,7 @@ int StdRandomRange(int range); #define SQ(val) ((val) * (val)) -#define KENFACING_PLAYER(pp,sp) (sintable[NORM_ANGLE(sp->ang+512)]*(pp->posy-sp->y) >= sintable[NORM_ANGLE(sp-ang)]*(pp->posx-sp->x)) +#define KENFACING_PLAYER(pp,sp) (bcos(sp->ang)*(pp->posy-sp->y) >= bsin(sp-ang)*(pp->posx-sp->x)) #define FACING_PLAYER(pp,sp) (abs(getincangle(getangle((pp)->posx - (sp)->x, (pp)->posy - (sp)->y), (sp)->ang)) < 512) #define PLAYER_FACING(pp,sp) (abs(getincangle(getangle((sp)->x - (pp)->posx, (sp)->y - (pp)->posy), (pp)->angle.ang.asbuild())) < 320) #define FACING(sp1,sp2) (abs(getincangle(getangle((sp1)->x - (sp2)->x, (sp1)->y - (sp2)->y), (sp2)->ang)) < 512)