- Tidy up coord stat to use gi->getConsoleActor() and also print pitch.

This commit is contained in:
Mitchell Richters 2023-03-17 17:28:26 +11:00
parent 3c4b4e4483
commit 81caf74721
10 changed files with 7 additions and 45 deletions

View file

@ -46,6 +46,7 @@
#include "quotemgr.h" #include "quotemgr.h"
#include "gamestruct.h" #include "gamestruct.h"
#include "statusbar.h" #include "statusbar.h"
#include "coreactor.h"
CVARD(Bool, cl_crosshair, true, CVAR_ARCHIVE, "enable/disable crosshair"); 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 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) ADD_STAT(coord)
{ {
auto coord = gi->GetCoordinates();
FString out; FString out;
if (coord.first.X < DBL_MAX) if (const auto pActor = gi->getConsoleActor())
{ {
out.AppendFormat("X: %f ", coord.first.X); out.AppendFormat("X: %.4f ", pActor->spr.pos.X);
out.AppendFormat("Y: %f ", coord.first.Y); out.AppendFormat("Y: %.4f ", pActor->spr.pos.Y);
out.AppendFormat("Z: %f ", coord.first.Z); out.AppendFormat("Z: %.4f ", pActor->spr.pos.Z);
out.AppendFormat("Angle: %f\n", coord.second.Degrees()); out.AppendFormat("Yaw: %.4f ", pActor->spr.Angles.Yaw.Degrees());
out.AppendFormat("Pitch: %.4f\n", pActor->spr.Angles.Pitch.Degrees());
} }
return out; return out;
} }

View file

@ -87,7 +87,6 @@ struct GameInterface
virtual void SerializeGameState(FSerializer& arc) {} virtual void SerializeGameState(FSerializer& arc) {}
virtual void DrawPlayerSprite(const DVector2& origin, bool onteam) {} virtual void DrawPlayerSprite(const DVector2& origin, bool onteam) {}
virtual void SetAmbience(bool on) {} virtual void SetAmbience(bool on) {}
virtual std::pair<DVector3, DAngle> GetCoordinates() { return {}; }
virtual void ExitFromMenu() { throw CExitEvent(0); } virtual void ExitFromMenu() { throw CExitEvent(0); }
virtual void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) {} virtual void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) {}
virtual void UpdateSounds() {} virtual void UpdateSounds() {}

View file

@ -119,7 +119,6 @@ struct GameInterface : public ::GameInterface
void MenuOpened() override; void MenuOpened() override;
void MenuClosed() override; void MenuClosed() override;
bool CanSave() override; bool CanSave() override;
std::pair<DVector3, DAngle> GetCoordinates() override;
void UpdateSounds() override; void UpdateSounds() override;
void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) override; void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) override;
void Ticker() override; void Ticker() override;

View file

@ -774,13 +774,6 @@ bool GameInterface::GenerateSavePic()
return true; return true;
} }
std::pair<DVector3, DAngle> 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);
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //

View file

@ -36,7 +36,6 @@ struct GameInterface : public ::GameInterface
FSavegameInfo GetSaveSig() override; FSavegameInfo GetSaveSig() override;
double SmallFontScale() override { return isRR() ? 0.5 : 1.; } double SmallFontScale() override { return isRR() ? 0.5 : 1.; }
void SerializeGameState(FSerializer& arc) override; void SerializeGameState(FSerializer& arc) override;
std::pair<DVector3, DAngle> GetCoordinates() override;
void ExitFromMenu() override; void ExitFromMenu() override;
void DrawPlayerSprite(const DVector2& origin, bool onteam) override; void DrawPlayerSprite(const DVector2& origin, bool onteam) override;
void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) override; void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* packet = nullptr) override;

View file

@ -55,13 +55,6 @@ BEGIN_DUKE_NS
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
std::pair<DVector3, DAngle> 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() GameStats GameInterface::getStats()
{ {
player_struct* p = &ps[myconnectindex]; player_struct* p = &ps[myconnectindex];

View file

@ -679,13 +679,6 @@ bool GameInterface::CanSave()
return new GameInterface; return new GameInterface;
} }
std::pair<DVector3, DAngle> 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);
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //

View file

@ -238,7 +238,6 @@ struct GameInterface : public ::GameInterface
void ToggleThirdPerson() override; void ToggleThirdPerson() override;
void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double interpfrac) override; void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double interpfrac) override;
int GetCurrentSkill() override; int GetCurrentSkill() override;
std::pair<DVector3, DAngle> GetCoordinates() override;
void StartSoundEngine() override; void StartSoundEngine() override;
::GameStats getStats() override; ::GameStats getStats() override;

View file

@ -967,19 +967,6 @@ void post_analyzesprites(tspriteArray& tsprites)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
std::pair<DVector3, DAngle> 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) void PrintSpriteInfo(PLAYER* pp)
{ {
const int Y_STEP = 7; const int Y_STEP = 7;

View file

@ -1679,7 +1679,6 @@ struct GameInterface : public ::GameInterface
FSavegameInfo GetSaveSig() override; FSavegameInfo GetSaveSig() override;
void SerializeGameState(FSerializer& arc); void SerializeGameState(FSerializer& arc);
void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); } void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); }
std::pair<DVector3, DAngle> GetCoordinates() override;
void UpdateSounds() override; void UpdateSounds() override;
void ErrorCleanup() override; void ErrorCleanup() override;
void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* input = nullptr) override; void GetInput(ControlInfo* const hidInput, double const scaleAdjust, InputPacket* input = nullptr) override;