Kinoko
A reimplementation of Mario Kart Wii's physics engine in C++
Toggle main menu visibility
Loading...
Searching...
No Matches
ObjectItemboxPress.cc
1
#include "ObjectItemboxPress.hh"
2
3
#include "game/field/obj/ObjectPress.hh"
4
5
namespace
Kinoko::Field
{
6
8
ObjectItemboxPress::ObjectItemboxPress(
const
System::MapdataGeoObj ¶ms)
9
:
ObjectCollidable
(params) {}
10
12
ObjectItemboxPress::~ObjectItemboxPress() =
default
;
13
15
void
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
31
void
ObjectItemboxPress::startPress
() {
32
m_state = 2;
33
m_railInterpolator->init(0.0f, 0);
34
m_railInterpolator->setPerPointVelocities(
true
);
35
}
36
38
void
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
Kinoko::Field::ObjectCollidable
Definition
ObjectCollidable.hh:18
Kinoko::Field::ObjectItemboxPress::startPress
void startPress()
Used by ObjectItemboxLine to activate the stomper.
Definition
ObjectItemboxPress.cc:31
Kinoko::Field
Pertains to collision.
Definition
BoxColManager.cc:10
game
field
obj
ObjectItemboxPress.cc
Made by
Malleo
. Logo by
vabold
. Website generated by
Doxygen
1.17.0