A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectKoopaBall.hh
1#pragma once
2
3#include "game/field/obj/ObjectCollidable.hh"
4
5#include "game/render/DrawMdl.hh"
6
7namespace Kinoko::Field {
8
9class ObjectKoopaBall final : public ObjectCollidable {
10public:
11 ObjectKoopaBall(const System::MapdataGeoObj &params);
12 ~ObjectKoopaBall() override;
13
14 void init() override;
15 void calc() override;
16
18 [[nodiscard]] LoadFlags loadFlags() const override {
20 }
21
22 Kart::Reaction onCollision(Kart::KartObject *kartObj, Kart::Reaction reactionOnKart,
23 Kart::Reaction reactionOnObj, EGG::Vector3f &hitDepth) override;
24
26 const EGG::Vector3f &getCollisionTranslation() const override {
27 return m_vel;
28 }
29
30private:
31 enum class State {
32 Tangible = 0,
33 Intangible = 1,
34 Exploding = 2,
35 };
36
37 void calcTangible();
38 void calcExploding();
39 void calcIntangible();
40
41 void checkSphereFull();
42
43 State m_state;
45 EGG::Vector3f m_vel;
46 f32 m_angSpeed;
48 Render::DrawMdl *m_bombCoreDrawMdl;
49 s32 m_explodeTimer;
50 u32 m_animFramecount;
51 f32 m_angleRad;
52 f32 m_curScale;
53
54 static constexpr f32 RADIUS_AABB = 870.0f * 2.0f;
55 static constexpr f32 SCALE_INITIAL = RADIUS_AABB / 940.0f * 0.5f;
56 static constexpr f32 SCALE_DELTA = SCALE_INITIAL / 25.0f;
57 static constexpr f32 INITIAL_VELOCITY = 400.0f;
58 static constexpr f32 INITIAL_ANGULAR_SPEED = 3.0f;
59 static constexpr f32 INITIAL_Y_VEL = -30.0f;
60};
61
62} // namespace Kinoko::Field
EGG::TBitFlag< u8, eLoadFlags > LoadFlags
A bitfield of eLoadFlags that represents the update requirements of the object.
Definition ObjectBase.hh:36
@ Calc
The state of the object should be recalculated every frame.
Definition ObjectBase.hh:30
LoadFlags loadFlags() const override
Returns a bitmask indicating which lifecycle hooks should be called for the object.
s32 m_cooldownTimer
Frames until koopa will start to shoot the fireball.
The highest level abstraction for a kart.
Definition KartObject.hh:11
Pertains to collision.
Reaction
Represents the different reactions that can occur when a kart collides with an object.
Definition Reaction.hh:8
A 3D float vector.
Definition Vector.hh:107