diff options
-rw-r--r-- | sword2/build_display.cpp | 35 | ||||
-rw-r--r-- | sword2/controls.cpp | 29 | ||||
-rw-r--r-- | sword2/function.cpp | 1 | ||||
-rw-r--r-- | sword2/resman.cpp | 14 | ||||
-rw-r--r-- | sword2/sword2.h | 1 |
5 files changed, 20 insertions, 60 deletions
diff --git a/sword2/build_display.cpp b/sword2/build_display.cpp index f03c475c8d..8a8ce847c7 100644 --- a/sword2/build_display.cpp +++ b/sword2/build_display.cpp @@ -115,7 +115,8 @@ void Sword2Engine::buildDisplay(void) { /** * Fades down and displays a message on the screen. * @param text The message - * @param time The number of seconds to display the message + * @param time The number of seconds to display the message, or 0 to display it + * until the user clicks the mouse or presses a key. */ void Sword2Engine::displayMsg(byte *text, int time) { @@ -171,27 +172,27 @@ void Sword2Engine::displayMsg(byte *text, int time) { free(text_spr); _graphics->waitForFade(); - uint32 targetTime = _system->get_msecs() + (time * 1000); + if (time > 0) { + uint32 targetTime = _system->get_msecs() + (time * 1000); + sleepUntil(targetTime); + } else { + while (!_quit) { + MouseEvent *me = mouseEvent(); + if (me && (me->buttons & (RD_LEFTBUTTONDOWN | RD_RIGHTBUTTONDOWN))) + break; - sleepUntil(targetTime); - _graphics->setPalette(0, 256, oldPal, RDPAL_FADE); - _graphics->fadeUp(); -} + if (keyboardEvent()) + break; -/** - * Fades message down and removes it, fading up again afterwards - */ + _graphics->updateDisplay(); + _system->delay_msecs(50); + } + } -void Sword2Engine::removeMsg(void) { _graphics->fadeDown(); _graphics->waitForFade(); - _graphics->clearScene(); - - // _graphics->fadeUp(); - // removed by JEL (08oct97) to prevent "eye" smacker corruption when - // restarting game from CD2 and also to prevent palette flicker when - // restoring game to a different CD since the "insert CD" message uses - // this routine to clean up! + _graphics->setPalette(0, 256, oldPal, RDPAL_FADE); + _graphics->fadeUp(); } void Sword2Engine::drawBackPar0Frames(void) { diff --git a/sword2/controls.cpp b/sword2/controls.cpp index b628648115..e710813247 100644 --- a/sword2/controls.cpp +++ b/sword2/controls.cpp @@ -1164,8 +1164,6 @@ private: Button *_okButton; Button *_cancelButton; - void saveLoadError(byte *text); - public: SaveLoadDialog(Gui *gui, int mode) : Dialog(gui), _mode(mode), _selectedSlot(-1) { @@ -1433,7 +1431,7 @@ public: break; } - saveLoadError(_gui->_vm->fetchTextLine(_gui->_vm->_resman->openResource(textId / SIZE), textId & 0xffff) + 2); + _gui->_vm->displayMsg(_gui->_vm->fetchTextLine(_gui->_vm->_resman->openResource(textId / SIZE), textId & 0xffff) + 2, 0); result = 0; } } else { @@ -1454,7 +1452,7 @@ public: break; } - saveLoadError(_gui->_vm->fetchTextLine(_gui->_vm->_resman->openResource(textId / SIZE), textId & 0xffff) + 2); + _gui->_vm->displayMsg(_gui->_vm->fetchTextLine(_gui->_vm->_resman->openResource(textId / SIZE), textId & 0xffff) + 2, 0); result = 0; } else { // Prime system with a game cycle @@ -1476,29 +1474,6 @@ public: } }; -void SaveLoadDialog::saveLoadError(byte* text) { - // Print a message on screen. Second parameter is duration. - _gui->_vm->displayMsg((byte *) text, 0); - - // Wait for ESC or mouse click - while (1) { - _gui->_vm->_graphics->updateDisplay(); - - KeyboardEvent *ke = _gui->_vm->keyboardEvent(); - if (ke && ke->keycode == 27) - break; - - MouseEvent *me = _gui->_vm->mouseEvent(); - if (me && (me->buttons & RD_LEFTBUTTONDOWN)) - break; - - _gui->_vm->_system->delay_msecs(20); - } - - // Remove the message. - _gui->_vm->removeMsg(); -} - Gui::Gui(Sword2Engine *vm) : _vm(vm), _baseSlot(0) { int i; diff --git a/sword2/function.cpp b/sword2/function.cpp index 9feca89f3e..4f95b89852 100644 --- a/sword2/function.cpp +++ b/sword2/function.cpp @@ -304,7 +304,6 @@ int32 Logic::fnDisplayMsg(int32 *params) { _vm->displayMsg(_vm->fetchTextLine(_vm->_resman->openResource(text_res), local_text) + 2, 3); _vm->_resman->closeResource(text_res); - _vm->removeMsg(); return IR_CONT; } diff --git a/sword2/resman.cpp b/sword2/resman.cpp index 1788855b43..a92ac23cf9 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -858,20 +858,6 @@ void ResourceManager::getCd(int cd) { // // CD1: "RBSII1" (or "PCF76" for the PCF76 version, whatever that is) // CD2: "RBSII2" - - while (1) { - MouseEvent *me = _vm->mouseEvent(); - if (me && (me->buttons & (RD_LEFTBUTTONDOWN | RD_RIGHTBUTTONDOWN))) - break; - - if (_vm->keyboardEvent()) - break; - - _vm->_graphics->updateDisplay(); - _vm->_system->delay_msecs(50); - } - - _vm->removeMsg(); } } // End of namespace Sword2 diff --git a/sword2/sword2.h b/sword2/sword2.h index 29f4267c0b..0c7027847b 100644 --- a/sword2/sword2.h +++ b/sword2/sword2.h @@ -210,7 +210,6 @@ public: void resetRenderLists(void); void buildDisplay(void); void displayMsg(byte *text, int time); - void removeMsg(void); void setFullPalette(int32 palRes); int32 registerFrame(int32 *params); |