2007-11-06 22:00:00 +01:00
|
|
|
|
//=======================================================================
|
|
|
|
|
// Copyright XashXT Group 2007 <20>
|
|
|
|
|
// cl_cmds.c - client console commnds
|
|
|
|
|
//=======================================================================
|
|
|
|
|
|
2008-06-09 22:00:00 +02:00
|
|
|
|
#include "common.h"
|
2007-11-06 22:00:00 +01:00
|
|
|
|
#include "client.h"
|
|
|
|
|
|
2008-10-20 22:00:00 +02:00
|
|
|
|
#define SCRSHOT_TYPE "tga"
|
|
|
|
|
|
2007-11-13 22:00:00 +01:00
|
|
|
|
/*
|
|
|
|
|
================
|
|
|
|
|
SCR_Loading_f
|
2008-08-04 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
loading
|
2007-11-13 22:00:00 +01:00
|
|
|
|
================
|
|
|
|
|
*/
|
2008-08-04 22:00:00 +02:00
|
|
|
|
void SCR_Loading_f( void )
|
2007-11-13 22:00:00 +01:00
|
|
|
|
{
|
2007-11-14 22:00:00 +01:00
|
|
|
|
S_StopAllSounds();
|
2007-11-13 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-08-04 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
====================
|
|
|
|
|
CL_SetFont_f
|
|
|
|
|
|
|
|
|
|
setfont <fontname>
|
|
|
|
|
====================
|
|
|
|
|
*/
|
2008-01-20 22:00:00 +01:00
|
|
|
|
void CL_SetFont_f( void )
|
|
|
|
|
{
|
2008-11-15 22:00:00 +01:00
|
|
|
|
if( Cmd_Argc() < 2 )
|
2008-01-20 22:00:00 +01:00
|
|
|
|
{
|
2008-11-15 22:00:00 +01:00
|
|
|
|
Msg( "Usage: setfont <fontname> <console>\n" );
|
2008-01-20 22:00:00 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
2008-11-15 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
switch(Cmd_Argc( ))
|
|
|
|
|
{
|
|
|
|
|
case 2:
|
|
|
|
|
Cvar_Set( "cl_font", Cmd_Argv( 1 ));
|
|
|
|
|
cls.clientFont = re->RegisterShader( va( "gfx/fonts/%s", cl_font->string ), SHADER_FONT );
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
Cvar_Set( "con_font", Cmd_Argv( 1 ));
|
|
|
|
|
cls.consoleFont = re->RegisterShader( va( "gfx/fonts/%s", con_font->string ), SHADER_FONT );
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Msg( "setfont: invalid aruments\n" );
|
|
|
|
|
break;
|
|
|
|
|
}
|
2008-01-20 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-08-04 22:00:00 +02:00
|
|
|
|
/*
|
|
|
|
|
====================
|
|
|
|
|
CL_PlayVideo_f
|
|
|
|
|
|
|
|
|
|
movie <moviename>
|
|
|
|
|
====================
|
|
|
|
|
*/
|
|
|
|
|
void CL_PlayVideo_f( void )
|
|
|
|
|
{
|
|
|
|
|
if( Cmd_Argc() != 2 )
|
|
|
|
|
{
|
|
|
|
|
Msg( "movie <moviename>\n" );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if( cls.state == ca_active )
|
|
|
|
|
{
|
|
|
|
|
// FIXME: get rid of this stupid alias
|
|
|
|
|
Cbuf_AddText(va("killserver\n; wait\n; movie %s\n;", Cmd_Argv(1)));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
SCR_PlayCinematic( Cmd_Argv(1), 0 );
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-02 22:00:00 +02:00
|
|
|
|
/*
|
|
|
|
|
===============
|
|
|
|
|
CL_Download_f
|
|
|
|
|
|
|
|
|
|
Request a download from the server
|
|
|
|
|
===============
|
|
|
|
|
*/
|
|
|
|
|
void CL_Download_f( void )
|
|
|
|
|
{
|
|
|
|
|
if( Cmd_Argc() != 2 )
|
|
|
|
|
{
|
|
|
|
|
Msg( "Usage: download <filename>\n" );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
CL_CheckOrDownloadFile(Cmd_Argv(1));
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-06 22:00:00 +01:00
|
|
|
|
/*
|
|
|
|
|
==================
|
|
|
|
|
CL_ScreenshotGetName
|
|
|
|
|
==================
|
|
|
|
|
*/
|
|
|
|
|
void CL_ScreenshotGetName( int lastnum, char *filename )
|
|
|
|
|
{
|
|
|
|
|
int a, b, c, d;
|
|
|
|
|
|
|
|
|
|
if(!filename) return;
|
|
|
|
|
if(lastnum < 0 || lastnum > 9999)
|
|
|
|
|
{
|
|
|
|
|
// bound
|
2008-10-20 22:00:00 +02:00
|
|
|
|
com.sprintf( filename, "scrshots/%s/shot9999.%s", cl.configstrings[CS_NAME], SCRSHOT_TYPE );
|
2007-11-06 22:00:00 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a = lastnum / 1000;
|
|
|
|
|
lastnum -= a * 1000;
|
|
|
|
|
b = lastnum / 100;
|
|
|
|
|
lastnum -= b * 100;
|
|
|
|
|
c = lastnum / 10;
|
|
|
|
|
lastnum -= c * 10;
|
|
|
|
|
d = lastnum;
|
|
|
|
|
|
2008-10-20 22:00:00 +02:00
|
|
|
|
com.sprintf( filename, "scrshots/%s/shot%i%i%i%i.%s", cl.configstrings[CS_NAME], a, b, c, d, SCRSHOT_TYPE );
|
2007-11-06 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
|
|
SCREEN SHOTS
|
|
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
==================
|
|
|
|
|
CL_ScreenShot_f
|
|
|
|
|
|
|
|
|
|
normal screenshot
|
|
|
|
|
==================
|
|
|
|
|
*/
|
|
|
|
|
void CL_ScreenShot_f( void )
|
|
|
|
|
{
|
2008-07-23 22:00:00 +02:00
|
|
|
|
int i;
|
|
|
|
|
string checkname;
|
2007-11-06 22:00:00 +01:00
|
|
|
|
|
|
|
|
|
// scan for a free filename
|
|
|
|
|
for (i = 0; i <= 9999; i++ )
|
|
|
|
|
{
|
|
|
|
|
CL_ScreenshotGetName( i, checkname );
|
|
|
|
|
if(!FS_FileExists( checkname )) break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Con_ClearNotify();
|
|
|
|
|
re->ScrShot( checkname, false );
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-09 22:00:00 +01:00
|
|
|
|
void CL_EnvShot_f( void )
|
|
|
|
|
{
|
|
|
|
|
string basename;
|
|
|
|
|
|
|
|
|
|
if(Cmd_Argc() < 2)
|
|
|
|
|
{
|
|
|
|
|
Msg("Usage: envshot <shotname>\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Con_ClearNotify();
|
|
|
|
|
com.snprintf( basename, MAX_STRING, "gfx/env/%s", Cmd_Argv( 1 ));
|
|
|
|
|
re->EnvShot( basename, cl_envshot_size->integer, false );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CL_SkyShot_f( void )
|
|
|
|
|
{
|
|
|
|
|
string basename;
|
|
|
|
|
|
|
|
|
|
if(Cmd_Argc() < 2)
|
|
|
|
|
{
|
|
|
|
|
Msg("Usage: envshot <shotname>\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Con_ClearNotify();
|
|
|
|
|
com.snprintf( basename, MAX_STRING, "gfx/env/%s", Cmd_Argv( 1 ));
|
|
|
|
|
re->EnvShot( basename, cl_envshot_size->integer, true );
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-06 22:00:00 +01:00
|
|
|
|
/*
|
|
|
|
|
==================
|
|
|
|
|
CL_LevelShot_f
|
|
|
|
|
|
|
|
|
|
splash logo while map is loading
|
|
|
|
|
==================
|
|
|
|
|
*/
|
|
|
|
|
void CL_LevelShot_f( void )
|
|
|
|
|
{
|
2008-07-23 22:00:00 +02:00
|
|
|
|
string checkname;
|
2007-11-06 22:00:00 +01:00
|
|
|
|
|
2009-01-05 22:00:00 +01:00
|
|
|
|
if( !cl.need_levelshot )
|
|
|
|
|
{
|
|
|
|
|
Msg( "levelshot is not valid from the console\n" );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-06 22:00:00 +01:00
|
|
|
|
// check for exist
|
2008-12-06 22:00:00 +01:00
|
|
|
|
com.sprintf( checkname, "media/background/%s.png", cl.configstrings[CS_NAME] );
|
2009-01-05 22:00:00 +01:00
|
|
|
|
if( !FS_FileExists( checkname )) re->ScrShot( checkname, true );
|
|
|
|
|
cl.need_levelshot = false; // done
|
2007-11-13 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
=================
|
|
|
|
|
CL_SetSky_f
|
|
|
|
|
|
|
|
|
|
Set a specific sky and rotation speed
|
|
|
|
|
=================
|
|
|
|
|
*/
|
|
|
|
|
void CL_SetSky_f( void )
|
|
|
|
|
{
|
|
|
|
|
if(Cmd_Argc() < 2)
|
|
|
|
|
{
|
2008-11-09 22:00:00 +01:00
|
|
|
|
Msg("Usage: sky <shadername>\n");
|
2007-11-13 22:00:00 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
2008-11-09 22:00:00 +01:00
|
|
|
|
re->RegisterShader( Cmd_Argv(1), SHADER_SKY );
|
2007-11-13 22:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
================
|
|
|
|
|
SCR_TimeRefresh_f
|
2008-08-04 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
timerefres [noflip]
|
2007-11-13 22:00:00 +01:00
|
|
|
|
================
|
|
|
|
|
*/
|
2008-06-30 22:00:00 +02:00
|
|
|
|
void SCR_TimeRefresh_f( void )
|
2007-11-13 22:00:00 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
2008-07-03 22:00:00 +02:00
|
|
|
|
int start, stop;
|
2007-11-13 22:00:00 +01:00
|
|
|
|
float time;
|
|
|
|
|
|
|
|
|
|
if ( cls.state != ca_active )
|
|
|
|
|
return;
|
|
|
|
|
|
2008-07-03 22:00:00 +02:00
|
|
|
|
start = Sys_Milliseconds();
|
2007-11-13 22:00:00 +01:00
|
|
|
|
|
2008-06-30 22:00:00 +02:00
|
|
|
|
if( Cmd_Argc() == 2 )
|
2007-11-13 22:00:00 +01:00
|
|
|
|
{
|
|
|
|
|
// run without page flipping
|
2008-10-19 22:00:00 +02:00
|
|
|
|
re->BeginFrame();
|
2008-06-30 22:00:00 +02:00
|
|
|
|
for( i = 0; i < 128; i++ )
|
2007-11-13 22:00:00 +01:00
|
|
|
|
{
|
2008-06-30 22:00:00 +02:00
|
|
|
|
cl.refdef.viewangles[1] = i/128.0 * 360.0f;
|
2007-11-13 22:00:00 +01:00
|
|
|
|
re->RenderFrame (&cl.refdef);
|
|
|
|
|
}
|
|
|
|
|
re->EndFrame();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-06-30 22:00:00 +02:00
|
|
|
|
for( i = 0; i < 128; i++ )
|
2007-11-13 22:00:00 +01:00
|
|
|
|
{
|
2008-06-30 22:00:00 +02:00
|
|
|
|
cl.refdef.viewangles[1] = i/128.0 * 360.0f;
|
2007-11-13 22:00:00 +01:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
re->BeginFrame();
|
2007-11-13 22:00:00 +01:00
|
|
|
|
re->RenderFrame(&cl.refdef);
|
|
|
|
|
re->EndFrame();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-03 22:00:00 +02:00
|
|
|
|
stop = Sys_Milliseconds();
|
2008-07-04 22:00:00 +02:00
|
|
|
|
time = (stop - start) / 1000.0f;
|
2008-06-30 22:00:00 +02:00
|
|
|
|
Msg( "%f seconds (%f fps)\n", time, 128 / time );
|
2008-08-04 22:00:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
=============
|
|
|
|
|
SCR_Viewpos_f
|
|
|
|
|
|
|
|
|
|
viewpos
|
|
|
|
|
=============
|
|
|
|
|
*/
|
|
|
|
|
void SCR_Viewpos_f( void )
|
|
|
|
|
{
|
|
|
|
|
Msg("(%g %g %g)\n", cl.refdef.vieworg[0], cl.refdef.vieworg[1], cl.refdef.vieworg[2] );
|
2007-11-06 22:00:00 +01:00
|
|
|
|
}
|