From e6779231651b08c7d2b81fb69ec8ac5a50b5a500 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 2 Nov 2014 05:35:06 +0000 Subject: [PATCH] LUT for slope recip calculations in classic. DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@4714 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/a-c.c | 3 ++- polymer/eduke32/build/src/engine.c | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/build/src/a-c.c b/polymer/eduke32/build/src/a-c.c index 2529d066d..5bac2017f 100644 --- a/polymer/eduke32/build/src/a-c.c +++ b/polymer/eduke32/build/src/a-c.c @@ -96,6 +96,7 @@ void hlineasm4(int32_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by, ///// Sloped ceiling/floor vertical line functions ///// +extern int32_t sloptable[16384]; void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, int32_t cnt, int32_t bx, int32_t by) { @@ -107,7 +108,7 @@ void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, int32_t cnt, int32_t slopalptr = (intptr_t *)slopaloffs; for (; cnt>0; cnt--) { - i = krecipasm(bz>>6); bz += bzinc; + i = (sloptable[(bz>>6)+8192]); bz += bzinc; u = bx+(inthi_t)globalx3*i; v = by+(inthi_t)globaly3*i; (*(char *)p) = *(char *)(((intptr_t)slopalptr[0])+gbuf[((u>>(32-glogx))<>(32-glogy))]); diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 9eff744ec..fc4352bc3 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -187,6 +187,7 @@ int32_t globalx1, globaly2, globalx3, globaly3; }; #endif +int32_t sloptable[16384]; static intptr_t slopalookup[16384]; // was 2048 #if defined(USE_OPENGL) palette_t palookupfog[MAXPALOOKUPS]; @@ -4239,7 +4240,7 @@ static void tslopevlin(uint8_t *p, int32_t i, const intptr_t *slopalptr, int32_t uint8_t ch; uint32_t u, v; - i = krecipasm(bz>>6); bz += bzinc; + i = (sloptable[(bz>>6)+8192]); bz += bzinc; u = bx + xtou*i; v = by + ytov*i; ch = *(uint8_t *)(slopalptr[0] + buf[((u>>(32-logx))<>(32-logy))]); @@ -8009,6 +8010,9 @@ static int32_t loadtables(void) for (i=0; i<2048; i++) reciptable[i] = divscale30(2048, i+2048); + for (i=0; i<16384; i++) + sloptable[i] = krecipasm(i-8192); + for (i=0; i<=512; i++) sintable[i] = (int16_t)(16384.f * sinf((float)i * BANG2RAD)); for (i=513; i<1024; i++)