A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectSunManager.hh
1#pragma once
2
3#include "game/field/ObjectDirector.hh"
4#include "game/field/obj/ObjectSniper.hh"
5
6#include <string>
7
8namespace Field {
9
12class ObjectSunManager final : public ObjectSniper {
13public:
16 auto &managedObjs = ObjectDirector::Instance()->managedObjects();
17
18 size_t count = 0;
19
20 for (auto *&obj : managedObjs) {
21 if (strcmp(obj->getName(), "FireSnake") == 0) {
22 ++count;
23 }
24 }
25
26 m_projectiles = std::span<ObjectProjectile *>(new ObjectProjectile *[count], count);
27
28 size_t curIdx = 0;
29
30 for (auto *&obj : managedObjs) {
31 if (strcmp(obj->getName(), "FireSnake") == 0) {
32 m_projectiles[curIdx++] = reinterpret_cast<ObjectProjectile *>(obj);
33 } else if (strcmp(obj->getName(), "sunDS") == 0) {
34 m_launcher = reinterpret_cast<ObjectProjectileLauncher *>(obj);
35 }
36 }
37
38 u16 pointCount = m_launcher->railInterpolator()->pointCount();
39 m_pointIdxs = std::span<s16>(new s16[pointCount], pointCount);
40 }
41
43 ~ObjectSunManager() override {
44 delete[] m_projectiles.data();
45 delete[] m_pointIdxs.data();
46 }
47};
48
49} // namespace Field
Abstract class that moves along its own rail and throws projectiles.
Abstract class that represents an object thrown by an ObjectProjectileLauncher.
The base class for a manager object which is responsible for synchronizing a set of projectiles and a...
Handles the synchronization between the ObjectSunDS and ObjectFireSnake projectiles.
Pertains to collision.