A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectPenguin.hh
1#pragma once
2
3#include "game/field/obj/ObjectCollidable.hh"
4
5namespace Field {
6
13public:
15 ~ObjectPenguin() override;
16
17 void init() override;
18
20 void calc() override {
21 if (m_state == State::Walk) {
22 calcWalk();
23 }
24 }
25
27 [[nodiscard]] u32 loadFlags() const override {
28 return 1;
29 }
30
32 virtual void calcWalk() {
33 m_railInterpolator->calc();
34 calcPos();
35 calcRot();
36 }
37
38 void calcRot();
39
41 virtual void calcPos() {
42 m_pos = m_railInterpolator->curPos();
43 m_flags.setBit(eFlags::Position);
44 }
45
46 virtual void enterWalk();
47
48protected:
49 enum class State {
50 Walk = 0,
51 Dive = 1,
52 Slider = 2,
53 SliderSlow = 3,
54 StandUp = 4,
55 };
56
57 State m_state;
58 EGG::Vector3f m_basis;
59};
60
62class ObjectPenguinS final : public ObjectPenguin {
63public:
65 ~ObjectPenguinS() override;
66
67 void init() override;
68 void calc() override;
69
70 void loadAnims() override;
71
73 void calcWalk() override {
74 calcRail();
75 calcPos();
76 calcRot();
77 }
78
80 void enterWalk() override {
81 m_state = State::Walk;
82 }
83
84private:
86 void calcDive() {
87 calcWalk();
88 }
89
90 void calcSlider();
91 void calcStandUp();
92 void calcRail();
93
94 s32 m_anmTimer;
95};
96
97} // namespace Field
Represents the penguins on N64 Sherbet Land that slide on their stomach.
void loadAnims() override
TODO: Maybe not needed.
The base class for penguins on N64 Sherbet Land.
Pertains to collision.
constexpr TBitFlag< T, E > & setBit(Es... es)
Sets the corresponding bits for the provided enum values.
Definition BitFlag.hh:62
A 3D float vector.
Definition Vector.hh:88