diff options
author | Eugene Sandulenko | 2016-06-19 07:02:39 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | b3676907c5acd43e0cf7667e168809514e54498e (patch) | |
tree | 7f73266bedda552808d8ff66b4c900ebad240b6c | |
parent | 76282dc9d75e7a4a3b3a05b4a376a536a1f48ad2 (diff) | |
download | scummvm-rg350-b3676907c5acd43e0cf7667e168809514e54498e.tar.gz scummvm-rg350-b3676907c5acd43e0cf7667e168809514e54498e.tar.bz2 scummvm-rg350-b3676907c5acd43e0cf7667e168809514e54498e.zip |
DIRECTOR: Lingo: Implemented script execution
-rw-r--r-- | engines/director/lingo/lingo.cpp | 13 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 4ac9c12ed3..fc79167373 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -100,6 +100,8 @@ int Lingo::codeString(const char *str) { } void Lingo::addCode(Common::String code, ScriptType type, uint16 id) { + code += '\n'; + debug(2, "Add code \"%s\" for type %d with id %d", code.c_str(), type, id); if (_scripts[type].contains(id)) { @@ -114,6 +116,17 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) { Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst)); } +void Lingo::executeScript(ScriptType type, uint16 id) { + if (!_scripts[type].contains(id)) { + warning("Request to execute non-existant script type %d id %d", type, id); + return; + } + + for(_pc = &_scripts[type][id]->front(); *_pc != STOP;) { + (*((++_pc)[-1]))(); + } +} + void Lingo::processEvent(LEvent event, int entityId) { if (!_eventHandlerTypes.contains(event)) error("processEvent: Unknown event %d for entity %d", event, entityId); diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index c00d239a67..fba82a26d7 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -99,6 +99,7 @@ public: ~Lingo(); void addCode(Common::String code, ScriptType type, uint16 id); + void executeScript(ScriptType type, uint16 id); void processEvent(LEvent event, int entityId); |