NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_controller_information.cpp
1#include <d_profileNP/bases/d_controller_information.hpp>
5#include <dol/framework/f_profile_name.hpp>
6#include <dol/snd/snd_audio_mgr.hpp>
7
8BASE_PROFILE(CONTROLLER_INFORMATION, dControllerInformation_c);
9
10dControllerInformation_c::dControllerInformation_c() : mIsCreated(false) {
11}
12
13dControllerInformation_c::~dControllerInformation_c() {}
14
16 if (mIsCreated) {
17 return SUCCEEDED;
18 }
19
20 if (!createLayout()) {
21 return NOT_READY;
22 }
23
24 mLayout.ReverseAnimeStartSetup(IN2BTN, false);
25 mLayout.AnimePlay();
26 mLayout.calc();
27 mIsCreated = true;
28 mVisible = false;
29 mState = IDLE;
30
31 return SUCCEEDED;
32}
33
35
36 static const char *animeNames[] = {
37 "ControllerInformation_07_in2btn.brlan",
38 "ControllerInformation_07_loop2btn.brlan",
39 "ControllerInformation_07_hit2btn.brlan"
40 };
41
42 static const int groupIdxs[] = {0, 1, 2};
43 static const char *groupNames[] = {
44 "A00_2btn_00",
45 "A00_2btn_00",
46 "A00_2btn_00"
47 };
48
49 static const int textBoxMsgs[] = {
50 MSG_HOLD_WIIMOTE_SIDEWAYS,
51 MSG_HOLD_WIIMOTE_SIDEWAYS,
52 };
53
54 static const char *textBoxNames[] = {
55 "T_contInfo_00",
56 "T_contInfo_01"
57 };
58
59 bool res = mLayout.ReadResource("ControllerInformation/ControllerInformation.arc", false);
60 if (!res) {
61 return false;
62 }
63
64 mLayout.build("ControllerInformation_07.brlyt", nullptr);
65 mLayout.AnimeResRegister(animeNames, ARRAY_SIZE(animeNames));
66 mLayout.GroupRegister(groupNames, groupIdxs, ARRAY_SIZE(groupNames));
67 mLayout.TPaneNameRegister(textBoxNames, textBoxMsgs, BMG_CATEGORY_CONTROLLER_INFORMATION, ARRAY_SIZE(textBoxNames));
68
69 return true;
70}
71
73 if (mIsCreated && mVisible) {
74 switch (mState) {
75 case SHOW_IN:
76 mLayout.AnimeStartSetup(IN2BTN, false);
78 break;
79
80 case SHOW_LOOP:
81 if (!mLayout.isAnime(IN2BTN)) {
82 mLayout.LoopAnimeStartSetup(LOOP2BTN);
84 }
85 break;
86
87 case END:
88 SndAudioMgr::sInstance->startSystemSe(SE_SYS_BUTTON_SKIP, 1);
89 mLayout.AnimeEndSetup(IN2BTN);
90 mLayout.AnimeEndSetup(LOOP2BTN);
91 mLayout.AnimeStartSetup(HIT2BTN, false);
92 mState = IDLE;
93 break;
94 }
95 mLayout.AnimePlay();
96 mLayout.calc();
97 }
98 return SUCCEEDED;
99}
100
102 if (mIsCreated && mVisible) {
103 mLayout.entry();
104 }
105 return SUCCEEDED;
106}
107
109 return mLayout.doDelete();
110}
Displays the controller information screen.
bool mIsCreated
If the layout has been successfully created.
STATE_e mState
Which state the base is currently in.
@ WAITING_FOR_END
Play the button animation while waiting for user input.
@ SHOW_IN
Play the button pop-out animation.
@ END
The button has been pressed, play the sound effect and the shrinking button animation.
@ SHOW_LOOP
Wait for the pop-out to finish.
@ IDLE
Initial state; waiting for layout creation.
virtual int execute()
do method for the execute operation.
virtual int doDelete()
do method for the delete operation.
virtual int draw()
do method for the draw operation.
virtual int create()
do method for the create operation.
bool mVisible
If the layout should be rendered.
bool createLayout()
Loads the resources and creates the layout for the base.
LytBase_c mLayout
The layout of the base.
@ LOOP2BTN
The button's blinking loop animation.
@ HIT2BTN
The button's hit animation.
@ IN2BTN
The button's pop-out animation.
@ NOT_READY
The step could not completed at this time.
Definition f_base.hpp:144
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:145
#define BASE_PROFILE(profName, className)
Creates a basic profile, using the profile number as the execute and draw order value.
Definition f_profile.hpp:23