From 3130b51a9624ac6cb7468f28c788747a30c427be Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 25 Jun 2019 11:30:03 +0000 Subject: [PATCH] Add SLOPTABLESIZ preprocessor definition git-svn-id: https://svn.eduke32.com/eduke32@7718 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/a.h | 5 +++++ source/build/src/a-c.cpp | 4 +--- source/build/src/engine.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source/build/include/a.h b/source/build/include/a.h index 7c498fa91..7633db6a7 100644 --- a/source/build/include/a.h +++ b/source/build/include/a.h @@ -16,6 +16,11 @@ # define CLASSIC_NONPOW2_YSIZE_WALLS #endif +#define SLOPTABLESIZ 32768 +#define HALFSLOPTABLESIZ (SLOPTABLESIZ>>1) + +extern int32_t sloptable[SLOPTABLESIZ]; + /** Definitions of high-precision integer types. **/ // Should be used for values that represent coordinates with which calculations // like dot product are carried out. Substituting 32-bit ints for these will diff --git a/source/build/src/a-c.cpp b/source/build/src/a-c.cpp index f7cbad509..7d6bc0018 100644 --- a/source/build/src/a-c.cpp +++ b/source/build/src/a-c.cpp @@ -107,8 +107,6 @@ void hlineasm4(bssize_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by, ///// Sloped ceiling/floor vertical line functions ///// -extern int32_t sloptable[32768]; - void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, bssize_t cnt, int32_t bx, int32_t by) { intptr_t * A_C_RESTRICT slopalptr; @@ -119,7 +117,7 @@ void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, bssize_t cnt, int32_t slopalptr = (intptr_t *)slopaloffs; for (; cnt>0; cnt--) { - i = (sloptable[(bz>>6)+16384]); bz += bzinc; + i = (sloptable[(bz>>6)+HALFSLOPTABLESIZ]); 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/source/build/src/engine.cpp b/source/build/src/engine.cpp index cdc3f5a2e..31d7f0870 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -164,7 +164,7 @@ int32_t globalx1, globaly2, globalx3, globaly3; } #endif -int32_t sloptable[32768]; +int32_t sloptable[SLOPTABLESIZ]; static intptr_t slopalookup[16384]; // was 2048 static int32_t no_radarang2 = 0; @@ -3393,7 +3393,7 @@ static void tslopevlin(uint8_t *p, const intptr_t *slopalptr, bssize_t cnt, int3 do { - int const i = (sloptable[(bz>>6)+16384]); bz += bzinc; + int const i = (sloptable[(bz>>6)+HALFSLOPTABLESIZ]); bz += bzinc; uint32_t u = bx + xtou*i; uint32_t v = by + ytov*i; uint8_t ch = buf[((u>>(32-logx))<>(32-logy))]; @@ -3423,7 +3423,7 @@ static void mslopevlin(uint8_t *p, const intptr_t *slopalptr, bssize_t cnt, int3 do { - int const i = (sloptable[(bz>>6)+16384]); bz += bzinc; + int const i = (sloptable[(bz>>6)+HALFSLOPTABLESIZ]); bz += bzinc; uint32_t u = bx + xtou*i; uint32_t v = by + ytov*i; uint8_t ch = buf[((u>>(32-logx))<>(32-logy))]; @@ -7229,8 +7229,8 @@ static int32_t engineLoadTables(void) for (i=0; i<2048; i++) reciptable[i] = divscale30(2048, i+2048); - for (i=0; i<32768; i++) - sloptable[i] = krecipasm(i-16384); + for (i=0; i