From d572e56839c6e63fcb706cae5f98cb0116061c5a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 21 May 2021 12:53:31 +0200 Subject: [PATCH] - removed the indirection for the global arrays. No idea what part of EDuke32 needed this, but it is not necessary. --- source/build/include/build.h | 11 +++++------ source/build/src/engine.cpp | 28 +++++++--------------------- source/core/gamecontrol.cpp | 1 - source/games/duke/src/types.h | 4 +--- 4 files changed, 13 insertions(+), 31 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 957499acc..6ea31e0a8 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -145,12 +145,12 @@ struct usermaphack_t uint8_t md4[16]{}; }; -EXTERN spriteext_t *spriteext; -EXTERN spritesmooth_t *spritesmooth; +extern spriteext_t spriteext[MAXSPRITES]; +extern spritesmooth_t spritesmooth[MAXSPRITES]; -EXTERN sectortype *sector; -EXTERN walltype *wall; -EXTERN spritetype *sprite; +extern sectortype sector[MAXSECTORS]; +extern walltype wall[MAXWALLS]; +extern spritetype sprite[MAXSPRITES]; EXTERN int leveltimer; extern sectortype sectorbackup[MAXSECTORS]; @@ -337,7 +337,6 @@ typedef struct artheader_t { } artheader_t; #define ARTv1_UNITOFFSET 24 // using sizeof does not work because picanm_t is not the in-file format. -int32_t enginePreInit(void); // a partial setup of the engine used for launch windows int32_t engineInit(void); void engineUnInit(void); void initspritelists(void); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 8e0f7896d..849602636 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -41,6 +41,13 @@ #include "gl_renderer.h" #endif +spriteext_t spriteext[MAXSPRITES]; +spritesmooth_t spritesmooth[MAXSPRITES]; + +sectortype sector[MAXSECTORS]; +walltype wall[MAXWALLS]; +spritetype sprite[MAXSPRITES]; + int32_t r_rortexture = 0; int32_t r_rortexturerange = 0; int32_t r_rorphase = 0; @@ -625,27 +632,6 @@ const int16_t* getpsky(int32_t picnum, int32_t* dapyscale, int32_t* dapskybits, } - -// -// preinitengine -// -static spriteext_t spriteext_s[MAXSPRITES+MAXUNIQHUDID]; -static spritesmooth_t spritesmooth_s[MAXSPRITES+MAXUNIQHUDID]; -static sectortype sector_s[MAXSECTORS]; -static walltype wall_s[MAXWALLS]; -spritetype sprite_s[MAXSPRITES]; - -int32_t enginePreInit(void) -{ - sector = sector_s; - wall = wall_s; - sprite = sprite_s; - spriteext = spriteext_s; - spritesmooth = spritesmooth_s; - return 0; -} - - // // initengine // diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index fb628085d..6836f548a 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -986,7 +986,6 @@ int RunGame() if (Args->CheckParm("-sounddebug")) C_DoCommand("stat sounddebug"); - enginePreInit(); SetupGameButtons(); gameinfo.mBackButton = "engine/graphics/m_back.png"; StartScreen->Progress(); diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 3b352ab2b..14d081e6b 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -4,8 +4,6 @@ #include "d_net.h" #include "gameinput.h" -extern spritetype sprite_s[]; - BEGIN_DUKE_NS @@ -41,7 +39,7 @@ struct weaponhit static weaponhit* array(); // this is necessary to allow define inline functions referencing the global array inside the definition itself. - weaponhit() : s(&sprite_s[this - array()]) {} // little trick to initialize the reference automatically. ;) + weaponhit() : s(&sprite[this - array()]) {} // little trick to initialize the reference automatically. ;) weaponhit(const weaponhit& other) = delete; // we also do not want to allow copies. weaponhit& operator=(const weaponhit& other) = delete; void clear()