diff options
author | Paul Gilbert | 2018-03-04 18:27:34 -0500 |
---|---|---|
committer | Paul Gilbert | 2018-03-04 22:40:43 -0500 |
commit | 67d4de1bb818b2cfc628549ba38cc4f00b8236b2 (patch) | |
tree | 119c70ac00efbec0d479c1ebfecad6a6db9a728a /engines/xeen/dialogs | |
parent | f2b574d64762d23a83cc682da0e622be99080688 (diff) | |
download | scummvm-rg350-67d4de1bb818b2cfc628549ba38cc4f00b8236b2.tar.gz scummvm-rg350-67d4de1bb818b2cfc628549ba38cc4f00b8236b2.tar.bz2 scummvm-rg350-67d4de1bb818b2cfc628549ba38cc4f00b8236b2.zip |
XEEN: Move Credits and Please Wait classes into their own files
Diffstat (limited to 'engines/xeen/dialogs')
-rw-r--r-- | engines/xeen/dialogs/credits_screen.cpp | 72 | ||||
-rw-r--r-- | engines/xeen/dialogs/credits_screen.h | 41 | ||||
-rw-r--r-- | engines/xeen/dialogs/dialogs.cpp | 67 | ||||
-rw-r--r-- | engines/xeen/dialogs/dialogs.h | 19 | ||||
-rw-r--r-- | engines/xeen/dialogs/please_wait.cpp | 50 | ||||
-rw-r--r-- | engines/xeen/dialogs/please_wait.h | 45 |
6 files changed, 208 insertions, 86 deletions
diff --git a/engines/xeen/dialogs/credits_screen.cpp b/engines/xeen/dialogs/credits_screen.cpp new file mode 100644 index 0000000000..8fe0387ccf --- /dev/null +++ b/engines/xeen/dialogs/credits_screen.cpp @@ -0,0 +1,72 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "xeen/dialogs/credits_screen.h" +#include "xeen/resources.h" +#include "xeen/xeen.h" + +namespace Xeen { + +void CreditsScreen::show(XeenEngine *vm) { + CreditsScreen *dlg = new CreditsScreen(vm); + + switch (vm->getGameID()) { + case GType_Clouds: + dlg->execute(Res.CLOUDS_CREDITS); + break; + case GType_Swords: + dlg->execute(Res.SWORDS_CREDITS1); + dlg->execute(Res.SWORDS_CREDITS2); + break; + default: + dlg->execute(Res.DARK_SIDE_CREDITS); + break; + } + + delete dlg; +} + +void CreditsScreen::execute(const char *content) { + Screen &screen = *_vm->_screen; + Windows &windows = *_vm->_windows; + EventsManager &events = *_vm->_events; + + // Handle drawing the credits screen + doScroll(true, false); + windows[GAME_WINDOW].close(); + + screen.loadBackground("marb.raw"); + windows[0].writeString(content); + doScroll(false, false); + + events.setCursor(0); + windows[0].update(); + clearButtons(); + + // Wait for keypress + while (!events.isKeyMousePressed()) + events.pollEventsAndWait(); + + doScroll(true, false); +} + +} // End of namespace Xeen diff --git a/engines/xeen/dialogs/credits_screen.h b/engines/xeen/dialogs/credits_screen.h new file mode 100644 index 0000000000..b52839d5ae --- /dev/null +++ b/engines/xeen/dialogs/credits_screen.h @@ -0,0 +1,41 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef XEEN_DIALOGS_CREDITS_SCREEN_H +#define XEEN_DIALOGS_CREDITS_SCREEN_H + +#include "xeen/dialogs/dialogs.h" + +namespace Xeen { + +class CreditsScreen: public ButtonContainer { +private: + CreditsScreen(XeenEngine *vm) : ButtonContainer(vm) {} + + void execute(const char *content); +public: + static void show(XeenEngine *vm); +}; + +} // End of namespace Xeen + +#endif /* XEEN_DIALOGS_CREDITS_SCREEN_H */ diff --git a/engines/xeen/dialogs/dialogs.cpp b/engines/xeen/dialogs/dialogs.cpp index c9b5658a0e..d7a696b8d5 100644 --- a/engines/xeen/dialogs/dialogs.cpp +++ b/engines/xeen/dialogs/dialogs.cpp @@ -187,71 +187,4 @@ void SettingsBaseDialog::showContents(SpriteResource &title1, bool waitFlag) { checkEvents(_vm); } -/*------------------------------------------------------------------------*/ - -void CreditsScreen::show(XeenEngine *vm) { - CreditsScreen *dlg = new CreditsScreen(vm); - - switch (vm->getGameID()) { - case GType_Clouds: - dlg->execute(Res.CLOUDS_CREDITS); - break; - case GType_Swords: - dlg->execute(Res.SWORDS_CREDITS1); - dlg->execute(Res.SWORDS_CREDITS2); - break; - default: - dlg->execute(Res.DARK_SIDE_CREDITS); - break; - } - - delete dlg; -} - -void CreditsScreen::execute(const char *content) { - Screen &screen = *_vm->_screen; - Windows &windows = *_vm->_windows; - EventsManager &events = *_vm->_events; - - // Handle drawing the credits screen - doScroll(true, false); - windows[GAME_WINDOW].close(); - - screen.loadBackground("marb.raw"); - windows[0].writeString(content); - doScroll(false, false); - - events.setCursor(0); - windows[0].update(); - clearButtons(); - - // Wait for keypress - while (!events.isKeyMousePressed()) - events.pollEventsAndWait(); - - doScroll(true, false); -} - -/*------------------------------------------------------------------------*/ - -PleaseWait::PleaseWait(bool isOops) { - _msg = isOops ? Res.OOPS : Res.PLEASE_WAIT; -} - -PleaseWait::~PleaseWait() { - Windows &windows = *g_vm->_windows; - windows[9].close(); -} - -void PleaseWait::show() { - Windows &windows = *g_vm->_windows; - Window &w = windows[9]; - - if (g_vm->_mode != MODE_0) { - w.open(); - w.writeString(_msg); - w.update(); - } -} - } // End of namespace Xeen diff --git a/engines/xeen/dialogs/dialogs.h b/engines/xeen/dialogs/dialogs.h index cabc921536..9038f75ef8 100644 --- a/engines/xeen/dialogs/dialogs.h +++ b/engines/xeen/dialogs/dialogs.h @@ -113,25 +113,6 @@ public: virtual ~SettingsBaseDialog() {} }; -class CreditsScreen: public ButtonContainer { -private: - CreditsScreen(XeenEngine *vm) : ButtonContainer(vm) {} - - void execute(const char *content); -public: - static void show(XeenEngine *vm); -}; - -class PleaseWait { -private: - Common::String _msg; -public: - PleaseWait(bool isOops = false); - ~PleaseWait(); - - void show(); -}; - } // End of namespace Xeen #endif /* XEEN_DIALOGS_H */ diff --git a/engines/xeen/dialogs/please_wait.cpp b/engines/xeen/dialogs/please_wait.cpp new file mode 100644 index 0000000000..749c6a850a --- /dev/null +++ b/engines/xeen/dialogs/please_wait.cpp @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "xeen/dialogs/please_wait.h" +#include "xeen/resources.h" +#include "xeen/window.h" +#include "xeen/xeen.h" + +namespace Xeen { + +PleaseWait::PleaseWait(bool isOops) { + _msg = isOops ? Res.OOPS : Res.PLEASE_WAIT; +} + +PleaseWait::~PleaseWait() { + Windows &windows = *g_vm->_windows; + windows[9].close(); +} + +void PleaseWait::show() { + Windows &windows = *g_vm->_windows; + Window &w = windows[9]; + + if (g_vm->_mode != MODE_0) { + w.open(); + w.writeString(_msg); + w.update(); + } +} + +} // End of namespace Xeen diff --git a/engines/xeen/dialogs/please_wait.h b/engines/xeen/dialogs/please_wait.h new file mode 100644 index 0000000000..0432e5552a --- /dev/null +++ b/engines/xeen/dialogs/please_wait.h @@ -0,0 +1,45 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef XEEN_DIALOGS_PLEASE_WAIT_H +#define XEEN_DIALOGS_PLEASE_WAIT_H + +#include "xeen/dialogs/dialogs.h" + +namespace Xeen { + +class PleaseWait { +private: + Common::String _msg; +public: + PleaseWait(bool isOops = false); + ~PleaseWait(); + + /** + * Show the dialog + */ + void show(); +}; + +} // End of namespace Xeen + +#endif /* XEEN_DIALOGS_PLEASE_WAIT_H */ |