当前位置: 首页>>代码示例>>C++>>正文


C++ Cvar_FullSet函数代码示例

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


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

示例1: FS_SetGamedir

/*
================
FS_SetGamedir

Sets the gamedir and path to a different directory.
================
*/
void FS_SetGamedir (const char *dir)
{
	searchpath_t	*next;

	if (strstr(dir, "..") || strchr(dir, '/')
		|| strchr(dir, '\\') || strchr(dir, ':') )
	{
		Com_Printf ("Gamedir '%s' should be a single filename, not a path\n", LOG_GENERAL, dir);
		return;
	}

	//
	// free up any current game dir info
	//
	while (fs_searchpaths != fs_base_searchpaths)
	{
		if (fs_searchpaths->pack)
		{
			fclose (fs_searchpaths->pack->h.handle);
			//Z_Free (fs_searchpaths->pack->files);
			rbdestroy (fs_searchpaths->pack->rb);
			Z_Free (fs_searchpaths->pack);
		}
		next = fs_searchpaths->next;
		Z_Free (fs_searchpaths);
		fs_searchpaths = next;
	}

	//
	// flush all data, so it will be forced to reload
	//

	FS_FlushCache();

#ifndef DEDICATED_ONLY
#ifndef NO_SERVER
	if (!dedicated->intvalue)
	{
#endif
		//Cbuf_AddText ("vid_restart\nsnd_restart\n");
		Cmd_ExecuteString ("vid_restart");
		Cmd_ExecuteString ("snd_restart");
#ifndef NO_SERVER
	}
#endif
#endif

	if (!strcmp(dir,BASEDIRNAME) || (*dir == 0))
	{
		Com_sprintf (fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basedir->string, BASEDIRNAME);
		Cvar_FullSet ("gamedir", "", CVAR_SERVERINFO|CVAR_NOSET);
		Cvar_FullSet ("game", "", CVAR_LATCH|CVAR_SERVERINFO);
	}
	else
	{
		Com_sprintf (fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basedir->string, dir);
		Cvar_FullSet ("gamedir", dir, CVAR_SERVERINFO|CVAR_NOSET);
		FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
	}
}
开发者ID:Slipyx,项目名称:r1q2,代码行数:67,代码来源:files.c

示例2: NET_Init

/*
====================
NET_Init
====================
*/
void NET_Init (void)
{
	char *ip = (*ps.params.ip) ? ps.params.ip : "0.0.0.0";
	char port[64] = {0};

	snprintf(port, sizeof(port), "%d", 	ps.params.port ? ps.params.port : QWFWD_DEFAULT_PORT);

	if (*ps.params.ip) // if cmd line - force it, so we have priority over cfg
		net_ip	 = Cvar_FullSet("net_ip", ip, CVAR_NOSET);
	else
		net_ip	 = Cvar_Get("net_ip",	  ip, CVAR_NOSET);

	if (ps.params.port) // if cmd line - force it, so we have priority over cfg
		net_port = Cvar_FullSet("net_port",	port, CVAR_NOSET);
	else
		net_port = Cvar_Get("net_port",		port, CVAR_NOSET);

#ifdef _WIN32
	{
		WSADATA		winsockdata;

		if (WSAStartup(MAKEWORD (2, 1), &winsockdata))
			Sys_Error("WinSock initialization failed");
	}
#endif

	if ((net_socket = NET_UDP_OpenSocket(net_ip->string, net_port->integer, true)) == INVALID_SOCKET)
		Sys_Error("NET_Init: failed to initialize socket");

	// init the message buffer
	SZ_InitEx(&net_message, net_message_buffer, sizeof(net_message_buffer), false);

	Sys_DPrintf("UDP Initialized\n");
}
开发者ID:deurk,项目名称:qwfwd,代码行数:39,代码来源:net.c

示例3: map

/*
==================
SV_MapBackground_f

Set background map (enable physics in menu)
==================
*/
void SV_MapBackground_f( void )
{
	string	mapname;
	int	flags;

	if( Cmd_Argc() != 2 )
	{
		Msg( "Usage: map_background <mapname>\n" );
		return;
	}

	if( sv.state == ss_active && !sv.background )
	{
		Msg( "SV_NewMap: can't set background map while game is active\n" );
		return;
	}

	// hold mapname to other place
	Q_strncpy( mapname, Cmd_Argv( 1 ), sizeof( mapname ));
	flags = SV_MapIsValid( mapname, GI->sp_entity, NULL );

	if(!( flags & MAP_IS_EXIST ))
	{
		Msg( "SV_NewMap: map %s doesn't exist\n", mapname );
		return;
	}

	// background maps allow without spawnpoints (just throw warning)
	if(!( flags & MAP_HAS_SPAWNPOINT ))
		MsgDev( D_WARN, "SV_NewMap: map %s doesn't have a valid spawnpoint\n", mapname );

	Q_strncpy( host.finalmsg, "", MAX_STRING );
	SV_Shutdown( true );
	NET_Config ( false ); // close network sockets

	sv.background = true;
	sv.loadgame = false; // set right state

	// reset all multiplayer cvars
	Cvar_FullSet( "coop", "0",  CVAR_LATCH );
	Cvar_FullSet( "teamplay", "0",  CVAR_LATCH );
	Cvar_FullSet( "deathmatch", "0",  CVAR_LATCH );
	Cvar_FullSet( "maxplayers", "1", CVAR_LATCH );

#ifndef _DEDICATED
	SCR_BeginLoadingPlaque( true );
#endif

	SV_SpawnServer( mapname, NULL );
	SV_LevelInit( mapname, NULL, NULL, false );
	SV_ActivateServer ();
}
开发者ID:Xash3DLinux,项目名称:xash3dlinux,代码行数:59,代码来源:sv_cmds.c

示例4: FS_SetGamedir

/*
================
FS_SetGamedir

Sets the gamedir and path to a different directory.
================
*/
void FS_SetGamedir(char *dir)
{
	searchpath_t	*next;

	if (strstr(dir, "..") || strstr(dir, "/")
		|| strstr(dir, "\\") || strstr(dir, ":"))
	{
		Com_Printf("Gamedir should be a single filename, not a path\n");
		return;
	}

	//
	// free up any current game dir info
	//
	while (fs_searchpaths != fs_base_searchpaths)
	{
		if (fs_searchpaths->pack)
		{
			fclose(fs_searchpaths->pack->handle);
			Z_Free(fs_searchpaths->pack->files);
			Z_Free(fs_searchpaths->pack);
		}
		next = fs_searchpaths->next;
		Z_Free(fs_searchpaths);
		fs_searchpaths = next;
	}

	//
	// flush all data, so it will be forced to reload
	//
	if (dedicated && !dedicated->value)
		Cbuf_AddText("vid_restart\nsnd_restart\n");

	Com_sprintf(fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basedir->string, dir);

	if (!strcmp(dir, BASEDIRNAME) || (*dir == 0))
	{
		Cvar_FullSet("gamedir", "", CVAR_SERVERINFO | CVAR_NOSET);
		Cvar_FullSet("game", "", CVAR_LATCH | CVAR_SERVERINFO);
	}
	else
	{
		Cvar_FullSet("gamedir", dir, CVAR_SERVERINFO | CVAR_NOSET);
		if (fs_cddir->string[0])
			FS_AddGameDirectory(va("%s/%s", fs_cddir->string, dir));
		FS_AddGameDirectory(va("%s/%s", fs_basedir->string, dir));
	}
}
开发者ID:qbism,项目名称:qbq2,代码行数:55,代码来源:files.c

示例5: CL_StopPlayback

/*
==============
CL_StopPlayback

Called when a demo file runs out, or the user starts a game
==============
*/
void CL_StopPlayback( void )
{
	if( !cls.demoplayback ) return;

	// release demofile
	FS_Close( cls.demofile );
	cls.demoplayback = false;
	demo.framecount = 0;
	cls.demofile = NULL;

	cls.olddemonum = max( -1, cls.demonum - 1 );
	Mem_Free( demo.directory.entries );
	demo.directory.numentries = 0;
	demo.directory.entries = NULL;
	demo.entry = NULL;

	cls.demoname[0] = '\0';	// clear demoname too
	menu.globals->demoname[0] = '\0';

	S_StopAllSounds();
	S_StopBackgroundTrack();

	if( !cls.changedemo )
	{
		// let game known about demo state	
		Cvar_FullSet( "cl_background", "0", CVAR_READ_ONLY );
		cls.state = ca_disconnected;
		cl.background = 0;
		cls.demonum = -1;
	}
}
开发者ID:nekonomicon,项目名称:xash3d,代码行数:38,代码来源:cl_demo.c

示例6: Cvar_Set_f

/*
============
Cvar_Set_f

Allows setting and defining of arbitrary cvars from console
============
*/
void Cvar_Set_f (void)
{
	int		c;
	int		flags;

	c = Cmd_Argc();
	if (c != 3 && c != 4)
	{
		Com_Printf ("usage: set <variable> <value> [u / s]\n");
		return;
	}

	if (c == 4)
	{
		if (!strcmp(Cmd_Argv(3), "u"))
			flags = CVAR_USERINFO;
		else if (!strcmp(Cmd_Argv(3), "s"))
			flags = CVAR_SERVERINFO;
		else
		{
			Com_Printf ("flags can only be 'u' or 's'\n");
			return;
		}
		Cvar_FullSet (Cmd_Argv(1), Cmd_Argv(2), flags);
	}
	else
		Cvar_Set (Cmd_Argv(1), Cmd_Argv(2));
}
开发者ID:weimingtom,项目名称:quakesdl2,代码行数:35,代码来源:cvar.c

示例7: Cvar_Set_f

/**
 * @brief Allows setting and defining of arbitrary cvars from console
 */
static void Cvar_Set_f (void)
{
	const int c = Cmd_Argc();
	if (c != 3 && c != 4) {
		Com_Printf("Usage: %s <variable> <value> [u / s]\n", Cmd_Argv(0));
		return;
	}

	if (c == 4) {
		const char* arg = Cmd_Argv(3);
		int flags = 0;

		while (arg[0] != '\0') {
			switch (arg[0]) {
			case 'u':
				flags |= CVAR_USERINFO;
				break;
			case 's':
				flags |= CVAR_SERVERINFO;
				break;
			case 'a':
				flags |= CVAR_ARCHIVE;
				break;
			default:
				Com_Printf("invalid flags %c given\n", arg[0]);
				break;
			}
			arg++;
		}
		Cvar_FullSet(Cmd_Argv(1), Cmd_Argv(2), flags);
	} else {
		Cvar_Set(Cmd_Argv(1), "%s", Cmd_Argv(2));
	}
}
开发者ID:drone-pl,项目名称:ufoai,代码行数:37,代码来源:cvar.cpp

示例8: Cvar_Switch_f

/**
 * @brief Allows switching boolean cvars between zero and not-zero from console
 */
static void Cvar_Switch_f (void)
{
	const int c = Cmd_Argc();
	if (c != 2 && c != 3) {
		Com_Printf("Usage: %s <variable> [u / s / a]\n", Cmd_Argv(0));
		return;
	}

	if (c == 3) {
		const char* arg = Cmd_Argv(2);
		int flags = 0;

		while (arg[0] != '\0') {
			switch (arg[0]) {
			case 'u':
				flags |= CVAR_USERINFO;
				break;
			case 's':
				flags |= CVAR_SERVERINFO;
				break;
			case 'a':
				flags |= CVAR_ARCHIVE;
				break;
			default:
				Com_Printf("invalid flags %c given\n", arg[0]);
				break;
			}
			arg++;
		}
		Cvar_FullSet(Cmd_Argv(1), va("%i", !Cvar_GetInteger(Cmd_Argv(1))), flags);
	} else {
		Com_Printf("val: %i\n", Cvar_GetInteger(Cmd_Argv(1)));
		Cvar_Set(Cmd_Argv(1), "%i", !Cvar_GetInteger(Cmd_Argv(1)));
	}
}
开发者ID:drone-pl,项目名称:ufoai,代码行数:38,代码来源:cvar.cpp

示例9: Cvar_SetWithFlag_f

static void Cvar_SetWithFlag_f( cvar_flag_t flag )
{
	if( Cmd_Argc() != 3 )
	{
		Com_Printf( "usage: %s <variable> <value>\n", Cmd_Argv( 0 ) );
		return;
	}
	Cvar_FullSet( Cmd_Argv( 1 ), Cmd_Argv( 2 ), flag, qfalse );
}
开发者ID:codetwister,项目名称:qfusion,代码行数:9,代码来源:cvar.c

示例10: SV_AntiCheat_ParseReady

static void SV_AntiCheat_ParseReady (void)
{
	//SV_BroadcastPrintf (PRINT_HIGH, ANTICHEATMESSAGE " Anticheat server connection established. Please reconnect if you are using an anticheat-capable client.\n");
	anticheat_ready = true;
	retryBackOff = DEFAULT_BACKOFF;
	Com_Printf ("ANTICHEAT: Ready to serve anticheat clients.\n", LOG_ANTICHEAT);

	Cvar_FullSet ("anticheat", sv_require_anticheat->string, CVAR_SERVERINFO | CVAR_NOSET);
}
开发者ID:Slipyx,项目名称:r1q2,代码行数:9,代码来源:sv_anticheat.c

示例11: SV_AntiCheat_Disconnect

void SV_AntiCheat_Disconnect (void)
{
	if (!acSocket)
		return;

	closesocket (acSocket);
	acSocket = 0;
	retryTime = 0;
	anticheat_ready = false;
	ping_pending = false;

	Cvar_FullSet ("anticheat", "0", CVAR_NOSET);
}
开发者ID:Slipyx,项目名称:r1q2,代码行数:13,代码来源:sv_anticheat.c

示例12: Cvar_Set_f

/*
============
Cvar_Set_f

Allows setting and defining of arbitrary cvars from console
============
*/
static void Cvar_Set_f (void)
{
	int		c;
	int		flags;

	c = Cmd_Argc();
	//if (c != 3 && c != 4)
	if (c < 3)
	{
		Com_Printf ("usage: set <variable> <value> [u / s] (line: set %s)\n", LOG_GENERAL, Cmd_Args());
		return;
	}

	//r1: fixed so that 'set variable some thing' results in variable -> "some thing"
	//so that set command can be used in aliases to set things with spaces without
	//requring quotes.

	if (!strcmp(Cmd_Argv(c-1), "u"))
		flags = CVAR_USERINFO;
	else if (!strcmp(Cmd_Argv(3), "s"))
		flags = CVAR_SERVERINFO;
	else
		flags = 0;


	if (flags)
	{
		/*char	string[2048];
		int		i;

		string[0] = 0;

		for (i=2 ; i<c-1 ; i++)
		{
			strcat (string, Cmd_Argv(i));
			if (i+1 != c-1)
				strcat (string, " ");
		}*/

		//note, we don't do the above to get the full string since userinfo vars
		//have to use same format as 3.20 (eg set undef $undef u should set undef "u")
		//for q2admin and other userinfo checking mods.
		Cvar_FullSet (Cmd_Argv(1), Cmd_Argv(2), flags);
	}
	else
	{
		Cvar_Set (Cmd_Argv(1), Cmd_Args2(2));
	}
}
开发者ID:turol,项目名称:webquake2,代码行数:56,代码来源:cvar.c

示例13: VID_StartupGamma

void VID_StartupGamma( void )
{
	// Device supports gamma anyway, but cannot do anything with it.
	fs_offset_t	gamma_size;
	byte	*savedGamma;
	size_t	gammaTypeSize = sizeof(glState.stateRamp);

	// init gamma ramp
	Q_memset( glState.stateRamp, 0, gammaTypeSize);

	// force to set cvar
	Cvar_FullSet( "gl_ignorehwgamma", "1", CVAR_GLCONFIG );

	glConfig.deviceSupportsGamma = false;	// even if supported!
	BuildGammaTable( vid_gamma->value, vid_texgamma->value );
	MsgDev( D_NOTE, "VID_StartupGamma: software gamma initialized\n" );
}
开发者ID:Reedych,项目名称:xash3d,代码行数:17,代码来源:gl_vidnt_nanogl.c

示例14: Sv_LoadMedia

/*
 * @brief Loads the map or demo file and populates the server-controlled "config
 * strings."  We hand off the entity string to the game module, which will
 * load the rest.
 */
static void Sv_LoadMedia(const char *server, sv_state_t state) {
	int32_t i, map_size;

	strcpy(sv.name, server);
	strcpy(sv.config_strings[CS_NAME], server);

	if (state == SV_ACTIVE_DEMO) { // loading a demo
		sv.models[0] = Cm_LoadBsp(NULL, &map_size);

		sv.demo_file = Fs_OpenRead(va("demos/%s.dem", sv.name));
		svs.spawn_count = 0;

		Com_Print("  Loaded demo %s.\n", sv.name);
	} else { // loading a map
		g_snprintf(sv.config_strings[CS_MODELS], MAX_QPATH, "maps/%s.bsp", sv.name);

		sv.models[0] = Cm_LoadBsp(sv.config_strings[CS_MODELS], &map_size);

		const char *dir = Fs_RealDir(sv.config_strings[CS_MODELS]);
		if (g_str_has_suffix(dir, ".zip")) {
			g_strlcpy(sv.config_strings[CS_ZIP], Basename(dir), MAX_QPATH);
		}

		for (i = 1; i < Cm_NumModels(); i++) {

			char *s = sv.config_strings[CS_MODELS + i];
			g_snprintf(s, MAX_QPATH, "*%d", i);

			sv.models[i] = Cm_Model(s);
		}

		sv.state = SV_LOADING;

		Sv_InitWorld();

		svs.game->SpawnEntities(sv.name, Cm_EntityString());

		Sv_CreateBaseline();

		Com_Print("  Loaded map %s, %d entities.\n", sv.name, svs.game->num_edicts);
	}
	g_snprintf(sv.config_strings[CS_BSP_SIZE], MAX_QPATH, "%i", map_size);

	Cvar_FullSet("map_name", sv.name, CVAR_SERVER_INFO | CVAR_NO_SET);
}
开发者ID:devilx4,项目名称:quake2world,代码行数:50,代码来源:sv_init.c

示例15: CL_ClearState

/*
=====================
CL_ClearState

=====================
*/
void CL_ClearState( void )
{
	S_StopAllSounds ();
	CL_ClearEffects ();
	CL_FreeEdicts ();

	CL_ClearPhysEnts ();

	// wipe the entire cl structure
	Q_memset( &cl, 0, sizeof( cl ));
	BF_Clear( &cls.netchan.message );
	Q_memset( &clgame.fade, 0, sizeof( clgame.fade ));
	Q_memset( &clgame.shake, 0, sizeof( clgame.shake ));
	Cvar_FullSet( "cl_background", "0", CVAR_READ_ONLY );
	cl.refdef.movevars = &clgame.movevars;
	cl.maxclients = 1; // allow to drawing player in menu

	Cvar_SetFloat( "scr_download", 0.0f );
	Cvar_SetFloat( "scr_loading", 0.0f );

	// restore real developer level
	host.developer = host.old_developer;
}
开发者ID:ShaunNoWay,项目名称:xash3d,代码行数:29,代码来源:cl_main.c


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