commit 131bb8293be74db4c09162a317e16ff63eab2414 Author: devhc Date: Mon Feb 7 18:49:25 2011 +0100 levelshot resurrection diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index 7ce6650..d788273 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -377,6 +377,58 @@ void Cmd_Noclip_f( gentity_t *ent ) { /* ================== +Cmd_LevelShot_f + +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, + "print \"Must be in g_gametype 0 for levelshot\n\"" ); + return; + } + + // 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_TeamTask_f ================== */ @@ -1622,6 +1674,8 @@ void ClientCommand( int clientNum ) { Cmd_Kill_f (ent); else if (Q_stricmp (cmd, "teamtask") == 0) Cmd_TeamTask_f (ent); + else if (Q_stricmp (cmd, "levelshot") == 0) + Cmd_LevelShot_f (ent); else if (Q_stricmp (cmd, "follow") == 0) Cmd_Follow_f (ent); else if (Q_stricmp (cmd, "follownext") == 0)