/// <summary> /// Draw a filled box from an array of coordinates. /// </summary> /// <param name="array">The byte array.</param> /// <param name="startindex">The start index.</param> /// <param name="color">The color of the box.</param> /// <param name="device">The direct3D device.</param> private void DrawBoxFromArray(byte[] array, int startindex, Color color, Device device) { BoxPoints boxFromArray = GetBoxFromArray(array, startindex); DrawBox( boxFromArray.D, boxFromArray.A, boxFromArray.B, boxFromArray.C, color, device); }
/// <summary> /// Draw a filled box when on hit is active from an array of coordinates. /// </summary> /// <param name="array">The byte array.</param> /// <param name="startindex">The start index.</param> /// <param name="color">The color of the box.</param> /// <param name="device">The direct3D device.</param> /// <remarks>Draws box from array only if it's active.</remarks> private void DrawBoxFromArrayOnHit(byte[] array, int startindex, Color color, Device device) { // This byte should be 0x2 when the box is active, but for some reason that is not always the case. if (array[startindex + 0xac] != 0x2) { return; } BoxPoints boxFromArray = GetBoxFromArray(array, startindex); DrawBox( boxFromArray.D, boxFromArray.A, boxFromArray.B, boxFromArray.C, color, device); }
/// <summary> /// Returns a struct with coordinates. /// </summary> /// <param name="array">The array of vertexes.</param> /// <param name="startindex">The start index</param> /// <returns><see cref="BoxPoints"/></returns> private BoxPoints GetBoxFromArray(byte[] array, int startindex) { BoxPoints hitbox = new BoxPoints { A = new Vector3( BitConverter.ToSingle(array, startindex), BitConverter.ToSingle(array, startindex + 0x4), BitConverter.ToSingle(array, startindex + 0x8)), B = new Vector3( BitConverter.ToSingle(array, startindex + 0x10), BitConverter.ToSingle(array, startindex + 0x14), BitConverter.ToSingle(array, startindex + 0x18)), C = new Vector3( BitConverter.ToSingle(array, startindex + 0x20), BitConverter.ToSingle(array, startindex + 0x24), BitConverter.ToSingle(array, startindex + 0x28)), D = new Vector3( BitConverter.ToSingle(array, startindex + 0x30), BitConverter.ToSingle(array, startindex + 0x34), BitConverter.ToSingle(array, startindex + 0x38)) }; return(hitbox); }
/// <summary> /// Returns a struct with coordinates. /// </summary> /// <param name="array">The array of vertexes.</param> /// <param name="startindex">The start index</param> /// <returns><see cref="BoxPoints"/></returns> private BoxPoints GetBoxFromArray(byte[] array, int startindex) { BoxPoints hitbox = new BoxPoints { A = new Vector3( BitConverter.ToSingle(array, startindex), BitConverter.ToSingle(array, startindex + 0x4), BitConverter.ToSingle(array, startindex + 0x8)), B = new Vector3( BitConverter.ToSingle(array, startindex + 0x10), BitConverter.ToSingle(array, startindex + 0x14), BitConverter.ToSingle(array, startindex + 0x18)), C = new Vector3( BitConverter.ToSingle(array, startindex + 0x20), BitConverter.ToSingle(array, startindex + 0x24), BitConverter.ToSingle(array, startindex + 0x28)), D = new Vector3( BitConverter.ToSingle(array, startindex + 0x30), BitConverter.ToSingle(array, startindex + 0x34), BitConverter.ToSingle(array, startindex + 0x38)) }; return hitbox; }