Beispiel #1
0
    public static void FF9ShadowSetAmpField(Int32 uid, Int32 amp)
    {
        FF9StateFieldMap map = FF9StateSystem.Field.FF9Field.loc.map;

        FF9StateSystem.Field.FF9Field.loc.map.shadowArray[uid].amp           = amp;
        FF9StateSystem.Field.FF9Field.loc.map.shadowArray[uid].needUpdate    = true;
        FF9StateSystem.Field.FF9Field.loc.map.shadowArray[uid].needUpdateAmp = true;
    }
Beispiel #2
0
	private void ff9ShutdownStateFieldMap()
	{
		FF9StateFieldMap map = FF9StateSystem.Field.FF9Field.loc.map;
		FF9Snd.ff9fieldsound_stopall_mapsndeffect((Int32)this.FF9.fldMapNo);
		EBin eBin = this.ee.eBin;
		Int32 varManually = eBin.getVarManually(6357);
		switch (map.nextMode)
		{
		case 1:
			this.FF9.fldMapNo = map.nextMapNo;
			break;
		case 2:
			this.FF9.btlMapNo = map.nextMapNo;
			FF9StateSystem.Battle.battleMapIndex = (Int32)this.FF9.btlMapNo;
			this.FF9Sys.mode = 2;
			this.FF9Sys.prevMode = 1;
			break;
		case 3:
			this.FF9.wldMapNo = map.nextMapNo;
			this.FF9.wldLocNo = (Int16)EventEngineUtils.eventIDToMESID[(Int32)this.FF9.wldMapNo];
			this.FF9Sys.mode = 3;
			this.FF9Sys.prevMode = 1;
			break;
		case 4:
		{
			AllSoundDispatchPlayer allSoundDispatchPlayer = SoundLib.GetAllSoundDispatchPlayer();
			allSoundDispatchPlayer.FF9SOUND_SNDEFFECT_STOP_ALL(null);
			allSoundDispatchPlayer.FF9SOUND_SNDEFFECTRES_STOPCURRENT();
			allSoundDispatchPlayer.FF9SOUND_STREAM_STOP();
			break;
		}
		case 7:
		{
			AllSoundDispatchPlayer allSoundDispatchPlayer2 = SoundLib.GetAllSoundDispatchPlayer();
			allSoundDispatchPlayer2.FF9SOUND_SNDEFFECT_STOP_ALL(null);
			allSoundDispatchPlayer2.FF9SOUND_SNDEFFECTRES_STOPCURRENT();
			allSoundDispatchPlayer2.FF9SOUND_STREAM_STOP();
			this.FF9Sys.mode = 7;
			this.FF9Sys.prevMode = 1;
			break;
		}
		case 9:
		{
			Int32 currentMusicId = FF9Snd.GetCurrentMusicId();
			if (currentMusicId != -1)
			{
				FF9Snd.ff9fldsnd_song_suspend(currentMusicId);
			}
			FF9Snd.ff9fieldSoundSuspendAllResidentSndEffect();
			AllSoundDispatchPlayer allSoundDispatchPlayer3 = SoundLib.GetAllSoundDispatchPlayer();
			allSoundDispatchPlayer3.FF9SOUND_STREAM_STOP();
			break;
		}
		}
	}
Beispiel #3
0
    public void ff9ResetStateFieldMap()
    {
        this.attr      = 0;
        this.nextMapNo = -1;
        this.nextMode  = 1;
        this.charStateArray.Clear();
        this.shadowArray.Clear();
        FF9StateFieldMap map = FF9StateSystem.Field.FF9Field.loc.map;

        for (Int32 i = 0; i < FF9Snd.FLDINT_CHAR_SOUNDCOUNT; i++)
        {
            map.charSoundArray[i] = new FF9FieldCharSound();
        }
        map.charSoundUse = 0;
    }
Beispiel #4
0
    private void RequestPlayBattleEncounterSongForField()
    {
        AllSoundDispatchPlayer soundDispatchPlayer = SoundLib.GetAllSoundDispatchPlayer();

        FF9Snd.ff9fieldSoundSuspendAllResidentSndEffect();
        AllSoundDispatchPlayer.PlayingSfx[] residentSndEffectSlot1 = soundDispatchPlayer.GetResidentSndEffectSlot();
        Int32 num1 = residentSndEffectSlot1[0]?.SndEffectVol ?? 0;
        Int32 num2 = residentSndEffectSlot1[1]?.SndEffectVol ?? 0;

        soundDispatchPlayer.FF9SOUND_SNDEFFECTRES_VOL_INTPLALL(15, 0);
        AllSoundDispatchPlayer.PlayingSfx[] residentSndEffectSlot2 = soundDispatchPlayer.GetResidentSndEffectSlot();
        if (residentSndEffectSlot2[0] != null)
        {
            residentSndEffectSlot2[0].SndEffectVol = num1;
        }
        if (residentSndEffectSlot2[1] != null)
        {
            residentSndEffectSlot2[1].SndEffectVol = num2;
        }

        Int32                     index            = FF9StateSystem.Common.FF9.fldMapNo;
        FF9StateFieldMap          ff9StateFieldMap = FF9StateSystem.Field.FF9Field.loc.map;
        Dictionary <Int32, Int32> dictionary       = FF9SndMetaData.BtlBgmMapperForFieldMap[index];
        Int32                     currentMusicId   = FF9Snd.GetCurrentMusicId();

        FF9StateSystem.Battle.IsPlayFieldBGMInCurrentBattle = true;
        if (dictionary.Count == 0 || !dictionary.ContainsKey(ff9StateFieldMap.nextMapNo))
        {
            return;
        }

        Int32 songid = dictionary[ff9StateFieldMap.nextMapNo];

        if (songid == currentMusicId)
        {
            return;
        }

        FF9Snd.ff9fldsnd_song_suspend(currentMusicId);
        btlsnd.ff9btlsnd_song_play(songid);
        FF9StateSystem.Battle.IsPlayFieldBGMInCurrentBattle = false;
    }
Beispiel #5
0
    public static void ff9fieldMCFService()
    {
        DMSMapConf?mcfPtr = FF9StateSystem.Field.FF9Field.loc.map.mcfPtr;

        if (mcfPtr == null)
        {
            return;
        }
        DMSMapChar[] dmsmapChar = mcfPtr.Value.DMSMapChar;
        if (dmsmapChar != null)
        {
            DMSMapLight?dmsmapLight  = null;
            DMSMapLight?dmsmapLight2 = null;
            DMSMapChar? dmsmapChar2  = fldmcf.ff9fieldMCFGetCharByID(mcfPtr.Value, -1);
            fldmcf.ff9fieldMCFGetLightDefault(mcfPtr.Value, ref dmsmapLight, ref dmsmapLight2);
            foreach (Int32 num in FF9StateSystem.Common.FF9.charArray.Keys)
            {
                FF9Char ff9Char          = FF9StateSystem.Common.FF9.charArray[num];
                Actor   activeActorByUID = PersistenSingleton <EventEngine> .Instance.getActiveActorByUID(num);

                FF9StateFieldMap map = FF9StateSystem.Field.FF9Field.loc.map;
                if (ff9Char != null && activeActorByUID != null)
                {
                    FF9FieldCharState ff9FieldCharState = FF9StateSystem.Field.FF9Field.loc.map.charStateArray[num];
                    Int16             num2         = 0;
                    DMSMapChar?       dmsmapChar3  = fldmcf.ff9fieldMCFGetCharByID(mcfPtr.Value, (Int32)activeActorByUID.model);
                    DMSMapLight?      dmsmapLight3 = fldmcf.ff9fieldMCFGetLightByCharFloor(mcfPtr.Value, num, ref num2);
                    UInt32            num3         = (UInt32)(ff9Char.attr & 4u);
                    Boolean           flag         = ((Int32)ff9FieldCharState.floor & 255) != (Int32)(num2 & 255) || ((Int64)num3 ^ (Int64)((UInt64)(ff9FieldCharState.attr & 4u))) != 0L || FF9Char.ff9charptr_attr_test(ff9Char, 256) == 0;
                    if (flag)
                    {
                        if (FF9Char.ff9charptr_attr_test(ff9Char, 1024) == 0)
                        {
                            SByte[] array = new SByte[4];
                            SByte[] clr;
                            if (dmsmapChar3 != null)
                            {
                                clr = dmsmapChar3.Value.clr;
                            }
                            else
                            {
                                clr = dmsmapChar2.Value.clr;
                            }
                            if (num3 != 0 && dmsmapLight2 != null)
                            {
                                array = dmsmapLight2.Value.clr;
                            }
                            else if (dmsmapLight3 != null)
                            {
                                array = dmsmapLight3.Value.clr;
                            }
                            else if (dmsmapLight != null)
                            {
                                array = dmsmapLight.Value.clr;
                            }
                            FF9FieldCharColor ff9FieldCharColor = default(FF9FieldCharColor);
                            ff9FieldCharColor.r      = (Byte)((Int32)clr[0] + (Int32)array[0] << 3);
                            ff9FieldCharColor.g      = (Byte)((Int32)clr[1] + (Int32)array[1] << 3);
                            ff9FieldCharColor.b      = (Byte)((Int32)clr[2] + (Int32)array[2] << 3);
                            ff9FieldCharColor.active = true;
                            ff9FieldCharState.clr[0] = (ff9FieldCharState.clr[1] = ff9FieldCharColor);
                        }
                        Int32 num4;
                        Int32 num5;
                        if (dmsmapChar3 != null)
                        {
                            num4 = (Int32)dmsmapChar3.Value.shadowI;
                            num5 = (Int32)dmsmapChar3.Value.shadowR;
                        }
                        else
                        {
                            num4 = (Int32)dmsmapChar2.Value.shadowI;
                            num5 = (Int32)dmsmapChar2.Value.shadowR;
                        }
                        if (dmsmapLight3 != null)
                        {
                            num4 += (Int32)dmsmapLight3.Value.shadowI;
                            num5 += (Int32)dmsmapLight3.Value.shadowR;
                        }
                        else if (dmsmapLight != null)
                        {
                            num4 += (Int32)dmsmapLight.Value.shadowI;
                            num5 += (Int32)dmsmapLight.Value.shadowR;
                        }
                        num4 <<= 3;
                        ff9shadow.FF9ShadowSetAmpField(num, num4);
                        ff9shadow.FF9ShadowSetScaleField(num, num5, num5);
                        ff9FieldCharState.floor = (SByte)num2;
                        ff9FieldCharState.attr  = ((ff9FieldCharState.attr & 0xFFFFFFFF) | num3);
                        FF9Char.ff9charptr_attr_set(ff9Char, 256);
                    }
                }
            }
        }
    }
Beispiel #6
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();
		}
	}