From 94b2b0af319699c8e02cbf901bfd5ff2918c4157 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 7 Nov 2021 20:14:44 +0100 Subject: [PATCH] - widen sector index in engineLoadBoard to 32 bit --- source/build/include/build.h | 2 +- source/core/maploader.cpp | 7 ++++--- source/games/duke/src/premap.cpp | 2 +- source/games/exhumed/src/engine.h | 2 +- source/games/exhumed/src/init.cpp | 3 ++- source/games/exhumed/src/osdcmds.cpp | 6 ------ source/games/sw/src/game.cpp | 4 +--- 7 files changed, 10 insertions(+), 16 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 587324f9c..561a9bf94 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -377,7 +377,7 @@ int32_t engineInit(void); void engineUnInit(void); void initspritelists(void); -void engineLoadBoard(const char *filename, int flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); +void engineLoadBoard(const char *filename, int flags, vec3_t *dapos, int16_t *daang, int *dacursectnum); void loadMapBackup(const char* filename); void G_LoadMapHack(const char* filename, const unsigned char*); diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 4cd284321..14b954761 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -331,7 +331,7 @@ static void ReadSpriteV5(FileReader& fr, spritetype& spr) } -static void insertAllSprites(const char* filename, const vec3_t* pos, int16_t* cursectnum, int16_t numsprites) +static void insertAllSprites(const char* filename, const vec3_t* pos, int* cursectnum, int16_t numsprites) { // This function is stupid because it exploits side effects of insertsprite and should be redone by only inserting the valid sprites. int i, realnumsprites = numsprites; @@ -372,7 +372,7 @@ static void insertAllSprites(const char* filename, const vec3_t* pos, int16_t* c void addBlockingPairs(); -void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang, int16_t* cursectnum) +void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang, int* cursectnum) { inputState.ClearAllInput(); memset(sector, 0, sizeof(*sector) * MAXSECTORS); @@ -468,6 +468,7 @@ void loadMapBackup(const char* filename) { vec3_t pos; int16_t scratch; + int scratch2; if (isBlood()) { @@ -475,7 +476,7 @@ void loadMapBackup(const char* filename) } else { - engineLoadBoard(filename, 0, &pos, &scratch, &scratch); + engineLoadBoard(filename, 0, &pos, &scratch, &scratch2); initspritelists(); } } diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 573e02d59..7c111c268 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -947,7 +947,7 @@ static int LoadTheMap(MapRecord *mi, struct player_struct *p, int gamemode) } currentLevel = mi; - int16_t sect; // engine still needs 16 bit here. + int sect; engineLoadBoard(mi->fileName, isShareware(), &p->pos, &lbang, §);// &p->cursectnum); p->cursectnum = sect; diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index 3f15e5930..0e0c8f3a6 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -60,7 +60,7 @@ extern int initx; extern int inity; extern int initz; extern short inita; -extern short initsect; +extern int initsect; extern short nCurChunkNum; extern DExhumedActor* nBodyGunSprite[50]; diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 3e58dcf0a..c05e52665 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -41,7 +41,8 @@ enum }; int initx, inity, initz; -short inita, initsect; +short inita; +int initsect; short nCurChunkNum = 0; diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 60c721e95..9d66bfadc 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -69,12 +69,6 @@ static int osdcmd_doors(CCmdFuncPtr parm) return CCMD_OK; } -extern int initx; -extern int inity; -extern int initz; -extern short inita; -extern short initsect; - static int osdcmd_spawn(CCmdFuncPtr parm) { if (parm->numparms != 1) return CCMD_SHOWHELP; diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index 59b5c05af..e2de44aca 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -322,9 +322,7 @@ void InitLevel(MapRecord *maprec) int16_t ang; currentLevel = maprec; - short sect16 = -1; - engineLoadBoard(maprec->fileName, SW_SHAREWARE ? 1 : 0, &Player[0].pos, &ang, §16); - Player[0].cursectnum = sect16; + engineLoadBoard(maprec->fileName, SW_SHAREWARE ? 1 : 0, &Player[0].pos, &ang, &Player[0].cursectnum); SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); STAT_NewLevel(currentLevel->fileName);