Kinoko
A reimplementation of Mario Kart Wii's physics engine in C++
Toggle main menu visibility
Loading...
Searching...
No Matches
KartBoost.hh
1
#pragma once
2
3
#include <
Common.hh
>
4
5
namespace
Kinoko::Kart
{
6
9
class
KartBoost {
10
public
:
11
enum class
Type {
12
AllMt,
13
MushroomAndBoostPanel,
14
TrickAndZipper,
15
Max,
16
};
17
18
KartBoost();
19
~KartBoost();
20
21
[[nodiscard]]
bool
activate
(Type type, s16 frames);
22
[[nodiscard]]
bool
calc
();
23
void
reset();
24
26
void
resetActive() {
27
m_active
.fill(
false
);
28
}
29
31
[[nodiscard]] f32 multiplier()
const
{
32
return
m_multiplier
;
33
}
34
35
[[nodiscard]] f32 acceleration()
const
{
36
return
m_acceleration;
37
}
38
39
[[nodiscard]] f32 speedLimit()
const
{
40
return
m_speedLimit;
41
}
43
44
private
:
45
// We need to evaluate this expression early for the array initialization
46
static
constexpr
size_t
BOOST_TYPE_COUNT =
static_cast<
size_t
>
(Type::Max);
47
48
std::array<s16, BOOST_TYPE_COUNT>
m_timers
;
49
std::array<bool, BOOST_TYPE_COUNT>
m_active
;
50
f32
m_multiplier
;
51
f32 m_acceleration;
52
f32 m_speedLimit;
53
};
54
55
}
// namespace Kinoko::Kart
Common.hh
This header houses common data types such as our integral types and enums.
Kinoko::Kart::KartBoost::m_timers
std::array< s16, BOOST_TYPE_COUNT > m_timers
Durations for the different boost types.
Definition
KartBoost.hh:48
Kinoko::Kart::KartBoost::m_active
std::array< bool, BOOST_TYPE_COUNT > m_active
Whether the different boost types are active.
Definition
KartBoost.hh:49
Kinoko::Kart::KartBoost::m_multiplier
f32 m_multiplier
Multiplier applied to vehicle speed.
Definition
KartBoost.hh:50
Kinoko::Kart::KartBoost::activate
bool activate(Type type, s16 frames)
Starts/restarts a boost of the given type.
Definition
KartBoost.cc:21
Kinoko::Kart::KartBoost::calc
bool calc()
Computes the current frame's boost multiplier, acceleration, and speed limit.
Definition
KartBoost.cc:38
Kinoko::Kart
Pertains to kart-related functionality.
Definition
BoxColManager.hh:14
game
kart
KartBoost.hh
Made by
Malleo
. Logo by
vabold
. Website generated by
Doxygen
1.17.0