• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cvar函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cvar函数的典型用法代码示例。如果您正苦于以下问题:C++ cvar函数的具体用法?C++ cvar怎么用?C++ cvar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cvar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: vote_check_antilag

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;
	}
}
开发者ID:QuakePhil,项目名称:ktx-hoonymode,代码行数:27,代码来源:vote.c


示例2: nospecs

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 ();
}
开发者ID:QuakePhil,项目名称:ktx-hoonymode,代码行数:30,代码来源:vote.c


示例3: vote_check_coop

// { 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;
	}
}
开发者ID:QuakePhil,项目名称:ktx-hoonymode,代码行数:36,代码来源:vote.c


示例4: teamoverlay

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 ();
}
开发者ID:deurk,项目名称:ktx,代码行数:30,代码来源:vote.c


示例5: mctf

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 );
	}
}
开发者ID:deurk,项目名称:ktx,代码行数:35,代码来源:ctf.c


示例6: vote_check_teamoverlay

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;
	}
}
开发者ID:deurk,项目名称:ktx,代码行数:27,代码来源:vote.c


示例7: antilag

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 ();
}
开发者ID:QuakePhil,项目名称:ktx-hoonymode,代码行数:30,代码来源:vote.c


示例8: norunes

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
	}
}
开发者ID:deurk,项目名称:ktx,代码行数:26,代码来源:ctf.c


示例9: T_RadiusDamage

/*
============
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 );
	}
}
开发者ID:meag,项目名称:ktx,代码行数:64,代码来源:combat.c


示例10: someShadowCvarIsEnabled

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;
}
开发者ID:aspotton,项目名称:xonotic-data-patches,代码行数:10,代码来源:dialog_settings_effects.c


示例11: loadCvarsNexuizCheckBox

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);
}
开发者ID:ZeusInTraining,项目名称:edu2,代码行数:11,代码来源:checkbox.c


示例12: XonoticCrosshairButton_draw

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"));
}
开发者ID:VenFPS,项目名称:Vengeance,代码行数:28,代码来源:crosshairbutton.c


示例13: XonoticDecibelsSlider_loadCvars

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) );
}
开发者ID:VenFPS,项目名称:Vengeance,代码行数:15,代码来源:slider_decibels.c


示例14: ToggleMapLock

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");
}
开发者ID:deurk,项目名称:ktx,代码行数:28,代码来源:admin.c


示例15: loadCvarsNexuizGametypeButton

void loadCvarsNexuizGametypeButton(entity me)
{
	if not(me.cvarName)
		return;

	me.checked = cvar(me.cvarName);
}
开发者ID:nexAkari,项目名称:RocketMinsta,代码行数:7,代码来源:gametypebutton.c


示例16: NexuizSlider_loadCvars

void NexuizSlider_loadCvars(entity me)
{
	if not(me.cvarName)
		return;

	me.setValue( me, cvar(me.cvarName) );
}
开发者ID:Bader14,项目名称:Nexuiz,代码行数:7,代码来源:slider.c


示例17: mousePressButton

float mousePressButton(entity me, vector pos)
{
	me.mouseDrag(me, pos); // verify coordinates
	if(cvar("menu_sounds"))
		localsound("sound/misc/menu2.wav");
	return 1;
}
开发者ID:atphalix,项目名称:nexuiz,代码行数:7,代码来源:button.c


示例18: XonoticCrosshairButton_loadCvars

void XonoticCrosshairButton_loadCvars(entity me)
{
	if not(me.cvarName)
		return;

	me.checked = (cvar(me.cvarName) == me.cvarValueFloat);
}
开发者ID:danidomi,项目名称:xonotic-data.pk3dir,代码行数:7,代码来源:crosshairbutton.c


示例19: SpectatorDisconnect

////////////////
// 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;
}
开发者ID:devrac,项目名称:ktx,代码行数:35,代码来源:spectate.c


示例20: log_open

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;
	}
}
开发者ID:JosephPecoraro,项目名称:ktx,代码行数:25,代码来源:logs.c



注:本文中的cvar函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cvfixnum函数代码示例发布时间:2022-05-30
下一篇:
C++ cv_wait_sig函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap