Example #1
0
 public void Write(BinaryWriter w)
 {
     lock (this) {
         w.Write((uint)Flags);
         w.Write((ushort)Flags2);
         w.Write(Time);
         w.Write(X);
         w.Write(Y);
         w.Write(Z);
         w.Write(O);
         if (Flags.HasFlag(MovementFlags.OnTransport))
         {
             Transport.Write(w);
         }
         if (Flags.HasFlag(MovementFlags.Swimming | MovementFlags.Flying) ||
             Flags2.HasFlag(MovementFlags2.AlwaysAllowPitching))
         {
             w.Write(SwimmPitch);
         }
         w.Write(FallTime);
         if (Flags.HasFlag(MovementFlags.Falling))
         {
             w.Write(JumpUnk1);
             w.Write(JumpSin);
             w.Write(JumpCos);
             w.Write(JumpSpeed);
         }
         if (Flags.HasFlag(MovementFlags.SplineElevation))
         {
             w.Write(SplineElevation);
         }
     }
 }
Example #2
0
 public void Read(BinaryReader r)
 {
     lock (this) {
         Flags  = ((MovementFlags)r.ReadUInt32());
         Flags2 = (MovementFlags2)r.ReadUInt16();
         Time   = r.ReadUInt32();
         X      = r.ReadSingle();
         Y      = r.ReadSingle();
         Z      = r.ReadSingle();
         O      = r.ReadSingle();
         if (Flags.HasFlag(MovementFlags.OnTransport))
         {
             if (Transport == null)
             {
                 Transport = new TransportInfo();
             }
             Transport.Read(r);
         }
         else
         {
             Transport = null;
         }
         if (Flags.HasFlag(MovementFlags.Swimming | MovementFlags.Flying) ||
             Flags2.HasFlag(MovementFlags2.AlwaysAllowPitching))
         {
             SwimmPitch = r.ReadSingle();
         }
         FallTime = r.ReadUInt32();
         if (Flags.HasFlag(MovementFlags.Falling))
         {
             JumpUnk1  = r.ReadSingle();
             JumpSin   = r.ReadSingle();
             JumpCos   = r.ReadSingle();
             JumpSpeed = r.ReadSingle();
         }
         if (Flags.HasFlag(MovementFlags.SplineElevation))
         {
             SplineElevation = r.ReadSingle();
         }
     }
 }
Example #3
0
 /// <summary>
 /// Returns a value indicating wheter the given flag is currently set.
 /// </summary>
 /// <param name="flag">The flag to check.</param>
 /// <returns><c>true</c> if the flag is set; otherwise, <c>false</c>.</returns>
 public bool HasFlag(Flags2 flag) => Flags2.HasFlag(flag);
Example #4
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendFormat("Movement Flags: {0}", Flags).AppendLine();
            sb.AppendFormat("Movement Flags2: {0}", Flags2).AppendLine();
            sb.AppendFormat("Movement TimeStamp: {0}", TimeStamp).AppendLine();
            sb.AppendFormat("Movement Position: {0}", Position).AppendLine();
            sb.AppendFormat("Movement Facing: {0}", Facing).AppendLine();

            if (Flags.HasFlag(MovementFlags.ONTRANSPORT))
            {
                sb.AppendFormat("Movement Transport: {0}", Transport).AppendLine();
            }

            if (Flags.HasFlag(MovementFlags.SWIMMING) || Flags.HasFlag(MovementFlags.FLYING) || Flags2.HasFlag(MovementFlags2.AlwaysAllowPitching))
            {
                sb.AppendFormat("Movement Pitch: {0}", Pitch).AppendLine();
            }

            sb.AppendFormat("Movement FallTime: {0}", FallTime).AppendLine();

            if (Flags.HasFlag(MovementFlags.FALLING))
            {
                sb.AppendFormat("Movement FallVelocity: {0}", FallVelocity).AppendLine();
                sb.AppendFormat("Movement FallCosAngle: {0}", FallCosAngle).AppendLine();
                sb.AppendFormat("Movement FallSinAngle: {0}", FallSinAngle).AppendLine();
                sb.AppendFormat("Movement FallSpeed: {0}", FallSpeed).AppendLine();
            }

            if (Flags.HasFlag(MovementFlags.SPLINEELEVATION))
            {
                sb.AppendFormat("Movement SplineElevation: {0}", SplineElevation).AppendLine();
            }

            return(sb.ToString());
        }
Example #5
0
 public bool GetFlag2(int bit)
 {
     return(Flags2.HasFlag((SuitStatusFlags)(1 << bit)));
 }