From 1fae3404262c8d777798ec53f125169513a2cbb0 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 18 Apr 2019 17:24:43 +0000 Subject: [PATCH] Fix a bunch of improperly defined bitmap arrays git-svn-id: https://svn.eduke32.com/eduke32@7594 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/build.cpp --- source/build/include/editor.h | 6 +++--- source/build/src/clip.cpp | 6 +++--- source/build/src/engine.cpp | 14 +++++++------- source/build/src/engine_priv.h | 2 +- source/duke3d/src/astub.cpp | 6 +++--- source/duke3d/src/m32common.cpp | 2 +- source/duke3d/src/m32exec.cpp | 2 +- source/duke3d/src/savegame.cpp | 2 +- source/duke3d/src/sounds_mapster32.cpp | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/source/build/include/editor.h b/source/build/include/editor.h index ff3df159d..0f51f2f31 100644 --- a/source/build/include/editor.h +++ b/source/build/include/editor.h @@ -119,8 +119,8 @@ extern int32_t showheightindicators; extern int32_t showambiencesounds; extern int32_t numgraysects; -extern uint8_t graysectbitmap[MAXSECTORS>>3]; -extern uint8_t graywallbitmap[MAXWALLS>>3]; +extern uint8_t graysectbitmap[(MAXSECTORS+7)>>3]; +extern uint8_t graywallbitmap[(MAXWALLS+7)>>3]; extern int32_t autogray, showinnergray; extern void drawgradient(void); @@ -355,7 +355,7 @@ void inflineintersect(int32_t x1, int32_t y1, int32_t x2, int32_t y2, void ovhscrcoords(int32_t x, int32_t y, int32_t *scrx, int32_t *scry); -extern uint8_t hlsectorbitmap[MAXSECTORS>>3]; +extern uint8_t hlsectorbitmap[(MAXSECTORS+7)>>3]; void test_map(int32_t mode); diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 28588c2e6..866107a9c 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -17,8 +17,8 @@ static linetype clipit[MAXCLIPNUM]; static int32_t clipsectnum, origclipsectnum, clipspritenum; int16_t clipsectorlist[MAXCLIPSECTORS]; static int16_t origclipsectorlist[MAXCLIPSECTORS]; -static uint8_t clipsectormap[MAXCLIPSECTORS >> 3]; -static uint8_t origclipsectormap[MAXCLIPSECTORS >> 3]; +static uint8_t clipsectormap[(MAXSECTORS+7)>>3]; +static uint8_t origclipsectormap[(MAXSECTORS+7)>>3]; #ifdef HAVE_CLIPSHAPE_FEATURE static int16_t clipspritelist[MAXCLIPNUM]; // sector-like sprite clipping #endif @@ -914,7 +914,7 @@ static void clipupdatesector(vec2_t const &p, int16_t * const sectnum, int const return; static int16_t sectlist[MAXSECTORS]; - static uint8_t sectbitmap[MAXSECTORS >> 3]; + static uint8_t sectbitmap[(MAXSECTORS+7)>>3]; int32_t nsecs; bfirst_search_init(sectlist, sectbitmap, &nsecs, numsectors, *sectnum); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index e3eeeeb6e..25e7e955a 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -220,8 +220,8 @@ static void getclosestpointonwall_internal(vec2_t const &p, int32_t const dawall ////////// YAX ////////// int32_t numgraysects = 0; -uint8_t graysectbitmap[MAXSECTORS>>3]; -uint8_t graywallbitmap[MAXWALLS>>3]; +uint8_t graysectbitmap[(MAXSECTORS+7)>>3]; +uint8_t graywallbitmap[(MAXWALLS+7)>>3]; int32_t autogray = 0, showinnergray = 1; //#define YAX_DEBUG_YMOSTS @@ -323,7 +323,7 @@ static uint16_t yax_tsprite[1 + 2*YAX_MAXDRAWS][MAXSPRITESONSCREEN]; static uint8_t yax_tsprfrombunch[1 + 2*YAX_MAXDRAWS][MAXSPRITESONSCREEN]; // drawn sectors -uint8_t yax_gotsector[MAXSECTORS>>3]; // engine internal +uint8_t yax_gotsector[(MAXSECTORS+7)>>3]; // engine internal # if !defined NEW_MAP_FORMAT // Game-time YAX data structures, V7-V9 map formats. @@ -860,7 +860,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), int32_t bbeg, numhere; // original (1st-draw) and accumulated ('per-level') gotsector bitmaps - static uint8_t ogotsector[MAXSECTORS>>3], lgotsector[MAXSECTORS>>3]; + static uint8_t ogotsector[(MAXSECTORS+7)>>3], lgotsector[(MAXSECTORS+7)>>3]; #ifdef YAX_DEBUG uint64_t t; #endif @@ -10412,7 +10412,7 @@ int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, in int32_t dacnt, danum; const int32_t x21 = x2-x1, y21 = y2-y1, z21 = z2-z1; - static uint8_t sectbitmap[MAXSECTORS>>3]; + static uint8_t sectbitmap[(MAXSECTORS+7)>>3]; #ifdef YAX_ENABLE int16_t pendingsectnum; vec3_t pendingvec; @@ -11032,7 +11032,7 @@ void updatesector(int32_t const x, int32_t const y, int16_t * const sectnum) } static int16_t sectlist[MAXSECTORS]; - static uint8_t sectbitmap[MAXSECTORS>>3]; + static uint8_t sectbitmap[(MAXSECTORS+7)>>3]; int32_t nsecs; bfirst_search_init(sectlist, sectbitmap, &nsecs, numsectors, *sectnum); @@ -11134,7 +11134,7 @@ void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t * return; static int16_t sectlist[MAXSECTORS]; - static uint8_t sectbitmap[MAXSECTORS>>3]; + static uint8_t sectbitmap[(MAXSECTORS+7)>>3]; int32_t nsecs; bfirst_search_init(sectlist, sectbitmap, &nsecs, numsectors, *sectnum); diff --git a/source/build/src/engine_priv.h b/source/build/src/engine_priv.h index 49fcee374..3eebaa97d 100644 --- a/source/build/src/engine_priv.h +++ b/source/build/src/engine_priv.h @@ -307,7 +307,7 @@ extern int32_t g_nodraw, scansector_retfast, scansector_collectsprites; extern int32_t yax_globallev, yax_globalbunch; extern int32_t yax_globalcf, yax_nomaskpass, yax_nomaskdidit; extern uint8_t haveymost[YAX_MAXBUNCHES>>3]; -extern uint8_t yax_gotsector[MAXSECTORS>>3]; +extern uint8_t yax_gotsector[(MAXSECTORS+7)>>3]; extern int32_t yax_polymostclearzbuffer; static FORCE_INLINE int32_t yax_isislandwall(int32_t line, int32_t cf) { return (yax_vnextsec(line, cf) >= 0); } diff --git a/source/duke3d/src/astub.cpp b/source/duke3d/src/astub.cpp index 59275cb82..d901d248d 100644 --- a/source/duke3d/src/astub.cpp +++ b/source/duke3d/src/astub.cpp @@ -191,7 +191,7 @@ static char spriteshades[MAXSPRITES]; static char wallpals[MAXWALLS]; static char sectorpals[MAXSECTORS][2]; static char spritepals[MAXSPRITES]; -static uint8_t wallflag[MAXWALLS>>3]; +static uint8_t wallflag[(MAXWALLS+7)>>3]; #ifdef YAX_ENABLE static uint8_t havebunch[YAX_MAXBUNCHES]; @@ -2007,7 +2007,7 @@ static void SoundDisplay(void) int32_t AmbienceToggle = 1; int32_t ParentalLock = 0; -uint8_t g_ambiencePlaying[MAXSPRITES>>3]; +uint8_t g_ambiencePlaying[(MAXSPRITES+7)>>3]; #define testbit(bitarray, i) (bitarray[(i)>>3] & (1<<((i)&7))) #define setbit(bitarray, i) bitarray[(i)>>3] |= (1<<((i)&7)) @@ -6717,7 +6717,7 @@ static void Keys3d(void) static const char *addnstr[4] = {"", "+stat+panning", "+stat", "+stat + panning (some)"}; static int16_t sectlist[MAXSECTORS]; - static uint8_t sectbitmap[MAXSECTORS>>3]; + static uint8_t sectbitmap[(MAXSECTORS+7)>>3]; int32_t sectcnt, sectnum; i = searchsector; diff --git a/source/duke3d/src/m32common.cpp b/source/duke3d/src/m32common.cpp index e9aaed801..2cd9a0a58 100644 --- a/source/duke3d/src/m32common.cpp +++ b/source/duke3d/src/m32common.cpp @@ -742,7 +742,7 @@ static int32_t csc_s, csc_i; static int32_t check_spritelist_consistency() { int32_t ournumsprites=0; - static uint8_t havesprite[MAXSPRITES>>3]; + static uint8_t havesprite[(MAXSPRITES+7)>>3]; csc_s = csc_i = -1; diff --git a/source/duke3d/src/m32exec.cpp b/source/duke3d/src/m32exec.cpp index da8757b55..8c1691227 100644 --- a/source/duke3d/src/m32exec.cpp +++ b/source/duke3d/src/m32exec.cpp @@ -1242,7 +1242,7 @@ skip_check: int32_t *const sectlist32 = (int32_t *)sectlist; int32_t j, startwall, endwall, ns; - static uint8_t sectbitmap[MAXSECTORS>>3]; + static uint8_t sectbitmap[(MAXSECTORS+7)>>3]; X_ERROR_INVALIDSECT(startsectnum); if (arsize < numsectors) diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index 7e832c015..358de087c 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -1258,7 +1258,7 @@ static const dataspec_t svgm_anmisc[] = { 0, &g_spriteDeleteQueuePos, sizeof(g_spriteDeleteQueuePos), 1 }, { DS_NOCHK, &g_deleteQueueSize, sizeof(g_deleteQueueSize), 1 }, { DS_CNT(g_deleteQueueSize), &SpriteDeletionQueue[0], sizeof(int16_t), (intptr_t)&g_deleteQueueSize }, - { 0, &show2dsector[0], sizeof(uint8_t), MAXSECTORS>>3 }, + { 0, &show2dsector[0], sizeof(uint8_t), (MAXSECTORS+7)>>3 }, { DS_NOCHK, &g_cloudCnt, sizeof(g_cloudCnt), 1 }, { 0, &g_cloudSect[0], sizeof(g_cloudSect), 1 }, { 0, &g_cloudX, sizeof(g_cloudX), 1 }, diff --git a/source/duke3d/src/sounds_mapster32.cpp b/source/duke3d/src/sounds_mapster32.cpp index 983a5d58b..81a59cf4a 100644 --- a/source/duke3d/src/sounds_mapster32.cpp +++ b/source/duke3d/src/sounds_mapster32.cpp @@ -459,7 +459,7 @@ void S_Callback(uint32_t num) if (sprite[i].picnum == MUSICANDSFX && sector[sprite[i].sectnum].lotag < 3 && sprite[i].lotag < 999) { - extern uint8_t g_ambiencePlaying[MAXSPRITES>>3]; + extern uint8_t g_ambiencePlaying[(MAXSPRITES+7)>>3]; g_ambiencePlaying[i>>3] &= ~(1<<(i&7));