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 RenderInfo() { Origin = new V2(0.0f, 0.0f); Size = new V2(0.0f, 0.0f); Bgf = null; HotspotType = HotSpotType.HOTSPOT_NONE; SubOverlay = null; }
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; lightFlags = BitConverter.ToUInt16(Buffer, cursor); // LightFlags (2 bytes) cursor += TypeSizes.SHORT; if (lightFlags > 0) { lightIntensity = Buffer[cursor]; // LightIntensity (1 byte) cursor++; lightColor = BitConverter.ToUInt16(Buffer, cursor); // LightColor (2 bytes) cursor += TypeSizes.SHORT; } 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); } }
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); }
/// <summary> /// Updates the ViewerParent and ViewerHotspot property. /// </summary> /// <param name="Root">The object this suboverlay belongs to</param> /// <param name="SubOverlays">The current suboverlays of the object</param> public void UpdateHotspots(ObjectBase Root, IList<SubOverlay> SubOverlays) { FrontParent = null; FrontHotspot = null; ViewerParent = null; ViewerHotspot = null; // try find hotspot on active mainoverlay frame if (Root.ViewerFrame != null) ViewerHotspot = Root.ViewerFrame.FindHotspot(hotSpot); // if not found if (ViewerHotspot == null) { // try find on suboverlays foreach (SubOverlay subOv in SubOverlays) { if (subOv.ViewerFrame != null) { ViewerHotspot = subOv.ViewerFrame.FindHotspot(hotSpot); if (ViewerHotspot != null) { ViewerParent = subOv; break; } } } } }
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, StartIndex); ushort coordinateY = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; ushort coordinateX = BitConverter.ToUInt16(Buffer, cursor); cursor += TypeSizes.SHORT; position3D = new V3(coordinateX, 0.0f, coordinateY); angle = MathUtil.BinaryAngleToRadian(BitConverter.ToUInt16(Buffer, cursor)); cursor += TypeSizes.SHORT; if ((AnimationType)Buffer[cursor] == AnimationType.TRANSLATION) // check if there is a colortranslation or effect as 1. anim { motionFirstAnimationType = (AnimationType)Buffer[cursor]; cursor++; motionColorTranslation = Buffer[cursor]; // RoomObjectColorTranslation (1 byte) cursor++; } else if (((AnimationType)Buffer[cursor] == AnimationType.EFFECT)) { motionFirstAnimationType = (AnimationType)Buffer[cursor]; cursor++; motionEffect = Buffer[cursor]; // RoomObjectEffect (1 byte) cursor++; } if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) motionColorTranslation = ColorTransformation.FILTERWHITE90; motionAnimation = Animation.ExtractAnimation(Buffer, cursor); // Animation (n bytes) cursor += motionAnimation.ByteLength; motionAnimation.PropertyChanged += OnMotionAnimationPropertyChanged; byte 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; obj.PropertyChanged += OnMotionSubOverlayPropertyChanged; motionSubOverlays.Add(obj); } return cursor - StartIndex; }
public override unsafe void ReadFrom(ref byte* Buffer) { base.ReadFrom(ref Buffer); ushort coordinateY = *((ushort*)Buffer); Buffer += TypeSizes.SHORT; ushort coordinateX = *((ushort*)Buffer); Buffer += TypeSizes.SHORT; position3D = new V3(coordinateX, 0.0f, coordinateY); angle = MathUtil.BinaryAngleToRadian(*((ushort*)Buffer)); Buffer += TypeSizes.SHORT; if ((AnimationType)Buffer[0] == AnimationType.TRANSLATION) { motionFirstAnimationType = (AnimationType)Buffer[0]; Buffer++; motionColorTranslation = Buffer[0]; Buffer++; } else if (((AnimationType)Buffer[0] == AnimationType.EFFECT)) { motionFirstAnimationType = (AnimationType)Buffer[0]; Buffer++; motionEffect = Buffer[0]; Buffer++; } if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans) motionColorTranslation = ColorTransformation.FILTERWHITE90; motionAnimation = Animation.ExtractAnimation(ref Buffer); motionAnimation.PropertyChanged += OnMotionAnimationPropertyChanged; byte 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; subov.PropertyChanged += OnMotionSubOverlayPropertyChanged; motionSubOverlays.Add(subov); } }
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); } }