Kinoko
A reimplementation of Mario Kart Wii's physics engine in C++
Toggle main menu visibility
Loading...
Searching...
No Matches
ObjectItemboxLine.cc
1
#include "ObjectItemboxLine.hh"
2
3
#include "game/field/obj/ObjectItemboxPress.hh"
4
#include "game/field/obj/ObjectPress.hh"
5
6
namespace
Kinoko::Field
{
7
9
ObjectItemboxLine::ObjectItemboxLine(
const
System::MapdataGeoObj ¶ms)
10
:
ObjectCollidable
(params) {
11
constexpr
u32 DEFAULT_PRESS_COUNT = 5;
12
13
auto
*senko = EGG::egg_new<ObjectPressSenko>(params);
14
senko->load();
15
16
u32 pressCount = params.setting(6);
17
if
(pressCount == 0) {
18
pressCount = DEFAULT_PRESS_COUNT;
19
}
20
21
m_press = owning_span<ObjectItemboxPress *>(pressCount);
22
23
for
(
auto
*&press : m_press) {
24
press = EGG::egg_new<ObjectItemboxPress>(params);
25
press->load();
26
press->setSenko(senko);
27
}
28
}
29
31
ObjectItemboxLine::~ObjectItemboxLine() =
default
;
32
34
void
ObjectItemboxLine::init() {
35
ASSERT(m_mapObj);
36
u32 timer =
static_cast<
u32
>
(m_mapObj->setting(4));
37
38
if
(timer == 0) {
39
timer =
static_cast<
u32
>
(m_mapObj->setting(5));
40
}
41
42
m_stompCooldown = timer;
43
m_curPressIdx = 0;
44
}
45
47
void
ObjectItemboxLine::calc() {
48
if
(--m_stompCooldown > 0) {
49
return
;
50
}
51
52
m_stompCooldown =
static_cast<
u32
>
(m_mapObj->setting(5));
53
54
m_press[m_curPressIdx]->startPress();
55
m_curPressIdx = (m_curPressIdx + 1) % m_press.size();
56
}
57
58
}
// namespace Kinoko::Field
Kinoko::Field::ObjectCollidable
Definition
ObjectCollidable.hh:18
Kinoko::Field
Pertains to collision.
Definition
BoxColManager.cc:10
game
field
obj
ObjectItemboxLine.cc
Made by
Malleo
. Logo by
vabold
. Website generated by
Doxygen
1.17.0