From 67d4de1bb818b2cfc628549ba38cc4f00b8236b2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 Mar 2018 18:27:34 -0500 Subject: XEEN: Move Credits and Please Wait classes into their own files --- engines/xeen/dialogs/credits_screen.cpp | 72 +++++++++++++++++++++++++ engines/xeen/dialogs/credits_screen.h | 41 ++++++++++++++ engines/xeen/dialogs/dialogs.cpp | 67 ----------------------- engines/xeen/dialogs/dialogs.h | 19 ------- engines/xeen/dialogs/please_wait.cpp | 50 +++++++++++++++++ engines/xeen/dialogs/please_wait.h | 45 ++++++++++++++++ engines/xeen/map.cpp | 1 + engines/xeen/module.mk | 12 +++-- engines/xeen/swordsofxeen/swordsofxeen_menu.cpp | 1 + engines/xeen/worldofxeen/worldofxeen_menu.cpp | 1 + 10 files changed, 218 insertions(+), 91 deletions(-) create mode 100644 engines/xeen/dialogs/credits_screen.cpp create mode 100644 engines/xeen/dialogs/credits_screen.h create mode 100644 engines/xeen/dialogs/please_wait.cpp create mode 100644 engines/xeen/dialogs/please_wait.h (limited to 'engines/xeen') 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 */ diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index d57d2585d7..63068cde7a 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -27,6 +27,7 @@ #include "xeen/saves.h" #include "xeen/screen.h" #include "xeen/xeen.h" +#include "xeen/dialogs/please_wait.h" namespace Xeen { diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk index a49d5a3e33..b3e0d9ae86 100644 --- a/engines/xeen/module.mk +++ b/engines/xeen/module.mk @@ -9,11 +9,7 @@ MODULE_OBJS := \ worldofxeen/worldofxeen_resources.o \ swordsofxeen/swordsofxeen.o \ swordsofxeen/swordsofxeen_menu.o \ - character.o \ - combat.o \ - cutscenes.o \ - debugger.o \ - detection.o \ + dialogs/credits_screen.o \ dialogs/dialogs.o \ dialogs/dialogs_awards.o \ dialogs/dialogs_char_info.o \ @@ -34,6 +30,12 @@ MODULE_OBJS := \ dialogs/dialogs_quick_ref.o \ dialogs/dialogs_spells.o \ dialogs/dialogs_whowill.o \ + dialogs/please_wait.o \ + character.o \ + combat.o \ + cutscenes.o \ + debugger.o \ + detection.o \ events.o \ files.o \ font.o \ diff --git a/engines/xeen/swordsofxeen/swordsofxeen_menu.cpp b/engines/xeen/swordsofxeen/swordsofxeen_menu.cpp index 6eb6a647b1..14f20838ae 100644 --- a/engines/xeen/swordsofxeen/swordsofxeen_menu.cpp +++ b/engines/xeen/swordsofxeen/swordsofxeen_menu.cpp @@ -21,6 +21,7 @@ */ #include "xeen/swordsofxeen/swordsofxeen_menu.h" +#include "xeen/dialogs/credits_screen.h" #include "xeen/dialogs/dialogs_difficulty.h" #include "xeen/xeen.h" diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.cpp b/engines/xeen/worldofxeen/worldofxeen_menu.cpp index c0aa9008b5..4797309a9f 100644 --- a/engines/xeen/worldofxeen/worldofxeen_menu.cpp +++ b/engines/xeen/worldofxeen/worldofxeen_menu.cpp @@ -23,6 +23,7 @@ #include "common/scummsys.h" #include "xeen/worldofxeen/worldofxeen_menu.h" #include "xeen/worldofxeen/worldofxeen.h" +#include "xeen/dialogs/credits_screen.h" #include "xeen/dialogs/dialogs_difficulty.h" #include "xeen/resources.h" -- cgit v1.2.3