A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
KartScale.hh
1#pragma once
2
3#include "game/kart/KartObjectProxy.hh"
4#include "game/kart/KartParam.hh"
5
6namespace Kart {
7
9class KartScale : protected KartObjectProxy {
10public:
11 KartScale(const KartParam::Stats &stats);
12 ~KartScale();
13
14 void reset();
15 void calc();
16
17 void startCrush();
18 void endCrush();
19 void startShrink(s32 unk);
20 void endShrink(s32 unk);
21
22 [[nodiscard]] const EGG::Vector3f &sizeScale() const {
23 return m_sizeScale;
24 }
25
26 [[nodiscard]] const EGG::Vector3f &pressScale() const {
27 return m_pressScale;
28 }
29
30private:
31 enum class CrushState {
32 None = -1,
33 Crush = 0,
34 Uncrush = 1,
35 };
36
37 void calcCrush();
38
39 [[nodiscard]] EGG::Vector3f getAnmScale(f32 frame) const;
40
41 s32 m_type;
42 EGG::Vector3f m_scaleTransformOffset;
43 EGG::Vector3f m_scaleTransformSlope;
44 EGG::Vector3f m_sizeScale;
45 bool m_scaleAnmActive;
46 f32 m_anmFrame;
47 std::array<f32, 4> m_scaleTarget;
48 CrushState m_crushState;
51 EGG::Vector3f m_pressScale;
52
53 static constexpr f32 CRUSH_SCALE = 0.3f;
54
55 static constexpr std::array<f32, 4> s_baseScaleStart = {{
56 0.5f,
57 1.0f,
58 1.0f,
59 2.0f,
60 }};
61
62 static constexpr std::array<f32, 4> s_baseScaleTarget = {{
63 1.0f,
64 0.5f,
65 2.0f,
66 1.0f,
67 }};
68};
69
70} // namespace Kart
Base class for most kart-related objects.
Mainly responsible for calculating scaling for the squish/unsquish animation.
Definition KartScale.hh:9
bool m_calcCrush
Set while crush scaling is occurring.
Definition KartScale.hh:49
CrushState m_crushState
Specifies the current crush/uncrush state.
Definition KartScale.hh:48
f32 m_uncrushAnmFrame
Current frame of the unsquish animation.
Definition KartScale.hh:50
Pertains to kart-related functionality.
A 3D float vector.
Definition Vector.hh:88
Various character/vehicle-related handling and speed stats.
Definition KartParam.hh:67