void R_ScreenShotJPEG_f() { // if we have saved a previous screenshot, don't scan // again, because recording demo avis can involve // thousands of shots static int lastNumber = 0; if ( !String::Cmp( Cmd_Argv( 1 ), "levelshot" ) ) { R_LevelShot(); return; } bool silent = !String::Cmp( Cmd_Argv( 1 ), "silent" ); char checkname[ MAX_OSPATH ]; if ( Cmd_Argc() == 2 && !silent ) { // explicit filename String::Sprintf( checkname, MAX_OSPATH, "screenshots/%s.jpg", Cmd_Argv( 1 ) ); } else { // scan for a free filename if ( !R_FindAvailableScreenshotFilename( lastNumber, checkname, "jpg" ) ) { return; } } if ( GGameType & GAME_Tech3 ) { R_TakeScreenshot( 0, 0, glConfig.vidWidth, glConfig.vidHeight, checkname, true ); } else { R_TakeScreenshot( 0, 0, glConfig.vidWidth, glConfig.vidHeight, checkname, true ); } if ( !silent ) { common->Printf( "Wrote %s\n", checkname ); } }
void R_ScreenShotPNG_f (void) { char checkname[MAX_OSPATH]; static int lastNumber = -1; qboolean silent; qboolean levelshot; if ( !strcmp( ri.Cmd_Argv(1), "levelshot" ) ) { R_LevelShot( ST_PNG, ".png" ); levelshot = qtrue; } else { levelshot = qfalse; } if ( !strcmp( ri.Cmd_Argv(1), "silent" ) ) { silent = qtrue; } else { silent = qfalse; } if ( levelshot ) { sprintf( checkname, "levelshots/%s.png", tr.world->baseName ); } else if ( ri.Cmd_Argc() == 2 && !silent ) { // explicit filename Com_sprintf( checkname, MAX_OSPATH, "screenshots/%s.png", ri.Cmd_Argv( 1 ) ); } else { // scan for a free filename // if we have saved a previous screenshot, don't scan // again, because recording demo avis can involve // thousands of shots if ( lastNumber == -1 ) { lastNumber = 0; } // scan for a free number for ( ; lastNumber <= 9999 ; lastNumber++ ) { R_ScreenshotFilename( lastNumber, checkname, ".png" ); if (!ri.FS_FileExists( checkname )) { break; // file doesn't exist } } if ( lastNumber >= 9999 ) { ri.Printf (PRINT_ALL, "ScreenShot: Couldn't create a file\n"); return; } lastNumber++; } R_TakeScreenshot( 0, 0, glConfig.vidWidth, glConfig.vidHeight, checkname, ST_PNG ); if ( !silent ) { ri.Printf (PRINT_ALL, "Wrote %s\n", checkname); } }
/* ================== R_ScreenShotTGA_f screenshot screenshot [silent] screenshot [levelshot] screenshot [filename] Doesn't print the pacifier message if there is a second arg ================== */ void R_ScreenShotTGA_f (void) { #ifndef _XBOX char checkname[MAX_OSPATH]; int len; static int lastNumber = -1; qboolean silent; if ( !strcmp( Cmd_Argv(1), "levelshot" ) ) { R_LevelShot(); return; } if ( !strcmp( Cmd_Argv(1), "silent" ) ) { silent = qtrue; } else { silent = qfalse; } if ( Cmd_Argc() == 2 && !silent ) { // explicit filename Com_sprintf( checkname, MAX_OSPATH, "screenshots/%s.tga", Cmd_Argv( 1 ) ); } else { // scan for a free filename // if we have saved a previous screenshot, don't scan // again, because recording demo avis can involve // thousands of shots if ( lastNumber == -1 ) { // scan for a free number for ( lastNumber = 0 ; lastNumber <= 9999 ; lastNumber++ ) { R_ScreenshotFilename( lastNumber, checkname, ".tga" ); len = FS_ReadFile( checkname, NULL ); if ( len <= 0 ) { break; // file doesn't exist } } } else { R_ScreenshotFilename( lastNumber, checkname, ".tga" ); } if ( lastNumber == 10000 ) { VID_Printf (PRINT_ALL, "ScreenShot: Couldn't create a file\n"); return; } lastNumber++; } R_TakeScreenshot( 0, 0, glConfig.vidWidth, glConfig.vidHeight, checkname ); if ( !silent ) { VID_Printf (PRINT_ALL, "Wrote %s\n", checkname); } #endif }
void R_ScreenShotJPEG_f(void) { char checkname[MAX_OSPATH]; static int lastNumber = -1; qbool silent; if(!strcmp(ri.cmdargv(1), "levelshot")){ R_LevelShot(); return; } if(!strcmp(ri.cmdargv(1), "silent")){ silent = qtrue; }else{ silent = qfalse; } if(ri.cmdargc() == 2 && !silent){ /* explicit filename */ Q_sprintf(checkname, MAX_OSPATH, "screenshots/%s.jpg", ri.cmdargv(1)); }else{ /* scan for a free filename */ /* if we have saved a previous screenshot, don't scan * again, because recording demo avis can involve * thousands of shots */ if(lastNumber == -1){ lastNumber = 0; } /* scan for a free number */ for(; lastNumber <= 9999; lastNumber++){ R_ScreenshotFilenameJPEG(lastNumber, checkname); if(!ri.fsfileexists(checkname)){ break; /* file doesn't exist */ } } if(lastNumber == 10000){ ri.Printf (PRINT_ALL, "ScreenShot: Couldn't create a file\n"); return; } lastNumber++; } R_TakeScreenshot(0, 0, glConfig.vidWidth, glConfig.vidHeight, checkname, qtrue); if(!silent){ ri.Printf (PRINT_ALL, "Wrote %s\n", checkname); } }
//jpeg vession void R_ScreenShot_f (void) { char checkname[MAX_OSPATH]; static int lastNumber = -1; qboolean silent; if ( !strcmp( Cmd_Argv(1), "levelshot" ) ) { R_LevelShot(); return; } if ( !strcmp( Cmd_Argv(1), "silent" ) ) { silent = qtrue; } else { silent = qfalse; } if ( Cmd_Argc() == 2 && !silent ) { // explicit filename Com_sprintf( checkname, MAX_OSPATH, "screenshots/%s.jpg", Cmd_Argv( 1 ) ); } else { // scan for a free filename // if we have saved a previous screenshot, don't scan // again, because recording demo avis can involve // thousands of shots if ( lastNumber == -1 ) { lastNumber = 0; } // scan for a free number for ( ; lastNumber <= 9999 ; lastNumber++ ) { R_ScreenshotFilename( lastNumber, checkname, ".jpg" ); if (!FS_FileExists( checkname )) { break; // file doesn't exist } } if ( lastNumber == 10000 ) { Com_Printf ( "ScreenShot: Couldn't create a file\n"); return; } lastNumber++; } R_TakeScreenshotJPEG( 0, 0, glConfig.vidWidth, glConfig.vidHeight, checkname ); if ( !silent ) { Com_Printf ( "Wrote %s\n", checkname); } }