mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-22 20:21:13 +00:00
- Consolidate player coord stat/CCMD into coreplayer.cpp
.
This commit is contained in:
parent
0bbfe81a92
commit
210ebefd3d
4 changed files with 61 additions and 48 deletions
|
@ -272,3 +272,63 @@ void DCorePlayer::doRollInput(const bool bUnderwater)
|
|||
actor->spr.Angles.Roll += cmd.ucmd.ang.Roll * gameInput.SyncInput();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Stat for console player's position/angles.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
ADD_STAT(coord)
|
||||
{
|
||||
FString out;
|
||||
const auto p = PlayerArray[myconnectindex];
|
||||
if (const auto pActor = p->GetActor())
|
||||
{
|
||||
out.AppendFormat("X: %.4f ", pActor->spr.pos.X);
|
||||
out.AppendFormat("Y: %.4f ", pActor->spr.pos.Y);
|
||||
out.AppendFormat("Z: %.4f\n", pActor->spr.pos.Z);
|
||||
out.AppendFormat("Yaw: %.4f ", pActor->spr.Angles.Yaw.Degrees());
|
||||
out.AppendFormat("Pitch: %.4f ", pActor->spr.Angles.Pitch.Degrees());
|
||||
out.AppendFormat("Roll: %.4f\n", pActor->spr.Angles.Roll.Degrees());
|
||||
out.AppendFormat("View Yaw: %.4f ", p->ViewAngles.Yaw.Degrees());
|
||||
out.AppendFormat("View Pitch: %.4f ", p->ViewAngles.Pitch.Degrees());
|
||||
out.AppendFormat("View Roll: %.4f\n", p->ViewAngles.Roll.Degrees());
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// CCMD to warp console player to the given coordinates.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
CCMD(warptocoords)
|
||||
{
|
||||
if (netgame)
|
||||
{
|
||||
Printf("warptocoords cannot be used in multiplayer.\n");
|
||||
return;
|
||||
}
|
||||
if (argv.argc() < 4)
|
||||
{
|
||||
Printf("warptocoords [x] [y] [z] [yaw] (optional) [pitch] (optional): warps the player to the specified coordinates\n");
|
||||
return;
|
||||
}
|
||||
if (gamestate != GS_LEVEL)
|
||||
{
|
||||
Printf("warptocoords: must be in a level\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (const auto pActor = PlayerArray[myconnectindex]->GetActor())
|
||||
{
|
||||
pActor->spr.pos = DVector3(atof(argv[1]), atof(argv[2]), atof(argv[3]));
|
||||
if (argv.argc() > 4) pActor->spr.Angles.Yaw = DAngle::fromDeg(atof(argv[4]));
|
||||
if (argv.argc() > 5) pActor->spr.Angles.Pitch = DAngle::fromDeg(atof(argv[5]));
|
||||
pActor->backuploc();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "d_net.h"
|
||||
#include "packet.h"
|
||||
#include "gamestate.h"
|
||||
#include "gamefuncs.h"
|
||||
|
||||
class DCorePlayer : public DObject
|
||||
|
|
|
@ -249,25 +249,6 @@ ADD_STAT(fps)
|
|||
return gi->statFPS();
|
||||
}
|
||||
|
||||
ADD_STAT(coord)
|
||||
{
|
||||
FString out;
|
||||
const auto p = PlayerArray[myconnectindex];
|
||||
if (const auto pActor = p->GetActor())
|
||||
{
|
||||
out.AppendFormat("X: %.4f ", pActor->spr.pos.X);
|
||||
out.AppendFormat("Y: %.4f ", pActor->spr.pos.Y);
|
||||
out.AppendFormat("Z: %.4f\n", pActor->spr.pos.Z);
|
||||
out.AppendFormat("Yaw: %.4f ", pActor->spr.Angles.Yaw.Degrees());
|
||||
out.AppendFormat("Pitch: %.4f ", pActor->spr.Angles.Pitch.Degrees());
|
||||
out.AppendFormat("Roll: %.4f\n", pActor->spr.Angles.Roll.Degrees());
|
||||
out.AppendFormat("View Yaw: %.4f ", p->ViewAngles.Yaw.Degrees());
|
||||
out.AppendFormat("View Pitch: %.4f ", p->ViewAngles.Pitch.Degrees());
|
||||
out.AppendFormat("View Roll: %.4f\n", p->ViewAngles.Roll.Degrees());
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
CUSTOM_CVARD(Int, r_showfps, 0, 0, "show the frame rate counter")
|
||||
{
|
||||
if (self < 0 || self > 3) self = 1;
|
||||
|
|
|
@ -22,9 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "menu.h"
|
||||
#include "gamestate.h"
|
||||
#include "gameinput.h"
|
||||
#include "coreplayer.h"
|
||||
#include "g_input.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -439,33 +437,6 @@ CCMD(holsterweapon)
|
|||
gameInput.SendAction(SB_HOLSTER);
|
||||
}
|
||||
|
||||
CCMD(warptocoords)
|
||||
{
|
||||
if (netgame)
|
||||
{
|
||||
Printf("warptocoords cannot be used in multiplayer.\n");
|
||||
return;
|
||||
}
|
||||
if (argv.argc() < 4)
|
||||
{
|
||||
Printf("warptocoords [x] [y] [z] [yaw] (optional) [pitch] (optional): warps the player to the specified coordinates\n");
|
||||
return;
|
||||
}
|
||||
if (gamestate != GS_LEVEL)
|
||||
{
|
||||
Printf("warptocoords: must be in a level\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (const auto pActor = PlayerArray[myconnectindex]->GetActor())
|
||||
{
|
||||
pActor->spr.pos = DVector3(atof(argv[1]), atof(argv[2]), atof(argv[3]));
|
||||
if (argv.argc() > 4) pActor->spr.Angles.Yaw = DAngle::fromDeg(atof(argv[4]));
|
||||
if (argv.argc() > 5) pActor->spr.Angles.Pitch = DAngle::fromDeg(atof(argv[5]));
|
||||
pActor->backuploc();
|
||||
}
|
||||
}
|
||||
|
||||
CCMD(third_person_view)
|
||||
{
|
||||
gi->ToggleThirdPerson();
|
||||
|
|
Loading…
Reference in a new issue