示例#1
0
        private void CreateSceneObjects()
        {
            SceneObjects = new Dictionary <int, CutsceneObject>();

            if (Objects == null)
            {
                return;
            }


            var refCounts = new Dictionary <MetaHash, int>();

            foreach (var obj in Objects.Values)
            {
                var sobj = new CutsceneObject();
                sobj.Init(obj, GameFileCache);
                SceneObjects[sobj.ObjectID] = sobj;

                if (sobj.AnimHash != 0)
                {
                    int refcount = 0;
                    var hash     = sobj.AnimHash;
                    refCounts.TryGetValue(hash, out refcount);
                    if (refcount > 0)
                    {
                        var newstr = hash.ToString() + "^" + refcount.ToString();
                        sobj.AnimHash = JenkHash.GenHash(newstr);
                    }
                    refcount++;
                    refCounts[hash] = refcount;
                }
            }
        }
示例#2
0
        private void PedVariation(CutEvent e)
        {
            var args = e.EventArgs as CutObjectVariationEventArgs;

            if (args == null)
            {
                return;
            }

            var oe = e as CutObjectIdEvent;

            if (oe == null)
            {
                return;
            }


            CutsceneObject cso = null;

            SceneObjects.TryGetValue(oe.iObjectId, out cso);

            if (cso?.Ped != null)
            {
                int comp = args.iComponent;
                int drbl = args.iDrawable;
                int texx = args.iTexture;

                Task.Run(() =>
                {
                    cso.Ped.SetComponentDrawable(comp, drbl, 0, texx, GameFileCache);
                });
            }
        }
示例#3
0
        private void EnableHideObject(CutEvent e)
        {
            var oe = e as CutObjectIdEvent;

            if (oe == null)
            {
                return;
            }

            CutsceneObject cso = null;

            SceneObjects.TryGetValue(oe.iObjectId, out cso);
            if (cso != null)
            {
                cso.Enabled = true;
            }
        }
示例#4
0
        private void CameraCut(CutEvent e)
        {
            var args = e.EventArgs as CutCameraCutEventArgs;

            if (args == null)
            {
                return;
            }

            var oe = e as CutObjectIdEvent;

            if (oe == null)
            {
                return;
            }


            CutsceneObject obj = null;

            SceneObjects.TryGetValue(oe.iObjectId, out obj);
            if (obj == null)
            {
                return;
            }


            var pos = Position;
            var rot = Rotation * Quaternion.RotationAxis(Vector3.UnitX, 1.57079632679f);

            obj.Position = pos + rot.Multiply(args.vPosition);
            obj.Rotation = rot * args.vRotationQuaternion;

            CameraNearClip   = (args.fNearDrawDistance > 0) ? Math.Min(args.fNearDrawDistance, 0.5f) : 0.5f;
            CameraFarClip    = (args.fFarDrawDistance > 0) ? Math.Max(args.fFarDrawDistance, 1000.0f) : 12000.0f;
            CameraClipUpdate = true;
            CameraObject     = obj;
        }
示例#5
0
        private void UnloadModels(CutEvent e)
        {
            var args = e.EventArgs as CutObjectIdListEventArgs;

            if (args == null)
            {
                return;
            }

            if (args.iObjectIdList == null)
            {
                return;
            }

            foreach (var objid in args.iObjectIdList)
            {
                CutsceneObject obj = null;
                SceneObjects.TryGetValue(objid, out obj);
                if (obj != null)
                {
                    obj.Enabled = false;
                }
            }
        }