From a830d7732537a913aa29ae4a4bc10e80e79dbc82 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 15 Apr 2015 07:49:10 -0500 Subject: SHERLOCK: Refactored out Scripts class --- engines/sherlock/module.mk | 1 - engines/sherlock/scripts.cpp | 42 --------------------------------- engines/sherlock/scripts.h | 54 ------------------------------------------- engines/sherlock/sherlock.cpp | 3 --- engines/sherlock/sherlock.h | 2 -- engines/sherlock/talk.cpp | 14 +++++++---- engines/sherlock/talk.h | 2 ++ 7 files changed, 12 insertions(+), 106 deletions(-) delete mode 100644 engines/sherlock/scripts.cpp delete mode 100644 engines/sherlock/scripts.h (limited to 'engines') diff --git a/engines/sherlock/module.mk b/engines/sherlock/module.mk index a01f9f0f71..4101769a80 100644 --- a/engines/sherlock/module.mk +++ b/engines/sherlock/module.mk @@ -18,7 +18,6 @@ MODULE_OBJS = \ resources.o \ scene.o \ screen.o \ - scripts.o \ sherlock.o \ sound.o \ talk.o \ diff --git a/engines/sherlock/scripts.cpp b/engines/sherlock/scripts.cpp deleted file mode 100644 index 02dcfa6f0b..0000000000 --- a/engines/sherlock/scripts.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 "sherlock/scripts.h" -#include "sherlock/sherlock.h" - -namespace Sherlock { - -Scripts::Scripts(SherlockEngine *vm): _vm(vm) { - -} - -void Scripts::popStack() { - /* - ScriptEntry script = _scriptStack.pop(); - _scriptName = script._name; -// _scriptSaveIndex = script._index; - _scriptSelect = script._select; - */ -} - - -} // End of namespace Sherlock diff --git a/engines/sherlock/scripts.h b/engines/sherlock/scripts.h deleted file mode 100644 index beea726c8d..0000000000 --- a/engines/sherlock/scripts.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 SHERLOCK_SCRIPTS_H -#define SHERLOCK_SCRIPTS_H - -#include "common/scummsys.h" -#include "common/stack.h" - -namespace Sherlock { - -class SherlockEngine; - -struct ScriptEntry { - Common::String _name; - int _index; - int _select; -}; - -class Scripts { -private: - SherlockEngine *_vm; -public: - -public: - Scripts(SherlockEngine *vm); - - void doScript(const Common::String &str); - - void popStack(); -}; - -} // End of namespace Sherlock - -#endif diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp index 72c072b640..c65a70a20f 100644 --- a/engines/sherlock/sherlock.cpp +++ b/engines/sherlock/sherlock.cpp @@ -39,7 +39,6 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam _res = nullptr; _scene = nullptr; _screen = nullptr; - _scripts = nullptr; _sound = nullptr; _talk = nullptr; _ui = nullptr; @@ -59,7 +58,6 @@ SherlockEngine::~SherlockEngine() { delete _people; delete _scene; delete _screen; - delete _scripts; delete _sound; delete _talk; delete _ui; @@ -84,7 +82,6 @@ void SherlockEngine::initialize() { _people = new People(this); _scene = new Scene(this); _screen = new Screen(this); - _scripts = new Scripts(this); _sound = new Sound(this); _talk = new Talk(this); _ui = new UserInterface(this); diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h index ef10cd2d47..ec8e0c3148 100644 --- a/engines/sherlock/sherlock.h +++ b/engines/sherlock/sherlock.h @@ -40,7 +40,6 @@ #include "sherlock/resources.h" #include "sherlock/scene.h" #include "sherlock/screen.h" -#include "sherlock/scripts.h" #include "sherlock/sound.h" #include "sherlock/talk.h" #include "sherlock/user_interface.h" @@ -90,7 +89,6 @@ public: Resources *_res; Scene *_scene; Screen *_screen; - Scripts *_scripts; Sound *_sound; Talk *_talk; UserInterface *_ui; diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index ef64edd66b..ee1e6201d2 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -160,7 +160,6 @@ void Talk::talkTo(const Common::String &filename) { People &people = *_vm->_people; Scene &scene = *_vm->_scene; Screen &screen = *_vm->_screen; - Scripts &scripts = *_vm->_scripts; UserInterface &ui = *_vm->_ui; Common::Rect savedBounds = screen.getDisplayBounds(); bool abortFlag = false; @@ -459,9 +458,7 @@ void Talk::talkTo(const Common::String &filename) { // If a script was added to the script stack, restore state so that the // previous script can continue - if (!_scriptStack.empty()) { - scripts.popStack(); - } + popStack(); events.setCursor(ARROW); } @@ -1738,5 +1735,14 @@ int Talk::waitForMore(int delay) { return key2; } +void Talk::popStack() { + if (!_scriptStack.empty()) { + ScriptStackEntry scriptEntry = _scriptStack.pop(); + _scriptName = scriptEntry._name; + _scriptSaveIndex = scriptEntry._currentIndex; + _scriptSelect = scriptEntry._select; + _scriptMoreFlag = true; + } +} } // End of namespace Sherlock diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h index bf4f12675c..4a33f2f557 100644 --- a/engines/sherlock/talk.h +++ b/engines/sherlock/talk.h @@ -143,6 +143,8 @@ public: void pushSequence(int speaker); void setSequence(int speaker); bool isSequencesEmpty() const { return _scriptStack.empty(); } + + void popStack(); }; } // End of namespace Sherlock -- cgit v1.2.3