public SpellObject(
     uint ID, 
     uint Count,            
     uint OverlayFileRID,
     uint NameRID, 
     uint Flags,
     ushort LightFlags, 
     byte LightIntensity, 
     ushort LightColor, 
     AnimationType FirstAnimationType, 
     byte ColorTranslation, 
     byte Effect, 
     Animation Animation, 
     BaseList<SubOverlay> SubOverlays,                      
     byte TargetsCount,
     SchoolType SchoolType)
     : base(ID, Count, 
         OverlayFileRID, NameRID, Flags, 
         LightFlags, LightIntensity, LightColor, 
         FirstAnimationType, ColorTranslation, Effect, 
         Animation, SubOverlays)
 {
     this.targetsCount = TargetsCount;
     this.schoolType = SchoolType;
 }
 public TradeOfferObject(
     uint ID,
     uint Count, 
     uint OverlayFileRID, 
     uint NameRID, 
     uint Flags,
     ushort LightFlags, 
     byte LightIntensity, 
     ushort LightColor, 
     AnimationType FirstAnimationType, 
     byte ColorTranslation, 
     byte Effect,
     Animation Animation, 
     BaseList<SubOverlay> SubOverlays,            
     uint Price)
     : base(ID, Count, OverlayFileRID, NameRID, Flags, 
         LightFlags, LightIntensity, LightColor, 
         FirstAnimationType, ColorTranslation, Effect, 
         Animation, SubOverlays)
 {
     this.price = Price;
 }
        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 SubOverlay(uint ResourceID, Animation LinkedAnimation, byte HotSpotIndex, byte ColorTranslation, byte Effect)
        {
            this.resourceID = ResourceID;
            this.animation = LinkedAnimation;
            this.hotSpot = HotSpotIndex;

            if ((ColorTranslation != 0x00) && (Effect == 0x00))
            {
                firstAnimationType = AnimationType.TRANSLATION;
                this.colorTranslation = ColorTranslation;
            }
            else if ((ColorTranslation == 0x00) && (Effect != 0x00))
            {
                firstAnimationType = AnimationType.EFFECT;
                this.effect = Effect;
            }
            else if ((ColorTranslation == 0x00) && (Effect == 0x00))
            {
                firstAnimationType = AnimationType.TRANSLATION;
                this.colorTranslation = 0x00;
            }
            else
                throw new Exception("Don't set Translation AND Effect at same time");
        }
 public virtual void Clear(bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         ResourceID = 0;
         HotSpot = 0;
         FirstAnimationType = 0;
         ColorTranslation = 0;
         Effect = 0;
         Animation = new AnimationNone();
         Name = String.Empty;
     }
     else
     {
         resourceID = 0;
         hotSpot = 0;
         firstAnimationType = 0;
         colorTranslation = 0;
         effect = 0;
         animation = new AnimationNone();
         name = String.Empty;
     }
 }
        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 void Clear(bool RaiseChangedEvent)
        {
            if (RaiseChangedEvent)
            {
                OverlayFileRID = 0;
                FirstAnimationType = 0;
                ColorTranslation = 0;
                Effect = 0;
                Animation = new AnimationNone();
                Source = new ObjectID(0);
                Target = new ObjectID(0);
                Speed = 0;
                Flags = 0;
                LightFlags = 0;
                LightIntensity = 0;
                LightColor = 0;

                OverlayFile = String.Empty;
            }
            else
            {
                overlayFileRID = 0;
                firstAnimationType = 0;
                colorTranslation = 0;
                effect = 0;
                animation = new AnimationNone();
                source = new ObjectID(0);
                target = new ObjectID(0);
                speed = 0;
                flags = 0;
                lightFlags = 0;
                lightIntensity = 0;
                lightColor = 0;

                overlayFile = String.Empty;
            }
        }
 public PlayerOverlay(
     uint ID,
     uint Count, 
     uint OverlayFileRID, 
     uint NameRID, 
     uint Flags,
     ushort LightFlags, 
     byte LightIntensity, 
     ushort LightColor, 
     AnimationType FirstAnimationType, 
     byte ColorTranslation, 
     byte Effect,
     Animation Animation, 
     BaseList<SubOverlay> SubOverlays,
     PlayerOverlayHotspot RenderPosition)        
     : base(
         ID, Count, OverlayFileRID, NameRID, Flags, 
         LightFlags, LightIntensity, LightColor, 
         FirstAnimationType, ColorTranslation, Effect, 
         Animation, SubOverlays, false)
 {
     renderPosition = RenderPosition;
 }
        public unsafe override 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);
            }
        }
Beispiel #10
0
        public override void Clear(bool RaiseChangedEvent)
        {
            base.Clear(RaiseChangedEvent);

            if (RaiseChangedEvent)
            {
                OverlayFileRID = 0;
                NameRID = 0;               
                LightFlags = 0;
                LightIntensity = 0;
                LightColor = 0;
                FirstAnimationType = 0;
                ColorTranslation = 0;
                Effect = 0;
                Animation = new AnimationNone();

                MotionFirstAnimationType = 0;
                MotionColorTranslation = 0;
                MotionEffect = 0;
                MotionAnimation = new AnimationNone();

                Name = String.Empty;
                OverlayFile = String.Empty;
            }
            else
            {
                overlayFileRID = 0;
                nameRID = 0;
                lightFlags = 0;
                lightIntensity = 0;
                lightColor = 0;
                firstAnimationType = 0;
                colorTranslation = 0;
                effect = 0;
                animation = new AnimationNone();
                
                motionFirstAnimationType = 0;
                motionColorTranslation = 0;
                motionEffect = 0;
                motionAnimation = new AnimationNone();
                
                name = String.Empty;
                overlayFile = String.Empty;
            }

            flags.Clear(RaiseChangedEvent);
            subOverlays.Clear();
            motionSubOverlays.Clear();
        }
Beispiel #11
0
        public override void UpdateFromModel(ObjectUpdate Model, bool RaiseChangedEvent)
        {
            base.UpdateFromModel(Model, RaiseChangedEvent);

            if (RaiseChangedEvent)
            {      
                MotionFirstAnimationType = Model.MotionFirstAnimationType;
                MotionColorTranslation = Model.MotionColorTranslation;
                MotionEffect = Model.MotionEffect;

                if (MotionAnimation != null)
                    MotionAnimation.PropertyChanged -= OnMotionAnimationPropertyChanged;

                MotionAnimation = Model.MotionAnimation;
                MotionAnimation.PropertyChanged += OnMotionAnimationPropertyChanged;
                
                MotionSubOverlays.Clear();
                MotionSubOverlays.AddRange(Model.MotionSubOverlays);
            }
            else
            {
                motionFirstAnimationType = Model.MotionFirstAnimationType;
                motionColorTranslation = Model.MotionColorTranslation;
                motionEffect = Model.MotionEffect;

                if (motionAnimation != null)
                    motionAnimation.PropertyChanged -= OnMotionAnimationPropertyChanged;

                motionAnimation = Model.MotionAnimation;
                motionAnimation.PropertyChanged += OnMotionAnimationPropertyChanged;
                
                foreach (SubOverlay obj in motionSubOverlays)
                    obj.PropertyChanged -= OnMotionSubOverlayPropertyChanged;

                motionSubOverlays.Clear();
                motionSubOverlays.AddRange(Model.MotionSubOverlays);
            }

            // update appearance
            ProcessAppearance(true);
        }
 /// <summary>
 /// Constructor by values
 /// </summary>
 /// <param name="ID"></param>
 /// <param name="Count"></param>
 /// <param name="OverlayFileRID"></param>
 /// <param name="NameRID"></param>
 /// <param name="Flags"></param>
 /// <param name="LightFlags"></param>
 /// <param name="LightIntensity"></param>
 /// <param name="LightColor"></param>
 /// <param name="FirstAnimationType"></param>
 /// <param name="ColorTranslation"></param>
 /// <param name="Effect"></param>
 /// <param name="Animation"></param>
 /// <param name="SubOverlays"></param>
 /// <param name="IsInUse"></param>
 public InventoryObject(
     uint ID,
     uint Count,           
     uint OverlayFileRID,
     uint NameRID, 
     uint Flags,
     ushort LightFlags, 
     byte LightIntensity, 
     ushort LightColor, 
     AnimationType FirstAnimationType, 
     byte ColorTranslation, 
     byte Effect, 
     Animation Animation, 
     BaseList<SubOverlay> SubOverlays,
     bool IsInUse
     )            
     : base(
         ID, Count, 
         OverlayFileRID, NameRID, Flags, 
         LightFlags, LightIntensity, LightColor, 
         FirstAnimationType, ColorTranslation, Effect, Animation, SubOverlays)
 {
     this.isInUse = IsInUse;            
 }
Beispiel #13
0
        /// <summary>
        /// Resets the object to default state/values
        /// </summary>
        /// <param name="RaiseChangedEvent"></param>
        public override void Clear(bool RaiseChangedEvent)
        {
            base.Clear(RaiseChangedEvent);

            if (RaiseChangedEvent)
            {
                Position3D = new V3(0, 0, 0);
                Angle = 0.0f;
                MotionFirstAnimationType = 0;
                MotionColorTranslation = 0;
                MotionEffect = 0;

                if (motionAnimation != null)
                    motionAnimation.PropertyChanged -= OnMotionAnimationPropertyChanged;

                MotionAnimation = new AnimationNone();
                MotionAnimation.PropertyChanged += OnMotionAnimationPropertyChanged;

                motionSubOverlays.Clear();
                
                IsMoving = false;
                IsTarget = false;
                IsHighlighted = false;
                VerticalSpeed = 0.0f;
            }
            else
            {
                position3D = new V3(0, 0, 0);
                angle = 0.0f;
                motionFirstAnimationType = 0;
                motionColorTranslation = 0;
                motionEffect = 0;

                if (motionAnimation != null)
                    motionAnimation.PropertyChanged -= OnMotionAnimationPropertyChanged;

                motionAnimation = new AnimationNone();
                motionAnimation.PropertyChanged += OnMotionAnimationPropertyChanged;

                motionSubOverlays.Clear();
                
                isMoving = false;
                isTarget = false;
                isHighlighted = false;
                verticalSpeed = 0.0f;
            }
        }
Beispiel #14
0
        public RoomObject(
            uint ID,
            uint Count,           
            uint OverlayFileRID,
            uint NameRID, 
            uint Flags,
            ushort LightFlags, 
            byte LightIntensity, 
            ushort LightColor, 
            AnimationType FirstAnimationType, 
            byte ColorTranslation, 
            byte Effect, 
            Animation Animation, 
            IEnumerable<SubOverlay> SubOverlays,            
            V3 Position3D,
            ushort Angle, 
            AnimationType MotionFirstAnimationType, 
            byte MotionColorTranslation, 
            byte MotionEffect, 
            Animation MotionAnimation, 
            IEnumerable<SubOverlay> MotionSubOverlays)            
            : base(
                ID, Count, 
                OverlayFileRID, NameRID, Flags, 
                LightFlags, LightIntensity, LightColor, 
                FirstAnimationType, ColorTranslation, Effect, Animation, SubOverlays)
        {
            // attach motionsuboverlays listener
            motionSubOverlays.ListChanged += OnMotionSubOverlaysListChanged;

            // coordinates & angle
            position3D = Position3D;
            angle = Angle;

            // roomobject stuff (like object)
            motionFirstAnimationType = MotionFirstAnimationType;
            motionColorTranslation = MotionColorTranslation;
            motionEffect = MotionEffect;
            motionAnimation = MotionAnimation;
            motionAnimation.PropertyChanged += OnMotionAnimationPropertyChanged;

            // special handling for secondtrans
            if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans)
            {
                motionColorTranslation = ColorTransformation.FILTERWHITE90;

                foreach (SubOverlay subOv in MotionSubOverlays)
                    subOv.ColorTranslation = ColorTransformation.FILTERWHITE90;
            }

            // motionsuboverlays
            motionSubOverlays.AddRange(MotionSubOverlays);
        }
Beispiel #15
0
 protected void CreateAnimation()
 {
     // setup cycle animation
     if (Speed != 0)
     {
         int period = 10000 / Speed;
         this.Animation = new AnimationCycle((uint)period, 1, 1);
     }
     // scroll animation
     else if (Flags.ScrollSpeed != TextureScrollSpeed.NONE)
     {
         Speed = (byte)Flags.ScrollSpeed;
         // we handle this with internal mogre texture scrolling atm
     }
 }
        public unsafe override 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 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 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 WallAnimateMessage(ushort SideDefServerID, Animation Animation, RoomAnimationAction Action) 
     : base(MessageTypeGameMode.WallAnimate)
 {
     this.SideDefServerID = SideDefServerID;
     this.Animation = Animation;
     this.Action = Action;                                          
 }
Beispiel #20
0
        public ObjectUpdate(
            uint ID, 
            uint Count = 0,             
            uint OverlayFileRID = 0, 
            uint NameRID = 0, 
            uint Flags = 0,
            ushort LightFlags = 0, 
            byte LightIntensity = 0, 
            ushort LightColor = 0, 
            AnimationType FirstAnimationType = 0, 
            byte ColorTranslation = 0, 
            byte Effect = 0, 
            Animation Animation = null, 
            IEnumerable<SubOverlay> SubOverlays = null,            
            AnimationType MotionFirstAnimationType = 0, 
            byte MotionColorTranslation = 0, 
            byte MotionEffect = 0, 
            Animation MotionAnimation = null, 
            IEnumerable<SubOverlay> MotionSubOverlays = null)
            : base(ID, Count)
        {
            this.overlayFileRID = OverlayFileRID;
            this.nameRID = NameRID;
            this.flags.Value = Flags;
            this.lightFlags = LightFlags;
            this.lightIntensity = LightIntensity;
            this.lightColor = LightColor;
            this.firstAnimationType = FirstAnimationType;
            this.colorTranslation = ColorTranslation;

            // special handling for secondtrans
            if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans)
            {
                colorTranslation = ColorTransformation.FILTERWHITE90;

                foreach (SubOverlay subOv in SubOverlays)
                    subOv.ColorTranslation = ColorTransformation.FILTERWHITE90;
            }

            this.effect = Effect;
            this.animation = Animation;

            if (SubOverlays != null)
                this.subOverlays.AddRange(SubOverlays);

            this.motionFirstAnimationType = MotionFirstAnimationType;
            this.motionColorTranslation = MotionColorTranslation;

            // special handling for secondtrans
            if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans)
            {
                motionColorTranslation = ColorTransformation.FILTERWHITE90;

                foreach (SubOverlay subOv in MotionSubOverlays)
                    subOv.ColorTranslation = ColorTransformation.FILTERWHITE90;
            }

            this.motionEffect = MotionEffect;
            this.motionAnimation = MotionAnimation;

            if (MotionSubOverlays != null)
                this.motionSubOverlays.AddRange(MotionSubOverlays);
        }
Beispiel #21
0
        /// <summary>
        /// Constructor by values
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Count"></param>
        /// <param name="OverlayFileRID"></param>
        /// <param name="NameRID"></param>
        /// <param name="Flags"></param>
        /// <param name="LightFlags"></param>
        /// <param name="LightIntensity"></param>
        /// <param name="LightColor"></param>
        /// <param name="FirstAnimationType"></param>
        /// <param name="ColorTranslation"></param>
        /// <param name="Effect"></param>
        /// <param name="Animation"></param>
        /// <param name="SubOverlays"></param>
        /// <param name="HasLight"></param>
        public ObjectBase(
            uint ID,
            uint Count,             
            uint OverlayFileRID,
            uint NameRID , 
            uint Flags,
            ushort LightFlags, 
            byte LightIntensity, 
            ushort LightColor, 
            AnimationType FirstAnimationType, 
            byte ColorTranslation, 
            byte Effect, 
            Animation Animation, 
            IEnumerable<SubOverlay> SubOverlays,            
            bool HasLight = true)
            : base(ID, Count)
        {
            // with light ?
            hasLight = HasLight;

            // basic
            overlayFileRID = OverlayFileRID;
            nameRID = NameRID;
            flags.Value = Flags;

            // light
            lightFlags = LightFlags;
            lightIntensity = LightIntensity;
            lightColor = LightColor;
            
            // first animation: colortranslation or effect
            firstAnimationType = FirstAnimationType;
            colorTranslation = ColorTranslation;
            effect = Effect;

            // special handling for secondtrans
            if (flags.Drawing == ObjectFlags.DrawingType.SecondTrans)
            {
                colorTranslation = ColorTransformation.FILTERWHITE90;

                foreach(SubOverlay subOv in SubOverlays)
                    subOv.ColorTranslation = ColorTransformation.FILTERWHITE90;
            }

            // animation
            animation = Animation;
            animation.PropertyChanged += OnAnimationPropertyChanged; 

            
            // suboverlays
            subOverlays.AddRange(SubOverlays);

            // attach listeners last (no need to refresh in contructor)
            subOverlays.ListChanged += OnSubOverlaysListChanged;
            flags.PropertyChanged += OnFlagsPropertyChanged;          
        }
        public Projectile(
            uint ResourceID,
            AnimationType FirstObjectAnimationType, 
            byte ColorTranslation, 
            byte Effect, 
            Animation Animation, 
            ObjectID Source, 
            ObjectID Targe,
            byte Speed,
            ushort Flags,
            ushort LightFlags, 
            byte LightIntensity, 
            ushort LightColor)
        {
            ID = nextID;
            nextID++;

            this.overlayFileRID = ResourceID;

            this.firstAnimationType = FirstObjectAnimationType;
            this.colorTranslation = ColorTranslation;
            this.effect = Effect;

            this.animation = Animation;

            this.source = Source;
            this.target = Target;

            this.flags = Flags;

            this.lightFlags = LightFlags;
            this.lightIntensity = LightIntensity;
            this.lightColor = LightColor;
        }
Beispiel #23
0
        public override void Clear(bool RaiseChangedEvent)
        {
            base.Clear(RaiseChangedEvent);

            if (RaiseChangedEvent)
            {
                OverlayFileRID = 0;
                NameRID = 0;
                LightFlags = 0;
                LightIntensity = 0;
                LightColor = 0;
                FirstAnimationType = 0;
                ColorTranslation = 0;
                Effect = 0;

                if (animation != null)
                    animation.PropertyChanged -= OnAnimationPropertyChanged;

                Animation = new AnimationNone();
                animation.PropertyChanged += OnAnimationPropertyChanged;

                Name = String.Empty;
                OverlayFile = String.Empty;
                Resource = null;
            }
            else
            {
                overlayFileRID = 0;
                nameRID = 0;
                lightFlags = 0;
                lightIntensity = 0;
                lightColor = 0;
                firstAnimationType = 0;
                colorTranslation = 0;
                effect = 0;

                if (animation != null)
                    animation.PropertyChanged -= OnAnimationPropertyChanged;

                animation = new AnimationNone();
                animation.PropertyChanged += OnAnimationPropertyChanged;

                name = String.Empty;
                overlayFile = String.Empty;
                resource = null;
            }

            flags.Clear(RaiseChangedEvent);                              
            subOverlays.Clear();
        }
        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;
        }
Beispiel #25
0
        /// <summary>
        /// Updates values of this instance to values taken from parameter instance.
        /// </summary>
        /// <param name="Model"></param>
        /// <param name="RaiseChangedEvent"></param>
        public override void UpdateFromModel(ObjectBase Model, bool RaiseChangedEvent)
        {
            base.UpdateFromModel(Model, RaiseChangedEvent);

            if (RaiseChangedEvent)
            {
                OverlayFileRID = Model.OverlayFileRID;
                NameRID = Model.NameRID;
                Flags.UpdateFromModel(Model.Flags, RaiseChangedEvent);
                LightFlags = Model.LightFlags;
                LightIntensity = Model.LightIntensity;
                LightColor = Model.LightColor;
                FirstAnimationType = Model.FirstAnimationType;
                ColorTranslation = Model.ColorTranslation;
                Effect = Model.Effect;
                
                if (Animation != null)
                    Animation.PropertyChanged -= OnAnimationPropertyChanged;

                Animation = Model.Animation;
                Animation.PropertyChanged += OnAnimationPropertyChanged;

                subOverlays.Clear();
                subOverlays.AddRange(Model.SubOverlays);
               
                Name = Model.Name;
                OverlayFile = Model.OverlayFile;
                Resource = Model.Resource;
            }
            else
            {
                overlayFileRID = Model.OverlayFileRID;
                nameRID = Model.NameRID;
                Flags.UpdateFromModel(Model.Flags, RaiseChangedEvent);
                lightFlags = Model.LightFlags;
                lightIntensity = Model.LightIntensity;
                lightColor = Model.LightColor;
                firstAnimationType = Model.FirstAnimationType;
                colorTranslation = Model.ColorTranslation;
                effect = Model.Effect;

                if (animation != null)
                    animation.PropertyChanged -= OnAnimationPropertyChanged;

                animation = Model.Animation;
                animation.PropertyChanged += OnAnimationPropertyChanged;

                subOverlays.Clear();
                subOverlays.AddRange(Model.SubOverlays);
                
                name = Model.Name;
                overlayFile = Model.OverlayFile;
                resource = Model.Resource;
            }
            
            // appearance update
            ProcessAppearance(true);
        }