예제 #1
0
        public static CreateParticleHook ReadHookType(DatReader datReader)
        {
            CreateParticleHook hook = new CreateParticleHook();

            hook.EmitterInfoId = datReader.ReadUInt32();

            hook.PartIndex = datReader.ReadUInt32();

            hook.Offset = PositionExtensions.ReadPosition(datReader);

            hook.EmitterId = datReader.ReadUInt32();
            return(hook);
        }
예제 #2
0
        public static Animation ReadFromDat(uint fileId)
        {
            // Check the FileCache so we don't need to hit the FileSystem repeatedly
            if (DatManager.PortalDat.FileCache.ContainsKey(fileId))
            {
                return((Animation)DatManager.PortalDat.FileCache[fileId]);
            }
            else
            {
                DatReader datReader = DatManager.PortalDat.GetReaderForFile(fileId);
                Animation a         = new Animation();
                a.AnimationId = datReader.ReadUInt32();

                uint flags = datReader.ReadUInt32();

                a.NumParts  = datReader.ReadUInt32();
                a.NumFrames = datReader.ReadUInt32();

                bool hasPosFrames = ((flags & 1) > 0);
                if (hasPosFrames && a.NumFrames > 0)
                {
                    for (uint i = 0; i < a.NumFrames; i++)
                    {
                        // Origin
                        a.PosFrames.Add(PositionExtensions.ReadPosition(datReader));
                    }
                }

                for (uint i = 0; i < a.NumFrames; i++)
                {
                    AnimationFrame f = AnimationFrame.Read(a.NumParts, datReader);
                    a.Frames.Add(f);
                }

                // Store this object in the FileCache
                DatManager.PortalDat.FileCache[fileId] = a;

                return(a);
            }
        }