Parse() public method

Normally this will use a .reg file instead of a .map file if it exists, which is what the game and dmap want, but the editor will want to always load a .map file.
public Parse ( string fileName, bool ignoreRegion = false, bool osPath = false ) : bool
fileName string Does not require an extension.
ignoreRegion bool
osPath bool
return bool
Beispiel #1
0
		private void LoadMap(string mapName, int randomSeed)
		{
			bool isSameMap = ((_currentMapFile != null) && (_currentMapFileName.ToLower() == mapName.ToLower()));

			// clear the sound system
			_currentSoundWorld.ClearAllSoundEmitters();

			InitAsyncNetwork();

			if((isSameMap == false) || ((_currentMapFile != null) && (_currentMapFile.NeedsReload == true)))
			{
				// load the .map file
				if(_currentMapFile != null)
				{
					_currentMapFile.Dispose();
					_currentMapFile = null;
				}

				_currentMapFile = new idMapFile();

				if(_currentMapFile.Parse(mapName) == false)
				{
					_currentMapFile.Dispose();
					_currentMapFile = null;

					idConsole.Error("Couldn't load {0}", mapName);
				}
			}

			_currentMapFileName = _currentMapFile.Name;

			// load the collision map
			idR.CollisionModelManager.LoadMap(_currentMapFile);

			_clientCount = 0;

			// initialize all entities for this game
			_entities = new idEntity[idR.MaxGameEntities];
			_spawnIds = new int[idR.MaxGameEntities];

			_userCommands = new idUserCommand[0];
			_spawnCount = idGame.InitialSpawnCount;

			_spawnedEntities.Clear();
			_activeEntities.Clear();
			_entitiesToDeactivate = 0;

			_sortTeamMasters = false;
			_sortPushers = false;
			/*lastGUIEnt = NULL;
			lastGUI = 0;*/

			_globalMaterial = null;
			_globalMaterialParameters = new float[idE.MaxGlobalMaterialParameters];

			// always leave room for the max number of clients,
			// even if they aren't all used, so numbers inside that
			// range are NEVER anything but clients

			_entityCount = idR.MaxClients;
			_firstFreeIndex = idR.MaxClients;

			// reset the random number generator.
			_random = new Random((this.IsMultiplayer == true) ? randomSeed : 0);

			/*

			camera			= NULL;
			world			= NULL;
			testmodel		= NULL;
			testFx			= NULL;

			lastAIAlertEntity = NULL;
			lastAIAlertTime = 0;*/
			_previousTime = 0;
			_time = 0;
			_frameCount = 0;

			_sessionCommand = string.Empty;
			/*
			nextGibTime		= 0;

			vacuumAreaNum = -1;		// if an info_vacuum is spawned, it will set this

			*/

			_gravity = new Vector3(0, 0, -idR.CvarSystem.GetFloat("g_gravity"));
			_spawnArgs.Clear();

			/*skipCinematic = false;
			inCinematic = false;
			cinematicSkipTime = 0;
			cinematicStopTime = 0;
			cinematicMaxSkipTime = 0;*/

			_clip.Init();

			/*pvs.Init();
			playerPVS.i = -1;
			playerConnectedAreas.i = -1;

			// load navigation system for all the different monster sizes
			for( i = 0; i < aasNames.Num(); i++ ) {
				aasList[ i ]->Init( idStr( mapFileName ).SetFileExtension( aasNames[ i ] ).c_str(), mapFile->GetGeometryCRC() );
			}

			// clear the smoke particle free list
			smokeParticles->Init();*/

			// cache miscellanious media references
			FindEntityDef("preCacheExtras", false);

			if(isSameMap == false)
			{
				_currentMapFile.RemovePrimitiveData();
			}
		}