A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectItemboxPress.cc
1#include "ObjectItemboxPress.hh"
2
3#include "game/field/obj/ObjectPress.hh"
4
5namespace Kinoko::Field {
6
8ObjectItemboxPress::ObjectItemboxPress(const System::MapdataGeoObj &params)
9 : ObjectCollidable(params) {}
10
12ObjectItemboxPress::~ObjectItemboxPress() = default;
13
15void ObjectItemboxPress::calc() {
16 constexpr f32 HEIGHT_OFFSET = 180.0f;
17
18 switch (m_state) {
19 case 1:
20 case 2: {
21 calcRail();
22 const auto &railPos = m_railInterpolator->curPos();
23 setPos(EGG::Vector3f(railPos.x, railPos.y + HEIGHT_OFFSET, railPos.z));
24 } break;
25 default:
26 break;
27 }
28}
29
32 m_state = 2;
33 m_railInterpolator->init(0.0f, 0);
34 m_railInterpolator->setPerPointVelocities(true);
35}
36
38void ObjectItemboxPress::calcRail() {
39 auto result = m_railInterpolator->calc();
40 if (result == RailInterpolator::Status::SegmentEnd) {
41 if (m_railInterpolator->curPoint().setting[1] == 1) {
42 m_senko->setWindup(true);
43 }
44 } else if (result == RailInterpolator::Status::ChangingDirection) {
45 m_state = 0;
46 }
47}
48
49} // namespace Kinoko::Field
void startPress()
Used by ObjectItemboxLine to activate the stomper.
Pertains to collision.