public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            ServerID = BitConverter.ToInt16(Buffer, cursor);
            cursor  += TypeSizes.SHORT;

            FloorTexture = BitConverter.ToUInt16(Buffer, cursor);
            cursor      += TypeSizes.SHORT;

            CeilingTexture = BitConverter.ToUInt16(Buffer, cursor);
            cursor        += TypeSizes.SHORT;

            TextureX = BitConverter.ToInt16(Buffer, cursor);
            cursor  += TypeSizes.SHORT;

            TextureY = BitConverter.ToInt16(Buffer, cursor);
            cursor  += TypeSizes.SHORT;

            FloorHeight = (Real)BitConverter.ToInt16(Buffer, cursor);
            cursor     += TypeSizes.SHORT;

            CeilingHeight = (Real)BitConverter.ToInt16(Buffer, cursor);
            cursor       += TypeSizes.SHORT;

            Light1 = Buffer[cursor];
            cursor++;

            Flags   = new RooSectorFlags(BitConverter.ToUInt32(Buffer, cursor));
            cursor += TypeSizes.INT;

            if (HasSpeed)
            {
                Speed = Buffer[cursor];
                cursor++;
            }

            // Check for attached subinfo
            if (Flags.IsSlopedFloor)
            {
                SlopeInfoFloor = new RooSectorSlopeInfo(RooVersion, Buffer, cursor);
                cursor        += SlopeInfoFloor.ByteLength;
            }
            if (Flags.IsSlopedCeiling)
            {
                SlopeInfoCeiling = new RooSectorSlopeInfo(RooVersion, Buffer, cursor);
                cursor          += SlopeInfoCeiling.ByteLength;
            }

            return(cursor - StartIndex);
        }
        public unsafe void ReadFrom(ref byte *Buffer)
        {
            ServerID = *((short *)Buffer);
            Buffer  += TypeSizes.SHORT;

            FloorTexture = *((ushort *)Buffer);
            Buffer      += TypeSizes.SHORT;

            CeilingTexture = *((ushort *)Buffer);
            Buffer        += TypeSizes.SHORT;

            TextureX = *((short *)Buffer);
            Buffer  += TypeSizes.SHORT;

            TextureY = *((short *)Buffer);
            Buffer  += TypeSizes.SHORT;

            FloorHeight = (Real)(*((short *)Buffer));
            Buffer     += TypeSizes.SHORT;

            CeilingHeight = (Real)(*((short *)Buffer));
            Buffer       += TypeSizes.SHORT;

            Light1 = Buffer[0];
            Buffer++;

            Flags   = new RooSectorFlags(*((uint *)Buffer));
            Buffer += TypeSizes.INT;

            if (HasSpeed)
            {
                Speed = Buffer[0];
                Buffer++;
            }

            // Check for attached subinfo
            if (Flags.IsSlopedFloor)
            {
                SlopeInfoFloor = new RooSectorSlopeInfo(RooVersion, ref Buffer);
            }

            if (Flags.IsSlopedCeiling)
            {
                SlopeInfoCeiling = new RooSectorSlopeInfo(RooVersion, ref Buffer);
            }
        }
Example #3
0
        public unsafe void ReadFrom(ref byte* Buffer)
        {
            ServerID = *((short*)Buffer);
            Buffer += TypeSizes.SHORT;

            FloorTexture = *((ushort*)Buffer);
            Buffer += TypeSizes.SHORT;

            CeilingTexture = *((ushort*)Buffer);
            Buffer += TypeSizes.SHORT;

            TextureX = *((short*)Buffer);
            Buffer += TypeSizes.SHORT;

            TextureY = *((short*)Buffer);
            Buffer += TypeSizes.SHORT;

            FloorHeight = (Real)(*((short*)Buffer));
            Buffer += TypeSizes.SHORT;

            CeilingHeight = (Real)(*((short*)Buffer));
            Buffer += TypeSizes.SHORT;

            Light1 = Buffer[0];
            Buffer++;

            Flags = new RooSectorFlags(*((uint*)Buffer));
            Buffer += TypeSizes.INT;

            if (HasSpeed)
            {
                Speed = Buffer[0];
                Buffer++;
            }

            // Check for attached subinfo
            if (Flags.IsSlopedFloor)           
                SlopeInfoFloor = new RooSectorSlopeInfo(RooVersion, ref Buffer);
                           
            if (Flags.IsSlopedCeiling)
                SlopeInfoCeiling = new RooSectorSlopeInfo(RooVersion, ref Buffer);
        }
Example #4
0
        public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            ServerID = BitConverter.ToInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            FloorTexture = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            CeilingTexture = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            TextureX = BitConverter.ToInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            TextureY = BitConverter.ToInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            FloorHeight = (Real)BitConverter.ToInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            CeilingHeight = (Real)BitConverter.ToInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            Light1 = Buffer[cursor];
            cursor++ ;

            Flags = new RooSectorFlags(BitConverter.ToUInt32(Buffer, cursor));
            cursor += TypeSizes.INT;

            if (HasSpeed)
            {
                Speed = Buffer[cursor];
                cursor++;
            }
            
            // Check for attached subinfo
            if (Flags.IsSlopedFloor)
            {
                SlopeInfoFloor = new RooSectorSlopeInfo(RooVersion, Buffer, cursor);
                cursor += SlopeInfoFloor.ByteLength;
            }
            if (Flags.IsSlopedCeiling)
            {
                SlopeInfoCeiling = new RooSectorSlopeInfo(RooVersion, Buffer, cursor);
                cursor += SlopeInfoCeiling.ByteLength;
            }

            return cursor - StartIndex;
        }