definition.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 shared default selection (not just
  15. * the equipped one), plus one extra row for the equipped subclass's real picks when those are not
  16. * already the default — 3 characters by up to 4 rows (3 subclasses plus the equipped one's real
  17. * picks) each.
  18. */
  19. inline constexpr std::size_t kDefinitionCapacity = 12;
  20. /** All bits set marks a bucket no entry claimed. */
  21. inline constexpr std::uint8_t kEmptyBucketKind = 0xFF;
  22. /** One ability bucket: the item category it collects and that category's definition hashes. */
  23. struct Bucket {
  24. std::uint8_t kind{kEmptyBucketKind};
  25. std::uint8_t hashCount{};
  26. std::array<std::uint32_t, kBucketHashCapacity> hashes{};
  27. };
  28. /**
  29. * The 5 socket entries one character has selected on its subclass.
  30. * Sprint is the sixth selected entry but is not selectable, so it is fixed and not a key field.
  31. */
  32. struct Selection {
  33. std::uint8_t movementEntry{};
  34. std::uint8_t grenadeEntry{};
  35. std::uint8_t superEntry{};
  36. std::uint8_t meleeEntry{};
  37. std::uint8_t classEntry{};
  38. friend bool operator==(const Selection&, const Selection&) = default;
  39. };
  40. /**
  41. * The ability buckets one subclass publishes under one ability selection.
  42. * Both key fields are needed. The socket entry list is the subclass's ability layout, and the
  43. * selection picks among the choices that layout offers.
  44. */
  45. struct Definition {
  46. std::uint16_t socketEntryListIndex{};
  47. Selection selection{};
  48. std::uint8_t overflowCount{};
  49. std::array<Bucket, kBucketCapacity> buckets{};
  50. std::array<std::uint32_t, kOverflowCapacity> overflow{};
  51. };
  52. } // namespace sunrise::state::build_data::abilities