예제 #1
0
void UI_DrawLoadPanel( qboolean forcerefresh, qboolean ownerdraw, qboolean uihack ) {
	static qboolean inside = qfalse;

	if ( inside ) {
		if ( !uihack && trap_Cvar_VariableValue( "ui_connecting" ) ) {
			trap_Cvar_Set( "ui_connecting", "0" );
		}
		return;
	}

	connect_ownerdraw = ownerdraw;

	inside = qtrue;

	if ( !bg_loadscreeninited ) {
		trap_R_RegisterFont( "ariblk", 27, &bg_loadscreenfont1 );
		trap_R_RegisterFont( "courbd", 30, &bg_loadscreenfont2 );

		BG_PanelButtonsSetup( loadpanelButtons );

		bg_loadscreeninited = qtrue;
	}

	BG_PanelButtonsRender( loadpanelButtons );

	if ( forcerefresh ) {
		//trap_UpdateScreen();
	}

	if ( !uihack && trap_Cvar_VariableValue( "ui_connecting" ) ) {
		trap_Cvar_Set( "ui_connecting", "0" );
	}

	inside = qfalse;
}
예제 #2
0
/*
=================
ArenaServers_StopRefresh
=================
*/
static void ArenaServers_StopRefresh( void )
{
	int count;

	if (!serverStatus.refreshActive) {
		// not currently refreshing
		return;
	}
	serverStatus.refreshActive = qfalse;
	Com_Printf("%d servers listed in browser with %d players.\n",
					serverStatus.numDisplayServers,
					serverStatus.numPlayersOnServers);
	count = trap_LAN_GetServerCount(g_arenaservers.master.curvalue);
	if (count - serverStatus.numDisplayServers > 0) {
		if ( ui_browserShowAwOnly.integer ) {
			Com_Printf("%d servers not listed because they aren't running Afterwards or have pings over %d\n",
						count - serverStatus.numDisplayServers,
						(int) trap_Cvar_VariableValue("cl_maxPing"));
		} else {
			Com_Printf("%d servers not listed due to packet loss or pings over %d\n",
						count - serverStatus.numDisplayServers,
						(int) trap_Cvar_VariableValue("cl_maxPing"));
		}
	}

	ArenaServers_UpdateMenu( qtrue );
}
예제 #3
0
/*
=================
FirstConnect_SetMenuItems
=================
*/
static void FirstConnect_SetMenuItems( void ) {
    int rate;
    // name
	Q_strncpyz( s_firstconnect.name.field.buffer, UI_Cvar_VariableString("name"), sizeof(s_firstconnect.name.field.buffer) );

        rate = trap_Cvar_VariableValue( "rate" );
	if( rate <= 2500 ) {
		s_firstconnect.rate.curvalue = 0;
	}
	else if( rate <= 3000 ) {
		s_firstconnect.rate.curvalue = 1;
	}
	else if( rate <= 4000 ) {
		s_firstconnect.rate.curvalue = 2;
	}
	else if( rate <= 5000 ) {
		s_firstconnect.rate.curvalue = 3;
	}
	else {
		s_firstconnect.rate.curvalue = 4;
	}

        s_firstconnect.allowdownload.curvalue	= trap_Cvar_VariableValue( "cl_allowDownload" ) != 0;
        s_firstconnect.delaghitscan.curvalue	= trap_Cvar_VariableValue( "cg_delag" ) != 0;
}
/*
=================
Controls_SetConfig
=================
*/
static void Controls_SetConfig( void )
{
	int		i;
	bind_t*	bindptr;

	// set the bindings from the local store
	bindptr = g_bindings;

	// iterate each command, get its numeric binding
	for (i=0; ;i++,bindptr++)
	{
		if (!bindptr->label)
			break;

		if (bindptr->bind1 != -1)
		{	
			trap_Key_SetBinding( bindptr->bind1, bindptr->command );

			if (bindptr->bind2 != -1)
				trap_Key_SetBinding( bindptr->bind2, bindptr->command );
		}
	}

	if ( s_controls.invertmouse.curvalue )
		trap_Cvar_SetValue( "m_pitch", -fabs( trap_Cvar_VariableValue( "m_pitch" ) ) );
	else
		trap_Cvar_SetValue( "m_pitch", fabs( trap_Cvar_VariableValue( "m_pitch" ) ) );

	trap_Cvar_SetValue( "m_filter", s_controls.smoothmouse.curvalue );
	trap_Cvar_SetValue( "cg_autoswitch", s_controls.autoswitch.curvalue );
	trap_Cvar_SetValue( "sensitivity", s_controls.sensitivity.curvalue );
	trap_Cmd_ExecuteText( EXEC_APPEND, "in_restart\n" );
}
예제 #5
0
/*
=================
PlayerSettings_SetMenuItems
=================
*/
static void PlayerSettings_SetMenuItems(void) {
    vec3_t  viewangles;
    int     c;
    int     h;

    // name
    Q_strncpyz(s_playersettings.name.field.buffer, UI_Cvar_VariableString("name"), sizeof(s_playersettings.name.field.buffer));

    // effects color
    c = trap_Cvar_VariableValue("color1") - 1;
    if (c < 0 || c > 6) {
        c = 6;
    }
    s_playersettings.effects.curvalue = gamecodetoui[c];

    // model/skin
    memset(&s_playersettings.playerinfo, 0, sizeof(playerInfo_t));

    viewangles[YAW]   = 180 - 30;
    viewangles[PITCH] = 0;
    viewangles[ROLL]  = 0;

    UI_PlayerInfo_SetModel(&s_playersettings.playerinfo, UI_Cvar_VariableString("model"));
    UI_PlayerInfo_SetInfo(&s_playersettings.playerinfo, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_MACHINEGUN, qfalse);

    // handicap
    h = Com_Clamp(5, 100, trap_Cvar_VariableValue("handicap"));
    s_playersettings.handicap.curvalue = 20 - h / 5;
}
예제 #6
0
/*
===============
UI_SetBestScore

Set the player's best finish for a level
===============
*/
void UI_SetBestScore(int level, int score) {
    int     skill;
    int     oldScore;
    char    arenaKey[16];
    char    scores[MAX_INFO_VALUE];

    // validate score
    if (score < 1 || score > 8) {
        return;
    }

    // validate skill
    skill = (int)trap_Cvar_VariableValue("g_spSkill");
    if (skill < 1 || skill > 5) {
        return;
    }

    // get scores
    trap_Cvar_VariableStringBuffer(va("g_spScores%i", skill), scores, MAX_INFO_VALUE);

    // see if this is better
    Com_sprintf(arenaKey, sizeof(arenaKey), "l%i", level);
    oldScore = atoi(Info_ValueForKey(scores, arenaKey));
    if (oldScore && oldScore <= score) {
        return;
    }

    // update scores
    Info_SetValueForKey(scores, arenaKey, va("%i", score));
    trap_Cvar_Set(va("g_spScores%i", skill), scores);
}
예제 #7
0
/*
=================
UI_SPSkillMenu_SkillEvent
=================
*/
static void UI_SPSkillMenu_SkillEvent( void *ptr, int notification ) {
	int		id;
	int		skill;

	if (notification != QM_ACTIVATED)
		return;

	SetSkillColor( (int)trap_Cvar_VariableValue( "g_spSkill" ), text_big_color );

	id = ((menucommon_s*)ptr)->id;
	skill = id - ID_BABY + 1;
	trap_Cvar_SetValue( "g_spSkill", skill );

#ifdef TURTLEARENA
	SetSkillColor( skill, color_orange );
#else
	SetSkillColor( skill, color_white );
#endif
#ifndef TA_MISC // SRB2_SKILLS
	skillMenuInfo.art_skillPic.shader = skillMenuInfo.skillpics[skill - 1];

	if( id == ID_NIGHTMARE ) {
		trap_S_StartLocalSound( skillMenuInfo.nightmareSound, CHAN_ANNOUNCER );
	}
	else {
		trap_S_StartLocalSound( skillMenuInfo.silenceSound, CHAN_ANNOUNCER );
	}
#endif
}
/*
=================
InServer_Event
=================
*/
void InServer_Event( void *ptr, int notification ) {
	if( notification != QM_ACTIVATED ) {
		return;
	}

	switch( ((menucommon_s*)ptr)->id ) {
	case ID_CHANGEMAP:
#ifdef TA_SP // ARCADE
		UI_StartServerMenu( !ui_singlePlayerActive.integer );
#else
		UI_StartServerMenu( trap_Cvar_VariableValue("g_gametype") != GT_SINGLE_PLAYER );
#endif
		break;

	case ID_RESTART:
		UI_ConfirmMenu( "Restart Level?", 0, InServer_RestartAction );
		break;

	case ID_ADDBOTS:
		UI_AddBotsMenu();
		break;

	case ID_REMOVEBOTS:
		UI_RemoveBotsMenu();
		break;


	case ID_BACK:
		UI_PopMenu();
		break;
	}
}
예제 #9
0
/*
=================
PunkBuster_Confirm
=================
*/
static void Punkbuster_ConfirmEnable( qboolean result ) {
	if (result)
	{		
		trap_SetPbClStatus(1);
	}
	g_arenaservers.punkbuster.curvalue = Com_Clamp( 0, 1, trap_Cvar_VariableValue( "cl_punkbuster" ) );
}
예제 #10
0
void UI_LoadBestScores(const char *map, int game) {
#ifndef _XBOX
	char		fileName[MAX_QPATH];
	fileHandle_t f;
	postGameInfo_t newInfo;
	memset(&newInfo, 0, sizeof(postGameInfo_t));
	Com_sprintf(fileName, MAX_QPATH, "games/%s_%i.game", map, game);
	if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
		int size = 0;
		trap_FS_Read(&size, sizeof(int), f);
		if (size == sizeof(postGameInfo_t)) {
			trap_FS_Read(&newInfo, sizeof(postGameInfo_t), f);
		}
		trap_FS_FCloseFile(f);
	}
	UI_SetBestScores(&newInfo, qfalse);

	Com_sprintf(fileName, MAX_QPATH, "demos/%s_%d.dm_%d", map, game, (int)trap_Cvar_VariableValue("protocol"));
	uiInfo.demoAvailable = qfalse;
	if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
		uiInfo.demoAvailable = qtrue;
		trap_FS_FCloseFile(f);
	} 
#endif
}
예제 #11
0
/*
=================
UI_SPSkillMenu_SkillEvent
=================
*/
static void UI_SPSkillMenu_SkillEvent(void *ptr, int notification)
{
	int		id;
	int		skill;

	if (notification != QM_ACTIVATED)
		return;

	SetSkillColor((int)trap_Cvar_VariableValue("g_spSkill"), color_red);

	id = ((menucommon_s*)ptr)->id;
	skill = id - ID_BABY + 1;
	trap_Cvar_SetValue("g_spSkill", skill);

	SetSkillColor(skill, color_white);
	skillMenuInfo.art_skillPic.shader = skillMenuInfo.skillpics[skill - 1];

	if (id == ID_NIGHTMARE)
	{
		trap_S_StartLocalSound(skillMenuInfo.nightmareSound, CHAN_ANNOUNCER);
	}
	else
	{
		trap_S_StartLocalSound(skillMenuInfo.silenceSound, CHAN_ANNOUNCER);
	}
}
예제 #12
0
/*
=======================================================================================================================================
PlayerModel_BuildList
=======================================================================================================================================
*/
static void PlayerModel_BuildList(void) {
	int numdirs;
	int numfiles;
	char dirlist[2048];
	char filelist[2048];
	char skinname[MAX_QPATH];
	char *dirptr;
	char *fileptr;
	int i;
	int j;
	int dirlen;
	int filelen;
	qboolean precache;

	precache = trap_Cvar_VariableValue("com_buildscript");

	s_playermodel.modelpage = 0;
	s_playermodel.nummodels = 0;
	// iterate directory of all player models
	numdirs = trap_FS_GetFileList("models/players", "/", dirlist, 2048);
	dirptr = dirlist;

	for (i = 0; i < numdirs && s_playermodel.nummodels < MAX_PLAYERMODELS; i++, dirptr += dirlen + 1) {
		dirlen = strlen(dirptr);

		if (dirlen && dirptr[dirlen - 1] == '/') {
			dirptr[dirlen - 1] = '\0';
		}

		if (!strcmp(dirptr, ".") || !strcmp(dirptr, "..")) {
			continue;
		}
		// iterate all skin files in directory
		numfiles = trap_FS_GetFileList(va("models/players/%s", dirptr), "tga", filelist, 2048);
		fileptr = filelist;

		for (j = 0; j < numfiles && s_playermodel.nummodels < MAX_PLAYERMODELS; j++, fileptr += filelen + 1) {
			filelen = strlen(fileptr);

			COM_StripExtension(fileptr, skinname, sizeof(skinname));
			// look for icon_????
			if (!Q_stricmpn(skinname, "icon_", 5)) {
				Com_sprintf(s_playermodel.modelnames[s_playermodel.nummodels++], sizeof(s_playermodel.modelnames[s_playermodel.nummodels]), "models/players/%s/%s", dirptr, skinname);
				//if (s_playermodel.nummodels >= MAX_PLAYERMODELS) {
				//	return;
				//}
			}

			if (precache) {
				trap_S_RegisterSound(va("sound/player/announce/%s_wins.wav", skinname), qfalse);
			}
		}
	}
	// APSFIXME - Degenerate no models case
	s_playermodel.numpages = s_playermodel.nummodels / MAX_MODELSPERPAGE;

	if (s_playermodel.nummodels % MAX_MODELSPERPAGE) {
		s_playermodel.numpages++;
	}
}
예제 #13
0
void UI_SPArena_Start( const char *arenaInfo ) {
	char	*map;
	int		level;
	int		n;
	char	*txt;

	n = (int)trap_Cvar_VariableValue( "sv_maxclients" );
	if ( n < 8 ) {
		trap_Cvar_SetValue( "sv_maxclients", 8 );
	}

	level = atoi( Info_ValueForKey( arenaInfo, "num" ) );
	txt = Info_ValueForKey( arenaInfo, "special" );
	if( txt[0] ) {
		if( Q_stricmp( txt, "training" ) == 0 ) {
			level = -4;
		}
		else if( Q_stricmp( txt, "final" ) == 0 ) {
			level = UI_GetNumSPTiers() * ARENAS_PER_TIER;
		}
	}
	trap_Cvar_SetValue( "ui_spSelection", level );

	map = Info_ValueForKey( arenaInfo, "map" );
	trap_Cmd_ExecuteText( EXEC_APPEND, va( "spmap %s\n", map ) );
}
예제 #14
0
파일: g_bot.c 프로젝트: otty/cake3
/*
===============
G_SpawnBots
===============
*/
static void G_SpawnBots(char *botList, int baseDelay)
{
	char           *bot;
	char           *p;
	float           skill;
	int             delay;
	char            bots[MAX_INFO_VALUE];

	podium1 = NULL;
	podium2 = NULL;
	podium3 = NULL;

	skill = trap_Cvar_VariableValue("g_spSkill");
	if(skill < 1)
	{
		trap_Cvar_Set("g_spSkill", "1");
		skill = 1;
	}
	else if(skill > 5)
	{
		trap_Cvar_Set("g_spSkill", "5");
		skill = 5;
	}

	Q_strncpyz(bots, botList, sizeof(bots));
	p = &bots[0];
	delay = baseDelay;
	while(*p)
	{
		//skip spaces
		while(*p && *p == ' ')
		{
			p++;
		}
		if(!p)
		{
			break;
		}

		// mark start of bot name
		bot = p;

		// skip until space of null
		while(*p && *p != ' ')
		{
			p++;
		}
		if(*p)
		{
			*p++ = 0;
		}

		// we must add the bot this way, calling G_AddBot directly at this stage
		// does "Bad Things"
		trap_SendConsoleCommand(EXEC_INSERT, va("addbot %s %f free %i\n", bot, skill, delay));

		delay += BOT_BEGIN_DELAY_INCREMENT;
	}
}
예제 #15
0
/*
=================
StartServer_InGame_Old_Init
=================
*/
static void StartServer_InGame_Old_Init( void )
{
	int 		i, j;
	qboolean 	disabled;
	qboolean 	init;
	groupinfo_t* 	group;
	int 		type, t;

	s_itemcontrols_old.enabled = ingame_enabled_old;
	s_itemcontrols_old.grouptype = ingame_grouptype_old;

	// get the cvars currently set
	for (i = 0; i < ITEM_COUNT; i++)
	{
		disabled = (int)Com_Clamp(0, 1, trap_Cvar_VariableValue(va("disable_%s", server_itemlist[i].mapitem)));
		if (disabled)
			s_itemcontrols_old.enabled[i] = qfalse;
		else
			s_itemcontrols_old.enabled[i] = qtrue;
	}

	// all groups are custom by default, just in case a group
	// doesn't have a master control (we want the control visible and editable)
	for (i = 0; i < ITEMGROUP_COUNT; i++)
	{
		s_itemcontrols_old.grouptype[i] = ALLGROUPS_CUSTOM;
	}

	// now scan through the master controls to see how they should be setup
	for (i = 0; i < masterControl_old_Size; i++)
	{
		if (!masterControl_old[i].control)
			continue;

		// check each group for a contrary enable state
		init = qfalse;
		for (j = 0; j < groupInfo_Size; j++)
		{
			group = groupInfo[j].group;
			if (group->ident != masterControl_old[i].ident)
				continue;

			t = StartServer_InGame_Old_FindGroupType(group->itemlist, group->size);

			if (init) {
				type = t;
				init = qfalse;
			}
			else {
				if (t != type)
					type = ALLGROUPS_CUSTOM;
			}
		}

		s_itemcontrols_old.grouptype[ masterControl_old[i].ident ] = type;
	}

	StartServer_BothItemPage_Old_InitControls();
}
예제 #16
0
/*
=================
UI_SPPostgameMenu_Cache
=================
*/
void UI_SPPostgameMenu_Cache( void ) {
	qboolean	buildscript;
	buildscript = trap_Cvar_VariableValue("com_buildscript");
	if( buildscript ) {	//cache these for the pack file!
		trap_Cmd_ExecuteText( EXEC_APPEND, "music music/win\n" );
		trap_Cmd_ExecuteText( EXEC_APPEND, "music music/loss\n" );
	}
}
예제 #17
0
void UI_DrawLoadPanel(qboolean ownerdraw, qboolean uihack)
{
	static qboolean inside = qfalse;

	// to avoid a flickering screen on widescreens, we erase it before drawing onto it..
	if (((float)(DC->glconfig.vidWidth) / DC->glconfig.vidHeight) != RATIO43)
	{
		float xoffset = Cui_WideXoffset() * DC->xscale;

		trap_R_DrawStretchPic(0, 0, xoffset, DC->glconfig.vidHeight, 0, 0, 1, 1, DC->registerShaderNoMip("gfx/2d/backtile"));
		trap_R_DrawStretchPic(DC->glconfig.vidWidth - xoffset, 0, xoffset, DC->glconfig.vidHeight, 0, 0, 1, 1, DC->registerShaderNoMip("gfx/2d/backtile"));
	}

	if (inside)
	{
		if (!uihack && trap_Cvar_VariableValue("ui_connecting"))
		{
			trap_Cvar_Set("ui_connecting", "0");
		}
		return;
	}

	connect_ownerdraw = ownerdraw;

	inside = qtrue;

	if (!bg_loadscreeninited)
	{
		trap_R_RegisterFont("ariblk", 27, &bg_loadscreenfont1);
		trap_R_RegisterFont("courbd", 30, &bg_loadscreenfont2);

		BG_PanelButtonsSetup(loadpanelButtons);
		C_PanelButtonsSetup(loadpanelButtons, Cui_WideXoffset());   // convert to possible widescreen coordinates..

		bg_loadscreeninited = qtrue;
	}

	BG_PanelButtonsRender(loadpanelButtons);

	if (!uihack && trap_Cvar_VariableValue("ui_connecting"))
	{
		trap_Cvar_Set("ui_connecting", "0");
	}

	inside = qfalse;
}
예제 #18
0
파일: ui_atoms.c 프로젝트: Zekom/reaction
void UI_LoadBestScores(const char *map, int game)
{
    char fileName[MAX_QPATH];
    fileHandle_t f;
    postGameInfo_t newInfo;
    int protocol, protocolLegacy;

    memset(&newInfo, 0, sizeof(postGameInfo_t));
    Com_sprintf(fileName, MAX_QPATH, "games/%s_%i.game", map, game);
    if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) {
        int size = 0;
        trap_FS_Read(&size, sizeof(int), f);
        if (size == sizeof(postGameInfo_t)) {
            trap_FS_Read(&newInfo, sizeof(postGameInfo_t), f);
        }
        trap_FS_FCloseFile(f);
    }
    UI_SetBestScores(&newInfo, qfalse);

    uiInfo.demoAvailable = qfalse;

    protocolLegacy = trap_Cvar_VariableValue("com_legacyprotocol");
    protocol = trap_Cvar_VariableValue("com_protocol");

    if(!protocol)
        protocol = trap_Cvar_VariableValue("protocol");
    if(protocolLegacy == protocol)
        protocolLegacy = 0;

    Com_sprintf(fileName, MAX_QPATH, "demos/%s_%d.%s%d", map, game, DEMOEXT, protocol);
    if(trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0)
    {
        uiInfo.demoAvailable = qtrue;
        trap_FS_FCloseFile(f);
    }
    else if(protocolLegacy > 0)
    {
        Com_sprintf(fileName, MAX_QPATH, "demos/%s_%d.%s%d", map, game, DEMOEXT, protocolLegacy);
        if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0)
        {
            uiInfo.demoAvailable = qtrue;
            trap_FS_FCloseFile(f);
        }
    }
}
예제 #19
0
/*
=================
ArenaServers_MaxPing
=================
*/
static int ArenaServers_MaxPing( void ) {
	int		maxPing;

	maxPing = (int)trap_Cvar_VariableValue( "cl_maxPing" );
	if( maxPing < 100 ) {
		maxPing = 100;
	}
	return maxPing;
}
예제 #20
0
/*
=================
ArenaServers_StartRefresh
=================
*/
static void ArenaServers_StartRefresh(qboolean full)
{
	int		i;
	char	*ptr;

//	qtime_t q;
//	trap_RealTime(&q);
// 	trap_Cvar_Set( va("ui_lastServerRefresh_%i", g_arenaservers.master.curvalue), va("%s-%i, %i at %i:%i", MonthAbbrev[q.tm_mon],q.tm_mday, 1900+q.tm_year,q.tm_hour,q.tm_min));

	if (!full) {
		UI_UpdatePendingPings();
		return;
	}

	serverStatus.refreshActive = qtrue;
	serverStatus.nextDisplayRefresh = uis.realtime + 1000;
	// clear number of displayed servers
	serverStatus.numDisplayServers = 0;
	serverStatus.numRefreshedServers = 0;
	serverStatus.numPlayersOnServers = 0;
	// reset list
	g_arenaservers.list.numitems = serverStatus.numDisplayServers;
	g_arenaservers.list.curvalue = 0;
	g_arenaservers.list.top      = 0;
	// mark all servers as visible so we store ping updates for them
	trap_LAN_MarkServerVisible(g_arenaservers.master.curvalue, -1, qtrue);
	// reset all the pings
	trap_LAN_ResetPings(g_arenaservers.master.curvalue);
	//
	serverStatus.refreshtime = uis.realtime + 1000;
	if( g_arenaservers.master.curvalue == AS_LOCAL ) {
		trap_Cmd_ExecuteText( EXEC_NOW, "localservers\n" );
		// update menu
		ArenaServers_UpdateMenu( qfalse );
		return;
	}

	if( g_arenaservers.master.curvalue == AS_GLOBAL || g_arenaservers.master.curvalue == AS_MPLAYER ) {
		serverStatus.refreshtime = uis.realtime + 4000;
		if( g_arenaservers.master.curvalue == AS_GLOBAL ) {
			i = 0;
		}
		else {
			i = 1;
		}

		ptr = UI_Cvar_VariableString("debug_protocol");
		if (strlen(ptr)) {
			trap_Cmd_ExecuteText( EXEC_NOW, va( "globalservers %d %s full empty\n", i, ptr));
		}
		else {
			trap_Cmd_ExecuteText( EXEC_NOW, va( "globalservers %d %d full empty\n", i, (int)trap_Cvar_VariableValue( "protocol" ) ) );
		}
	}
	// update menu
	ArenaServers_UpdateMenu( qfalse );
}
예제 #21
0
파일: g_bot.c 프로젝트: eserozvataf/q3now
/*
===============
G_AddRandomBot
===============
*/
void G_AddRandomBot( int team ) {
	char	*teamstr;
	float	skill;

	skill = trap_Cvar_VariableValue( "g_spSkill" );
	if (team == TEAM_RED) teamstr = "red";
	else if (team == TEAM_BLUE) teamstr = "blue";
	else teamstr = "free";
	trap_SendConsoleCommand( EXEC_INSERT, va("addbot random %f %s %i\n", skill, teamstr, 0) );
}
예제 #22
0
/*
===============
UI_InitGameinfo
===============
*/
void UI_InitGameinfo( void ) {

	UI_InitMemory();
	UI_LoadArenas();
	UI_LoadBots();

	if( (trap_Cvar_VariableValue( "fs_restrict" )) || (ui_numSpecialSinglePlayerArenas == 0 && ui_numSinglePlayerArenas == 2) ) {
		uis.demoversion = qtrue;
	}
	else {
		uis.demoversion = qfalse;
	}
}
/*
=================
Controls_InitCvars
=================
*/
static void Controls_InitCvars( void )
{
	int				i;
	configcvar_t*	cvarptr;

	cvarptr = g_configcvars;
	for (i=0; ;i++,cvarptr++)
	{
		if (!cvarptr->name)
			break;

		// get current value
		cvarptr->value = trap_Cvar_VariableValue( cvarptr->name );

		// get default value
		trap_Cvar_Reset( cvarptr->name );
		cvarptr->defaultvalue = trap_Cvar_VariableValue( cvarptr->name );

		// restore current value
		trap_Cvar_SetValue( cvarptr->name, cvarptr->value );
	}
}
예제 #24
0
void QDECL Com_DPrintf( const char *msg, ... ) {
	va_list		argptr;
	char		text[1024];

	if (!trap_Cvar_VariableValue("developer")) {
		return;			// don't confuse non-developers with techie stuff...
	}

	va_start (argptr, msg);
	Q_vsnprintf (text, sizeof(text), msg, argptr);
	va_end (argptr);

	trap_Print( text );
}
예제 #25
0
void UI_DrawLoadPanel(qboolean ownerdraw, qboolean uihack)
{
	static qboolean inside = qfalse;

	if (inside)
	{
		if (!uihack && trap_Cvar_VariableValue("ui_connecting"))
		{
			trap_Cvar_Set("ui_connecting", "0");
		}
		return;
	}

	connect_ownerdraw = ownerdraw;

	inside = qtrue;

	if (!bg_loadscreeninited)
	{
		trap_R_RegisterFont("ariblk", 27, &bg_loadscreenfont1);
		trap_R_RegisterFont("courbd", 30, &bg_loadscreenfont2);

		BG_PanelButtonsSetup(loadpanelButtons);
		C_PanelButtonsSetup(loadpanelButtons, Cui_WideXoffset());   // convert to possible widescreen coordinates..

		bg_loadscreeninited = qtrue;
	}

	BG_PanelButtonsRender(loadpanelButtons);

	if (!uihack && trap_Cvar_VariableValue("ui_connecting"))
	{
		trap_Cvar_Set("ui_connecting", "0");
	}

	inside = qfalse;
}
예제 #26
0
void QDECL Com_DPrintf( const char *fmt, ...) {
    va_list		argptr;
    char		msg[MAXPRINTMSG];
    int developer;

    developer = trap_Cvar_VariableValue("developer");
    if ( !developer)
        return;

    va_start (argptr,fmt);
    Q_vsnprintf (msg, sizeof(msg), fmt, argptr);
    va_end (argptr);

    Com_Printf ("%s", msg);
}
예제 #27
0
/*
===============
G_AddRandomBot
===============
*/
void G_AddRandomBot( int team ) {
	int n;
	char *value, netname[36], *teamstr;
	float	skill;

	n = G_SelectRandomBotForAdd(team);

	// Get name of selected bot.
	value = Info_ValueForKey( g_botInfos[n], "name" );

	skill = trap_Cvar_VariableValue( "g_spSkill" );
	if (team == TEAM_RED) teamstr = "red";
	else if (team == TEAM_BLUE) teamstr = "blue";
	else teamstr = "free";
	strncpy(netname, value, sizeof(netname)-1);
	netname[sizeof(netname)-1] = '\0';
	Q_CleanStr(netname);
	trap_Cmd_ExecuteText( EXEC_INSERT, va("addbot %s %f %s %i\n", netname, skill, teamstr, 0) );
}
예제 #28
0
/*
===============
UI_RankStatusMenu
===============
*/
void UI_RankStatusMenu(void)
{

	s_status = (grank_status_t)trap_Cvar_VariableValue("client_status");

	switch (s_status)
	{
	case QGR_STATUS_NEW:
		return;
	case QGR_STATUS_PENDING:
		// GRANK_FIXME
		return;
	case QGR_STATUS_NO_USER:
		// GRANK_FIXME - get this when user exists
		s_rankstatus_message = "Username unavailable";
		break;
	case QGR_STATUS_BAD_PASSWORD:
		s_rankstatus_message = "Invalid password";
		break;
	case QGR_STATUS_TIMEOUT:
		s_rankstatus_message = "Timed out";
		break;
	case QGR_STATUS_NO_MEMBERSHIP:
		s_rankstatus_message = "No membership";
		break;
	case QGR_STATUS_INVALIDUSER:
		s_rankstatus_message = "Validation failed";
		break;
	case QGR_STATUS_ERROR:
		s_rankstatus_message = "Error";
		break;
	case QGR_STATUS_SPECTATOR:
	case QGR_STATUS_ACTIVE:
		UI_ForceMenuOff();
		return;
	default:
		return;
	}
	RankStatus_MenuInit();
	trap_CL_UI_RankUserReset();
	UI_PushMenu (&s_rankstatus.menu);
}
예제 #29
0
/*
=================
PlayerSettings_SetMenuItems
=================
*/
static void PlayerSettings_SetMenuItems( void ) {
	vec3_t	viewangles;
	int		c1, c2, c3;
	int		h;
	char	temp[6];

	// name
	Q_strncpyz( s_playersettings.name.field.buffer, UI_Cvar_VariableString("name"), sizeof(s_playersettings.name.field.buffer) );

	// effects color
	trap_Cvar_VariableStringBuffer( "color1", temp, sizeof(temp) );

	c1 = atoi( va( "%c", temp[0] ) ) - 1;
	c2 = atoi( va( "%c", temp[2] ) ) - 1;
	c3 = atoi( va( "%c", temp[4] ) ) - 1;

	if ( c1 > 6 || c1 < 0 ) c1 = 6;
	if ( c2 > 6 || c2 < 0 ) c2 = 6;
	if ( c3 > 6 || c3 < 0 ) c3 = 6;

	s_playersettings.effects.curvalue = gamecodetoui[c1];
	s_playersettings.effects2.curvalue = gamecodetoui[c2];
	s_playersettings.effects3.curvalue = gamecodetoui[c3];


	// model/skin
	memset( &s_playersettings.playerinfo, 0, sizeof(playerInfo_t) );

	viewangles[YAW]   = 180 - 30;
	viewangles[PITCH] = 0;
	viewangles[ROLL]  = 0;

	UI_PlayerInfo_SetModel( &s_playersettings.playerinfo, UI_Cvar_VariableString( "model" ) );
	UI_PlayerInfo_SetInfo( &s_playersettings.playerinfo, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_RAILGUN, qfalse );

	// handicap
	h = Com_Clamp( 5, 100, trap_Cvar_VariableValue("handicap") );
	s_playersettings.handicap.curvalue = 20 - h / 5;
}
예제 #30
0
/*
=================
UI_SPPostgameMenu_Cache
=================
*/
void UI_SPPostgameMenu_Cache( void ) {
    int			n;
    qboolean	buildscript;

    buildscript = trap_Cvar_VariableValue("com_buildscript");

    trap_R_RegisterShaderNoMip( ART_MENU0 );
    trap_R_RegisterShaderNoMip( ART_MENU1 );
    trap_R_RegisterShaderNoMip( ART_REPLAY0 );
    trap_R_RegisterShaderNoMip( ART_REPLAY1 );
    trap_R_RegisterShaderNoMip( ART_NEXT0 );
    trap_R_RegisterShaderNoMip( ART_NEXT1 );
    for( n = 0; n < 6; n++ ) {
        trap_R_RegisterShaderNoMip( ui_medalPicNames[n] );
        trap_S_RegisterSound( ui_medalSounds[n], qfalse );
    }

    if( buildscript ) {
        trap_S_RegisterSound( "music/loss.wav", qfalse );
        trap_S_RegisterSound( "music/win.wav", qfalse );
        trap_S_RegisterSound( "sound/player/announce/youwin.wav", qfalse );
    }
}