A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectBasabasa.hh
1#pragma once
2
3#include "game/field/StateManager.hh"
4#include "game/field/obj/ObjectCollidable.hh"
5
6namespace Field {
7
9class ObjectBasabasaDummy final : public ObjectCollidable, public StateManager {
10public:
12 ~ObjectBasabasaDummy() override;
13
14 void init() override;
15
17 void calc() override {
18 StateManager::calc();
19 }
20
22 [[nodiscard]] u32 loadFlags() const override {
23 return 3;
24 }
25
27 [[nodiscard]] virtual const char *getKclName() const override {
28 return "basabasa";
29 }
30
31 Kart::Reaction onCollision(Kart::KartObject *kartObj, Kart::Reaction reactionOnKart,
32 Kart::Reaction reactionOnObj, EGG::Vector3f &hitDepth) override;
33
34 void setActive(bool isSet) {
35 m_active = isSet;
36 }
37
38 [[nodiscard]] bool active() const {
39 return m_active;
40 }
41
42private:
44 void enterState0() {}
45
48 void enterState1() {}
49
50 void calcState0();
51
54 void calcState1() {}
55
56 const bool m_bigBump;
58 bool m_active;
59
60 static constexpr std::array<StateManagerEntry, 2> STATE_ENTRIES = {{
61 {StateEntry<ObjectBasabasaDummy, &ObjectBasabasaDummy::enterState0,
62 &ObjectBasabasaDummy::calcState0>(0)},
65 }};
66};
67
71class ObjectBasabasa final : public ObjectCollidable {
72public:
74 ~ObjectBasabasa() override;
75
76 void init() override;
77 void calc() override;
78
80 [[nodiscard]] u32 loadFlags() const override {
81 return 3;
82 }
83
85 void createCollision() override {}
86
88 void loadRail() override {}
89
90private:
91 std::span<ObjectBasabasaDummy *> m_bats;
92 const u32 m_initialTimer;
93 const u32 m_batsPerGroup;
94 const u32 m_startFrame;
95 const u32 m_batSpacing;
98};
99
100} // namespace Field
Represents a single bat. It's owned and managed by ObjectBasabasa.
void calcState1()
This is run when a bat is hit with a start or other item. We can ignore for Kinoko.
const bool m_bigBump
Affects the severity of the "push" when colliding with bat.
void enterState1()
This is run when a bat is hit with a start or other item. We can ignore for Kinoko.
EGG::Vector3f m_initialPos
RNG-based starting position for the bat.
bool m_active
Whether or not this bat is currently spawned.
Can be thought of as the bat "spawner". It's the class that manages an array of bats.
u32 m_cycleTimer
Used to determine when to spawn next bat.
const u32 m_initialTimer
The m_cycleTimer starts and resets to this value.
const u32 m_batSpacing
How many frames in between bat spawns.
std::span< ObjectBasabasaDummy * > m_bats
The array of individual bats.
const u32 m_startFrame
Initial delay before the spawner will start calculating.
const u32 m_batsPerGroup
Number of bats that will spawn before resetting the m_cycleTimer.
u32 m_batsActive
The number of bats currently spawned.
Base class that represents different "states" for an object.
The highest level abstraction for a kart.
Definition KartObject.hh:11
Pertains to collision.
A 3D float vector.
Definition Vector.hh:88