// NERVE - SMF static void CG_QuickMessage_f( void ) { if ( cg_quickMessageAlt.integer ) { trap_UI_Popup( "UIMENU_WM_QUICKMESSAGEALT" ); } else { trap_UI_Popup( "UIMENU_WM_QUICKMESSAGE" ); } }
void CG_QuickMessage_f(void) { CG_EventHandling(CGAME_EVENT_NONE, qfalse); if (cg_quickMessageAlt.integer) { trap_UI_Popup(UIMENU_WM_QUICKMESSAGEALT); } else { trap_UI_Popup(UIMENU_WM_QUICKMESSAGE); } }
void CG_QuickFireteamMessage_f( void ) { if( cgs.clientinfo[ cg.clientNum ].team == TEAM_SPECTATOR ) { return; } CG_EventHandling( CGAME_EVENT_NONE, qfalse ); if( cg_quickMessageAlt.integer ) { trap_UI_Popup( UIMENU_WM_FTQUICKMESSAGEALT ); } else { trap_UI_Popup( UIMENU_WM_FTQUICKMESSAGE ); } }
void CG_QuickMessage_f( void ) { if( cgs.clientinfo[ cg.clientNum ].team == TEAM_SPECTATOR && cgs.etpub < ETPUB_VERSION(0,7,0) ) { return; } CG_EventHandling( CGAME_EVENT_NONE, qfalse ); if( cg_quickMessageAlt.integer ) { trap_UI_Popup( UIMENU_WM_QUICKMESSAGEALT ); } else { trap_UI_Popup( UIMENU_WM_QUICKMESSAGE ); } }
// say, team say, etc static void CG_MessageMode_f(void) { char cmd[64]; if (cgs.eventHandling != CGAME_EVENT_NONE) { return; } // get the actual command trap_Argv(0, cmd, 64); // team say if (!Q_stricmp(cmd, "messagemode2")) { trap_Cvar_Set("cg_messageType", "2"); } // fireteam say else if (!Q_stricmp(cmd, "messagemode3")) { trap_Cvar_Set("cg_messageType", "3"); } // (normal) say else { trap_Cvar_Set("cg_messageType", "1"); } // clear the chat text trap_Cvar_Set("cg_messageText", ""); // open the menu trap_UI_Popup(UIMENU_INGAME_MESSAGEMODE); }
void CG_QuickFireteamAdmin_f( void ) { trap_UI_Popup( UIMENU_NONE ); if( cg.showFireteamMenu ) { if( cgs.ftMenuMode == 1 ) { CG_EventHandling( CGAME_EVENT_NONE, qfalse ); } else { cgs.ftMenuMode = 1; } } else if( cgs.clientinfo[ cg.clientNum ].team != TEAM_SPECTATOR ) { CG_EventHandling( CGAME_EVENT_FIRETEAMMSG, qfalse ); cgs.ftMenuMode = 1; } }
static void CG_OpenLimbo_f( void ) { int currentTeam; char buf[32]; // set correct team, also set current team to detect if its changed if ( cg.snap ) { currentTeam = cg.snap->ps.persistant[PERS_TEAM] - 1; } else { currentTeam = 0; } if ( currentTeam > 2 ) { currentTeam = 2; } // Arnout - don't set currentteam when following as it won't be the actual currentteam if ( currentTeam != mp_team.integer && !( cg.snap->ps.pm_flags & PMF_FOLLOW ) ) { trap_Cvar_Set( "mp_team", va( "%d", currentTeam ) ); } if ( currentTeam != mp_currentTeam.integer && !( cg.snap->ps.pm_flags & PMF_FOLLOW ) ) { trap_Cvar_Set( "mp_currentTeam", va( "%d", currentTeam ) ); } // set current player type if ( mp_currentPlayerType.integer != cg.snap->ps.stats[ STAT_PLAYER_CLASS ] ) { trap_Cvar_Set( "mp_currentPlayerType", va( "%i", cg.snap->ps.stats[ STAT_PLAYER_CLASS ] ) ); } // set isSpectator trap_Cvar_VariableStringBuffer( "ui_isSpectator", buf, 32 ); if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR && cg.snap->ps.pm_type != PM_INTERMISSION ) { trap_SendConsoleCommand( "+scores\n" ); // NERVE - SMF - blah if ( !atoi( buf ) ) { trap_Cvar_Set( "ui_isSpectator", "1" ); } } else { if ( atoi( buf ) ) { trap_Cvar_Set( "ui_isSpectator", "0" ); } } trap_UI_Popup( "UIMENU_WM_LIMBO" ); }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot(snapshot_t *snap) { int i; centity_t *cent; entityState_t *state; char buff[16]; cg.snap = snap; // trap_S_ClearSounds( qtrue ); BG_PlayerStateToEntityState(&snap->ps, &cg_entities[snap->ps.clientNum].currentState, cg.time, qfalse); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands(snap->serverCommandSequence); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(qfalse); for (i = 0 ; i < cg.snap->numEntities ; i++) { state = &cg.snap->entities[i]; cent = &cg_entities[state->number]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity(cent); // check for events CG_CheckEvents(cent); } trap_Cvar_VariableStringBuffer("r_oldMode", buff, sizeof(buff)); if (atoi(buff)) { // confirmation screen trap_UI_Popup(UIMENU_INGAME); } else if (cg.demoPlayback) { ccInitial = qtrue; } else { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer("mapname", curmap, 64); if (Q_stricmp(curmap, prevmap)) { strcpy(prevmap, curmap); if (cgs.campaignInfoLoaded) { if (!cg.showGameView) { CG_LimboMenu_f(); } /* } else { ccInitial = qtrue; // Start the Initial Camera if specified CG_StartInitialCamera(); */ } } } // remove motd window if (cg.motdWindow != NULL) { CG_windowFree(cg.motdWindow); cg.motdWindow = NULL; } // Activate alternate input handler during demo playback if (cg.demoPlayback) { CG_keyOn_f(); if (demo_infoWindow.integer > 0) { CG_ShowHelp_On(&cg.demohelpWindow); } } // update client XP for spectator frames if (cg.snap->ps.clientNum == cg.clientNum) // sanity check { int cXP = (32768 * cg.snap->ps.stats[STAT_XP_OVERFLOW]) + cg.snap->ps.stats[STAT_XP]; if (cg.xp < cXP) { cg.xpChangeTime = cg.time; } cg.xp = cXP; } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. ================== */ void CG_SetInitialSnapshot(snapshot_t *snap) { int i; centity_t *cent; char buff[16]; cg.snap = snap; BG_PlayerStateToEntityState(&snap->ps, &cg_entities[snap->ps.clientNum].currentState, qfalse); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands(snap->serverCommandSequence); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for (i = 0 ; i < cg.snap->numEntities ; ++i) { entityState_t *state = &cg.snap->entities[i]; cent = &cg_entities[state->number]; memcpy(¢->currentState, state, sizeof (entityState_t)); cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity(cent); // check for events CG_CheckEvents(cent); } cg_fxflags = 0; trap_Cvar_VariableStringBuffer("r_oldMode", buff, sizeof (buff)); if (atoi(buff)) { // Arnout: confirmation screen trap_UI_Popup(UIMENU_INGAME); } else if (!cg.demoPlayback) { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer("mapname", curmap, 64); if (Q_stricmp(curmap, prevmap)) { strcpy(prevmap, curmap); if (cgs.campaignInfoLoaded) { if (!cg.showGameView) { CG_LimboMenu_f(); } } } } // OSP - remove motd window if (cg.motdWindow != NULL) { CG_windowFree(cg.motdWindow); cg.motdWindow = NULL; } // Activate alternate input handler during demo playback if (cg.demoPlayback) { CG_keyOn_f(); if (demo_infoWindow.integer > 0) { CG_ShowHelp_On(&cg.demohelpWindow); } } }
void CG_TeamSelectMenu_f(void) { CG_EventHandling( CGAME_EVENT_NONE, qfalse ); trap_UI_Popup( UIMENU_WM_TEAMALT ); trap_SendConsoleCommand( "vstr select_team;"); }
static void CG_OpenLimbo_f( void ) { if ( cgs.gametype != GT_WOLF ) { return; } trap_UI_Popup( "UIMENU_WM_LIMBO" ); }
static void CG_QuickMessage_f( void ) { if ( cgs.gametype != GT_WOLF ) { return; } trap_UI_Popup( "UIMENU_WM_QUICKMESSAGE" ); }
static void CG_ServerCommand( void ) { const char *cmd; char text[MAX_SAY_TEXT]; cmd = CG_Argv( 0 ); if ( !cmd[0] ) { // server claimed the command return; } if ( !strcmp( cmd, "startCam" ) ) { CG_StartCamera( CG_Argv( 1 ), atoi( CG_Argv( 2 ) ) ); return; } if ( !strcmp( cmd, "stopCam" ) ) { CG_StopCamera(); return; } if ( !strcmp( cmd, "mvspd" ) ) { CG_RequestMoveSpeed( CG_Argv( 1 ) ); return; } if ( !strcmp( cmd, "dp" ) ) { // dynamite print (what a hack :( CG_CenterPrint( va( "%s %d %s", CG_translateString( "dynamitetimer" ), atoi( CG_Argv( 1 ) ), CG_translateString( "seconds" ) ), SCREEN_HEIGHT - ( SCREEN_HEIGHT * 0.25 ), SMALLCHAR_WIDTH ); return; } if ( !strcmp( cmd, "cp" ) ) { CG_CenterPrint( CG_Argv( 1 ), SCREEN_HEIGHT - ( SCREEN_HEIGHT * 0.25 ), SMALLCHAR_WIDTH ); return; } if ( !strcmp( cmd, "cs" ) ) { CG_ConfigStringModified(); return; } if ( !strcmp( cmd, "print" ) ) { CG_Printf( "%s", CG_Argv( 1 ) ); #ifdef MISSIONPACK cmd = CG_Argv( 1 ); // yes, this is obviously a hack, but so is the way we hear about // votes passing or failing if ( !Q_stricmpn( cmd, "vote failed", 11 ) || !Q_stricmpn( cmd, "team vote failed", 16 ) ) { trap_S_StartLocalSound( cgs.media.voteFailed, CHAN_ANNOUNCER ); } else if ( !Q_stricmpn( cmd, "vote passed", 11 ) || !Q_stricmpn( cmd, "team vote passed", 16 ) ) { trap_S_StartLocalSound( cgs.media.votePassed, CHAN_ANNOUNCER ); } #endif return; } if ( !strcmp( cmd, "chat" ) ) { if ( !cg_teamChatsOnly.integer ) { trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT ); CG_RemoveChatEscapeChar( text ); CG_Printf( "%s\n", text ); } return; } if ( !strcmp( cmd, "tchat" ) ) { trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT ); CG_RemoveChatEscapeChar( text ); CG_AddToTeamChat( text ); CG_Printf( "%s\n", text ); return; } // NERVE - SMF - limbo chat if ( !strcmp( cmd, "lchat" ) ) { trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT ); CG_RemoveChatEscapeChar( text ); // CG_AddToLimboChat( text ); trap_UI_LimboChat( text ); CG_Printf( "%s\n", text ); return; } // -NERVE - SMF if ( !strcmp( cmd, "vchat" ) ) { // CG_VoiceChat( SAY_ALL ); return; } if ( !strcmp( cmd, "vtchat" ) ) { // CG_VoiceChat( SAY_TEAM ); return; } if ( !strcmp( cmd, "vtell" ) ) { // CG_VoiceChat( SAY_TELL ); return; } if ( !strcmp( cmd, "scores" ) ) { CG_ParseScores(); return; } if ( !strcmp( cmd, "tinfo" ) ) { CG_ParseTeamInfo(); return; } if ( !strcmp( cmd, "map_restart" ) ) { CG_MapRestart(); return; } if ( Q_stricmp( cmd, "remapShader" ) == 0 ) { if ( trap_Argc() == 4 ) { trap_R_RemapShader( CG_Argv( 1 ), CG_Argv( 2 ), CG_Argv( 3 ) ); } } // loaddeferred can be both a servercmd and a consolecmd if ( !strcmp( cmd, "loaddeferred" ) ) { // spelling fixed (SA) CG_LoadDeferredPlayers(); return; } // clientLevelShot is sent before taking a special screenshot for // the menu system during development if ( !strcmp( cmd, "clientLevelShot" ) ) { cg.levelShot = qtrue; return; } // NERVE - SMF if ( !Q_stricmp( cmd, "oid" ) ) { CG_ObjectivePrint( CG_Argv( 2 ), SMALLCHAR_WIDTH, atoi( CG_Argv( 1 ) ) ); return; } // -NERVE - SMF // // music // // loops \/ if ( !strcmp( cmd, "mu_start" ) ) { // has optional parameter for fade-up time int fadeTime = 0; // default to instant start Q_strncpyz( text, CG_Argv( 2 ), MAX_SAY_TEXT ); if ( text && strlen( text ) ) { fadeTime = atoi( text ); } trap_S_StartBackgroundTrack( CG_Argv( 1 ), CG_Argv( 1 ), fadeTime ); return; } // plays once then back to whatever the loop was \/ if ( !strcmp( cmd, "mu_play" ) ) { // has optional parameter for fade-up time int fadeTime = 0; // default to instant start Q_strncpyz( text, CG_Argv( 2 ), MAX_SAY_TEXT ); if ( text && strlen( text ) ) { fadeTime = atoi( text ); } trap_S_StartBackgroundTrack( CG_Argv( 1 ), "onetimeonly", fadeTime ); return; } if ( !strcmp( cmd, "mu_stop" ) ) { // has optional parameter for fade-down time int fadeTime = 0; // default to instant stop Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT ); if ( text && strlen( text ) ) { fadeTime = atoi( text ); } trap_S_FadeBackgroundTrack( 0.0f, fadeTime, 0 ); trap_S_StartBackgroundTrack( "", "", -2 ); // '-2' for 'queue looping track' (QUEUED_PLAY_LOOPED) return; } if ( !strcmp( cmd, "mu_fade" ) ) { trap_S_FadeBackgroundTrack( atof( CG_Argv( 1 ) ), atoi( CG_Argv( 2 ) ), 0 ); return; } if ( !strcmp( cmd, "snd_fade" ) ) { trap_S_FadeAllSound( atof( CG_Argv( 1 ) ), atoi( CG_Argv( 2 ) ) ); return; } if ( !strcmp( cmd, "rockandroll" ) ) { // map loaded, game is ready to begin. CG_Fade( 0, 0, 0, 255, cg.time, 0 ); // go black trap_UI_Popup( "pregame" ); // start pregame menu trap_Cvar_Set( "cg_norender", "1" ); // don't render the world until the player clicks in and the 'playerstart' func has been called (g_main in G_UpdateCvars() ~ilne 949) trap_S_FadeAllSound( 1.0f, 1000 ); // fade sound up return; } // ensure a file gets into a build (mainly for scripted music calls) if ( !strcmp( cmd, "addToBuild" ) ) { fileHandle_t f; if ( !cg_buildScript.integer ) { return; } // just open the file so it gets copied to the build dir //CG_FileTouchForBuild(CG_Argv(1)); trap_FS_FOpenFile( CG_Argv( 1 ), &f, FS_READ ); trap_FS_FCloseFile( f ); return; } CG_Printf( "Unknown client game command: %s\n", cmd ); }
void CG_ClassSelectMenu_f(void) { CG_EventHandling( CGAME_EVENT_NONE, qfalse ); trap_UI_Popup( UIMENU_WM_CLASSALT ); trap_SendConsoleCommand( "vstr select_class;"); }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; char buff[16]; cg.snap = snap; // trap_S_ClearSounds( qtrue ); BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn( qfalse ); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } cg_fxflags = 0; trap_Cvar_VariableStringBuffer( "r_oldMode", buff, sizeof(buff) ); if( atoi(buff) ) { // Arnout: confirmation screen trap_UI_Popup( UIMENU_INGAME ); } else if(cg.demoPlayback) { ccInitial = qtrue; } else { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer( "mapname", curmap, 64 ); if ( Q_stricmp( curmap, prevmap ) ) { strcpy( prevmap, curmap ); if(cgs.campaignInfoLoaded) { if( !cg.showGameView ) { CG_LimboMenu_f(); } /* } else { ccInitial = qtrue; // Start the Initial Camera if specified CG_StartInitialCamera(); */ } } } // OSP - remove motd window if(cg.motdWindow != NULL) { CG_windowFree(cg.motdWindow); cg.motdWindow = NULL; } // Activate alternate input handler during demo playback if(cg.demoPlayback) { CG_keyOn_f(); if(demo_infoWindow.integer > 0) { CG_ShowHelp_On(&cg.demohelpWindow); } } // OSP #if __MACOS__ #ifdef GAMERANGER // LBO 12/13/04. Add support for GameRanger team voice IDs GRSetMyTeamID(cg.snap->ps.persistant[PERS_TEAM]); #endif #endif }
/* ================== CG_EventHandling ================== */ void CG_EventHandling( int type, qboolean fForced ) { // CG_Printf("EventHandling: %d\n", type); if( cg.demoPlayback && type == CGAME_EVENT_NONE && !fForced ) { type = CGAME_EVENT_DEMO; } if( type != CGAME_EVENT_NONE ) { trap_Cvar_Set( "cl_bypassMouseInput", 0 ); } switch( type ) { // OSP - Demo support case CGAME_EVENT_DEMO: cgs.fResize = qfalse; cgs.fSelect = qfalse; cgs.cursorUpdate = cg.time + 10000; cgs.timescaleUpdate = cg.time + 4000; CG_ScoresUp_f(); break; case CGAME_EVENT_SPEAKEREDITOR: case CGAME_EVENT_GAMEVIEW: case CGAME_EVENT_NONE: case CGAME_EVENT_CAMPAIGNBREIFING: case CGAME_EVENT_FIRETEAMMSG: case CGAME_EVENT_MULTIVIEW: default: // default handling (cleanup mostly) if( cgs.eventHandling == CGAME_EVENT_HUDEDITOR) { // forty - visual hud editor cg.hudEditor.showHudEditor = qfalse; } else if(cgs.eventHandling == CGAME_EVENT_MULTIVIEW) { if( type == -CGAME_EVENT_MULTIVIEW) { type = CGAME_EVENT_NONE; } else { trap_Key_SetCatcher( KEYCATCH_CGAME ); return; } } else if( cgs.eventHandling == CGAME_EVENT_GAMEVIEW ) { cg.showGameView = qfalse; trap_S_FadeBackgroundTrack( 0.0f, 500, 0 ); trap_S_StopStreamingSound( -1 ); cg.limboEndCinematicTime = 0; if( fForced ) { if( cgs.limboLoadoutModified ) { trap_SendClientCommand( "rs" ); cgs.limboLoadoutSelected = qfalse; } } } else if( cgs.eventHandling == CGAME_EVENT_SPEAKEREDITOR ) { if( type == -CGAME_EVENT_SPEAKEREDITOR ) { type = CGAME_EVENT_NONE; } else { trap_Key_SetCatcher( KEYCATCH_CGAME ); return; } } else if( cgs.eventHandling == CGAME_EVENT_CAMPAIGNBREIFING ) { type = CGAME_EVENT_GAMEVIEW; } else if( cgs.eventHandling == CGAME_EVENT_FIRETEAMMSG ) { cg.showFireteamMenu = qfalse; trap_Cvar_Set( "cl_bypassmouseinput", "0" ); } else if( cg.snap && cg.snap->ps.pm_type == PM_INTERMISSION && fForced ) { trap_UI_Popup( UIMENU_INGAME ); } break; } cgs.eventHandling = type; if(type == CGAME_EVENT_NONE) { trap_Key_SetCatcher(trap_Key_GetCatcher() & ~KEYCATCH_CGAME); ccInitial = qfalse; if(cg.demoPlayback && cg.demohelpWindow != SHOW_OFF) { CG_ShowHelp_Off(&cg.demohelpWindow); } } else if( type == CGAME_EVENT_HUDEDITOR ) { // forty - visual hud editor cg.hudEditor.showHudEditor = qtrue; trap_Key_SetCatcher(KEYCATCH_CGAME); } else if( type == CGAME_EVENT_MULTIVIEW ) { trap_Key_SetCatcher(KEYCATCH_CGAME); } else if( type == CGAME_EVENT_GAMEVIEW ) { cg.showGameView = qtrue; CG_LimboPanel_Setup(); trap_Key_SetCatcher(KEYCATCH_CGAME); } else if( type == CGAME_EVENT_FIRETEAMMSG ) { cgs.ftMenuPos = -1; cgs.ftMenuMode = 0; cg.showFireteamMenu = qtrue; trap_Cvar_Set( "cl_bypassmouseinput", "1" ); trap_Key_SetCatcher(KEYCATCH_CGAME); } else { trap_Key_SetCatcher(KEYCATCH_CGAME); } }
// kw: TODO: make this menu dynamic, showing spawnpoint names void CG_SpawnSelectMenu_f(void) { CG_EventHandling( CGAME_EVENT_NONE, qfalse ); trap_UI_Popup( UIMENU_WM_SPAWNALT ); trap_SendConsoleCommand( "vstr select_spawnpoint;"); }