diff --git a/source/games/exhumed/src/bubbles.cpp b/source/games/exhumed/src/bubbles.cpp index 414bde9e5..f33e6345f 100644 --- a/source/games/exhumed/src/bubbles.cpp +++ b/source/games/exhumed/src/bubbles.cpp @@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "sequence.h" #include "mapinfo.h" #include +#include "player.h" BEGIN_PS_NS @@ -53,6 +54,7 @@ DExhumedActor* BuildBubble(const DVector3& pos, sectortype* pSector) } auto pActor = insertActor(pSector, 402); + auto pPlayerActor = PlayerList[nLocalPlayer].pActor; pActor->spr.pos = pos; pActor->spr.cstat = 0; @@ -63,7 +65,7 @@ DExhumedActor* BuildBubble(const DVector3& pos, sectortype* pSector) pActor->spr.xoffset = 0; pActor->spr.yoffset = 0; pActor->spr.picnum = 1; - pActor->spr.Angles.Yaw = inita; + pActor->spr.Angles.Yaw = pPlayerActor->spr.Angles.Yaw; pActor->vel.X = 0; pActor->vel.Y = 0; pActor->vel.Z = -1200 / 256.; diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index 764a1cab7..496c5bd62 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -57,7 +57,6 @@ enum { }; extern DVector3 initpos; -extern DAngle inita; extern sectortype* initsectp; extern int nCurChunkNum; diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index 0bb0d9963..35f5bb7c3 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -369,7 +369,6 @@ void GameInterface::Ticker() { // this must be done before the view is backed up. PlayerList[nLocalPlayer].Angles.resetCameraAngles(); - UpdatePlayerSpriteAngle(&PlayerList[nLocalPlayer]); // disable synchronised input if set by game. resetForcedSyncInput(); @@ -381,7 +380,7 @@ void GameInterface::Ticker() auto& lPlayerVel = PlayerList[nLocalPlayer].vel; - auto inputvect = DVector2(PlayerList[nLocalPlayer].input.fvel, PlayerList[nLocalPlayer].input.svel).Rotated(inita) * 0.375; + auto inputvect = DVector2(PlayerList[nLocalPlayer].input.fvel, PlayerList[nLocalPlayer].input.svel).Rotated(PlayerList[nLocalPlayer].pActor->spr.Angles.Yaw) * 0.375; for (int i = 0; i < 4; i++) { diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index cc6277a4b..de752aca7 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -40,7 +40,6 @@ enum }; DVector3 initpos; -DAngle inita; sectortype* initsectp; int nCurChunkNum = 0; @@ -147,7 +146,6 @@ uint8_t LoadLevel(MapRecord* map) SpawnSpriteDef spawned; int16_t mapang; loadMap(currentLevel->fileName, 0, &initpos, &mapang, &initsect, spawned); - inita = DAngle::fromBuild(mapang); initsectp = initsect; auto actors = spawnactors(spawned); @@ -164,6 +162,13 @@ uint8_t LoadLevel(MapRecord* map) precache(); LoadObjects(actors); + + for (int i = 0; i < nTotalPlayers; i++) + { + SetSavePoint(i, initpos, initsectp, DAngle::fromBuild(mapang)); + RestartPlayer(i); + InitPlayerKeys(i); + } return true; } @@ -180,13 +185,6 @@ void InitLevel(MapRecord* map) if (!LoadLevel(map)) { I_Error("Cannot load %s...\n", map->fileName.GetChars()); } - - for (int i = 0; i < nTotalPlayers; i++) - { - SetSavePoint(i, initpos, initsectp, inita); - RestartPlayer(i); - InitPlayerKeys(i); - } EndLevel = 0; ResetView(); ResetEngine(); @@ -854,7 +852,6 @@ void SerializeInit(FSerializer& arc) if (arc.BeginObject("init")) { arc("init", initpos) - ("inita", inita) ("initsect", initsectp) ("curchunk", nCurChunkNum) .Array("counters", Counters, kNumCounters) diff --git a/source/games/exhumed/src/input.cpp b/source/games/exhumed/src/input.cpp index 275be4165..e460ab936 100644 --- a/source/games/exhumed/src/input.cpp +++ b/source/games/exhumed/src/input.cpp @@ -85,8 +85,6 @@ void GameInterface::GetInput(const double scaleAdjust, InputPacket* packet) { pPlayer->bPlayerPan = pPlayer->bLockPan = true; } - - UpdatePlayerSpriteAngle(pPlayer); } if (packet) diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index b96095163..4b5114f25 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -945,7 +945,6 @@ void MoveSector(sectortype* pSector, DAngle nAngle, DVector2& nVel) */ auto pActor = PlayerList[nLocalPlayer].pActor; initpos = pActor->spr.pos; - inita = pActor->spr.Angles.Yaw; initsectp = pActor->sector(); } diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 3d795cf5c..dda1f0926 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -73,13 +73,16 @@ static int osdcmd_doors(CCmdFuncPtr parm) static int osdcmd_spawn(CCmdFuncPtr parm) { + auto pActor = PlayerList[nLocalPlayer].pActor; if (parm->numparms != 1) return CCMD_SHOWHELP; + if (!pActor) return CCMD_SHOWHELP; auto c = parm->parms[0]; auto sectp = initsectp; + 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); else if (!stricmp(c, "mummy")) BuildMummy(nullptr, initpos, sectp, inita); - else if (!stricmp(c, "fish")) BuildFish(nullptr, initpos.plusZ(PlayerList[nLocalPlayer].pActor->viewzoffset), sectp, inita); + else if (!stricmp(c, "fish")) BuildFish(nullptr, initpos.plusZ(pActor->viewzoffset), sectp, inita); else if (!stricmp(c, "lion")) BuildLion(nullptr, initpos, sectp, inita); else if (!stricmp(c, "lava")) BuildLava(nullptr, initpos, sectp, inita, nNetPlayerCount); else if (!stricmp(c, "rex")) BuildRex(nullptr, initpos, sectp, inita, nNetPlayerCount); diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 442a17a96..200cb7039 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -664,17 +664,6 @@ static void pickupMessage(int no) // //--------------------------------------------------------------------------- -void UpdatePlayerSpriteAngle(Player* pPlayer) -{ - if (pPlayer->pActor) inita = pPlayer->pActor->spr.Angles.Yaw.Normalized360(); -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void AIPlayer::Draw(RunListEvent* ev) { int nPlayer = RunData[ev->nRun].nObjIndex; @@ -987,7 +976,6 @@ void AIPlayer::Tick(RunListEvent* ev) } PlayerList[nPlayer].Angles.doYawKeys(&PlayerList[nLocalPlayer].input); - UpdatePlayerSpriteAngle(&PlayerList[nPlayer]); // player.zvel is modified within Gravity() double zVel = pPlayerActor->vel.Z; @@ -2600,7 +2588,6 @@ sectdone: { initpos = pPlayerActor->spr.pos; initsectp = pPlayerActor->sector(); - inita = pPlayerActor->spr.Angles.Yaw; } if (!PlayerList[nPlayer].nHealth) diff --git a/source/games/exhumed/src/player.h b/source/games/exhumed/src/player.h index dceddcb9f..777d582e8 100644 --- a/source/games/exhumed/src/player.h +++ b/source/games/exhumed/src/player.h @@ -122,7 +122,6 @@ int GetPlayerFromActor(DExhumedActor* actor); void SetPlayerMummified(int nPlayer, int bIsMummified); int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount); void ShootStaff(int nPlayer); -void UpdatePlayerSpriteAngle(Player* pPlayer); END_PS_NS diff --git a/source/games/exhumed/src/sound.cpp b/source/games/exhumed/src/sound.cpp index 6b4d49f53..1b19b2ad8 100644 --- a/source/games/exhumed/src/sound.cpp +++ b/source/games/exhumed/src/sound.cpp @@ -500,6 +500,8 @@ void GameInterface::UpdateSounds() if (nFreeze) return; + const auto pActor = PlayerList[nLocalPlayer].pActor; + DVector3 pos; DAngle ang; if (nSnakeCam > -1) @@ -508,10 +510,10 @@ void GameInterface::UpdateSounds() pos = pSnake->pSprites[0]->spr.pos; ang = pSnake->pSprites[0]->spr.Angles.Yaw; } - else + else if (pActor) { pos = initpos; - ang = inita; + ang = pActor->spr.Angles.Yaw; } SoundListener listener; listener.angle = float(-ang.Radians()); // Build uses a period of 2048. diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 835a82400..cf3b3edda 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -204,7 +204,6 @@ void DrawView(double interpfrac, bool sceneonly) // update render angles. pPlayer->Angles.updateCameraAngles(interpfrac); - UpdatePlayerSpriteAngle(pPlayer); if (nSnakeCam >= 0 && !sceneonly) { @@ -342,12 +341,6 @@ void DrawView(double interpfrac, bool sceneonly) if (ang2.Degrees() < 0) ang2 = -ang2; - if (ang2 > mapangle(10)) - { - inita -= ang2 * (1. / 8.); - return; - } - if (bSubTitles) { subtitleOverlay.Start(I_GetTimeNS() * (120. / 1'000'000'000));