Exemplo n.º 1
0
        public cStab(byte[] buffer, StreamReader inputFile)
        {
            id    = Utils.ReadUInt32(buffer, inputFile);
            frame = new sFrame(buffer, inputFile);

            //if (!validPortalDatEntries.isValidStabEntry(id)) //this is not complete, there's some entries that can be converted and aren't in the entry. particles? something else?
            //    id = 0x0200026B;//turbine box
        }
Exemplo n.º 2
0
 public sGeneratorTableEntry(StreamReader inputFile)
 {
     probability = Utils.readSingle(inputFile);
     type        = Utils.readInt32(inputFile);
     delay       = Utils.readDouble(inputFile);
     initCreate  = Utils.readInt32(inputFile);
     maxNum      = Utils.readInt32(inputFile);
     whenCreate  = (eRegenerationType)Utils.readInt32(inputFile);
     whereCreate = (eRegenLocationType)Utils.readInt32(inputFile);
     stackSize   = Utils.readInt32(inputFile);
     ptid        = Utils.readInt32(inputFile);
     shade       = Utils.readInt32(inputFile);
     objcell_id  = Utils.readInt32(inputFile);
     frame       = new sFrame(inputFile);
     slot        = Utils.readInt32(inputFile);
 }
Exemplo n.º 3
0
        public cBuildInfo(byte[] buffer, StreamReader inputFile, eDatFormat format)
        {
            ModelId = Utils.ReadUInt32(buffer, inputFile);

            Frame = new sFrame(buffer, inputFile);

            NumLeaves = Utils.ReadUInt32(buffer, inputFile);

            int portalsCount = Utils.ReadInt32(buffer, inputFile);

            Portals = new List <cCBldPortal>();
            for (int i = 0; i < portalsCount; i++)
            {
                cCBldPortal newPortal = new cCBldPortal(buffer, inputFile, format);
                Portals.Add(newPortal);
            }
        }
Exemplo n.º 4
0
 public sPosStat(StreamReader inputFile)
 {
     key        = Utils.readInt32(inputFile);
     objcell_id = Utils.readUInt32(inputFile);
     frame      = new sFrame(inputFile);
 }
Exemplo n.º 5
0
 public sPosition(StreamReader inputFile)
 {
     objcell_id = Utils.readUInt32(inputFile);
     frame      = new sFrame(inputFile);
 }
Exemplo n.º 6
0
        public cEnvCell(byte[] buffer, StreamReader inputFile, eDatFormat format, bool translateTextureIds = true)
        {
            if (format == eDatFormat.ToD)
            {
                Id = Utils.ReadUInt32(buffer, inputFile);

                Bitfield = Utils.ReadUInt32(buffer, inputFile);

                Utils.ReadUInt32(buffer, inputFile); //repeat id
            }
            else if (format == eDatFormat.retail)
            {
                Bitfield = Utils.ReadUInt32(buffer, inputFile);
                Id       = Utils.ReadUInt32(buffer, inputFile);
            }

            byte   numSurfaces = Utils.ReadByte(buffer, inputFile);
            byte   numPortals  = Utils.ReadByte(buffer, inputFile);   // Note that "portal" in this context does not refer to the swirly pink/purple thing, its basically connecting cells
            ushort numCells    = Utils.ReadUInt16(buffer, inputFile); // I believe this is what cells can be seen from this one. So the engine knows what else it needs to load/draw.

            Textures = new List <ushort>();
            // Read what surfaces are used in this cell
            for (uint i = 0; i < numSurfaces; i++)
            {
                ushort texture = Utils.ReadUInt16(buffer, inputFile);

                if (translateTextureIds)
                {
                    if (format == eDatFormat.ToD)
                    {
                        Textures.Add(texture);
                    }
                    else
                    {
                        Textures.Add(validPortalDatEntries.translateTextureId(texture));
                    }
                }
                else
                {
                    Textures.Add(texture);
                }
            }

            if (format == eDatFormat.retail)
            {
                Utils.Align(inputFile);
            }

            EnvironmentId = Utils.ReadUInt16(buffer, inputFile);

            StructId = Utils.ReadUInt16(buffer, inputFile);

            Position = new sFrame(buffer, inputFile);

            Portals = new List <cCellPortal>();
            for (int i = 0; i < numPortals; i++)
            {
                cCellPortal newPortal = new cCellPortal(buffer, inputFile);
                Portals.Add(newPortal);
            }

            if (format == eDatFormat.retail)
            {
                Utils.Align(inputFile);
            }

            Cells = new List <ushort>();
            for (uint i = 0; i < numCells; i++)
            {
                Cells.Add(Utils.ReadUInt16(buffer, inputFile));
            }

            if (format == eDatFormat.retail)
            {
                Utils.Align(inputFile);
            }

            Stabs = new List <cStab>();
            if ((Bitfield & 2) != 0)
            {
                int numStabs = Utils.ReadInt32(buffer, inputFile);

                for (int i = 0; i < numStabs; i++)
                {
                    //cStab Size is 32
                    cStab newStab = new cStab(buffer, inputFile);
                    Stabs.Add(newStab);
                }
            }

            if (format == eDatFormat.retail)
            {
                Utils.Align(inputFile);
            }

            if ((Bitfield & 8) != 0)
            {
                RestrictionObj = Utils.ReadUInt32(buffer, inputFile);
            }

            if (inputFile.BaseStream.Position != inputFile.BaseStream.Length)
            {
                throw new Exception();
            }
        }
Exemplo n.º 7
0
 public sPosStat(byte[] buffer, StreamReader inputFile)
 {
     key        = Utils.ReadInt32(buffer, inputFile);
     objcell_id = Utils.ReadUInt32(buffer, inputFile);
     frame      = new sFrame(buffer, inputFile);
 }
Exemplo n.º 8
0
 public sPosition(byte[] buffer, StreamReader inputFile)
 {
     objcell_id = Utils.ReadUInt32(buffer, inputFile);
     frame      = new sFrame(buffer, inputFile);
 }