public static void SetDefaultShader(BTL_DATA btl) { BBGINFO bbgInfoPtr = battlebg.nf_GetBbgInfoPtr(); FF9StateBattleSystem ff9Battle = FF9StateSystem.Battle.FF9Battle; if ((ff9Battle.btl_load_status & 4) == 0 || (ff9Battle.btl_load_status & 32) == 0 || FF9StateSystem.Battle.isFade) { return; } btl_util.GeoSetABR(btl.gameObject, "PSX/BattleMap_StatusEffect"); btl_util.GeoSetColor2DrawPacket(btl.gameObject, bbgInfoPtr.chr_r, bbgInfoPtr.chr_g, bbgInfoPtr.chr_b, Byte.MaxValue); }
public static void SetFadeRate(BTL_DATA btl, Int32 rate) { if (rate >= 0 && rate < 32) { BBGINFO bbginfo = battlebg.nf_GetBbgInfoPtr(); btl_util.GeoSetABR(btl.gameObject, "GEO_POLYFLAGS_TRANS_100_PLUS_25"); btl_util.GeoSetColor2Source(btl.gameObject, (Byte)((Int32)bbginfo.chr_r * rate >> 5), (Byte)((Int32)bbginfo.chr_g * rate >> 5), (Byte)((Int32)bbginfo.chr_b * rate >> 5)); if (btl.weapon_geo) { btl_util.GeoSetABR(btl.weapon_geo, "GEO_POLYFLAGS_TRANS_100_PLUS_25"); btl_util.GeoSetColor2Source(btl.weapon_geo, (Byte)((Int32)bbginfo.chr_r * rate >> 5), (Byte)((Int32)bbginfo.chr_g * rate >> 5), (Byte)((Int32)bbginfo.chr_b * rate >> 5)); } } }
public static void SetEnemyFadeToPacket(BTL_DATA btl, Int32 rate) { BBGINFO bbginfo = battlebg.nf_GetBbgInfoPtr(); btl_util.GeoSetABR(btl.gameObject, "GEO_POLYFLAGS_TRANS_100_PLUS_25"); btl_util.GeoSetColor2DrawPacket(btl.gameObject, (Byte)((Int32)bbginfo.chr_r * rate >> 5), (Byte)((Int32)bbginfo.chr_g * rate >> 5), (Byte)((Int32)bbginfo.chr_b * rate >> 5), Byte.MaxValue); if (btl.bi.shadow != 0) { btl_util.GeoSetABR(btl.getShadow(), "GEO_POLYFLAGS_TRANS_100_PLUS_25"); btl_util.GeoSetColor2DrawPacket(btl.getShadow(), (Byte)((Int32)bbginfo.chr_r * rate >> 5), (Byte)((Int32)bbginfo.chr_g * rate >> 5), (Byte)((Int32)bbginfo.chr_b * rate >> 5), Byte.MaxValue); } if (rate == 0) { btl.SetDisappear(1); } }
public static void nf_InitBattleBG(BBGINFO bbginfoPtr, GEOTEXHEADER tab) { battlebg.btlModel = FF9StateSystem.Battle.FF9Battle.map.btlBGPtr; battlebg.nf_BbgInfoPtr = bbginfoPtr; battlebg.nf_BbgNumber = (Int32)battlebg.nf_BbgInfoPtr.bbgnumber; battlebg.nf_SkyFixPositionFlag = 0; if (battlebg.nf_BbgInfoPtr.fog != 0) { battlebg.nf_SkyFixPositionFlag++; } battlebg.nf_BbgSkyRotation = (Int32)battlebg.nf_BbgInfoPtr.skyrotation; battlebg.nf_BbgTexAnm = (Int32)battlebg.nf_BbgInfoPtr.texanim; battlebg.nf_BbgTabAddress = tab; battlebg.nf_BbgUVChangeCount = (Int32)battlebg.nf_BbgInfoPtr.uvcount; battlebg.nf_SetBbgDispAttribute(15); battlebg.nf_BbgSkyAngle_Y = 0; battlebg.SetDefaultShader(battlebg.btlModel); battlebg.objAnimModel = FF9StateSystem.Battle.FF9Battle.map.btlBGObjAnim; battlebg.objAnimModel = new GameObject[(Int32)battlebg.nf_BbgInfoPtr.objanim]; for (Int32 i = 0; i < (Int32)battlebg.nf_BbgInfoPtr.objanim; i++) { String text = String.Concat(new Object[] { "BBG_B", battlebg.nf_BbgNumber.ToString("D3"), "_OBJ", i + 1 }); battlebg.objAnimModel[i] = ModelFactory.CreateModel("BattleMap/BattleModel/battleMap_all/" + text + "/" + text, false); battlebg.SetDefaultShader(battlebg.objAnimModel[i]); if (battlebg.nf_BbgNumber == 171 && i == 1) { battlebg.SetMaterailShader(battlebg.objAnimModel[i], "PSX/BattleMap_Cystal"); } } FF9StateSystem.Battle.FF9Battle.map.btlBGObjAnim = battlebg.objAnimModel; battlebg.nf_BbgTabAddress.InitTextureAnim(); if (battlebg.nf_BbgTexAnm != 0) { for (Int32 j = 0; j < battlebg.nf_BbgTexAnm; j++) { battlebg.geoBGTexAnimPlay(battlebg.nf_BbgTabAddress, j); } } }
private static void SetStatusPolyColor(BTL_DATA btl) { BBGINFO bbgInfoPtr = battlebg.nf_GetBbgInfoPtr(); Int16[] numArray1 = new Int16[3]; Int16[] numArray2 = new Int16[3] { bbgInfoPtr.chr_r, bbgInfoPtr.chr_g, bbgInfoPtr.chr_b }; if (Status.checkCurStat(btl, 64U)) { numArray1[0] = 48; numArray1[1] = 72; numArray1[2] = 88; } else if (Status.checkCurStat(btl, 2048U)) { numArray1[0] = -16; numArray1[1] = 40; numArray1[2] = 40; } else if (Status.checkCurStat(btl, 16777216U)) { numArray1[0] = -80; numArray1[1] = 16; numArray1[2] = 72; } else if (Status.checkCurStat(btl, 33554432U)) { numArray1[0] = 48; numArray1[1] = 0; numArray1[2] = -96; } else { numArray1[0] = numArray1[1] = numArray1[2] = 0; } for (Int32 index = 0; index < 3; ++index) { btl.add_col[index] = numArray2[index] - numArray1[index] >= 0 ? numArray2[index] - numArray1[index] <= Byte.MaxValue ? (Byte)((UInt32)numArray2[index] - (UInt32)numArray1[index]) : Byte.MaxValue : (Byte)0; } }
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 static void SetBBGColor(GameObject geo) { BBGINFO bbginfo = battlebg.nf_GetBbgInfoPtr(); btl_util.GeoSetColor2Source(geo, bbginfo.chr_r, bbginfo.chr_g, bbginfo.chr_b); }
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; } }
public static void GeoAddColor2DrawPacket(GameObject go, Int16 r, Int16 g, Int16 b) { if (r < 0) { r = 0; } if (g < 0) { g = 0; } if (b < 0) { b = 0; } BBGINFO bbgInfoPtr = battlebg.nf_GetBbgInfoPtr(); r = (Int16)(bbgInfoPtr.chr_r + r); g = (Int16)(bbgInfoPtr.chr_g + g); b = (Int16)(bbgInfoPtr.chr_b + b); if (r > Byte.MaxValue) { r = Byte.MaxValue; } if (g > Byte.MaxValue) { g = Byte.MaxValue; } if (b > Byte.MaxValue) { b = Byte.MaxValue; } SkinnedMeshRenderer[] componentsInChildren1 = go.GetComponentsInChildren <SkinnedMeshRenderer>(); for (Int32 index = 0; index < componentsInChildren1.Length; ++index) { if (r == 0 && g == 0 && b == 0) { componentsInChildren1[index].tag = "RGBZero"; componentsInChildren1[index].enabled = false; } else { if (!componentsInChildren1[index].enabled && componentsInChildren1[index].CompareTag("RGBZero")) { componentsInChildren1[index].enabled = true; componentsInChildren1[index].tag = String.Empty; } componentsInChildren1[index].material.SetColor("_Color", new Color32((Byte)r, (Byte)g, (Byte)b, Byte.MaxValue)); } } MeshRenderer[] componentsInChildren2 = go.GetComponentsInChildren <MeshRenderer>(); for (Int32 index = 0; index < componentsInChildren2.Length; ++index) { if (r == 0 && g == 0 && b == 0) { componentsInChildren2[index].enabled = false; } else { componentsInChildren2[index].enabled = true; foreach (Material material in componentsInChildren2[index].materials) { material.SetColor("_Color", new Color32((Byte)r, (Byte)g, (Byte)b, Byte.MaxValue)); } } } }
public static void SetStatusVfx(BattleUnit unit) { BTL_DATA data = unit.Data; FF9StateBattleSystem ff9Battle = FF9StateSystem.Battle.FF9Battle; if (data.bi.disappear == 0 && !Status.checkCurStat(data, 1U)) { BBGINFO bbgInfoPtr = battlebg.nf_GetBbgInfoPtr(); if (Status.checkCurStat(data, 50333760U)) { if (!FF9StateSystem.Battle.isFade) { btl_util.GeoSetABR(data.gameObject, "PSX/BattleMap_StatusEffect"); } btl_util.GeoSetColor2DrawPacket(data.gameObject, data.add_col[0], data.add_col[1], data.add_col[2], Byte.MaxValue); if (data.weapon_geo) { btl_util.GeoSetColor2DrawPacket(data.weapon_geo, data.add_col[0], data.add_col[1], data.add_col[2], Byte.MaxValue); } } else if (Status.checkCurStat(data, 12582912U)) { if (!FF9StateSystem.Battle.isFade) { btl_util.GeoSetABR(data.gameObject, "PSX/BattleMap_StatusEffect"); } Byte num1 = (Byte)(ff9Battle.btl_cnt % 24); Int16 num2; Int16 num3; Int16 num4; if ((!Status.checkCurStat(data, 8388608U) || !Status.checkCurStat(data, 4194304U) ? (!Status.checkCurStat(data, 8388608U) ? 1 : 0) : (ff9Battle.btl_cnt % 48 >= 24 ? 1 : 0)) != 0) { num2 = (Int16)(bbgInfoPtr.chr_r - 64); num3 = (Int16)(bbgInfoPtr.chr_g - -24); num4 = (Int16)(bbgInfoPtr.chr_b - -72); } else { num2 = (Int16)(bbgInfoPtr.chr_r - -40); num3 = (Int16)(bbgInfoPtr.chr_g - -40); num4 = (Int16)(bbgInfoPtr.chr_b - 80); } Byte num5 = (Int32)num1 >= 8 ? ((Int32)num1 >= 16 ? (Byte)(24U - num1) : (Byte)8) : num1; Int16 r = (Int16)(num2 * num5 >> 3); Int16 g = (Int16)(num3 * num5 >> 3); Int16 b = (Int16)(num4 * num5 >> 3); GeoAddColor2DrawPacket(data.gameObject, r, g, b); if (data.weapon_geo) { GeoAddColor2DrawPacket(data.weapon_geo, r, g, b); } } else if (unit.IsUnderStatus(BattleStatus.Trance) && !unit.IsUnderStatus(BattleStatus.Death)) { if (btl_util.getSerialNumber(data) + 19 < btl_init.model_id.Length) { if (!FF9StateSystem.Battle.isFade) { btl_util.GeoSetABR(data.gameObject, "PSX/BattleMap_StatusEffect"); } Byte[][] numArray = new Byte[8][] { new Byte[3] { Byte.MaxValue, 96, 96 }, new Byte[3] { 104, 120, Byte.MaxValue }, new Byte[3] { Byte.MaxValue, 184, 120 }, new Byte[3] { 128, 192, 208 }, new Byte[3] { 192, 104, 144 }, new Byte[3] { 208, 112, 120 }, new Byte[3] { 200, 216, 104 }, new Byte[3] { 208, 184, 104 } }; Byte num1 = (Byte)(ff9Battle.btl_cnt % 16); Int16 num2 = (Int16)(bbgInfoPtr.chr_r - (128 - numArray[data.bi.slot_no][0])); Int16 num3 = (Int16)(bbgInfoPtr.chr_g - (128 - numArray[data.bi.slot_no][1])); Int16 num4 = (Int16)(bbgInfoPtr.chr_b - (128 - numArray[data.bi.slot_no][2])); Byte num5 = (Int32)num1 >= 8 ? (Byte)(16U - num1) : num1; GeoAddColor2DrawPacket(data.gameObject, (Int16)(num2 * num5 >> 3), (Int16)(num3 * num5 >> 3), (Int16)(num4 * num5 >> 3)); if (data.weapon_geo) { GeoAddColor2DrawPacket(data.weapon_geo, (Int16)(num2 * num5 >> 3), (Int16)(num3 * num5 >> 3), (Int16)(num4 * num5 >> 3)); } } } else { SetDefaultShader(data); } } else if (Status.checkCurStat(data, 1U)) { SetDefaultShader(data); SetStatusClut(data, true); } if (FF9StateSystem.Battle.isDebug && FF9StateSystem.Battle.isLevitate) { Vector3 pos = data.pos; if (data.bi.player != 0) { pos.y = -200 - (Int32)(30 * ff9.rsin((ff9Battle.btl_cnt & 15) << 8) / 4096f); pos.y *= -1f; } data.pos = pos; } if (CheckStatus(data, 2097152u)) { Single y = -200 - (Int32)(30 * ff9.rsin((ff9Battle.btl_cnt & 15) << 8) / 4096f); Vector3 vector = data.base_pos; vector.y = y; vector.y *= -1f; data.base_pos = vector; vector = data.pos; vector.y = y; vector.y *= -1f; data.pos = vector; } }