Example #1
0
    public static void SetBattleModel(BTL_DATA btl)
    {
        String text  = (btl.dms_geo_id == -1) ? String.Empty : FF9BattleDB.GEO.GetValue((Int32)btl.dms_geo_id);
        Int32  scale = 1;

        if (ModelFactory.HaveUpScaleModel(text))
        {
            scale = 4;
        }
        GEOTEXHEADER geotexheader = new GEOTEXHEADER();

        geotexheader.ReadPlayerTextureAnim(btl, "Models/GeoTexAnim/" + text + ".tab", scale);
        btl.texanimptr = geotexheader;
        Byte serialNumber = btl_util.getSerialNumber(btl);

        if ((Int32)(serialNumber + 19) >= (Int32)btl_init.model_id.Length)
        {
            return;
        }
        Int32        num           = (Int32)(serialNumber + 19);
        String       geoName       = btl_init.model_id[num];
        GEOTEXHEADER geotexheader2 = new GEOTEXHEADER();

        geotexheader2.ReadTrancePlayerTextureAnim(btl, geoName, scale);
        btl.tranceTexanimptr = geotexheader2;
    }
Example #2
0
    private IEnumerator WaitForRecreateRenderTexture(GEOTEXANIMHEADER texAnimHeader, GEOTEXHEADER texHeader, Int32 i)
    {
        this.SetDefaultTextures(texHeader, i);
        yield return(new WaitForEndOfFrame());

        this.SetBackRenderTexture(texHeader, i);
        GeoTexAnim.RecreateMultiTexAnim(texAnimHeader, texHeader, i);
        yield break;
    }
Example #3
0
    public static void geoTexAnimStop(GEOTEXHEADER tab, Int32 anum)
    {
        if (tab == null || tab.geotex == null)
        {
            return;
        }
        Byte             b = 3;
        GEOTEXANIMHEADER geotexanimheader = tab.geotex[anum];

        geotexanimheader.flags = (Byte)(geotexanimheader.flags & (Byte)(~b));
    }
Example #4
0
    public static void RecreateMultiTexAnim(GEOTEXANIMHEADER texAnimHeader, GEOTEXHEADER texHeader, Int32 i)
    {
        RenderTexture active = RenderTexture.active;

        RenderTexture.active = texHeader.RenderTexMapping[texHeader._mainTextureIndexs[i]];
        GL.PushMatrix();
        GL.Clear(true, true, Color.clear);
        GL.LoadPixelMatrix(0f, texHeader.RenderTexWidth, texHeader.RenderTexHeight, 0f);
        Graphics.DrawTexture(new Rect(0f, 0f, texHeader.RenderTexWidth, texHeader.RenderTexHeight), texHeader.TextureMapping[texHeader._mainTextureIndexs[i]]);
        GL.PopMatrix();
        RenderTexture.active = active;
    }
Example #5
0
    private static void MultiTexAnimService(GEOTEXANIMHEADER texAnimHeader, GEOTEXHEADER texHeader, Int32 i, Int16 framenum)
    {
        RenderTexture active = RenderTexture.active;

        RenderTexture.active = texHeader.RenderTexMapping[texHeader._mainTextureIndexs[i]];
        GL.PushMatrix();
        GL.LoadPixelMatrix(0f, texHeader.RenderTexWidth, texHeader.RenderTexHeight, 0f);
        Graphics.DrawTexture(new Rect(0f, 0f, texHeader.RenderTexWidth, texHeader.RenderTexHeight), texHeader.TextureMapping[texHeader._mainTextureIndexs[i]], GEOTEXANIMHEADER.texAnimMat);
        Graphics.DrawTexture(texAnimHeader.targetuv, texHeader.TextureMapping[texHeader._subTextureIndexs[i]], texAnimHeader.rectuvs[(Int32)framenum], 0, 0, 0, 0);
        GL.PopMatrix();
        RenderTexture.active = active;
    }
Example #6
0
    public static void geoTexAnimPlayOnce(GEOTEXHEADER tab, Int32 anum)
    {
        if (tab == null || tab.geotex == null)
        {
            return;
        }
        GEOTEXANIMHEADER geotexanimheader = tab.geotex[anum];

        geotexanimheader.flags     = (Byte)(geotexanimheader.flags | 3);
        tab.geotex[anum].frame     = 0;
        tab.geotex[anum].lastframe = 4096;
    }
Example #7
0
    public static void geoBGTexAnimPlay(GEOTEXHEADER tab, Int32 anum)
    {
        if (tab.geotex[anum].numframes == 0)
        {
            tab.TexAnimTextures[anum].wrapMode = TextureWrapMode.Repeat;
            if (battlebg.nf_BbgNumber == 57)
            {
                tab.extraTexAnimTrTextures[anum].wrapMode = TextureWrapMode.Repeat;
            }
        }
        GEOTEXANIMHEADER geotexanimheader = tab.geotex[anum];

        geotexanimheader.flags     = (Byte)(geotexanimheader.flags | 1);
        tab.geotex[anum].frame     = 0;
        tab.geotex[anum].lastframe = 4096;
    }
Example #8
0
 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);
         }
     }
 }
Example #9
0
 public void CheckRenderTexture(GEOTEXHEADER texHeader)
 {
     if (texHeader == null)
     {
         return;
     }
     for (Int32 i = 0; i < (Int32)texHeader.count; i++)
     {
         RenderTexture renderTexture = texHeader.RenderTexMapping[texHeader._mainTextureIndexs[i]];
         if (!renderTexture.IsCreated())
         {
             if (texHeader.geotex != null)
             {
                 GEOTEXANIMHEADER texAnimHeader = texHeader.geotex[i];
                 base.StartCoroutine(this.WaitForRecreateRenderTexture(texAnimHeader, texHeader, i));
             }
         }
     }
 }
Example #10
0
    public static void geoBGTexAnimService(GEOTEXHEADER texheaderptr)
    {
        UInt16 count = texheaderptr.count;

        GEOTEXANIMHEADER[] geotex = texheaderptr.geotex;
        for (Int32 i = 0; i < (Int32)count; i++)
        {
            GEOTEXANIMHEADER geotexanimheader = geotex[i];
            if ((geotexanimheader.flags & 1) != 0)
            {
                if (geotexanimheader.numframes != 0)
                {
                    Int32 num       = geotexanimheader.frame;
                    Int16 lastframe = geotexanimheader.lastframe;
                    Int16 num2      = (Int16)(num >> 12);
                    if (num2 >= 0)
                    {
                        if (geotexanimheader.numframes <= 0)
                        {
                            goto IL_2C3;
                        }
                        if (num2 != lastframe)
                        {
                            for (Int32 j = 0; j < (Int32)geotexanimheader.count; j++)
                            {
                                Single x    = (geotexanimheader.coords[(Int32)num2].x - geotexanimheader.target.x) / (Single)texheaderptr.TexAnimTextures[j].width;
                                Single num3 = (geotexanimheader.coords[(Int32)num2].y - geotexanimheader.target.y) / (Single)texheaderptr.TexAnimTextures[j].height;
                                texheaderptr.texAnimMaterials[i].SetTextureOffset("_MainTex", new Vector2(x, -num3));
                            }
                            geotexanimheader.lastframe = num2;
                        }
                        Int16 rate = geotexanimheader.rate;
                        num += (Int32)rate;
                    }
                    else
                    {
                        num += 4096;
                    }
                    if (num >> 12 < (Int32)geotexanimheader.numframes)
                    {
                        geotexanimheader.frame = num;
                    }
                    else if (geotexanimheader.randrange > 0)
                    {
                        UInt32 num4 = battlebg.geoBGTexAnimRandom((UInt32)geotexanimheader.randmin, (UInt32)geotexanimheader.randrange);
                        geotexanimheader.frame = (Int32)(-(Int32)((UInt64)((UInt64)num4 << 12)));
                    }
                    else if ((geotexanimheader.flags & 2) != 0)
                    {
                        Byte             b = 3;
                        GEOTEXANIMHEADER geotexanimheader2 = geotexanimheader;
                        geotexanimheader2.flags = (Byte)(geotexanimheader2.flags & (Byte)(~b));
                    }
                    else
                    {
                        geotexanimheader.frame = 0;
                    }
                }
                else if ((geotexanimheader.flags & 4) != 0)
                {
                    Int32 num  = geotexanimheader.frame;
                    Int16 num2 = (Int16)(num >> 12);
                    for (Int32 k = 0; k < (Int32)geotexanimheader.count; k++)
                    {
                        Int32  num5   = 0;
                        Int32  height = texheaderptr.TexAnimTextures[k].height;
                        Single num6   = (Single)num2 / (Single)height;
                        if (battlebg.nf_BbgNumber == 69 && i == 3)
                        {
                            num6 *= -1f;
                        }
                        texheaderptr.texAnimMaterials[i].SetTextureOffset("_MainTex", new Vector2((Single)num5, -num6));
                        if (battlebg.nf_BbgNumber == 57)
                        {
                            texheaderptr.extraTexAimMaterials[i].SetTextureOffset("_MainTex", new Vector2((Single)num5, -num6));
                        }
                        else if (battlebg.nf_BbgNumber == 71 && k == 0)
                        {
                            texheaderptr.extraTexAimMaterials[i].SetTextureOffset("_MainTex", new Vector2((Single)num5, -num6));
                        }
                    }
                    Int16 rate = geotexanimheader.rate;
                    geotexanimheader.frame += (Int32)rate;
                }
            }
            IL_2C3 :;
        }
    }
Example #11
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;
    }
Example #12
0
    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;
        }
    }
Example #13
0
 private void SetBackRenderTexture(GEOTEXHEADER texHeader, Int32 i)
 {
     texHeader._smrs[texHeader._mainTextureIndexs[i]].material.mainTexture = texHeader.RenderTexMapping[texHeader._mainTextureIndexs[i]];
 }
Example #14
0
 private void SetDefaultTextures(GEOTEXHEADER texHeader, Int32 i)
 {
     texHeader._smrs[texHeader._mainTextureIndexs[i]].material.mainTexture = texHeader.TextureMapping[texHeader._mainTextureIndexs[i]];
     texHeader._smrs[texHeader._subTextureIndexs[i]].material.mainTexture  = texHeader.TextureMapping[texHeader._subTextureIndexs[i]];
 }
Example #15
0
 public static void geoTexAnimService(GEOTEXHEADER texHeader)
 {
     if (texHeader == null)
     {
         return;
     }
     for (Int32 i = 0; i < (Int32)texHeader.count; i++)
     {
         GEOTEXANIMHEADER geotexanimheader = texHeader.geotex[i];
         if ((geotexanimheader.flags & 1) != 0)
         {
             if (geotexanimheader.numframes != 0)
             {
                 Int32 num       = geotexanimheader.frame;
                 Int16 lastframe = geotexanimheader.lastframe;
                 Int16 num2      = (Int16)(num >> 12);
                 if (num2 >= 0)
                 {
                     if (num2 != lastframe)
                     {
                         for (Int32 j = 0; j < (Int32)geotexanimheader.count; j++)
                         {
                             if (texHeader.geotex != null)
                             {
                                 GeoTexAnim.MultiTexAnimService(geotexanimheader, texHeader, i, num2);
                             }
                         }
                         geotexanimheader.lastframe = num2;
                     }
                     Int16 rate = geotexanimheader.rate;
                     num += (Int32)rate;
                 }
                 else
                 {
                     num += 4096;
                 }
                 if (num >> 12 < (Int32)geotexanimheader.numframes)
                 {
                     geotexanimheader.frame = num;
                 }
                 else if (geotexanimheader.randrange > 0)
                 {
                     UInt32 num3 = (UInt32)UnityEngine.Random.Range((Int32)geotexanimheader.randmin, (Int32)(geotexanimheader.randrange + 1));
                     geotexanimheader.frame = (Int32)(-(Int32)((UInt64)((UInt64)num3 << 12)));
                 }
                 else if ((geotexanimheader.flags & 2) != 0)
                 {
                     Byte             b = 3;
                     GEOTEXANIMHEADER geotexanimheader2 = geotexanimheader;
                     geotexanimheader2.flags = (Byte)(geotexanimheader2.flags & (Byte)(~b));
                 }
                 else
                 {
                     geotexanimheader.frame = 0;
                 }
             }
             else if ((geotexanimheader.flags & 4) != 0)
             {
                 global::Debug.Log("SCROLL!!!");
             }
         }
     }
 }