Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions src/game/client/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#include "ScreenSpaceEffects.h"
#include "sourcevr/isourcevirtualreality.h"
#include "client_virtualreality.h"
#include "fmtstr.h"
#include "vgui/ISystem.h"

#if defined( REPLAY_ENABLED )
#include "replay/ireplaysystem.h"
Expand Down Expand Up @@ -1275,30 +1277,46 @@ static void GetPos( const CCommand &args, Vector &vecOrigin, QAngle &angles )
}
}

CON_COMMAND( spec_pos, "dump position and angles to the console" )
CON_COMMAND( spec_pos, "dump position and angles to the console ( 1 = to clipboard )" )
{
Vector vecOrigin;
QAngle angles;
GetPos( args, vecOrigin, angles );
Warning( "spec_goto %.1f %.1f %.1f %.1f %.1f\n", vecOrigin.x, vecOrigin.y,
vecOrigin.z, angles.x, angles.y );

bool bClip = ( args.ArgC() >= 2 && Q_atoi( args[ 1 ] ) == 1 );

CFmtStr fmtCommand(
"spec_goto %.1f %.1f %.1f %.1f %.1f",
vecOrigin.x, vecOrigin.y, vecOrigin.z, angles.x, angles.y
);

Warning( "%s\n", fmtCommand.String() );
if ( bClip )
{
vgui::system()->SetClipboardText( fmtCommand.String(), fmtCommand.Length() );
}
}

CON_COMMAND( getpos, "dump position and angles to the console" )
CON_COMMAND( getpos, "dump position and angles to the console ( 1 = to clipboard, 2 = exact pos, 3 = all )" )
{
Vector vecOrigin;
QAngle angles;
GetPos( args, vecOrigin, angles );

const char *pCommand1 = "setpos";
const char *pCommand2 = "setang";
if ( args.ArgC() == 2 && atoi( args[1] ) == 2 )
int nParm = ( args.ArgC() >= 2 ) ? Q_atoi( args[ 1 ] ) : 0;
bool bClip = ( nParm == 1 || nParm == 3 );
bool bExact = ( nParm == 2 || nParm == 3 );

CFmtStr fmtCommand(
"%s %f %f %f;%s %f %f %f",
bExact ? "setpos_exact" : "setpos", vecOrigin.x, vecOrigin.y, vecOrigin.z,
bExact ? "setang_exact" : "setang", angles.x, angles.y, angles.z
);

Warning( "%s\n", fmtCommand.String() );
if ( bClip )
{
pCommand1 = "setpos_exact";
pCommand2 = "setang_exact";
vgui::system()->SetClipboardText( fmtCommand.String(), fmtCommand.Length() );
}

Warning( "%s %f %f %f;", pCommand1, vecOrigin.x, vecOrigin.y, vecOrigin.z );
Warning( "%s %f %f %f\n", pCommand2, angles.x, angles.y, angles.z );
}