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 Kinoko::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 {
72 friend class Host::Context;
73
74public:
76 ~ObjectBasabasa() override;
77
78 void init() override;
79 void calc() override;
80
82 [[nodiscard]] u32 loadFlags() const override {
83 return 3;
84 }
85
87 void createCollision() override {}
88
90 void loadRail() override {}
91
92 [[nodiscard]] static f32 initialXRange() {
93 return s_initialXRange;
94 }
95
96 [[nodiscard]] static f32 initialYRange() {
97 return s_initialYRange;
98 }
99
100private:
102 const u32 m_initialTimer;
103 const u32 m_batsPerGroup;
104 const u32 m_startFrame;
105 const u32 m_batSpacing;
108
109 static f32 s_initialXRange;
110 static f32 s_initialYRange;
111};
112
113} // namespace Kinoko::Field
Represents a single bat. It's owned and managed by ObjectBasabasa.
void enterState1()
This is run when a bat is hit with a start or other item. We can ignore for Kinoko.
bool m_active
Whether or not this bat is currently spawned.
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.
EGG::Vector3f m_initialPos
RNG-based starting position for the bat.
Can be thought of as the bat "spawner". It's the class that manages an array of bats.
const u32 m_initialTimer
The m_cycleTimer starts and resets to this value.
owning_span< ObjectBasabasaDummy * > m_bats
The array of individual bats.
const u32 m_startFrame
Initial delay before the spawner will start calculating.
u32 m_cycleTimer
Used to determine when to spawn next bat.
const u32 m_batSpacing
How many frames in between bat spawns.
u32 m_batsActive
The number of bats currently spawned.
const u32 m_batsPerGroup
Number of bats that will spawn before resetting the m_cycleTimer.
Base class that represents different "states" for an object.
Contexts can be used to restore a previous memory state for the current session.
Definition Context.hh:70
The highest level abstraction for a kart.
Definition KartObject.hh:11
A contiguous storage container that manages the lifecycle of a buffer of a given size.
Definition Types.hh:29
Pertains to collision.
A 3D float vector.
Definition Vector.hh:107