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 [[nodiscard]] s16 launchPointIdx() override;
26
27private:
29 void enterStill() {
30 m_railInterpolator->setCurrVel(0.0f);
31 }
32
34 void enterRevolving() {
35 m_railInterpolator->setCurrVel(m_revolutionSpeed);
36 }
37
39 void calcStill() {
40 if (m_currentFrame >= m_stillDuration) {
41 m_nextStateId = 1;
42 }
43 }
44
46 void calcRevolving() {}
47
49 const s32 m_startFrame;
51
52 static constexpr std::array<StateManagerEntry, 2> STATE_ENTRIES = {{
53 {StateEntry<ObjectSunDS, &ObjectSunDS::enterStill, &ObjectSunDS::calcStill>(0)},
54 {StateEntry<ObjectSunDS, &ObjectSunDS::enterRevolving, &ObjectSunDS::calcRevolving>(1)},
55 }};
56};
57
58} // 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.