From c3573173efdba4f28df5ae82c0dd69749f35cc04 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Sat, 18 Jun 2011 13:57:20 +0000 Subject: [PATCH] fix sin/cos table macros git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3824 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/p_script.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engine/client/p_script.c b/engine/client/p_script.c index d66235ebc..266427789 100644 --- a/engine/client/p_script.c +++ b/engine/client/p_script.c @@ -68,16 +68,16 @@ static int pe_size2 = P_INVALID; static int pe_size3 = P_INVALID; static int pe_defaulttrail = P_INVALID; -static float psintable[64]; +static float psintable[256]; static void buildsintable(void) { int i; - for (i = 0; i < 64; i++) - psintable[i] = sin((i*M_PI)/32); + for (i = 0; i < 256; i++) + psintable[i] = sin((i*M_PI)/128); } -#define sin(x) (psintable[(int)(x*(64/M_PI)) & 63]) -#define cos(x) (psintable[((int)(x*(64/M_PI)) + 16) & 63]) +#define sin(x) (psintable[(int)((x)*(128/M_PI)) & 255]) +#define cos(x) (psintable[((int)((x)*(128/M_PI)) + 64) & 255]) typedef struct particle_s { @@ -3155,7 +3155,7 @@ static void P_ParticleTrailDraw (vec3_t startpos, vec3_t end, part_type_t *ptype float randvelvert = ptype->randomvelvert; float step; float stop; - float tdegree = 2*M_PI/256; /* MSVC whine */ + float tdegree = 2.0*M_PI/256; /* MSVC whine */ float sdegree = 0; float nrfirst, nrlast; @@ -3246,7 +3246,7 @@ static void P_ParticleTrailDraw (vec3_t startpos, vec3_t end, part_type_t *ptype // precalculate degree of rotation if (ptype->spawnparam1) - tdegree = 2*M_PI/ptype->spawnparam1; /* distance per rotation inversed */ + tdegree = 2.0*M_PI/ptype->spawnparam1; /* distance per rotation inversed */ sdegree = ptype->spawnparam2*(M_PI/180); } else if (ptype->spawnmode == SM_CIRCLE)