Kinoko
A reimplementation of Mario Kart Wii's physics engine in C++
Toggle main menu visibility
Loading...
Searching...
No Matches
ObjectDossun.hh
1
#pragma once
2
3
#include "game/field/obj/ObjectCollidable.hh"
4
5
namespace
Kinoko::Field
{
6
class
ObjectDossunTsuibiHolder
;
7
12
class
ObjectDossun :
public
ObjectCollidable {
13
friend
ObjectDossunTsuibiHolder;
14
15
public
:
16
ObjectDossun(
const
System::MapdataGeoObj
¶ms);
17
~ObjectDossun()
override
;
18
19
void
init()
override
;
20
21
[[nodiscard]] u32 loadFlags()
const override
{
22
return
1;
23
}
24
25
void
calcCollisionTransform()
override
;
26
Kart::Reaction onCollision(
Kart::KartObject
*kartObj, Kart::Reaction reactionOnKart,
27
Kart::Reaction reactionOnObj,
EGG::Vector3f
&hitDepth)
override
;
28
29
void
initState();
30
void
calcStomp();
31
33
virtual
void
startStill() {
34
m_anmState = AnmState::Still;
35
m_shakePhase
= 0;
36
m_vel
= 0.0f;
37
setRot(
EGG::Vector3f
(rot().x, m_currRot, rot().z));
38
}
39
41
void
startGrounded() {
42
m_anmState =
AnmState::Grounded
;
43
m_groundedTimer
= GROUND_DURATION;
44
}
45
46
protected
:
48
enum class
AnmState
{
49
Still = 0,
50
BeforeFall
= 1,
51
Falling
= 2,
52
Grounded
= 3,
53
Rising
= 4,
54
};
55
56
enum class
StompState {
57
Inactive = 0,
58
Active = 1,
59
};
60
61
StompState m_stompState;
62
AnmState m_anmState;
63
s32
m_beforeFallTimer
;
64
s32
m_stillTimer
;
65
s32
m_groundedTimer
;
66
s32
m_shakePhase
;
67
f32
m_vel
;
68
f32 m_initialPosY;
69
u32
m_fullDuration
;
70
s32 m_cycleTimer;
71
f32 m_currRot;
72
bool
m_touchingGround;
73
75
static
constexpr
u32
BEFORE_FALL_DURATION
= 10;
76
77
private
:
78
void
calcBeforeFall();
79
81
void
calcFalling() {
82
m_vel
-= STOMP_ACCEL;
83
setPos(
EGG::Vector3f
(pos().x,
m_vel
+ pos().y, pos().z));
84
checkFloorCollision();
85
}
86
88
void
calcGrounded() {
89
if
(--
m_groundedTimer
== 0) {
90
m_anmState =
AnmState::Rising
;
91
}
92
}
93
95
void
calcRising() {
96
f32 posY = std::min(RISING_VEL + pos().y, m_initialPosY);
97
setPos(EGG::Vector3f(pos().x, posY, pos().z));
98
}
99
100
void
checkFloorCollision();
101
102
static
constexpr
u32 GROUND_DURATION = 60;
103
static
constexpr
u32 STOMP_ACCEL = 17.0f;
104
static
constexpr
f32 STOMP_RADIUS = 20.0f;
105
static
constexpr
EGG::Vector3f STOMP_POS_OFFSET = EGG::Vector3f(0.0f, STOMP_RADIUS, 0.0f);
106
static
constexpr
f32 RISING_VEL = 10.0f;
107
};
108
109
}
// namespace Kinoko::Field
Kinoko::Field::ObjectDossunTsuibiHolder
The manager class for the pair of Thwomps in the long hallway on rBC.
Definition
ObjectDossunTsuibiHolder.hh:12
Kinoko::Field::ObjectDossun::m_fullDuration
u32 m_fullDuration
Framecount of an entire animation loop.
Definition
ObjectDossun.hh:69
Kinoko::Field::ObjectDossun::AnmState
AnmState
Represents the current movement state of the Thwomp in terms of its stomp.
Definition
ObjectDossun.hh:48
Kinoko::Field::ObjectDossun::AnmState::Falling
@ Falling
Slamming down.
Definition
ObjectDossun.hh:51
Kinoko::Field::ObjectDossun::AnmState::BeforeFall
@ BeforeFall
The quick upwards motion before slamming down.
Definition
ObjectDossun.hh:50
Kinoko::Field::ObjectDossun::AnmState::Rising
@ Rising
Resetting.
Definition
ObjectDossun.hh:53
Kinoko::Field::ObjectDossun::AnmState::Grounded
@ Grounded
Contacting the floor.
Definition
ObjectDossun.hh:52
Kinoko::Field::ObjectDossun::m_shakePhase
s32 m_shakePhase
Causes the Thwomp's position to shake at the end of the "still" state.
Definition
ObjectDossun.hh:66
Kinoko::Field::ObjectDossun::m_stillTimer
s32 m_stillTimer
Number of frames the Thwomp will remain stationary (or shakes).
Definition
ObjectDossun.hh:64
Kinoko::Field::ObjectDossun::m_groundedTimer
s32 m_groundedTimer
Number of frames the Thwomp remains on the ground.
Definition
ObjectDossun.hh:65
Kinoko::Field::ObjectDossun::m_vel
f32 m_vel
Vector3f in the base game, but only the y-component is used.
Definition
ObjectDossun.hh:67
Kinoko::Field::ObjectDossun::m_beforeFallTimer
s32 m_beforeFallTimer
Number of frames until the Thwomp will stomp down.
Definition
ObjectDossun.hh:63
Kinoko::Field::ObjectDossun::BEFORE_FALL_DURATION
static constexpr u32 BEFORE_FALL_DURATION
The total number of frames the thwomp rises before crashing down.
Definition
ObjectDossun.hh:75
Kinoko::Kart::KartObject
The highest level abstraction for a kart.
Definition
KartObject.hh:11
Kinoko::System::MapdataGeoObj
Definition
MapdataGeoObj.hh:9
Kinoko::Field
Pertains to collision.
Definition
BoxColManager.cc:10
Kinoko::EGG::Vector3f
A 3D float vector.
Definition
Vector.hh:107
game
field
obj
ObjectDossun.hh
Made by
Malleo
. Logo by
vabold
. Website generated by
Doxygen
1.17.0