public static void FF9Play_SetParty(int party_id, int slot_id) { FF9StateGlobal ff9StateGlobal = FF9StateSystem.Common.FF9; PLAYER player = ff9StateGlobal.party.member[party_id]; if (slot_id >= 9) { slot_id = -1; } if (0 > slot_id) { ff9StateGlobal.party.member[party_id] = null; } else { FF9Play_Add(slot_id); ff9StateGlobal.party.member[party_id] = ff9StateGlobal.player[slot_id]; } if (player == ff9StateGlobal.party.member[party_id]) { return; } FF9Play_SetFaceDirty(true); }
private void ff9fieldInternalLoopEnd() { FF9StateGlobal ff = FF9StateSystem.Common.FF9; if ((ff.attr & 256u) == 0u) { FF9FieldAttrState ff9FieldAttr = FieldMap.FF9FieldAttr; ff.attr |= (UInt32)ff9FieldAttr.ff9[0, 0]; ff.attr &= (UInt32)(~(UInt32)ff9FieldAttr.ff9[1, 0]); this.FF9Field.attr |= (UInt32)ff9FieldAttr.field[0, 0]; this.FF9Field.attr &= (UInt32)(~(UInt32)ff9FieldAttr.field[1, 0]); fldfmv.ff9fieldFMVAttr |= (Int32)ff9FieldAttr.fmv[0, 0]; fldfmv.ff9fieldFMVAttr &= (Int32)(~(Int32)ff9FieldAttr.fmv[1, 0]); for (Int32 i = 0; i < 2; i++) { for (Int32 j = 0; j < 3; j++) { ff9FieldAttr.ff9[i, j] = ff9FieldAttr.ff9[i, j + 1]; ff9FieldAttr.field[i, j] = ff9FieldAttr.field[i, j + 1]; ff9FieldAttr.fmv[i, j] = ff9FieldAttr.fmv[i, j + 1]; } ff9FieldAttr.ff9[i, 3] = 0; ff9FieldAttr.field[i, 3] = 0; ff9FieldAttr.fmv[i, 3] = 0; } } }
public static Boolean ManageBattleSong(FF9StateGlobal sys, UInt32 ticks, UInt32 song_id) { if ((sys.btl_flag & 16) == 0) { btlsnd.ff9btlsnd_song_vol_intplall((Int32)ticks, 0); sys.btl_flag = (Byte)(sys.btl_flag | 16); } if ((sys.btl_flag & 2) == 0) { FF9StateBattleSystem ff9Battle = FF9StateSystem.Battle.FF9Battle; if ((Int64)(ff9Battle.player_load_fade = (SByte)((Int32)ff9Battle.player_load_fade + 4)) < (Int64)((UInt64)ticks)) { return(false); } btlsnd.ff9btlsnd_song_load((Int32)song_id); sys.btl_flag = (Byte)(sys.btl_flag | 2); } if (btlsnd.ff9btlsnd_sync() != 0) { return(false); } if ((sys.btl_flag & 32) == 0) { btlsnd.ff9btlsnd_song_play((Int32)song_id); sys.btl_flag = (Byte)(sys.btl_flag | 32); } return(true); }
public static void FF9Play_Init() { DefaultEquipment = LoadCharacterDefaultEquipment(); FF9StateGlobal ff9StateGlobal = FF9StateSystem.Common.FF9; FF9Play_SetFaceDirty(false); for (Int32 slot_id = 0; slot_id < 9; ++slot_id) { FF9Play_New(slot_id); } FF9Play_Add(0); FF9Play_Add(1); FF9Play_Add(2); FF9Play_Add(3); FF9Play_Add(4); FF9Play_Add(5); FF9Play_Add(7); FF9Play_Add(6); FF9Play_SetParty(0, 0); FF9Play_SetParty(1, 1); FF9Play_SetParty(2, 2); FF9Play_SetParty(3, 3); ff9StateGlobal.party.gil = 500U; ff9StateGlobal.party.summon_flag = 0; }
public Int32 GetPartyMember(Int32 index) { FF9StateGlobal ff = FF9StateSystem.Common.FF9; PLAYER player = ff.party.member[index]; return((Int32)((player == null) ? -1 : ((Int32)player.info.slot_no))); }
public static void InitBattle() { SFX.SetCameraPhase(1); FF9StateGlobal ff9 = FF9StateSystem.Common.FF9; ff9.btl_flag = 0; ff9.player[3].info.serial_no = ff9.steiner_state == 0 ? (Byte)7 : (Byte)8; ff9.btl_result = 0; btl_sys.InitBattleSystem(); btl2d.Btl2dInit(); }
public static void DispSelectCursor(FF9StateGlobal sys, FF9StateBattleSystem btlsys, BTL_DATA btl) { GameObject gameObject = btlsys.s_cur; Vector3 localPosition = btl.gameObject.transform.localPosition; Vector3 eulerAngles = gameObject.transform.localRotation.eulerAngles; gameObject.transform.localPosition = new Vector3(localPosition.x, localPosition.y + btl.height, localPosition.z); float num = (float)((((btlsys.btl_cnt & 15) << 8) + 1265) % 4096 / 4096.0 * 360.0); gameObject.transform.localRotation = Quaternion.Euler(eulerAngles.x, -num, eulerAngles.z); }
private static void BattleSubSystem(FF9StateGlobal sys, FF9StateBattleSystem btlsys) { if (btlsys.enemy_die != 0) { --btlsys.enemy_die; } btlseq.Sequencer(); battlebg.nf_BattleBG(); SFX.UpdatePlugin(); btl2d.Btl2dMain(); HonoluluBattleMain.battleSPS.GenerateSPS(); }
public void SetEventEnable(Boolean isEnable) { FF9StateGlobal ff = FF9StateSystem.Common.FF9; if (isEnable) { ff.attr &= 4294967293u; ff.attr &= 4294967039u; } else { ff.attr |= 2u; ff.attr |= 256u; } }
private DialogBoxConstructor(Dialog dlg, String text) { _dlg = dlg; _text = text; _chars = text.ToCharArray(); _sb = new StringBuilder(_chars.Length); _sb.Append(NGUIText.FF9WhiteColor); // Clear color _isJapanese = FF9StateSystem.Settings.CurrentLanguage == "Japanese"; _gameState = FF9StateSystem.Common.FF9; _textEngine = PersistenSingleton <EventEngine> .Instance?.eTb; _dlg.SignalNumber = ETb.gMesSignal; }
private static Boolean BattleIdleLoop(FF9StateGlobal sys, FF9StateBattleSystem btlsys) { //uint id = sys.id; Boolean flag = true; foreach (BattleUnit next in FF9StateSystem.Battle.FF9Battle.EnumerateBattleUnits()) { BTL_DATA data = next.Data; if (data.bi.disappear == 0) { btlseq.DispCharacter(data); if (btlsys.btl_phase == 3) { data.bi.stop_anim = 0; if (data.evt.animFrame >= GeoAnim.geoAnimGetNumFrames(data)) { if (!next.IsUnderStatus(BattleStatus.Death)) { btl_mot.setMotion(next, data.bi.def_idle); } data.evt.animFrame = 0; } if (!next.IsUnderStatus(BattleStatus.Petrify) && !btl_mot.checkMotion(data, data.bi.def_idle) && !btl_mot.checkMotion(data, 4)) { flag = false; } } else if (btlsys.btl_phase == 6 && next.IsPlayer && !next.IsUnderStatus((BattleStatus)4355U) && btlsys.btl_scene.Info.WinPose != 0 && (next.Player.Data.info.win_pose != 0 && data.evt.animFrame >= GeoAnim.geoAnimGetNumFrames(data))) { btl_mot.setMotion(next, 19); data.evt.animFrame = 0; } btl_stat.SetStatusVfx(next); } btl_mot.DieSequence(data); } if (btlsys.btl_phase == 7 && btlsys.btl_scene.Info.NoGameOver == 0 && !btl_util.ManageBattleSong(sys, 30U, 6U)) { flag = false; } battle.BattleSubSystem(sys, btlsys); return(flag); }
public void Init() { this.SceneName = "FBG_N00_TSHP_MAP002_TH_CGR_1"; this.index = 0; this.startPos = Vector3.zero; this.startRot = 0f; this.twist = Vector2.zero; this.UseUpscalFM = true; this.isOpenFieldMapDebugPanel = true; this.isEncount = true; this.isDebug = true; this.isDebugWalkMesh = false; this.FF9Field = new FF9StateFieldSystem(); PersistenSingleton <FF9StateSystem> .Instance.mode = 1; FF9StateGlobal ff = FF9StateSystem.Common.FF9; ff.fldMapNo = 100; ff.fldLocNo = 33; }
public static void FF9Dbg_SetCharacter(int player, int slot) { FF9StateGlobal ff9StateGlobal = FF9StateSystem.Common.FF9; FF9DBG_CHAR[] ff9DbgCharArray = { new FF9DBG_CHAR(0, false, -1), new FF9DBG_CHAR(1, false, -1), new FF9DBG_CHAR(2, false, -1), new FF9DBG_CHAR(3, false, -1), new FF9DBG_CHAR(4, false, -1), new FF9DBG_CHAR(5, false, 5), new FF9DBG_CHAR(6, false, 6), new FF9DBG_CHAR(7, false, 7), new FF9DBG_CHAR(5, true, 8), new FF9DBG_CHAR(6, true, 10), new FF9DBG_CHAR(7, true, 12), new FF9DBG_CHAR(8, true, 14) }; if (player == byte.MaxValue) { ff9StateGlobal.party.member[slot] = null; } else { FF9DBG_CHAR ff9DbgChar = ff9DbgCharArray[player]; PLAYER play = ff9StateGlobal.party.member[slot] = ff9StateGlobal.player[ff9DbgChar.slot_no]; if (ff9DbgChar.menu_type >= 0) { if (player != FF9Play_GetCharID(play.info.menu_type)) { play.info.menu_type = (byte)ff9DbgChar.menu_type; } play.category = (byte)FF9Play_GetCategory(play.info.menu_type); if (!FF9Dbg_CheckEquip(play)) { FF9Play_SetDefEquips(play.equip, FF9Play_GetCharID3(play)); } play.info.serial_no = (byte)FF9Play_GetSerialID(play.info.slot_no, (play.category & 16) != 0, play.equip); } play.category = (byte)FF9Play_GetCategory(play.info.menu_type); } }
private static Boolean BattleIdleLoop(FF9StateGlobal sys, FF9StateBattleSystem btlsys) { //uint id = sys.id; Boolean flag = true; for (BTL_DATA next = btlsys.btl_list.next; next != null; next = next.next) { if (next.bi.disappear == 0) { btlseq.DispCharacter(next); if (btlsys.btl_phase == 3) { next.bi.stop_anim = 0; if (next.evt.animFrame >= GeoAnim.geoAnimGetNumFrames(next)) { if (!Status.checkCurStat(next, 256U)) { btl_mot.setMotion(next, next.bi.def_idle); } next.evt.animFrame = 0; } if (!Status.checkCurStat(next, 1U) && !btl_mot.checkMotion(next, next.bi.def_idle) && !btl_mot.checkMotion(next, 4)) { flag = false; } } else if (btlsys.btl_phase == 6 && next.bi.player != 0 && (!Status.checkCurStat(next, 4355U) && btlsys.btl_scene.Info.WinPose != 0) && (btl_util.getPlayerPtr(next).info.win_pose != 0 && next.evt.animFrame >= GeoAnim.geoAnimGetNumFrames(next))) { btl_mot.setMotion(next, 19); next.evt.animFrame = 0; } btl_stat.SetStatusVfx(next); } btl_mot.DieSequence(next); } if (btlsys.btl_phase == 7 && btlsys.btl_scene.Info.NoGameOver == 0 && !btl_util.ManageBattleSong(sys, 30U, 6U)) { flag = false; } battle.BattleSubSystem(sys, btlsys); return(flag); }
public static Int32 FF9Item_Add(Int32 id, Int32 count) { FF9StateGlobal ff9StateGlobal = FF9StateSystem.Common.FF9; if (id == Byte.MaxValue) { return(0); } Int32 index1 = 0; FF9ITEM[] ff9ItemArray1 = ff9StateGlobal.item; for (; index1 < 256; ++index1) { FF9ITEM ff9Item = ff9ItemArray1[index1]; if (ff9Item.count != 0 && ff9Item.id == id) { if (ff9Item.count + count > 99) { count = 99 - ff9Item.count; } ff9Item.count += (Byte)count; FF9Item_Achievement(ff9Item.id, ff9Item.count); return(count); } } Int32 index2 = 0; FF9ITEM[] ff9ItemArray2 = ff9StateGlobal.item; for (; index2 < 256; ++index2) { FF9ITEM ff9Item = ff9ItemArray2[index2]; if (ff9Item.count == 0) { ff9Item.id = (Byte)id; ff9Item.count = (Byte)count; FF9Item_Achievement(ff9Item.id, ff9Item.count); return(count); } } return(0); }
private static void BattleMainLoop(FF9StateGlobal sys, FF9StateBattleSystem btlsys) { //uint id = sys.id; FF9StateSystem.Settings.SetTranceFull(); Boolean flag = false; for (BTL_DATA next = btlsys.btl_list.next; next != null; next = next.next) { if (next.bi.disappear == 0) { btlseq.DispCharacter(next); } if (!FF9StateSystem.Battle.isDebug && UIManager.Battle.CurrentPlayerIndex != -1 && (next.btl_id == 1 << UIManager.Battle.CurrentPlayerIndex && (btlsys.cmd_status & 2) != 0) && (next.flags & geo.GEO_FLAGS_CLIP) == 0) { flag = true; btl_cmd.DispSelectCursor(sys, btlsys, next); } btl_para.CheckPointData(next); // ============ Warning ============ if (Configuration.Battle.Speed == 0 || next.sel_mode != 0 || next.sel_menu != 0 || next.cur.hp == 0 || next.bi.atb == 0) { btl_stat.CheckStatusLoop(next, false); } // ================================= } if (flag) { if (!btlsys.s_cur.activeSelf) { btlsys.s_cur.SetActive(true); } } else { btlsys.s_cur.SetActive(false); } btl_cmd.CommandEngine(btlsys); battle.BattleSubSystem(sys, btlsys); }
private static void UpdateOverFrame() { FF9StateGlobal ff9StateGlobal = FF9StateSystem.Common.FF9; switch (ff9StateGlobal.btl_result) { case 1: case 2: case 3: case 4: case 5: case 7: if (ff9StateGlobal.btl_result == 2) { ff9StateGlobal.btl_result = 1; } if (FF9StateSystem.Battle.FF9Battle.map.nextMode == 1 || FF9StateSystem.Battle.FF9Battle.map.nextMode == 5) { FF9StateSystem.Common.FF9.fldMapNo = FF9StateSystem.Battle.FF9Battle.map.nextMapNo; } else if (FF9StateSystem.Battle.FF9Battle.map.nextMode == 3) { FF9StateSystem.Common.FF9.wldMapNo = FF9StateSystem.Battle.FF9Battle.map.nextMapNo; } UIManager.Battle.GoToBattleResult(); if (!FF9StateSystem.Battle.isDebug) { PersistenSingleton <EventEngine> .Instance.ServiceEvents(); SceneDirector.ServiceFade(); } return; case 6: UIManager.Battle.GoToGameOver(); return; default: return; } }
private static int FF9Play_GetAvgLevel(int slot_id) { int num1 = 0; int num2 = 0; FF9StateGlobal ff9StateGlobal = FF9StateSystem.Common.FF9; for (int index = 0; index < 9; ++index) { if (slot_id != index && ff9StateGlobal.player[index].info.party != 0) { num2 += ff9StateGlobal.player[index].level; ++num1; } } if (num1 == 0) { return(1); } return(num2 / num1); }
public static UInt32 ManageBattleEnd(FF9StateBattleSystem btlsys) { FF9StateGlobal ff9 = FF9StateSystem.Common.FF9; FF9StateBattleSystem ff9Battle = FF9StateSystem.Battle.FF9Battle; switch (ff9.btl_result) { case 3: case 6: if (btlsys.btl_scene.Info.NoGameOver == 0) { ff9.btl_result = 6; break; } for (BTL_DATA next = ff9Battle.btl_list.next; next != null; next = next.next) { if (next.bi.player != 0) { SavePlayerData(next, false); } } break; default: if (ff9.btl_result == 1 || ff9.btl_result == 2) { BattleAchievement.UpdateEndBattleAchievement(); } for (BTL_DATA next = ff9Battle.btl_list.next; next != null; next = next.next) { if (next.bi.player != 0) { SavePlayerData(next, false); } } break; } return(1); }
private void CreateBattleData(FF9StateGlobal FF9) { BTL_DATA[] btlDataArray = btlseq.btl_list = FF9StateSystem.Battle.FF9Battle.btl_data; Int32 index1 = 0; for (Int32 index2 = index1; index2 < 4; ++index2) { btlDataArray[index2] = new BTL_DATA(); if (FF9.party.member[index2] != null) { Byte num = FF9.party.member[index2].info.serial_no; BattlePlayerCharacter.CreatePlayer(btlDataArray[index1], (BattlePlayerCharacter.PlayerSerialNumber)num); Int32 length = 0; IEnumerator enumerator = btlDataArray[index1].gameObject.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { if ((enumerator.Current as UnityEngine.Object)?.name.Contains("mesh") == true) { ++length; } } } finally { IDisposable disposable = enumerator as IDisposable; disposable?.Dispose(); } btlDataArray[index1].meshIsRendering = new Boolean[length]; for (Int32 index3 = 0; index3 < length; ++index3) { btlDataArray[index1].meshIsRendering[index3] = true; } btlDataArray[index1].meshCount = length; btlDataArray[index1].animation = btlDataArray[index1].gameObject.GetComponent <Animation>(); ++index1; } btlDataArray[index2].typeNo = 5; btlDataArray[index2].idleAnimationName = this.animationName[index2]; } for (Int32 index2 = 4; index2 < 4 + (Int32)this.btlScene.PatAddr[FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum].MonCount; ++index2) { SB2_PATTERN sb2Pattern = this.btlScene.PatAddr[FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum]; Byte num = sb2Pattern.Put[index2 - 4].TypeNo; SB2_MON_PARM sb2MonParm = this.btlScene.MonAddr[num]; String path = FF9BattleDB.GEO.GetValue(sb2MonParm.Geo); //var vector3 = new Vector3(sb2Pattern.Put[index2 - 4].Xpos, sb2Pattern.Put[index2 - 4].Ypos * -1, sb2Pattern.Put[index2 - 4].Zpos); btlDataArray[index2] = new BTL_DATA { gameObject = ModelFactory.CreateModel(path, true) }; if (ModelFactory.IsUseAsEnemyCharacter(path)) { if (path.Contains("GEO_MON_B3_168")) { btlDataArray[index2].gameObject.transform.FindChild("mesh5").gameObject.SetActive(false); } btlDataArray[index2].weapon_geo = ModelFactory.CreateDefaultWeaponForCharacterWhenUseAsEnemy(path); MeshRenderer[] componentsInChildren = btlDataArray[index2].weapon_geo.GetComponentsInChildren <MeshRenderer>(); btlDataArray[index2].weaponMeshCount = componentsInChildren.Length; btlDataArray[index2].weaponRenderer = new Renderer[btlDataArray[index2].weaponMeshCount]; for (Int32 index3 = 0; index3 < btlDataArray[index2].weaponMeshCount; ++index3) { btlDataArray[index2].weaponRenderer[index3] = componentsInChildren[index3].GetComponent <Renderer>(); } geo.geoAttach(btlDataArray[index2].weapon_geo, btlDataArray[index2].gameObject, ModelFactory.GetDefaultWeaponBoneIdForCharacterWhenUseAsEnemy(path)); } Int32 length = 0; IEnumerator enumerator = btlDataArray[index2].gameObject.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { if ((enumerator.Current as UnityEngine.Object)?.name.Contains("mesh") == true) { ++length; } } } finally { IDisposable disposable = enumerator as IDisposable; disposable?.Dispose(); } btlDataArray[index2].meshIsRendering = new Boolean[length]; for (Int32 index3 = 0; index3 < length; ++index3) { btlDataArray[index2].meshIsRendering[index3] = true; } btlDataArray[index2].meshCount = length; btlDataArray[index2].animation = btlDataArray[index2].gameObject.GetComponent <Animation>(); btlDataArray[index2].animation = btlDataArray[index2].gameObject.GetComponent <Animation>(); btlDataArray[index2].typeNo = num; btlDataArray[index2].idleAnimationName = this.animationName[index2]; } }
public void InitBattleScene() { FF9StateGlobal FF9 = FF9StateSystem.Common.FF9; FF9.charArray.Clear(); this.btlScene = FF9StateSystem.Battle.FF9Battle.btl_scene = new BTL_SCENE(); Debug.Log("battleID = " + FF9StateSystem.Battle.battleMapIndex); Dictionary <String, Int32> source = FF9BattleDB.SceneData; battleSceneName = source.FirstOrDefault(p => p.Value == FF9StateSystem.Battle.battleMapIndex).Key; battleSceneName = battleSceneName.Substring(4); Debug.Log("battleSceneName = " + battleSceneName); this.btlScene.ReadBattleScene(battleSceneName); this.StartCoroutine(PersistenSingleton <FF9TextTool> .Instance.UpdateBattleText(FF9BattleDB.SceneData["BSC_" + battleSceneName])); WMProfiler.Begin("Start Load Text"); String battleModelPath = FF9BattleDB.MapModel["BSC_" + battleSceneName]; FF9StateSystem.Battle.FF9Battle.map.btlBGPtr = ModelFactory.CreateModel("BattleMap/BattleModel/battleMap_all/" + battleModelPath + "/" + battleModelPath, Vector3.zero, Vector3.zero, true); FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum = FF9StateSystem.Battle.isDebug ? FF9StateSystem.Battle.patternIndex : (Byte)this.ChoicePattern(); this.btlSeq = new btlseq(); this.btlSeq.ReadBattleSequence(battleSceneName); BeginInitialize(); battle.InitBattle(); EndInitialize(); if (!FF9StateSystem.Battle.isDebug) { String ebFileName = "EVT_BATTLE_" + battleSceneName; FF9StateBattleMap ff9StateBattleMap = FF9StateSystem.Battle.FF9Battle.map; ff9StateBattleMap.evtPtr = EventEngineUtils.loadEventData(ebFileName, "Battle/"); PersistenSingleton <EventEngine> .Instance.StartEvents(ff9StateBattleMap.evtPtr); PersistenSingleton <EventEngine> .Instance.eTb.InitMessage(); } this.CreateBattleData(FF9); if (battleSceneName == "EF_E006" || battleSceneName == "EF_E007") { BTL_DATA btlData1 = FF9StateSystem.Battle.FF9Battle.btl_data[4]; BTL_DATA btlData2 = FF9StateSystem.Battle.FF9Battle.btl_data[5]; this.GeoBattleAttach(btlData2.gameObject, btlData1.gameObject, 55); btlData2.attachOffset = 100; } FF9StateBattleSystem stateBattleSystem = FF9StateSystem.Battle.FF9Battle; GEOTEXHEADER geotexheader = new GEOTEXHEADER(); geotexheader.ReadBGTextureAnim(battleModelPath); stateBattleSystem.map.btlBGTexAnimPtr = geotexheader; BBGINFO bbginfo = new BBGINFO(); bbginfo.ReadBattleInfo(battleModelPath); FF9StateSystem.Battle.FF9Battle.map.btlBGInfoPtr = bbginfo; btlshadow.ff9battleShadowInit(13); battle.InitBattleMap(); this.seqList = new List <Int32>(); SB2_PATTERN sb2Pattern = this.btlScene.PatAddr[FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum]; Int32[] numArray = new Int32[sb2Pattern.MonCount]; for (Int32 index = 0; index < (Int32)sb2Pattern.MonCount; ++index) { numArray[index] = sb2Pattern.Put[index].TypeNo; } foreach (Int32 num in numArray.Distinct().ToArray()) { for (Int32 index1 = 0; index1 < this.btlSeq.sequenceProperty.Length; ++index1) { SequenceProperty sequenceProperty = this.btlSeq.sequenceProperty[index1]; if (sequenceProperty.Montype == num) { for (Int32 index2 = 0; index2 < sequenceProperty.PlayableSequence.Count; ++index2) { this.seqList.Add(sequenceProperty.PlayableSequence[index2]); } } } } this.btlIDList = FF9StateSystem.Battle.FF9Battle.seq_work_set.AnmOfsList.Distinct().ToArray(); this.battleState = BattleState.PlayerTurn; playerEnterCommand = false; this.playerCastingSkill = false; this.enemyEnterCommand = false; }
public void InitBattleScene() { FF9StateGlobal ff = FF9StateSystem.Common.FF9; ff.charArray.Clear(); this.btlScene = (FF9StateSystem.Battle.FF9Battle.btl_scene = new BTL_SCENE()); global::Debug.Log("battleID = " + FF9StateSystem.Battle.battleMapIndex); HonoluluBattleMain.battleSceneName = FF9BattleDB.SceneData.FirstOrDefault((KeyValuePair <string, int> x) => x.Value == FF9StateSystem.Battle.battleMapIndex).Key; HonoluluBattleMain.battleSceneName = HonoluluBattleMain.battleSceneName.Substring(4); global::Debug.Log("battleSceneName = " + HonoluluBattleMain.battleSceneName); this.btlScene.ReadBattleScene(HonoluluBattleMain.battleSceneName); base.StartCoroutine(PersistenSingleton <FF9TextTool> .Instance.UpdateBattleText(FF9BattleDB.SceneData["BSC_" + HonoluluBattleMain.battleSceneName])); WMProfiler.Begin("Start Load Text"); string text = FF9BattleDB.MapModel["BSC_" + HonoluluBattleMain.battleSceneName]; string path = "BattleMap/BattleModel/battleMap_all/" + text + "/" + text; FF9StateSystem.Battle.FF9Battle.map.btlBGPtr = ModelFactory.CreateModel(path, Vector3.zero, Vector3.zero, true); checked { if (!FF9StateSystem.Battle.isDebug) { FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum = (byte)this.ChoicePattern(); } else { FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum = FF9StateSystem.Battle.patternIndex; } this.btlSeq = new btlseq(); this.btlSeq.ReadBattleSequence(HonoluluBattleMain.battleSceneName); FF9StateSystem.Battle.FF9Battle.attr = 0; battle.InitBattle(); FF9StateBattleSystem ff9Battle = FF9StateSystem.Battle.FF9Battle; ff9Battle.attr |= 1; if (!FF9StateSystem.Battle.isDebug) { string ebFileName = "EVT_BATTLE_" + HonoluluBattleMain.battleSceneName; FF9StateBattleMap map = FF9StateSystem.Battle.FF9Battle.map; map.evtPtr = EventEngineUtils.loadEventData(ebFileName, EventEngineUtils.ebSubFolderBattle); PersistenSingleton <EventEngine> .Instance.StartEvents(map.evtPtr); PersistenSingleton <EventEngine> .Instance.eTb.InitMessage(); } this.CreateBattleData(ff); if (HonoluluBattleMain.battleSceneName == "EF_E006" || HonoluluBattleMain.battleSceneName == "EF_E007") { BTL_DATA btl_DATA = FF9StateSystem.Battle.FF9Battle.btl_data[4]; BTL_DATA btl_DATA2 = FF9StateSystem.Battle.FF9Battle.btl_data[5]; this.GeoBattleAttach(btl_DATA2.gameObject, btl_DATA.gameObject, 55); btl_DATA2.attachOffset = 100; } FF9StateBattleSystem ff9Battle2 = FF9StateSystem.Battle.FF9Battle; GEOTEXHEADER geotexheader = new GEOTEXHEADER(); geotexheader.ReadBGTextureAnim(text); ff9Battle2.map.btlBGTexAnimPtr = geotexheader; BBGINFO bbginfo = new BBGINFO(); bbginfo.ReadBattleInfo(text); FF9StateSystem.Battle.FF9Battle.map.btlBGInfoPtr = bbginfo; btlshadow.ff9battleShadowInit(13); battle.InitBattleMap(); this.seqList = new List <int> (); SB2_PATTERN sb2_PATTERN = this.btlScene.PatAddr[(int)FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum]; int[] array = new int[(int)sb2_PATTERN.MonCount]; for (int i = 0; i < (int)sb2_PATTERN.MonCount; i++) { array[i] = (int)sb2_PATTERN.Put[i].TypeNo; } array = array.Distinct <int> ().ToArray <int> (); for (int j = 0; j < array.Length; j++) { for (int k = 0; k < this.btlSeq.sequenceProperty.Length; k++) { SequenceProperty sequenceProperty = this.btlSeq.sequenceProperty[k]; if (sequenceProperty.Montype == array[j]) { for (int l = 0; l < sequenceProperty.PlayableSequence.Count; l++) { this.seqList.Add(sequenceProperty.PlayableSequence[l]); } } } } this.btlIDList = FF9StateSystem.Battle.FF9Battle.seq_work_set.AnmOfsList.Distinct <byte> ().ToArray <byte> (); this.battleState = HonoluluBattleMain.BattleState.PlayerTurn; HonoluluBattleMain.playerEnterCommand = false; this.playerCastingSkill = false; this.enemyEnterCommand = false; } }
private void Update() { BattleHUD.Read(); this.UpdateAttachModel(); this.cumulativeTime += Time.deltaTime; if (this.needClampTime) { this.cumulativeTime = Mathf.Min(this.cumulativeTime, HonoluluBattleMain.frameTime * (float)SettingsState.FastForwardGameSpeed * 1.2f); } while (this.cumulativeTime >= HonoluluBattleMain.frameTime) { this.cumulativeTime -= HonoluluBattleMain.frameTime; HonoluluBattleMain.battleSPS.Service(); if ((FF9StateSystem.Battle.FF9Battle.attr & 4096) == 0) { if ((FF9StateSystem.Battle.FF9Battle.attr & 256) == 0) { this.battleResult = (ulong)battle.BattleMain(); if (!FF9StateSystem.Battle.isDebug) { if (UIManager.Battle.FF9BMenu_IsEnable()) { this.YMenu_ManagerAt(); } if (this.battleResult == 1UL) { PersistenSingleton <FF9StateSystem> .Instance.mode = 8; FF9StateBattleSystem ff9Battle3 = FF9StateSystem.Battle.FF9Battle; ff9Battle3.attr |= 4096; } } SceneDirector.ServiceFade(); } } else { FF9StateGlobal ff9StateGlobal = FF9StateSystem.Common.FF9; switch (ff9StateGlobal.btl_result) { case 1: case 2: case 3: case 4: case 5: case 7: if (ff9StateGlobal.btl_result == 2) { ff9StateGlobal.btl_result = 1; } if (FF9StateSystem.Battle.FF9Battle.map.nextMode == 1 || FF9StateSystem.Battle.FF9Battle.map.nextMode == 5) { FF9StateSystem.Common.FF9.fldMapNo = FF9StateSystem.Battle.FF9Battle.map.nextMapNo; } else if (FF9StateSystem.Battle.FF9Battle.map.nextMode == 3) { FF9StateSystem.Common.FF9.wldMapNo = FF9StateSystem.Battle.FF9Battle.map.nextMapNo; } UIManager.Battle.GoToBattleResult(); if (!FF9StateSystem.Battle.isDebug) { PersistenSingleton <EventEngine> .Instance.ServiceEvents(); SceneDirector.ServiceFade(); } break; case 6: UIManager.Battle.GoToGameOver(); break; } } } for (BTL_DATA next = FF9StateSystem.Battle.FF9Battle.btl_list.next; next != null; next = next.next) { if (next.bi.slave == 0 && next.bi.disappear == 0 && next.bi.shadow != 0) { FF9StateBattleSystem ff9Battle2 = FF9StateSystem.Battle.FF9Battle; int boneNo = ff9btl.ff9btl_set_bone(next.shadow_bone[0], next.shadow_bone[1]); if (next.bi.player != 0) { if ((ff9Battle2.cmd_status & 1) == 0) { if ((next.escape_key ^ ff9Battle2.btl_escape_key) != 0) { btl_mot.SetDefaultIdle(next); } next.escape_key = ff9Battle2.btl_escape_key; } btlseq.FF9DrawShadowCharBattle(ff9Battle2.map.shadowArray, (int)next.bi.slot_no, 0, boneNo); } else if (next.die_seq < 4) { btlseq.FF9DrawShadowCharBattle(ff9Battle2.map.shadowArray, (int)(checked (9 + next.bi.slot_no)), 0, boneNo); } } } }
private void CreateBattleData(FF9StateGlobal FF9) { BTL_DATA[] array = btlseq.btl_list = FF9StateSystem.Battle.FF9Battle.btl_data; int num = 0; checked { for (int i = num; i < 4; i++) { array[i] = new BTL_DATA(); if (FF9.party.member[i] != null) { byte serial_no = FF9.party.member[i].info.serial_no; BattlePlayerCharacter.CreatePlayer(array[num], (BattlePlayerCharacter.PlayerSerialNumber)serial_no); int num2 = 0; using (IEnumerator enumerator = array[num].gameObject.transform.GetEnumerator()) { while (enumerator.MoveNext()) { if (((Transform)enumerator.Current).name.Contains("mesh")) { num2++; } } } array[num].meshIsRendering = new bool[num2]; for (int j = 0; j < num2; j++) { array[num].meshIsRendering[j] = true; } array[num].meshCount = num2; array[num].animation = array[num].gameObject.GetComponent <Animation> (); num++; } array[i].typeNo = 5; array[i].idleAnimationName = this.animationName[i]; } for (int k = 4; k < (int)(4 + this.btlScene.PatAddr[(int)FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum].MonCount); k++) { SB2_PATTERN sb2_PATTERN = this.btlScene.PatAddr[(int)FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum]; byte typeNo = sb2_PATTERN.Put[k - 4].TypeNo; SB2_MON_PARM sb2_MON_PARM = this.btlScene.MonAddr[(int)typeNo]; string text = FF9BattleDB.GEO[(int)sb2_MON_PARM.Geo]; new Vector3((float)sb2_PATTERN.Put[k - 4].Xpos, (float)(sb2_PATTERN.Put[k - 4].Ypos * -1), (float)sb2_PATTERN.Put[k - 4].Zpos); array[k] = new BTL_DATA(); array[k].gameObject = ModelFactory.CreateModel(text, true); if (ModelFactory.IsUseAsEnemyCharacter(text)) { if (text.Contains("GEO_MON_B3_168")) { array[k].gameObject.transform.FindChild("mesh5").gameObject.SetActive(false); } array[k].weapon_geo = ModelFactory.CreateDefaultWeaponForCharacterWhenUseAsEnemy(text); MeshRenderer[] componentsInChildren = array[k].weapon_geo.GetComponentsInChildren <MeshRenderer> (); array[k].weaponMeshCount = componentsInChildren.Length; array[k].weaponRenderer = new Renderer[array[k].weaponMeshCount]; for (int l = 0; l < array[k].weaponMeshCount; l++) { array[k].weaponRenderer[l] = componentsInChildren[l].GetComponent <Renderer> (); } geo.geoAttach(array[k].weapon_geo, array[k].gameObject, ModelFactory.GetDefaultWeaponBoneIdForCharacterWhenUseAsEnemy(text)); } int num3 = 0; using (IEnumerator enumerator = array[k].gameObject.transform.GetEnumerator()) { while (enumerator.MoveNext()) { if (((Transform)enumerator.Current).name.Contains("mesh")) { num3++; } } } array[k].meshIsRendering = new bool[num3]; for (int m = 0; m < num3; m++) { array[k].meshIsRendering[m] = true; } array[k].meshCount = num3; array[k].animation = array[k].gameObject.GetComponent <Animation> (); array[k].animation = array[k].gameObject.GetComponent <Animation> (); array[k].typeNo = typeNo; array[k].idleAnimationName = this.animationName[k]; } } }
public static void FF9FEqp_Equip(Byte charPosID, ref Int32 currentItemIndex) { ff9feqp._FF9FEqp.player = charPosID; ff9feqp._FF9FEqp.equip = 0; ff9feqp._FF9FEqp.item[0] = new FF9ITEM(Byte.MaxValue, 0); FF9StateGlobal ff = FF9StateSystem.Common.FF9; Int32 num = 0; UInt16[] array = new UInt16[] { 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1 }; Byte[] array2 = new Byte[] { 128, 32, 64, 16, 8 }; PLAYER play = FF9StateSystem.Common.FF9.party.member[(Int32)ff9feqp._FF9FEqp.player]; UInt16 num2 = array[(CharacterId)ff9play.FF9Play_GetCharID2(play.Index, play.IsSubCharacter)]; Byte b = array2[(Int32)ff9feqp._FF9FEqp.equip]; for (Int32 i = 0; i < 256; i++) { if (ff.item[i].count != 0) { FF9ITEM_DATA ff9ITEM_DATA = ff9item._FF9Item_Data[(Int32)ff.item[i].id]; if ((ff9ITEM_DATA.equip & num2) != 0 && (ff9ITEM_DATA.type & b) != 0) { ff9feqp._FF9FEqp.item[num++] = ff.item[i]; } } } if (currentItemIndex >= num) { currentItemIndex = 0; } else if (currentItemIndex < 0) { currentItemIndex = num - 1; } PLAYER player = FF9StateSystem.Common.FF9.party.member[(Int32)ff9feqp._FF9FEqp.player]; Int32 itemId1 = (Int32)player.equip[(Int32)ff9feqp._FF9FEqp.equip]; Int32 itemId2 = (Int32)ff9feqp._FF9FEqp.item[currentItemIndex].id; if (itemId1 != CharacterEquipment.EmptyItemId) { ff9item.FF9Item_Add(itemId1, 1); } if (ff9item.FF9Item_Remove(itemId2, 1) != 0) { player.equip[(Int32)ff9feqp._FF9FEqp.equip] = (Byte)itemId2; ff9feqp.FF9FEqp_UpdatePlayer(player); } }
// ReSharper disable PossibleNullReferenceException public static bool CheckCommandCondition(FF9StateBattleSystem btlsys, CMD_DATA cmd) { BTL_DATA btlData = cmd.regist; FF9StateGlobal ff9StateGlobal = FF9StateSystem.Common.FF9; if (btlData != null) { if (cmd.cmd_no < 55) { int num = btl_mot.setDirection(btlData); btlData.evt.rotBattle.eulerAngles = new Vector3(btlData.evt.rotBattle.eulerAngles.x, num, btlData.evt.rotBattle.eulerAngles.z); btlData.rot.eulerAngles = new Vector3(btlData.rot.eulerAngles.x, num, btlData.rot.eulerAngles.z); } if (battle.GARNET_DEPRESS_FLAG != 0 && btlData.bi.player != 0 && (btlData.bi.slot_no == 2 && cmd.cmd_no < 48) && Comn.random8() < 64) { UIManager.Battle.SetBattleFollowMessage(27); return(false); } if (!CheckMagicCondition(cmd)) { return(false); } } byte num1 = cmd.cmd_no; switch (num1) { case 11: btlData.cmd[3].tar_id = btl_util.GetStatusBtlID(1U, 0U); break; case 12: label_12: /*int num2 = (int)*/ btl_stat.AlterStatus(btlData, 1073741824U); btlData.cmd[3].cmd_no = cmd.cmd_no; btlData.cmd[3].tar_id = cmd.cmd_no != 3 ? btl_util.GetStatusBtlID(1U, 0U) : cmd.tar_id; cmd.tar_id = btlData.btl_id; break; case 14: case 15: label_14: if (ff9item.FF9Item_GetCount(cmd.sub_no) == 0) { UIManager.Battle.SetBattleFollowMessage(24); return(false); } if (cmd.cmd_no == 51) { UIManager.Battle.SetBattleFollowMessage(9); } break; case 16: case 18: case 20: btl_calc.DecideSummonType(cmd); break; case 22: case 23: if (cmd.sub_no == 46) { btl_calc.DecideMeteor(cmd); } break; case 24: if (cmd.sub_no == 82) { cmd.tar_id = btl_util.GetRandomBtlID((uint)(Comn.random8() & 1)); break; } if (cmd.sub_no == 93 && ff9item.FF9Item_GetCount(cmd.aa.Ref.power) < btl_util.SumOfTarget(1U)) { UIManager.Battle.SetBattleFollowMessage(24); return(false); } break; case 28: case 29: if (cmd.sub_no == 126 || cmd.sub_no == 134) { uint num3 = cmd.aa.Ref.power * (uint)btlData.level; if (num3 > ff9StateGlobal.party.gil) { UIManager.Battle.SetBattleFollowMessage(20); return(false); } ff9StateGlobal.party.gil -= num3; break; } if (cmd.sub_no == 129 || cmd.sub_no == 137) { cmd.aa.Ref.attr = (byte)(1 << Comn.random8() % 8); } break; case 31: return(btl_calc.DecideMagicSword(btlData, cmd.aa.MP)); default: switch (num1) { case 49: BTL_DATA btlDataPtr1; if ((btlDataPtr1 = btl_scrp.GetBtlDataPtr(cmd.tar_id)) == null || btlDataPtr1.bi.target == 0 || Status.checkCurStat(btlDataPtr1, 256U)) { return(false); } if (btlsys.btl_scene.Info.NoNeighboring != 0 && (btlData.weapon.category & 1) != 0) { UIManager.Battle.SetBattleFollowMessage(23); return(false); } if (cmd.cmd_no == 49) { UIManager.Battle.SetBattleFollowMessage(7); } break; case 50: BTL_DATA btlDataPtr2; if ((btlDataPtr2 = btl_scrp.GetBtlDataPtr(cmd.tar_id)) == null || btlDataPtr2.bi.target == 0 || Status.checkCurStat(btlDataPtr2, 256U)) { return(false); } UIManager.Battle.SetBattleFollowMessage(8); break; case 51: goto label_14; case 52: if (btlsys.btl_scene.Info.NoNeighboring != 0 && (btlData.weapon.category & 1) != 0) { UIManager.Battle.SetBattleFollowMessage(23); return(false); } if (cmd.cmd_no == 49) { UIManager.Battle.SetBattleFollowMessage(7); } break; case 56: if (btlsys.btl_phase == 4) { for (BTL_DATA btl = btlsys.btl_list.next; btl != null; btl = btl.next) { if (btl.bi.player != 0 && !Status.checkCurStat(btl, 1107431747U) && btl.cur.hp > 0) { if (!btl_mot.checkMotion(btl, 17)) { btl_mot.setMotion(btl, 17); btl.evt.animFrame = 0; } btlsys.btl_phase = 5; btlsys.btl_seq = 3; } } if (btlsys.btl_phase == 5 && btlsys.btl_seq == 3) { UIManager.Battle.SetIdle(); ++ff9StateGlobal.party.escape_no; if (cmd.sub_no == 0) { ff9StateGlobal.btl_flag |= 4; } KillAllCommand(btlsys); } else { btlsys.cmd_status &= 65534; } return(false); } break; case 57: if (cmd.sub_no != btlsys.phantom_no) { cmd.sub_no = btlsys.phantom_no; cmd.aa = btlsys.aa_data[cmd.sub_no]; } break; case 59: if (Status.checkCurStat(btlData, 16384U)) { UIManager.Battle.SetBattleFollowMessage(6); btlData.dms_geo_id = btl_init.GetModelID(btl_util.getSerialNumber(btlData) + 19); } else { btlData.dms_geo_id = btl_init.GetModelID(btl_util.getSerialNumber(btlData)); } return(true); case 60: btl_sys.CheckBattleMenuOff(btlData); if (btlData.die_seq == 0) { btlData.die_seq = btlData.bi.player == 0 ? btlData.bi.slave != 0 || btlData.bi.death_f == 0 ? (byte)1 : (byte)3 : (!btl_mot.checkMotion(btlData, 4) ? (byte)1 : (byte)5); } return(false); case 61: btlData.cur.hp = 1; /*int num4 = (int)*/ btl_stat.RemoveStatus(btlData, 256U); btlData.bi.dmg_mot_f = 1; FF9StateSystem.Settings.SetHPFull(); return(false); case 62: btl_stat.StatusCommandCancel(btlData, 1U); btlData.stat.cur |= 1U; btlData.bi.atb = 0; btl_sys.CheckBattlePhase(btlData); /*int num5 = (int)*/ btl_stat.RemoveStatus(btlData, 2147483648U); btl_stat.SetStatusClut(btlData, true); return(false); default: switch (num1) { case 1: if (btlsys.btl_scene.Info.NoNeighboring != 0 && (btlData.weapon.category & 1) != 0 && cmd.tar_id > 15) { UIManager.Battle.SetBattleFollowMessage(23); return(false); } break; case 3: goto label_12; } break; } break; } return(true); }
private static void BattleLoadLoop(FF9StateGlobal sys, FF9StateBattleSystem btlsys) { //uint id = sys.id; btlsys.attr |= 2; btlsys.attr |= 4; if ((btlsys.attr & 2) != 0 && (btlsys.btl_load_status & 32) == 0 && (btlsys.btl_load_status & 8) != 0) { btlsys.btl_load_status |= 32; } else if ((btlsys.attr & 4) != 0 && (btlsys.btl_load_status & 64) == 0 && (btlsys.btl_load_status & 16) != 0) { btlsys.btl_load_status |= 64; } foreach (BattleUnit next in FF9StateSystem.Battle.FF9Battle.EnumerateBattleUnits()) { BTL_DATA data = next.Data; if (data.bi.disappear == 0) { btlseq.DispCharacter(data); if (next.IsPlayer) { btl_util.SetFadeRate(data, btlsys.player_load_fade); } else if (!next.IsSlave) { btl_util.SetFadeRate(data, btlsys.enemy_load_fade); } btl_stat.SetStatusVfx(next); } } if ((btlsys.btl_load_status & 2) != 0) { btlseq.Sequencer(); } if ((btlsys.attr & 1) != 0) { battlebg.nf_BattleBG(); } if ((btlsys.attr & 2) != 0 && (btlsys.btl_load_status & 2) == 0) { if ((btlsys.btl_load_status & 8) == 0) { if (!FF9TextTool.IsLoading) { btl_init.InitEnemyData(btlsys); btl_init.OrganizeEnemyData(btlsys); } } else if ((btlsys.btl_load_status & 32) != 0) { if (btlsys.enemy_load_fade >= 32) { btlsys.btl_load_status |= 2; } else { btlsys.enemy_load_fade += 4; } } } if ((btlsys.attr & 4) == 0 || (btlsys.btl_load_status & 4) != 0) { return; } if ((btlsys.btl_load_status & 16) == 0) { if (FF9TextTool.IsLoading) { return; } btl_init.InitPlayerData(btlsys); SettingsState settings = FF9StateSystem.Settings; settings.SetATBFull(); settings.SetHPFull(); for (BTL_DATA next = btlsys.btl_list.next; next != null; next = next.next) { BattleTexAnimWatcher.ForcedNonCullingMesh(next.gameObject); } } else { if ((btlsys.btl_load_status & 64) == 0) { return; } if (btlsys.player_load_fade >= 32) { btlsys.btl_load_status |= 4; } else { btlsys.player_load_fade += 8; } } }
private static void BattleTrailingLoop(FF9StateGlobal sys, FF9StateBattleSystem btlsys) { //uint id = sys.id; UInt32 num1 = 1; if (SFX.isRunning || btlsys.cmd_queue.next != null || btlsys.cur_cmd != null) { num1 = 0U; } foreach (BattleUnit next in FF9StateSystem.Battle.FF9Battle.EnumerateBattleUnits()) { BTL_DATA data = next.Data; if (data.bi.disappear == 0) { btlseq.DispCharacter(data); switch (btlsys.btl_seq) { case 0: btl_para.CheckPointData(data); if ((!next.IsPlayer && !next.IsUnderStatus((BattleStatus)4099U)) || (next.IsPlayer && next.IsUnderStatus(BattleStatus.Death)) && !btl_mot.checkMotion(data, 4)) { num1 = 0U; } break; case 1: if (next.IsPlayer && !btl_mot.checkMotion(data, 4) && !next.IsUnderStatus((BattleStatus)4099U)) { num1 = 0U; } break; case 2: if (btlsys.cmd_queue.next != null && btlsys.cur_cmd == null && (!btl_cmd.CheckSpecificCommand2(59) && !btl_cmd.CheckSpecificCommand2(60)) && (!btl_cmd.CheckSpecificCommand2(61) && !btl_cmd.CheckSpecificCommand2(62))) { num1 = 1U; } btl_para.CheckPointData(data); if (next.IsPlayer) { next.TryRemoveStatuses((BattleStatus)33592320U); } if (btlsys.cmd_mode != 0) { num1 = 0U; } if (next.IsUnderStatus(BattleStatus.Death)) { if (data.die_seq == 0 && !btl_cmd.CheckUsingCommand(data.cmd[2])) { btl_cmd.SetCommand(data.cmd[2], 60U, 0U, data.btl_id, 0U); } if (next.IsPlayer && data.die_seq != 6 || !next.IsPlayer && data.die_seq != 6) { num1 = 0U; } break; } if (!Status.checkCurStat(data, 33558531U) && !btl_mot.checkMotion(data, 0) && !btl_mot.checkMotion(data, 1)) { num1 = 0U; } break; case 3: btl_cmd.KillAllCommand(btlsys); if (next.IsUnderStatus(BattleStatus.Death)) { if (data.die_seq == 0) { data.die_seq = 1; } if (!btl_mot.checkMotion(data, 4) || btl_cmd.CheckSpecificCommand(data, 61)) { num1 = 0U; } break; } if (next.IsPlayer && !Status.checkCurStat(data, 1107431747U)) { FF9StateSystem.Battle.isFade = true; data.pos[2] -= 100f; btl_util.SetFadeRate(data, btlsys.btl_escape_fade); if (btlsys.btl_escape_fade <= 0) { data.SetDisappear(1); break; } num1 = 0U; if (btlsys.btl_escape_fade == 32) { btlsnd.ff9btlsnd_sndeffect_play(2906, 0, SByte.MaxValue, 128); btlsnd.ff9btlsnd_sndeffect_play(2907, 0, SByte.MaxValue, 128); btlsnd.ff9btlsnd_sndeffect_play(2908, 0, SByte.MaxValue, 128); btlsys.btl_escape_fade -= 2; } } break; } btl_stat.SetStatusVfx(next); } btl_mot.DieSequence(data); } if (btlsys.btl_seq == 3 && btlsys.btl_escape_fade < 32 && btlsys.btl_escape_fade != 0) { btlsys.btl_escape_fade -= 2; } if ((Int32)num1 != 0) { switch (btlsys.btl_seq) { case 0: case 4: sys.btl_flag |= 64; sys.btl_result = 1; if (btlsys.btl_scene.Info.WinPose != 0) { if (btl_util.ManageBattleSong(sys, 30U, 5U)) { for (BTL_DATA next = btlsys.btl_list.next; next != null; next = next.next) { if (next.bi.player != 0) { /*int num2 = (int)*/ btl_stat.RemoveStatuses(next, 3221208064U); if (!Status.checkCurStat(next, 4355U)) { if (next.cur.hp > 0) { Int32 num3 = btl_mot.GetDirection(next); next.evt.rotBattle.eulerAngles = new Vector3(next.evt.rotBattle.eulerAngles.x, num3, next.evt.rotBattle.eulerAngles.z); next.rot.eulerAngles = new Vector3(next.rot.eulerAngles.x, num3, next.rot.eulerAngles.z); next.bi.def_idle = !btl_stat.CheckStatus(next, 197122U) ? (Byte)0 : (Byte)1; next.bi.cmd_idle = 0; if (btl_util.getPlayerPtr(next).info.win_pose != 0) { btl_mot.setMotion(next, 18); } else { btl_mot.setMotion(next, next.bi.def_idle); } next.evt.animFrame = 0; } else { /*int num4 = (int)*/ btl_stat.AlterStatus(next, 256U); } } } } SFX.SetCamera(2); } else { break; } } else if (btlsys.btl_scene.Info.FieldBGM != 0) { sys.btl_flag |= 8; } btlsys.btl_phase = 6; break; case 1: sys.btl_result = 3; btlsys.btl_phase = 7; break; case 2: if (btlsys.btl_scene.Info.WinPose == 0 && btlsys.btl_scene.Info.FieldBGM != 0) { sys.btl_flag |= 8; } btlsys.btl_phase = 1; btl_cmd.KillAllCommand(btlsys); btl_cmd.InitCommandSystem(btlsys); for (BTL_DATA next = btlsys.btl_list.next; next != null; next = next.next) { btl_cmd.InitCommand(next); if (next.bi.player == 0) { Int32 num2 = btl_mot.GetDirection(next); next.evt.rotBattle.eulerAngles = new Vector3(next.evt.rotBattle.eulerAngles.x, num2, next.evt.rotBattle.eulerAngles.z); next.rot.eulerAngles = new Vector3(next.rot.eulerAngles.x, num2, next.rot.eulerAngles.z); } } break; case 3: UInt32 gil = (UInt32)battle.btl_bonus.gil; sys.btl_flag |= 64; for (BTL_DATA next = btlsys.btl_list.next; next != null; next = next.next) { if (next.bi.player == 0) { gil += btl_util.getEnemyTypePtr(next).bonus.gil; } } if (btlsys.btl_scene.Info.WinPose == 0 && btlsys.btl_scene.Info.FieldBGM != 0) { sys.btl_flag |= 8; } sys.btl_result = 4; btlsys.btl_phase = 8; btl_sys.ClearBattleBonus(); if ((sys.btl_flag & 4) != 0) { UInt32 num2 = gil / 10U; if (sys.party.gil > num2) { sys.party.gil -= num2; } else { num2 = sys.party.gil; sys.party.gil = 0U; } UIManager.Battle.SetBattleFollowMessage(30, num2); break; } if (btl_abil.CheckPartyAbility(1U, 16384U)) { battle.btl_bonus.escape_gil = true; battle.btl_bonus.gil = (Int32)(gil / 10U); } break; } if (btlsys.btl_phase != 5) { btlsys.btl_seq = btlsys.btl_phase != 6 || btlsys.btl_scene.Info.WinPose != 0 ? (Byte)0 : (Byte)1; } } else { btl_cmd.CommandEngine(btlsys); } battle.BattleSubSystem(sys, btlsys); }
public static UInt32 BattleMain() { FF9StateGlobal ff9 = FF9StateSystem.Common.FF9; FF9StateBattleSystem ff9Battle = FF9StateSystem.Battle.FF9Battle; SFX.UpdateCamera(); if (ff9Battle.btl_phase != 4 && ff9Battle.s_cur != null && ff9Battle.s_cur.activeSelf) { ff9Battle.s_cur.SetActive(false); } switch (ff9Battle.btl_phase) { case 1: battle.BattleIdleLoop(ff9, ff9Battle); break; case 2: battle.BattleLoadLoop(ff9, ff9Battle); break; case 3: if (battle.BattleIdleLoop(ff9, ff9Battle)) { if (FF9StateSystem.Common.FF9.btlMapNo == 336 && !battle.isAlreadyShowTutorial) { PersistenSingleton <UIManager> .Instance.TutorialScene.DisplayMode = TutorialUI.Mode.Battle; PersistenSingleton <UIManager> .Instance.ChangeUIState(UIManager.UIState.Tutorial); battle.isAlreadyShowTutorial = true; } if (!FF9StateSystem.Battle.isTutorial) { ff9Battle.btl_phase = 4; ff9Battle.btl_cnt = ff9Battle.btl_cnt & 15; ff9Battle.player_load_fade = 0; for (BTL_DATA next = ff9Battle.btl_list.next; next != null; next = next.next) { UInt16 startSfx; if (next.bi.player == 0 && (startSfx = BTL_SCENE.BtlGetStartSFX()) != UInt16.MaxValue) { btl_util.SetBattleSfx(next, startSfx, 127); break; } } if (battle.SUMMON_RAY_FLAG == 0) { UIManager.Battle.FF9BMenu_EnableMenu(true); } if (ff9Battle.btl_scene.Info.StartType == 0) { UIManager.Battle.SetBattleFollowMessage(2); break; } if (ff9Battle.btl_scene.Info.StartType == 1) { UIManager.Battle.SetBattleFollowMessage(1); } } } break; case 4: battle.BattleMainLoop(ff9, ff9Battle); break; case 5: if (!FF9StateSystem.Battle.isDebug) { UIManager.Battle.FF9BMenu_EnableMenu(false); } battle.BattleTrailingLoop(ff9, ff9Battle); if (ff9Battle.btl_seq != 3) { ff9Battle.btl_escape_key = 0; } break; case 6: battle.BattleIdleLoop(ff9, ff9Battle); if (ff9Battle.btl_seq == 1) { SceneDirector.FF9Wipe_FadeOutEx(32); ++ff9Battle.btl_seq; break; } if (ff9Battle.btl_seq == 2 && ff9Battle.btl_fade_time++ > 32) { return(btl_sys.ManageBattleEnd(ff9Battle)); } break; case 7: case 8: if (battle.BattleIdleLoop(ff9, ff9Battle)) { ff9.btl_flag |= 64; if (ff9Battle.btl_seq == 0) { if (ff9.btl_result != 5) { SceneDirector.FF9Wipe_FadeOutEx(32); } ++ff9Battle.btl_seq; break; } if (ff9Battle.btl_seq == 1 && ff9Battle.btl_fade_time++ > 32) { return(btl_sys.ManageBattleEnd(ff9Battle)); } } break; } if (!FF9StateSystem.Battle.isDebug) { PersistenSingleton <EventEngine> .Instance.ServiceEvents(); } ++ff9Battle.btl_cnt; return(0); }
public void StartEvents(Byte[] ebFileData) { EventEngine.resyncBGMSignal = 0; //Debug.Log("Reset resyncBGMSignal = " + (object)EventEngine.resyncBGMSignal); this._ff9 = FF9StateSystem.Common.FF9; this._ff9.charArray.Clear(); this._ff9Sys = PersistenSingleton <FF9StateSystem> .Instance; BinaryReader br = new BinaryReader(new MemoryStream(ebFileData)); this.SetupCodeParam(br); this._ff9.mapNameStr = FF9TextTool.LocationName(this._ff9.fldMapNo); this._defaultMapName = this._ff9.mapNameStr; switch (this._ff9Sys.mode) { case 1: this.gMode = 1; break; case 2: this.gMode = 2; break; case 3: this.gMode = 3; UIManager.World.EnableMapButton = true; break; case 8: this.gMode = 4; break; } EventInput.IsProcessingInput = this.gMode != 2 && this.gMode != 4; EMinigame.GetTheAirShipAchievement(); EMinigame.GetHelpAllVictimsInCleyraTown(); TimerUI.SetEnable(this._ff9.timerDisplay); TimerUI.SetDisplay(this._ff9.timerDisplay); TimerUI.SetPlay(this._ff9.timerControl); this.allObjsEBData = new Byte[this.sSourceObjN][]; this.toBeAddedObjUIDList.Clear(); for (Int32 index = 0; index < this.sSourceObjN; ++index) { br.BaseStream.Seek(128L, SeekOrigin.Begin); Int32 num = (Int32)this.sObjTable[index].ofs; Int32 count = (Int32)this.sObjTable[index].size; br.BaseStream.Seek((Int64)num, SeekOrigin.Current); this.allObjsEBData[index] = br.ReadBytes(count); //if (count < 4) //; } if ((this.sEventContext0.inited == 1 || this.sEventContext0.inited == 3) && this.gMode == 2) { this.sEventContext1.copy(this.sEventContext0); } this._context = this.sEventContext0; this.InitMP(); this.InitObj(); EventInput.IsProcessingInput = true; EIcon.InitFIcon(); EIcon.SetAIcon(0); for (Int32 index = 0; index < 80; ++index) { this._context.mapvar[index] = 0; } this._context.usercontrol = 0; this._context.controlUID = 0; this._context.idletimer = 0; EIcon.SetHereIcon(0); this.gStopObj = null; this._context.dashinh = 0; this._context.twist_a = 0; this._context.twist_d = 0; this.eTb.gMesCount = this.gAnimCount = 10; this._noEvents = false; this.InitEncount(); NewThread(0, 0); this._context.activeObj.obj.state = EventEngine.stateInit; this.SetupPartyUID(); for (Int32 index = 0; index < 8; ++index) { this._objPtrList[index] = null; } this._opLStart = 0; if (this.gMode == 2) { for (Int32 index = 0; index < 4; ++index) { Int32 partyMember = this.eTb.GetPartyMember(index); if (partyMember >= 0) { Actor actor = new Actor(this.sSourceObjN - 9 + partyMember, 0, EventEngine.sizeOfActor); } } this._context.partyObjTail = this._context.activeObjTail; } else { this._ff9.btl_rain = 0; } this._opLStart = 4; if (this.gMode == 1 && this.sEventContext1.inited == 1 && this.sEventContext1.lastmap == this._ff9.fldMapNo || this.gMode == 3 && this.sEventContext1.inited == 3 && this.sEventContext1.lastmap == this._ff9.wldMapNo || this._ff9Sys.prevMode == 9 && this.sEventContext1.inited != 0) { this.sEventContext0.copy(this.sEventContext1); this.Request(this.FindObjByUID(0), 0, 10, false); this.EnterBattleEnd(); } else { if (this.gMode != 2 && this.gMode != 4) { Boolean flag1 = this._ff9.fldMapNo == 70; Boolean flag2 = this._ff9.fldMapNo == 2200 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 9450 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 9999; Boolean flag3 = this._ff9.fldMapNo == 150 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 1155 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 325; Boolean flag4 = this._ff9.fldMapNo == 1251 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 5400; Boolean flag5 = this._ff9.fldMapNo == 1602 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 6645 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 16; Boolean flag6 = this._ff9.fldMapNo == 1757 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 6740; Boolean flag7 = this._ff9.fldMapNo == 2752 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 11100 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 9999; Boolean flag8 = this._ff9.fldMapNo == 3001 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 12000 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 0; Boolean flag9 = this._ff9.fldMapNo == 2161 && this.eBin.getVarManually(EBin.SC_COUNTER_SVR) == 10000 && this.eBin.getVarManually(EBin.MAP_INDEX_SVR) == 32; if (!flag1 && !flag4 && (!flag5 && !flag6) && (!flag3 && !flag2 && (!flag7 && !flag8)) && !flag9) { FF9StateSystem.Settings.UpdateTickTime(); ISharedDataSerializer serializer = FF9StateSystem.Serializer; serializer.Autosave(null, (e, s) => { }); } } this.ProcessEvents(); } this._context.inited = (Byte)this.gMode; this._context.lastmap = this.gMode != 1 ? (this.gMode != 3 ? (UInt16)0 : (UInt16)this._ff9.wldMapNo) : (UInt16)this._ff9.fldMapNo; br.Close(); SpawnCustomChatacters(); PersistenSingleton <CheatingManager> .Instance.ApplyDataWhenEventStart(); }