Example #1
0
        public static SetOmegaHook ReadHookType(DatReader datReader)
        {
            SetOmegaHook so = new SetOmegaHook();

            so.Axis = new AceVector3(datReader.ReadSingle(), datReader.ReadSingle(), datReader.ReadSingle());
            return(so);
        }
Example #2
0
        public static MotionData Read(DatReader datReader)
        {
            MotionData md = new Entity.MotionData();

            byte numAnims = datReader.ReadByte();

            md.Bitfield  = datReader.ReadByte();
            md.Bitfield2 = datReader.ReadByte();
            datReader.AlignBoundary();

            for (byte i = 0; i < numAnims; i++)
            {
                AnimData animData = new AnimData();
                animData.AnimId    = datReader.ReadUInt32();
                animData.LowFrame  = datReader.ReadUInt32();
                animData.HighFrame = datReader.ReadUInt32();
                animData.Framerate = datReader.ReadSingle();
                md.Anims.Add(animData);
            }

            if ((md.Bitfield2 & 1) > 0)
            {
                md.Velocity = new AceVector3(datReader.ReadSingle(), datReader.ReadSingle(), datReader.ReadSingle());
            }

            if ((md.Bitfield2 & 2) > 0)
            {
                md.Omega = new AceVector3(datReader.ReadSingle(), datReader.ReadSingle(), datReader.ReadSingle());
            }

            return(md);
        }
Example #3
0
        public static Surface ReadFromDat(uint fileId)
        {
            // Check the FileCache so we don't need to hit the FileSystem repeatedly
            if (DatManager.PortalDat.FileCache.ContainsKey(fileId))
            {
                return((Surface)DatManager.PortalDat.FileCache[fileId]);
            }
            else
            {
                DatReader datReader = DatManager.PortalDat.GetReaderForFile(fileId);
                Surface   obj       = new Surface();

                obj.Type = (SurfaceType)datReader.ReadUInt32();

                if (((uint)obj.Type & 6) > 0)
                {
                    obj.OrigTextureId = datReader.ReadUInt32();
                    obj.OrigPaletteId = datReader.ReadUInt32();
                }
                else
                {
                    obj.ColorValue = datReader.ReadUInt32();
                }

                obj.Translucency = datReader.ReadSingle();
                obj.Luminosity   = datReader.ReadSingle();
                obj.Diffuse      = datReader.ReadSingle();

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

                return(obj);
            }
        }
Example #4
0
        public static CSphere Read(DatReader datReader)
        {
            CSphere obj = new CSphere();

            obj.Origin = new AceVector3(datReader.ReadSingle(), datReader.ReadSingle(), datReader.ReadSingle());
            obj.Radius = datReader.ReadSingle();
            return(obj);
        }
Example #5
0
        public static ScaleHook ReadHookType(DatReader datReader)
        {
            ScaleHook s = new ScaleHook();

            s.End  = datReader.ReadSingle();
            s.Time = datReader.ReadSingle();
            return(s);
        }
Example #6
0
        public static TextureVelocityHook ReadHookType(DatReader datReader)
        {
            TextureVelocityHook tv = new TextureVelocityHook();

            tv.USpeed = datReader.ReadSingle();
            tv.VSpeed = datReader.ReadSingle();
            return(tv);
        }
Example #7
0
        public static DiffuseHook ReadHookType(DatReader datReader)
        {
            DiffuseHook d = new DiffuseHook();

            d.Start = datReader.ReadSingle();
            d.End   = datReader.ReadSingle();
            d.Time  = datReader.ReadSingle();
            return(d);
        }
Example #8
0
        public static LuminousHook ReadHookType(DatReader datReader)
        {
            LuminousHook l = new LuminousHook();

            l.Start = datReader.ReadSingle();
            l.End   = datReader.ReadSingle();
            l.Time  = datReader.ReadSingle();
            return(l);
        }
Example #9
0
        public static TransparentHook ReadHookType(DatReader datReader)
        {
            TransparentHook tp = new TransparentHook();

            tp.Start = datReader.ReadSingle();
            tp.End   = datReader.ReadSingle();
            tp.Time  = datReader.ReadSingle();
            return(tp);
        }
Example #10
0
        public static Vec2Duv Read(DatReader datReader)
        {
            Vec2Duv obj = new Vec2Duv();

            obj.U = datReader.ReadSingle();
            obj.V = datReader.ReadSingle();

            return(obj);
        }
Example #11
0
        public static SoundTweakedHook ReadHookType(DatReader datReader)
        {
            SoundTweakedHook st = new SoundTweakedHook();

            st.SoundID     = datReader.ReadUInt32();
            st.Priority    = datReader.ReadSingle();
            st.Probability = datReader.ReadSingle();
            st.Volume      = datReader.ReadSingle();
            return(st);
        }
Example #12
0
        public static DiffusePartHook ReadHookType(DatReader datReader)
        {
            DiffusePartHook dp = new DiffusePartHook();

            dp.Part  = datReader.ReadUInt32();
            dp.Start = datReader.ReadSingle();
            dp.End   = datReader.ReadSingle();
            dp.Time  = datReader.ReadSingle();
            return(dp);
        }
Example #13
0
        public static LuminousPartHook ReadHookType(DatReader datReader)
        {
            LuminousPartHook lp = new LuminousPartHook();

            lp.Part  = datReader.ReadUInt32();
            lp.Start = datReader.ReadSingle();
            lp.End   = datReader.ReadSingle();
            lp.Time  = datReader.ReadSingle();
            return(lp);
        }
Example #14
0
        public static AmbientSoundDesc Read(DatReader datReader)
        {
            AmbientSoundDesc obj = new AmbientSoundDesc();

            obj.SType      = datReader.ReadUInt32();
            obj.Volume     = datReader.ReadSingle();
            obj.BaseChance = datReader.ReadSingle();
            obj.MinRate    = datReader.ReadSingle();
            obj.MaxRate    = datReader.ReadSingle();
            return(obj);
        }
Example #15
0
        public static GfxObjInfo Read(DatReader datReader)
        {
            GfxObjInfo obj = new GfxObjInfo();

            obj.Id          = datReader.ReadUInt32();
            obj.DegradeMode = datReader.ReadUInt32();
            obj.MinDist     = datReader.ReadSingle();
            obj.IdealDist   = datReader.ReadSingle();
            obj.MaxDist     = datReader.ReadSingle();

            return(obj);
        }
Example #16
0
        public static LightInfo Read(DatReader datReader)
        {
            LightInfo obj = new LightInfo();

            obj.ViewerspaceLocation = PositionExtensions.ReadPosition(datReader);
            obj.Color     = datReader.ReadUInt32();
            obj.Intensity = datReader.ReadSingle();
            obj.Falloff   = datReader.ReadSingle();
            obj.ConeAngle = datReader.ReadSingle();

            return(obj);
        }
Example #17
0
        public static SkyObjectReplace Read(DatReader datReader)
        {
            SkyObjectReplace obj = new SkyObjectReplace();

            obj.ObjectIndex = datReader.ReadUInt32();
            obj.GFXObjId    = datReader.ReadUInt32();
            obj.Rotate      = datReader.ReadSingle();
            obj.Transparent = datReader.ReadSingle();
            obj.Luminosity  = datReader.ReadSingle();
            obj.MaxBright   = datReader.ReadSingle();
            return(obj);
        }
Example #18
0
        public static CallPESHook ReadHookType(DatReader datReader)
        {
            CallPESHook hook = new CallPESHook();

            hook.PES   = datReader.ReadUInt32();
            hook.Pause = datReader.ReadSingle();
            return(hook);
        }
Example #19
0
        public static SkyTimeOfDay Read(DatReader datReader)
        {
            SkyTimeOfDay obj = new SkyTimeOfDay();

            obj.Begin      = datReader.ReadSingle();
            obj.DirBright  = datReader.ReadSingle();
            obj.DirHeading = datReader.ReadSingle();
            obj.DirPitch   = datReader.ReadSingle();
            obj.DirColor   = datReader.ReadUInt32();

            obj.AmbBright = datReader.ReadSingle();
            obj.AmbColor  = datReader.ReadUInt32();

            obj.MinWorldFog   = datReader.ReadSingle();
            obj.MaxWorldFog   = datReader.ReadSingle();
            obj.WorldFogColor = datReader.ReadUInt32();
            obj.WorldFog      = datReader.ReadUInt32();

            uint num_sky_obj_replace = datReader.ReadUInt32();

            for (uint i = 0; i < num_sky_obj_replace; i++)
            {
                obj.SkyObjReplace.Add(SkyObjectReplace.Read(datReader));
            }

            return(obj);
        }
Example #20
0
        public static AnimationFrame Read(uint numParts, DatReader datReader)
        {
            AnimationFrame a = new AnimationFrame();

            for (uint i = 0; i < numParts; i++)
            {
                Position p = new Position();
                // Origin
                p.PositionX = datReader.ReadSingle();
                p.PositionY = datReader.ReadSingle();
                p.PositionZ = datReader.ReadSingle();
                p.RotationW = datReader.ReadSingle();
                p.RotationX = datReader.ReadSingle();
                p.RotationY = datReader.ReadSingle();
                p.RotationZ = datReader.ReadSingle();
                a.Locations.Add(p);
            }

            uint numHooks = datReader.ReadUInt32();

            for (uint i = 0; i < numHooks; i++)
            {
                a.Hooks.Add(AnimationHook.Read(datReader));
            }

            return(a);
        }
Example #21
0
        public static Plane Read(DatReader datReader)
        {
            Plane obj = new Plane();

            obj.N = PositionExtensions.ReadPositionFrame(datReader);
            obj.D = datReader.ReadSingle();

            return(obj);
        }
Example #22
0
        public static ScriptAndModData Read(DatReader datReader)
        {
            ScriptAndModData obj = new ScriptAndModData();

            obj.Mod      = datReader.ReadSingle();
            obj.ScriptId = datReader.ReadUInt32();

            return(obj);
        }
Example #23
0
        public static LandDefs Read(DatReader datReader)
        {
            LandDefs obj = new LandDefs();

            for (int i = 0; i < 256; i++)
            {
                obj.LandHeightTable.Add(datReader.ReadSingle());
            }
            return(obj);
        }
Example #24
0
 public static void Read(this Position p, DatReader datReader)
 {
     p.PositionX = datReader.ReadSingle();
     p.PositionY = datReader.ReadSingle();
     p.PositionZ = datReader.ReadSingle();
     p.RotationW = datReader.ReadSingle();
     p.RotationX = datReader.ReadSingle();
     p.RotationY = datReader.ReadSingle();
     p.RotationZ = datReader.ReadSingle();
 }
Example #25
0
        public static SpellComponentsTable ReadFromDat()
        {
            // Check the FileCache so we don't need to hit the FileSystem repeatedly
            if (DatManager.PortalDat.FileCache.ContainsKey(0x0E00000F))
            {
                return((SpellComponentsTable)DatManager.PortalDat.FileCache[0x0E00000F]);
            }
            else
            {
                // Create the datReader for the proper file
                DatReader            datReader = DatManager.PortalDat.GetReaderForFile(0x0E00000F);
                SpellComponentsTable comps     = new SpellComponentsTable();

                comps.FileId = datReader.ReadUInt32();
                uint numComps = datReader.ReadUInt16(); // Should be 163 or 0xA3
                datReader.AlignBoundary();
                // loop through the entire file...
                for (uint i = 0; i < numComps; i++)
                {
                    SpellComponentBase newComp = new SpellComponentBase();
                    uint compId = datReader.ReadUInt32();
                    newComp.Name = datReader.ReadObfuscatedString();
                    datReader.AlignBoundary();
                    newComp.Category = datReader.ReadUInt32();
                    newComp.Icon     = datReader.ReadUInt32();
                    newComp.Type     = datReader.ReadUInt32();
                    newComp.Gesture  = datReader.ReadUInt32();
                    newComp.Time     = datReader.ReadSingle();
                    newComp.Text     = datReader.ReadObfuscatedString();
                    datReader.AlignBoundary();
                    newComp.CDM = datReader.ReadSingle();
                    comps.SpellComponents.Add(compId, newComp);
                }

                DatManager.PortalDat.FileCache[0x0E00000F] = comps;
                return(comps);
            }
        }
Example #26
0
        public static ObjectDesc Read(DatReader datReader)
        {
            ObjectDesc obj = new ObjectDesc();

            obj.ObjId       = datReader.ReadUInt32();
            obj.BaseLoc     = PositionExtensions.ReadPosition(datReader);
            obj.Freq        = datReader.ReadSingle();
            obj.DisplaceX   = datReader.ReadSingle();
            obj.DisplaceY   = datReader.ReadSingle();
            obj.MinScale    = datReader.ReadSingle();
            obj.MaxScale    = datReader.ReadSingle();
            obj.MaxRotation = datReader.ReadSingle();
            obj.MinSlope    = datReader.ReadSingle();
            obj.MaxSlope    = datReader.ReadSingle();
            obj.Align       = datReader.ReadUInt32();
            obj.Orient      = datReader.ReadUInt32();
            obj.WeenieObj   = datReader.ReadUInt32();

            return(obj);
        }
Example #27
0
        public static SkyObject Read(DatReader datReader)
        {
            SkyObject obj = new SkyObject();

            obj.BeginTime          = datReader.ReadSingle();
            obj.EndTime            = datReader.ReadSingle();
            obj.BeginAngle         = datReader.ReadSingle();
            obj.EndAngle           = datReader.ReadSingle();
            obj.TexVelocityX       = datReader.ReadSingle();
            obj.TexVelocityY       = datReader.ReadSingle();
            obj.DefaultGFXObjectId = datReader.ReadUInt32();
            obj.DefaultPESObjectId = datReader.ReadUInt32();
            obj.Properties         = datReader.ReadUInt32();
            return(obj);
        }
Example #28
0
        public static AttackCone Read(DatReader datReader)
        {
            AttackCone a = new AttackCone();

            a.PartIndex = datReader.ReadUInt32();

            a.LeftX = datReader.ReadSingle();
            a.LeftY = datReader.ReadSingle();

            a.RightX = datReader.ReadSingle();
            a.RightY = datReader.ReadSingle();

            a.Radius = datReader.ReadSingle();
            a.Height = datReader.ReadSingle();
            return(a);
        }
Example #29
0
        public static DayGroup Read(DatReader datReader)
        {
            DayGroup obj = new DayGroup();

            obj.ChanceOfOccur = datReader.ReadSingle();
            obj.DayName       = datReader.ReadPString();
            datReader.AlignBoundary();

            uint num_sky_objects = datReader.ReadUInt32();

            for (uint i = 0; i < num_sky_objects; i++)
            {
                obj.SkyObjects.Add(SkyObject.Read(datReader));
            }

            uint num_sky_times = datReader.ReadUInt32();

            for (uint i = 0; i < num_sky_times; i++)
            {
                obj.SkyTime.Add(SkyTimeOfDay.Read(datReader));
            }

            return(obj);
        }
Example #30
0
        public static SWVertex Read(DatReader datReader)
        {
            SWVertex obj = new SWVertex();

            short num_uvs = datReader.ReadInt16();

            obj.X       = datReader.ReadSingle();
            obj.Y       = datReader.ReadSingle();
            obj.Z       = datReader.ReadSingle();
            obj.NormalX = datReader.ReadSingle();
            obj.NormalY = datReader.ReadSingle();
            obj.NormalZ = datReader.ReadSingle();

            for (short i = 0; i < num_uvs; i++)
            {
                obj.UVs.Add(Vec2Duv.Read(datReader));
            }

            return(obj);
        }