Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add /saveviewpos to save the current position to a cvar
  • Loading branch information
Amanieu committed Aug 17, 2015
1 parent 84bb10b commit c50aea9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/cgame/cg_consolecmds.cpp
Expand Up @@ -64,6 +64,20 @@ static void CG_Viewpos_f()
( int ) cg.refdefViewAngles[ YAW ] );
}

/*
=============
CG_SaveViewpos_f
Save the current position to cg_savedviewpos
=============
*/
static void CG_SaveViewpos_f()
{
Cvar::SetValue("cg_savedviewpos", Str::Format("%f %f %f %f %f", cg.refdef.vieworg[0], cg.refdef.vieworg[1],
cg.refdef.vieworg[2], cg.refdefViewAngles[YAW], cg.refdefViewAngles[PITCH]));
Cvar::AddFlags("cg_savedviewpos", Cvar::ARCHIVE);
}

void CG_RequestScores()
{
cg.scoresRequestTime = cg.time;
Expand Down Expand Up @@ -470,6 +484,7 @@ static const struct
{ "reloadHud", CG_ReloadHud_f, 0 },
{ "rocket", Rocket_Rocket_f, 0, },
{ "rocketDebug", Rocket_RocketDebug_f, 0, },
{ "saveviewpos", CG_SaveViewpos_f, 0 },
{ "say", 0, 0 },
{ "say_area", 0, 0 },
{ "say_area_team", 0, 0 },
Expand Down

0 comments on commit c50aea9

Please sign in to comment.