Skip to content

Commit

Permalink
SHERLOCK: Refactored out Scripts class
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Apr 15, 2015
1 parent 5b97d58 commit a830d77
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 106 deletions.
1 change: 0 additions & 1 deletion engines/sherlock/module.mk
Expand Up @@ -18,7 +18,6 @@ MODULE_OBJS = \
resources.o \
scene.o \
screen.o \
scripts.o \
sherlock.o \
sound.o \
talk.o \
Expand Down
42 changes: 0 additions & 42 deletions engines/sherlock/scripts.cpp

This file was deleted.

54 changes: 0 additions & 54 deletions engines/sherlock/scripts.h

This file was deleted.

3 changes: 0 additions & 3 deletions engines/sherlock/sherlock.cpp
Expand Up @@ -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;
Expand All @@ -59,7 +58,6 @@ SherlockEngine::~SherlockEngine() {
delete _people;
delete _scene;
delete _screen;
delete _scripts;
delete _sound;
delete _talk;
delete _ui;
Expand All @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions engines/sherlock/sherlock.h
Expand Up @@ -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"
Expand Down Expand Up @@ -90,7 +89,6 @@ class SherlockEngine : public Engine {
Resources *_res;
Scene *_scene;
Screen *_screen;
Scripts *_scripts;
Sound *_sound;
Talk *_talk;
UserInterface *_ui;
Expand Down
14 changes: 10 additions & 4 deletions engines/sherlock/talk.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions engines/sherlock/talk.h
Expand Up @@ -143,6 +143,8 @@ class Talk {
void pushSequence(int speaker);
void setSequence(int speaker);
bool isSequencesEmpty() const { return _scriptStack.empty(); }

void popStack();
};

} // End of namespace Sherlock
Expand Down

0 comments on commit a830d77

Please sign in to comment.