Kernel_bin.Battle_Commands.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System.Collections;
  2. using System.IO;
  3. namespace FF8
  4. {
  5. public partial class Kernel_bin
  6. {
  7. /// <summary>
  8. /// Battle Commands
  9. /// </summary>
  10. /// <see cref="https://github.com/alexfilth/doomtrain/wiki/Battle-commands"/>
  11. public class Battle_Commands
  12. {
  13. public const int id = 0;
  14. public const int count = 39;
  15. public FF8String Name { get; private set; }
  16. public FF8String Description { get; private set; }
  17. public override string ToString() => Name;
  18. //public byte[] OffsetName; //0x0000 2 bytes Offset to ability name
  19. //public byte[] OffsetDesc; //0x0002 2 bytes Offset to ability description
  20. /// <summary>
  21. /// Ability data ID
  22. /// </summary>
  23. public byte Ability; //0x0004 1 byte Ability data ID
  24. /// <summary>
  25. /// Unknown Flags
  26. /// </summary>
  27. public BitArray Flags; //0x0005 1 byte Unknown Flags
  28. /// <summary>
  29. /// Target
  30. /// </summary>
  31. public byte Target; //0x0006 1 byte Target
  32. /// <summary>
  33. /// Unknown / Unused
  34. /// </summary>
  35. public byte Unknown; //0x0007 1 byte Unknown / Unused
  36. public void Read(BinaryReader br, int i)
  37. {
  38. Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2);
  39. Description = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2+1);
  40. br.BaseStream.Seek(4, SeekOrigin.Current);
  41. Ability = br.ReadByte();
  42. Flags = new BitArray(br.ReadBytes(1));
  43. Target = br.ReadByte();
  44. Unknown = br.ReadByte();
  45. }
  46. public static Battle_Commands[] Read(BinaryReader br)
  47. {
  48. var ret = new Battle_Commands[count];
  49. for (int i = 0; i < count; i++)
  50. {
  51. var tmp = new Battle_Commands();
  52. tmp.Read(br, i);
  53. ret[i] = tmp;
  54. }
  55. return ret;
  56. }
  57. }
  58. }
  59. }