SHERLOCK: Refactored out Scripts class
This commit is contained in:
parent
5b97d581f6
commit
a830d77325
7 changed files with 12 additions and 106 deletions
|
@ -18,7 +18,6 @@ MODULE_OBJS = \
|
||||||
resources.o \
|
resources.o \
|
||||||
scene.o \
|
scene.o \
|
||||||
screen.o \
|
screen.o \
|
||||||
scripts.o \
|
|
||||||
sherlock.o \
|
sherlock.o \
|
||||||
sound.o \
|
sound.o \
|
||||||
talk.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;
|
_res = nullptr;
|
||||||
_scene = nullptr;
|
_scene = nullptr;
|
||||||
_screen = nullptr;
|
_screen = nullptr;
|
||||||
_scripts = nullptr;
|
|
||||||
_sound = nullptr;
|
_sound = nullptr;
|
||||||
_talk = nullptr;
|
_talk = nullptr;
|
||||||
_ui = nullptr;
|
_ui = nullptr;
|
||||||
|
@ -59,7 +58,6 @@ SherlockEngine::~SherlockEngine() {
|
||||||
delete _people;
|
delete _people;
|
||||||
delete _scene;
|
delete _scene;
|
||||||
delete _screen;
|
delete _screen;
|
||||||
delete _scripts;
|
|
||||||
delete _sound;
|
delete _sound;
|
||||||
delete _talk;
|
delete _talk;
|
||||||
delete _ui;
|
delete _ui;
|
||||||
|
@ -84,7 +82,6 @@ void SherlockEngine::initialize() {
|
||||||
_people = new People(this);
|
_people = new People(this);
|
||||||
_scene = new Scene(this);
|
_scene = new Scene(this);
|
||||||
_screen = new Screen(this);
|
_screen = new Screen(this);
|
||||||
_scripts = new Scripts(this);
|
|
||||||
_sound = new Sound(this);
|
_sound = new Sound(this);
|
||||||
_talk = new Talk(this);
|
_talk = new Talk(this);
|
||||||
_ui = new UserInterface(this);
|
_ui = new UserInterface(this);
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include "sherlock/resources.h"
|
#include "sherlock/resources.h"
|
||||||
#include "sherlock/scene.h"
|
#include "sherlock/scene.h"
|
||||||
#include "sherlock/screen.h"
|
#include "sherlock/screen.h"
|
||||||
#include "sherlock/scripts.h"
|
|
||||||
#include "sherlock/sound.h"
|
#include "sherlock/sound.h"
|
||||||
#include "sherlock/talk.h"
|
#include "sherlock/talk.h"
|
||||||
#include "sherlock/user_interface.h"
|
#include "sherlock/user_interface.h"
|
||||||
|
@ -90,7 +89,6 @@ public:
|
||||||
Resources *_res;
|
Resources *_res;
|
||||||
Scene *_scene;
|
Scene *_scene;
|
||||||
Screen *_screen;
|
Screen *_screen;
|
||||||
Scripts *_scripts;
|
|
||||||
Sound *_sound;
|
Sound *_sound;
|
||||||
Talk *_talk;
|
Talk *_talk;
|
||||||
UserInterface *_ui;
|
UserInterface *_ui;
|
||||||
|
|
|
@ -160,7 +160,6 @@ void Talk::talkTo(const Common::String &filename) {
|
||||||
People &people = *_vm->_people;
|
People &people = *_vm->_people;
|
||||||
Scene &scene = *_vm->_scene;
|
Scene &scene = *_vm->_scene;
|
||||||
Screen &screen = *_vm->_screen;
|
Screen &screen = *_vm->_screen;
|
||||||
Scripts &scripts = *_vm->_scripts;
|
|
||||||
UserInterface &ui = *_vm->_ui;
|
UserInterface &ui = *_vm->_ui;
|
||||||
Common::Rect savedBounds = screen.getDisplayBounds();
|
Common::Rect savedBounds = screen.getDisplayBounds();
|
||||||
bool abortFlag = false;
|
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
|
// If a script was added to the script stack, restore state so that the
|
||||||
// previous script can continue
|
// previous script can continue
|
||||||
if (!_scriptStack.empty()) {
|
popStack();
|
||||||
scripts.popStack();
|
|
||||||
}
|
|
||||||
|
|
||||||
events.setCursor(ARROW);
|
events.setCursor(ARROW);
|
||||||
}
|
}
|
||||||
|
@ -1738,5 +1735,14 @@ int Talk::waitForMore(int delay) {
|
||||||
return key2;
|
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
|
} // End of namespace Sherlock
|
||||||
|
|
|
@ -143,6 +143,8 @@ public:
|
||||||
void pushSequence(int speaker);
|
void pushSequence(int speaker);
|
||||||
void setSequence(int speaker);
|
void setSequence(int speaker);
|
||||||
bool isSequencesEmpty() const { return _scriptStack.empty(); }
|
bool isSequencesEmpty() const { return _scriptStack.empty(); }
|
||||||
|
|
||||||
|
void popStack();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace Sherlock
|
} // End of namespace Sherlock
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue