diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index de4c39f03..bc1d958f2 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -56,8 +56,6 @@ enum { kSectLava = 0x4000, }; -extern sectortype* initsectp; - extern int nCurChunkNum; // all static counters combined in an array for easier maintenance. diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index 09b92fbda..797d6de69 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -942,7 +942,7 @@ void DrawWeapons(double interpfrac) int var_28 = var_30 + WeaponInfo[nWeapon].b[var_34]; - int8_t nShade = initsectp->ceilingshade; + int8_t nShade = PlayerList[nLocalPlayer].pActor->sector()->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 5a7b667b8..3e51e0a72 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -39,8 +39,6 @@ enum kTagRamses = 61, }; -sectortype* initsectp; - int nCurChunkNum = 0; int Counters[kNumCounters]; @@ -146,7 +144,6 @@ uint8_t LoadLevel(MapRecord* map) DVector3 initpos; int16_t mapang; loadMap(currentLevel->fileName, 0, &initpos, &mapang, &initsect, spawned); - initsectp = initsect; auto actors = spawnactors(spawned); int i; @@ -165,7 +162,7 @@ uint8_t LoadLevel(MapRecord* map) for (int i = 0; i < nTotalPlayers; i++) { - SetSavePoint(i, initpos, initsectp, DAngle::fromBuild(mapang)); + SetSavePoint(i, initpos, initsect, DAngle::fromBuild(mapang)); RestartPlayer(i); InitPlayerKeys(i); } @@ -767,7 +764,7 @@ void ExamineSprites(TArray& actors) if (nNetPlayerCount) { - auto pActor = insertActor(initsectp, 0); + auto pActor = insertActor(PlayerList[nLocalPlayer].pActor->sector(), 0); pActor->spr.pos = PlayerList[nLocalPlayer].pActor->spr.pos; pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE; @@ -849,8 +846,7 @@ void SerializeInit(FSerializer& arc) { if (arc.BeginObject("init")) { - arc("initsect", initsectp) - ("curchunk", nCurChunkNum) + arc("curchunk", nCurChunkNum) .Array("counters", Counters, kNumCounters) .EndObject(); } diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index a0d67d17f..c2557cf70 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -45,6 +45,7 @@ void GrabMap() void UpdateMap() { + const auto initsectp = PlayerList[nLocalPlayer].pActor->sector(); if (initsectp->ceilingpal != 3 || (PlayerList[nLocalPlayer].nTorch != 0)) { MarkSectorSeen(initsectp); } diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index e00350e21..901b34744 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -936,15 +936,6 @@ void MoveSector(sectortype* pSector, DAngle nAngle, DVector2& nVel) } nVel = vect; - - /* - Update player position variables, in case the player sprite was moved by a sector, - Otherwise these can be out of sync when used in sound code (before being updated in PlayerFunc()). - Can cause local player sounds to play off-centre. - TODO: Might need to be done elsewhere too? - */ - auto pActor = PlayerList[nLocalPlayer].pActor; - initsectp = pActor->sector(); } //--------------------------------------------------------------------------- diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 394498d6a..162e020ef 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -78,7 +78,7 @@ static int osdcmd_spawn(CCmdFuncPtr parm) if (!pActor) return CCMD_SHOWHELP; auto c = parm->parms[0]; auto& initpos = pActor->spr.pos; - auto sectp = initsectp; + auto sectp = pActor->sector(); auto inita = pActor->spr.Angles.Yaw; if (!stricmp(c, "anubis")) BuildAnubis(nullptr, initpos, sectp, inita, false); else if (!stricmp(c, "spider")) BuildSpider(nullptr, initpos, sectp, inita); diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 663245264..da0e68a0a 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -2583,12 +2583,6 @@ sectdone: } } - // loc_1C3B4: - if (nPlayer == nLocalPlayer) - { - initsectp = pPlayerActor->sector(); - } - if (!PlayerList[nPlayer].nHealth) { PlayerList[nPlayer].nThrust.Zero();