- Exhumed: Eliminate initpos global.

This commit is contained in:
Mitchell Richters 2023-03-18 12:49:44 +11:00
parent 5fe4b0fdb1
commit d30ce9691a
7 changed files with 8 additions and 13 deletions

View file

@ -56,7 +56,6 @@ enum {
kSectLava = 0x4000,
};
extern DVector3 initpos;
extern sectortype* initsectp;
extern int nCurChunkNum;

View file

@ -39,7 +39,6 @@ enum
kTagRamses = 61,
};
DVector3 initpos;
sectortype* initsectp;
int nCurChunkNum = 0;
@ -144,6 +143,7 @@ uint8_t LoadLevel(MapRecord* map)
sectortype* initsect;
SpawnSpriteDef spawned;
DVector3 initpos;
int16_t mapang;
loadMap(currentLevel->fileName, 0, &initpos, &mapang, &initsect, spawned);
initsectp = initsect;
@ -769,7 +769,7 @@ void ExamineSprites(TArray<DExhumedActor*>& actors)
{
auto pActor = insertActor(initsectp, 0);
pActor->spr.pos = initpos;
pActor->spr.pos = PlayerList[nLocalPlayer].pActor->spr.pos;
pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
nNetStartSprite[nNetStartSprites] = pActor;
nNetStartSprites++;
@ -837,8 +837,6 @@ void LoadObjects(TArray<DExhumedActor*>& actors)
runlist_ChangeChannel(nChannel, 0);
runlist_ReadyChannel(nChannel);
}
nCamerapos = initpos;
}
//---------------------------------------------------------------------------
@ -851,8 +849,7 @@ void SerializeInit(FSerializer& arc)
{
if (arc.BeginObject("init"))
{
arc("init", initpos)
("initsect", initsectp)
arc("initsect", initsectp)
("curchunk", nCurChunkNum)
.Array("counters", Counters, kNumCounters)
.EndObject();

View file

@ -944,7 +944,6 @@ void MoveSector(sectortype* pSector, DAngle nAngle, DVector2& nVel)
TODO: Might need to be done elsewhere too?
*/
auto pActor = PlayerList[nLocalPlayer].pActor;
initpos = pActor->spr.pos;
initsectp = pActor->sector();
}

View file

@ -77,6 +77,7 @@ static int osdcmd_spawn(CCmdFuncPtr parm)
if (parm->numparms != 1) return CCMD_SHOWHELP;
if (!pActor) return CCMD_SHOWHELP;
auto c = parm->parms[0];
auto& initpos = pActor->spr.pos;
auto sectp = initsectp;
auto inita = pActor->spr.Angles.Yaw;
if (!stricmp(c, "anubis")) BuildAnubis(nullptr, initpos, sectp, inita, false);

View file

@ -2586,7 +2586,6 @@ sectdone:
// loc_1C3B4:
if (nPlayer == nLocalPlayer)
{
initpos = pPlayerActor->spr.pos;
initsectp = pPlayerActor->sector();
}

View file

@ -676,7 +676,7 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
auto pSector =pTSprite->sectp;
double nFloorZ = pSector->floorz;
if (nFloorZ <= PlayerList[nLocalPlayer].pActor->viewzoffset + initpos.Z) {
if (nFloorZ <= PlayerList[nLocalPlayer].pActor->viewzoffset + PlayerList[nLocalPlayer].pActor->spr.pos.Z) {
pTSprite->ownerActor = nullptr;
}
else

View file

@ -433,9 +433,9 @@ void EXSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
Snake* pSnake = &SnakeList[nSnakeCam];
campos = pSnake->pSprites[0]->spr.pos;
}
else
else if (const auto pActor = PlayerList[nLocalPlayer].pActor)
{
campos = initpos;
campos = pActor->spr.pos;
}
auto fcampos = GetSoundPos(campos);
@ -512,7 +512,7 @@ void GameInterface::UpdateSounds()
}
else if (pActor)
{
pos = initpos;
pos = pActor->spr.pos;
ang = pActor->spr.Angles.Yaw;
}
SoundListener listener;