diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-03 20:10:42 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-03 20:10:42 -0400 |
commit | 0fa1aa6d0f0422cb18ce3eedac6d819808a92eab (patch) | |
tree | 7f88914baf0516f05fcc01720a7dda87bcc89b4b /include | |
parent | 307b4a54c95e08ad01e2c6b7c27a3eca54f05f42 (diff) |
TPlyInventory: Add `TPlyInventory`
Diffstat (limited to 'include')
-rw-r--r-- | include/pso/TPlyInventory.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/pso/TPlyInventory.h b/include/pso/TPlyInventory.h new file mode 100644 index 0000000..6143a06 --- /dev/null +++ b/include/pso/TPlyInventory.h @@ -0,0 +1,61 @@ +#ifndef TPLYINVENTORY_H +#define TPLYINVENTORY_H + +#include <global_types.h> +#include <pso/macros.h> +#include <pso/protocol.h> +#include <pso/TArray.h> + +struct TItemData { + TItemData(); + void bswap(); + TItemData &assign(const TItemData &src); + + union { + TArray<u8, 12> data_u8; + TArray<u16, 6> data_u16; + TArray<u32, 3> data_u32; + } data1; + u32 id; + union { + TArray<u8, 4> data_u8; + TArray<u8, 2> data_u16; + u32 data_u32; + } data2; +}; + +class TPlyInventoryItem { +public: + TPlyInventoryItem() {}; + + void bswap(); + TPlyInventoryItem &assign(const TPlyInventoryItem &src); + + PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, present, 4); + PRIVATE_MEMBER_ACCESSORS(u32, flags); + PRIVATE_MEMBER_ACCESSORS(TItemData, data); +private: + TArray<u8, 4> m_present; + u32 m_flags; + TItemData m_data; +}; + +class TPlyInventory { +public: + void bswap(); + TPlyInventory &assign(const TPlyInventory &src); + + PRIVATE_MEMBER_ACCESSORS(u8, num_items); + PRIVATE_MEMBER_ACCESSORS(u8, hp_materials_used); + PRIVATE_MEMBER_ACCESSORS(u8, tp_materials_used); + PRIVATE_MEMBER_ACCESSORS(u8, language); + PRIVATE_MEMBER_ACCESSORS_ARRAY(TPlyInventoryItem, items, 30); +private: + u8 m_num_items; + u8 m_hp_materials_used; + u8 m_tp_materials_used; + u8 m_language; + TArray<TPlyInventoryItem, 30> m_items; +}; + +#endif |