definition.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #include <array>
  3. #include <cstddef>
  4. #include <cstdint>
  5. namespace sunrise::state::build_data::abilities {
  6. /** A character record publishes 12 ability buckets with fixed meanings. */
  7. inline constexpr std::size_t kBucketCapacity = 12;
  8. /** Each bucket holds 16 definition hashes. */
  9. inline constexpr std::size_t kBucketHashCapacity = 16;
  10. /** The flat overflow bank holds 32 hashes no bucket category claims. */
  11. inline constexpr std::size_t kOverflowCapacity = 32;
  12. /**
  13. * One row per distinct subclass and ability selection the configured characters use. Each
  14. * character publishes a row for every subclass it owns at the default selection, plus one for the
  15. * equipped subclass's real picks when those differ: 3 characters by up to 4 rows.
  16. */
  17. inline constexpr std::size_t kDefinitionCapacity = 12;
  18. /** All bits set marks a bucket no entry claimed. */
  19. inline constexpr std::uint8_t kEmptyBucketKind = 0xFF;
  20. /** One ability bucket: the item category it collects and that category's definition hashes. */
  21. struct Bucket {
  22. std::uint8_t kind{kEmptyBucketKind};
  23. std::uint8_t hashCount{};
  24. std::array<std::uint32_t, kBucketHashCapacity> hashes{};
  25. };
  26. /**
  27. * The 5 socket entries one character has selected on its subclass.
  28. * Sprint is the sixth selected entry but is not selectable, so it is fixed and not a key field.
  29. */
  30. struct Selection {
  31. std::uint8_t movementEntry{};
  32. std::uint8_t grenadeEntry{};
  33. std::uint8_t superEntry{};
  34. std::uint8_t meleeEntry{};
  35. std::uint8_t classEntry{};
  36. friend bool operator==(const Selection&, const Selection&) = default;
  37. };
  38. /**
  39. * The ability buckets one subclass publishes under one ability selection.
  40. * Both key fields are needed. The socket entry list is the subclass's ability layout, and the
  41. * selection picks among the choices that layout offers.
  42. */
  43. struct Definition {
  44. std::uint16_t socketEntryListIndex{};
  45. Selection selection{};
  46. std::uint8_t overflowCount{};
  47. std::array<Bucket, kBucketCapacity> buckets{};
  48. std::array<std::uint32_t, kOverflowCapacity> overflow{};
  49. };
  50. } // namespace sunrise::state::build_data::abilities