A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectSunDS.hh
1#pragma once
2
3#include "game/field/StateManager.hh"
4#include "game/field/obj/ObjectProjectileLauncher.hh"
5
6namespace Field {
7
9public:
11 ~ObjectSunDS() override;
12
14 void init() override {
16 }
17
18 void calc() override;
19
21 [[nodiscard]] u32 loadFlags() const override {
22 return 1;
23 }
24
25 // Not overridden in the base game, but has collision mode 0
26 void createCollision() override {}
27
28 [[nodiscard]] s16 launchPointIdx() override;
29
30private:
32 void enterStill() {
33 m_railInterpolator->setCurrVel(0.0f);
34 }
35
37 void enterRevolving() {
38 m_railInterpolator->setCurrVel(m_revolutionSpeed);
39 }
40
42 void calcStill() {
43 if (m_currentFrame >= m_stillDuration) {
44 m_nextStateId = 1;
45 }
46 }
47
49 void calcRevolving() {}
50
52 const s32 m_startFrame;
54
55 static constexpr std::array<StateManagerEntry, 2> STATE_ENTRIES = {{
56 {StateEntry<ObjectSunDS, &ObjectSunDS::enterStill, &ObjectSunDS::calcStill>(0)},
57 {StateEntry<ObjectSunDS, &ObjectSunDS::enterRevolving, &ObjectSunDS::calcRevolving>(1)},
58 }};
59};
60
61} // namespace Field
Abstract class that moves along its own rail and throws projectiles.
s16 launchPointIdx() override
Used by ObjectSniper to check which object (if any) should be thrown.
const s32 m_startFrame
The sun is inactive until this frame.
u32 m_stillDuration
How long the sun remains stationary for before moving again.
const f32 m_revolutionSpeed
Speed of sun revolving around the course.
Base class that represents different "states" for an object.
Pertains to collision.