/*
=================
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" );
}
Beispiel #2
0
/*
==============
BotInterbreeding
==============
*/
void BotInterbreeding(void) {
	int i;

	trap_Cvar_Update(&bot_interbreedchar);
	if (!strlen(bot_interbreedchar.string)) return;
	//make sure we are in tournament mode
	if (gametype != GT_TOURNAMENT) {
		trap_Cvar_SetValue("g_gametype", GT_TOURNAMENT);
		ExitLevel();
		return;
	}
	//shutdown all the bots
	for (i = 0; i < MAX_CLIENTS; i++) {
		if (botstates[i] && botstates[i]->inuse) {
			BotAIShutdownPlayer(botstates[i]->playernum, qfalse);
		}
	}
	//make sure all item weight configs are reloaded and Not shared
	trap_Cvar_SetValue("bot_reloadcharacters", 1);
	//add a number of bots using the desired bot character
	for (i = 0; i < bot_interbreedbots.integer; i++) {
		trap_Cmd_ExecuteText( EXEC_INSERT, va("addbot %s 4 free %i %s%d\n",
						bot_interbreedchar.string, i * 50, bot_interbreedchar.string, i) );
	}
	//
	trap_Cvar_Set("bot_interbreedchar", "");
	bot_interbreed = qtrue;
}
Beispiel #3
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 ) );
}
Beispiel #4
0
static void StartServerActionFunc( menucommon_t *unused )
{
    char *str;
    char mapname[MAX_CONFIGSTRING_CHARS];
    char starservercmd[MAX_STRING_CHARS];

    m_listitem_t *mapitem;
    mapitem = UI_FindItemInScrollListWithId( &mapList, mapList_cur_idx );
    if( !mapitem || !mapitem->name )
        return;

    trap_Cvar_Set( "g_gametype", startserver_gametype_names[m_gametype] );
    trap_Cvar_SetValue( "sv_skilllevel", m_skill );
    trap_Cvar_SetValue( "sv_cheats", m_cheats );
    trap_Cvar_SetValue( "sv_public", m_public );

    str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_hostname" ) );
    if( str ) trap_Cvar_Set( "sv_hostname", str );

    str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_maxplayers" ) );
    if( str ) trap_Cvar_Set( "sv_maxclients", str );

    // game stuff, overriding local gametype config
    starservercmd[0] = '\0';
    Q_strncatz( starservercmd, va( "g_instagib %i;", m_instagib ), sizeof( starservercmd ) );
    trap_Cvar_SetValue( "g_instagib", (float)m_instagib );

    str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_timelimit" ) );
    if( str )
    {
        Q_strncatz( starservercmd, va( "g_timelimit %s;", str ), sizeof( starservercmd ) );
        trap_Cvar_Set( "g_timelimit", str );
    }

    str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_scorelimit" ) );
    if( str )
    {
        Q_strncatz( starservercmd, va( "g_scorelimit %s;", str ), sizeof( starservercmd ) );
        trap_Cvar_Set( "g_scorelimit", str );
    }

    str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_numbots" ) );
    if( str )
    {
        Q_strncatz( starservercmd, va( "g_numbots %s;", str ), sizeof( starservercmd ) );
        trap_Cvar_Set( "g_numbots", str );
    }

    trap_Cvar_ForceSet( "ui_startservercmd", starservercmd );

    if( uis.serverState )
        trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect\n" );

    if( trap_ML_GetMapByNum( (int)((size_t)mapitem->data), mapname, sizeof( mapname ) ) )
        trap_Cvar_ForceSet( "ui_startserver_lastselectedmap", mapname );

    trap_Cmd_ExecuteText( EXEC_APPEND, va( "map \"%s\"\n", mapitem->name ) );
}
Beispiel #5
0
/*
=================
PlayerSettings_SaveChanges
=================
*/
static void PlayerSettings_SaveChanges(void) {
    // name
    trap_Cvar_Set("name", s_playersettings.name.field.buffer);

    // handicap
    trap_Cvar_SetValue("handicap", 100 - s_playersettings.handicap.curvalue * 5);

    // effects color
    trap_Cvar_SetValue("color1", uitogamecode[s_playersettings.effects.curvalue]);
}
/*
=================
UI_DisplayOptionsMenu_Event
=================
*/
static void UI_DisplayOptionsMenu_Event( void* ptr, int event ) {
	if( event != QM_ACTIVATED ) {
		return;
	}

	switch( ((menucommon_s*)ptr)->id ) {
	case ID_GRAPHICS:
		UI_PopMenu();
		UI_GraphicsOptionsMenu();
		break;

	case ID_DISPLAY:
		break;

	case ID_SOUND:
		UI_PopMenu();
		UI_SoundOptionsMenu();
		break;

	case ID_NETWORK:
		UI_PopMenu();
		UI_NetworkOptionsMenu();
		break;

	case ID_BRIGHTNESS:
		trap_Cvar_SetValue( "r_gamma", displayOptionsInfo.brightness.curvalue / 10.0f );
		break;
	
	case ID_IGNOREHWG:
		trap_Cvar_SetValue( "r_ignorehwgamma", displayOptionsInfo.ignoreHWG.curvalue );
		trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" );
		break;

	case ID_BACK:
		UI_PopMenu();
		break;

	case ID_ANAGLYPH:
		trap_Cvar_SetValue( "r_anaglyphMode", displayOptionsInfo.anaglyph.curvalue );
		if ( !displayOptionsInfo.anaglyph.curvalue ) {
			displayOptionsInfo.greyscale.generic.flags |= QMF_GRAYED;
		}
		else {
			displayOptionsInfo.greyscale.generic.flags &= ~QMF_GRAYED;
		}
		break;

	case ID_GREYSCALE:
		trap_Cvar_SetValue( "r_greyscale", ( displayOptionsInfo.greyscale.curvalue / 100.0f ) );
		displayOptionsInfo.apply.generic.flags &= ~( QMF_HIDDEN | QMF_INACTIVE );
		break;
	}
}
Beispiel #7
0
/*
=================
UI_NetworkOptionsMenu_Event
=================
*/
static void UI_NetworkOptionsMenu_Event( void* ptr, int event ) 
{
	if( event != QM_ACTIVATED ) 
	{
		return;
	}

	switch( ((menucommon_s*)ptr)->id ) 
	{
	case ID_GRAPHICS:
		UI_PopMenu();
		UI_VideoDataMenu();		// Move to the Video Menu
		break;

	case ID_DISPLAY:
		UI_PopMenu();
		UI_VideoDataMenu();		// Move to the Video Menu
		break;

	case ID_SOUND:
		UI_PopMenu();
//		UI_SoundOptionsMenu();
		break;

	case ID_NETWORK:
		break;

	case ID_RATE:
		if( networkOptionsInfo.rate.curvalue == 0 ) 
		{
			trap_Cvar_SetValue( "rate", 2500 );
		}
		else if( networkOptionsInfo.rate.curvalue == 1 ) 
		{
			trap_Cvar_SetValue( "rate", 3000 );
		}
		else if( networkOptionsInfo.rate.curvalue == 2 ) 
		{
			trap_Cvar_SetValue( "rate", 4000 );
		}
		else if( networkOptionsInfo.rate.curvalue == 3 ) 
		{
			trap_Cvar_SetValue( "rate", 5000 );
		}
		else if( networkOptionsInfo.rate.curvalue == 4 ) 
		{
			trap_Cvar_SetValue( "rate", 25000 );
		}
		break;

	}
}
static void CG_CameraOrbit( int speed, int delay ) {
	int i;

	trap_Cvar_SetValue( "cg_cameraOrbit", speed );
	if ( delay > 0 ) {
		trap_Cvar_SetValue( "cg_cameraOrbitDelay", delay );
	}

	for ( i = 0; i < CG_MaxSplitView(); i++ ) {
		trap_Cvar_SetValue(Com_LocalPlayerCvarName( i, "cg_thirdPerson" ), speed == 0 ? 0 : 1 );
		trap_Cvar_SetValue(Com_LocalPlayerCvarName( i, "cg_thirdPersonAngle" ), 0 );
		trap_Cvar_SetValue(Com_LocalPlayerCvarName( i, "cg_thirdPersonRange" ), 100 );
	}
}
Beispiel #9
0
/*
=================
FirstConnect_Event
=================
*/
static void FirstConnect_Event( void* ptr, int event )
{
	switch (((menucommon_s*)ptr)->id)
	{
		case ID_GO:
			if (event != QM_ACTIVATED)
				break;
                        FirstConnect_SaveChanges();
                        UI_PopMenu();
                        trap_Cvar_SetValue( "ui_setupchecked", 1 );
                        UI_ArenaServersMenu();
			break;

		case ID_BACK:
			if (event != QM_ACTIVATED)
				break;

			UI_PopMenu();
			break;

                case ID_RATE:
                        if( s_firstconnect.rate.curvalue == 0 ) {
                                trap_Cvar_SetValue( "rate", 2500 );
                        }
                        else if( s_firstconnect.rate.curvalue == 1 ) {
                                trap_Cvar_SetValue( "rate", 3000 );
                        }
                        else if( s_firstconnect.rate.curvalue == 2 ) {
                                trap_Cvar_SetValue( "rate", 4000 );
                        }
                        else if( s_firstconnect.rate.curvalue == 3 ) {
                                trap_Cvar_SetValue( "rate", 5000 );
                        }
                        else if( s_firstconnect.rate.curvalue == 4 ) {
                                trap_Cvar_SetValue( "rate", 25000 );
                        }
                        break;

                case ID_ALLOWDOWNLOAD:
                        trap_Cvar_SetValue( "cl_allowDownload", s_firstconnect.allowdownload.curvalue );
                        trap_Cvar_SetValue( "sv_allowDownload", s_firstconnect.allowdownload.curvalue );
                        break;

                case ID_DELAGHITSCAN:
                        trap_Cvar_SetValue( "g_delagHitscan", s_firstconnect.delaghitscan.curvalue );
                        trap_Cvar_SetValue( "cg_delag", s_firstconnect.delaghitscan.curvalue );
                        break;
	}
}
Beispiel #10
0
/*
=================
UI_SoundOptionsMenu_Event
=================
*/
static void UI_SoundOptionsMenu_Event( void* ptr, int event ) {
	if( event != QM_ACTIVATED ) {
		return;
	}

	switch( ((menucommon_s*)ptr)->id ) {
	case ID_GRAPHICS:
		UI_PopMenu();
		UI_GraphicsOptionsMenu();
		break;

	case ID_DISPLAY:
		UI_PopMenu();
		UI_DisplayOptionsMenu();
		break;

	case ID_SOUND:
		break;

	case ID_NETWORK:
		UI_PopMenu();
		UI_NetworkOptionsMenu();
		break;

	case ID_EFFECTSVOLUME:
		trap_Cvar_SetValue( "s_volume", soundOptionsInfo.sfxvolume.curvalue / 10 );
		break;

	case ID_MUSICVOLUME:
		trap_Cvar_SetValue( "s_musicvolume", soundOptionsInfo.musicvolume.curvalue / 10 );
		break;

/*
	case ID_A3D:
		if( soundOptionsInfo.a3d.curvalue ) {
			trap_Cmd_ExecuteText( EXEC_NOW, "s_enable_a3d\n" );
		}
		else {
			trap_Cmd_ExecuteText( EXEC_NOW, "s_disable_a3d\n" );
		}
		soundOptionsInfo.a3d.curvalue = (int)trap_Cvar_VariableValue( "s_usingA3D" );
		break;
*/
	case ID_BACK:
		UI_PopMenu();
		break;
	}
}
/*
=================
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
}
Beispiel #12
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);
	}
}
Beispiel #13
0
static void objectCVar_setF( float value, ascvar_t *self )
{
	if( !self->cvar )
		return;

	trap_Cvar_SetValue( self->cvar->name, value );
}
Beispiel #14
0
//==================
//M_TV_UpdateScrollbar
//==================
static void M_TV_UpdateScrollbar( menucommon_t *menuitem )
{
	menuitem->maxvalue = max( 0, channelsScrollList.numItems - max_menu_channels );
	if( menuitem->curvalue > menuitem->maxvalue )  //if filters shrunk the list size, shrink the scrollbar and its value
		menuitem->curvalue = menuitem->maxvalue;
	trap_Cvar_SetValue( menuitem->title, menuitem->curvalue );
	scrollbar_curvalue = menuitem->curvalue;
}
Beispiel #15
0
static void UI_SPLevelMenu_ResetAction( qboolean result ) {
	if( !result ) {
		return;
	}

	// clear game variables
	UI_NewGame();
	if ( UI_GetSpecialArenaInfo( "training" ) ) {
		trap_Cvar_SetValue( "ui_spSelection", -4 );
	} else {
		trap_Cvar_SetValue( "ui_spSelection", 0 );
	}

	// make the level select menu re-initialize
	UI_PopMenu();
	UI_SPLevelMenu();
}
Beispiel #16
0
/*QUAKED worldspawn (0 0 0) ?

Every map should have exactly one worldspawn.
"music"		music wav file
"gravity"	800 is default gravity
"message"	Text to print during connection process
*/
void SP_worldspawn( void ) {
	char	*s;

	G_SpawnString( "classname", "", &s );
	if ( Q_stricmp( s, "worldspawn" ) ) {
		G_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" );
	}

	// make some data visible to connecting client
	trap_SetConfigstring( CS_GAME_VERSION, GAME_VERSION );

	trap_SetConfigstring( CS_LEVEL_START_TIME, va("%i", level.startTime ) );

	G_SpawnString( "music", "", &s );
	trap_SetConfigstring( CS_MUSIC, s );

	G_SpawnString( "message", "", &s );
	trap_SetConfigstring( CS_MESSAGE, s );				// map specific message

	trap_SetConfigstring( CS_MOTD, g_motd.string );		// message of the day

	G_SpawnString( "gravity", "800", &s );
	trap_Cvar_Set( "g_gravity", s );

	G_SpawnString( "enableDust", "0", &s );
	trap_Cvar_Set( "g_enableDust", s );

	G_SpawnString( "enableBreath", "0", &s );
	trap_Cvar_Set( "g_enableBreath", s );

#if 0 // ZTM: Currently game doesn't need the tracemap
	level.mapcoordsValid = qfalse;
	if ( G_SpawnVector2D( "mapcoordsmins", "-128 128", level.mapcoordsMins ) &&  // top left
		 G_SpawnVector2D( "mapcoordsmaxs", "128 -128", level.mapcoordsMaxs ) ) { // bottom right
		level.mapcoordsValid = qtrue;
	}
#endif

	g_entities[ENTITYNUM_WORLD].s.number = ENTITYNUM_WORLD;
	g_entities[ENTITYNUM_WORLD].r.ownerNum = ENTITYNUM_NONE;
	g_entities[ENTITYNUM_WORLD].classname = "worldspawn";

	g_entities[ENTITYNUM_NONE].s.number = ENTITYNUM_NONE;
	g_entities[ENTITYNUM_NONE].r.ownerNum = ENTITYNUM_NONE;
	g_entities[ENTITYNUM_NONE].classname = "nothing";

	// see if we want a warmup time
	trap_SetConfigstring( CS_WARMUP, "" );
	if ( g_restarted.integer ) {
		trap_Cvar_SetValue( "g_restarted", 0 );
		level.warmupTime = 0;
	} else if ( g_doWarmup.integer ) { // Turn it on
		level.warmupTime = -1;
		trap_SetConfigstring( CS_WARMUP, va("%i", level.warmupTime) );
		G_LogPrintf( "Warmup:\n" );
	}

}
Beispiel #17
0
/*
===============
UI_JoystickMenu_Event
===============
*/
static void UI_JoystickMenu_Event( void *ptr, int event ) {
	if( event != QM_ACTIVATED ) {
		return;
	}

	if (((menucommon_s*)ptr)->id >= ID_JOYSTICK && ((menucommon_s*)ptr)->id < ID_JOYSTICK + MAX_JOYSTICKS) {
		int joystick = ((menucommon_s*)ptr)->id - ID_JOYSTICK;
		int i;

		if (joystick == 0) {
			// Disable joystick
			trap_Cvar_SetValue(Com_LocalClientCvarName(joystickMenu.localClient, "in_joystick"), 0);
			trap_Cvar_SetValue(Com_LocalClientCvarName(joystickMenu.localClient, "in_joystickNo"), 0);
		} else {
			// Enable joystick
			trap_Cvar_SetValue(Com_LocalClientCvarName(joystickMenu.localClient, "in_joystick"), 1);
			trap_Cvar_SetValue(Com_LocalClientCvarName(joystickMenu.localClient, "in_joystickNo"), joystick-1);
		}

		// Disable last selected joystick.
		for (i = 0; i < MAX_JOYSTICKS; i++) {
			joystickMenu.joysticks[i].generic.flags |= QMF_PULSEIFFOCUS;
			joystickMenu.joysticks[i].generic.flags &= ~(QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS);
		}

		// Select joystick.
		((menucommon_s*)ptr)->flags &= ~QMF_PULSEIFFOCUS;
		((menucommon_s*)ptr)->flags |= (QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS);

		joystickMenu.changed = (joystick != joystickMenu.originalJoystick);
		return;
	}

	switch( ((menucommon_s*)ptr)->id ) {

	case ID_BACK:
		if (joystickMenu.changed) {
			trap_Cmd_ExecuteText( EXEC_APPEND, "in_restart\n" );
		}

		UI_PopMenu();
		break;
	}
}
Beispiel #18
0
/**
 * Updates time-dependent gamepad state.
 *
 * @param frametime real frame time
 */
static void CG_GamepadFrame( float frametime )
{
	// Add acceleration to the gamepad look above the acceleration threshold.

	vec4_t sticks;
	trap_IN_GetThumbsticks( sticks );

	int axes = ( cg_gamepad_swapSticks->integer ? 0 : 2 );

	if( cg_gamepad_accelMax->value < 0.0f )
		trap_Cvar_SetValue( cg_gamepad_accelMax->name, 0.0f );
	if( cg_gamepad_accelSpeed->value < 0.0f )
		trap_Cvar_SetValue( cg_gamepad_accelSpeed->name, 0.0f );

	float accelMax = cg_gamepad_accelMax->value + 1.0f;
	float accelSpeed = cg_gamepad_accelSpeed->value;
	float accelThres = cg_gamepad_accelThres->value;

	float value = fabs( sticks[axes] );
	if( value > cg_gamepad_yawThres->value )
	{
		cg_gamepad_accelYaw += ( ( value > accelThres ) ? 1.0f : -1.0f ) * frametime * accelSpeed;
		clamp( cg_gamepad_accelYaw, 1.0f, accelMax );
	}
	else
	{
		cg_gamepad_accelYaw = 1.0f;
	}

	value = fabs( sticks[axes + 1] );
	if( value > cg_gamepad_pitchThres->value )
	{
		cg_gamepad_accelPitch += ( ( value > accelThres ) ? 1.0f : -1.0f ) * frametime * accelSpeed;
		clamp( cg_gamepad_accelPitch, 1.0f, accelMax );
	}
	else
	{
		cg_gamepad_accelPitch = 1.0f;
	}
}
Beispiel #19
0
/*
=================
PlayerSettings_SaveChanges
=================
*/
static void PlayerSettings_SaveChanges( void ) {
	// name
	trap_Cvar_Set( "name", s_playersettings.name.field.buffer );

	// handicap
	trap_Cvar_SetValue( "handicap", 100 - s_playersettings.handicap.curvalue * 5 );

	// effects color
	// CORKSCREW 3 effect colors
	//trap_Cvar_SetValue( "color", uitogamecode[s_playersettings.effects.curvalue] );
// 1.29 fix: color -> color1
	trap_Cvar_Set( "color1", va( "%i %i %i", uitogamecode[s_playersettings.effects.curvalue], uitogamecode[s_playersettings.effects2.curvalue], uitogamecode[s_playersettings.effects3.curvalue] ) );
}
Beispiel #20
0
static void UI_SPLevelMenu_ResetAction( qboolean result ) {
	if( !result ) {
		return;
	}

	// clear game variables
	UI_NewGame();
	trap_Cvar_SetValue( "ui_spSelection", -4 );

	// make the level select menu re-initialize
	UI_PopMenu();
	UI_SPLevelMenu();
}
Beispiel #21
0
static void SoundQualityAction( qboolean result ) 
{
	if ( result ) 
	{
		soundOptionsInfo.holdSoundQuality = soundOptionsInfo.quality.curvalue; 
		if( soundOptionsInfo.quality.curvalue ) 
		{
			trap_Cvar_SetValue( "s_khz", 22 );
//			trap_Cvar_SetValue( "s_compression", 0 );
		}
		else 
		{
			trap_Cvar_SetValue( "s_khz", 11 );
//			trap_Cvar_SetValue( "s_compression", 1 );
		}
		//UI_ForceMenuOff();
		trap_Cmd_ExecuteText( EXEC_APPEND, "snd_restart\n" );
	}
	else
	{
		soundOptionsInfo.quality.curvalue =	soundOptionsInfo.holdSoundQuality; 
	}
}
Beispiel #22
0
/*
=================
UI_DisplayOptionsMenu_Event
=================
*/
static void UI_DisplayOptionsMenu_Event( void* ptr, int event ) {
	if( event != QM_ACTIVATED ) {
		return;
	}

	switch( ((menucommon_s*)ptr)->id ) {
	case ID_GRAPHICS:
		UI_PopMenu();
		UI_GraphicsOptionsMenu();
		break;

	case ID_DISPLAY:
		break;

	case ID_SOUND:
		UI_PopMenu();
		UI_SoundOptionsMenu();
		break;

	case ID_NETWORK:
		UI_PopMenu();
		UI_NetworkOptionsMenu();
		break;

	case ID_BRIGHTNESS:
		trap_Cvar_SetValue( "r_gamma", displayOptionsInfo.brightness.curvalue / 10.0f );
		break;
	
	case ID_SCREENSIZE:
		trap_Cvar_SetValue( "cg_viewsize", displayOptionsInfo.screensize.curvalue * 10 );
		break;

	case ID_BACK:
		UI_PopMenu();
		break;
	}
}
Beispiel #23
0
/*
=================
UI_SPLevelMenu_LevelEvent
=================
*/
static void UI_SPLevelMenu_LevelEvent( void* ptr, int notification ) {
	if (notification != QM_ACTIVATED) {
		return;
	}

	if ( selectedArenaSet == trainingTier || selectedArenaSet == finalTier ) {
		return;
	}

	selectedArena = ((menucommon_s*)ptr)->id - ID_PICTURE0;
	levelMenuInfo.selectedArenaInfo = UI_GetArenaInfoByNumber( selectedArenaSet * ARENAS_PER_TIER + selectedArena );
	UI_SPLevelMenu_SetBots();

	trap_Cvar_SetValue( "ui_spSelection", selectedArenaSet * ARENAS_PER_TIER + selectedArena );
}
Beispiel #24
0
/*
=================
UI_SoundOptionsMenu_Event
=================
 */
static void UI_SoundOptionsMenu_Event(void* ptr, int event) {
    if (event != QM_ACTIVATED) {
        return;
    }

    switch (((menucommon_s*) ptr)->id) {
        case ID_GRAPHICS:
            UI_PopMenu();
            UI_GraphicsOptionsMenu();
            break;

        case ID_DISPLAY:
            UI_PopMenu();
            UI_DisplayOptionsMenu();
            break;

        case ID_SOUND:
            break;

        case ID_EFFECTSVOLUME:
            trap_Cvar_SetValue("s_volume", soundOptionsInfo.sfxvolume.curvalue / 10);
            break;

        case ID_MUSICVOLUME:
            trap_Cvar_SetValue("s_musicvolume", soundOptionsInfo.musicvolume.curvalue / 10);
            break;

        case ID_QUALITY:
            if (soundOptionsInfo.quality.curvalue) {
                trap_Cvar_SetValue("s_khz", 22);
                trap_Cvar_SetValue("s_compression", 0);
            } else {
                trap_Cvar_SetValue("s_khz", 11);
                trap_Cvar_SetValue("s_compression", 1);
            }
            UI_ForceMenuOff();
            trap_Cmd_ExecuteText(EXEC_APPEND, "snd_restart\n");
            break;
            /*
                    case ID_A3D:
                            if( soundOptionsInfo.a3d.curvalue ) {
                                    trap_Cmd_ExecuteText( EXEC_NOW, "s_enable_a3d\n" );
                            }
                            else {
                                    trap_Cmd_ExecuteText( EXEC_NOW, "s_disable_a3d\n" );
                            }
                            soundOptionsInfo.a3d.curvalue = (int)trap_Cvar_VariableValue( "s_usingA3D" );
                            break;
             */
        case ID_BACK:
            UI_PopMenu();
            break;
    }
}
Beispiel #25
0
/*
=================
Reset_MenuEvent
=================
*/
void Reset_MenuEvent(void* ptr, int event) {
	if( event != QM_ACTIVATED ) {
		return;
	}

	UI_PopMenu();

	if( ((menucommon_s*)ptr)->id == ID_NO ) {
		return;
	}

	// reset the game, pop the level menu and restart it so it updates
	UI_NewGame();
	trap_Cvar_SetValue( "ui_spSelection", 0 );
	UI_PopMenu();
	UI_SPLevelMenu();
}
Beispiel #26
0
static void StartServer_UpdateOrderMethod( menucommon_t *menuitem )
{
    char mapinfo[MAX_CONFIGSTRING_CHARS] = { 0 };
    m_listitem_t *mapitem;

    trap_Cvar_SetValue( "ui_maplist_sortmethod", menuitem->curvalue );

    mapitem = UI_FindItemInScrollListWithId( &mapList, mapList_cur_idx );
    if( mapitem && mapitem->name )
        trap_ML_GetMapByNum( (int)((size_t)mapitem->data), mapinfo, sizeof( mapinfo ) );

    MapsList_CreateItems( mapinfo );
    MapsList_ChooseMap( NULL );

    menuitem = UI_MenuItemByName( "m_mapList_scrollbar" );
    menuitem->curvalue = bound( menuitem->minvalue, mapList_cur_idx, menuitem->maxvalue );
    MapsList_UpdateScrollbar( menuitem );
}
/*
=================
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 );
	}
}
Beispiel #28
0
/*QUAKED target_changelevel (1 0 0) (-8 -8 -8) (8 8 8)
Changes level to "map" when fired
*/
void use_target_changelevel( edict_t *self, edict_t *other, edict_t *activator )
{
	//	if( GS_MatchState() >= MATCH_STATE_POSTMATCH )
	return;		// allready activated
	/*
	if( 0 )
	{
	// if noexit, do a ton of damage to other
	if( noexit->value && other != world )
	{
	T_Damage( other, self, self, vec3_origin, other->s.origin, vec3_origin, 10 * other->max_health, 1000, 0 );
	return;
	}

	// let everyone know who hit the exit
	if( other && other->client )
	G_Printf( "%s exited the level.\n", other->client->pers.netname);
	}
	*/
	trap_Cvar_SetValue( "g_maprotation", -1 );
	G_Match_LaunchState( MATCH_STATE_POSTMATCH );
}
Beispiel #29
0
static void CG_CameraOrbit( int speed, int delay ) {
	int i;

	trap_Cvar_SetValue( "cg_cameraOrbit", speed );
#ifndef IOQ3ZTM // NEW_CAM
	if ( delay > 0 ) {
		trap_Cvar_SetValue( "cg_cameraOrbitDelay", delay );
	}
#endif

	for ( i = 0; i < CG_MaxSplitView(); i++ ) {
#ifdef TURTLEARENA // THIRD_PERSON
		trap_Cvar_SetValue(Com_LocalPlayerCvarName( i, "cg_thirdPerson" ), 1 );
#else
		trap_Cvar_SetValue(Com_LocalPlayerCvarName( i, "cg_thirdPerson" ), speed == 0 ? 0 : 1 );
#endif
		trap_Cvar_SetValue(Com_LocalPlayerCvarName( i, "cg_thirdPersonAngle" ), 0 );
#ifndef TURTLEARENA // THIRD_PERSON
		trap_Cvar_SetValue(Com_LocalPlayerCvarName( i, "cg_thirdPersonRange" ), 100 );
#endif
	}
}
Beispiel #30
0
static c4clipedict_t *GClip_GetClipEdictForDeltaTime( int entNum, int deltaTime )
{
	static int index = 0;
	static c4clipedict_t clipEnts[8];
	static c4clipedict_t *clipent;
	static c4clipedict_t clipentNewer; // for interpolation
	c4frame_t *cframe = NULL;
	unsigned int backTime, cframenum, backframes, i;
	edict_t	*ent = game.edicts + entNum;

	// pick one of the 8 slots to prevent overwritings
	clipent = &clipEnts[index];
	index = ( index + 1 )&7;

	if( !entNum || deltaTime >= 0 || !g_antilag->integer )
	{                                                    // current time entity
		clipent->r = ent->r;
		clipent->s = ent->s;
		return clipent;
	}

	if( !ent->r.inuse || ent->r.solid == SOLID_NOT 
		|| ( ent->r.solid == SOLID_TRIGGER && !(entNum >= 1 && entNum <= gs.maxclients) ) )
	{
		clipent->r = ent->r;
		clipent->s = ent->s;
		return clipent;
	}

	// clamp delta time inside the backed up limits
	backTime = abs( deltaTime );
	if( g_antilag_maxtimedelta->integer )
	{
		if( g_antilag_maxtimedelta->integer < 0 )
			trap_Cvar_SetValue( "g_antilag_maxtimedelta", abs( g_antilag_maxtimedelta->integer ) );
		if( backTime > (unsigned int)g_antilag_maxtimedelta->integer )
			backTime = (unsigned int)g_antilag_maxtimedelta->integer;
	}

	// find the first snap with timestamp < than realtime - backtime
	cframenum = sv_collisionFrameNum;
	for( backframes = 1; backframes < CFRAME_UPDATE_BACKUP && backframes < sv_collisionFrameNum; backframes++ ) // never overpass limits
	{
		cframe = &sv_collisionframes[( cframenum-backframes ) & CFRAME_UPDATE_MASK];
		// if solid has changed, we can't keep moving backwards
		if( ent->r.solid != cframe->clipEdicts[entNum].r.solid || ent->r.inuse != cframe->clipEdicts[entNum].r.inuse )
		{
			backframes--;
			if( backframes == 0 )
			{           // we can't step back from first
				cframe = NULL;
			}
			else
			{
				cframe = &sv_collisionframes[( cframenum-backframes ) & CFRAME_UPDATE_MASK];
			}
			break;
		}

		if( game.serverTime >= cframe->timestamp + backTime )
			break;
	}

	if( !cframe )
	{           // current time entity
		clipent->r = ent->r;
		clipent->s = ent->s;
		return clipent;
	}

	// setup with older for the data that is not interpolated
	*clipent = cframe->clipEdicts[entNum];

	// if we found an older than desired backtime frame, interpolate to find a more precise position.
	if( game.serverTime > cframe->timestamp+backTime )
	{
		float lerpFrac;

		if( backframes == 1 )
		{               // interpolate from 1st backed up to current
			lerpFrac = (float)( ( game.serverTime - backTime ) - cframe->timestamp ) / (float)( game.serverTime - cframe->timestamp );
			clipentNewer.r = ent->r;
			clipentNewer.s = ent->s;
		}
		else
		{ // interpolate between 2 backed up
			c4frame_t *cframeNewer = &sv_collisionframes[( cframenum-( backframes-1 ) ) & CFRAME_UPDATE_MASK];
			lerpFrac = (float)( ( game.serverTime - backTime ) - cframe->timestamp ) / (float)( cframeNewer->timestamp - cframe->timestamp );
			clipentNewer = cframeNewer->clipEdicts[entNum];
		}

		//G_Printf( "backTime:%i cframeBackTime:%i backFrames:%i lerfrac:%f\n", backTime, game.serverTime - cframe->timestamp, backframes, lerpFrac );

		// interpolate
		VectorLerp( clipent->s.origin, lerpFrac, clipentNewer.s.origin, clipent->s.origin );
		VectorLerp( clipent->r.mins, lerpFrac, clipentNewer.r.mins, clipent->r.mins );
		VectorLerp( clipent->r.maxs, lerpFrac, clipentNewer.r.maxs, clipent->r.maxs );
		for( i = 0; i < 3; i++ )
			clipent->s.angles[i] = LerpAngle( clipent->s.angles[i], clipentNewer.s.angles[i], lerpFrac );
	}

	//G_Printf( "backTime:%i cframeBackTime:%i backFrames:%i\n", backTime, game.serverTime - cframe->timestamp, backframes );

	// back time entity
	return clipent;
}