|
|
@ -157,32 +157,12 @@ void CL_PlayCDTrack_f( void ) |
|
|
|
CL_ScreenshotGetName |
|
|
|
CL_ScreenshotGetName |
|
|
|
================== |
|
|
|
================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static qboolean CL_ScreenshotGetName( int lastnum, char *filename, size_t size ) |
|
|
|
static qboolean CL_ScreenshotGetName( const char *fmt, int lastnum, char *filename, size_t size ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( lastnum < 0 || lastnum > 9999 ) |
|
|
|
if( lastnum < 0 || lastnum > 9999 ) |
|
|
|
{ |
|
|
|
|
|
|
|
Con_Printf( S_ERROR "unable to write screenshot\n" ); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Q_snprintf( filename, size, "scrshots/%s_shot%04d.png", clgame.mapname, lastnum ) > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
================== |
|
|
|
|
|
|
|
CL_SnapshotGetName |
|
|
|
|
|
|
|
================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
static qboolean CL_SnapshotGetName( int lastnum, char *filename, size_t size ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( lastnum < 0 || lastnum > 9999 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Con_Printf( S_ERROR "unable to write snapshot\n" ); |
|
|
|
|
|
|
|
FS_AllowDirectPaths( false ); |
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Q_snprintf( filename, size, "../%s_%04d.png", clgame.mapname, lastnum ) > 0; |
|
|
|
return Q_snprintf( filename, size, fmt, clgame.mapname, lastnum ) > 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -192,127 +172,6 @@ static qboolean CL_SnapshotGetName( int lastnum, char *filename, size_t size ) |
|
|
|
|
|
|
|
|
|
|
|
============================================================================== |
|
|
|
============================================================================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
/*
|
|
|
|
|
|
|
|
================== |
|
|
|
|
|
|
|
CL_ScreenShot_f |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
normal screenshot |
|
|
|
|
|
|
|
================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void CL_ScreenShot_f( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
string checkname; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( CL_IsDevOverviewMode() == 1 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// special case for write overview image and script file
|
|
|
|
|
|
|
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname ); |
|
|
|
|
|
|
|
cls.scrshot_action = scrshot_mapshot; // build new frame for mapshot
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// scan for a free filename
|
|
|
|
|
|
|
|
for( i = 0; i < 9999; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( !CL_ScreenshotGetName( i, checkname, sizeof( checkname ))) |
|
|
|
|
|
|
|
return; // no namespace
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !FS_FileExists( checkname, true )) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname )); |
|
|
|
|
|
|
|
cls.scrshot_action = scrshot_normal; // build new frame for screenshot
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cls.envshot_vieworg = NULL; // no custom view
|
|
|
|
|
|
|
|
cls.envshot_viewsize = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
================== |
|
|
|
|
|
|
|
CL_SnapShot_f |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
save screenshots into root dir |
|
|
|
|
|
|
|
================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void CL_SnapShot_f( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
string checkname; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( CL_IsDevOverviewMode() == 1 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// special case for write overview image and script file
|
|
|
|
|
|
|
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname ); |
|
|
|
|
|
|
|
cls.scrshot_action = scrshot_mapshot; // build new frame for mapshot
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
FS_AllowDirectPaths( true ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// scan for a free filename
|
|
|
|
|
|
|
|
for( i = 0; i < 9999; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( !CL_SnapshotGetName( i, checkname, sizeof( checkname ))) |
|
|
|
|
|
|
|
return; // no namespace
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !FS_FileExists( checkname, true )) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FS_AllowDirectPaths( false ); |
|
|
|
|
|
|
|
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname )); |
|
|
|
|
|
|
|
cls.scrshot_action = scrshot_snapshot; // build new frame for screenshot
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cls.envshot_vieworg = NULL; // no custom view
|
|
|
|
|
|
|
|
cls.envshot_viewsize = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
================== |
|
|
|
|
|
|
|
CL_EnvShot_f |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cubemap view |
|
|
|
|
|
|
|
================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void CL_EnvShot_f( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( Cmd_Argc() < 2 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Con_Printf( S_USAGE "envshot <shotname>\n" ); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "gfx/env/%s", Cmd_Argv( 1 )); |
|
|
|
|
|
|
|
cls.scrshot_action = scrshot_envshot; // build new frame for envshot
|
|
|
|
|
|
|
|
cls.envshot_vieworg = NULL; // no custom view
|
|
|
|
|
|
|
|
cls.envshot_viewsize = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
================== |
|
|
|
|
|
|
|
CL_SkyShot_f |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skybox view |
|
|
|
|
|
|
|
================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void CL_SkyShot_f( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( Cmd_Argc() < 2 ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Con_Printf( S_USAGE "skyshot <shotname>\n" ); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ),"gfx/env/%s", Cmd_Argv( 1 )); |
|
|
|
|
|
|
|
cls.scrshot_action = scrshot_skyshot; // build new frame for skyshot
|
|
|
|
|
|
|
|
cls.envshot_vieworg = NULL; // no custom view
|
|
|
|
|
|
|
|
cls.envshot_viewsize = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
================== |
|
|
|
================== |
|
|
|
CL_LevelShot_f |
|
|
|
CL_LevelShot_f |
|
|
@ -355,23 +214,100 @@ void CL_LevelShot_f( void ) |
|
|
|
else cls.scrshot_action = scrshot_inactive; // disable - not needs
|
|
|
|
else cls.scrshot_action = scrshot_inactive; // disable - not needs
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
static scrshot_t CL_GetScreenshotTypeFromString( const char *string ) |
|
|
|
================== |
|
|
|
{ |
|
|
|
CL_SaveShot_f |
|
|
|
if( !Q_stricmp( string, "snapshot" )) |
|
|
|
|
|
|
|
return scrshot_snapshot; |
|
|
|
|
|
|
|
|
|
|
|
mini-pic in loadgame menu |
|
|
|
if( !Q_stricmp( string, "screenshot" )) |
|
|
|
================== |
|
|
|
return scrshot_normal; |
|
|
|
*/ |
|
|
|
|
|
|
|
void CL_SaveShot_f( void ) |
|
|
|
if( !Q_stricmp( string, "saveshot" )) |
|
|
|
|
|
|
|
return scrshot_savegame; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !Q_stricmp( string, "envshot" )) |
|
|
|
|
|
|
|
return scrshot_envshot; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !Q_stricmp( string, "skyshot" )) |
|
|
|
|
|
|
|
return scrshot_skyshot; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return scrshot_inactive; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CL_GenericShot_f( void ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const char *argv0 = Cmd_Argv( 0 ); |
|
|
|
|
|
|
|
scrshot_t type; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type = CL_GetScreenshotTypeFromString( argv0 ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( type == scrshot_normal || type == scrshot_snapshot ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( CL_IsDevOverviewMode() == 1 ) |
|
|
|
|
|
|
|
type = scrshot_mapshot; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( Cmd_Argc() < 2 ) |
|
|
|
if( Cmd_Argc() < 2 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Con_Printf( S_USAGE "saveshot <savename>\n" ); |
|
|
|
Con_Printf( S_USAGE "%s <shotname>\n", argv0 ); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch( type ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case scrshot_envshot: |
|
|
|
|
|
|
|
case scrshot_skyshot: |
|
|
|
|
|
|
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "gfx/env/%s", Cmd_Argv( 1 )); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case scrshot_savegame: |
|
|
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), DEFAULT_SAVE_DIRECTORY "%s.bmp", Cmd_Argv( 1 )); |
|
|
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), DEFAULT_SAVE_DIRECTORY "%s.bmp", Cmd_Argv( 1 )); |
|
|
|
cls.scrshot_action = scrshot_savegame; // build new frame for saveshot
|
|
|
|
break; |
|
|
|
|
|
|
|
case scrshot_mapshot: |
|
|
|
|
|
|
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname ); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case scrshot_normal: |
|
|
|
|
|
|
|
case scrshot_snapshot: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const char *fmt; |
|
|
|
|
|
|
|
string checkname; |
|
|
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( type == scrshot_snapshot ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
fmt = "../%s_%04d.png"; |
|
|
|
|
|
|
|
FS_AllowDirectPaths( true ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else fmt = "scrshots/%s_shot%04d.png"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < 9999; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( !CL_ScreenshotGetName( fmt, i, checkname, sizeof( checkname ))) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Con_Printf( S_ERROR "unable to write %s\n", argv0 ); |
|
|
|
|
|
|
|
FS_AllowDirectPaths( false ); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !FS_FileExists( checkname, true )) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FS_AllowDirectPaths( false ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname )); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case scrshot_inactive: |
|
|
|
|
|
|
|
case scrshot_plaque: |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
return; // shouldn't happen
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cls.scrshot_action = type; // build new frame for saveshot
|
|
|
|
|
|
|
|
cls.envshot_vieworg = NULL; |
|
|
|
|
|
|
|
cls.envshot_viewsize = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|