コード例 #1
0
ファイル: vote.c プロジェクト: QuakePhil/ktx-hoonymode
void vote_check_antilag ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_ANTILAG ) )
		return;

	veto = is_admins_vote( OV_ANTILAG );

	if( veto || !get_votes_req( OV_ANTILAG, true ) )
	{
		vote_clear( OV_ANTILAG );

		// toggle antilag mode.
		trap_cvar_set_float( "sv_antilag", (float)(cvar( "sv_antilag" ) ? 0 : 2));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("Antilag mode %s by admin veto", OnOff(2 == cvar("sv_antilag")))));
		else
			G_bprint(2, "%s\n", redtext(va("Antilag mode %s by majority vote", OnOff(2 == cvar("sv_antilag")))));

		return;
	}
}
コード例 #2
0
ファイル: vote.c プロジェクト: QuakePhil/ktx-hoonymode
void nospecs( )
{
    int votes;
	
	if ( match_in_progress )
	{
        G_sprint(self, 2, "%s mode %s\n", redtext("No spectators"), OnOff(cvar("_k_nospecs")));
        return;
	}

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.nospecs = !self->v.nospecs;

	G_bprint(2, "%s %s!%s\n", self->s.v.netname, 
			(self->v.nospecs ? redtext(va("votes for nospecs %s", OnOff(!cvar("_k_nospecs")))) : 
							   redtext(va("withdraws %s nospecs vote", g_his(self)))),
			((votes = get_votes_req( OV_NOSPECS, true )) ? va(" (%d)", votes) : ""));

	vote_check_nospecs ();
}
コード例 #3
0
ファイル: vote.c プロジェクト: QuakePhil/ktx-hoonymode
// { votecoop
void vote_check_coop ()
{
	int veto;

	if ( ( deathmatch && match_in_progress ) || intermission_running || match_over )
		return;

	if ( !get_votes( OV_COOP ) )
		return;

	veto = is_admins_vote( OV_COOP );

	if( veto || !get_votes_req( OV_COOP, true ) )
	{
		vote_clear( OV_COOP );

		// toggle coop mode
		cvar_fset( "coop", coop = !cvar("coop") );
		// set appropriate deathmatch
		cvar_fset( "deathmatch", deathmatch = !coop );

		if ( veto )
			G_bprint( 2, "%s\n", redtext(va("Coop mode %s by admin veto", OnOff(cvar("coop")))) );
		else
			G_bprint( 2, "%s\n", redtext(va("Coop mode %s by majority vote", OnOff(cvar("coop")))) );

		// and reload map
		if ( cvar("k_bloodfest") )
			changelevel( coop ? g_globalvars.mapname : cvar_string( "k_defmap" ) );
		else
			changelevel( coop ? "start" : g_globalvars.mapname );
			
		return;
	}
}
コード例 #4
0
ファイル: vote.c プロジェクト: deurk/ktx
void teamoverlay( )
{
    int votes;

    if ( match_in_progress )
    {
        G_sprint(self, 2, "%s %s\n", redtext("Teamoverlay"), OnOff(cvar("k_teamoverlay")));
        return;
    }

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.teamoverlay = !self->v.teamoverlay;

	G_bprint(2, "%s %s!%s\n", self->netname, 
			(self->v.teamoverlay ? redtext(va("votes for teamoverlay %s", OnOff(!cvar("k_teamoverlay")))) : 
							       redtext(va("withdraws %s teamoverlay vote", g_his(self)))),
			((votes = get_votes_req( OV_TEAMOVERLAY, true )) ? va(" (%d)", votes) : ""));

    vote_check_teamoverlay ();
}
コード例 #5
0
ファイル: ctf.c プロジェクト: deurk/ktx
void mctf()
{
	if( match_in_progress && !k_matchLess )
		return;

	if ( !isCTF() ) {
		G_sprint ( self, 2, "Can't do this in non CTF mode\n" );
		return;
	}

	if ( !cvar("k_ctf_hook") && !cvar("k_ctf_runes") ) {
		G_sprint ( self, 2, "Already done\n" );
		return;
	}

	cvar_fset("k_ctf_hook", 0);
	cvar_fset("k_ctf_runes", 0);

	G_sprint ( self, 2, "%s turn off: %s\n", getname(self), redtext("hook & runes") );

	// In matchless mode, toggling runes and hook normally won't do anything since match is already in progress. Call this to handle this scenario.
	if (k_matchLess)
	{
		// If a player is carrying a rune when runes are disabled, get rid of it
		if (!cvar("k_ctf_runes")) {
			gedict_t * p;
			for (p = world; (p = find_plr(p)); ) {
				p->ctf_flag -= (p->ctf_flag & (CTF_RUNE_MASK));
				p->maxspeed = cvar("sv_maxspeed"); // Reset speed, in case was carrying haste
			}
		}
		SpawnRunes( 0 );
		AddHook ( false );
	}
}
コード例 #6
0
ファイル: vote.c プロジェクト: deurk/ktx
void vote_check_teamoverlay ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_TEAMOVERLAY ) )
		return;

	veto = is_admins_vote( OV_TEAMOVERLAY );

	if( veto || !get_votes_req( OV_TEAMOVERLAY, true ) )
	{
		vote_clear( OV_TEAMOVERLAY );

		// Toggle teamoverlay.
		cvar_fset("k_teamoverlay", !cvar("k_teamoverlay"));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("Teamoverlay %s by admin veto", OnOff(cvar("k_teamoverlay")))));
		else
			G_bprint(2, "%s\n", redtext(va("Teamoverlay %s by majority vote", OnOff(cvar("k_teamoverlay")))));

		return;
	}
}
コード例 #7
0
ファイル: vote.c プロジェクト: QuakePhil/ktx-hoonymode
void antilag( )
{
    int votes;
	
	if ( match_in_progress )
	{
        G_sprint(self, 2, "%s mode %s\n", redtext("Antilag"), OnOff(2 == cvar("sv_antilag")));
        return;
	}

	// admin may turn this status alone on server...
	if ( !is_adm( self ) )
	{
		// Dont need to bother if less than 2 players
		if ( CountPlayers() < 2 )
		{
			G_sprint(self, 2, "You need at least 2 players to do this.\n");
			return;
		}
	}

	self->v.antilag = !self->v.antilag;

	G_bprint(2, "%s %s!%s\n", self->s.v.netname, 
			(self->v.antilag ? redtext(va("votes for antilag %s", OnOff(!(2 == cvar("sv_antilag"))))) : 
							   redtext(va("withdraws %s antilag vote", g_his(self)))),
			((votes = get_votes_req( OV_ANTILAG, true )) ? va(" (%d)", votes) : ""));

	vote_check_antilag ();
}
コード例 #8
0
ファイル: ctf.c プロジェクト: deurk/ktx
void norunes()
{
	if( match_in_progress && !k_matchLess )
		return;

	if ( !isCTF() ) {
		G_sprint ( self, 2, "Can't do this in non CTF mode\n" );
		return;
	}

	cvar_toggle_msg( self, "k_ctf_runes", redtext("runes") );

	// In matchless mode, toggling runes normally won't do anything since match is already in progress. Call this to handle this scenario.
	if (k_matchLess)
	{
		// If a player is carrying a rune when runes are disabled, get rid of it
		if (!cvar("k_ctf_runes")) {
			gedict_t * p;
			for (p = world; (p = find_plr(p)); ) {
				p->ctf_flag -= (p->ctf_flag & (CTF_RUNE_MASK));
				p->maxspeed = cvar("sv_maxspeed"); // Reset speed, in case was carrying haste
			}
		}
		SpawnRunes(cvar("k_ctf_runes")); // Toggle runes
	}
}
コード例 #9
0
ファイル: combat.c プロジェクト: meag/ktx
/*
============
T_RadiusDamage
============
*/
void T_RadiusDamage( gedict_t * inflictor, gedict_t * attacker, float damage, gedict_t * ignore, deathType_t dtype )
{
	float           points;
	gedict_t       *head;
	vec3_t          org;

	head = trap_findradius( world, inflictor->s.v.origin, damage + 40 );

	while ( head )
	{
		if ( head != ignore )
		{
			if ( head->s.v.takedamage )
			{
				org[0] = inflictor->s.v.origin[0] - ( head->s.v.origin[0] + ( head->s.v.mins[0] + head->s.v.maxs[0] ) * 0.5 );
				org[1] = inflictor->s.v.origin[1] - ( head->s.v.origin[1] + ( head->s.v.mins[1] + head->s.v.maxs[1] ) * 0.5 );
				org[2] = inflictor->s.v.origin[2] - ( head->s.v.origin[2] + ( head->s.v.mins[2] + head->s.v.maxs[2] ) * 0.5 );
				points = 0.5 * vlen( org );

				if ( points < 0 )
					points = 0;

				points = damage - points;

				if ( head == attacker )
					points = points * 0.5;
				// no out of water discharge damage if k_dis 2
				else if ( cvar("k_dis") == 2 && dtLG_DIS == dtype && !head->s.v.waterlevel )
					points = 0;

				if ( points > 0 )
				{
					if ( CanDamage( head, inflictor ) )
					{
						head->deathtype = dtype;

						dmg_is_splash = 1; // mark damage as splash

						if ( cvar("k_instagib") || isRACE() ) // in instagib splash applied to inflictor only, for coil jump
						{
							if ( head == attacker )
								T_Damage( head, inflictor, attacker, points );
						}
						else
						{
							// shamblers only take half damage from rocket/grenade explosions
							if ( streq(head->s.v.classname, "monster_shambler") && !cvar("k_bloodfest") )
								points = points / 2;
							T_Damage( head, inflictor, attacker, points );
						}

						dmg_is_splash = 0; // unmark splash
					}
				}
			}
		}
		head = trap_findradius( head, inflictor->s.v.origin, damage + 40 );
	}
}
コード例 #10
0
float someShadowCvarIsEnabled(entity box)
{
	if(cvar("r_shadow_realtime_dlight"))
		if(cvar("r_shadow_realtime_dlight_shadows"))
			return TRUE;
	if(cvar("r_shadow_realtime_world"))
		if(cvar("r_shadow_realtime_world_shadows"))
			return TRUE;
	return FALSE;
}
コード例 #11
0
ファイル: checkbox.c プロジェクト: ZeusInTraining/edu2
void loadCvarsNexuizCheckBox(entity me)
{
	if(me.inverted == 0)
		me.checked = cvar(me.cvarName);
	else if(me.inverted == 1)
		me.checked = !cvar(me.cvarName);
	else if(me.inverted > 1)
		me.checked = (cvar(me.cvarName) < 0);
	else if(me.inverted < -1)
		me.checked = (cvar(me.cvarName) > 0);
}
コード例 #12
0
ファイル: crosshairbutton.c プロジェクト: VenFPS/Vengeance
void XonoticCrosshairButton_draw(entity me)
{
	vector sz, rgb;
	float a;

	rgb = eX * cvar("crosshair_color_red") + eY * cvar("crosshair_color_green") + eZ * cvar("crosshair_color_blue");
	a = cvar("crosshair_alpha");

	if(!me.checked && !me.focused)
	{
		a *= me.disabledAlpha;
		rgb = '1 1 1';
	}

	SUPER(XonoticCrosshairButton).draw(me);

	sz = draw_PictureSize(me.src3);
	sz = globalToBoxSize(sz, draw_scale);
	sz = (10 * '1 1 0' + sz * cvar("crosshair_size")) * 0.05; // (10 * '1 1 0' + ...) * 0.05 here to make visible size changes happen also at bigger sizes
	if(sz_x > 0.95)
		sz = sz * (0.95 / sz_x);
	if(sz_y > 0.95)
		sz = sz * (0.95 / sz_y);

	draw_Picture('0.5 0.5 0' - 0.5 * sz, me.src3, sz, rgb, a);
	if(cvar("crosshair_dot"))
		draw_Picture('0.5 0.5 0' - 0.5 * sz * cvar("crosshair_dot_size"), me.src4, sz * cvar("crosshair_dot_size"), rgb, a * cvar("crosshair_dot_alpha"));
}
コード例 #13
0
ファイル: slider_decibels.c プロジェクト: VenFPS/Vengeance
void XonoticDecibelsSlider_loadCvars(entity me)
{
	float v;

	if not(me.cvarName)
		return;

	v = cvar(me.cvarName);
	if(v >= 0.98)
		Slider_setValue( me, 0 );
	else if(v < 0.0005)
		Slider_setValue( me, -1000000 );
	else
		Slider_setValue( me, 0.1 * floor(0.5 + 10.0 * log10(cvar(me.cvarName)) * 10) );
}
コード例 #14
0
ファイル: admin.c プロジェクト: deurk/ktx
void ToggleMapLock ()
{
    float tmp;

    if( !is_adm( self ) )
        return;

    tmp = cvar( "k_lockmap" );

    if( tmp )
    {
		cvar_fset( "k_lockmap", 0 );

        if( !match_in_progress )
            G_bprint(2, "%s unlocks map\n", self->netname);
        else
            G_sprint(self, 2, "Map unlocked\n");

        return;
    }

	cvar_fset( "k_lockmap", 1 );

    if( !match_in_progress )
        G_bprint(2, "%s locks map\n", self->netname);
    else
        G_sprint(self, 2, "Map is locked\n");
}
コード例 #15
0
void loadCvarsNexuizGametypeButton(entity me)
{
	if not(me.cvarName)
		return;

	me.checked = cvar(me.cvarName);
}
コード例 #16
0
ファイル: slider.c プロジェクト: Bader14/Nexuiz
void NexuizSlider_loadCvars(entity me)
{
	if not(me.cvarName)
		return;

	me.setValue( me, cvar(me.cvarName) );
}
コード例 #17
0
ファイル: button.c プロジェクト: atphalix/nexuiz
float mousePressButton(entity me, vector pos)
{
	me.mouseDrag(me, pos); // verify coordinates
	if(cvar("menu_sounds"))
		localsound("sound/misc/menu2.wav");
	return 1;
}
コード例 #18
0
void XonoticCrosshairButton_loadCvars(entity me)
{
	if not(me.cvarName)
		return;

	me.checked = (cvar(me.cvarName) == me.cvarValueFloat);
}
コード例 #19
0
ファイル: spectate.c プロジェクト: devrac/ktx
////////////////
// GlobalParams:
// self
///////////////
void SpectatorDisconnect()
{
	gedict_t *p;

	if ( self->k_accepted )
	{
		for ( p = world; (p = ( match_in_progress == 2 && !cvar("k_ann") ) ? find_spc( p ) : find_client( p )); )	
			G_sprint( p, PRINT_HIGH, "Spectator %s left the game\n", self->s.v.netname );
	}

// s: added conditional function call here
	if( self->v.elect_type != etNone ) {

		if ( match_in_progress != 2 )
			G_bprint(2, "Election aborted\n");

		AbortElect();
	}

	if ( self->wizard ) {
		ent_remove( self->wizard );
		self->wizard = NULL;
	}

	if( self->k_kicking )
		ExitKick( self );

	self->s.v.classname = ""; // Cenobite, so we clear out any specs as they leave
	self->k_accepted  = 0;
	self->ct = ctNone;
}
コード例 #20
0
ファイル: logs.c プロジェクト: JosephPecoraro/ktx
void log_open( const char *fmt, ... )
{
	va_list argptr;
	char	text[1024] = {0};
 
	if ( !cvar("k_extralog") )
		return;

	log_close();

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

	text[sizeof(text)-1] = 0;

	if ( !text[0] )
		return; // name not specified
 
	if ( trap_FS_OpenFile( text, &log_handle, FS_APPEND_BIN ) < 0 )
	{
		log_handle = -1;
		return;
	}
}
コード例 #21
0
ファイル: maplist.c プロジェクト: Bader14/Nexuiz
void MapList_LoadMap(entity btn, entity me)
{
	string m;
	float i;

	i = me.selectedItem;

	if(btn.parent.instanceOfNexuizMapInfoDialog)
	{
		i = btn.parent.currentMapIndex;
		Dialog_Close(btn, btn.parent);
	}

	if(i >= me.nItems || i < 0)
		return;

	m = MapInfo_BSPName_ByID(i);
	if not(m)
	{
		print("Huh? Can't play this (m is NULL). Refiltering so this won't happen again.\n");
		return;
	}
	if(MapInfo_CheckMap(m))
	{
		localcmd("\nmenu_loadmap_prepare\n");
		if(cvar("menu_use_default_hostname"))
			localcmd("hostname \"", strdecolorize(cvar_string("_cl_name")), "'s Nexuiz server\"\n");
		MapInfo_LoadMap(m);
	}
	else
	{
		print("Huh? Can't play this (invalid game type). Refiltering so this won't happen again.\n");
		me.refilter(me);
	}
}
コード例 #22
0
ファイル: slider.c プロジェクト: adamvany/nexuiz-classbased
void loadCvarsNexuizSlider(entity me)
{
	if not(me.cvarName)
		return;

	me.value = cvar(me.cvarName);
}
コード例 #23
0
void XonoticCrosshairButton_draw(entity me)
{
	vector sz, rgb;
	float a;

	rgb = stov(cvar_string("crosshair_color"));
	a = cvar("crosshair_alpha");

	if(!me.checked && !me.focused && me.cvarValueFloat != -1)
	{
		a *= me.disabledAlpha;
		rgb = '1 1 1';
	}

	if(me.cvarValueFloat == -1) // update the preview if this is the preview button
	{
		if(me.src3)
			strunzone(me.src3);
		me.src3 = strzone(strcat("/gfx/crosshair", cvar_string("crosshair")));
		me.focused = 1;
		me.checked = 0;
	}

	SUPER(XonoticCrosshairButton).draw(me);

	sz = draw_PictureSize(me.src3);
	sz = globalToBoxSize(sz, draw_scale);
	if(me.cvarValueFloat == -1)
	{
		sz = (6 * '1 1 0' + sz * cvar("crosshair_size")) * 0.08; // (6 * '1 1 0' + ...) * 0.08 here to make visible size changes happen also at bigger sizes
		if(sz_x > 0.95)
			sz = sz * (0.95 / sz_x);
		if(sz_y > 0.95)
			sz = sz * (0.95 / sz_y);
	}
	else // show the crosshair picker at full size
		sz = '0.95 0.95 0';

	draw_Picture('0.5 0.5 0' - 0.5 * sz, me.src3, sz, rgb, a);
	if(cvar("crosshair_dot"))
    {
        if(cvar_string("crosshair_dot_color") != "0")
            rgb = stov(cvar_string("crosshair_dot_color"));
		draw_Picture('0.5 0.5 0' - 0.5 * sz * cvar("crosshair_dot_size"), me.src4, sz * cvar("crosshair_dot_size"), rgb, a * cvar("crosshair_dot_alpha"));
    }
}
コード例 #24
0
 Real getValue(SampleGenerator<Real> &sampler) {
   Real val  = RiskMeasure<Real>::val_, cvar(0);
   sampler.sumAll(&val,&cvar,1);
   for (int i = 0; i < size_; i++) {
     cvar += coeff_[i]*xvar_[i];
   }
   return cvar;
 }
コード例 #25
0
ファイル: vote.c プロジェクト: QuakePhil/ktx-hoonymode
void FixNoSpecs( void )
{
	// turn off "no specs" mode if there no players left
	if ( g_globalvars.time > 10 && !match_in_progress && !CountPlayers() && cvar("_k_nospecs") )
	{
		G_bprint(2,	"%s mode turned off\n", redtext("No spectators"));
		cvar_set("_k_nospecs", "0");
	}
}
コード例 #26
0
ファイル: vote.c プロジェクト: QuakePhil/ktx-hoonymode
void vote_check_nospecs ()
{
	int veto;

	if ( match_in_progress || intermission_running || match_over )
		return;

	if ( !get_votes( OV_NOSPECS ) )
		return;

	veto = is_admins_vote( OV_NOSPECS );

	if( veto || !get_votes_req( OV_NOSPECS, true ) )
	{
		vote_clear( OV_NOSPECS );

		// set no specs mode
		cvar_fset("_k_nospecs", !cvar("_k_nospecs"));

		if ( veto )
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by admin veto", OnOff(cvar("_k_nospecs")))));
		else
			G_bprint(2, "%s\n", redtext(va("No spectators mode %s by majority vote", OnOff(cvar("_k_nospecs")))));

		// kick specs
		if ( cvar("_k_nospecs") )
		{
			gedict_t *spec;

			for ( spec = world; (spec = find_spc( spec )); )
			{
				if ( VIP( spec ) & ALLOWED_NOSPECS_VIPS )
					continue; // don't kick this VIP
    
				if ( is_real_adm(spec) )
					continue; // don't kick real admin
    
				stuffcmd(spec, "disconnect\n");  // FIXME: stupid way
			}
		}

		return;
	}
}
コード例 #27
0
void XonoticInputSettingsTab_fill(entity me)
{
	entity e;
	entity kb;

	me.TR(me);
		me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Key bindings:")));
	me.TR(me);
		me.TD(me, me.rows - 4, 3.3, kb = makeXonoticKeyBinder());
	me.gotoRC(me, me.rows - 3, 0);
	me.TR(me);
		me.TD(me, 1, 1.1, e = makeXonoticButton(_("Change key..."), '0 0 0'));
			e.onClick = KeyBinder_Bind_Change;
			e.onClickEntity = kb;
			kb.keyGrabButton = e;
		me.TD(me, 1, 1.1, e = makeXonoticButton(_("Edit..."), '0 0 0'));
			e.onClick = KeyBinder_Bind_Edit;
			e.onClickEntity = kb;
			kb.userbindEditButton = e;
			kb.userbindEditDialog = main.userbindEditDialog;
			main.userbindEditDialog.keybindBox = kb;
		me.TD(me, 1, 1.1, e = makeXonoticButton(_("Clear"), '0 0 0'));
			e.onClick = KeyBinder_Bind_Clear;
			e.onClickEntity = kb;

	me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
		me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Sensitivity:")));
		me.TD(me, 1, 2, e = makeXonoticSlider(1, 32, 0.2, "sensitivity"));
	me.TR(me);
		if(cvar("menu_mouse_absolute") == 0) // TODO remove this entirely later
		{
			me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("UI mouse speed:")));
			me.TD(me, 1, 2, e = makeXonoticSlider(0.2, 4.0, 0.1, "menu_mouse_speed"));
		}
	me.TR(me);
		me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "m_filter", _("Mouse filter")));
	me.TR(me);
		me.TD(me, 1, 3, e = makeXonoticCheckBox(1.022, "m_pitch", _("Invert mouse")));
	me.TR(me);
		if(cvar_type("joy_enable") & CVAR_TYPEFLAG_ENGINE)
			me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joy_enable", _("Use joystick input")));
		else if(cvar_type("joystick") & CVAR_TYPEFLAG_ENGINE)
			me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joystick", _("Use joystick input")));
	me.TR(me);
		if(cvar_type("vid_dgamouse") & CVAR_TYPEFLAG_ENGINE)
			me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "vid_dgamouse", _("Turn off OS mouse acceleration")));
		else if(cvar_type("apple_mouse_noaccel") & CVAR_TYPEFLAG_ENGINE)
			me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "apple_mouse_noaccel", _("Turn off OS mouse acceleration")));
	me.TR(me);
		me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "con_closeontoggleconsole", _("\"enter console\" also closes")));
	me.TR(me);
	me.TR(me);
		me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_movement_track_canjump", _("Holding jump key keeps jumping")));
	me.gotoRC(me, me.rows - 1, 0);
		me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "sendcvar cl_movement_track_canjump", COMMANDBUTTON_APPLY));
}
コード例 #28
0
void updateConwidths()
{
	vector r, c;
	float minfactor, maxfactor;
	float sz, f;
	r_x = cvar("menu_vid_width");
	r_y = cvar("menu_vid_height");
	r_z = cvar("menu_vid_pixelheight");
	sz = cvar("menu_vid_scale");

	// calculate the base resolution
	c_z = 0;
	c_x = 800;
	c_y = c_x * r_y * r_z / r_x;
	if(c_y < 600)
	{
		c_y = 600;
		c_x = c_y * r_x / (r_y * r_z);
	}

	f = min(r_x / c_x, r_y / c_y);
	if(f < 1)
		c = c * f; // ensures that c_x <= r_x and c_y <= r_y

	minfactor = min(1, 640 / c_x);             // can be > 1 only if c_x is <640
	maxfactor = max3(1, r_x / c_x, r_y / c_y); // can be < 1 only if r_x < c_x and r_y < c_y
	dprint("min factor: ", ftos(minfactor), "\n");
	dprint("max factor: ", ftos(maxfactor), "\n");

	if(sz < 0)
		f = 1 - (maxfactor - 1) * sz;
	else if(sz > 0)
		f = 1 + (minfactor - 1) * sz;
	else
		f = 1;
	c = c * f; // fteqcc fail

	cvar_set("vid_width", ftos(rint(r_x)));
	cvar_set("vid_height", ftos(rint(r_y)));
	cvar_set("vid_pixelheight", ftos(rint(r_z)));
	cvar_set("vid_conwidth", ftos(rint(c_x)));
	cvar_set("vid_conheight", ftos(rint(c_y)));
}
コード例 #29
0
ファイル: spectate.c プロジェクト: devrac/ktx
void wizard_think()
{
	if ( !cvar("k_no_wizard_animation") ) // animate if allowed
		( self->s.v.frame )++;

	if ( self->s.v.frame > 14 || self->s.v.frame < 0 )
		self->s.v.frame = 0;

	self->s.v.nextthink = g_globalvars.time + 0.1;
}
コード例 #30
0
void showNotifyNexuizTeamSelectDialog(entity me)
{
	float teams, nTeams;
	teams = cvar("_teams_available");
	nTeams = 0;
	me.team1.disabled = !(teams & 1); nTeams += !!(teams & 1);
	me.team2.disabled = !(teams & 2); nTeams += !!(teams & 2);
	me.team3.disabled = !(teams & 4); nTeams += !!(teams & 4);
	me.team4.disabled = !(teams & 8); nTeams += !!(teams & 8);
}