A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectFlowTable.cc
1#include "ObjectFlowTable.hh"
2
3#include "game/system/ResourceManager.hh"
4
5#include <cstring>
6
7namespace Field {
8
10ObjectFlowTable::ObjectFlowTable(const char *filename) {
11 SFile *file = reinterpret_cast<SFile *>(System::ResourceManager::Instance()->getFile(filename,
12 nullptr, System::ArchiveId::Core));
13
14 m_count = parse<s16>(file->count);
15 m_sets = file->sets;
16 m_slots = reinterpret_cast<const s16 *>(m_sets + m_count);
17}
18
20ObjectFlowTable::~ObjectFlowTable() = default;
21
23ObjectId ObjectFlowTable::getIdfFromName(const char *name) const {
24 for (s16 i = 0; i < m_count; ++i) {
25 const auto *curSet = set(i);
26 ASSERT(curSet);
27
28 if (strncmp(name, curSet->name, sizeof(curSet->name)) == 0) {
29 return static_cast<ObjectId>(parse<u16>(curSet->id));
30 }
31 }
32
33 return ObjectId::None;
34}
35
36} // namespace Field
Pertains to collision.