mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-10 04:43:26 +00:00
SHERLOCK: Refactored out Scripts class
This commit is contained in:
parent
5b97d581f6
commit
a830d77325
@ -18,7 +18,6 @@ MODULE_OBJS = \
|
||||
resources.o \
|
||||
scene.o \
|
||||
screen.o \
|
||||
scripts.o \
|
||||
sherlock.o \
|
||||
sound.o \
|
||||
talk.o \
|
||||
|
@ -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
|
@ -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
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user