A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectSunDS.cc
1#include "ObjectSunDS.hh"
2
3#include "game/system/RaceManager.hh"
4
5namespace Kinoko::Field {
6
8ObjectSunDS::ObjectSunDS(const System::MapdataGeoObj &params)
9 : ObjectProjectileLauncher(params), StateManager(this, STATE_ENTRIES),
10 m_revolutionSpeed(static_cast<f32>(params.setting(0))),
11 m_startFrame(static_cast<s32>(params.setting(1))) {}
12
14ObjectSunDS::~ObjectSunDS() = default;
15
17void ObjectSunDS::calc() {
18 if (System::RaceManager::Instance()->timer() < static_cast<u32>(m_startFrame)) {
19 return;
20 }
21
22 if (m_railInterpolator->calc() == RailInterpolator::Status::SegmentEnd) {
23 m_railInterpolator->setT(0.0f);
24
25 u16 setting = m_railInterpolator->curPoint().setting[0];
26 if (setting != 0) {
27 m_stillDuration = setting;
28 m_nextStateId = 0;
29 }
30 }
31
32 StateManager::calc();
33
34 setPos(m_railInterpolator->curPos());
35}
36
39 constexpr u16 THROW_DELAY = 30;
40
41 if (m_currentStateId != 0 || THROW_DELAY != m_currentFrame) {
42 return -1;
43 }
44
45 return m_railInterpolator->curPointIdx();
46}
47
48} // namespace Kinoko::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.
Base class that represents different "states" for an object.
Pertains to collision.