NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_a_nice_coin.cpp
1#include <game/bases/d_a_nice_coin.hpp>
2#include <game/bases/d_bg.hpp>
3#include <game/bases/d_multi_manager.hpp>
4
5typedef daNiceCoin_c daNiceCoinRegular_c;
6
7ACTOR_PROFILE(AC_NICE_COIN, daNiceCoin_c, 0);
8ACTOR_PROFILE(AC_NICE_COIN_REGULAR, daNiceCoinRegular_c, 0);
9
12
15 if (mProfName == fProf::AC_NICE_COIN_REGULAR) {
17 }
18
19 if (dBg_c::m_bg_p->CoinGetBitCheck(mPos.x, -mPos.y, m_mbgchoice_keep)) {
20 // Already activated, don't spawn the actor.
21 return FAILED;
22 }
23
24 mCollectionID = ACTOR_PARAM(CollectionID);
25 mReqCoinNum = ACTOR_PARAM(CoinNum);
26 mReqBlueCoinNum = ACTOR_PARAM(BlueCoinNum);
27
29 if (mReqCoinNum != 0 && mReqBlueCoinNum != 0) {
31 }
32 if (mReqCoinNum == 0 && mReqBlueCoinNum != 0) {
34 }
35
36 mStateMgr.changeState(StateID_Search);
37 return SUCCEEDED;
38}
39
41 mStateMgr.executeState();
42 return SUCCEEDED;
43}
44
46 return SUCCEEDED;
47}
48
50 return SUCCEEDED;
51}
52
53void daNiceCoin_c::initializeState_Search() {}
54void daNiceCoin_c::finalizeState_Search() {}
55void daNiceCoin_c::executeState_Search() {
56 bool notCompleted = false;
57
59 notCompleted = true;
60 }
62 notCompleted = true;
63 }
64
65 if (!notCompleted) {
67 dBg_c::m_bg_p->CoinGetBitSet(mPos.x, -mPos.y, mLayer);
68 mStateMgr.changeState(StateID_EndWait);
69 }
70}
71
72void daNiceCoin_c::initializeState_EndWait() {}
73void daNiceCoin_c::finalizeState_EndWait() {}
74void daNiceCoin_c::executeState_EndWait() {}
sFStateMgr_c< dActorState_c, sStateMethodUsr_FI_c > mStateMgr
The state manager.
u8 mLayer
The actor's layer.
Definition d_actor.hpp:377
static u8 m_mbgchoice_keep
Temporary storage for the next created sprite actor's layer. See mLayer.
Definition d_actor.hpp:425
mVec3_c mPos
The actor's position.
void setClapSE()
Plays the clap sound effect.
static dMultiMng_c * mspInstance
The instance of this class.
A tracker for collected coins and blue coins.
virtual int doDelete()
do method for the delete operation.
COLLECT_TYPE_e mCollectType
The type of coins being tracked.
@ TYPE_NICE_COIN_REGULAR
AC_NICE_COIN_REGULAR.
@ TYPE_NICE_COIN
AC_NICE_COIN.
int mReqBlueCoinNum
The number of blue coins that need to be collected.
virtual int create()
do method for the create operation.
virtual int execute()
do method for the execute operation.
int mCollectedCoinNum
The number of coins collected so far.
static sFStateID_c< daNiceCoin_c > StateID_EndWait
Empty state after the coins were collected.
static sFStateID_c< daNiceCoin_c > StateID_Search
Checking if coins are collected.
int mReqCoinNum
The number of coins that need to be collected.
int mCollectionID
The ID used to check for collected coins.
NICE_TYPE_e mNiceType
The type of this actor.
@ TYPE_BOTH
Both normal and blue coins.
@ TYPE_BLUE
Blue coins.
@ TYPE_NORMAL
Normal coins.
int mCollectedBlueCoinNum
The number of blue coins collected so far.
virtual int draw()
do method for the draw operation.
ProfileName mProfName
The base's profile name.
Definition f_base.hpp:63
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:46
@ FAILED
The step could not be completed.
Definition f_base.hpp:47
#define ACTOR_PROFILE(profName, className, properties)
Creates an actor profile, using the profile number as the execute and draw order value.
Definition f_profile.hpp:29
#define STATE_DEFINE(class, name)
Defines a state.
Definition s_State.hpp:36