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
8class ObjectSunDS;
9
12
13public:
15 ~ObjectSunDS() override;
16
18 void init() override {
20 }
21
22 void calc() override;
23
25 [[nodiscard]] u32 loadFlags() const override {
26 return 1;
27 }
28
29 // Not overridden in the base game, but has collision mode 0
30 void createCollision() override {}
31
32 [[nodiscard]] s16 launchPointIdx() override;
33
34private:
36 void enterStill() {
37 m_railInterpolator->setCurrVel(0.0f);
38 }
39
41 void enterRevolving() {
42 m_railInterpolator->setCurrVel(m_revolutionSpeed);
43 }
44
46 void calcStill() {
47 if (m_currentFrame >= m_stillDuration) {
48 m_nextStateId = 1;
49 }
50 }
51
53 void calcRevolving() {}
54
58
59 static constexpr std::array<StateManagerEntry<ObjectSunDS>, 2> STATE_ENTRIES = {{
60 {0, &ObjectSunDS::enterStill, &ObjectSunDS::calcStill},
61 {1, &ObjectSunDS::enterRevolving, &ObjectSunDS::calcRevolving},
62 }};
63};
64
65} // 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.
Pertains to collision.