Esempio n. 1
0
/*
=================
UI_ConsoleCommand
=================
*/
qboolean UI_ConsoleCommand( int realTime ) {
	char	*cmd;

	uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
	uiInfo.uiDC.realTime = realTime;

	cmd = UI_Argv( 0 );

	// ensure minimum menu data is available
	//Menu_Cache();

	if ( Q_stricmp (cmd, "ui_test") == 0 ) {
		UI_ShowPostGame(qtrue);
	}

	if ( Q_stricmp (cmd, "ui_report") == 0 ) {
		UI_Report();
		return qtrue;
	}
	
	if ( Q_stricmp (cmd, "ui_load") == 0 ) {
		UI_Load();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "remapShader") == 0 ) {
		if (trap_Argc() == 4) {
			char shader1[MAX_QPATH];
			char shader2[MAX_QPATH];
			Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
			Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
			trap_R_RemapShader(shader1, shader2, UI_Argv(3));
			return qtrue;
		}
	}

	if ( Q_stricmp (cmd, "postgame") == 0 ) {
		UI_CalcPostGameStats();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_cache") == 0 ) {
		UI_Cache_f();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) {
		//UI_TeamOrdersMenu_f();
		return qtrue;
	}


	if ( Q_stricmp (cmd, "ui_cdkey") == 0 ) {
		//UI_CDKeyMenu_f();
		return qtrue;
	}

	return qfalse;
}
Esempio n. 2
0
qboolean UI_ConsoleCommand( int realTime ) {
	char *cmd = UI_Argv( 0 );

	uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
	uiInfo.uiDC.realTime = realTime;

	if ( Q_stricmp( cmd, "ui_report" ) == 0 ) {
		UI_Report();
		return qtrue;
	}

	if ( Q_stricmp( cmd, "ui_load" ) == 0 ) {
		UI_Load();
		return qtrue;
	}

	if ( Q_stricmp( cmd, "ui_opensiegemenu" ) == 0 ) {
		if ( trap->Cvar_VariableValue( "g_gametype" ) == GT_SIEGE ) {
			Menus_CloseAll();
			if ( Menus_ActivateByName( UI_Argv( 1 ) ) ) {
				trap->Key_SetCatcher( KEYCATCH_UI );
			}
		}
		return qtrue;
	}

	if ( !Q_stricmp( cmd, "ui_openmenu" ) ) {
		Menus_CloseAll();
		if ( Menus_ActivateByName( UI_Argv( 1 ) ) ) {
			trap->Key_SetCatcher( KEYCATCH_UI );
		}
		return qtrue;
	}

	if ( Q_stricmp( cmd, "ui_cache" ) == 0 ) {
		UI_Cache_f();
		return qtrue;
	}

	if ( Q_stricmp( cmd, "ui_teamOrders" ) == 0 ) {
		return qtrue;
	}

	if ( Q_stricmp( cmd, "ui_cdkey" ) == 0 ) {
		return qtrue;
	}

	return qfalse;
}
Esempio n. 3
0
char *UI_ConcatArgs( int arg, char *buf, int len )
{
  char *p;
  int c;

  if( len <= 0 )
    return buf;

  p = buf;
  c = trap_Argc();

  for( ; arg < c; arg++ )
  {
    char *argp = UI_Argv( arg );

    while( *argp && p < &buf[ len - 1 ] )
      *p++ = *argp++;

    if( p < &buf[ len - 2 ] )
      *p++ = ' ';
    else
      break;
  }

  *p = '\0';

  return buf;
}
Esempio n. 4
0
/*
===============
UI_CinematicsMenu_f
===============
*/
void UI_CinematicsMenu_f( void ) {
	int		n;

	n = atoi( UI_Argv( 1 ) );
	UI_CinematicsMenu();
	Menu_SetCursorToItem( &cinematicsMenuInfo.menu, cinematicsMenuInfo.menu.items[n + 3] );
}
Esempio n. 5
0
static void UI_MessageMode_f( void )
{
  char *arg = UI_Argv( 0 );

  trap_Cvar_Set( "ui_sayBuffer", "" );

  switch( arg[ 11 ] )
  {
    default:
    case '\0':
      // Global
      uiInfo.chatTeam             = qfalse;
      break;

    case '2':
      // Team
      uiInfo.chatTeam             = qtrue;
      break;
  }

  trap_Key_SetCatcher( KEYCATCH_UI );
  Menus_CloseByName( "say" );
  Menus_CloseByName( "say_team" );

  if( uiInfo.chatTeam )
    Menus_ActivateByName( "say_team" );
  else
    Menus_ActivateByName( "say" );
}
Esempio n. 6
0
static void UI_Menu_f( void )
{
    if( Menu_Count( ) > 0 )
    {
      trap_Key_SetCatcher( KEYCATCH_UI );
      Menus_ActivateByName( UI_Argv( 1 ) );
    }
}
Esempio n. 7
0
/*
=================
UI_SPPostgameMenu_f
=================
*/
void UI_SPPostgameMenu_f( void ) {
	int			playerGameRank;
//	int			oldFrags, newFrags;
	const char	*arena;
	char		map[MAX_QPATH];
	char		info[MAX_INFO_STRING];

	Mouse_Show();

	memset( &postgameMenuInfo, 0, sizeof(postgameMenuInfo) );

	trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) );
	postgameMenuInfo.serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) );

	postgameMenuInfo.menu.nobackground = qtrue;

	trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
	Q_strncpyz( map, Info_ValueForKey( info, "mapname" ), sizeof(map) );
	arena = UI_GetArenaInfoByMap( map );
	if ( !arena ) {
		return;
	}
	Q_strncpyz( arenainfo, arena, sizeof(arenainfo) );

	postgameMenuInfo.level = atoi( Info_ValueForKey( arenainfo, "num" ) );

	playerGameRank = 8;		// in case they ended game as a spectator
	playerGameRank = atoi( UI_Argv(1));

	UI_SetBestScore( postgameMenuInfo.level, playerGameRank+1 );

	postgameMenuInfo.starttime = uis.realtime;
	postgameMenuInfo.scoreboardtime = uis.realtime;

	trap_Key_SetCatcher( KEYCATCH_UI );
	uis.menusp = 0;

	UI_SPPostgameMenu_Init();
	UI_PushMenu( &postgameMenuInfo.menu );

	if (playerGameRank == 0) 
	{
		postgameMenuInfo.won = 1;
		Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_next );
	}
	else {
		Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_menu );
	}

//	trap_Cmd_ExecuteText( EXEC_APPEND, "music music/win\n" );	//?? always win?  should this be deleted and playing cg_scoreboard now?

	postgameMenuInfo.lastTier = UI_GetNumSPTiers();
	if ( UI_GetSpecialArenaInfo( "final" ) ) {
		postgameMenuInfo.lastTier++;
	}
}
/*
===============
UI_HelpMenu_SetTopic
===============
*/
static void UI_HelpMenu_SetTopic( void ) {
	char	*arg;
	char	info[MAX_INFO_STRING];
	int		gametype;

	if ( trap_Argc() > 1 ) {
		arg = UI_Argv( 1 );

		if ( Q_stricmp( arg, "gametype" ) == 0 ) {
			helpList	= HELP_GAMETYPE;

			trap_GetConfigString( CS_SERVERINFO, info, sizeof( info ) );
			gametype = atoi( Info_ValueForKey( info, "g_gametype" ) );
			if ( ( gametype < 0 ) || ( gametype > GT_MAX_GAME_TYPE ) ) {
				gametype = GT_MAX_GAME_TYPE;
			}
			
			helpIndex	= GAMETYPE_REMAP[gametype];
			helpMin		= helpIndex;
			helpMax		= helpIndex;

			helpMenuInfo.prev.generic.flags = QMF_HIDDEN;
			helpMenuInfo.next.generic.flags = QMF_HIDDEN;

			helpMenuInfo.width	= HMI_GAMETYPE_W;
			helpMenuInfo.height	= HMI_GAMETYPE_H;
			helpMenuInfo.x		= HMI_GAMETYPE_X;
			helpMenuInfo.y		= HMI_GAMETYPE_Y;
		}
		else {
			helpMin		= 0;
			helpMax		= ( NUM_HELP_ITEM - 1 );
			helpList	= HELP_ITEM;
			helpIndex	= helpMin;
			helpMenuInfo.width	= HMI_ITEM_W;
			helpMenuInfo.height	= HMI_ITEM_H;
			helpMenuInfo.x		= HMI_ITEM_X;
			helpMenuInfo.y		= HMI_ITEM_Y;
		}
	}
	else {
		helpMin		= 0;
		helpMax		= ( NUM_HELP_ITEM - 1 );
		helpList	= HELP_ITEM;
		helpIndex	= helpMax;
		helpMenuInfo.width	= HMI_ITEM_W;
		helpMenuInfo.height	= HMI_ITEM_H;
		helpMenuInfo.x		= HMI_ITEM_X;
		helpMenuInfo.y		= HMI_ITEM_Y;
	}

	UI_HelpMenu_AdjustButtons();
}
Esempio n. 9
0
qboolean UI_ConsoleCommand( void )
{
	char	*cmd;

	if (!ui.SG_GameAllowedToSaveHere(qtrue))	//only check if incamera
	{
		return qfalse;
	}

	cmd = UI_Argv( 0 );

	// ensure minimum menu data is available
	Menu_Cache();

	if ( Q_stricmp (cmd, "ui_cache") == 0 )
	{
		UI_Cache_f();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "levelselect") == 0 )
	{
		UI_LoadMenu_f();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_teamOrders") == 0 )
	{
		UI_SaveMenu_f();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_report") == 0 )
	{
		UI_Report();
		return qtrue;
	}

#ifndef JK2_MODE
	if ( Q_stricmp (cmd, "ui_load") == 0 )
	{
		UI_Load();
		return qtrue;
	}
#endif

	return qfalse;
}
Esempio n. 10
0
/*
=================
UI_ConsoleCommand
=================
*/
qboolean UI_ConsoleCommand(int realTime)
{
  	struct uicmd *cmd = bsearch( UI_Argv( 0 ), commands,
    	ARRAY_LEN( commands ), sizeof( commands[ 0 ] ),
    	commandComp );

	uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
	uiInfo.uiDC.realTime = realTime;

  	if( cmd )
	{
	    cmd->function( );
		return qtrue;
	}
	
	return qfalse;
}
Esempio n. 11
0
/*
=================
UI_ConsoleCommand
=================
*/
qboolean UI_ConsoleCommand( int realTime ) {
    char	*cmd;
    uiClientState_t	cstate;

    uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
    uiInfo.uiDC.realTime = realTime;

    cmd = UI_Argv( 0 );

    // ensure minimum menu data is available
    //Menu_Cache();

    if ( Q_stricmp (cmd, "ui_test") == 0 ) {
        UI_ShowPostGame(qtrue);
    }

    if ( Q_stricmp (cmd, "ui_report") == 0 ) {
        UI_Report();
        return qtrue;
    }

    if ( Q_stricmp (cmd, "ui_load") == 0 ) {
        UI_Load();
        return qtrue;
    }

    // Arnout: we DEFINATELY do NOT want this here
    /*if ( Q_stricmp (cmd, "remapShader") == 0 ) {
    	if (trap_Argc() == 4) {
    		char shader1[MAX_QPATH];
    		char shader2[MAX_QPATH];
    		Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
    		Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
    		trap_R_RemapShader(shader1, shader2, UI_Argv(3));
    		return qtrue;
    	}
    }*/

    if ( Q_stricmp (cmd, "postgame") == 0 ) {
        UI_CalcPostGameStats();
        return qtrue;
    }

    if ( Q_stricmp (cmd, "ui_cache") == 0 ) {
        UI_Cache_f();
        return qtrue;
    }

    if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) {
        //UI_TeamOrdersMenu_f();
        return qtrue;
    }


    if ( Q_stricmp (cmd, "ui_cdkey") == 0 ) {
        //UI_CDKeyMenu_f();
        return qtrue;
    }

    if( Q_stricmp( cmd, "iamacheater" ) == 0 ) {
        int i;

        // unlock all available levels and campaigns for SP
        for( i = 0; i < uiInfo.campaignCount; i++ ) {
            if( uiInfo.campaignList[i].typeBits & (1<<GT_SINGLE_PLAYER) ) {
                uiInfo.campaignList[i].unlocked = qtrue;
                uiInfo.campaignList[i].progress = uiInfo.campaignList[i].mapCount;
            }
        }
        return qtrue;
    }

    trap_GetClientState( &cstate );
    if( cstate.connState == CA_DISCONNECTED ) {
        if( Q_stricmp( cmd, "campaign" ) == 0 ) {
            UI_Campaign_f();
            return qtrue;
        }

        if( Q_stricmp( cmd, "listcampaigns" ) == 0 ) {
            UI_ListCampaigns_f();
            return qtrue;
        }
    }

    return qfalse;
}
Esempio n. 12
0
qboolean UI_ConsoleCommand(int realTime)
{
    char *cmd;

    uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
    uiInfo.uiDC.realTime = realTime;

    cmd = UI_Argv(0);

    // ensure minimum menu data is available
    //Menu_Cache();

    if (Q_stricmp(cmd, "ui_test") == 0) {
        UI_ShowPostGame(qtrue);
    }

    if (Q_stricmp(cmd, "ui_report") == 0) {
        UI_Report();
        return qtrue;
    }

    if (Q_stricmp(cmd, "ui_load") == 0) {
        UI_Load();
        return qtrue;
    }

    if (Q_stricmp(cmd, "remapShader") == 0) {
        //Makro - disabling shader remapping when cheats are off
        if (trap_Cvar_VariableValue("sv_cheats") == 1) {
            if (trap_Argc() >= 4) {
                char shader1[MAX_QPATH];
                char shader2[MAX_QPATH];

                Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
                Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
                trap_R_RemapShader(shader1, shader2, UI_Argv(3));
            } else
                //Makro - if no offset is specified, use 0
                if (trap_Argc() == 3) {
                    char shader1[MAX_QPATH];
                    char shader2[MAX_QPATH];

                    Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
                    Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
                    trap_R_RemapShader(shader1, shader2, 0);
                } else
                    Com_Printf("Usage: remapShader <oldShader> <newShader> [timeOffset]\n");
        } else
            Com_Printf("Shader remapping is cheat-protected\n");
        return qtrue;
    }

    if (Q_stricmp(cmd, "postgame") == 0) {
        UI_CalcPostGameStats();
        return qtrue;
    }

    if (Q_stricmp(cmd, "ui_cache") == 0) {
        UI_Cache_f();
        return qtrue;
    }

    if (Q_stricmp(cmd, "ui_teamOrders") == 0) {
        //UI_TeamOrdersMenu_f();
        return qtrue;
    }

    if (Q_stricmp(cmd, "ui_cdkey") == 0) {
        //UI_CDKeyMenu_f();
        return qtrue;
    }
    //Makro - adding popup for choose commands
    if (Q_stricmp(cmd, "ui_RQ3_loadout") == 0) {
        if (UI_RQ3_WeaponMenuAccess())
            _UI_SetActiveMenu(UIMENU_RQ3_WEAPON);
        else
            Com_Printf("Weapon/item menus are not available in this gametype.\n");
        return qtrue;
    }
    //Makro - join menu
    if (Q_stricmp(cmd, "ui_RQ3_joinTeam") == 0) {
        _UI_SetActiveMenu(UIMENU_RQ3_JOIN);
        return qtrue;
    }
    //Makro - tkok menu
    if (Q_stricmp(cmd, "ui_RQ3_tkok") == 0) {
        if (trap_Cvar_VariableValue("g_gametype") >= GT_TEAM)
            _UI_SetActiveMenu(UIMENU_RQ3_TKOK);
        else
            Com_Printf("Not playing a team-based game.\n");
        return qtrue;
    }
    //Makro - presets menu
    if (Q_stricmp(cmd, "ui_RQ3_presets") == 0) {
        _UI_SetActiveMenu(UIMENU_RQ3_PRESETS);
        return qtrue;
    }
    //Makro - I've always wanted a command to inc/dec a cvar :)
    if (Q_stricmp(cmd, "inc") == 0) {
        if (trap_Argc() >= 2) {
            char cvar[MAX_CVAR_VALUE_STRING];
            float amount = 1;
            float val;
            int max = 0;

            Q_strncpyz(cvar, UI_Argv(1), sizeof(cvar));
            val = trap_Cvar_VariableValue(cvar);

            if (trap_Argc() >= 3) {
                amount = atof(UI_Argv(2));
                if (trap_Argc() >= 4) {
                    max = atoi(UI_Argv(3));
                }
            }
            if (max != 0) {
                trap_Cvar_SetValue(cvar, (float) (((int) (val + amount)) % max));
            } else {
                trap_Cvar_SetValue(cvar, val + amount);
            }
        } else {
            Com_Printf("Usage: inc <cvarName> [amount] [max]\n");
        }
        return qtrue;
    }
    /*
    	if ( Q_stricmp (cmd, "ifCvars") == 0) {
    		if (trap_Argc() >= 4) {
    			char cvar[MAX_CVAR_VALUE_STRING], cvarValue[MAX_CVAR_VALUE_STRING];
    			char *val = "";
    			char command[256];
    			char script[1024];
    			qboolean doScript = qfalse;
    			int i;

    			Q_strncpyz(cvar, UI_Argv(1), sizeof(cvar));
    			Q_strncpyz(cvarValue, UI_Argv(2), sizeof(cvarValue));
    			memset(script, 0, sizeof(script));

    			for (i=3; i<trap_Argc(); i++) {
    				Q_strncpyz(command, UI_Argv(i), sizeof(command));
    				Q_strcat(script, sizeof(script), command);
    				if (trap_Argc()-i > 1) {
    					Q_strcat(script, sizeof(script), " ");
    				}
    			}
    			val = UI_Cvar_VariableString(cvar);

    			if (Q_stricmp(val, cvarValue) == 0) {
    				doScript = qtrue;
    				Com_Printf(va("^3%s = %s^7\n", val, cvarValue));
    			}

    			if (doScript) {
    				trap_Cmd_ExecuteText(EXEC_APPEND, va("%s\n", script));
    			}

    		} else {
    			Com_Printf(va("Usage: %s <cvarName> <cvarValue> <script>\n", cmd));
    		}
    		return qtrue;
    	}
    */

    /*
    if (Q_stricmp(cmd, "error") == 0) {
    	if (trap_Cvar_VariableValue("developer") == 1) {
    		char text[MAX_CVAR_VALUE_STRING];

    		memset(text, 0, sizeof(text));

    		if (trap_Argc() == 1) {
    			//Q_strcat(text, sizeof(text), "INFO: Testing error menu. Type 'error [msg]' in the console to see this screen. This command is only available when developer is set to 1");
    			Q_strcat(text, sizeof(text),
    				 "Could not download \"maps/longmapname.pk3\" because autodownloading is disabled on the server\n\nThe server you are connecting to is not a pure server, set autodownload to No in your settings and you might be able to join the game anyway.\n");
    		} else {
    			Q_strncpyz(text, ConcatArgs(1), sizeof(text));
    		}

    		Com_Error(ERR_DROP, text);
    		return qtrue;
    	}
    }
    */

    if (Q_stricmp(cmd, "ui_RQ3_postVidRestart") == 0) {
        _UI_SetActiveMenu(UIMENU_RQ3_POST_VID_RESTART);
        return qtrue;
    }

    return qfalse;
}
Esempio n. 13
0
/*
=======================
UI_CalcPostGameStats
=======================
*/
static void UI_CalcPostGameStats( void )
{
    char map[MAX_QPATH];
    char fileName[MAX_QPATH];
    char info[MAX_INFO_STRING];
    fileHandle_t f;
    int size, game, time, adjustedTime;
    postGameInfo_t oldInfo;
    postGameInfo_t newInfo;
    qboolean newHigh = qfalse;

    trap_GetConfigString(CS_SERVERINFO, info, sizeof(info));
    Q_strncpyz(map, Info_ValueForKey(info, "mapname"), sizeof(map));
    game = atoi(Info_ValueForKey(info, "g_gametype"));

    // compose file name
    Com_sprintf(fileName, MAX_QPATH, "games/%s_%i.game", map, game);
    // see if we have one already
    memset(&oldInfo, 0, sizeof(postGameInfo_t));
    if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
        // if so load it
        size = 0;
        trap_FS_Read(&size, sizeof(int), f);
        if (size == sizeof(postGameInfo_t)) {
            trap_FS_Read(&oldInfo, sizeof(postGameInfo_t), f);
        }
        trap_FS_FCloseFile(f);
    }

    newInfo.accuracy = atoi(UI_Argv(3));
    newInfo.impressives = atoi(UI_Argv(4));
    newInfo.excellents = atoi(UI_Argv(5));
    newInfo.defends = atoi(UI_Argv(6));
    newInfo.assists = atoi(UI_Argv(7));
    newInfo.gauntlets = atoi(UI_Argv(8));
    newInfo.baseScore = atoi(UI_Argv(9));
    newInfo.perfects = atoi(UI_Argv(10));
    newInfo.redScore = atoi(UI_Argv(11));
    newInfo.blueScore = atoi(UI_Argv(12));
    time = atoi(UI_Argv(13));
    newInfo.captures = atoi(UI_Argv(14));

    newInfo.time = (time - trap_Cvar_VariableValue("ui_matchStartTime")) / 1000;
    adjustedTime = uiInfo.mapList[ui_currentMap.integer].timeToBeat[game];
    if (newInfo.time < adjustedTime) {
        newInfo.timeBonus = (adjustedTime - newInfo.time) * 10;
    } else {
        newInfo.timeBonus = 0;
    }

    if (newInfo.redScore > newInfo.blueScore && newInfo.blueScore <= 0) {
        newInfo.shutoutBonus = 100;
    } else {
        newInfo.shutoutBonus = 0;
    }

    newInfo.skillBonus = trap_Cvar_VariableValue("g_spSkill");
    if (newInfo.skillBonus <= 0) {
        newInfo.skillBonus = 1;
    }
    newInfo.score = newInfo.baseScore + newInfo.shutoutBonus + newInfo.timeBonus;
    newInfo.score *= newInfo.skillBonus;

    // see if the score is higher for this one
    newHigh = (newInfo.redScore > newInfo.blueScore && newInfo.score > oldInfo.score);

    if (newHigh) {
        // if so write out the new one
        uiInfo.newHighScoreTime = uiInfo.uiDC.realTime + 20000;
        if (trap_FS_FOpenFile(fileName, &f, FS_WRITE) >= 0) {
            size = sizeof(postGameInfo_t);
            trap_FS_Write(&size, sizeof(int), f);
            trap_FS_Write(&newInfo, sizeof(postGameInfo_t), f);
            trap_FS_FCloseFile(f);
        }
    }

    if (newInfo.time < oldInfo.time) {
        uiInfo.newBestTime = uiInfo.uiDC.realTime + 20000;
    }
    // put back all the ui overrides
    trap_Cvar_Set("capturelimit", UI_Cvar_VariableString("ui_saveCaptureLimit"));
    trap_Cvar_Set("fraglimit", UI_Cvar_VariableString("ui_saveFragLimit"));
    trap_Cvar_Set("cg_drawTimer", UI_Cvar_VariableString("ui_drawTimer"));
    trap_Cvar_Set("g_doWarmup", UI_Cvar_VariableString("ui_doWarmup"));
    trap_Cvar_Set("g_Warmup", UI_Cvar_VariableString("ui_Warmup"));
    trap_Cvar_Set("sv_pure", UI_Cvar_VariableString("ui_pure"));
    trap_Cvar_Set("g_friendlyFire", UI_Cvar_VariableString("ui_friendlyFire"));

    UI_SetBestScores(&newInfo, qtrue);
    UI_ShowPostGame(newHigh);

}
Esempio n. 14
0
/*
=================
UI_ConsoleCommand
=================
*/
qboolean UI_ConsoleCommand( int realTime ) {
	char	*cmd;

	uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
	uiInfo.uiDC.realTime = realTime;

	cmd = UI_Argv( 0 );

	// ensure minimum menu data is available
	//Menu_Cache();

	if ( Q_stricmp (cmd, "ui_test") == 0 ) {
		UI_ShowPostGame(qtrue);
	}

	if ( Q_stricmp (cmd, "ui_report") == 0 ) {
		UI_Report();
		return qtrue;
	}
	
	if ( Q_stricmp (cmd, "ui_load") == 0 ) {
		UI_Load();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_opensiegemenu" ) == 0 ) 
	{
		if ( trap_Cvar_VariableValue ( "g_gametype" ) == GT_SIEGE )
		{
			Menus_CloseAll();
			if (Menus_ActivateByName(UI_Argv(1)))
			{
				trap_Key_SetCatcher( KEYCATCH_UI );
			}
		}
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_openmenu" ) == 0 ) 
	{
		//if ( trap_Cvar_VariableValue ( "developer" ) )
		{
			Menus_CloseAll();
			if (Menus_ActivateByName(UI_Argv(1)))
			{
				trap_Key_SetCatcher( KEYCATCH_UI );
			}
			return qtrue;
		}
	}

	/*
	if ( Q_stricmp (cmd, "remapShader") == 0 ) {
		if (trap_Argc() == 4) {
			char shader1[MAX_QPATH];
			char shader2[MAX_QPATH];
			Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
			Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
			trap_R_RemapShader(shader1, shader2, UI_Argv(3));
			return qtrue;
		}
	}
	*/

	if ( Q_stricmp (cmd, "postgame") == 0 ) {
		UI_CalcPostGameStats();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_cache") == 0 ) {
		UI_Cache_f();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) {
		//UI_TeamOrdersMenu_f();
		return qtrue;
	}
	if ( Q_stricmp (cmd, "pause") == 0 ) {
		return qtrue;
	}
	return qfalse;
}
Esempio n. 15
0
qboolean UI_ConsoleCommand(int realTime)
{
	char            *cmd;
	uiClientState_t cstate;

	uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
	uiInfo.uiDC.realTime  = realTime;

	cmd = UI_Argv(0);

	if (Q_stricmp(cmd, "ui_test") == 0)
	{
		UI_ShowPostGame(qtrue);
	}
	else if (Q_stricmp(cmd, "ui_report") == 0)
	{
		UI_Report();
		return qtrue;
	}
	else if (Q_stricmp(cmd, "ui_load") == 0)
	{
		UI_Load();
		return qtrue;
	}
	else if (Q_stricmp(cmd, "ui_cache") == 0)
	{
		UI_Cache_f();
		return qtrue;
	}
	else if (Q_stricmp(cmd, "listfavs") == 0)
	{
		UI_ListFavourites_f();
		return qtrue;
	}
	else if (Q_stricmp(cmd, "removefavs") == 0)
	{
		UI_RemoveAllFavourites_f();
		return qtrue;
	}
	else if (Q_stricmp(cmd, "show_menu") == 0 && DC->getCVarValue("developer"))
	{
		char *menu_name = UI_Argv(1);
		if (menu_name)
		{
			Menus_OpenByName(menu_name);
		}
	}

	trap_GetClientState(&cstate);
	if (cstate.connState == CA_DISCONNECTED)
	{
		if (Q_stricmp(cmd, "campaign") == 0)
		{
			UI_Campaign_f();
			return qtrue;
		}
		else if (Q_stricmp(cmd, "listcampaigns") == 0)
		{
			UI_ListCampaigns_f();
			return qtrue;
		}
	}

	return qfalse;
}
/*
=================
UI_SPPostgameMenu_f
=================
*/
void UI_SPPostgameMenu_f( void ) {
    int			playerGameRank;
    int			playerClientNum;
    int			n;
    int			oldFrags, newFrags;
    const char	*arena;
    int			awardValues[6];
    char		map[MAX_QPATH];
    char		info[MAX_INFO_STRING];

    memset( &postgameMenuInfo, 0, sizeof(postgameMenuInfo) );

    trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) );
    postgameMenuInfo.serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) );

    trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
    Q_strncpyz( map, Info_ValueForKey( info, "mapname" ), sizeof(map) );
    arena = UI_GetArenaInfoByMap( map );
    if ( !arena ) {
        return;
    }
    Q_strncpyz( arenainfo, arena, sizeof(arenainfo) );

    postgameMenuInfo.level = atoi( Info_ValueForKey( arenainfo, "num" ) );

    postgameMenuInfo.numClients = atoi( UI_Argv( 1 ) );
    playerClientNum = atoi( UI_Argv( 2 ) );
    playerGameRank = 8;		// in case they ended game as a spectator

    if( postgameMenuInfo.numClients > MAX_SCOREBOARD_CLIENTS ) {
        postgameMenuInfo.numClients = MAX_SCOREBOARD_CLIENTS;
    }

    for( n = 0; n < postgameMenuInfo.numClients; n++ ) {
        postgameMenuInfo.clientNums[n] = atoi( UI_Argv( 8 + n * 3 + 1 ) );
        postgameMenuInfo.ranks[n] = atoi( UI_Argv( 8 + n * 3 + 2 ) );
        postgameMenuInfo.scores[n] = atoi( UI_Argv( 8 + n * 3 + 3 ) );

        if( postgameMenuInfo.clientNums[n] == playerClientNum ) {
            playerGameRank = (postgameMenuInfo.ranks[n] & ~RANK_TIED_FLAG) + 1;
        }
    }

    UI_SetBestScore( postgameMenuInfo.level, playerGameRank );

    // process award stats and prepare presentation data
    awardValues[AWARD_ACCURACY] = atoi( UI_Argv( 3 ) );
    awardValues[AWARD_IMPRESSIVE] = atoi( UI_Argv( 4 ) );
    awardValues[AWARD_EXCELLENT] = atoi( UI_Argv( 5 ) );
    awardValues[AWARD_GAUNTLET] = atoi( UI_Argv( 6 ) );
    awardValues[AWARD_FRAGS] = atoi( UI_Argv( 7 ) );
    awardValues[AWARD_PERFECT] = atoi( UI_Argv( 8 ) );

    postgameMenuInfo.numAwards = 0;

    if( awardValues[AWARD_ACCURACY] >= 50 ) {
        UI_LogAwardData( AWARD_ACCURACY, 1 );
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_ACCURACY;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_ACCURACY];
        postgameMenuInfo.numAwards++;
    }

    if( awardValues[AWARD_IMPRESSIVE] ) {
        UI_LogAwardData( AWARD_IMPRESSIVE, awardValues[AWARD_IMPRESSIVE] );
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_IMPRESSIVE;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_IMPRESSIVE];
        postgameMenuInfo.numAwards++;
    }

    if( awardValues[AWARD_EXCELLENT] ) {
        UI_LogAwardData( AWARD_EXCELLENT, awardValues[AWARD_EXCELLENT] );
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_EXCELLENT;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_EXCELLENT];
        postgameMenuInfo.numAwards++;
    }

    if( awardValues[AWARD_GAUNTLET] ) {
        UI_LogAwardData( AWARD_GAUNTLET, awardValues[AWARD_GAUNTLET] );
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_GAUNTLET;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_GAUNTLET];
        postgameMenuInfo.numAwards++;
    }

    oldFrags = UI_GetAwardLevel( AWARD_FRAGS ) / 100;
    UI_LogAwardData( AWARD_FRAGS, awardValues[AWARD_FRAGS] );
    newFrags = UI_GetAwardLevel( AWARD_FRAGS ) / 100;
    if( newFrags > oldFrags ) {
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_FRAGS;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = newFrags * 100;
        postgameMenuInfo.numAwards++;
    }

    if( awardValues[AWARD_PERFECT] ) {
        UI_LogAwardData( AWARD_PERFECT, 1 );
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_PERFECT;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = 1;
        postgameMenuInfo.numAwards++;
    }

    if ( playerGameRank == 1 ) {
        postgameMenuInfo.won = UI_TierCompleted( postgameMenuInfo.level );
    }
    else {
        postgameMenuInfo.won = -1;
    }

    postgameMenuInfo.starttime = uis.realtime;
    postgameMenuInfo.scoreboardtime = uis.realtime;

    trap_Key_SetCatcher( KEYCATCH_UI );
    uis.menusp = 0;

    UI_SPPostgameMenu_Init();
    UI_PushMenu( &postgameMenuInfo.menu );

    if ( playerGameRank == 1 ) {
        Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_next );
    }
    else {
        Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_again );
    }

    Prepname( 0 );
    Prepname( 1 );
    Prepname( 2 );

    if ( playerGameRank != 1 ) {
        postgameMenuInfo.winnerSound = trap_S_RegisterSound( va( "sound/player/announce/%s_wins.wav", postgameMenuInfo.placeNames[0] ), qfalse );
        trap_Cmd_ExecuteText( EXEC_APPEND, "music music/loss\n" );
    }
    else {
        postgameMenuInfo.winnerSound = trap_S_RegisterSound( "sound/player/announce/youwin.wav", qfalse );
        trap_Cmd_ExecuteText( EXEC_APPEND, "music music/win\n" );
    }

    postgameMenuInfo.phase = 1;

    postgameMenuInfo.lastTier = UI_GetNumSPTiers();
    if ( UI_GetSpecialArenaInfo( "final" ) ) {
        postgameMenuInfo.lastTier++;
    }
}
Esempio n. 17
0
/*
=================
UI_ConsoleCommand
=================
*/
qboolean UI_ConsoleCommand(int realTime)
{
	char           *cmd;
	char           *arg1;

	uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
	uiInfo.uiDC.realTime = realTime;

	cmd = UI_Argv(0);

	// ensure minimum menu data is available
	//Menu_Cache();

	if(Q_stricmp(cmd, "ui_test") == 0)
	{
		UI_ShowPostGame(qtrue);
	}

	if(Q_stricmp(cmd, "ui_report") == 0)
	{
		UI_Report();
		return qtrue;
	}

	if(Q_stricmp(cmd, "ui_load") == 0)
	{
		UI_Load();
		return qtrue;
	}

	if(Q_stricmp(cmd, "remapShader") == 0)
	{
		if(trap_Argc() == 4)
		{
			char            shader1[MAX_QPATH];
			char            shader2[MAX_QPATH];

			Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
			Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
			trap_R_RemapShader(shader1, shader2, UI_Argv(3));
			return qtrue;
		}
	}

	if(Q_stricmp(cmd, "postgame") == 0)
	{
		UI_CalcPostGameStats();
		return qtrue;
	}

	if(Q_stricmp(cmd, "ui_cache") == 0)
	{
		UI_Cache_f();
		return qtrue;
	}

	if(Q_stricmp(cmd, "ui_teamOrders") == 0)
	{
		//UI_TeamOrdersMenu_f();
		return qtrue;
	}

	if(Q_stricmp(cmd, "menu") == 0)
	{
		arg1 = UI_Argv(1);

		if(Menu_Count() > 0)
		{
			trap_Key_SetCatcher(KEYCATCH_UI);
			Menus_ActivateByName(arg1);
			return qtrue;
		}
	}

	if(Q_stricmp(cmd, "closemenus") == 0)
	{
		if(Menu_Count() > 0)
		{
			trap_Key_SetCatcher(trap_Key_GetCatcher() & ~KEYCATCH_UI);
			trap_Key_ClearStates();
			trap_Cvar_Set("cl_paused", "0");
			Menus_CloseAll();
			return qtrue;
		}
	}

	return qfalse;
}
Esempio n. 18
0
/*
=================
UI_ConsoleCommand
=================
*/
qboolean UI_ConsoleCommand( int realTime ) {
	char	*cmd;

	uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
	uiInfo.uiDC.realTime = realTime;

	cmd = UI_Argv( 0 );

	// ensure minimum menu data is available
	//Menu_Cache();

// JKG - Only allow these commands if we're using a debug compile
// We don't want players f****n around with these
#ifdef _DEBUG

	if ( Q_stricmp (cmd, "ui_report") == 0 ) {
		UI_Report();
		return qtrue;
	}
	/*if ( Q_stricmp (cmd, "ui_testmaster") == 0) {
		JKG_GLUI_Task_Test(testMasterFinalFunc);
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_testterms") == 0) {
		JKG_GLUI_Task_GetTermsOfUse(termsMasterFinalFunc);
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_testregister") == 0 ) {
		char username[32];
		char password[32];
		char email[64];

		trap_Argv(1, username, 32);
		trap_Argv(2, password, 32);
		trap_Argv(3, email, 32);

		JKG_GLUI_Task_RegisterUser(username, password, email, registerFinalFunc);
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_testlogin") == 0 ) {
		char username[32];
		char password[32];

		trap_Argv(1, username, 32);
		trap_Argv(2, password, 32);

		JKG_GLUI_Task_Login(username, password, loginFinalFunc);
		return qtrue;
	}*/

	
	

	if ( Q_stricmp (cmd, "ui_report") == 0 ) {
		UI_Report();
		return qtrue;
	}
	
	if ( Q_stricmp (cmd, "ui_load") == 0 ) {
		UI_Load();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_openmenu" ) == 0 ) 
	{
		//if ( trap_Cvar_VariableValue ( "developer" ) )
		{
			Menus_CloseAll();
			if (Menus_ActivateByName(UI_Argv(1)))
			{
				trap_Key_SetCatcher( KEYCATCH_UI );
			}
			return qtrue;
		}
	}

	if ( Q_stricmp (cmd, "ui_cache") == 0 ) {
		UI_Cache_f();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) {
		//UI_TeamOrdersMenu_f();
		return qtrue;
	}


#endif // _DEBUG

	return qfalse;
}