diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp index f6c4ef81e1b..464ebd35ab8 100644 --- a/audio/softsynth/mt32.cpp +++ b/audio/softsynth/mt32.cpp @@ -65,12 +65,12 @@ public: // Callbacks for reporting various errors and information void onErrorControlROM() override { - GUI::MessageDialog dialog("MT32Emu: Init Error - Missing or invalid Control ROM image", "OK"); + GUI::MessageDialog dialog("MT32Emu: Init Error - Missing or invalid Control ROM image"); dialog.runModal(); error("MT32emu: Init Error - Missing or invalid Control ROM image"); } void onErrorPCMROM() override { - GUI::MessageDialog dialog("MT32Emu: Init Error - Missing PCM ROM image", "OK"); + GUI::MessageDialog dialog("MT32Emu: Init Error - Missing PCM ROM image"); dialog.runModal(); error("MT32emu: Init Error - Missing PCM ROM image"); } diff --git a/base/main.cpp b/base/main.cpp index a0ca78f68f2..b5eed27653d 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -656,7 +656,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { "Select the folder containing the game's files, then tap **Choose**. \n" "\n" "Repeat steps 1 and 6 for each game." - ), _("Ok"), + ), _("OK"), // I18N: A button caption to dismiss a message and read it later _("Read Later"), Graphics::kTextAlignLeft); @@ -681,7 +681,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { "Select the sub-folder containing the game's files, then tap **Choose**." "\n" "Repeat steps 1 and 6 for each game." - ), _("Ok"), + ), _("OK"), // I18N: A button caption to dismiss a message and read it later _("Read Later"), Graphics::kTextAlignLeft); diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index 23f75c32db5..c3a807e514c 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -574,7 +574,7 @@ MoviePlayer *makeMoviePlayer(AGOSEngine_Feeble *vm, const char *name) { } Common::U32String buf = Common::U32String::format(_("Cutscene file '%s' not found!"), baseName); - GUI::MessageDialog dialog(buf, _("OK")); + GUI::MessageDialog dialog(buf); dialog.runModal(); return NULL; diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp index de23cca8ffc..a8f6cb1ef54 100644 --- a/engines/agos/midi.cpp +++ b/engines/agos/midi.cpp @@ -316,8 +316,7 @@ int MidiPlayer::open() { _("Could not find AdLib instrument definition file\n" "%s. Without this file,\n" "the music will not sound the same as the original game."), - "MT_FM.IBK"), - _("OK")); + "MT_FM.IBK")); dialog.runModal(); _driverMsMusic = new MidiDriver_ADLIB_Multisource(oplType); @@ -374,8 +373,7 @@ int MidiPlayer::open() { _("Could not find AdLib instrument definition file\n" "%s. Without this file,\n" "the sound effects will not sound the same as the original game."), - "MT_FM.IBK"), - _("OK")); + "MT_FM.IBK")); dialog.runModal(); _driverMsSfx = new MidiDriver_ADLIB_Multisource(oplType); @@ -453,8 +451,7 @@ int MidiPlayer::open() { _("Could not find AdLib instrument definition file\n" "%s or %s. Without one of these files,\n" "the music will not sound the same as the original game."), - "MIDPAK.AD", "SETUP.SHR"), - _("OK")); + "MIDPAK.AD", "SETUP.SHR")); dialog.runModal(); _driverMsMusic = new MidiDriver_ADLIB_Multisource(oplType); diff --git a/engines/ags/engine/ac/listbox.cpp b/engines/ags/engine/ac/listbox.cpp index 19216af8367..07d8ef99b78 100644 --- a/engines/ags/engine/ac/listbox.cpp +++ b/engines/ags/engine/ac/listbox.cpp @@ -77,7 +77,7 @@ static void FillSaveList(std::set &files, const String &filePattern) { if ((strcmp(_GP(game).guid, "{a46a9171-f6f9-456c-9b2b-a509b560ddc0}") == 0) && _G(displayed_room) == 1) { ::GUI::MessageDialog dialog(_("The game will now list characters exported from the Sierra games that can be imported:\n" "1. Save files named qfg1*.sav or qfg1vga*.sav inside ScummVM save directory, or\n" - "2. Any .sav file inside the QfG2 Remake game directory"), "Ok"); + "2. Any .sav file inside the QfG2 Remake game directory")); dialog.runModal(); matches = g_system->getSavefileManager()->listSavefiles("qfg1*.sav"); diff --git a/engines/buried/buried.cpp b/engines/buried/buried.cpp index ef40b34312c..44576f1f074 100644 --- a/engines/buried/buried.cpp +++ b/engines/buried/buried.cpp @@ -619,7 +619,7 @@ void BuriedEngine::showPoints() { GUI::MessageDialog dialog( agentEvaluation->_scoringTextDescriptionsWithScores, - "OK", + _("OK"), Common::U32String(), Graphics::kTextAlignLeft ); diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp index 0e82e5caab1..0928815cdf2 100644 --- a/engines/director/lingo/lingo-builtins.cpp +++ b/engines/director/lingo/lingo-builtins.cpp @@ -1715,7 +1715,7 @@ void LB::b_open(int nargs) { if (!debugChannelSet(-1, kDebugFewFramesOnly) && !(g_director->getGameGID() == GID_TEST || g_director->getGameGID() == GID_TESTALL)) { Common::U32String message = Common::String::format("Unsupported command open encountered -> The movie tried to execute open %s %s!", ex.asString().c_str(), d.type != VOID ? d.asString().c_str() : ""); - GUI::MessageDialog dialog(message, _("Ok")); + GUI::MessageDialog dialog(message); dialog.runModal(); } } @@ -2466,7 +2466,7 @@ void LB::b_alert(int nargs) { if (!debugChannelSet(-1, kDebugFewFramesOnly)) { g_director->_wm->clearHandlingWidgets(); - GUI::MessageDialog dialog(alert.c_str(), _("OK")); + GUI::MessageDialog dialog(alert.c_str()); dialog.runModal(); } diff --git a/engines/director/lingo/xlibs/j/jitdraw3.cpp b/engines/director/lingo/xlibs/j/jitdraw3.cpp index 687aab1c566..7415ade1ee1 100644 --- a/engines/director/lingo/xlibs/j/jitdraw3.cpp +++ b/engines/director/lingo/xlibs/j/jitdraw3.cpp @@ -120,7 +120,7 @@ XOBJSTUB(JITDraw3XObj::m_checkifcdrom, 0) void JITDraw3XObj::m_msgokcancel(int nargs) { Common::U32String caption = g_lingo->pop().asString(); // Title of the message box Common::U32String message = g_lingo->pop().asString(); - GUI::MessageDialog dialog(message, _("Ok"), _("Cancel")); + GUI::MessageDialog dialog(message, _("OK"), _("Cancel")); int result = dialog.runModal(); g_lingo->push(Datum(result == GUI::kMessageOK ? 1 : 0)); } @@ -128,7 +128,7 @@ void JITDraw3XObj::m_msgokcancel(int nargs) { void JITDraw3XObj::m_msgok(int nargs) { Common::U32String caption = g_lingo->pop().asString(); // Title of the message box Common::U32String message = g_lingo->pop().asString(); - GUI::MessageDialog dialog(message, _("Ok")); + GUI::MessageDialog dialog(message); dialog.runModal(); g_lingo->push(Datum()); } diff --git a/engines/engine.cpp b/engines/engine.cpp index eb8446218aa..281bee16ed5 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -600,7 +600,7 @@ bool Engine::isDataAndCDAudioReadFromSameCD() { "from the CD. This is known to cause problems,\n" "and it is therefore recommended that you copy\n" "the data files to your hard disk instead.\n" - "See the documentation (CD audio) for details."), _("OK")); + "See the documentation (CD audio) for details.")); dialog.runModal(); return true; } @@ -623,7 +623,7 @@ void Engine::warnMissingExtractedCDAudio() { "tracks need to be ripped from the CD using\n" "an appropriate CD audio extracting tool in\n" "order to listen to the game's music.\n" - "See the documentation (CD audio) for details."), _("OK")); + "See the documentation (CD audio) for details.")); dialog.runModal(); } diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index 5ce1170e139..b28f63e192f 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -662,7 +662,7 @@ void Script::savegame(uint slot, const Common::String &name) { if (!file) { debugC(9, kDebugScript, "Save file pointer is null"); - GUI::MessageDialog dialog(_("Failed to save game"), _("OK")); + GUI::MessageDialog dialog(_("Failed to save game")); dialog.runModal(); return; } diff --git a/engines/mtropolis/mtropolis.cpp b/engines/mtropolis/mtropolis.cpp index d15fd15f385..e4866c0e81c 100644 --- a/engines/mtropolis/mtropolis.cpp +++ b/engines/mtropolis/mtropolis.cpp @@ -110,8 +110,7 @@ Common::Error MTropolisEngine::run() { GUI::MessageDialog dialog( _("This game requires MPEG video support for some\n" "content but MPEG video support was not compiled in.\n" - "The game will still play, but MPEG videos will not work."), - _("OK")); + "The game will still play, but MPEG videos will not work.")); dialog.runModal(); } #endif @@ -120,8 +119,7 @@ Common::Error MTropolisEngine::run() { GUI::MessageDialog dialog( _("This game requires MPEG audio support for some\n" "content but MPEG audio support was not compiled in.\n" - "The game will still play, but some audio will not work."), - _("OK")); + "The game will still play, but some audio will not work.")); dialog.runModal(); } #endif diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index c6b28206a56..5987cc12460 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -98,8 +98,7 @@ Music::Music(SagaEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer), _par _("Could not find AdLib instrument definition files\n" "%s and %s. Without these files,\n" "the music will not sound the same as the original game."), - opl2InstDefFilename, opl3InstDefFilename), - _("OK")); + opl2InstDefFilename, opl3InstDefFilename)); dialog.runModal(); OPL::Config::OplType oplType = diff --git a/engines/scumm/he/net/net_lobby.cpp b/engines/scumm/he/net/net_lobby.cpp index 2b87ac3643e..c261ec00536 100644 --- a/engines/scumm/he/net/net_lobby.cpp +++ b/engines/scumm/he/net/net_lobby.cpp @@ -341,7 +341,7 @@ void Lobby::openUrl(const char *url) { urlString == "http://www.humongoussports.com/backyard/registration/register.asp") { if (_vm->displayMessageYesNo("Online Play for this game is provided by Backyard Sports Online, which is a\nservice provided by the ScummVM project.\nWould you like to go to their registration page?")) { if (!g_system->openUrl("https://backyardsports.online/register")) { - _vm->displayMessage(0, "Failed to open registration URL. Please navigate to this page manually.\n\n\"https://backyardsports.online/register\""); + _vm->displayMessage("Failed to open registration URL. Please navigate to this page manually.\n\n\"https://backyardsports.online/register\""); } } } else { diff --git a/engines/scumm/he/net/net_main.cpp b/engines/scumm/he/net/net_main.cpp index b438b028fd3..f8f7c8148f9 100644 --- a/engines/scumm/he/net/net_main.cpp +++ b/engines/scumm/he/net/net_main.cpp @@ -131,12 +131,12 @@ int Net::hostGame(char *sessionName, char *userName) { _userIdToPeerIndex[_myUserId] = -1; return 1; } else { - _vm->displayMessage(0, "Error Adding User \"%s\" to Session \"%s\"", userName, sessionName); + _vm->displayMessage("Error Adding User \"%s\" to Session \"%s\"", userName, sessionName); endSession(); closeProvider(); } } else { - _vm->displayMessage(0, "Error creating session \"%s\"", userName ); + _vm->displayMessage("Error creating session \"%s\"", userName ); closeProvider(); } @@ -453,7 +453,7 @@ int Net::doJoinSession(Session session) { return true; } } - _vm->displayMessage(0, "Unable to join game session with address \"%s:%d\"", session.host.c_str(), session.port); + _vm->displayMessage("Unable to join game session with address \"%s:%d\"", session.host.c_str(), session.port); return false; } @@ -768,7 +768,7 @@ bool Net::initProvider() { return true; _enet = new Networking::ENet::ENet(); if (!_enet->initialize()) { - _vm->displayMessage(0, "Unable to initialize ENet library."); + _vm->displayMessage("Unable to initialize ENet library."); Net::closeProvider(); return false; } @@ -1243,7 +1243,7 @@ void Net::remoteReceiveData() { if (_gameName == "moonbase") { // TODO: Host migration if (!_isHost && _vm->_currentRoom == 2) { - _vm->displayMessage(0, "You have been disconnected from the game host.\nNormally, host migration would take place, but ScummVM doesn't do that yet, so this game session will now end."); + _vm->displayMessage("You have been disconnected from the game host.\nNormally, host migration would take place, but ScummVM doesn't do that yet, so this game session will now end."); _vm->VAR(253) = 26; // gGameMode = GAME-OVER _vm->runScript(2104, 1, 0, 0); // leave-game } @@ -1404,7 +1404,7 @@ void Net::handleGameData(Common::JSONValue *json, int peerIndex) { if (paramsArray[0]->asIntegerNumber() == 145 && _fromUserId == 1) { if (!_isHost && _vm->_currentRoom == 2) { // TODO: Host migration - _vm->displayMessage(0, "You have been disconnected from the game host.\nNormally, host migration would take place, but ScummVM doesn't do that yet, so this game session will now end."); + _vm->displayMessage("You have been disconnected from the game host.\nNormally, host migration would take place, but ScummVM doesn't do that yet, so this game session will now end."); _vm->VAR(253) = 26; // GAME-OVER _vm->runScript(2104, 1, 0, 0); // leave-game return; diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 72d6980b8cf..2d31e33dd78 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -231,7 +231,7 @@ void ScummEngine::askForDisk(const Common::Path &filename, int disknum) { ConfMan.getPath("path").toString(Common::Path::kNativeSeparator).c_str()); #endif - result = displayMessage("Quit", "%s", buf); + result = displayMessageOKQuit("%s", buf); if (!result) { error("Cannot find file: '%s'", filename.toString(Common::Path::kNativeSeparator).c_str()); } @@ -293,7 +293,7 @@ void ScummEngine::readIndexFile() { } if (checkTryMedia(_fileHandle)) { - displayMessage(nullptr, "You're trying to run game encrypted by ActiveMark. This is not supported."); + displayMessage("You're trying to run game encrypted by ActiveMark. This is not supported."); quitGame(); return; diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index b65972a479f..e6559a50ae6 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1356,7 +1356,7 @@ Common::Error ScummEngine::init() { GUI::MessageDialog dialog(Common::U32String::format( _("Could not find the '%s' Macintosh executable to read resources from. %s will be disabled."), - gameName, (_game.id == GID_MONKEY2 || _game.version > 6) ? _s("The Mac GUI") : _s("The music and the Mac GUI")), _("OK")); + gameName, (_game.id == GID_MONKEY2 || _game.version > 6) ? _s("The Mac GUI") : _s("The music and the Mac GUI"))); dialog.runModal(); } else if (isUsingOriginalGUI() || _game.id == GID_INDY3 || _game.id == GID_LOOM) { // FIXME: THIS IS A TEMPORARY WORKAROUND! @@ -1810,8 +1810,7 @@ void ScummEngine_v7::setupScumm(const Common::Path &macResourceFile) { GUI::MessageDialog dialog(_( "Audio files compressed with ScummVM Tools were detected; *.BUN/*.SOU\n" "compression is not supported anymore for this game, audio will be disabled.\n" - "Please copy the game from the original media without compression."), - _("OK")); + "Please copy the game from the original media without compression.")); dialog.runModal(); _imuseDigital->disableEngine(); } @@ -2300,8 +2299,7 @@ void ScummEngine::setupMusic(int midi) { GUI::MessageDialog dialog( Common::U32String::format( _("Native MIDI support requires the Roland Upgrade from LucasArts,\n" - "but %s is missing. Using AdLib instead."), fileName.toString(Common::Path::kNativeSeparator).c_str()), - _("OK")); + "but %s is missing. Using AdLib instead."), fileName.toString(Common::Path::kNativeSeparator).c_str())); dialog.runModal(); _sound->_musicType = MDT_ADLIB; } @@ -2316,8 +2314,7 @@ void ScummEngine::setupMusic(int midi) { memcmp(_gameMD5, "\xa0\x1f\xab\x4a\x64\xd4\x7b\x96\xe2\xe5\x8e\x6b\x0f\x82\x5c\xc7", 16) == 0) { GUI::MessageDialog dialog( _("This particular version of Monkey Island 1 is known to miss some\n" - "required resources for MT-32. Using AdLib instead."), - _("OK")); + "required resources for MT-32. Using AdLib instead.")); dialog.runModal(); _sound->_musicType = MDT_ADLIB; } @@ -4301,7 +4298,7 @@ void ScummEngine::confirmRestartDialog() { } } -char ScummEngine::displayMessage(const char *altButton, const char *message, ...) { +char ScummEngine::displayMessage(const char *message, ...) { char buf[STRINGBUFLEN]; va_list va; @@ -4309,7 +4306,7 @@ char ScummEngine::displayMessage(const char *altButton, const char *message, ... vsnprintf(buf, STRINGBUFLEN, message, va); va_end(va); - GUI::MessageDialog dialog(buf, "OK", altButton); + GUI::MessageDialog dialog(buf); return runDialog(dialog); } @@ -4325,6 +4322,18 @@ bool ScummEngine::displayMessageYesNo(const char *message, ...) { return runDialog(dialog) == GUI::kMessageOK; } +bool ScummEngine::displayMessageYesNo(const char *message, ...) { + char buf[STRINGBUFLEN]; + va_list va; + + va_start(va, message); + vsnprintf(buf, STRINGBUFLEN, message, va); + va_end(va); + + GUI::MessageDialog dialog(buf, _("OK"), _("Quit")); + return runDialog(dialog) == GUI::kMessageOK; +} + #if defined(ENABLE_HE) && defined(USE_ENET) int ScummEngine_v90he::networkSessionDialog() { GUI::MessageDialog dialog(_("Would you like to host or join a network play session?"), _("Host"), _("Join")); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index a869f33ba13..2458f156a3d 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -803,8 +803,9 @@ protected: void drawDraftsInventory(); public: - char displayMessage(const char *altButton, MSVC_PRINTF const char *message, ...) GCC_PRINTF(3, 4); + char displayMessage(MSVC_PRINTF const char *message, ...) GCC_PRINTF(2, 3); bool displayMessageYesNo(MSVC_PRINTF const char *message, ...) GCC_PRINTF(2, 3); + bool displayMessageOKQuit(MSVC_PRINTF const char *message, ...) GCC_PRINTF(2, 3); protected: byte _fastMode = 0; diff --git a/engines/sky/compact.cpp b/engines/sky/compact.cpp index 5bad4015f76..7e35015a214 100644 --- a/engines/sky/compact.cpp +++ b/engines/sky/compact.cpp @@ -137,7 +137,7 @@ SkyCompact::SkyCompact() { error("unknown \"sky.cpt\" version"); if (SKY_CPT_SIZE != _cptFile->size()) { - GUI::MessageDialog dialog(_("The \"sky.cpt\" engine data file has an incorrect size."), _("OK")); + GUI::MessageDialog dialog(_("The \"sky.cpt\" engine data file has an incorrect size.")); dialog.runModal(); error("Incorrect sky.cpt size (%d, expected: %d)", (int)_cptFile->size(), SKY_CPT_SIZE); } diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp index db438a086d6..f854b9f42d4 100644 --- a/engines/sky/control.cpp +++ b/engines/sky/control.cpp @@ -954,7 +954,7 @@ uint16 Control::saveRestorePanel(bool allowSave) { saveGameTexts[_selectedGame] = dirtyBufStr; saveDescriptions(saveGameTexts); } else if (clickRes == NO_DISK_SPACE) - displayMessage(0, "Could not save the game. (%s)", _saveFileMan->popErrorDesc().c_str()); + displayMessage("Could not save the game. (%s)", _saveFileMan->popErrorDesc().c_str()); quitPanel = true; } _mouseClicked = false; @@ -1002,7 +1002,7 @@ uint16 Control::saveRestorePanel(bool allowSave) { refreshNames = true; } if (clickRes == NO_DISK_SPACE) { - displayMessage(0, "Could not save the game. (%s)", _saveFileMan->popErrorDesc().c_str()); + displayMessage("Could not save the game. (%s)", _saveFileMan->popErrorDesc().c_str()); quitPanel = true; } if ((clickRes == CANCEL_PRESSED) || (clickRes == GAME_RESTORED)) @@ -1153,7 +1153,7 @@ bool Control::isControlPanelOpen() { return _controlPanel; } -int Control::displayMessage(const char *altButton, const char *message, ...) { +int Control::displayMessage(const char *message, ...) { char buf[STRINGBUFLEN]; va_list va; @@ -1161,7 +1161,7 @@ int Control::displayMessage(const char *altButton, const char *message, ...) { vsnprintf(buf, STRINGBUFLEN, message, va); va_end(va); - GUI::MessageDialog dialog(buf, "OK", altButton); + GUI::MessageDialog dialog(buf); int result = dialog.runModal(); _skyMouse->spriteMouse(MOUSE_NORMAL, 0, 0); return result; @@ -1182,7 +1182,7 @@ void Control::saveDescriptions(const Common::StringArray &list) { delete outf; } if (ioFailed) - displayMessage(NULL, "Unable to store Savegame names to file SKY-VM.SAV. (%s)", _saveFileMan->popErrorDesc().c_str()); + displayMessage("Unable to store Savegame names to file SKY-VM.SAV. (%s)", _saveFileMan->popErrorDesc().c_str()); } uint16 Control::saveGameToFile(bool fromControlPanel, const char *filename, bool isAutosave) { @@ -1385,16 +1385,16 @@ uint16 Control::parseSaveData(uint8 *srcBuf) { LODSD(srcPos, size); LODSD(srcPos, saveRev); if (saveRev > SAVE_FILE_REVISION) { - displayMessage(0, "Unknown save file revision (%d)", saveRev); + displayMessage("Unknown save file revision (%d)", saveRev); return RESTORE_FAILED; } else if (saveRev < OLD_SAVEGAME_TYPE) { - displayMessage(0, "This saved game version is unsupported."); + displayMessage("This saved game version is unsupported."); return RESTORE_FAILED; } LODSD(srcPos, gameVersion); if (gameVersion != SkyEngine::_systemVars->gameVersion) { if ((!SkyEngine::isCDVersion()) || (gameVersion < 365)) { // cd versions are compatible - displayMessage(NULL, "This saved game was created by\n" + displayMessage("This saved game was created by\n" "Beneath a Steel Sky v0.0%03d\n" "It cannot be loaded by this version (v0.0%3d)", gameVersion, SkyEngine::_systemVars->gameVersion); @@ -1482,7 +1482,7 @@ uint16 Control::restoreGameFromFile(bool autoSave) { *(uint32 *)saveData = TO_LE_32(infSize); if (inf->read(saveData+4, infSize-4) != infSize-4) { - displayMessage(NULL, "Can't read from file '%s'", filename.c_str()); + displayMessage("Can't read from file '%s'", filename.c_str()); free(saveData); delete inf; return RESTORE_FAILED; diff --git a/engines/sky/control.h b/engines/sky/control.h index 2a32cbe8487..82a690acd85 100644 --- a/engines/sky/control.h +++ b/engines/sky/control.h @@ -198,7 +198,7 @@ public: void saveDescriptions(const Common::StringArray &list); private: - int displayMessage(const char *altButton, MSVC_PRINTF const char *message, ...) GCC_PRINTF(3, 4); + int displayMessage(MSVC_PRINTF const char *message, ...) GCC_PRINTF(2, 3); void initPanel(); void removePanel(); diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp index 0c1a28ad7bd..6dd77a271ff 100644 --- a/engines/sword1/animation.cpp +++ b/engines/sword1/animation.cpp @@ -563,7 +563,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan * Video::VideoDecoder *aviDecoder = new Video::AVIDecoder(12); return new MoviePlayer(vm, textMan, resMan, sound, system, aviDecoder, kVideoDecoderMP2); #else - GUI::MessageDialog dialog(_("MPEG-2 cutscenes found but ScummVM has been built without MPEG-2 support"), _("OK")); + GUI::MessageDialog dialog(_("MPEG-2 cutscenes found but ScummVM has been built without MPEG-2 support")); dialog.runModal(); return 0; #endif @@ -571,7 +571,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan * if (!vm->isPsx() || scumm_stricmp(sequenceList[id], "enddemo") != 0) { Common::U32String buf = Common::U32String::format(_("Cutscene '%s' not found"), sequenceList[id]); - GUI::MessageDialog dialog(buf, _("OK")); + GUI::MessageDialog dialog(buf); dialog.runModal(); } diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp index 8ad897b11a4..1c40eb63566 100644 --- a/engines/sword1/control.cpp +++ b/engines/sword1/control.cpp @@ -2790,7 +2790,7 @@ void Control::drawPsxComponent(int componentType, uint8 *src, uint8 *dst, FrameH free(initialPtr); } -int Control::displayMessage(const char *altButton, const char *message, ...) { +int Control::displayMessage(const char *message, ...) { char buf[STRINGBUFLEN]; va_list va; @@ -2798,7 +2798,7 @@ int Control::displayMessage(const char *altButton, const char *message, ...) { vsnprintf(buf, STRINGBUFLEN, message, va); va_end(va); - GUI::MessageDialog dialog(buf, "OK", altButton); + GUI::MessageDialog dialog(buf); int result = dialog.runModal(); _mouse->setPointer(MSE_POINTER, 0); return result; @@ -2860,7 +2860,7 @@ void Control::saveGameToFile(uint8 slot) { outf = _saveFileMan->openForSaving(fName); if (!outf) { // Display an error message and do nothing - displayMessage(0, "Unable to create file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); + displayMessage("Unable to create file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); return; } @@ -2908,7 +2908,7 @@ void Control::saveGameToFile(uint8 slot) { outf->writeUint32LE(playerRaw[cnt2]); outf->finalize(); if (outf->err()) - displayMessage(0, "Couldn't write to file '%s'. Device full? (%s)", fName, _saveFileMan->popErrorDesc().c_str()); + displayMessage("Couldn't write to file '%s'. Device full? (%s)", fName, _saveFileMan->popErrorDesc().c_str()); delete outf; } @@ -2920,14 +2920,14 @@ bool Control::restoreGameFromFile(uint8 slot) { inf = _saveFileMan->openForLoading(fName); if (!inf) { // Display an error message, and do nothing - displayMessage(0, "Can't open file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); + displayMessage("Can't open file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); return false; } uint saveHeader = inf->readUint32LE(); if (saveHeader != SAVEGAME_HEADER) { // Display an error message, and do nothing - displayMessage(0, "Saved game '%s' is corrupt", fName); + displayMessage("Saved game '%s' is corrupt", fName); return false; } @@ -2973,7 +2973,7 @@ bool Control::restoreGameFromFile(uint8 slot) { playerBuf[cnt2] = inf->readUint32LE(); if (inf->err() || inf->eos()) { - displayMessage(0, "Can't read from file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); + displayMessage("Can't read from file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); delete inf; free(_restoreBuf); _restoreBuf = nullptr; diff --git a/engines/sword1/control.h b/engines/sword1/control.h index ce75304b65a..fd004607df5 100644 --- a/engines/sword1/control.h +++ b/engines/sword1/control.h @@ -202,7 +202,7 @@ private: bool gameVersionIsMediaHouse(); bool loadCustomStrings(const char *filename); - int displayMessage(const char *altButton, MSVC_PRINTF const char *message, ...) GCC_PRINTF(3, 4); + int displayMessage(MSVC_PRINTF const char *message, ...) GCC_PRINTF(2, 3); // PSX Credits functions int32 getCreditsFontHeight(uint8 *font); diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp index c6d502adb84..dbc9282a3fb 100644 --- a/engines/sword1/logic.cpp +++ b/engines/sword1/logic.cpp @@ -1735,7 +1735,7 @@ int Logic::fnRestartGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 int Logic::fnQuitGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) { if (SwordEngine::_systemVars.isDemo) { - GUI::MessageDialog dialog(_("This is the end of the Broken Sword 1 Demo"), _("OK")); + GUI::MessageDialog dialog(_("This is the end of the Broken Sword 1 Demo")); dialog.runModal(); Engine::quitGame(); } else diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp index 64bdac2671d..a7319a02862 100644 --- a/engines/sword2/animation.cpp +++ b/engines/sword2/animation.cpp @@ -456,7 +456,7 @@ MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, OSystem *system Video::AVIDecoder *aviDecoder = new Video::AVIDecoder(12); return new MoviePlayer(vm, system, aviDecoder, kVideoDecoderMP2); #else - GUI::MessageDialog dialog(_("MPEG-2 cutscenes found but ScummVM has been built without MPEG-2 support"), _("OK")); + GUI::MessageDialog dialog(_("MPEG-2 cutscenes found but ScummVM has been built without MPEG-2 support")); dialog.runModal(); return nullptr; #endif @@ -466,7 +466,7 @@ MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, OSystem *system // In addition, some of the later re-releases of the game don't have the "eye" Virgin logo movie. if (!vm->_logic->readVar(DEMO) && strcmp(name, "eye") != 0) { Common::U32String buf = Common::U32String::format(_("Cutscene '%s' not found"), name); - GUI::MessageDialog dialog(buf, _("OK")); + GUI::MessageDialog dialog(buf); dialog.runModal(); } else warning("Cutscene '%s' not found", name); diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index 23ad23191da..1729378a658 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -486,7 +486,7 @@ void SoundManager::setSFXVolumes(uint8 volume) { void SoundManager::showSoundError(const char *errorMsg, const char *soundFile) { Common::String msg; msg = Common::String::format(errorMsg, soundFile); - GUI::MessageDialog dialog(msg.c_str(), "OK"); + GUI::MessageDialog dialog(msg.c_str()); dialog.runModal(); error("%s", msg.c_str()); diff --git a/engines/tinsel/strres.cpp b/engines/tinsel/strres.cpp index 9e88a4366c0..9fca54e0a64 100644 --- a/engines/tinsel/strres.cpp +++ b/engines/tinsel/strres.cpp @@ -98,7 +98,7 @@ void ChangeLanguage(LANGUAGE newLang) { if ((newLang == TXT_ENGLISH) || !f.open(_vm->getTextFile(TXT_ENGLISH))) { char buf[50]; Common::sprintf_s(buf, CANNOT_FIND_FILE, _vm->getTextFile(newLang)); - GUI::MessageDialog dialog(buf, "OK"); + GUI::MessageDialog dialog(buf); dialog.runModal(); error(CANNOT_FIND_FILE, _vm->getTextFile(newLang)); diff --git a/engines/vcruise/vcruise.cpp b/engines/vcruise/vcruise.cpp index d615598be4b..0bb6541d95c 100644 --- a/engines/vcruise/vcruise.cpp +++ b/engines/vcruise/vcruise.cpp @@ -92,8 +92,7 @@ Common::Error VCruiseEngine::run() { if (_gameDescription->desc.flags & VCRUISE_GF_WANT_OGG_VORBIS) { GUI::MessageDialog dialog( _("Music for this game requires Ogg Vorbis support, which was not compiled in.\n" - "The game will still play, but will not have any music."), - _("OK")); + "The game will still play, but will not have any music.")); dialog.runModal(); } #endif @@ -102,8 +101,7 @@ Common::Error VCruiseEngine::run() { if (_gameDescription->desc.flags & VCRUISE_GF_WANT_MP3) { GUI::MessageDialog dialog( _("Music for this game requires MP3 support, which was not compiled in.\n" - "The game will still play, but will not have any music."), - _("OK")); + "The game will still play, but will not have any music.")); dialog.runModal(); } #endif diff --git a/engines/zvision/file/save_manager.cpp b/engines/zvision/file/save_manager.cpp index d190d177a77..4cc007ed6df 100644 --- a/engines/zvision/file/save_manager.cpp +++ b/engines/zvision/file/save_manager.cpp @@ -207,8 +207,7 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea _("This saved game uses version %u, but this engine only " "supports up to version %d. You will need an updated version " "of the engine to use this saved game."), tempVersion, SAVE_VERSION - ), - _("OK")); + )); dialog.runModal(); } diff --git a/gui/downloaddialog.cpp b/gui/downloaddialog.cpp index f58f2484d63..54b4116208d 100644 --- a/gui/downloaddialog.cpp +++ b/gui/downloaddialog.cpp @@ -143,7 +143,7 @@ bool DownloadDialog::selectDirectories() { if (file.getName().equalsIgnoreCase(remoteDirectory.name())) { // If there is, ask user whether it's OK if (!file.isDirectory()) { - GUI::MessageDialog alert(_("Cannot create a directory to download - the specified directory has a file with the same name."), _("OK")); + GUI::MessageDialog alert(_("Cannot create a directory to download - the specified directory has a file with the same name.")); alert.runModal(); return false; } diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 123c52eaac9..1882f10c752 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -563,11 +563,11 @@ void LauncherDialog::loadGame(int item) { } } else { MessageDialog dialog - (_("This game does not support loading games from the launcher."), _("OK")); + (_("This game does not support loading games from the launcher.")); dialog.runModal(); } } else { - MessageDialog dialog(_("ScummVM could not find any engine capable of running the selected game!"), _("OK")); + MessageDialog dialog(_("ScummVM could not find any engine capable of running the selected game!")); dialog.runModal(); } diff --git a/gui/message.cpp b/gui/message.cpp index 4af435ad8d0..a2659e236f7 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -152,6 +152,14 @@ void MessageDialog::reflowLayout() { } } +MessageDialog::MessageDialog(const Common::U32String &message) + : MessageDialog(message, _("OK")) { +} + +MessageDialog::MessageDialog(const Common::String &message) + : MessageDialog(Common::U32String(message), _("OK")) { +} + MessageDialog::MessageDialog(const Common::U32String &message, const Common::U32String &defaultButton, const Common::U32String &altButton, @@ -218,6 +226,11 @@ void TimedMessageDialog::handleTickle() { close(); } +CountdownMessageDialog::CountdownMessageDialog(const Common::U32String &message, + uint32 duration) + : CountdownMessageDialog(message, duration, _("OK")) { +} + CountdownMessageDialog::CountdownMessageDialog(const Common::U32String &message, uint32 duration, const Common::U32String &defaultButton, @@ -253,6 +266,14 @@ void CountdownMessageDialog::updateCountdown() { } } +MessageDialogWithURL::MessageDialogWithURL(const Common::U32String &message, const char *url) + : MessageDialogWithURL(message, url, _("OK")) { +} + +MessageDialogWithURL::MessageDialogWithURL(const Common::String &message, const char *url) + : MessageDialogWithURL(Common::U32String(message), url, _("OK")) { +} + MessageDialogWithURL::MessageDialogWithURL(const Common::U32String &message, const char *url, const Common::U32String &defaultButton, Graphics::TextAlign alignment) : MessageDialog(message, defaultButton, _("Open URL"), alignment, url) { } diff --git a/gui/message.h b/gui/message.h index 2656fa81659..4916ed3196c 100644 --- a/gui/message.h +++ b/gui/message.h @@ -43,14 +43,16 @@ enum { */ class MessageDialog : public Dialog { public: + MessageDialog(const Common::U32String &message); + MessageDialog(const Common::String &message); MessageDialog(const Common::U32String &message, - const Common::U32String &defaultButton = Common::U32String("OK"), + const Common::U32String &defaultButton, const Common::U32String &altButton = Common::U32String(), Graphics::TextAlign alignment = Graphics::kTextAlignCenter, const char *url = nullptr, const Common::U32String &extraMessage = Common::U32String()); MessageDialog(const Common::String &message, - const Common::String &defaultButton = "OK", + const Common::String &defaultButton, const Common::String &altButton = Common::String(), Graphics::TextAlign alignment = Graphics::kTextAlignCenter, const char *url = nullptr); @@ -97,9 +99,11 @@ protected: */ class CountdownMessageDialog : public MessageDialog { public: + CountdownMessageDialog(const Common::U32String &message, + uint32 duration); CountdownMessageDialog(const Common::U32String &message, uint32 duration, - const Common::U32String &defaultButton = Common::U32String("OK"), + const Common::U32String &defaultButton, const Common::U32String &altButton = Common::U32String(), Graphics::TextAlign alignment = Graphics::kTextAlignCenter, const Common::U32String &countdownMessage = Common::U32String("")); @@ -119,8 +123,10 @@ protected: */ class MessageDialogWithURL : public MessageDialog { public: - MessageDialogWithURL(const Common::U32String &message, const char *url, const Common::U32String &defaultButton = Common::U32String("OK"), Graphics::TextAlign alignment = Graphics::kTextAlignCenter); - MessageDialogWithURL(const Common::String &message, const char *url, const char *defaultButton = "OK", Graphics::TextAlign alignment = Graphics::kTextAlignCenter); + MessageDialogWithURL(const Common::U32String &message, const char *url); + MessageDialogWithURL(const Common::String &message, const char *url); + MessageDialogWithURL(const Common::U32String &message, const char *url, const Common::U32String &defaultButton, Graphics::TextAlign alignment = Graphics::kTextAlignCenter); + MessageDialogWithURL(const Common::String &message, const char *url, const char *defaultButton, Graphics::TextAlign alignment = Graphics::kTextAlignCenter); };