diff options
Diffstat (limited to 'src/msgbox.cpp')
-rw-r--r-- | src/msgbox.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/msgbox.cpp b/src/msgbox.cpp index 30ee66e..ed75f83 100644 --- a/src/msgbox.cpp +++ b/src/msgbox.cpp @@ -101,7 +101,12 @@ void dMsgBoxManager_c::executeState_Wait() { /*****************************************************************************/ // Show Box -void dMsgBoxManager_c::showMessage(int id) { +void dMsgBoxManager_c::showMessage(int id, bool canCancel, int delay) { + if (!this) { + OSReport("ADD A MESSAGE BOX MANAGER YOU MORON\n"); + return; + } + // get the data file header_s *data = (header_s*)msgDataLoader.buffer; @@ -116,12 +121,17 @@ void dMsgBoxManager_c::showMessage(int id) { } if (title == 0) { + OSReport("Message Box: Message %08x not found\n", id); return; } layout.findTextBoxByName("T_title")->SetString(title); layout.findTextBoxByName("T_msg")->SetString(msg); + this->canCancel = canCancel; + this->delay = delay; + layout.findPictureByName("button")->SetVisible(canCancel); + state.setState(&StateID_BoxAppearWait); } @@ -151,10 +161,17 @@ CREATE_STATE(dMsgBoxManager_c, ShownWait); void dMsgBoxManager_c::beginState_ShownWait() { } void dMsgBoxManager_c::executeState_ShownWait() { - int nowPressed = Remocon_GetPressed(GetActiveRemocon()); - - if (nowPressed & WPAD_TWO) { - state.setState(&StateID_BoxDisappearWait); + if (canCancel) { + int nowPressed = Remocon_GetPressed(GetActiveRemocon()); + + if (nowPressed & WPAD_TWO) + state.setState(&StateID_BoxDisappearWait); + } + + if (delay > 0) { + delay--; + if (delay == 0) + state.setState(&StateID_BoxDisappearWait); } } void dMsgBoxManager_c::endState_ShownWait() { } |