1#include <game/bases/d_pausewindow.hpp>
2#include <game/bases/d_game_com.hpp>
3#include <game/bases/d_scene.hpp>
4#include <game/bases/d_cursor_select.hpp>
5#include <game/bases/d_info.hpp>
6#include <game/bases/d_s_world_map_static.hpp>
7#include <game/bases/d_wm_lib.hpp>
8#include <game/snd/snd_audio_mgr.hpp>
24Pausewindow_c::Pausewindow_c() :
25 mStateMgr(*this, StateID_InitWait),
26 mHasLoadedLayout(false)
31Pausewindow_c::~Pausewindow_c() {}
35 static const char *AnmNameTbl[ANIM_NAME_COUNT] = {
36 "pauseMenu_16_inWindow.brlan",
37 "pauseMenu_16_loopWindow.brlan",
38 "pauseMenu_16_outWindow.brlan",
39 "pauseMenu_16_onButton.brlan",
40 "pauseMenu_16_idleButton.brlan",
41 "pauseMenu_16_offButon.brlan",
42 "pauseMenu_16_hitButton.brlan"
45 static const char *GROUP_NAME_DT[ANIM_COUNT] = {
46 "A00_inWindow",
"A00_inWindow",
"A00_inWindow",
47 "B00_tuzukuButton",
"B02_menuButton",
48 "B00_tuzukuButton",
"B02_menuButton",
49 "B00_tuzukuButton",
"B02_menuButton",
50 "B00_tuzukuButton",
"B02_menuButton"
53 static const int ANIME_INDEX_TBL[ANIM_COUNT] = {
54 inWindow, loopWindow, outWindow,
56 idleButton, idleButton,
61 static const char *textBox[] = {
62 "T_tuzukeru_00",
"T_tuzukeru_01",
63 "T_modoru_00",
"T_modoru_01"
65 static const int msgIdTbl[ARRAY_SIZE(textBox)] = {
66 MSG_PAUSE_CONTINUE, MSG_PAUSE_CONTINUE,
67 MSG_PAUSE_EXIT, MSG_PAUSE_EXIT
70 static const char *textBox2[] = {
71 "T_world_00",
"T_hyphen_00",
"T_multiText_00"
73 static const int msgIdTbl2[ARRAY_SIZE(textBox2)] = {
74 MSG_WM_WORLD, MSG_WM_HYPHEN, MSG_WM_FREE_MODE
77 static const char *PPANE_NAME_DT[P_COUNT] = {
84 static const char *WPANE_NAME_DT[W_COUNT] = {
88 static const char *T_PANE_NAME_TBL[T_COUNT] = {
89 "T_tuzukeru_00",
"T_tuzukeru_01",
90 "T_modoru_00",
"T_modoru_01",
91 "T_worldNum_00",
"T_corseNum_00",
96 static const char *NPANE_NAME_DT[N_COUNT] = {
106 if (!
mLayout.ReadResource(
"pauseMenu/pauseMenu.arc",
false)) {
110 mLayout.build(
"pauseMenu_16.brlyt",
nullptr);
111 mLayout.AnimeResRegister(AnmNameTbl, ANIM_NAME_COUNT);
112 mLayout.GroupRegister(GROUP_NAME_DT, ANIME_INDEX_TBL, ANIM_COUNT);
113 mLayout.TPaneNameRegister(textBox, msgIdTbl, BMG_CATEGORY_PAUSE_WINDOW, ARRAY_SIZE(textBox));
114 mLayout.TPaneNameRegister(textBox2, msgIdTbl2, BMG_CATEGORY_WORLD_MAP, ARRAY_SIZE(textBox2));
129 dGameCom::isNowCourseClear() ||
131 dInfo_c::m_startGameInfo.mLevel1 == STAGE_CANNON
138 dInfo_c::m_startGameInfo.mLevel1 == STAGE_ENEMY ||
139 dInfo_c::m_startGameInfo.mLevel1 == STAGE_ENEMY_2 ||
140 dInfo_c::m_startGameInfo.mLevel1 == STAGE_ENEMY_3
175 MsgRes_c *msgRes = dMessage_c::getMesRes();
176 dInfo_c *info = dInfo_c::getInstance();
177 u8 world = info->getWorld();
178 u8 course = info->getCourse();
179 if (info->getWorld() > WORLD_USED_COUNT) {
180 world = WORLD_USED_COUNT;
182 info->mDisplayCourseWorld = world + 1;
183 mpTextBoxes[T_worldNum_00]->setMessage(msgRes, BMG_CATEGORY_WORLD_MAP, MSG_WM_WORLD_NUM, 0);
186 case STAGE_GHOST_HOUSE:
187 msgID = MSG_WM_ICON_GHOST_HOUSE;
191 msgID = MSG_WM_ICON_TOWER;
195 if (world != LAST_WORLD) {
196 msgID = MSG_WM_ICON_CASTLE;
198 msgID = MSG_WM_ICON_LAST_WORLD_CASTLE;
201 case STAGE_KINOKO_HOUSE:
202 case STAGE_KINOKO_HOUSE_2:
203 case STAGE_KINOKO_HOUSE_3:
204 case STAGE_KINOKO_HOUSE_4:
205 case STAGE_KINOKO_HOUSE_5:
206 case STAGE_KINOKO_HOUSE_6:
207 case STAGE_KINOKO_HOUSE_7:
208 if (dScWMap_c::IsCourseType(world, course, dScWMap_c::COURSE_TYPE_KINOKO_HOUSE_1UP)) {
209 msgID = MSG_WM_ICON_KINOKO_HOUSE_1UP;
210 }
else if (dScWMap_c::IsCourseType(world, course, dScWMap_c::COURSE_TYPE_KINOKO_HOUSE_STAR)) {
211 msgID = MSG_WM_ICON_KINOKO_HOUSE_STAR;
213 msgID = MSG_WM_ICON_KINOKO_HOUSE;
217 if (dWmLib::isStartPointKinokoHouseStar()) {
218 msgID = MSG_WM_ICON_KINOKO_HOUSE_STAR;
219 }
else if (dWmLib::isStartPointKinokoHouseRed()) {
220 msgID = MSG_WM_ICON_KINOKO_HOUSE;
222 msgID = MSG_WM_ICON_KINOKO_HOUSE_1UP;
228 msgID = MSG_WM_ICON_RESCUE;
231 msgID = MSG_WM_ICON_CANNON;
233 case STAGE_PEACH_CASTLE:
234 msgID = MSG_WM_ICON_PEACH_CASTLE;
237 msgID = MSG_WM_ICON_ANCHOR;
240 if (dWmLib::isKoopaShipAnchor()) {
241 msgID = MSG_WM_ICON_ANCHOR;
243 msgID = MSG_WM_ICON_AIRSHIP;
247 info->mDisplayCourseNum = course + 1;
249 mpTextBoxes[T_corseNum_00]->setMessage(msgRes, BMG_CATEGORY_WORLD_MAP, MSG_WM_COURSE_NUM, 0);
255 mpTextBoxes[T_corsePic_00]->setMessage(msgRes, BMG_CATEGORY_WORLD_MAP, msgID, 0);
262 MsgRes_c *msgRes = dMessage_c::getMesRes();
263 dInfo_c *info = dInfo_c::m_instance;
264 int pageIndex = info->mCourseSelectIndexInPage;
265 if (pageIndex >= 10) {
270 info->mCourseSelectPageNum == 0 &&
278 info->mDisplayCourseNum = pageIndex + 1;
279 mpTextBoxes[T_corseNum_00]->setMessage(msgRes, BMG_CATEGORY_WORLD_MAP, MSG_WM_COURSE_NUM, 0);
287 static const int PANE_IDX_TBL[] = {
294void Pausewindow_c::initializeState_InitWait() {}
295void Pausewindow_c::executeState_InitWait() {
300 MsgRes_c *msgRes = dMessage_c::getMesRes();
301 mpTextBoxes[T_tuzukeru_00]->setMessage(msgRes, BMG_CATEGORY_MAIN_MENU, MSG_MAIN_MENU_CONTINUE, 0);
302 mpTextBoxes[T_tuzukeru_01]->setMessage(msgRes, BMG_CATEGORY_MAIN_MENU, MSG_MAIN_MENU_CONTINUE, 0);
303 mpTextBoxes[T_modoru_00]->setMessage(msgRes, BMG_CATEGORY_MAIN_MENU, MSG_MAIN_MENU_TITLE_SCREEN, 0);
304 mpTextBoxes[T_modoru_01]->setMessage(msgRes, BMG_CATEGORY_MAIN_MENU, MSG_MAIN_MENU_TITLE_SCREEN, 0);
308void Pausewindow_c::finalizeState_InitWait() {}
310void Pausewindow_c::initializeState_OpenAnimeEndWait() {
313 mLayout.ReverseAnimeStartSetup(ANIM_ON_TUZUKU,
false);
314 mLayout.ReverseAnimeStartSetup(ANIM_ON_MENU,
false);
315 mLayout.AnimeStartSetup(ANIM_IN_WINDOW,
false);
317void Pausewindow_c::executeState_OpenAnimeEndWait() {
322void Pausewindow_c::finalizeState_OpenAnimeEndWait() {
329void Pausewindow_c::initializeState_ButtonChangeAnimeEndWait() {
338void Pausewindow_c::executeState_ButtonChangeAnimeEndWait() {
343void Pausewindow_c::finalizeState_ButtonChangeAnimeEndWait() {
347void Pausewindow_c::initializeState_PauseDisp() {
350void Pausewindow_c::executeState_PauseDisp() {
357 SndAudioMgr::sInstance->startSystemSe(SE_SYS_CURSOR, 1);
362void Pausewindow_c::finalizeState_PauseDisp() {
363 dSelectCursor_c::m_instance->Cancel(0);
366void Pausewindow_c::initializeState_HitAnimeEndWait() {
370void Pausewindow_c::executeState_HitAnimeEndWait() {
375void Pausewindow_c::finalizeState_HitAnimeEndWait() {
379void Pausewindow_c::initializeState_ClouseAnimeEndWait() {
381 mLayout.AnimeStartSetup(ANIM_OUT_WINDOW,
false);
383void Pausewindow_c::executeState_ClouseAnimeEndWait() {
389void Pausewindow_c::finalizeState_ClouseAnimeEndWait() {
Display a menu that appears when the game is paused inside a course.
nw4r::lyt::Pane * mpNullPanes[N_COUNT]
The null panes of the view.
virtual int create()
do method for the create operation.
static sFStateID_c< Pausewindow_c > StateID_ButtonChangeAnimeEndWait
Waiting for the button change animation to finish.
virtual int draw()
do method for the draw operation.
static Pausewindow_c * m_instance
The static instance of the pause window.
int mColor
The color of the window. Use a value from 0-3 (one per player).
static sFStateID_c< Pausewindow_c > StateID_ClouseAnimeEndWait
Waiting for the close animation to finish. Goes back to InitWait.
sFStateMgr_c< Pausewindow_c, sStateMethodUsr_FI_c > mStateMgr
The state manager for the window.
static sFStateID_c< Pausewindow_c > StateID_HitAnimeEndWait
Waiting for the button hit animation to finish and goes to ClouseAnimeEndWait after.
void setWorldCourseWrite()
Sets the world number and course number / icon.
bool mButtonHit
Whether one of the buttons was hit.
void SelectCursorSetup()
Sets up the cursor for the buttons.
nw4r::lyt::Window * mpWindowPanes[W_COUNT]
The window panes of the view.
bool mHasLoadedLayout
Whether the layout has been loaded.
int mNextButton
The button to be activated next (when the cursor moves).
virtual int doDelete()
do method for the delete operation.
static sFStateID_c< Pausewindow_c > StateID_OpenAnimeEndWait
Waiting for the window to finish the opening animation.
virtual int execute()
do method for the execute operation.
bool mClose
Whether the window was closed via the back button.
bool mIsActive
Whether the window is currently open.
void TitleDispChkWrite()
Sets the visibility of the panes based on the game mode.
static sFStateID_c< Pausewindow_c > StateID_InitWait
Initial state. Switches to OpenAnimeEndWait immediately.
LytTextBox_c * mpTextBoxes[T_COUNT]
The textboxes of the view.
bool mToTitle
Whether to show "Title Screen" instead of "Exit". [This seems to never be set in-game].
nw4r::lyt::Picture * mpPicturePanes[P_COUNT]
The picture panes of the view.
LytBase_c mLayout
The layout for the window.
int mActiveButton
The button currently active.
bool mIsAnimating
Whether an animation is currently playing.
static sFStateID_c< Pausewindow_c > StateID_PauseDisp
Showing the pause window.
static unsigned int mGameFlag
See GAME_FLAG_e.
static ProfileName m_nowScene
The profile name of the current scene.
@ NOT_READY
The step could not completed at this time.
@ SUCCEEDED
The step was completed successfully.
@ STAGE_START_KINOKO_HOUSE
The toad house on the starting node of each world.
#define ACTOR_PROFILE(profName, className, properties)
Creates an actor profile, using the profile number as the execute and draw order value.
#define STATE_DEFINE(class, name)
Defines a state.