A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectFlowTable.hh
1#pragma once
2
3#include "game/field/obj/ObjectId.hh"
4
5namespace Field {
6
8enum class CollisionMode {
9 None = 0,
10 Sphere = 1,
11 Cylinder = 2,
12 Box = 3,
13 Ground = 4,
14 Original = 5,
15};
16
21 u16 id;
22 char name[32];
23 char resources[64];
24 u8 _62[0x6a - 0x62];
25 s16 mode;
26 union {
27 struct {
28 s16 radius;
29 } sphere;
30 struct {
31 s16 radius;
32 s16 height;
33 } cylinder;
34 struct {
35 s16 x;
36 s16 y;
37 s16 z;
38 } box;
39 } params;
40 u8 _72[0x74 - 0x72];
41};
42STATIC_ASSERT(sizeof(SObjectCollisionSet) == 0x74);
43
45public:
46 ObjectFlowTable(const char *filename);
48
49 const SObjectCollisionSet *set(s16 slot) const {
50 return slot == -1 ? nullptr : slot < m_count ? &m_sets[slot] : nullptr;
51 }
52
53 [[nodiscard]] s16 slot(ObjectId id) const {
54 constexpr size_t SLOT_COUNT = 0x2f4;
55
56 size_t i = static_cast<size_t>(id);
57 return i < SLOT_COUNT ? parse<s16>(m_slots[i]) : -1;
58 }
59
60private:
61 struct SFile {
62 s16 count;
64 };
65
66 s16 m_count;
67 const SObjectCollisionSet *m_sets;
68 const s16 *m_slots;
69};
70
71} // namespace Field
Pertains to collision.
CollisionMode
Maps to SObjectCollisionSet::mode. Determines what type of collision an object has.
Structure of the ObjFlow.bin table entry. Contains dependencies and collision parameters.