public override void Pack(BinaryWriter writer)
 {
     writer.Write(ObjectID);
     ObjDesc.Pack(writer);
     PhysicsDesc.Pack(writer);
     Wdesc.Pack(writer);
 }
 public override void Unpack(BinaryReader reader)
 {
     base.Unpack(reader);
     ObjectID = reader.ReadUInt32();
     ObjDesc.Unpack(reader);
     PhysicsDesc.Unpack(reader);
     Wdesc.Unpack(reader);
 }
        public static UpdateObject read(BinaryReader binaryReader)
        {
            UpdateObject newObj = new UpdateObject();

            newObj.object_id   = binaryReader.ReadUInt32();
            newObj.objdesc     = ObjDesc.read(binaryReader);
            newObj.physicsdesc = PhysicsDesc.read(binaryReader);
            newObj.wdesc       = PublicWeenieDesc.read(binaryReader);
            return(newObj);
        }
 public static bool GetValidLocations(PhysicsDesc desc)
 {
     return(false);
 }
        public List <string> packedItems; // For display purposes

        public static PhysicsDesc read(BinaryReader binaryReader)
        {
            PhysicsDesc newObj = new PhysicsDesc();

            newObj.packedItems = new List <string>();
            newObj.bitfield    = binaryReader.ReadUInt32();
            newObj.state       = binaryReader.ReadUInt32();

            if ((newObj.bitfield & (uint)PhysicsDescInfo.MOVEMENT) != 0)
            {
                // Note: the client uses the MOVEMENT_TS and SERVER_CONTROLLED_MOVE_TS from the timestamps array
                // in addition to the following movement data. See SmartBox::HandleCreateObject.
                newObj.buff_length         = binaryReader.ReadUInt32();
                newObj.movement_buffer     = CM_Movement.MovementDataUnpack.read(binaryReader);
                newObj.autonomous_movement = binaryReader.ReadInt32();
                newObj.packedItems.Add(PhysicsDescInfo.MOVEMENT.ToString());
            }
            else if ((newObj.bitfield & (uint)PhysicsDescInfo.ANIMFRAME_ID) != 0)
            {
                newObj.animframe_id = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PhysicsDescInfo.ANIMFRAME_ID.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.POSITION) != 0)
            {
                newObj.pos = Position.read(binaryReader);
                newObj.packedItems.Add(PhysicsDescInfo.POSITION.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.MTABLE) != 0)
            {
                newObj.mtable_id = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PhysicsDescInfo.MTABLE.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.STABLE) != 0)
            {
                newObj.stable_id = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PhysicsDescInfo.STABLE.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.PETABLE) != 0)
            {
                newObj.phstable_id = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PhysicsDescInfo.PETABLE.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.CSetup) != 0)
            {
                newObj.setup_id = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PhysicsDescInfo.CSetup.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.PARENT) != 0)
            {
                newObj.parent_id   = binaryReader.ReadUInt32();
                newObj.location_id = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PhysicsDescInfo.PARENT.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.CHILDREN) != 0)
            {
                uint num_children = binaryReader.ReadUInt32();
                for (int i = 0; i < num_children; ++i)
                {
                    newObj.children.Add(ChildInfo.read(binaryReader));
                }
                newObj.packedItems.Add(PhysicsDescInfo.CHILDREN.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.OBJSCALE) != 0)
            {
                newObj.object_scale = binaryReader.ReadSingle();
                newObj.packedItems.Add(PhysicsDescInfo.OBJSCALE.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.FRICTION) != 0)
            {
                newObj.friction = binaryReader.ReadSingle();
                newObj.packedItems.Add(PhysicsDescInfo.FRICTION.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.ELASTICITY) != 0)
            {
                newObj.elasticity = binaryReader.ReadSingle();
                newObj.packedItems.Add(PhysicsDescInfo.ELASTICITY.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.TRANSLUCENCY) != 0)
            {
                newObj.translucency = binaryReader.ReadSingle();
                newObj.packedItems.Add(PhysicsDescInfo.TRANSLUCENCY.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.VELOCITY) != 0)
            {
                newObj.velocity.x = binaryReader.ReadSingle();
                newObj.velocity.y = binaryReader.ReadSingle();
                newObj.velocity.z = binaryReader.ReadSingle();
                newObj.packedItems.Add(PhysicsDescInfo.VELOCITY.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.ACCELERATION) != 0)
            {
                newObj.acceleration.x = binaryReader.ReadSingle();
                newObj.acceleration.y = binaryReader.ReadSingle();
                newObj.acceleration.z = binaryReader.ReadSingle();
                newObj.packedItems.Add(PhysicsDescInfo.ACCELERATION.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.OMEGA) != 0)
            {
                newObj.omega.x = binaryReader.ReadSingle();
                newObj.omega.y = binaryReader.ReadSingle();
                newObj.omega.z = binaryReader.ReadSingle();
                newObj.packedItems.Add(PhysicsDescInfo.OMEGA.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.DEFAULT_SCRIPT) != 0)
            {
                newObj.default_script = (PScriptType)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PhysicsDescInfo.DEFAULT_SCRIPT.ToString());
            }

            if ((newObj.bitfield & (uint)PhysicsDescInfo.DEFAULT_SCRIPT_INTENSITY) != 0)
            {
                newObj.default_script_intensity = binaryReader.ReadSingle();
                newObj.packedItems.Add(PhysicsDescInfo.DEFAULT_SCRIPT_INTENSITY.ToString());
            }

            for (int i = 0; i < newObj.timestamps.Length; ++i)
            {
                newObj.timestamps[i] = binaryReader.ReadUInt16();
            }

            Util.readToAlign(binaryReader);

            return(newObj);
        }
Beispiel #6
0
 public static uint GetGlobalTradeRoomID(PhysicsDesc desc)
 {
     return(0);
 }