MiscSection.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using System.Linq;
  4. namespace OpenVIII
  5. {
  6. namespace Kernel
  7. {
  8. /// <summary>
  9. /// Misc Data
  10. /// </summary>
  11. /// <see cref="https://github.com/alexfilth/doomtrain/wiki/Misc-section"/>
  12. public sealed class MiscSection
  13. {
  14. #region Fields
  15. public const int Count = 1;
  16. public const int ID = 29;
  17. #endregion Fields
  18. #region Constructors
  19. private MiscSection(BinaryReader br, int i)
  20. {
  21. StatusTimers = br.ReadBytes(14);
  22. AtbSpeedMultiplier = br.ReadByte();
  23. DeadTimer = br.ReadByte();
  24. StatusLimitEffects = br.ReadBytes(32);
  25. DuelTimersAndStartMoves = br.ReadBytes(8);
  26. ShotTimers = br.ReadBytes(4);
  27. }
  28. #endregion Constructors
  29. #region Properties
  30. public byte AtbSpeedMultiplier { get; }
  31. public byte DeadTimer { get; }
  32. public byte[] DuelTimersAndStartMoves { get; }
  33. public byte[] ShotTimers { get; }
  34. public byte[] StatusLimitEffects { get; }
  35. public byte[] StatusTimers { get; }
  36. #endregion Properties
  37. #region Methods
  38. private static MiscSection CreateInstance(BinaryReader br, int i) => new MiscSection(br, i);
  39. public static IReadOnlyList<MiscSection> Read(BinaryReader br)
  40. => Enumerable.Range(0, Count).Select(x => CreateInstance(br, x)).ToList();
  41. #endregion Methods
  42. }
  43. }
  44. }