Exemplo n.º 1
0
	private void ff9InitStateFieldMap(Int32 MapNo)
	{
		FF9StateFieldMap map = this.FF9Field.loc.map;
		map.ff9ResetStateFieldMap();
		this.FF9Sys.attr &= 4294966512u;
		this.FF9Field.attr |= 4u;
		FF9StateFieldSystem ff9Field = FF9StateSystem.Field.FF9Field;
		this.FF9Field.playerID = 0;
		map.nextMapNo = (this.FF9.fldMapNo = (Int16)MapNo);
		for (Int32 i = 1; i >= 0; i--)
		{
			for (Int32 j = 3; j >= 0; j--)
			{
				FieldMap.FF9FieldAttr.ff9[i, j] = 0;
				FieldMap.FF9FieldAttr.field[i, j] = 0;
			}
		}
		String text = FF9DBAll.EventDB[MapNo];
		map.evtPtr = EventEngineUtils.loadEventData(text, EventEngineUtils.ebSubFolderField);
		AnimationFactory.LoadAnimationUseInEvent(text);
		vib.LoadVibData(text);
		map.mcfPtr = MapConfiguration.LoadMapConfigData(text);
		GameObject gameObject = GameObject.Find("FieldMap Root");
		GameObject gameObject2 = new GameObject("FieldMap");
		gameObject2.transform.parent = gameObject.transform;
		PersistenSingleton<EventEngine>.Instance.fieldmap = gameObject2.AddComponent<FieldMap>();
		GameObject gameObject3 = new GameObject("FieldMap SPS");
		gameObject3.transform.parent = gameObject.transform;
		PersistenSingleton<EventEngine>.Instance.fieldSps = gameObject3.AddComponent<FieldSPSSystem>();
		PersistenSingleton<EventEngine>.Instance.fieldSps.Init(PersistenSingleton<EventEngine>.Instance.fieldmap);
		if (MapNo >= 3000 && MapNo <= 3012)
		{
			FF9StateSystem.Settings.CallBoosterButtonFuntion(BoosterType.BattleAssistance, false);
			FF9StateSystem.Settings.CallBoosterButtonFuntion(BoosterType.HighSpeedMode, false);
			FF9StateSystem.Settings.CallBoosterButtonFuntion(BoosterType.Attack9999, false);
			FF9StateSystem.Settings.CallBoosterButtonFuntion(BoosterType.NoRandomEncounter, false);
			PersistenSingleton<UIManager>.Instance.Booster.SetBoosterHudIcon(BoosterType.BattleAssistance, false);
			PersistenSingleton<UIManager>.Instance.Booster.SetBoosterHudIcon(BoosterType.HighSpeedMode, false);
			PersistenSingleton<UIManager>.Instance.Booster.SetBoosterHudIcon(BoosterType.Attack9999, false);
			PersistenSingleton<UIManager>.Instance.Booster.SetBoosterHudIcon(BoosterType.NoRandomEncounter, false);
			PersistenSingleton<UIManager>.Instance.SetUIPauseEnable(false);
			PersistenSingleton<UIManager>.Instance.ChangeUIState(UIManager.UIState.PreEnding);
		}
		else
		{
			PersistenSingleton<UIManager>.Instance.SetUIPauseEnable(true);
		}
		AllSoundDispatchPlayer allSoundDispatchPlayer = SoundLib.GetAllSoundDispatchPlayer();
		Int32 suspendSongID = allSoundDispatchPlayer.GetSuspendSongID();
		Int32 sndEffectResSoundID = allSoundDispatchPlayer.GetSndEffectResSoundID(0);
		Int32 sndEffectResSoundID2 = allSoundDispatchPlayer.GetSndEffectResSoundID(1);
		FF9Snd.BGMFieldSongCounter = 0;
		this.ee.StartEvents(map.evtPtr);
		FF9StateSystem.Field.SetTwistAD((Int32)this.ee.GetTwistA(), (Int32)this.ee.GetTwistD());
		PersistenSingleton<EventEngine>.Instance.eTb.InitMessage();
		PersistenSingleton<EventEngine>.Instance.eTb.InitMovieHitPoint(MapNo);
		this.FF9.npcCount = (Byte)this.ee.GetNumberNPC();
		this.fieldmap = GameObject.Find("FieldMap").GetComponent<FieldMap>();
		this.ee.updateModelsToBeAdded();
		Int32 suspendSongID2 = allSoundDispatchPlayer.GetSuspendSongID();
		Int32 sndEffectResSoundID3 = allSoundDispatchPlayer.GetSndEffectResSoundID(0);
		Int32 sndEffectResSoundID4 = allSoundDispatchPlayer.GetSndEffectResSoundID(1);
		if (suspendSongID != -1 && suspendSongID2 != -1 && suspendSongID == suspendSongID2)
		{
			FF9Snd.ff9fldsnd_song_restore();
		}
		if (FF9Snd.LatestWorldPlayedSong != -1 && FF9Snd.LatestWorldPlayedSong == SoundLib.GetAllSoundDispatchPlayer().GetCurrentMusicId() && FF9Snd.BGMFieldSongCounter == 0)
		{
			SoundLib.GetAllSoundDispatchPlayer().FF9SOUND_SONG_STOPCURRENT();
		}
		FF9Snd.LatestWorldPlayedSong = -1;
		FF9Snd.BGMFieldSongCounter = 0;
		if ((sndEffectResSoundID != -1 || sndEffectResSoundID2 != -1) && (sndEffectResSoundID3 != -1 || sndEffectResSoundID4 != -1) && sndEffectResSoundID == sndEffectResSoundID3 && sndEffectResSoundID2 == sndEffectResSoundID4)
		{
			FF9Snd.ff9fieldSoundRestoreAllResidentSndEffect();
		}
	}