diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index f2b5e00ad..de30286f7 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -57,7 +57,7 @@ extern int initx; extern int inity; extern int initz; extern int16_t inita; -extern int initsect; +extern sectortype* initsectp; extern int nCurChunkNum; extern DExhumedActor* nBodyGunSprite[50]; diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index a27171c82..fdf971111 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -913,7 +913,7 @@ void DrawWeapons(double smooth) int var_28 = var_30 + WeaponInfo[nWeapon].b[var_34]; - int8_t nShade = sector[initsect].ceilingshade; + int8_t nShade = initsectp->ceilingshade; int nDouble = PlayerList[nLocalPlayer].nDouble; int nPal = kPalNormal; diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index f18aaedd3..cd7609c70 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -41,7 +41,7 @@ enum int initx, inity, initz; int16_t inita; -int initsect; +sectortype* initsectp; int nCurChunkNum = 0; @@ -117,10 +117,12 @@ uint8_t LoadLevel(MapRecord* map) } vec3_t startPos; + int initsect; engineLoadBoard(currentLevel->fileName, 0, &startPos, &inita, &initsect); initx = startPos.x; inity = startPos.y; initz = startPos.z; + initsectp = §or[initsect]; int i; @@ -159,7 +161,7 @@ void InitLevel(MapRecord* map) for (int i = 0; i < nTotalPlayers; i++) { - SetSavePoint(i, initx, inity, initz, §or[initsect], inita); + SetSavePoint(i, initx, inity, initz, initsectp, inita); RestartPlayer(i); InitPlayerKeys(i); } @@ -735,7 +737,7 @@ void ExamineSprites() if (nNetPlayerCount) { - auto pActor = insertActor(initsect, 0); + auto pActor = insertActor(initsectp, 0); auto pSprite = &pActor->s(); pSprite->x = initx; @@ -816,7 +818,7 @@ void SerializeInit(FSerializer& arc) ("inity", inity) ("initz", initz) ("inita", inita) - ("initsect", initsect) + ("initsect", initsectp) ("curchunk", nCurChunkNum) .Array("bodygunsprite", nBodyGunSprite, countof(nBodyGunSprite)) ("curbodygun", nCurBodyGunNum) diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index 7dd2f9b5b..7aa3ddc97 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -40,8 +40,8 @@ void GrabMap() void UpdateMap() { - if (sector[initsect].ceilingpal != 3 || (PlayerList[nLocalPlayer].nTorch != 0)) { - MarkSectorSeen(initsect); + if (initsectp->ceilingpal != 3 || (PlayerList[nLocalPlayer].nTorch != 0)) { + MarkSectorSeen(sectnum(initsectp)); } } diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 744878b3e..321d0450b 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -1090,7 +1090,7 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel) inity = pSprite->y; initz = pSprite->z; inita = pSprite->ang; - initsect = pSprite->sectnum; + initsectp = pSprite->sector(); } void SetQuake(DExhumedActor* pActor, int nVal) diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 7e422755a..4563ed5ef 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -72,7 +72,7 @@ static int osdcmd_spawn(CCmdFuncPtr parm) { if (parm->numparms != 1) return CCMD_SHOWHELP; auto c = parm->parms[0]; - auto sectp = §or[initsect]; + auto sectp = initsectp; if (!stricmp(c, "anubis")) BuildAnubis(nullptr, initx, inity, sectp->floorz, sectp, inita, false); else if (!stricmp(c, "spider")) BuildSpider(nullptr, initx, inity, sectp->floorz, sectp, inita); else if (!stricmp(c, "mummy")) BuildMummy(nullptr, initx, inity, sectp->floorz, sectp, inita); diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 077e96777..c93ec8707 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -2553,7 +2553,7 @@ sectdone: initx = pPlayerSprite->x; inity = pPlayerSprite->y; initz = pPlayerSprite->z; - initsect = pPlayerSprite->sectnum; + initsectp = pPlayerSprite->sector(); inita = pPlayerSprite->ang; }