diff --git a/source/core/gamecvars.cpp b/source/core/gamecvars.cpp index ff5aebe02..5e1b75d96 100644 --- a/source/core/gamecvars.cpp +++ b/source/core/gamecvars.cpp @@ -46,6 +46,7 @@ #include "quotemgr.h" #include "gamestruct.h" #include "statusbar.h" +#include "coreactor.h" CVARD(Bool, cl_crosshair, true, CVAR_ARCHIVE, "enable/disable crosshair"); CVARD(Bool, cl_automsg, false, CVAR_ARCHIVE, "enable/disable automatically sending messages to all players") // Not implemented for Blood @@ -235,14 +236,14 @@ ADD_STAT(fps) ADD_STAT(coord) { - auto coord = gi->GetCoordinates(); FString out; - if (coord.first.X < DBL_MAX) + if (const auto pActor = gi->getConsoleActor()) { - out.AppendFormat("X: %f ", coord.first.X); - out.AppendFormat("Y: %f ", coord.first.Y); - out.AppendFormat("Z: %f ", coord.first.Z); - out.AppendFormat("Angle: %f\n", coord.second.Degrees()); + out.AppendFormat("X: %.4f ", pActor->spr.pos.X); + out.AppendFormat("Y: %.4f ", pActor->spr.pos.Y); + out.AppendFormat("Z: %.4f ", pActor->spr.pos.Z); + out.AppendFormat("Yaw: %.4f ", pActor->spr.Angles.Yaw.Degrees()); + out.AppendFormat("Pitch: %.4f\n", pActor->spr.Angles.Pitch.Degrees()); } return out; } diff --git a/source/core/gamestruct.h b/source/core/gamestruct.h index cf99196e5..af0ee818d 100644 --- a/source/core/gamestruct.h +++ b/source/core/gamestruct.h @@ -87,7 +87,6 @@ struct GameInterface virtual void SerializeGameState(FSerializer& arc) {} virtual void DrawPlayerSprite(const DVector2& origin, bool onteam) {} virtual void SetAmbience(bool on) {} - virtual std::pair GetCoordinates() { return {}; } virtual void ExitFromMenu() { throw CExitEvent(0); } virtual void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) {} virtual void UpdateSounds() {} diff --git a/source/games/blood/src/blood.h b/source/games/blood/src/blood.h index 5fcde103f..070d6ee1b 100644 --- a/source/games/blood/src/blood.h +++ b/source/games/blood/src/blood.h @@ -119,7 +119,6 @@ struct GameInterface : public ::GameInterface void MenuOpened() override; void MenuClosed() override; bool CanSave() override; - std::pair GetCoordinates() override; void UpdateSounds() override; void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) override; void Ticker() override; diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index bf7ce28cd..456f5c022 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -774,13 +774,6 @@ bool GameInterface::GenerateSavePic() return true; } -std::pair GameInterface::GetCoordinates() -{ - PLAYER* pPlayer = &gPlayer[myconnectindex]; - if (!pPlayer->actor) return std::make_pair(DVector3(DBL_MAX, 0, 0), nullAngle); - return std::make_pair(pPlayer->actor->spr.pos, pPlayer->actor->spr.Angles.Yaw); -} - //--------------------------------------------------------------------------- // diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index e472ab0a5..7e0b60c5d 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -36,7 +36,6 @@ struct GameInterface : public ::GameInterface FSavegameInfo GetSaveSig() override; double SmallFontScale() override { return isRR() ? 0.5 : 1.; } void SerializeGameState(FSerializer& arc) override; - std::pair GetCoordinates() override; void ExitFromMenu() override; void DrawPlayerSprite(const DVector2& origin, bool onteam) override; void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) override; diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index eca805b6e..fe6dd8159 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -55,13 +55,6 @@ BEGIN_DUKE_NS // //--------------------------------------------------------------------------- -std::pair GameInterface::GetCoordinates() -{ - auto pActor = ps[screenpeek].GetActor(); - if (!pActor) return std::make_pair(DVector3(DBL_MAX, 0, 0), nullAngle); - return std::make_pair(pActor->spr.pos, pActor->spr.Angles.Yaw); -} - GameStats GameInterface::getStats() { player_struct* p = &ps[myconnectindex]; diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index 60c5e60e0..0bb0d9963 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -679,13 +679,6 @@ bool GameInterface::CanSave() return new GameInterface; } -std::pair GameInterface::GetCoordinates() -{ - auto pPlayerActor = PlayerList[nLocalPlayer].pActor; - if (!pPlayerActor) return std::make_pair(DVector3(DBL_MAX, 0, 0), nullAngle); - return std::make_pair(pPlayerActor->spr.pos, pPlayerActor->spr.Angles.Yaw); -} - //--------------------------------------------------------------------------- // diff --git a/source/games/exhumed/src/exhumed.h b/source/games/exhumed/src/exhumed.h index 0670d4d90..06960c93c 100644 --- a/source/games/exhumed/src/exhumed.h +++ b/source/games/exhumed/src/exhumed.h @@ -238,7 +238,6 @@ struct GameInterface : public ::GameInterface void ToggleThirdPerson() override; void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double interpfrac) override; int GetCurrentSkill() override; - std::pair GetCoordinates() override; void StartSoundEngine() override; ::GameStats getStats() override; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 5f9898b00..7d0ca917e 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -967,19 +967,6 @@ void post_analyzesprites(tspriteArray& tsprites) // //--------------------------------------------------------------------------- -std::pair GameInterface::GetCoordinates() -{ - auto ppActor = Player[myconnectindex].actor; - if (!ppActor) return std::make_pair(DVector3(DBL_MAX, 0, 0), nullAngle); - return std::make_pair(ppActor->spr.pos, ppActor->spr.Angles.Yaw); -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void PrintSpriteInfo(PLAYER* pp) { const int Y_STEP = 7; diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 50cc2e452..3e37d9fe8 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1679,7 +1679,6 @@ struct GameInterface : public ::GameInterface FSavegameInfo GetSaveSig() override; void SerializeGameState(FSerializer& arc); void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); } - std::pair GetCoordinates() override; void UpdateSounds() override; void ErrorCleanup() override; void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* input = nullptr) override;