public unsafe void ReadFrom(ref byte *Buffer) { resourceID = *((uint *)Buffer); Buffer += TypeSizes.INT; hotSpot = Buffer[0]; Buffer++; if ((AnimationType)Buffer[0] == AnimationType.TRANSLATION) // check if the next byte is animationtype { firstAnimationType = (AnimationType)Buffer[0]; Buffer++; colorTranslation = Buffer[0]; Buffer++; } else if ((AnimationType)Buffer[0] == AnimationType.EFFECT) { firstAnimationType = (AnimationType)Buffer[0]; Buffer++; effect = Buffer[0]; Buffer++; } animation = Animation.ExtractAnimation(ref Buffer); animation.PropertyChanged += OnAnimationPropertyChanged; }
public override unsafe void ReadFrom(ref byte *Buffer) { base.ReadFrom(ref Buffer); nameRID = *((uint *)Buffer); Buffer += TypeSizes.INT; overlayFileRID = *((uint *)Buffer); Buffer += TypeSizes.INT; if ((AnimationType)Buffer[0] == AnimationType.TRANSLATION) { firstAnimationType = (AnimationType)Buffer[0]; Buffer++; colorTranslation = Buffer[0]; Buffer++; } else if (((AnimationType)Buffer[0] == AnimationType.EFFECT)) { firstAnimationType = (AnimationType)Buffer[0]; Buffer++; effect = Buffer[0]; Buffer++; } animation = Animation.ExtractAnimation(ref Buffer); angle = *((ushort *)Buffer); Buffer += TypeSizes.SHORT; height = *((short *)Buffer); Buffer += TypeSizes.SHORT; }
public int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; this.resourceID = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; this.hotSpot = Buffer[cursor]; cursor++; if ((AnimationType)Buffer[cursor] == AnimationType.TRANSLATION) // check if the next byte is animationtype { // TRANSLATION or EFFECT firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; colorTranslation = Buffer[cursor]; // Translation (1 byte) cursor++; } else if (((AnimationType)Buffer[cursor] == AnimationType.EFFECT)) { firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; effect = Buffer[cursor]; // Effect (1 byte) cursor++; } // extract animation this.animation = Animation.ExtractAnimation(Buffer, cursor); animation.PropertyChanged += OnAnimationPropertyChanged; cursor += this.animation.ByteLength; return(cursor - StartIndex); }
public override unsafe void ReadFrom(ref byte *Buffer) { base.ReadFrom(ref Buffer); overlayFileRID = *((uint *)Buffer); Buffer += TypeSizes.INT; nameRID = *((uint *)Buffer); Buffer += TypeSizes.INT; flags.ReadFrom(ref Buffer); if (HasLight) { lightingInfo.ReadFrom(ref Buffer); } if ((AnimationType)Buffer[0] == AnimationType.TRANSLATION) { firstAnimationType = (AnimationType)Buffer[0]; Buffer++; colorTranslation = Buffer[0]; Buffer++; } else if (((AnimationType)Buffer[0] == AnimationType.EFFECT)) { firstAnimationType = (AnimationType)Buffer[0]; Buffer++; effect = Buffer[0]; Buffer++; } if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { colorTranslation = ColorTransformation.FILTERWHITE90; } animation = Animation.ExtractAnimation(ref Buffer); animation.PropertyChanged += OnAnimationPropertyChanged; byte subOverlaysCount = Buffer[0]; Buffer++; subOverlays.Clear(); for (byte i = 0; i < subOverlaysCount; i++) { SubOverlay subOverlay = new SubOverlay(ref Buffer); if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { subOverlay.ColorTranslation = ColorTransformation.FILTERWHITE90; } subOverlays.Add(subOverlay); } }
public virtual unsafe void ReadFrom(ref byte *Buffer) { SideDefServerID = *((ushort *)Buffer); Buffer += TypeSizes.SHORT; Animation = Animation.ExtractAnimation(ref Buffer); Action = (RoomAnimationAction)Buffer[0]; Buffer++; }
public int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; overlayFileRID = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; if ((AnimationType)Buffer[cursor] == AnimationType.TRANSLATION) { firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; colorTranslation = Buffer[cursor]; cursor++; } else if (((AnimationType)Buffer[cursor] == AnimationType.EFFECT)) { firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; effect = Buffer[cursor]; cursor++; } animation = Animation.ExtractAnimation(Buffer, cursor); animation.PropertyChanged += animation_PropertyChanged; cursor += animation.ByteLength; source = new ObjectID(Buffer, cursor); cursor += source.ByteLength; target = new ObjectID(Buffer, cursor); cursor += target.ByteLength; speed = Buffer[cursor]; cursor++; flags = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; lightFlags = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; if (lightFlags > 0) { lightIntensity = Buffer[cursor]; cursor++; lightColor = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; } return(cursor - StartIndex); }
public virtual int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; SideDefServerID = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; Animation = Animation.ExtractAnimation(Buffer, cursor); cursor += Animation.ByteLength; Action = (RoomAnimationAction)Buffer[cursor]; cursor++; return(cursor - StartIndex);; }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, StartIndex); nameRID = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; overlayFileRID = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; if ((AnimationType)Buffer[cursor] == AnimationType.TRANSLATION) { firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; colorTranslation = Buffer[cursor]; cursor++; } else if (((AnimationType)Buffer[cursor] == AnimationType.EFFECT)) { firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; effect = Buffer[cursor]; cursor++; } animation = Animation.ExtractAnimation(Buffer, cursor); cursor += animation.ByteLength; angle = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; height = BitConverter.ToInt16(Buffer, cursor); cursor += TypeSizes.SHORT; return(cursor - StartIndex); }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, StartIndex); overlayFileRID = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; nameRID = BitConverter.ToUInt32(Buffer, cursor); cursor += TypeSizes.INT; flags.ReadFrom(Buffer, cursor); cursor += flags.ByteLength; if (HasLight) { lightFlags = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; if (lightFlags > 0) { lightIntensity = Buffer[cursor]; cursor++; lightColor = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; } } if ((AnimationType)Buffer[cursor] == AnimationType.TRANSLATION) { firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; colorTranslation = Buffer[cursor]; cursor++; } else if (((AnimationType)Buffer[cursor] == AnimationType.EFFECT)) { firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; effect = Buffer[cursor]; cursor++; } if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { colorTranslation = ColorTransformation.FILTERWHITE90; } animation = Animation.ExtractAnimation(Buffer, cursor); animation.PropertyChanged += OnAnimationPropertyChanged; cursor += animation.ByteLength; byte subOverlaysCount = Buffer[cursor]; cursor++; subOverlays.Clear(); for (byte i = 0; i < subOverlaysCount; i++) { SubOverlay obj = new SubOverlay(Buffer, cursor); cursor += obj.ByteLength; if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { obj.ColorTranslation = ColorTransformation.FILTERWHITE90; } subOverlays.Add(obj); } return(cursor - StartIndex); }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, cursor); // ObjectID (4/8 bytes) overlayFileRID = BitConverter.ToUInt32(Buffer, cursor); // MainOverlayID (4 bytes) cursor += TypeSizes.INT; nameRID = BitConverter.ToUInt32(Buffer, cursor); // StringID (4 bytes) cursor += TypeSizes.INT; flags.ReadFrom(Buffer, cursor); // Flags (n bytes) cursor += flags.ByteLength; lightingInfo.ReadFrom(Buffer, cursor); // Lighting info (n bytes) cursor += lightingInfo.ByteLength; if ((AnimationType)Buffer[cursor] == AnimationType.TRANSLATION) // check if there is a translation or effect for object { firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; colorTranslation = Buffer[cursor]; // ColorTranslation (1 byte) cursor++; } else if ((AnimationType)Buffer[cursor] == AnimationType.EFFECT) { firstAnimationType = (AnimationType)Buffer[cursor]; cursor++; effect = Buffer[cursor]; // Effect (1 byte) cursor++; } if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { colorTranslation = ColorTransformation.FILTERWHITE90; } animation = Animation.ExtractAnimation(Buffer, cursor); // Animation (n bytes) cursor += animation.ByteLength; byte subOverlaysCount = Buffer[cursor]; // Suboverlaycount (1 byte) cursor++; subOverlays.Clear(); for (byte i = 0; i < subOverlaysCount; i++) // ObjectSuboverlays (n bytes) { SubOverlay obj = new SubOverlay(Buffer, cursor); cursor += obj.ByteLength; if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { obj.ColorTranslation = ColorTransformation.FILTERWHITE90; } subOverlays.Add(obj); } if ((AnimationType)Buffer[cursor] == AnimationType.TRANSLATION) // check if there is a translation or effect for roomobject { motionFirstAnimationType = (AnimationType)Buffer[cursor]; cursor++; motionColorTranslation = Buffer[cursor]; // ColorTranslation (1 byte) cursor++; } else if ((AnimationType)Buffer[cursor] == AnimationType.EFFECT) { motionFirstAnimationType = (AnimationType)Buffer[cursor]; cursor++; motionEffect = Buffer[cursor]; // Effect (1 byte) cursor++; } if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { motionColorTranslation = ColorTransformation.FILTERWHITE90; } motionAnimation = Animation.ExtractAnimation(Buffer, cursor); // Animation (n bytes) cursor += motionAnimation.ByteLength; subOverlaysCount = Buffer[cursor]; // RoomObjectSubOverlaysCount (1 byte) cursor++; motionSubOverlays.Clear(); for (byte i = 0; i < subOverlaysCount; i++) { SubOverlay obj = new SubOverlay(Buffer, cursor); cursor += obj.ByteLength; if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { obj.ColorTranslation = ColorTransformation.FILTERWHITE90; } motionSubOverlays.Add(obj); } return(cursor - StartIndex); }
public override unsafe void ReadFrom(ref byte *Buffer) { base.ReadFrom(ref Buffer); overlayFileRID = *((uint *)Buffer); Buffer += TypeSizes.INT; nameRID = *((uint *)Buffer); Buffer += TypeSizes.INT; flags.ReadFrom(ref Buffer); lightFlags = *((ushort *)Buffer); Buffer += TypeSizes.SHORT; if (lightFlags > 0) { lightIntensity = Buffer[0]; Buffer++; lightColor = *((ushort *)Buffer); Buffer += TypeSizes.SHORT; } if ((AnimationType)Buffer[0] == AnimationType.TRANSLATION) { firstAnimationType = (AnimationType)Buffer[0]; Buffer++; colorTranslation = Buffer[0]; Buffer++; if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { colorTranslation = ColorTransformation.FILTERWHITE90; } } else if ((AnimationType)Buffer[0] == AnimationType.EFFECT) { firstAnimationType = (AnimationType)Buffer[0]; Buffer++; effect = Buffer[0]; Buffer++; } animation = Animation.ExtractAnimation(ref Buffer); byte subOverlaysCount = Buffer[0]; Buffer++; subOverlays.Clear(); for (byte i = 0; i < subOverlaysCount; i++) { SubOverlay subOv = new SubOverlay(ref Buffer); if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { subOv.ColorTranslation = ColorTransformation.FILTERWHITE90; } subOverlays.Add(subOv); } if ((AnimationType)Buffer[0] == AnimationType.TRANSLATION) { motionFirstAnimationType = (AnimationType)Buffer[0]; Buffer++; motionColorTranslation = Buffer[0]; Buffer++; if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { motionColorTranslation = ColorTransformation.FILTERWHITE90; } } else if ((AnimationType)Buffer[0] == AnimationType.EFFECT) { motionFirstAnimationType = (AnimationType)Buffer[0]; Buffer++; motionEffect = Buffer[0]; Buffer++; } motionAnimation = Animation.ExtractAnimation(ref Buffer); subOverlaysCount = Buffer[0]; Buffer++; motionSubOverlays.Clear(); for (byte i = 0; i < subOverlaysCount; i++) { SubOverlay subOv = new SubOverlay(ref Buffer); if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) { subOv.ColorTranslation = ColorTransformation.FILTERWHITE90; } motionSubOverlays.Add(subOv); } }