summaryrefslogtreecommitdiff
path: root/src/msgbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/msgbox.cpp')
-rw-r--r--src/msgbox.cpp35
1 files changed, 6 insertions, 29 deletions
diff --git a/src/msgbox.cpp b/src/msgbox.cpp
index 829fcb3..4f8a958 100644
--- a/src/msgbox.cpp
+++ b/src/msgbox.cpp
@@ -78,23 +78,11 @@ int dMsgBoxManager_c::onDelete() {
MessageBoxIsShowing = false;
if (canCancel && StageC4::instance)
StageC4::instance->_1D = 0; // disable no-pause
- msgDataLoader.unload();
return layout.free();
}
/*****************************************************************************/
-// Load Resources
-CREATE_STATE_E(dMsgBoxManager_c, LoadRes);
-
-void dMsgBoxManager_c::executeState_LoadRes() {
- if (msgDataLoader.load("/NewerRes/Messages.bin")) {
- state.setState(&StateID_Wait);
- } else {
- }
-}
-
-/*****************************************************************************/
// Waiting
CREATE_STATE_E(dMsgBoxManager_c, Wait);
@@ -111,25 +99,14 @@ void dMsgBoxManager_c::showMessage(int id, bool canCancel, int delay) {
}
// get the data file
- header_s *data = (header_s*)msgDataLoader.buffer;
+ dScript::Res_c *bmg = GetBMG();
- const wchar_t *title = 0, *msg = 0;
-
- for (int i = 0; i < data->count; i++) {
- if (data->entry[i].id == id) {
- title = (const wchar_t*)((u32)data + data->entry[i].titleOffset);
- msg = (const wchar_t*)((u32)data + data->entry[i].msgOffset);
- break;
- }
- }
-
- if (title == 0) {
- OSReport("Message Box: Message %08x not found\n", id);
- return;
- }
+ nw4r::lyt::TextBox *tb = layout.findTextBoxByName("T_title");
+ nw4r::lyt::TextBox *mb = layout.findTextBoxByName("T_msg");
+ mb->alignment = (2*3) + 3;
- layout.findTextBoxByName("T_title")->SetString(title);
- layout.findTextBoxByName("T_msg")->SetString(msg);
+ Newer_WriteBMGToTextBox(tb, bmg, 110000 + (id >> 8), id & 0xFF, 0);
+ Newer_WriteBMGToTextBox(mb, bmg, 100000 + (id >> 8), id & 0xFF, 0);
this->canCancel = canCancel;
this->delay = delay;