NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_a_iceball.hpp
1#pragma once
2
3#include <game/bases/d_actor_state.hpp>
4#include <game/bases/d_circle_light_mask.hpp>
5#include <game/bases/d_heap_allocator.hpp>
6
7/// @brief An iceball, thrown by the player.
8/// @paramtable
9/// @statetable
10/// @ingroup bases
11class daIceBall_c : public dActorState_c {
12public:
13 struct GlobalData_t {
14 float calcExtraBoost(float speedDiff) const {
15 return speedDiff * mBoostExtraScale;
16 }
17
18 /// Up to this speed, the iceball's speed boost is calculated by multiplying
19 /// the player's speed by mMoveBoostScale.
21
22 /// Any speed between 0 and moveBoostThreshold is multiplied by this scale
23 /// to determine the iceball's speed boost on bounce.
25
26 /// If the player's speed on iceball bounce is over the boost threshold,
27 /// the extra speed is multiplied by this scale and added to the base speed boost.
29
30 float mLightRadius; ///< The radius of the iceball's light mask.
31 };
32
33 daIceBall_c() {} ///< Creates a new iceball actor.
34 virtual ~daIceBall_c() {} ///< Destroys the iceball actor.
35
36 virtual int create();
37 virtual int doDelete();
38 virtual int execute();
39 virtual int draw();
40 virtual void deleteReady();
41 virtual void setEatTongue(dActor_c *eatingActor);
42 virtual void eatMove(dActor_c *eatingActor);
43
44 STATE_FUNC_DECLARE(daIceBall_c, EatIn); ///< The iceball is being eaten.
45 STATE_FUNC_DECLARE(daIceBall_c, EatNow); ///< The iceball has been eaten.
46 STATE_FUNC_DECLARE(daIceBall_c, FireMove); ///< The iceball is moving downwards after being thrown.
47 STATE_FUNC_DECLARE(daIceBall_c, Kill); ///< The iceball has hit something and should be deleted.
48 STATE_FUNC_DECLARE(daIceBall_c, Move); ///< The iceball hit the ground and is doing a final bounce.
49
50 /// @brief Checks if the iceball is close to the ground so that it can spawn a bit higher up.
51 /// @param groundHeight Output parameter for the ground height.
52 /// @return Whether the iceball is close to the ground.
53 bool checkInitLine(float &groundHeight);
54
55 /// @brief Checks whether the iceball should vanish on creation.
56 /// This happens if the iceball is supposed to spawn inside a wall.
57 /// @return Whether the iceball should vanish.
58 bool checkInitVanish();
59
60 bool bgCheck(); ///< Checks for collisions and returns whether a collision occurred.
61 bool checkDeleteBg(); ///< Checks if the iceball should be deleted due to hitting something.
62 void setDeleteEffect(); ///< Creates an effect for when the iceball gets destroyed.
63 bool cullCheck(); ///< Checks if the iceball is within the camera's view.
64
65 void lightProc(); ///< Updates the iceball's light mask.
66 void chgZpos(); ///< Updates the iceball's Z position.
67
68 /// @brief Checks if the iceball hit the surface of a liquid.
69 /// If it did, it creates a splash effect and sound.
70 /// @return Whether the iceball should be deleted (in case of collision with lava or poison).
71 bool waterlineCheck();
72
73 void waterSplash(float height); ///< Creates a water splash effect and sound at a specified height.
74 void yoganSplash(float height); ///< Creates a lava splash effect and sound at a specified height.
75 void poisonSplash(float height); ///< Creates a poison splash effect and sound at a specified height.
76
77 static void ccCallback_Iceball(dCc_c *self, dCc_c *other); ///< Collision callback for the iceball.
78
79 /// @brief Checks if a new iceball can be created for a player based on the limit mode.
80 /// @param playerNo The player number.
81 /// @param limitMode The limit mode for iceball creation.
82 /// 0: 2 alive iceballs allowed, 1: 6 alive iceballs allowed. @see mAliveTimer
83 /// @return Whether a new iceball can be created.
84 static bool CheckIceballLimit(int playerNo, int limitMode);
85
86 /// @brief Timer for the iceball's lifetime.
87 /// This is used to limit how quickly the player can throw multiple iceballs.
88 /// Once the cooldown reaches zero, the iceball is no longer considered "alive",
89 /// even though it still exists.
91 u32 mHitEntity; ///< Whether the iceball has hit an entity.
92 u8 mPad1[4];
93 dBc_c::WATER_TYPE_e mLiquidType; ///< The type of liquid the iceball is currently in contact with.
94 float mLiquidHeight; ///< The height of the liquid surface the iceball is in contact with.
95 mVec3_c mStartPos; ///< The starting position of the iceball when it was created.
96 dHeapAllocator_c mAllocator; ///< Heap allocator for the iceball.
97 dCircleLightMask_c mLightMask; ///< Light mask for the iceball.
98 u8 mPad2[4];
99
100 ACTOR_PARAM_CONFIG(PlayerNo, 0, 2); ///< The player who threw the iceball.
101 ACTOR_PARAM_CONFIG(Direction, 4, 1); ///< The direction the iceball was thrown.
102 ACTOR_PARAM_CONFIG(Layer, 8, 2); ///< The layer the iceball is on.
103 ACTOR_PARAM_CONFIG(AmiLine, 12, 2); ///< The chainlink fence layer for the iceball.
104 ACTOR_PARAM_CONFIG(LimitMode, 16, 2); ///< The limit mode for the iceball. @see CheckIceballLimit()
105
106 static int sm_IceBallCount[4]; ///< The number of iceballs that currently exist for each player.
107 static int sm_IceBallAliveCount[4]; ///< The number of "alive" iceballs for each player. @see #mAliveTimer
108
109 static const int smc_MAX_ICEBALL_COUNT = 6; ///< @unofficial
110 static const int smc_MAX_ALIVE_ICEBALL_COUNT = 2; ///< @unofficial
111};
dActorState_c()
Constructs a new actor.
The minimum required implementation for a stage actor.
Definition d_actor.hpp:15
Collider ("Collision Check") class - handles collisions between actors.
Definition d_cc.hpp:111
static int sm_IceBallAliveCount[4]
The number of "alive" iceballs for each player.
ACTOR_PARAM_CONFIG(Layer, 8, 2)
The layer the iceball is on.
bool checkInitLine(float &groundHeight)
Checks if the iceball is close to the ground so that it can spawn a bit higher up.
virtual int create()
do method for the create operation.
ACTOR_PARAM_CONFIG(PlayerNo, 0, 2)
The player who threw the iceball.
dBc_c::WATER_TYPE_e mLiquidType
The type of liquid the iceball is currently in contact with.
ACTOR_PARAM_CONFIG(Direction, 4, 1)
The direction the iceball was thrown.
void waterSplash(float height)
Creates a water splash effect and sound at a specified height.
u32 mHitEntity
Whether the iceball has hit an entity.
static const int smc_MAX_ALIVE_ICEBALL_COUNT
bool checkInitVanish()
Checks whether the iceball should vanish on creation. This happens if the iceball is supposed to spaw...
bool bgCheck()
Checks for collisions and returns whether a collision occurred.
mVec3_c mStartPos
The starting position of the iceball when it was created.
void yoganSplash(float height)
Creates a lava splash effect and sound at a specified height.
virtual void eatMove(dActor_c *eatingActor)
Updates the actor's position during eating actions.
static const int smc_MAX_ICEBALL_COUNT
void setDeleteEffect()
Creates an effect for when the iceball gets destroyed.
float mLiquidHeight
The height of the liquid surface the iceball is in contact with.
virtual int doDelete()
do method for the delete operation.
bool checkDeleteBg()
Checks if the iceball should be deleted due to hitting something.
void poisonSplash(float height)
Creates a poison splash effect and sound at a specified height.
void lightProc()
Updates the iceball's light mask.
static int sm_IceBallCount[4]
The number of iceballs that currently exist for each player.
virtual void deleteReady()
Informs the base that it's about to be deleted.
void chgZpos()
Updates the iceball's Z position.
virtual ~daIceBall_c()
Destroys the iceball actor.
static bool CheckIceballLimit(int playerNo, int limitMode)
Checks if a new iceball can be created for a player based on the limit mode.
virtual void setEatTongue(dActor_c *eatingActor)
Callback for when the actor is targeted by Yoshi's tongue.
bool waterlineCheck()
Checks if the iceball hit the surface of a liquid. If it did, it creates a splash effect and sound.
virtual int draw()
do method for the draw operation.
dHeapAllocator_c mAllocator
Heap allocator for the iceball.
ACTOR_PARAM_CONFIG(AmiLine, 12, 2)
The chainlink fence layer for the iceball.
bool cullCheck()
Checks if the iceball is within the camera's view.
static void ccCallback_Iceball(dCc_c *self, dCc_c *other)
Collision callback for the iceball.
dCircleLightMask_c mLightMask
Light mask for the iceball.
ACTOR_PARAM_CONFIG(LimitMode, 16, 2)
The limit mode for the iceball.
daIceBall_c()
Creates a new iceball actor.
virtual int execute()
do method for the execute operation.
u32 mAliveTimer
Timer for the iceball's lifetime. This is used to limit how quickly the player can throw multiple ice...
A three-dimensional floating point vector.
Definition m_vec.hpp:107
#define STATE_FUNC_DECLARE(class, name)
Declares a state.
Definition s_State.hpp:12
float mLightRadius
The radius of the iceball's light mask.