Пример #1
0
    public static void FF9ShadowOffField(Int32 uid)
    {
        FF9Char ff9Char = FF9StateSystem.Common.FF9.FF9GetCharPtr(uid);

        ff9Char.attr |= 16u;
        FF9StateSystem.Field.FF9Field.loc.map.shadowArray[uid].needUpdate = true;
    }
Пример #2
0
    public static void FF9ShadowOnField(Int32 uid)
    {
        FF9Char ff9Char = FF9StateSystem.Common.FF9.FF9GetCharPtr(uid);

        ff9Char.attr = (UInt32)((UInt64)ff9Char.attr & 18446744073709551599UL);
        FF9StateSystem.Field.FF9Field.loc.map.shadowArray[uid].needUpdate = true;
    }
Пример #3
0
    public static void InitBattleData(BTL_DATA btl, FF9Char ff9char)
    {
        BTL_INFO bi = btl.bi;

        btl_cmd.InitCommand(btl);
        btl_stat.InitStatus(btl);
        bi.dmg_mot_f = 0;
        bi.cmd_idle  = 0;
        bi.death_f   = 0;
        bi.stop_anim = 0;
        btl.SetDisappear(0);
        bi.shadow         = 1;
        bi.cover          = 0;
        bi.dodge          = 0;
        bi.die_snd_f      = 0;
        bi.select         = 0;
        btl.escape_key    = 0;
        btl.sel_menu      = 0;
        btl.fig_info      = 0;
        btl.fig           = 0;
        btl.m_fig         = 0;
        btl.fig_stat_info = 0;
        btl.fig_regene_hp = 0;
        btl.fig_poison_hp = 0;
        btl.fig_poison_mp = 0;
        btl.die_seq       = 0;
        ff9char.btl       = btl;
        btl.evt           = ff9char.evt;
        GeoTexAnim.geoTexAnimPlay(btl.texanimptr, 2);
        btl_util.GeoSetColor2Source(btl.gameObject, 0, 0, 0);
        btl.mesh_current = 0;
    }
Пример #4
0
    public static void FF9ShadowLockYRotField(Int32 uid, Single rotY)
    {
        FF9Char ff9Char = FF9StateSystem.Common.FF9.FF9GetCharPtr(uid);

        ff9Char.attr |= 32u;
        FF9StateSystem.Field.FF9Field.loc.map.shadowArray[uid].yRot       = rotY;
        FF9StateSystem.Field.FF9Field.loc.map.shadowArray[uid].needUpdate = true;
    }
Пример #5
0
    public static void FF9ShadowOnBattle(Int32 uid)
    {
        FF9Char ff9Char = FF9StateSystem.Common.FF9.FF9GetCharPtr(uid);

        ff9Char.attr = (UInt32)((UInt64)ff9Char.attr & 18446744073709551599UL);
        GameObject[] shadowArray = FF9StateSystem.Battle.FF9Battle.map.shadowArray;
        MeshRenderer component   = shadowArray[uid].GetComponent <MeshRenderer>();

        component.enabled = true;
    }
Пример #6
0
        private static void CreateCharacter(Actor actor)
        {
            FF9Char character = new FF9Char
            {
                geo = actor.go,
                evt = actor
            };

            FF9StateSystem.Common.FF9.charArray.Add(actor.uid, character);
        }
Пример #7
0
    public static void FF9ShadowOffBattle(Int32 uid)
    {
        FF9Char ff9Char = FF9StateSystem.Common.FF9.FF9GetCharPtr(uid);

        ff9Char.attr |= 16u;
        GameObject[] shadowArray = FF9StateSystem.Battle.FF9Battle.map.shadowArray;
        MeshRenderer component   = shadowArray[uid].GetComponent <MeshRenderer>();

        component.enabled = false;
    }
Пример #8
0
 private static Int32 ff9fieldMCFSetCharColor(FF9Char CharPtr, Int32 ClrR, Int32 ClrG, Int32 ClrB)
 {
     if (FF9Char.ff9charptr_attr_test(CharPtr, 2048) == 0)
     {
         FF9FieldCharState ff9FieldCharState = FF9StateSystem.Field.FF9Field.loc.map.charStateArray[(Int32)CharPtr.evt.uid];
         FF9FieldCharColor ff9FieldCharColor = default(FF9FieldCharColor);
         ff9FieldCharColor.r      = (Byte)ClrR;
         ff9FieldCharColor.g      = (Byte)ClrG;
         ff9FieldCharColor.b      = (Byte)ClrB;
         ff9FieldCharColor.active = true;
         ff9FieldCharState.clr[0] = (ff9FieldCharState.clr[1] = ff9FieldCharColor);
         FF9Char.ff9charptr_attr_set(CharPtr, 1024);
         FF9Char.ff9charptr_attr_set(CharPtr, 2048);
         return(1);
     }
     FF9Char.ff9charptr_attr_clear(CharPtr, 2048);
     return(0);
 }
Пример #9
0
    public static void ff9fieldCharEffectService()
    {
        Dictionary <Int32, FF9Char>           charArray      = FF9StateSystem.Common.FF9.charArray;
        Dictionary <Int32, FF9FieldCharState> charStateArray = FF9StateSystem.Field.FF9Field.loc.map.charStateArray;

        if (charArray == null)
        {
            return;
        }
        List <Int32> list = new List <Int32>(charArray.Keys);

        foreach (Int32 key in list)
        {
            if (charArray.ContainsKey(key))
            {
                FF9Char ff9Char = charArray[key];
                if (charStateArray.ContainsKey(key))
                {
                    FF9FieldCharState ff9FieldCharState = charStateArray[key];
                    UInt32            num  = (UInt32)(ff9Char.attr & 65536u);
                    Int32             num2 = (Int32)((UInt64)(ff9FieldCharState.attr & 65536u) ^ (UInt64)((Int64)num));
                    Int32             num3 = FF9Char.ff9charptr_attr_test(ff9Char, 262144);
                    Int32             num4 = FF9Char.ff9charptr_attr_test(ff9Char, 131072);
                    Boolean           flag = num2 != 0 || num3 != 0 || num4 != 0;
                    if (ff9Char.geo)
                    {
                        Renderer[] componentsInChildren = ff9Char.geo.GetComponentsInChildren <Renderer>();
                        if (flag)
                        {
                            if (FF9Char.ff9charptr_attr_test(ff9Char, 65536) != 0)
                            {
                                Shader     shader = ShadersLoader.Find("PSX/Actor_Abr_" + ff9FieldCharState.arate);
                                Renderer[] array  = componentsInChildren;
                                for (Int32 i = 0; i < (Int32)array.Length; i++)
                                {
                                    Renderer   renderer  = array[i];
                                    Material[] materials = renderer.materials;
                                    for (Int32 j = 0; j < (Int32)materials.Length; j++)
                                    {
                                        Material material = materials[j];
                                        material.shader = shader;
                                    }
                                }
                            }
                            else
                            {
                                Shader shader2 = ShadersLoader.Find("PSX/FieldMapActor");

                                Renderer[] array2 = componentsInChildren;
                                for (Int32 k = 0; k < (Int32)array2.Length; k++)
                                {
                                    Renderer renderer2 = array2[k];
                                    renderer2.material.shader = shader2;
                                }
                            }
                            if (FF9Char.ff9charptr_attr_test(ff9Char, 131072) != 0)
                            {
                                FF9Char.ff9charptr_attr_clear(ff9Char, 131072);
                            }
                            FF9Char.ff9charptr_attr_clear(ff9Char, 262144);
                            if (num2 != 0 || num3 != 0)
                            {
                                FF9Char.ff9charptr_attr_set(ff9Char, 131072);
                            }
                            ff9FieldCharState.attr = (ff9FieldCharState.attr & 0xFFFEFFFF) | num;
                        }
                        FF9FieldCharColor ff9FieldCharColor = ff9FieldCharState.clr[0];
                        if (ff9FieldCharColor.active && !FF9StateSystem.Field.isDebugWalkMesh && (Int32)componentsInChildren.Length > 0)
                        {
                            Renderer[] array3 = componentsInChildren;
                            for (Int32 l = 0; l < (Int32)array3.Length; l++)
                            {
                                Renderer   renderer3  = array3[l];
                                Material[] materials2 = renderer3.materials;
                                for (Int32 m = 0; m < (Int32)materials2.Length; m++)
                                {
                                    Material material2 = materials2[m];
                                    Color32  c         = renderer3.material.GetColor("_Color");
                                    c.r = ff9FieldCharColor.r;
                                    c.g = ff9FieldCharColor.g;
                                    c.b = ff9FieldCharColor.b;
                                    material2.SetColor("_Color", c);
                                    ff9FieldCharState.clr[0] = ff9FieldCharState.clr[1];
                                }
                            }
                            ff9FieldCharState.clr[1] = default(FF9FieldCharColor);
                        }
                        FF9FieldCharMirror mirror = ff9FieldCharState.mirror;
                        if (mirror != null && FF9Char.ff9charptr_attr_test(mirror.chr, 16777216) != 0)
                        {
                            FF9Char chr    = mirror.chr;
                            Vector3 vector = mirror.point + ff9Char.geo.transform.localPosition;
                            vector   += mirror.point;
                            vector.y *= -1f;
                            mirror.geo.transform.position    = vector;
                            mirror.geo.transform.eulerAngles = ff9Char.geo.transform.eulerAngles;
                            Animation component  = ff9Char.geo.GetComponent <Animation>();
                            Animation component2 = mirror.geo.GetComponent <Animation>();
                            String    text       = FF9DBAll.AnimationDB.GetValue((Int32)ff9Char.evt.anim);
                            if (component2.GetClip(text) == (UnityEngine.Object)null)
                            {
                                AnimationClip clip = component.GetClip(text);
                                component2.AddClip(clip, text);
                            }
                            component2.Play(text);
                            component2[text].speed = 0f;
                            component2[text].time  = component[text].time;
                            component2.Sample();
                            Renderer[] componentsInChildren2 = mirror.geo.GetComponentsInChildren <Renderer>();
                            if (mirror.clr[3] != 0)
                            {
                                Color32 c2 = default(Color32);
                                c2.r = mirror.clr[0];
                                c2.g = mirror.clr[1];
                                c2.b = mirror.clr[2];
                                Renderer[] array4 = componentsInChildren2;
                                for (Int32 n = 0; n < (Int32)array4.Length; n++)
                                {
                                    Renderer renderer4 = array4[n];
                                    renderer4.material.SetColor("_Color", c2);
                                }
                                Byte[] clr  = mirror.clr;
                                Int32  num5 = 3;
                                clr[num5] = (Byte)(clr[num5] - 1);
                            }
                        }
                    }
                }
            }
        }
    }
Пример #10
0
    public static void FF9ShadowUnlockYRotField(Int32 uid)
    {
        FF9Char ff9Char = FF9StateSystem.Common.FF9.FF9GetCharPtr(uid);

        ff9Char.attr = (UInt32)((UInt64)ff9Char.attr & 18446744073709551583UL);
    }
Пример #11
0
    public static void OrganizePlayerData(PLAYER p, BTL_DATA btl, UInt16 cnt, UInt16 btl_no)
    {
        btl.btl_id = (UInt16)(1 << (Int32)btl_no);
        BONUS btl_bonus = battle.btl_bonus;

        btl_bonus.member_flag = (Byte)(btl_bonus.member_flag | (Byte)(1 << (Int32)cnt));
        btl.bi.player         = 1;
        btl.bi.slot_no        = p.info.slot_no;
        btl.bi.target         = 1;
        btl.bi.line_no        = (Byte)cnt;
        btl.bi.slave          = 0;
        if (battle.TRANCE_GAUGE_FLAG == 0 || (p.category & 16) != 0 || (btl.bi.slot_no == 2 && battle.GARNET_DEPRESS_FLAG != 0))
        {
            btl.bi.t_gauge = 0;
            btl.trance     = 0;
        }
        else
        {
            btl.bi.t_gauge = 1;
            btl.trance     = p.trance;
        }
        btl.tar_bone = 0;
        btl.sa       = p.sa;
        btl.elem.dex = p.elem.dex;
        btl.elem.str = p.elem.str;
        btl.elem.mgc = p.elem.mgc;
        btl.elem.wpr = p.elem.wpr;
        btl.level    = p.level;
        btl.max      = p.max;
        btl_init.CopyPoints(btl.cur, p.cur);
        Byte    serial_no = p.info.serial_no;
        FF9Char ff9Char   = new FF9Char();

        ff9Char.btl = btl;
        ff9Char.evt = btl.evt;
        FF9StateSystem.Common.FF9.charArray.Add((Int32)p.info.slot_no, ff9Char);
        btl_init.InitBattleData(btl, ff9Char);
        btl.mesh_banish = UInt16.MaxValue;
        btl_stat.InitCountDownStatus(btl);
        btl.max.at = (Int16)((60 - btl.elem.dex) * 40 << 2);
        btl_para.InitATB(btl);
        if (FF9StateSystem.Battle.FF9Battle.btl_scene.Info.StartType == 0)
        {
            btl.cur.at = 0;
        }
        else if (FF9StateSystem.Battle.FF9Battle.btl_scene.Info.StartType == 1)
        {
            btl.cur.at = (Int16)(btl.max.at - 1);
        }
        else
        {
            btl.cur.at = (Int16)(Comn.random16() % (Int32)btl.max.at);
        }
        btl_mot.SetPlayerDefMotion(btl, (UInt32)p.info.serial_no, (UInt32)btl_no);
        BattlePlayerCharacter.InitAnimation(btl);
        btl_eqp.InitWeapon(p, btl);
        btl.defence.PhisicalDefence = p.defence.PhisicalDefence;
        btl.defence.PhisicalEvade   = p.defence.PhisicalEvade;
        btl.defence.MagicalDefence  = p.defence.MagicalDefence;
        btl.defence.MagicalEvade    = p.defence.MagicalEvade;
        btl_eqp.InitEquipPrivilegeAttrib(p, btl);
        btl_util.GeoSetColor2Source(btl.weapon_geo, 0, 0, 0);
        if (btl.cur.hp * 6 < btl.max.hp)
        {
            btl.stat.cur |= 512u;
        }
        btl_stat.AlterStatuses(btl, (UInt32)p.status & 4294967294u);
        if ((p.status & 1) != 0)
        {
            btl_stat.AlterStatus(btl, 1u);
        }
        btl_abil.CheckStatusAbility(btl);
        btl.base_pos = btl.evt.posBattle;
        Int16 geoID = btl.dms_geo_id;

        btl.height = 0;
        btl.radius = 0;

        FF9BattleDBHeightAndRadius.TryFindHeightAndRadius(geoID, ref btl.height, ref btl.radius);

        if (btl.cur.hp == 0 && btl_stat.AlterStatus(btl, 256u) == 2u)
        {
            btl.die_seq = 5;
            btl_mot.DecidePlayerDieSequence(btl);
            return;
        }
        btl.bi.def_idle = Convert.ToByte(btl_stat.CheckStatus(btl, 197122u));
        btl_mot.setMotion(btl, btl.bi.def_idle);
        btl.evt.animFrame = 0;
    }
Пример #12
0
    public static void InitEnemyData(FF9StateBattleSystem btlsys)
    {
        BTL_DATA btl_DATA = (BTL_DATA)null;
        ObjList  objList  = new ObjList();

        if (!FF9StateSystem.Battle.isDebug)
        {
            objList = PersistenSingleton <EventEngine> .Instance.GetActiveObjList().next;
        }
        Int32 monCount = (Int32)FF9StateSystem.Battle.FF9Battle.btl_scene.PatAddr[(Int32)FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum].MonCount;
        Int32 i        = 0;
        Int32 j        = 4;

        while (i < monCount)
        {
            ENEMY    enemy     = btlsys.enemy[i];
            BTL_DATA btl_DATA2 = btlsys.btl_data[j];
            enemy.info.die_fade_rate = 32;
            if ((btl_DATA2.dms_geo_id = BTL_SCENE.GetMonGeoID(i)) < 0)
            {
                enemy.info.slave = 1;
            }
            else
            {
                btl_init.SetBattleModel(btl_DATA2);
                enemy.info.slave = 0;
                if (!FF9StateSystem.Battle.isDebug)
                {
                    objList = objList.next;
                }
            }
            btl_DATA2.btl_id     = (UInt16)(16 << i);
            btl_DATA2.bi.player  = 0;
            btl_DATA2.bi.slot_no = (Byte)i;
            btl_DATA2.bi.line_no = (Byte)(4 + i);
            btl_DATA2.bi.t_gauge = 0;
            btl_DATA2.bi.slave   = enemy.info.slave;
            BTL_SCENE    btl_scene    = FF9StateSystem.Battle.FF9Battle.btl_scene;
            SB2_PATTERN  sb2_PATTERN  = btl_scene.PatAddr[(Int32)FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum];
            SB2_MON_PARM sb2_MON_PARM = btl_scene.MonAddr[(Int32)sb2_PATTERN.Put[i].TypeNo];
            UInt16       geoID        = sb2_MON_PARM.Geo;
            btl_DATA2.height = 0;
            btl_DATA2.radius = 0;
            FF9Char ff9char = new FF9Char();
            btl_init.InitBattleData(btl_DATA2, ff9char);
            btl_DATA2.bi.def_idle = 0;
            btl_DATA2.base_pos    = enemy.base_pos;
            String path = (btl_DATA2.dms_geo_id == -1) ? String.Empty : FF9BattleDB.GEO.GetValue((Int32)btl_DATA2.dms_geo_id);
            if (!ModelFactory.IsUseAsEnemyCharacter(path))
            {
                btl_DATA2.weapon_geo = (GameObject)null;
            }
            btl_DATA2.sa = btl_init.enemy_dummy_sa;

            FF9BattleDBHeightAndRadius.TryFindHeightAndRadius(geoID, ref btl_DATA2.height, ref btl_DATA2.radius);

            if (btl_DATA != null)
            {
                btl_DATA.next = btl_DATA2;
            }
            btl_DATA = btl_DATA2;
            i++;
            j++;
        }
        while (j < 8)
        {
            btlsys.btl_data[j].btl_id = 0;
            j++;
        }
        btl_DATA.next          = (BTL_DATA)null;
        btlsys.btl_list.next   = btlsys.btl_data[4];
        btlsys.btl_load_status = (Byte)(btlsys.btl_load_status | 8);
        btl_init.SetupBattleEnemy();
        btlseq.InitSequencer();
    }
Пример #13
0
 public static void ff9charptr_attr_set(FF9Char ff9char, Int32 attr)
 {
     ff9char.attr |= (UInt32)attr;
 }
Пример #14
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);
                    }
                }
            }
        }
    }
Пример #15
0
    public static Int32 FF9FieldMCFSetCharColor(Int32 uid, Int32 ClrR, Int32 ClrG, Int32 ClrB)
    {
        FF9Char charPtr = FF9StateSystem.Common.FF9.charArray[uid];

        return(fldmcf.ff9fieldMCFSetCharColor(charPtr, ClrR, ClrG, ClrB));
    }
Пример #16
0
    public static void ff9char_attr_clear(Int32 charuid, Int32 attr)
    {
        FF9Char ff9char = FF9StateSystem.Common.FF9.charArray[charuid];

        FF9Char.ff9charptr_attr_clear(ff9char, attr);
    }
Пример #17
0
 public static void ff9charptr_attr_clear(FF9Char ff9char, Int32 attr)
 {
     ff9char.attr = (UInt32)((UInt64)ff9char.attr & (UInt64)((Int64)(~(Int64)attr)));
 }
Пример #18
0
    public static void FF9FieldCharDispatch(Int32 uid, Int32 Parm, Int32 Arg1, Int32 Arg2, Int32 Arg3)
    {
        FF9FieldCharState ff9FieldCharState = FF9StateSystem.Field.FF9Field.loc.map.charStateArray[uid];
        FF9Char           ff9Char           = FF9StateSystem.Common.FF9.charArray[uid];

        switch (Parm)
        {
        case 0:
            if ((Arg1 & 255) == 255)
            {
                ff9Char.attr = (UInt32)((UInt64)ff9Char.attr & 18446744073709486079UL);
            }
            else
            {
                if (Arg1 != (Int32)ff9FieldCharState.arate)
                {
                    ff9Char.attr |= 262144u;
                }
                ff9Char.attr |= 65536u;
            }
            ff9FieldCharState.arate = (SByte)Arg1;
            break;

        case 4:
            if (Arg1 != 0)
            {
                fldchar.geoSlice(ff9Char.geo, Arg2);
                ff9Char.attr |= 1048576u;
            }
            else
            {
                ff9Char.attr = (UInt32)((UInt64)ff9Char.attr & 18446744073708503039UL);
            }
            break;

        case 8:
        case 9:
        case 10:
        case 11:
        {
            FF9FieldCharMirror ff9FieldCharMirror = ff9FieldCharState.mirror;
            FF9Char            ff9Char2;
            if (ff9FieldCharMirror == null)
            {
                ff9FieldCharMirror          = (ff9FieldCharState.mirror = new FF9FieldCharMirror());
                ff9Char2                    = (ff9FieldCharMirror.chr = ff9Char);
                ff9Char2.attr               = 0u;
                ff9FieldCharMirror.geo      = ModelFactory.CreateModel(FF9BattleDB.GEO.GetValue((Int32)ff9Char.evt.model), false);
                ff9FieldCharMirror.geo.name = ff9Char.geo.name + "_mirror";
                Shader     shader = ShadersLoader.Find("PSX/FieldMapActor");
                Renderer[] componentsInChildren = ff9FieldCharMirror.geo.GetComponentsInChildren <Renderer>();
                Renderer[] array = componentsInChildren;
                for (Int32 i = 0; i < (Int32)array.Length; i++)
                {
                    Renderer renderer = array[i];
                    renderer.material.shader = shader;
                    renderer.material.SetColor("_Color", new Color(0.5f, 0.5f, 0.5f));
                    if (FF9StateSystem.Common.FF9.fldMapNo == 2653 || FF9StateSystem.Common.FF9.fldMapNo == 2654)
                    {
                        renderer.material.renderQueue = 2000;
                    }
                }
                ff9FieldCharMirror.geo.transform.SetParent(ff9Char.geo.transform.transform.parent);
                ff9FieldCharMirror.evt = ff9Char.evt;
                ff9FieldCharMirror.geo.transform.localScale       = new Vector3(-1f, 1f, 1f);
                ff9FieldCharMirror.geo.transform.localEulerAngles = Vector3.zero;
                ff9FieldCharMirror.geo.transform.localPosition    = Vector3.zero;
                ff9FieldCharMirror.actor = ff9FieldCharMirror.geo.AddComponent <FieldMapActor>();
                ff9FieldCharMirror.actor.meshRenderer = ff9FieldCharMirror.geo.GetComponentsInChildren <Renderer>();
                ff9FieldCharMirror.parent             = ff9Char;
                ff9FieldCharMirror.point  = Vector3.zero;
                ff9FieldCharMirror.normal = Vector3.zero;
                ff9FieldCharMirror.clr[0] = 0;
            }
            ff9Char2 = ff9FieldCharMirror.chr;
            if (FF9Char.ff9charptr_attr_test(ff9FieldCharMirror.chr, 1) == 0)
            {
                ff9Char2.evt = ff9Char.evt;
                FF9Char.ff9charptr_attr_set(ff9FieldCharMirror.chr, 33554433);
            }
            switch (Parm)
            {
            case 8:
                if (Arg1 != 0)
                {
                    FF9Char.ff9charptr_attr_set(ff9FieldCharMirror.chr, 16777216);
                    ff9FieldCharMirror.geo.SetActive(true);
                }
                else
                {
                    FF9Char.ff9charptr_attr_clear(ff9FieldCharMirror.chr, 16777216);
                    ff9FieldCharMirror.geo.SetActive(false);
                }
                break;

            case 9:
                ff9FieldCharMirror.point = new Vector3((Single)Arg1, (Single)Arg2, (Single)Arg3);
                break;

            case 10:
                ff9FieldCharMirror.normal = new Vector3((Single)(Arg1 >> 12), (Single)(Arg2 >> 12), (Single)(Arg3 >> 12));
                break;

            case 11:
                ff9FieldCharMirror.clr[0] = (Byte)Arg1;
                ff9FieldCharMirror.clr[1] = (Byte)Arg2;
                ff9FieldCharMirror.clr[2] = (Byte)Arg3;
                ff9FieldCharMirror.clr[3] = 2;
                break;
            }
            break;
        }

        case 16:
        case 17:
        case 18:
        case 19:
        {
            FF9FieldCharSound ff9FieldCharSound;
            if ((ff9FieldCharSound = FF9Snd.ff9fieldSoundGetChar(ff9Char, Arg1, Arg2)) == null && Parm != 19)
            {
                ff9FieldCharSound = FF9Snd.ff9fieldSoundNewChar(ff9Char, Arg1, Arg2);
            }
            switch (Parm)
            {
            case 16:
                ff9FieldCharSound.sndEffectID[0] = (UInt16)Arg3;
                break;

            case 17:
                ff9FieldCharSound.sndEffectID[1] = (UInt16)Arg3;
                break;

            case 18:
                ff9FieldCharSound.pitchRand = (SByte)((Arg3 == 0) ? 0 : 1);
                break;

            case 19:
                FF9Snd.ff9fieldSoundDeleteChar(ff9Char, Arg1, Arg2);
                break;
            }
            break;
        }
        }
    }
Пример #19
0
    public static void OrganizePlayerData(PLAYER p, BTL_DATA btl, UInt16 cnt, UInt16 btl_no)
    {
        btl.btl_id = (UInt16)(1 << btl_no);
        BONUS btl_bonus = battle.btl_bonus;

        btl_bonus.member_flag = (Byte)(btl_bonus.member_flag | (Byte)(1 << cnt));
        btl.bi.player         = 1;
        btl.bi.slot_no        = p.info.slot_no;
        btl.bi.target         = 1;
        btl.bi.line_no        = (Byte)cnt;
        btl.bi.slave          = 0;
        if (battle.TRANCE_GAUGE_FLAG == 0 || (p.category & 16) != 0 || (btl.bi.slot_no == 2 && battle.GARNET_DEPRESS_FLAG != 0))
        {
            btl.bi.t_gauge = 0;
            btl.trance     = 0;
        }
        else
        {
            btl.bi.t_gauge = 1;
            btl.trance     = p.trance;
        }
        btl.tar_bone = 0;
        btl.sa       = p.sa;
        btl.elem.dex = p.elem.dex;
        btl.elem.str = p.elem.str;
        btl.elem.mgc = p.elem.mgc;
        btl.elem.wpr = p.elem.wpr;
        btl.level    = p.level;
        btl.max      = p.max;
        btl_init.CopyPoints(btl.cur, p.cur);
        Byte    serial_no = p.info.serial_no;
        FF9Char ff9Char   = new FF9Char();

        ff9Char.btl = btl;
        ff9Char.evt = btl.evt;
        FF9StateSystem.Common.FF9.charArray.Add(p.info.slot_no, ff9Char);
        btl_init.InitBattleData(btl, ff9Char);
        btl.mesh_banish = UInt16.MaxValue;
        btl_stat.InitCountDownStatus(btl);
        btl.max.at = (Int16)((60 - btl.elem.dex) * 40 << 2);
        btl_para.InitATB(btl);
        if (FF9StateSystem.Battle.FF9Battle.btl_scene.Info.StartType == 0)
        {
            btl.cur.at = 0;
        }
        else if (FF9StateSystem.Battle.FF9Battle.btl_scene.Info.StartType == 1)
        {
            btl.cur.at = (Int16)(btl.max.at - 1);
        }
        else
        {
            btl.cur.at = (Int16)(Comn.random16() % btl.max.at);
        }
        btl_mot.SetPlayerDefMotion(btl, p.info.serial_no, btl_no);
        BattlePlayerCharacter.InitAnimation(btl);
        btl_eqp.InitWeapon(p, btl);
        btl.defence.PhisicalDefence = p.defence.PhisicalDefence;
        btl.defence.PhisicalEvade   = p.defence.PhisicalEvade;
        btl.defence.MagicalDefence  = p.defence.MagicalDefence;
        btl.defence.MagicalEvade    = p.defence.MagicalEvade;
        btl_eqp.InitEquipPrivilegeAttrib(p, btl);
        btl_util.GeoSetColor2Source(btl.weapon_geo, 0, 0, 0);
        if (btl.cur.hp * 6 < btl.max.hp)
        {
            btl.stat.cur |= BattleStatus.LowHP;
        }

        btl_stat.AlterStatuses(btl, (BattleStatus)p.status & (BattleStatus.Venom | BattleStatus.Virus | BattleStatus.Silence | BattleStatus.Blind | BattleStatus.Trouble | BattleStatus.Zombie | BattleStatus.EasyKill | BattleStatus.Death | BattleStatus.LowHP | BattleStatus.Confuse | BattleStatus.Berserk | BattleStatus.Stop | BattleStatus.AutoLife | BattleStatus.Trance | BattleStatus.Defend | BattleStatus.Poison | BattleStatus.Sleep | BattleStatus.Regen | BattleStatus.Haste | BattleStatus.Slow | BattleStatus.Float | BattleStatus.Shell | BattleStatus.Protect | BattleStatus.Heat | BattleStatus.Freeze | BattleStatus.Vanish | BattleStatus.Doom | BattleStatus.Mini | BattleStatus.Reflect | BattleStatus.Jump | BattleStatus.GradualPetrify));
        if ((p.status & 1) != 0)
        {
            btl_stat.AlterStatus(btl, BattleStatus.Petrify);
        }
        btl_abil.CheckStatusAbility(new BattleUnit(btl));
        btl.base_pos = btl.evt.posBattle;
        Int16 geoID = btl.dms_geo_id;

        btl.height = 0;
        btl.radius = 0;

        FF9BattleDBHeightAndRadius.TryFindHeightAndRadius(geoID, ref btl.height, ref btl.radius);

        if (btl.cur.hp == 0 && btl_stat.AlterStatus(btl, BattleStatus.Death) == 2u)
        {
            btl.die_seq = 5;
            btl_mot.DecidePlayerDieSequence(btl);
            return;
        }
        btl.bi.def_idle = Convert.ToByte(btl_stat.CheckStatus(btl, BattleStatus.IdleDying));
        btl_mot.setMotion(btl, btl.bi.def_idle);
        btl.evt.animFrame = 0;
    }
    public void updateModelsToBeAdded()
    {
        if (this.gMode != 1 && this.gMode != 3 && (Int32)this._ff9Sys.prevMode != 9 || (Int32)this.sEventContext1.inited == 0)
        {
            return;
        }
        for (ObjList objList = this._context.activeObj; objList != null; objList = objList.next)
        {
            Obj obj = objList.obj;
            if ((Int32)obj.cid == 4)
            {
                PosObj posObj = (PosObj)obj;
                if ((Int32)posObj.model != (Int32)UInt16.MaxValue)
                {
                    if (!((UnityEngine.Object)posObj.go != (UnityEngine.Object)null))
                    {
                        posObj.go = ModelFactory.CreateModel(FF9BattleDB.GEO[(Int32)posObj.model], false);
                        if (this.gMode == 1)
                        {
                            GeoTexAnim.addTexAnim(posObj.go, FF9BattleDB.GEO[(Int32)posObj.model]);
                        }
                        if (this.gMode == 1)
                        {
                            this.ReassignBasicAnimationForField((Actor)posObj);
                        }
                    }
                    if ((UnityEngine.Object)posObj.go != (UnityEngine.Object)null)
                    {
                        this.requiredAddActor = true;
                        this.toBeAddedObjUIDList.Add((Int32)posObj.uid);
                    }
                    if (this.gMode != 1)
                    {
                        ;
                    }
                }
            }
        }
        this.sEventContext1.inited = (Byte)0;
        if (!this.requiredAddActor)
        {
            return;
        }
        Int32 num = (Int32)this.GetControlUID();

        this.requiredAddActor = false;
        using (List <Int32> .Enumerator enumerator = this.toBeAddedObjUIDList.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                Int32   current  = enumerator.Current;
                Obj     objUid   = this.GetObjUID(current);
                Boolean isPlayer = current == num;
                if (this.gMode == 1)
                {
                    if (isPlayer)
                    {
                        objUid.go.name = "Player";
                    }
                    else
                    {
                        //Debug.Log((object)("o.uid = " + (object)objUid.uid + ", o.sid = " + (object)objUid.sid));
                        objUid.go.name = "obj" + (Object)current;
                    }
                    FF9Char ff9Char = new FF9Char();
                    ff9Char.geo = objUid.go;
                    ff9Char.evt = (PosObj)objUid;
                    FF9StateSystem.Common.FF9.charArray.Add((Int32)objUid.uid, ff9Char);
                    FF9FieldCharState ff9FieldCharState = new FF9FieldCharState();
                    FF9StateSystem.Field.FF9Field.loc.map.charStateArray.Add((Int32)objUid.uid, ff9FieldCharState);
                    FF9StateSystem.Field.FF9Field.loc.map.shadowArray.Add((Int32)objUid.uid, new FF9Shadow());
                    this.fieldmap.AddFieldChar(objUid.go, ((PosObj)objUid).posField, ((PosObj)objUid).rotField, isPlayer, (Actor)objUid, true);
                    this.turnOffTriManually((Int32)objUid.sid);
                }
                else if (this.gMode == 3)
                {
                    Singleton <WMWorld> .Instance.addWMActorOnly((Actor)objUid);

                    Singleton <WMWorld> .Instance.addGameObjectToWMActor(objUid.go, ((Actor)objUid).wmActor);

                    PosObj posObj = (PosObj)objUid;
                    if ((Int32)posObj.uid != (Int32)this._context.controlUID)
                    {
                        ;
                    }
                    ((Actor)objUid).wmActor.SetPosition(posObj.pos[0], posObj.pos[1], posObj.pos[2]);
                }
            }
        }
        this.requiredAddActor = false;
        this.toBeAddedObjUIDList.Clear();
    }
Пример #21
0
 public static Int32 ff9charptr_attr_test(FF9Char ff9char, Int32 attr)
 {
     return((Int32)((UInt64)ff9char.attr & (UInt64)((Int64)attr)));
 }