您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CM_LoadMap函数代码示例

51自学网 2021-06-01 20:03:08
  C++
这篇教程C++ CM_LoadMap函数代码示例写得很实用,希望能帮到您。

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

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

示例1: testMapLoading

static void testMapLoading (void){	if (FS_CheckFile("maps/%s.bsp", mapName) != -1) {		CM_LoadMap(mapName, qtrue, "", &mapData, &mapTiles);		CM_LoadMap(mapName, qtrue, "", &mapData, &mapTiles);	} else {		UFO_CU_FAIL_MSG(va("Map resource '%s.bsp' for test is missing.", mapName));	}}
开发者ID:kevlund,项目名称:ufoai,代码行数:9,


示例2: testMapLoading

static void testMapLoading (void){	if (FS_CheckFile("maps/%s.bsp", mapName) != -1) {		char entityString[MAX_TOKEN_CHARS];		CM_LoadMap(mapName, true, "", entityString, &mapData, &mapTiles);		CM_LoadMap(mapName, true, "", entityString, &mapData, &mapTiles);	} else {		UFO_CU_FAIL_MSG(va("Map resource '%s.bsp' for test is missing.", mapName));	}}
开发者ID:cigo,项目名称:ufoai,代码行数:10,


示例3: AAS_CalcReachAndClusters

void AAS_CalcReachAndClusters( struct quakefile_s *qf ) {	float time;	Log_Print( "loading collision map.../n" );	//	if ( !qf->pakfile[0] ) {		strcpy( qf->pakfile, qf->filename );	}	//load the map	CM_LoadMap( (char *) qf, qfalse, &( *aasworld ).bspchecksum );	//get a handle to the world model	worldmodel = CM_InlineModel( 0 );     // 0 = world, 1 + are bmodels	//initialize bot import structure	AAS_InitBotImport();	//load the BSP entity string	AAS_LoadBSPFile();	//init physics settings	AAS_InitSettings();	//initialize AAS link heap	AAS_InitAASLinkHeap();	//initialize the AAS linked entities for the new map	AAS_InitAASLinkedEntities();	//reset all reachabilities and clusters	( *aasworld ).reachabilitysize = 0;	( *aasworld ).numclusters = 0;	//set all view portals as cluster portals in case we re-calculate the reachabilities and clusters (with -reach)	AAS_SetViewPortalsAsClusterPortals();	//calculate reachabilities	AAS_InitReachability();	time = 0;	while ( AAS_ContinueInitReachability( time ) ) time++;	//calculate clusters	AAS_InitClustering();} //end of the function AAS_CalcReachAndClusters
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:34,


示例4: CLQW_Model_NextDownload

static void CLQW_Model_NextDownload() {	if ( clc.downloadNumber == 0 ) {		common->Printf( "Checking models.../n" );		clc.downloadNumber = 1;	}	clc.downloadType = dl_model;	for (		; cl.qh_model_name[ clc.downloadNumber ][ 0 ]		; clc.downloadNumber++ ) {		const char* s = cl.qh_model_name[ clc.downloadNumber ];		if ( s[ 0 ] == '*' ) {			continue;	// inline brush model		}		if ( !CL_CheckOrDownloadFile( s ) ) {			return;		// started a download		}	}	CM_LoadMap( cl.qh_model_name[ 1 ], true, NULL );	cl.model_clip[ 1 ] = 0;	R_LoadWorld( cl.qh_model_name[ 1 ] );	for ( int i = 2; i < MAX_MODELS_Q1; i++ ) {		if ( !cl.qh_model_name[ i ][ 0 ] ) {			break;		}		cl.model_draw[ i ] = CLQ1_RegisterModel( cl.qh_model_name[ i ] );		if ( cl.qh_model_name[ i ][ 0 ] == '*' ) {			cl.model_clip[ i ] = CM_InlineModel( String::Atoi( cl.qh_model_name[ i ] + 1 ) );		}		if ( !cl.model_draw[ i ] ) {			common->Printf( "/nThe required model file '%s' could not be found or downloaded./n/n",				cl.qh_model_name[ i ] );			common->Printf( "You may need to download or purchase a %s client "							"pack in order to play on this server./n/n", fs_gamedir );			CL_Disconnect( true );			return;		}	}	CLQW_CalcModelChecksum( "progs/player.mdl", "pmodel" );	CLQW_CalcModelChecksum( "progs/eyes.mdl", "emodel" );	// all done	R_EndRegistration();	int CheckSum1;	int CheckSum2;	CM_MapChecksums( CheckSum1, CheckSum2 );	// done with modellist, request first of static signon messages	CL_AddReliableCommand( va( "prespawn %i 0 %i", cl.servercount, CheckSum2 ) );}
开发者ID:janisl,项目名称:jlquake,代码行数:56,


示例5: CLT3_CM_LoadMap

//	Just adds default parameters that cgame doesn't need to know aboutvoid CLT3_CM_LoadMap( const char* mapname ) {	if ( GGameType & ( GAME_WolfMP | GAME_ET ) && com_sv_running->integer ) {		// TTimo		// catch here when a local server is started to avoid outdated com_errorDiagnoseIP		Cvar_Set( "com_errorDiagnoseIP", "" );	}	int checksum;	CM_LoadMap( mapname, true, &checksum );}
开发者ID:janisl,项目名称:jlquake,代码行数:11,


示例6: sizeof

void VM::VMInit() {	// Allocate entities and clients shared memory region	shmRegion = IPC::SharedMemory::Create(sizeof(gentity_t) * MAX_GENTITIES + sizeof(gclient_t) * MAX_CLIENTS);	char* shmBase = reinterpret_cast<char*>(shmRegion.GetBase());	g_entities = reinterpret_cast<gentity_t*>(shmBase);	g_clients = reinterpret_cast<gclient_t*>(shmBase + sizeof(gentity_t) * MAX_GENTITIES);	// Load the map collision data	std::string mapName = Cvar::GetValue("mapname");	CM_LoadMap(mapName);	G_CM_ClearWorld();}
开发者ID:RamchandraApte,项目名称:Unvanquished,代码行数:12,


示例7: CL_CM_LoadMap

/*====================CL_CM_LoadMapJust adds default parameters that cgame doesn't need to know about====================*/void CL_CM_LoadMap( const char *mapname ) {	int checksum;	// DHM - Nerve :: If we are not running the server, then set expected usage here	if ( !com_sv_running->integer ) {		CL_SetExpectedHunkUsage( mapname );	} else	{		// TTimo		// catch here when a local server is started to avoid outdated com_errorDiagnoseIP		Cvar_Set( "com_errorDiagnoseIP", "" );	}	CM_LoadMap( mapname, qtrue, &checksum );}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:22,


示例8: CL_CanMultiplayerStart

/** * @return @c true if are a compatible client and nothing else must be downloaded or no downloads are still running, * @c false if the start of the match must get a little bit postponed (running downloads). * @note throws ERR_DISCONNECT if we are not compatible to the server */static bool CL_CanMultiplayerStart (void){	const int day = CL_GetConfigStringInteger(CS_LIGHTMAP);	const char* serverVersion = CL_GetConfigString(CS_VERSION);	/* checksum doesn't match with the one the server gave us via configstring */	if (!Q_streq(UFO_VERSION, serverVersion)) {		Com_sprintf(popupText, sizeof(popupText), _("Local game version (%s) differs from the server version (%s)"), UFO_VERSION, serverVersion);		UI_Popup(_("Error"), popupText);		Com_Error(ERR_DISCONNECT, "Local game version (%s) differs from the server version (%s)", UFO_VERSION, serverVersion);	/* amount of objects from script files doesn't match */	} else if (csi.numODs != CL_GetConfigStringInteger(CS_OBJECTAMOUNT)) {		UI_Popup(_("Error"), _("Script files are not the same"));		Com_Error(ERR_DISCONNECT, "Script files are not the same");	}	/* activate the map loading screen for multiplayer, too */	SCR_BeginLoadingPlaque();	/* check download */	if (cls.downloadMaps) { /* confirm map */		if (CL_DownloadMap(CL_GetConfigString(CS_NAME)))			return false;		cls.downloadMaps = false;	}	/* map might still be downloading? */	if (CL_PendingHTTPDownloads())		return false;	if (Com_GetScriptChecksum() != CL_GetConfigStringInteger(CS_UFOCHECKSUM))		Com_Printf("You are using modified ufo script files - might produce problems/n");	CM_LoadMap(CL_GetConfigString(CS_TILES), day, CL_GetConfigString(CS_POSITIONS), CL_GetConfigString(CS_ENTITYSTRING), cl.mapData, cl.mapTiles);#if 0	if (cl.mapData->mapChecksum != CL_GetConfigStringInteger(CS_MAPCHECKSUM)) {		UI_Popup(_("Error"), _("Local map version differs from server"));		Com_Error(ERR_DISCONNECT, "Local map version differs from server: %u != '%i'",			cl.mapData->mapChecksum, CL_GetConfigStringInteger(CS_MAPCHECKSUM));	}#endif	return true;}
开发者ID:Astrocoderguy,项目名称:ufoai,代码行数:50,


示例9: CLQ2_Precache_f

//	The server will send this command right// before allowing the client into the serverstatic void CLQ2_Precache_f() {	//Yet another hack to let old demos work	//the old precache sequence	if ( Cmd_Argc() < 2 ) {		int map_checksum;		// for detecting cheater maps		CM_LoadMap( cl.q2_configstrings[ Q2CS_MODELS + 1 ], true, &map_checksum );		CLQ2_RegisterSounds();		CLQ2_PrepRefresh();		return;	}	clq2_precache_check = Q2CS_MODELS;	clq2_precache_spawncount = String::Atoi( Cmd_Argv( 1 ) );	clq2_precache_model = 0;	clq2_precache_model_skin = 0;	CLQ2_RequestNextDownload();}
开发者ID:janisl,项目名称:jlquake,代码行数:20,


示例10: CL_Precache_f

/* * The server will send this command right * before allowing the client into the server */voidCL_Precache_f(void){	/* Yet another hack to let old demos work */	if (Cmd_Argc() < 2)	{		unsigned map_checksum;    /* for detecting cheater maps */		CM_LoadMap(cl.configstrings[CS_MODELS + 1], true, &map_checksum);		CL_RegisterSounds();		CL_PrepRefresh();		return;	}	precache_check = CS_MODELS;	precache_spawncount = (int)strtol(Cmd_Argv(1), (char **)NULL, 10);	precache_model = 0;	precache_model_skin = 0;	CL_RequestNextDownload();}
开发者ID:Pickle,项目名称:yquake2,代码行数:26,


示例11: SV_SpawnServer

//.........这里部分代码省略.........//  Cvar_Set( "nextmap", va("map %s", server) );	// Ridah	// DHM - Nerve :: We want to use the completion bar in multiplayer as well	// Arnout: just always use it//  if( !SV_GameIsSinglePlayer() ) {	SV_SetExpectedHunkUsage( va( "maps/%s.bsp", server ) );//  } else {	// just set it to a negative number,so the cgame knows not to draw the percent bar//      Cvar_Set( "com_expectedhunkusage", "-1" );//  }	// make sure we are not paused	Cvar_Set( "cl_paused", "0" );#if !defined( DO_LIGHT_DEDICATED )	// get a new checksum feed and restart the file system	srand( Sys_Milliseconds() );	sv.checksumFeed = ( ( ( int ) rand() << 16 ) ^ rand() ) ^ Sys_Milliseconds();	// DO_LIGHT_DEDICATED	// only comment out when you need a new pure checksum string and it's associated random feed	//Com_DPrintf("SV_SpawnServer checksum feed: %p/n", sv.checksumFeed);#else // DO_LIGHT_DEDICATED implementation below	// we are not able to randomize the checksum feed since the feed is used as key for pure_checksum computations	// files.c 1776 : pack->pure_checksum = Com_BlockChecksumKey( fs_headerLongs, 4 * fs_numHeaderLongs, LittleLong(fs_checksumFeed) );	// we request a fake randomized feed, files.c knows the answer	srand( Sys_Milliseconds() );	sv.checksumFeed = FS_RandChecksumFeed();#endif	FS_Restart( sv.checksumFeed );	CM_LoadMap( va( "maps/%s.bsp", server ), qfalse, &checksum );	// set serverinfo visible name	Cvar_Set( "mapname", server );	Cvar_Set( "sv_mapChecksum", va( "%i", checksum ) );	sv_newGameShlib = Cvar_Get( "sv_newGameShlib", "", CVAR_TEMP );	// serverid should be different each time	sv.serverId = com_frameTime;	sv.restartedServerId = sv.serverId;	sv.checksumFeedServerId = sv.serverId;	Cvar_Set( "sv_serverid", va( "%i", sv.serverId ) );	// clear physics interaction links	SV_ClearWorld();	// media configstring setting should be done during	// the loading stage, so connected clients don't have	// to load during actual gameplay	sv.state = SS_LOADING;	Cvar_Set( "sv_serverRestarting", "1" );	// load and spawn all other entities	SV_InitGameProgs();	// don't allow a map_restart if game is modified	// Arnout: there isn't any check done against this, obsolete//  sv_gametype->modified = qfalse;	// run a few frames to allow everything to settle
开发者ID:SHOVELL,项目名称:Unvanquished,代码行数:67,


示例12: CL_CM_LoadMap

/*====================CL_CM_LoadMapJust adds default parameters that cgame doesn't need to know about====================*/void CL_CM_LoadMap( const char *mapname ) {	int		checksum;	CM_LoadMap( mapname, qtrue, &checksum );}
开发者ID:BruceJohnJennerLawso,项目名称:quake3,代码行数:12,


示例13: SV_SpawnServer

/*================SV_SpawnServerChange the server to a new map, taking all connectedclients along with it.================*/void SV_SpawnServer (char *server, char *spawnpoint, server_state_t serverstate, qboolean attractloop, qboolean loadgame){	int			i;	unsigned	checksum;	if (attractloop)		Cvar_Set ("paused", "0");	Com_Printf ("------- Server Initialization -------/n");	Com_DPrintf ("SpawnServer: %s/n",server);	if (sv.demofile)		fclose (sv.demofile);	svs.spawncount++;		// any partially connected client will be							// restarted	sv.state = ss_dead;	Com_SetServerState (sv.state);	// wipe the entire per-level structure	memset (&sv, 0, sizeof(sv));	svs.realtime = 0;	sv.loadgame = loadgame;	sv.attractloop = attractloop;	// save name for levels that don't set message	strcpy (sv.configstrings[CS_NAME], server);	if (Cvar_VariableValue ("deathmatch"))	{		sprintf(sv.configstrings[CS_AIRACCEL], "%g", sv_airaccelerate->value);		pm_airaccelerate = sv_airaccelerate->value;	}	else	{		strcpy(sv.configstrings[CS_AIRACCEL], "0");		pm_airaccelerate = 0;	}	SZ_Init (&sv.multicast, sv.multicast_buf, sizeof(sv.multicast_buf));	strcpy (sv.name, server);	// leave slots at start for clients only	for (i=0 ; i<maxclients->value ; i++)	{		// needs to reconnect		if (svs.clients[i].state > cs_connected)			svs.clients[i].state = cs_connected;		svs.clients[i].lastframe = -1;	}	sv.time = 1000;		strcpy (sv.name, server);	strcpy (sv.configstrings[CS_NAME], server);	if (serverstate != ss_game)	{		sv.models[1] = CM_LoadMap ("", false, &checksum);	// no real map	}	else	{		Com_sprintf (sv.configstrings[CS_MODELS+1],sizeof(sv.configstrings[CS_MODELS+1]),			"maps/%s.bsp", server);		sv.models[1] = CM_LoadMap (sv.configstrings[CS_MODELS+1], false, &checksum);	}	Com_sprintf (sv.configstrings[CS_MAPCHECKSUM],sizeof(sv.configstrings[CS_MAPCHECKSUM]),		"%i", checksum);	//	// clear physics interaction links	//	SV_ClearWorld ();		for (i=1 ; i< CM_NumInlineModels() ; i++)	{		Com_sprintf (sv.configstrings[CS_MODELS+1+i], sizeof(sv.configstrings[CS_MODELS+1+i]),			"*%i", i);		sv.models[i+1] = CM_InlineModel (sv.configstrings[CS_MODELS+1+i]);	}	//	// spawn the rest of the entities on the map	//		// precache and static commands can be issued during	// map initialization	sv.state = ss_loading;	Com_SetServerState (sv.state);	// load and spawn all other entities//.........这里部分代码省略.........
开发者ID:1vanK,项目名称:Urho3DQuake2,代码行数:101,


示例14: CL_StartHunkUsers

/*============================CL_StartHunkUsersAfter the server has cleared the hunk, these will need to be restartedThis is the only place that any of these functions are called from============================*/void CL_StartHunkUsers( void ) {	if ( !com_cl_running->integer ) {		return;	}	if ( !cls.rendererStarted ) {#ifdef _XBOX		//if ((!com_sv_running->integer || com_errorEntered) && !vidRestartReloadMap)		//{		//	// free up some memory		//	extern void SV_ClearLastLevel(void);		//	SV_ClearLastLevel();		//}#endif		cls.rendererStarted = qtrue;		re.BeginRegistration( &cls.glconfig );		// load character sets//		cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/bigchars" );		cls.charSetShader = re.RegisterShaderNoMip( "gfx/2d/charsgrid_med" );		cls.whiteShader = re.RegisterShader( "white" );		cls.consoleShader = re.RegisterShader( "console" );		g_console_field_width = cls.glconfig.vidWidth / SMALLCHAR_WIDTH - 2;		kg.g_consoleField.widthInChars = g_console_field_width;#ifndef _IMMERSION		//-------		//	The latest Immersion Force Feedback system initializes here, not through		//	win32 input system. Therefore, the window handle is valid :)		//-------		// now that the renderer has started up we know that the global hWnd is now valid,		//	so we can now go ahead and (re)setup the input stuff that needs hWnds for DI...		//  (especially Force feedback)...		//		static qboolean bOnceOnly = qfalse;	// only do once, not every renderer re-start		if (!bOnceOnly)		{			bOnceOnly = qtrue;			extern void Sys_In_Restart_f( void );			Sys_In_Restart_f();		}#ifdef _XBOX		if (vidRestartReloadMap)		{			int checksum;			CM_LoadMap(va("maps/%s.bsp", cl_mapname->string), qfalse, &checksum);			RE_LoadWorldMap(va("maps/%s.bsp", cl_mapname->string));			vidRestartReloadMap = qfalse;		}#endif // _XBOX#endif // _IMMERSION	}	if ( !cls.soundStarted ) {		cls.soundStarted = qtrue;		S_Init();	}	if ( !cls.soundRegistered ) {		cls.soundRegistered = qtrue;		S_BeginRegistration();	}#ifdef _IMMERSION	if ( !cls.forceStarted ) {		cls.forceStarted = qtrue;		CL_InitFF();	}#endif // _IMMERSION#if !defined (_XBOX)	//i guess xbox doesn't want the ui loaded all the time?	//we require the ui to be loaded here or else it crashes trying to access the ui on command line map loads	if ( !cls.uiStarted ) {		cls.uiStarted = qtrue;		CL_InitUI();	}#endif//	if ( !cls.cgameStarted && cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) {	if ( !cls.cgameStarted && cls.state > CA_CONNECTED && (cls.state != CA_CINEMATIC && !CL_IsRunningInGameCinematic()) ) 	{		cls.cgameStarted = qtrue;		CL_InitCGame();	}}
开发者ID:Hasimir,项目名称:jedi-academy-1,代码行数:96,


示例15: CL_CM_LoadMap

static void CL_CM_LoadMap( const char *mapname, qboolean subBSP ) {	if ( subBSP )	CM_LoadSubBSP( va( "maps/%s.bsp", mapname+1 ), qfalse );	else			CM_LoadMap( mapname, qtrue, NULL );}
开发者ID:Razish,项目名称:CompJA,代码行数:4,


示例16: CL_CM_LoadMap

/*====================CL_CM_LoadMapJust adds default parameters that cgame doesn't need to know about====================*/void CL_CM_LoadMap( const char *mapname, qboolean subBSP ) {	int		checksum;	CM_LoadMap( mapname, qtrue, &checksum, subBSP );}
开发者ID:Delfin1,项目名称:OpenJK,代码行数:12,


示例17: SV_Map_f

//.........这里部分代码省略.........	mod_SpectatorConnect = ED_FindFunctionOffset ("SpectatorConnect");	mod_SpectatorThink = ED_FindFunctionOffset ("SpectatorThink");	mod_SpectatorDisconnect = ED_FindFunctionOffset ("SpectatorDisconnect");	mod_ChatMessage = ED_FindFunctionOffset ("ChatMessage");	mod_UserInfo_Changed = ED_FindFunctionOffset ("UserInfo_Changed");	mod_ConsoleCmd = ED_FindFunctionOffset ("ConsoleCmd");	mod_UserCmd = ED_FindFunctionOffset ("UserCmd");	mod_localinfoChanged = ED_FindFunctionOffset ("localinfoChanged");	GE_ClientCommand = ED_FindFunctionOffset ("GE_ClientCommand");	GE_PausedTic = ED_FindFunctionOffset ("GE_PausedTic");	GE_ShouldPause = ED_FindFunctionOffset ("GE_ShouldPause");	// leave slots at start for clients only	sv.num_edicts = MAX_CLIENTS+1;	for (i=0 ; i<MAX_CLIENTS ; i++)	{		ent = EDICT_NUM(i+1);		// restore client name.		ent->v.netname = PR_SetString(svs.clients[i].name);		// reserve edict.		svs.clients[i].edict = ent;		//ZOID - make sure we update frags right		svs.clients[i].old_frags = 0;	}	// fill sv.mapname and sv.modelname with new map name	strlcpy (sv.mapname, mapname, sizeof(sv.mapname));	snprintf (sv.modelname, sizeof(sv.modelname), "maps/%s.bsp", sv.mapname);#ifndef SERVERONLY	// set cvar	Cvar_ForceSet (&host_mapname, mapname);#endif	if (!(sv.worldmodel = CM_LoadMap (sv.modelname, false, &sv.map_checksum, &sv.map_checksum2))) // true if bad map	{		Con_Printf ("Cant load map %s, falling back to %s/n", mapname, oldmap);		// fill mapname, sv.mapname and sv.modelname with old map name		strlcpy (sv.mapname, oldmap, sizeof(sv.mapname)); 		snprintf (sv.modelname, sizeof(sv.modelname), "maps/%s.bsp", sv.mapname);		mapname = oldmap;		// and re-load old map		sv.worldmodel = CM_LoadMap (sv.modelname, false, &sv.map_checksum, &sv.map_checksum2);		// this should never happen		if (!sv.worldmodel)			SV_Error ("CM_LoadMap: bad map");	}		sv.map_checksum2 = Com_TranslateMapChecksum (sv.mapname, sv.map_checksum2);	SV_ClearWorld (); // clear physics interaction links#ifdef USE_PR2	if ( sv_vm )	{		sv.sound_precache[0] = "";		sv.model_precache[0] = "";	}	else#endif	{		sv.sound_precache[0] = pr_strings;		sv.model_precache[0] = pr_strings;
开发者ID:ashabada,项目名称:mvdsv,代码行数:67,


示例18: SV_SpawnServer

/*================SV_SpawnServerChange the server to a new map, taking all connectedclients along with it.This is NOT called for map_restart================*/void SV_SpawnServer( char *server, qboolean killBots ) {    int			i;    int			checksum;    qboolean	isBot;    char		systemInfo[16384];    const char	*p;    // shut down the existing game if it is running    SV_ShutdownGameProgs();    Com_Printf ("------ Server Initialization ------/n");    Com_Printf ("Server: %s/n",server);    // if not running a dedicated server CL_MapLoading will connect the client to the server    // also print some status stuff    CL_MapLoading();    // make sure all the client stuff is unloaded    CL_ShutdownAll();    // clear the whole hunk because we're (re)loading the server    Hunk_Clear();    // clear collision map data    CM_ClearMap();    // init client structures and svs.numSnapshotEntities    if ( !Cvar_VariableValue("sv_running") ) {        SV_Startup();    } else {        // check for maxclients change        if ( sv_maxclients->modified ) {            SV_ChangeMaxClients();        }    }    // clear pak references    FS_ClearPakReferences(0);    // allocate the snapshot entities on the hunk    svs.snapshotEntities = Hunk_Alloc( sizeof(entityState_t)*svs.numSnapshotEntities, h_high );    svs.nextSnapshotEntities = 0;    // toggle the server bit so clients can detect that a    // server has changed    svs.snapFlagServerBit ^= SNAPFLAG_SERVERCOUNT;    // set nextmap to the same map, but it may be overriden    // by the game startup or another console command    Cvar_Set( "nextmap", "map_restart 0");//	Cvar_Set( "nextmap", va("map %s", server) );    // wipe the entire per-level structure    SV_ClearServer();    for ( i = 0 ; i < MAX_CONFIGSTRINGS ; i++ ) {        sv.configstrings[i] = CopyString("");    }    // make sure we are not paused    Cvar_Set("cl_paused", "0");    // get a new checksum feed and restart the file system    srand(Com_Milliseconds());    sv.checksumFeed = ( ((int) rand() << 16) ^ rand() ) ^ Com_Milliseconds();    FS_Restart( sv.checksumFeed );    CM_LoadMap( va("maps/%s.bsp", server), qfalse, &checksum );    // set serverinfo visible name    Cvar_Set( "mapname", server );    Cvar_Set( "sv_mapChecksum", va("%i",checksum) );    // serverid should be different each time    sv.serverId = com_frameTime;    sv.restartedServerId = sv.serverId; // I suppose the init here is just to be safe    sv.checksumFeedServerId = sv.serverId;    Cvar_Set( "sv_serverid", va("%i", sv.serverId ) );    // clear physics interaction links    SV_ClearWorld ();    // media configstring setting should be done during    // the loading stage, so connected clients don't have    // to load during actual gameplay    sv.state = SS_LOADING;    // load and spawn all other entities    SV_InitGameProgs();    // don't allow a map_restart if game is modified//.........这里部分代码省略.........
开发者ID:Avatarchik,项目名称:Quake-III-Arena-D3D11,代码行数:101,


示例19: NQD_ParseServerData

/*==================NQD_ParseServerData==================*/static void NQD_ParseServerData (void){	char	*str;	int		i;	int		nummodels, numsounds;	char	mapname[MAX_QPATH];	int		cs2;	qbool	gpl_map;#ifdef GLQUAKE	extern	qbool r_gpl_map;#endif	Com_DPrintf ("Serverdata packet received./n");//// wipe the client_state_t struct//	CL_ClearState ();// parse protocol version number	i = MSG_ReadLong ();	if (i != NQ_PROTOCOL_VERSION)		Host_Error ("Server returned version %i, not %i", i, NQ_PROTOCOL_VERSION);// parse maxclients	nq_maxclients = MSG_ReadByte ();	if (nq_maxclients < 1 || nq_maxclients > NQ_MAX_CLIENTS)		Host_Error ("Bad maxclients (%u) from server", nq_maxclients);// parse gametype	cl.gametype = MSG_ReadByte() ? GAME_DEATHMATCH : GAME_COOP;// parse signon message	str = MSG_ReadString ();	strlcpy (cl.levelname, str, sizeof(cl.levelname));// separate the printfs so the server message can have a color	Com_Printf("/n/n/35/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/36/37/n/n");	Com_Printf ("%c%s/n", 2, str);//// first we go through and touch all of the precache data that still// happens to be in the cache, so precaching something else doesn't// needlessly purge it//// precache models	for (nummodels=1 ; ; nummodels++)	{		str = MSG_ReadString ();		if (!str[0])			break;		if (nummodels == MAX_MODELS)			Host_Error ("Server sent too many model precaches");		strlcpy (cl.model_name[nummodels], str, sizeof(cl.model_name[0]));		Mod_TouchModel (str);	}// precache sounds	for (numsounds=1 ; ; numsounds++)	{		str = MSG_ReadString ();		if (!str[0])			break;		if (numsounds == MAX_SOUNDS)			Host_Error ("Server sent too many sound precaches");		strlcpy (cl.sound_name[numsounds], str, sizeof(cl.sound_name[0]));		S_TouchSound (str);	}//// now we try to load everything else until a cache allocation fails//	cl.clipmodels[1] = CM_LoadMap (cl.model_name[1], true, NULL, &cl.map_checksum2);	COM_StripExtension (COM_SkipPath(cl.model_name[1]), mapname);	cs2 = Com_TranslateMapChecksum (mapname, cl.map_checksum2);	gpl_map = (cl.map_checksum2 != cs2);	cl.map_checksum2 = cs2;#ifdef GLQUAKE	r_gpl_map = gpl_map;#endif	for (i = 1; i < nummodels; i++)	{		cl.model_precache[i] = Mod_ForName (cl.model_name[i], false, i == 1);		if (cl.model_precache[i] == NULL)			Host_Error ("Model %s not found", cl.model_name[i]);		if (cl.model_name[i][0] == '*')			cl.clipmodels[i] = CM_InlineModel(cl.model_name[i]);	}	for (i=1 ; i<numsounds ; i++) {		cl.sound_precache[i] = S_PrecacheSound (cl.sound_name[i]);	}//.........这里部分代码省略.........
开发者ID:luaman,项目名称:zq,代码行数:101,


示例20: SV_SpawnServer

/*================SV_SpawnServerChange the server to a new map, taking all connectedclients along with it.================*/void SV_SpawnServer( char *server, ForceReload_e eForceReload, qboolean bAllowScreenDissolve ){	int			i;	int			checksum;	RE_RegisterMedia_LevelLoadBegin( server, eForceReload, bAllowScreenDissolve );	Cvar_SetValue( "cl_paused", 0 );	Cvar_Set( "timescale", "1" );//jic we were skipping	// shut down the existing game if it is running	SV_ShutdownGameProgs();	Com_Printf ("------ Server Initialization ------/n%s/n", com_version->string);	Com_Printf ("Server: %s/n",server);		// init client structures and svs.numSnapshotEntities 	if ( !Cvar_VariableIntegerValue("sv_running") ) {		SV_Startup();	}			// don't let sound stutter and dump all stuff on the hunk	CL_MapLoading();	Hunk_Clear(); 	// clear out those shaders, images and Models	R_InitImages();	R_InitShaders();	R_ModelInit();	// create a heap for Ghoul2 to use for game side model vertex transforms used in collision detection	if (!G2VertSpaceServer)	{		static const int MiniHeapSize=128 * 1024; // maxsize of ghoul2 miniheap		G2VertSpaceServer	= new CMiniHeap(MiniHeapSize);	}	if (svs.snapshotEntities)	{		Z_Free(svs.snapshotEntities);	}	// allocate the snapshot entities 	svs.snapshotEntities = (entityState_t *) Z_Malloc (sizeof(entityState_t)*svs.numSnapshotEntities, TAG_CLIENTS, qtrue );	Music_SetLevelName(server);	// toggle the server bit so clients can detect that a	// server has changed//[email
C++ CM_PointContents函数代码示例
C++ CM_InlineModel函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。