diff options
author | Max Horn | 2003-11-02 02:18:16 +0000 |
---|---|---|
committer | Max Horn | 2003-11-02 02:18:16 +0000 |
commit | b27a871f870df854a6db0f4530d4596483927bb1 (patch) | |
tree | f6c75300cd5dcd22b67044256e36a01f985a054d /scumm | |
parent | f2c4bbbdbfb06b5296eb3fcdcb7235292e6ac039 (diff) | |
download | scummvm-rg350-b27a871f870df854a6db0f4530d4596483927bb1.tar.gz scummvm-rg350-b27a871f870df854a6db0f4530d4596483927bb1.tar.bz2 scummvm-rg350-b27a871f870df854a6db0f4530d4596483927bb1.zip |
turned NewGui into a singleton, and made OSystem a pseudo-singleton; added Widget::findWidget (preparing to add support for nested widgets, for the tab widget)
svn-id: r11045
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/debugger.cpp | 2 | ||||
-rw-r--r-- | scumm/dialogs.cpp | 44 | ||||
-rw-r--r-- | scumm/dialogs.h | 20 | ||||
-rw-r--r-- | scumm/resource.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 2 | ||||
-rw-r--r-- | scumm/scumm.h | 4 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 16 | ||||
-rw-r--r-- | scumm/string.cpp | 2 |
8 files changed, 42 insertions, 50 deletions
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index 28c0d9890b..3461bb6ad0 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -40,7 +40,7 @@ extern uint16 _debugLevel; namespace Scumm { ScummDebugger::ScummDebugger(ScummEngine *s) - : Common::Debugger<ScummDebugger>(s->_newgui) { + : Common::Debugger<ScummDebugger>() { _vm = s; // Register variables diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index a8a66c370a..0f66ece8e3 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -192,8 +192,8 @@ enum { kQuitCmd = 'QUIT' }; -SaveLoadDialog::SaveLoadDialog(NewGui *gui, ScummEngine *scumm) - : ScummDialog(gui, scumm, 20, 8, 280, 184) { +SaveLoadDialog::SaveLoadDialog(ScummEngine *scumm) + : ScummDialog(scumm, 20, 8, 280, 184) { const int x = _w - kButtonWidth - 8; int y = 20; @@ -218,9 +218,9 @@ SaveLoadDialog::SaveLoadDialog(NewGui *gui, ScummEngine *scumm) // // Create the sub dialog(s) // - _aboutDialog = new AboutDialog(gui); + _aboutDialog = new AboutDialog(); #ifndef DISABLE_HELP - _helpDialog = new HelpDialog(gui, scumm); + _helpDialog = new HelpDialog(scumm); #endif // The save game list @@ -388,11 +388,11 @@ enum { }; #ifndef _WIN32_WCE -OptionsDialog::OptionsDialog(NewGui *gui, ScummEngine *scumm) - : ScummDialog(gui, scumm, 40, 30, 240, 124) { +OptionsDialog::OptionsDialog(ScummEngine *scumm) + : ScummDialog(scumm, 40, 30, 240, 124) { #else -OptionsDialog::OptionsDialog(NewGui *gui, ScummEngine *scumm) - : ScummDialog(gui, scumm, 40, 30, 240, 124 + kButtonHeight + 4) { +OptionsDialog::OptionsDialog(ScummEngine *scumm) + : ScummDialog(scumm, 40, 30, 240, 124 + kButtonHeight + 4) { #endif // // Add the buttons @@ -442,7 +442,7 @@ OptionsDialog::OptionsDialog(NewGui *gui, ScummEngine *scumm) // Create the sub dialog(s) // #ifdef _WIN32_WCE - _keysDialog = new KeysDialog(gui, scumm); + _keysDialog = new KeysDialog(scumm); #endif } @@ -538,8 +538,8 @@ enum { kPrevCmd = 'PREV' }; -HelpDialog::HelpDialog(NewGui *gui, ScummEngine *scumm) - : ScummDialog(gui, scumm, 5, 5, 310, 190) { +HelpDialog::HelpDialog(ScummEngine *scumm) + : ScummDialog(scumm, 5, 5, 310, 190) { _page = 1; _numPages = ScummHelp::numPages(scumm->_gameId); @@ -608,18 +608,18 @@ void HelpDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { #pragma mark - -InfoDialog::InfoDialog(NewGui *gui, ScummEngine *scumm, int res) -: ScummDialog(gui, scumm, 0, 80, 0, 16) { // dummy x and w +InfoDialog::InfoDialog(ScummEngine *scumm, int res) +: ScummDialog(scumm, 0, 80, 0, 16) { // dummy x and w setInfoText(queryResString (res)); } -InfoDialog::InfoDialog(NewGui *gui, ScummEngine *scumm, const String& message) -: ScummDialog(gui, scumm, 0, 80, 0, 16) { // dummy x and w +InfoDialog::InfoDialog(ScummEngine *scumm, const String& message) +: ScummDialog(scumm, 0, 80, 0, 16) { // dummy x and w setInfoText(message); } void InfoDialog::setInfoText(const String& message) { - int width = _gui->getStringWidth(message.c_str()) + 16; + int width = g_gui.getStringWidth(message) + 16; _x = (_scumm->_screenWidth - width) >> 1; _w = width; @@ -629,12 +629,12 @@ void InfoDialog::setInfoText(const String& message) { #pragma mark - -PauseDialog::PauseDialog(NewGui *gui, ScummEngine *scumm) - : InfoDialog(gui, scumm, 10) { +PauseDialog::PauseDialog(ScummEngine *scumm) + : InfoDialog(scumm, 10) { } -ConfirmExitDialog::ConfirmExitDialog(NewGui *gui, ScummEngine *scumm) - : InfoDialog(gui, scumm, "Do you really want to quit (y/n)?") { +ConfirmExitDialog::ConfirmExitDialog(ScummEngine *scumm) + : InfoDialog(scumm, "Do you really want to quit (y/n)?") { } void ConfirmExitDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { @@ -657,8 +657,8 @@ enum { }; -KeysDialog::KeysDialog(NewGui *gui, ScummEngine *scumm) - : ScummDialog(gui, scumm, 30, 20, 260, 160) { +KeysDialog::KeysDialog(ScummEngine *scumm) + : ScummDialog(scumm, 30, 20, 260, 160) { addButton(160, 20, "Map", kMapCmd, 'M'); // Map addButton(160, 40, "OK", kOKCmd, 'O'); // OK addButton(160, 60, "Cancel", kCancelCmd, 'C'); // Cancel diff --git a/scumm/dialogs.h b/scumm/dialogs.h index 1d268f1c0d..a537436db6 100644 --- a/scumm/dialogs.h +++ b/scumm/dialogs.h @@ -37,8 +37,8 @@ class ScummEngine; class ScummDialog : public Dialog { public: - ScummDialog(NewGui *gui, ScummEngine *scumm, int x, int y, int w, int h) - : Dialog(gui, x, y, w, h), _scumm(scumm) {} + ScummDialog(ScummEngine *scumm, int x, int y, int w, int h) + : Dialog(x, y, w, h), _scumm(scumm) {} protected: typedef Common::String String; @@ -53,7 +53,7 @@ protected: class SaveLoadDialog : public ScummDialog { public: - SaveLoadDialog(NewGui *gui, ScummEngine *scumm); + SaveLoadDialog(ScummEngine *scumm); ~SaveLoadDialog(); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); virtual void open(); @@ -83,7 +83,7 @@ protected: class HelpDialog : public ScummDialog { public: - HelpDialog(NewGui *gui, ScummEngine *scumm); + HelpDialog(ScummEngine *scumm); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); protected: @@ -111,7 +111,7 @@ protected: #endif public: - OptionsDialog(NewGui *gui, ScummEngine *scumm); + OptionsDialog(ScummEngine *scumm); ~OptionsDialog(); virtual void open(); @@ -137,9 +137,9 @@ protected: class InfoDialog : public ScummDialog { public: // arbitrary message - InfoDialog(NewGui *gui, ScummEngine *scumm, const String& message); + InfoDialog(ScummEngine *scumm, const String& message); // from resources - InfoDialog(NewGui *gui, ScummEngine *scumm, int res); + InfoDialog(ScummEngine *scumm, int res); virtual void handleMouseDown(int x, int y, int button, int clickCount) { close(); @@ -155,7 +155,7 @@ protected: class PauseDialog : public InfoDialog { public: - PauseDialog(NewGui *gui, ScummEngine *scumm); + PauseDialog(ScummEngine *scumm); virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers) { if (ascii == ' ') // Close pause dialog if space key is pressed @@ -167,7 +167,7 @@ public: class ConfirmExitDialog : public InfoDialog { public: - ConfirmExitDialog(NewGui *gui, ScummEngine *scumm); + ConfirmExitDialog(ScummEngine *scumm); virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers); }; @@ -175,7 +175,7 @@ public: class KeysDialog : public ScummDialog { public: - KeysDialog(NewGui *gui, ScummEngine *scumm); + KeysDialog(ScummEngine *scumm); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers); diff --git a/scumm/resource.cpp b/scumm/resource.cpp index a15585c298..f2ea764c76 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -240,7 +240,7 @@ void ScummEngine::askForDisk(const char *filename, int disknum) { error("Cannot find file: '%s'", filename); } else { sprintf(buf, "Cannot find file: '%s'", filename); - InfoDialog dialog(_newgui, this, (char*)buf); + InfoDialog dialog(this, (char*)buf); runDialog(dialog); error("Cannot find file: '%s'", filename); } diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index bd4ce37b62..e61bc9c174 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -2425,7 +2425,7 @@ void ScummEngine_v6::o6_kernelSetFunctions() { break; case 3: if (readArray(233,0,50) == 0) { - InfoDialog info(_newgui, this, "Set MineRoad - You can now jump the gorge."); + InfoDialog info(this, "Set MineRoad - You can now jump the gorge."); runDialog(info); writeArray(233, 0, 50, 1); // INSANE callback: Chain diff --git a/scumm/scumm.h b/scumm/scumm.h index 10d1faaed9..9ff5adb0c2 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -34,7 +34,6 @@ class Dialog; class GameDetector; -class NewGui; namespace Scumm { @@ -341,9 +340,6 @@ public: /** We keep running until this is set to true. */ bool _quit; - // GUI - NewGui *_newgui; - protected: Dialog *_pauseDialog; Dialog *_optionsDialog; diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 50a694a130..83d7aac21a 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -64,7 +64,6 @@ extern bool isSmartphone(void); #endif -extern NewGui *g_gui; extern uint16 _debugLevel; namespace Scumm { @@ -307,7 +306,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _videoFinished = false; _smushPlay = false; _quit = false; - _newgui = NULL; _pauseDialog = NULL; _optionsDialog = NULL; _saveLoadDialog = NULL; @@ -650,8 +648,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS // Setup GDI object gdi._numStrips = _screenWidth / 8; - _newgui = g_gui; - // Create debugger _debugger = new ScummDebugger(this); @@ -1366,7 +1362,7 @@ load_game: #endif sprintf(buf, "Successfully saved game state in file:\n\n%s", filename); - TimedMessageDialog dialog(_newgui, buf, 1500); + TimedMessageDialog dialog(buf, 1500); runDialog(dialog); } if (success && _saveLoadFlag != 1) @@ -2459,25 +2455,25 @@ int ScummEngine::runDialog(Dialog &dialog) { void ScummEngine::pauseDialog() { if (!_pauseDialog) - _pauseDialog = new PauseDialog(_newgui, this); + _pauseDialog = new PauseDialog(this); runDialog(*_pauseDialog); } void ScummEngine::saveloadDialog() { if (!_saveLoadDialog) - _saveLoadDialog = new SaveLoadDialog(_newgui, this); + _saveLoadDialog = new SaveLoadDialog(this); runDialog(*_saveLoadDialog); } void ScummEngine::optionsDialog() { if (!_optionsDialog) - _optionsDialog = new OptionsDialog(_newgui, this); + _optionsDialog = new OptionsDialog(this); runDialog(*_optionsDialog); } void ScummEngine::confirmexitDialog() { if (!_confirmExitDialog) - _confirmExitDialog = new ConfirmExitDialog(_newgui, this); + _confirmExitDialog = new ConfirmExitDialog(this); if (runDialog(*_confirmExitDialog)) { _quit = true; @@ -2496,7 +2492,7 @@ char ScummEngine::displayError(bool showCancel, const char *message, ...) { vsprintf(buf, message, va); va_end(va); - MessageDialog dialog(_newgui, buf, "OK", "Cancel"); + MessageDialog dialog(buf, "OK", "Cancel"); return runDialog(dialog); } diff --git a/scumm/string.cpp b/scumm/string.cpp index c0c7041efc..c7c1887e7b 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -80,7 +80,7 @@ void ScummEngine::unkMessage2() { // FIXME: I know this is the right thing to do for MI1 and MI2. For // all other games it's just a guess. - InfoDialog dialog(_newgui, this, (char*)buf); + InfoDialog dialog(this, (char*)buf); VAR(VAR_KEYPRESS) = runDialog(dialog); _messagePtr = tmp; |