Exemplo n.º 1
0
 private void Update()
 {
     if ((Int32)this.AnimIdx.Length != (Int32)this.fieldMap.animIdx.Length)
     {
         this.AnimIdx = new Boolean[(Int32)this.fieldMap.animIdx.Length];
         for (Int32 i = 0; i < (Int32)this.fieldMap.animIdx.Length; i++)
         {
             this.AnimIdx[i] = this.fieldMap.animIdx[i];
         }
     }
     for (Int32 j = 0; j < (Int32)this.fieldMap.animIdx.Length; j++)
     {
         if (this.AnimIdx[j] != this.fieldMap.animIdx[j])
         {
             this.fieldMap.animIdx[j] = this.AnimIdx[j];
         }
     }
     if (this.fieldMap.camIdx != this.CamIdx)
     {
         BGCAM_DEF currentBgCamera = this.fieldMap.GetCurrentBgCamera();
         currentBgCamera.projectedWalkMesh.SetActive(false);
         this.fieldMap.SetCurrentCameraIndex(this.CamIdx);
         BGCAM_DEF currentBgCamera2 = this.fieldMap.GetCurrentBgCamera();
     }
 }
Exemplo n.º 2
0
    private void _RainLoop()
    {
        FieldMap fieldmap = PersistenSingleton <EventEngine> .Instance.fieldmap;

        if (fieldmap == (UnityEngine.Object)null)
        {
            return;
        }
        BGCAM_DEF currentBgCamera = fieldmap.GetCurrentBgCamera();

        for (Int32 i = 0; i < this.numRain; i++)
        {
            FieldRainRenderer.Rain rain = this.rainList[i];
            this._RTPTRain(rain, this.speed, this.gen);
            Vector3 p  = PSX.CalculateGTE_RTPT_POS(rain.p0, Matrix4x4.identity, currentBgCamera.GetMatrixR(), currentBgCamera.GetViewDistance(), fieldmap.GetProjectionOffset(), false);
            Vector3 p2 = PSX.CalculateGTE_RTPT_POS(rain.p1, Matrix4x4.identity, currentBgCamera.GetMatrixR(), currentBgCamera.GetViewDistance(), fieldmap.GetProjectionOffset(), false);
            Vector3 p3 = PSX.CalculateGTE_RTPT_POS(rain.p2, Matrix4x4.identity, currentBgCamera.GetMatrixR(), currentBgCamera.GetViewDistance(), fieldmap.GetProjectionOffset(), false);
            rain.p0   = p;
            rain.p1   = p2;
            rain.p2   = p3;
            rain.col0 = new Color(0f, 0f, 0f, 1f);
            Int32 num  = (Int32)p.z;
            Int32 num2 = num >> 6;
            Int32 num3 = 240;
            num3     -= num2;
            rain.col1 = new Color((Single)num3 / 255f, (Single)num3 / 255f, (Single)num3 / 255f, 1f);
        }
    }
Exemplo n.º 3
0
    private void SetQuad(BGSCENE_DEF scene, Int32 camIdx, Vector2 offset)
    {
        Color[] array = new Color[]
        {
            Color.cyan,
            Color.blue,
            Color.green,
            Color.yellow,
            Color.red,
            Color.white,
            Color.black,
            Color.grey
        };
        BGCAM_DEF bgcam_DEF = scene.cameraList[camIdx];

        Int32[] array2 = new Int32[]
        {
            2222,
            -5555,
            -2222,
            -5555,
            -2222,
            -4080,
            2222,
            -4080
        };
        Int32[] quad = this.fieldMapData[this.currentQuad].quad;
        String  str  = String.Empty;

        for (Int32 i = 0; i < (Int32)quad.Length; i++)
        {
            str = str + ", " + quad[i].ToString();
        }
        Vector3[] array3 = new Vector3[(Int32)quad.Length / 2];
        for (Int32 j = 0; j < (Int32)array3.Length; j++)
        {
            array3[j] = new Vector3((Single)quad[j * 2], 0f, (Single)quad[j * 2 + 1]);
            array3[j] = PSX.CalculateGTE_RTPT(array3[j], Matrix4x4.identity, bgcam_DEF.GetMatrixRT(), bgcam_DEF.GetViewDistance(), offset);
            Color   color = array[j];
            Single  num   = 5f;
            Vector3 b     = new Vector3(0f, 0f, (Single)scene.curZ);
            global::Debug.DrawLine(array3[j] + new Vector3(-num, -num, 0f) + b, array3[j] + new Vector3(num, num, 0f) + b, color, 0f, true);
            global::Debug.DrawLine(array3[j] + new Vector3(-num, num, 0f) + b, array3[j] + new Vector3(num, -num, 0f) + b, color, 0f, true);
        }
        for (Int32 k = 0; k < (Int32)array3.Length; k++)
        {
            Int32  num2 = (Int32)array3.Length - 1;
            Int32  num3 = (Int32)((k - 1 >= 0) ? (k - 1) : num2);
            Int32  num4 = (Int32)((k + 1 <= num2) ? (k + 1) : 0);
            Single num5 = Vector3.Angle(array3[k] - array3[num3], array3[k] - array3[num4]);
        }
        for (Int32 l = 0; l < (Int32)array3.Length - 1; l++)
        {
            global::Debug.DrawLine(array3[l], array3[l + 1], Color.cyan, 0f, true);
            global::Debug.DrawLine(array3[0], array3[l + 1], Color.cyan, 0f, true);
        }
    }
Exemplo n.º 4
0
 private void ExtractCameraData(BinaryReader reader)
 {
     reader.BaseStream.Seek(this.cameraOffset, SeekOrigin.Begin);
     for (Int32 i = 0; i < (Int32)this.cameraCount; i++)
     {
         BGCAM_DEF bGCAM_DEF = new BGCAM_DEF();
         bGCAM_DEF.ReadData(reader);
         this.cameraList.Add(bGCAM_DEF);
     }
 }
Exemplo n.º 5
0
    public static void World2Screen(Vector3 v, out Single x, out Single y)
    {
        FieldMap  fieldmap        = PersistenSingleton <EventEngine> .Instance.fieldmap;
        Camera    mainCamera      = fieldmap.GetMainCamera();
        BGCAM_DEF currentBgCamera = fieldmap.GetCurrentBgCamera();
        Vector3   vector          = PSX.CalculateGTE_RTPT(v, Matrix4x4.identity, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), fieldmap.GetProjectionOffset());
        Vector2   cameraOffset    = fieldmap.GetCameraOffset();
        Single    num             = vector.x - cameraOffset.x;
        Single    num2            = vector.y - cameraOffset.y;

        ETb.ConvertGTEToUIScreenPosition(ref num, ref num2);
        x = num;
        y = num2;
    }
Exemplo n.º 6
0
    public static void SetCenterPosition(Int32 type)
    {
        switch (type)
        {
        case 0:
            Obj objUid = PersistenSingleton <EventEngine> .Instance.GetObjUID(250);

            if (objUid != null && objUid.cid == 4)
            {
                PosObj    posObj          = (PosObj)objUid;
                FieldMap  fieldMap        = PersistenSingleton <EventEngine> .Instance.fieldmap;
                Camera    mainCamera      = fieldMap.GetMainCamera();
                BGCAM_DEF currentBgCamera = fieldMap.GetCurrentBgCamera();
                Vector3   position        = PSXCalculateGTE_RTPT(new Vector3(posObj.pos[0], posObj.pos[1], posObj.pos[2]), Matrix4x4.identity, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), fieldMap.GetProjectionOffset());
                Vector3   vector3         = mainCamera.WorldToScreenPoint(position);
                vector3.x /= mainCamera.pixelWidth;
                vector3.y /= mainCamera.pixelHeight;
                _px        = vector3.x;
                _py        = vector3.y;
                //Debug.Log(string.Concat("px : ", _px, " , py : ", _py));
                break;
            }
            _px = 0.5f;
            _py = 0.5f;
            break;

        case 1:
            if (ff9.w_moveActorPtr != null)
            {
                Vector3 pos     = ff9.w_moveActorPtr.pos;
                Camera  camera  = ff9.w_frameCameraPtr;
                Vector3 vector3 = camera.WorldToScreenPoint(pos);
                vector3.x /= camera.pixelWidth;
                vector3.y /= camera.pixelHeight;
                _px        = vector3.x;
                _py        = vector3.y;
                //Debug.Log(string.Concat("px : ", _px, " , py : ", _py));
                break;
            }
            _px = 0.5f;
            _py = 0.5f;
            break;

        default:
            _px = 0.5f;
            _py = 0.5f;
            break;
        }
    }
        public void OnGUI()
        {
            try
            {
                if (_obj == null)
                {
                    return;
                }

                if (_controler == null)
                {
                    _controler = FindObjectOfType <FieldMapActorController>();
                    if (_controler == null)
                    {
                        return;
                    }
                }

                Vector3 a = _obj.transform.position;

                Camera    mainCamera      = _controler.fieldMap.GetMainCamera();
                BGCAM_DEF currentBgCamera = _controler.fieldMap.GetCurrentBgCamera();
                Vector3   position        = PSX.CalculateGTE_RTPT(a + new Vector3(0f, 0, 0f), Matrix4x4.identity, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), _controler.fieldMap.GetProjectionOffset());
                position   = mainCamera.WorldToScreenPoint(position);
                position.y = (Single)Screen.height - position.y;
                Int32 targetMarkSize = 40;
                Rect  position2      = new Rect(position.x - targetMarkSize / 2f, position.y - targetMarkSize, targetMarkSize, targetMarkSize);
                GUI.Label(position2, _obj.name);

                Component[] components = _obj.GetComponents <Component>();
                Log.Message(_obj.name);
                foreach (Component cmp in components)
                {
                    Log.Message(cmp.name + '_' + cmp.GetType());
                }
                for (Int32 i = 0; i < _obj.transform.childCount; i++)
                {
                    GameObject child = _obj.GetChild(i);
                    Log.Message("child: " + child.name);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
Exemplo n.º 8
0
    private void Update()
    {
        try
        {
            if (!_eventObject.IsEnabled())
            {
                _position = Vector3.zero;
                return;
            }

            if (_actorControler == null)
            {
                _actorControler = gameObject.GetComponent <FieldMapActorController>();
                if (_actorControler == null)
                {
                    return;
                }

                if (!_actorControler.IsActive())
                {
                    return;
                }
            }

            Camera    mainCamera      = _actorControler.fieldMap.GetMainCamera();
            BGCAM_DEF currentBgCamera = _actorControler.fieldMap.GetCurrentBgCamera();

            Vector3 position = PSX.CalculateGTE_RTPT(
                this.gameObject.transform.position,
                Matrix4x4.identity,
                currentBgCamera.GetMatrixRT(),
                currentBgCamera.GetViewDistance(),
                _actorControler.fieldMap.GetProjectionOffset());

            position   = mainCamera.WorldToScreenPoint(position);
            position.y = Screen.height - position.y;

            _position = position;
        }
        catch (Exception ex)
        {
            Log.Error(ex, "Failed to update {0}", this);
            _position = Vector3.zero;
        }
    }
Exemplo n.º 9
0
 private void FollowTarget()
 {
     if (this.lastPosition != this.target.position || this.updateEveryFrame)
     {
         this.lastPosition = this.target.position;
         Camera    mainCamera      = this.fieldMap.GetMainCamera();
         BGCAM_DEF currentBgCamera = this.fieldMap.GetCurrentBgCamera();
         Vector2   cameraOffset    = this.fieldMap.GetCameraOffset();
         Vector3   position        = PSX.CalculateGTE_RTPT(this.lastPosition + this.transformOffset, Matrix4x4.identity, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), this.fieldMap.GetProjectionOffset());
         position.x -= cameraOffset.x;
         position.y -= cameraOffset.y;
         position.x *= UIManager.ResourceXMultipier;
         position.y *= UIManager.ResourceYMultipier;
         position.z  = 0f;
         this.selfPosition.position       = this.uiCam.transform.parent.TransformPoint(position);
         this.selfPosition.localPosition  = new Vector3(this.selfPosition.localPosition.x, this.selfPosition.localPosition.y, 0f);
         this.selfPosition.localPosition += this.uiOffset;
     }
 }
Exemplo n.º 10
0
    // Token: 0x060014D9 RID: 5337 RVA: 0x00150974 File Offset: 0x0014EB74
    public static void SetCenterPosition(int type)
    {
        if (type != 0)
        {
            if (type != 1)
            {
                SFX_Rush.px = 0.5f;
                SFX_Rush.py = 0.5f;
            }
            else if (ff9.w_moveActorPtr != null)
            {
                Vector3 pos = ff9.w_moveActorPtr.pos;
                Camera  w_frameCameraPtr = ff9.w_frameCameraPtr;
                Vector3 vector           = w_frameCameraPtr.WorldToScreenPoint(pos);
                vector.x   /= (float)w_frameCameraPtr.pixelWidth;
                vector.y   /= (float)w_frameCameraPtr.pixelHeight;
                SFX_Rush.px = vector.x;
                SFX_Rush.py = vector.y;
                global::Debug.Log(string.Concat(new object[]
                {
                    "px : ",
                    SFX_Rush.px,
                    " , py : ",
                    SFX_Rush.py
                }));
            }
            else
            {
                SFX_Rush.px = 0.5f;
                SFX_Rush.py = 0.5f;
            }
        }
        else
        {
            Obj objUID = PersistenSingleton <EventEngine> .Instance.GetObjUID(250);

            if (objUID != null && objUID.cid == 4)
            {
                PosObj    posObj          = (PosObj)objUID;
                FieldMap  fieldmap        = PersistenSingleton <EventEngine> .Instance.fieldmap;
                Camera    mainCamera      = fieldmap.GetMainCamera();
                BGCAM_DEF currentBgCamera = fieldmap.GetCurrentBgCamera();
                Vector3   vertex          = new Vector3(posObj.pos[0], posObj.pos[1], posObj.pos[2]);
                Vector3   position        = PSX.CalculateGTE_RTPT(vertex, Matrix4x4.identity, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), fieldmap.GetProjectionOffset());
                position    = mainCamera.WorldToScreenPoint(position);
                position.x /= (float)mainCamera.pixelWidth;
                position.y /= (float)mainCamera.pixelHeight;
                SFX_Rush.px = position.x;
                SFX_Rush.py = position.y;
                global::Debug.Log(string.Concat(new object[]
                {
                    "px : ",
                    SFX_Rush.px,
                    " , py : ",
                    SFX_Rush.py
                }));
            }
            else
            {
                SFX_Rush.px = 0.5f;
                SFX_Rush.py = 0.5f;
            }
        }
    }
Exemplo n.º 11
0
    private void _GenerateSPSMesh()
    {
        if (this.spsPrims.Count == 0)
        {
            return;
        }
        Boolean   flag            = false;
        BGCAM_DEF currentBgCamera = this.fieldMap.GetCurrentBgCamera();

        if (currentBgCamera == null)
        {
            return;
        }
        Single    num      = (Single)this.scale / 4096f;
        Matrix4x4 localRTS = Matrix4x4.identity;
        Boolean   flag2    = false;

        if (FF9StateSystem.Common.FF9.fldMapNo == 2929)
        {
            flag = true;
        }
        if (flag)
        {
            if (FF9StateSystem.Common.FF9.fldMapNo == 2929)
            {
                localRTS = Matrix4x4.TRS(this.pos * 0.9925f, Quaternion.Euler(-this.rot.x / 2f, -this.rot.y / 2f, this.rot.z / 2f), new Vector3(num, -num, 1f));
            }
            else
            {
                localRTS = Matrix4x4.TRS(this.pos, Quaternion.Euler(this.rot.x, this.rot.y, this.rot.z), new Vector3(num, -num, 1f));
            }
        }
        else
        {
            Vector3 vector = PSX.CalculateGTE_RTPT_POS(this.pos, Matrix4x4.identity, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), this.fieldMap.GetProjectionOffset(), true);
            num *= currentBgCamera.GetViewDistance() / vector.z;
            if (vector.z < 0f)
            {
                flag2 = true;
            }
            vector.z /= 4f;
            vector.z += (Single)currentBgCamera.depthOffset;
            base.transform.localPosition = new Vector3(vector.x, vector.y, vector.z + (Single)this.zOffset);
            base.transform.localScale    = new Vector3(num, -num, 1f);
            base.transform.localRotation = Quaternion.Euler(this.rot.x, this.rot.y, -this.rot.z);
        }
        this._vertices.Clear();
        this._colors.Clear();
        this._uv.Clear();
        this._indices.Clear();
        for (Int32 i = 0; i < this.spsPrims.Count; i++)
        {
            if (flag2)
            {
                break;
            }
            FieldSPS.FieldSPSPrim fieldSPSPrim = this.spsPrims[i];
            Int32 count = this._vertices.Count;
            if (flag)
            {
                Vector3 a    = PSX.CalculateGTE_RTPT(fieldSPSPrim.v0, localRTS, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), this.fieldMap.GetProjectionOffset());
                Vector3 a2   = PSX.CalculateGTE_RTPT(fieldSPSPrim.v1, localRTS, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), this.fieldMap.GetProjectionOffset());
                Vector3 a3   = PSX.CalculateGTE_RTPT(fieldSPSPrim.v2, localRTS, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), this.fieldMap.GetProjectionOffset());
                Vector3 a4   = PSX.CalculateGTE_RTPT(fieldSPSPrim.v3, localRTS, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), this.fieldMap.GetProjectionOffset());
                Single  num2 = PSX.CalculateGTE_RTPTZ(Vector3.zero, localRTS, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), this.fieldMap.GetProjectionOffset());
                num2 /= 4f;
                num2 += (Single)currentBgCamera.depthOffset;
                Vector3 b = new Vector3(0f, 0f, num2 - (Single)i / 100f);
                this._vertices.Add(a + b);
                this._vertices.Add(a2 + b);
                this._vertices.Add(a3 + b);
                this._vertices.Add(a4 + b);
            }
            else
            {
                Vector3 b2 = new Vector3(0f, 0f, (Single)(this.spsPrims.Count - i) / 100f);
                this._vertices.Add(fieldSPSPrim.v0 + b2);
                this._vertices.Add(fieldSPSPrim.v1 + b2);
                this._vertices.Add(fieldSPSPrim.v2 + b2);
                this._vertices.Add(fieldSPSPrim.v3 + b2);
            }
            this._colors.Add(fieldSPSPrim.color);
            this._colors.Add(fieldSPSPrim.color);
            this._colors.Add(fieldSPSPrim.color);
            this._colors.Add(fieldSPSPrim.color);
            this._uv.Add((fieldSPSPrim.uv0 + new Vector2(0.5f, 0.5f)) * 0.00390625f);
            this._uv.Add((fieldSPSPrim.uv1 + new Vector2(-0.5f, 0.5f)) * 0.00390625f);
            this._uv.Add((fieldSPSPrim.uv2 + new Vector2(0.5f, -0.5f)) * 0.00390625f);
            this._uv.Add((fieldSPSPrim.uv3 + new Vector2(-0.5f, -0.5f)) * 0.00390625f);
            this._indices.Add(count);
            this._indices.Add(count + 1);
            this._indices.Add(count + 2);
            this._indices.Add(count + 1);
            this._indices.Add(count + 3);
            this._indices.Add(count + 2);
        }
        Mesh mesh = this.meshFilter.mesh;

        mesh.Clear();
        mesh.vertices        = this._vertices.ToArray();
        mesh.colors          = this._colors.ToArray();
        mesh.uv              = this._uv.ToArray();
        mesh.triangles       = this._indices.ToArray();
        this.meshFilter.mesh = mesh;
        FieldSPS.FieldSPSPrim fieldSPSPrim2 = this.spsPrims[0];
        PSXTexture            texture       = PSXTextureMgr.GetTexture(fieldSPSPrim2.FlagTP, fieldSPSPrim2.FlagTY, fieldSPSPrim2.FlagTX, fieldSPSPrim2.FlagClutY, fieldSPSPrim2.FlagClutX);

        texture.SetFilter(FilterMode.Bilinear);
        Int32 num3 = (Int32)((this.arate >= 4) ? 4 : this.arate);

        this.materials[num3].mainTexture = texture.texture;
        this.meshRenderer.material       = this.materials[num3];
        if (this.spsActor != (UnityEngine.Object)null)
        {
            this.spsActor.spsPos = this.pos;
        }
    }
Exemplo n.º 12
0
    private void CreateScene(FieldMap fieldMap, Boolean UseUpscalFM)
    {
        GameObject gameObject = new GameObject("Background");

        gameObject.transform.parent        = fieldMap.transform;
        gameObject.transform.localPosition = new Vector3(this.curX - 160f, -(this.curY - 112f), this.curZ);
        gameObject.transform.localScale    = new Vector3(1f, -1f, 1f);
        for (Int32 i = 0; i < this.cameraList.Count; i++)
        {
            BGCAM_DEF  bGCAM_DEF   = this.cameraList[i];
            GameObject gameObject2 = new GameObject(String.Concat("Camera_", i.ToString("D2"), " : ", bGCAM_DEF.vrpMaxX + 160f, " x ", bGCAM_DEF.vrpMaxY + 112f));
            Transform  transform   = gameObject2.transform;
            transform.parent    = gameObject.transform;
            bGCAM_DEF.transform = transform;
            bGCAM_DEF.transform.localPosition = Vector3.zero;
            bGCAM_DEF.transform.localScale    = new Vector3(1f, 1f, 1f);
        }
        List <Vector3> list  = new List <Vector3>();
        List <Vector2> list2 = new List <Vector2>();
        List <Int32>   list3 = new List <Int32>();

        for (Int32 j = 0; j < this.overlayList.Count; j++)
        {
            BGOVERLAY_DEF bGOVERLAY_DEF = this.overlayList[j];
            String        str           = "Overlay_" + j.ToString("D2");
            GameObject    gameObject3   = new GameObject(str);
            Transform     transform2    = gameObject3.transform;
            transform2.parent        = this.cameraList[bGOVERLAY_DEF.camNdx].transform;
            transform2.localPosition = new Vector3(bGOVERLAY_DEF.curX * 1f, bGOVERLAY_DEF.curY * 1f, bGOVERLAY_DEF.curZ);
            transform2.localScale    = new Vector3(1f, 1f, 1f);
            bGOVERLAY_DEF.transform  = transform2;
            for (Int32 k = 0; k < bGOVERLAY_DEF.spriteList.Count; k++)
            {
                BGSPRITE_LOC_DEF bGSPRITE_LOC_DEF = bGOVERLAY_DEF.spriteList[k];
                var        num         = bGSPRITE_LOC_DEF.depth;
                GameObject gameObject4 = new GameObject(str + "_Sprite_" + k.ToString("D3"));
                Transform  transform3  = gameObject4.transform;
                transform3.parent = transform2;
                {
                    transform3.localPosition = new Vector3(bGSPRITE_LOC_DEF.offX * 1f, (bGSPRITE_LOC_DEF.offY + 16) * 1f, num);
                }
                transform3.localScale      = new Vector3(1f, 1f, 1f);
                bGSPRITE_LOC_DEF.transform = transform3;
                list.Clear();
                list2.Clear();
                list3.Clear();
                list.Add(new Vector3(0f, -16f, 0f));
                list.Add(new Vector3(16f, -16f, 0f));
                list.Add(new Vector3(16f, 0f, 0f));
                list.Add(new Vector3(0f, 0f, 0f));
                Single num2 = this.ATLAS_W;
                Single num3 = this.ATLAS_H;
                Single x;
                Single y;
                Single x2;
                Single y2;
                if (UseUpscalFM)
                {
                    Single num4 = 0.5f;
                    x  = (bGSPRITE_LOC_DEF.atlasX - num4) / num2;
                    y  = (this.ATLAS_H - bGSPRITE_LOC_DEF.atlasY + num4) / num3;
                    x2 = (bGSPRITE_LOC_DEF.atlasX + this.SPRITE_W - num4) / num2;
                    y2 = (this.ATLAS_H - (bGSPRITE_LOC_DEF.atlasY + this.SPRITE_H) + num4) / num3;
                }
                else
                {
                    Single num5 = 0.5f;
                    x  = (bGSPRITE_LOC_DEF.atlasX + num5) / num2;
                    y  = (bGSPRITE_LOC_DEF.atlasY + num5) / num3;
                    x2 = (bGSPRITE_LOC_DEF.atlasX + this.SPRITE_W - num5) / num2;
                    y2 = (bGSPRITE_LOC_DEF.atlasY + this.SPRITE_H - num5) / num3;
                }
                list2.Add(new Vector2(x, y));
                list2.Add(new Vector2(x2, y));
                list2.Add(new Vector2(x2, y2));
                list2.Add(new Vector2(x, y2));
                list3.Add(2);
                list3.Add(1);
                list3.Add(0);
                list3.Add(3);
                list3.Add(2);
                list3.Add(0);
                Mesh mesh = new Mesh
                {
                    vertices  = list.ToArray(),
                    uv        = list2.ToArray(),
                    triangles = list3.ToArray()
                };
                MeshRenderer meshRenderer = gameObject4.AddComponent <MeshRenderer>();
                MeshFilter   meshFilter   = gameObject4.AddComponent <MeshFilter>();
                meshFilter.mesh = mesh;
                Int32      num6     = this.curZ + (Int16)bGOVERLAY_DEF.curZ + bGSPRITE_LOC_DEF.depth;
                GameObject expr_5B4 = gameObject4;
                expr_5B4.name = expr_5B4.name + "_Depth(" + num6.ToString("D5") + ")";
                String text;
                if (bGSPRITE_LOC_DEF.trans != 0)
                {
                    if (bGSPRITE_LOC_DEF.alpha == 0)
                    {
                        text = "abr_0";
                    }
                    else if (bGSPRITE_LOC_DEF.alpha == 1)
                    {
                        text = "abr_1";
                    }
                    else if (bGSPRITE_LOC_DEF.alpha == 2)
                    {
                        text = "abr_2";
                    }
                    else
                    {
                        text = "abr_3";
                    }
                }
                else
                {
                    text = "abr_none";
                }
                if (fieldMap.mapName == "FBG_N39_UUVL_MAP671_UV_DEP_0" && j == 14)
                {
                    text = "abr_none";
                }
                GameObject expr_671 = gameObject4;
                expr_671.name         = expr_671.name + "_[" + text + "]";
                meshRenderer.material = this.materialList[text];
            }
            bGOVERLAY_DEF.transform.gameObject.SetActive((bGOVERLAY_DEF.flags & 2) != 0);
        }
        for (Int32 l = 0; l < this.animList.Count; l++)
        {
            BGANIM_DEF bGANIM_DEF = this.animList[l];
            for (Int32 m = 0; m < bGANIM_DEF.frameList.Count; m++)
            {
                GameObject gameObject5 = this.overlayList[bGANIM_DEF.frameList[m].target].transform.gameObject;
                GameObject expr_754    = gameObject5;
                expr_754.name = expr_754.name + "_[anim_" + l.ToString("D2") + "]";
                GameObject expr_77C = gameObject5;
                String     text2    = expr_77C.name;
                expr_77C.name = String.Concat(text2, "_[frame_", m.ToString("D2"), "_of_", bGANIM_DEF.frameList.Count.ToString("D2"), "]");
            }
        }
    }
Exemplo n.º 13
0
    public override void HonoLateUpdate()
    {
        if (FF9StateSystem.Common.FF9.fldMapNo == 70)
        {
            return;
        }
        BGCAM_DEF currentBgCamera  = this._fieldMap.GetCurrentBgCamera();
        Matrix4x4 cam              = FF9StateSystem.Common.FF9.cam;
        UInt16    proj             = FF9StateSystem.Common.FF9.proj;
        Vector2   projectionOffset = FF9StateSystem.Common.FF9.projectionOffset;
        Vector3   position         = base.transform.position;

        this.projectedPos   = PSX.CalculateGTE_RTPT_POS(position, Matrix4x4.identity, cam, (Single)proj, projectionOffset, true);
        this.projectedDepth = this.projectedPos.z / 4f + (Single)FF9StateSystem.Field.FF9Field.loc.map.charOTOffset;
        this.charOTOffset   = FF9StateSystem.Field.FF9Field.loc.map.charOTOffset;
        if (this.projectedDepth < 100f || this.projectedDepth > 3996f)
        {
        }
        Single num  = PSX.CalculateGTE_RTPTZ(base.transform.position, Matrix4x4.identity, cam, (Single)proj, projectionOffset) * 1f;
        Single num2 = num / 4f + (Single)FF9StateSystem.Field.FF9Field.loc.map.charOTOffset;

        if (this.meshRenderer != null)
        {
            if (this.actor != null)
            {
                PosObj posObj = this.actor;
                if (num2 < 100f || num2 > 3996f)
                {
                    if (FF9StateSystem.Common.FF9.fldMapNo == 1413)
                    {
                        FieldMapActorController component = base.GetComponent <FieldMapActorController>();
                        if (component.originalActor.sid == 12)
                        {
                            posObj.frontCamera = true;
                        }
                        else
                        {
                            posObj.frontCamera = false;
                        }
                    }
                    else if (FF9StateSystem.Common.FF9.fldMapNo == 1414)
                    {
                        FieldMapActorController component2 = base.GetComponent <FieldMapActorController>();
                        if (component2.originalActor.sid == 16)
                        {
                            posObj.frontCamera = true;
                        }
                        else
                        {
                            posObj.frontCamera = false;
                        }
                    }
                    else if (FF9StateSystem.Common.FF9.fldMapNo != 2752 && FF9StateSystem.Common.FF9.fldMapNo != 1707)
                    {
                        posObj.frontCamera = false;
                    }
                    return;
                }
                posObj.frontCamera = true;
            }
            Renderer[] array = this.meshRenderer;
            for (Int32 i = 0; i < (Int32)array.Length; i++)
            {
                Renderer renderer = array[i];
                if (renderer.enabled)
                {
                    Single num3;
                    if (MBG.MarkCharacterDepth)
                    {
                        num3 = 8f;
                    }
                    else
                    {
                        num3 = num;
                    }
                    this.charPsxZ = num3;
                    this.charZ    = (Single)(((Int32)num3 / 4 + FF9StateSystem.Field.FF9Field.loc.map.charOTOffset) * 1);
                    this.charZ    = (Single)(-(Single)((Int32)this.charZ));
                    if (FF9StateSystem.Common.FF9.fldMapNo == 2510 && this.actor.uid == 8)
                    {
                        renderer.material.SetFloat("_CharZ", 20f);
                    }
                    if (FF9StateSystem.Common.FF9.fldMapNo == 2363 && this.actor.uid == 33)
                    {
                        renderer.material.SetFloat("_CharZ", 20f);
                    }
                }
            }
        }
        if (this.actor == null)
        {
            return;
        }
        FF9Shadow ff9Shadow = FF9StateSystem.Field.FF9Field.loc.map.shadowArray[(Int32)this.actor.uid];
        Vector3   zero      = Vector3.zero;

        if (FF9StateSystem.Common.FF9.fldMapNo == 661 && this.actor.uid == 3)
        {
            zero = new Vector3(-39f, -14f, 80f);
        }
        else if (FF9StateSystem.Common.FF9.fldMapNo == 1659 && this.actor.uid == 128)
        {
            zero = new Vector3(0f, -66f, 0f);
        }
        else if (FF9StateSystem.Common.FF9.fldMapNo == 1659 && this.actor.uid == 129)
        {
            zero = new Vector3(0f, -21f, 0f);
        }
        else if (FF9StateSystem.Common.FF9.fldMapNo == 2363 && (this.actor.uid == 16 || this.actor.uid == 15 || this.actor.uid == 32 || this.actor.uid == 33))
        {
            zero = new Vector3(0f, -15f, 0f);
        }
        Vector3 a = this.GetShadowCurrentPos();

        if ((FF9StateSystem.Common.FF9.fldMapNo == 2107 && this.actor.uid == 5) || (FF9StateSystem.Common.FF9.fldMapNo == 2102 && this.actor.uid == 4))
        {
            a   = base.transform.position;
            a.y = 0f;
        }
        this.shadowTran.localPosition = a + new Vector3(ff9Shadow.xOffset, this.shadowHeightOffset * 1f, ff9Shadow.zOffset) + zero;
        Single num4 = PSX.CalculateGTE_RTPTZ(this.shadowTran.position, Matrix4x4.identity, cam, (Single)proj, projectionOffset);

        num4          = (Single)(((Int32)num4 / 4 + FF9StateSystem.Field.FF9Field.loc.map.charOTOffset) * 1);
        num4          = (Single)(-(Single)((Int32)num4));
        this.shadowZ  = (Int32)num4;
        this.charAbsZ = base.transform.position.z;
    }