diff --git a/code/cgame/cg_consolecmds.c b/code/cgame/cg_consolecmds.c index c8f8019..746f1f4 100644 --- a/code/cgame/cg_consolecmds.c +++ b/code/cgame/cg_consolecmds.c @@ -565,7 +565,6 @@ void CG_InitConsoleCommands( void ) { trap_AddCommand ("noclip"); trap_AddCommand ("team"); trap_AddCommand ("follow"); - trap_AddCommand ("levelshot"); trap_AddCommand ("addbot"); trap_AddCommand ("setviewpos"); trap_AddCommand ("callvote"); diff --git a/code/cgame/cg_draw.c b/code/cgame/cg_draw.c index 554f4f1..55e7155 100644 --- a/code/cgame/cg_draw.c +++ b/code/cgame/cg_draw.c @@ -2524,11 +2524,6 @@ static void CG_Draw2D(stereoFrame_t stereoFrame) CG_CheckOrderPending(); } #endif - // if we are taking a levelshot for the menu, don't draw anything - if ( cg.levelShot ) { - return; - } - if ( cg_draw2D.integer == 0 ) { return; } diff --git a/code/cgame/cg_local.h b/code/cgame/cg_local.h index d000916..7ee6658 100644 --- a/code/cgame/cg_local.h +++ b/code/cgame/cg_local.h @@ -457,7 +457,6 @@ typedef struct { int clientNum; qboolean demoPlayback; - qboolean levelShot; // taking a level menu screenshot int deferredPlayerLoading; qboolean loading; // don't defer players at initial startup qboolean intermissionStarted; // don't play voice rewards, because game will end shortly diff --git a/code/cgame/cg_servercmds.c b/code/cgame/cg_servercmds.c index 7761646..13bf25f 100644 --- a/code/cgame/cg_servercmds.c +++ b/code/cgame/cg_servercmds.c @@ -1093,13 +1093,6 @@ static void CG_ServerCommand( void ) { return; } - // clientLevelShot is sent before taking a special screenshot for - // the menu system during development - if ( !strcmp( cmd, "clientLevelShot" ) ) { - cg.levelShot = qtrue; - return; - } - CG_Printf( "Unknown client game command: %s\n", cmd ); } diff --git a/code/client/cl_cgame.c b/code/client/cl_cgame.c index 3c351a1..9c7106f 100644 --- a/code/client/cl_cgame.c +++ b/code/client/cl_cgame.c @@ -345,25 +345,6 @@ rescan: return qtrue; } - // the clientLevelShot command is used during development - // to generate 128*128 screenshots from the intermission - // point of levels for the menu system to use - // we pass it along to the cgame to make apropriate adjustments, - // but we also clear the console and notify lines here - if ( !strcmp( cmd, "clientLevelShot" ) ) { - // don't do it if we aren't running the server locally, - // otherwise malicious remote servers could overwrite - // the existing thumbnails - if ( !com_sv_running->integer ) { - return qfalse; - } - // close the console - Con_Close(); - // take a special screenshot next frame - Cbuf_AddText( "wait ; wait ; wait ; wait ; screenshot levelshot\n" ); - return qtrue; - } - // we may want to put a "connect to other server" command here // cgame can now act on the command diff --git a/code/game/ai_main.c b/code/game/ai_main.c index fb37c28..95d0b15 100644 --- a/code/game/ai_main.c +++ b/code/game/ai_main.c @@ -1021,8 +1021,6 @@ int BotAI(int client, float thinktime) { #endif else if (!Q_stricmp(buf, "scores")) { /*FIXME: parse scores?*/ } - else if (!Q_stricmp(buf, "clientLevelShot")) - { /*ignore*/ } } //add the delta angles to the bot's current view angles for (j = 0; j < 3; j++) { diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index 06df2db..d788273 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -379,37 +379,57 @@ void Cmd_Noclip_f( gentity_t *ent ) { ================== Cmd_LevelShot_f -This is just to help generate the level pictures -for the menus. It goes to the intermission immediately -and sends over a command to the client to resize the view, -hide the scoreboard, and take a special screenshot +A hack. Creating screenshots at the intermission camera +location (for use in map thumbnails) is made easy. ================== */ void Cmd_LevelShot_f( gentity_t *ent ) { + int draw2D; + char arg[ 20 ]; + int wait; + if ( !CheatsOk( ent ) ) { return; } // doesn't work in single player if ( g_gametype.integer != 0 ) { - trap_SendServerCommand( ent-g_entities, + trap_SendServerCommand( ent-g_entities, "print \"Must be in g_gametype 0 for levelshot\n\"" ); return; } - BeginIntermission(); - trap_SendServerCommand( ent-g_entities, "clientLevelShot" ); + // must be executed locally + if ( !ent->client->pers.localClient ) { + trap_SendServerCommand( ent-g_entities, + "print \"The levelshot command must be executed by a local client\n\"" ); + return; + } + + draw2D = trap_Cvar_VariableIntegerValue( "cg_draw2D" ); // back up the old cg_draw2D setting + trap_Cvar_Set( "cg_draw2D", "0" ); // stop the cgame from drawing the HUD or any text + + if( ent->client->pers.cmd.buttons & BUTTON_TALK ) // apparently the console is down + trap_SendConsoleCommand( EXEC_APPEND, "toggleconsole\n" ); // close it + + // just in case we want to wait some more or some less, before taking the screenshot + if( trap_Argc() >= 2 ) { + trap_Argv( 1, arg, sizeof( arg ) ); + wait = atoi( arg ); + } + else + wait = 100; + + BeginIntermission(); // prepare the camera + // allow the state to settle; take the screenshot; restore the old cg_draw2D setting + trap_SendConsoleCommand( EXEC_APPEND, va( + "wait %i ; screenshot levelshot ; set cg_draw2D %i\n", wait, draw2D ) ); } /* ================== -Cmd_LevelShot_f - -This is just to help generate the level pictures -for the menus. It goes to the intermission immediately -and sends over a command to the client to resize the view, -hide the scoreboard, and take a special screenshot +Cmd_TeamTask_f ================== */ void Cmd_TeamTask_f( gentity_t *ent ) {