NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_a_boss_demo.cpp
1#include <game/bases/d_a_boss_demo.hpp>
2#include <game/bases/d_a_player_manager.hpp>
3#include <game/bases/d_a_player_demo_manager.hpp>
4#include <game/bases/d_actor_manager.hpp>
5#include <game/bases/d_game_com.hpp>
6#include <game/bases/d_multi_manager.hpp>
7#include <game/bases/d_s_stage.hpp>
8#include <game/bases/d_wm_lib.hpp>
9#include <game/sLib/s_GlobalData.hpp>
10
15
16GLOBAL_DATA_DEF(daBossDemo_c, {
17 false
18});
19
21 if (dActorMng_c::m_instance->mpCurrBossDemo != nullptr) {
23 return NOT_READY;
24 }
25
26 dActorMng_c::m_instance->mpCurrBossDemo = this;
27 initialize();
28 mStateMgr.changeState(StateID_Ready);
29 mStateMgr.refreshState();
30 return SUCCEEDED;
31}
32
34 mStateMgr.executeState();
35 return SUCCEEDED;
36}
37
39 return SUCCEEDED;
40}
41
43
45 return SUCCEEDED;
46}
47
50 if (multiMng == nullptr) {
51 return;
52 }
53
54 multiMng->setCollectionCoin();
55 for (int i = 0; i < PLAYER_COUNT; i++) {
56 int rest = daPyMng_c::getRest(daPyMng_c::getPlayerType(i));
57 multiMng->setRest(rest, i);
58 }
59}
60
62 if (daPyMng_c::getNum() == daPyMng_c::getEntryNum()) {
63 dGameCom::setMultiCourseClear(3);
64 } else {
65 dGameCom::setMultiCourseClear(1);
66 }
67}
68
70 dScStage_c::setNextScene(fProf::WORLD_MAP, 0, dScStage_c::EXIT_0, dFader_c::FADER_MARIO);
71 return false;
72}
73
75 dScStage_c::setNextScene(fProf::WORLD_MAP, 0, dScStage_c::EXIT_2, dFader_c::FADER_CIRCLE_MIDDLE);
76}
77
79 if (GLOBAL_DATA.mForceOtehonClear) {
80 dOtehonClear_c *otehon = dScStage_c::m_OtehonClear_p;
81 otehon->m_b9 = b;
82 otehon->m_b8 = true;
83 otehon->m_b5 = true;
84 return true;
85 }
86
87 if (isOtehonClear()) {
88 dOtehonClear_c *otehon = dScStage_c::m_OtehonClear_p;
89 otehon->m_b9 = b;
90 otehon->m_b8 = true;
91 otehon->m_b5 = true;
92 return true;
93 }
94
95 return false;
96}
97
99 if (GLOBAL_DATA.mForceOtehonClear) {
100 return true;
101 }
102
103 bool result = false;
104 int world = dScStage_c::m_instance->mCurrWorld;
105 int course = dScStage_c::m_instance->mCurrCourse;
106 if (
107 dInfo_c::m_startGameInfo.mGameMode == dInfo_c::GAME_MODE_SUPER_GUIDE &&
108 !dWmLib::IsCourseClear(world, course)
109 ) {
110 result = true;
111 }
112 return result;
113}
114
115void daBossDemo_c::initializeState_Ready() {}
116void daBossDemo_c::finalizeState_Ready() {}
117void daBossDemo_c::executeState_Ready() {
118 if (mBossID == BASE_ID_NULL) {
119 dEnBoss_c *boss = bossSearch();
120 if (boss != nullptr) {
121 mBossID = boss->getID();
122 }
123 }
124
126 mStateMgr.changeState(StateID_BattleStDemo);
127 }
128}
129
130void daBossDemo_c::initializeState_BattleStDemo() {}
131void daBossDemo_c::finalizeState_BattleStDemo() {}
132void daBossDemo_c::executeState_BattleStDemo() {}
133
134void daBossDemo_c::initializeState_BattleIn() {
135 daPyDemoMng_c::mspInstance->releaseDemoMode(1);
136
137 dEnBoss_c *boss = (dEnBoss_c *) fManager_c::searchBaseByID(mBossID);
138 if (boss != nullptr) {
139 boss->setBattleReady();
140 }
141
142 mBattleEnd = false;
143}
144void daBossDemo_c::finalizeState_BattleIn() {}
145void daBossDemo_c::executeState_BattleIn() {
146 if (checkBattleEdDemo()) {
147 mStateMgr.changeState(StateID_BattleEdDemo);
148 }
149}
150
151void daBossDemo_c::initializeState_BattleEdDemo() {}
152void daBossDemo_c::finalizeState_BattleEdDemo() {}
153void daBossDemo_c::executeState_BattleEdDemo() {}
sFStateMgr_c< dActorState_c, sStateMethodUsr_FI_c > mStateMgr
The state manager.
Multiplayer manager. Keeps track of statistics for each player, used for Coin Battle and Free Mode.
void setRest(int rest, int plrNo)
Sets the remaining lives for a player.
static dMultiMng_c * mspInstance
The instance of this class.
void setCollectionCoin()
Loads the star coin collection information.
Base class for boss battle cutscene managers.
void setBattleResult()
Saves the star coins collected and the remaining lives of each player.
bool isOtehonClear()
Returns whether this course was only cleared by the Super Guide.
BOOL mBattleEnd
Whether the boss battle has ended.
virtual BOOL checkBattleStDemo()
Returns whether the boss battle start cutscene is ready to play.
virtual BOOL checkBattleEdDemo()
Returns whether the boss battle end cutscene is ready to play.
virtual int draw() override
do method for the draw operation.
virtual int create() override
do method for the create operation.
virtual int doDelete() override
do method for the delete operation.
virtual void initialize()
Subclass-specific initialization code.
virtual dEnBoss_c * bossSearch()
Returns the corresponding boss actor.
virtual bool demoScroll()
Returns whether the camera has finished scrolling to the boss.
virtual void deleteReady() override
Informs the base that it's about to be deleted.
virtual void retryAfterOtehonClear()
Returns to the world map without clearing the course after finishing it with Super Guide.
virtual int execute() override
do method for the execute operation.
static sFStateVirtualID_c< daBossDemo_c > StateID_BattleStDemo
In the boss battle starting cutscene.
fBaseID_e mBossID
The ID of the boss actor.
bool checkStartRetry(bool b)
Returns whether to show the "Want to try without Super Guide?" prompt.
virtual bool abandonRetryAfterOtehonClear()
Returns to the world map and clears the course after finishing it with Super Guide.
void setMultiCourseClear()
Marks the course as cleared.
static sFStateVirtualID_c< daBossDemo_c > StateID_Ready
Ready for the boss battle cutscene to start.
static sFStateVirtualID_c< daBossDemo_c > StateID_BattleEdDemo
In the boss battle ending cutscene.
void deleteRequest()
Requests deletion of the base.
Definition f_base.cpp:289
@ NOT_READY
The step could not completed at this time.
Definition f_base.hpp:45
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:46
static fBase_c * searchBaseByID(fBaseID_e id)
Searches for a base with the given ID.
Definition f_manager.cpp:18
@ BASE_ID_NULL
Represents the null base.
Definition f_base_id.hpp:7
#define STATE_VIRTUAL_DEFINE(class, name)
Defines a virtual state.
Definition s_State.hpp:46