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


C++ CM_LoadMap函数代码示例

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


在下文中一共展示了CM_LoadMap函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码来源:test_routing.c

示例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,代码来源:test_routing.cpp

示例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,代码来源:be_aas_bspc.c

示例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,代码来源:parse.cpp

示例5: CLT3_CM_LoadMap

//	Just adds default parameters that cgame doesn't need to know about
void 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,代码来源:cgame.cpp

示例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,代码来源:sg_api.cpp

示例7: CL_CM_LoadMap

/*
====================
CL_CM_LoadMap

Just 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,代码来源:cl_cgame.c

示例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,代码来源:cl_main.cpp

示例9: CLQ2_Precache_f

//	The server will send this command right
// before allowing the client into the server
static 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,代码来源:main.cpp

示例10: CL_Precache_f

/*
 * The server will send this command right
 * before allowing the client into the server
 */
void
CL_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,代码来源:cl_main.c

示例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,代码来源:sv_init.c

示例12: CL_CM_LoadMap

/*
====================
CL_CM_LoadMap

Just 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,代码来源:cl_cgame.c

示例13: SV_SpawnServer

/*
================
SV_SpawnServer

Change the server to a new map, taking all connected
clients 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,代码来源:sv_init.c

示例14: CL_StartHunkUsers

/*
============================
CL_StartHunkUsers

After the server has cleared the hunk, these will need to be restarted
This 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,代码来源:cl_main.cpp

示例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,代码来源:cl_cgameapi.cpp


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