aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstevenhoefel2017-01-10 09:24:21 +1100
committerstevenhoefel2017-01-10 09:24:21 +1100
commit60f936d1f7e0abb92e1bb12b19c61d2b45b53749 (patch)
tree29c1e509bdcfe2d6afcca457c1f7c9ec28c09ee5
parent0e20548c157f21e14381110d92b539c27bb9ef63 (diff)
downloadscummvm-rg350-60f936d1f7e0abb92e1bb12b19c61d2b45b53749.tar.gz
scummvm-rg350-60f936d1f7e0abb92e1bb12b19c61d2b45b53749.tar.bz2
scummvm-rg350-60f936d1f7e0abb92e1bb12b19c61d2b45b53749.zip
DIRECTOR: More work to get events triggering. Loop all frames in score.
-rw-r--r--engines/director/cast.h2
-rw-r--r--engines/director/lingo/lingo-code.cpp2
-rw-r--r--engines/director/lingo/lingo.cpp3
-rw-r--r--engines/director/lingo/lingo.h2
-rw-r--r--engines/director/score.cpp8
-rw-r--r--engines/director/score.h3
6 files changed, 11 insertions, 9 deletions
diff --git a/engines/director/cast.h b/engines/director/cast.h
index a739ccc25d..0d06f23da8 100644
--- a/engines/director/cast.h
+++ b/engines/director/cast.h
@@ -40,7 +40,7 @@ enum CastType {
kCastShape = 8,
kCastMovie = 9,
kCastDigitalVideo = 10,
- kCastScript = 11
+ kCastLingoScript = 11
};
struct Cast {
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index c9f9c14e84..7531a87157 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -856,7 +856,7 @@ void Lingo::c_call() {
g_lingo->call(name, nargs);
}
-void Lingo::call(Common::String name, int nargs) {
+void Lingo::call(Common::String name, int entityId) {
bool dropArgs = false;
Symbol *sym;
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 5eb687fe99..2811c0cc65 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -269,6 +269,7 @@ ScriptType Lingo::event2script(LEvent ev) {
}
void Lingo::processEvent(LEvent event, int entityId) {
+ if (entityId <= 0) return;
if (!_eventHandlerTypes.contains(event))
error("processEvent: Unknown event %d for entity %d", event, entityId);
@@ -277,7 +278,7 @@ void Lingo::processEvent(LEvent event, int entityId) {
if (st != kNoneScript) {
executeScript(st, entityId + 1);
} else if (_handlers.contains(_eventHandlerTypes[event])) {
- call(_eventHandlerTypes[event], 0);
+ call(_eventHandlerTypes[event], entityId);
pop();
} else {
debugC(8, kDebugLingoExec, "STUB: processEvent(%s) for %d", _eventHandlerTypes[event], entityId);
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 0ed69de587..a0355f3a36 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -275,7 +275,7 @@ public:
static void c_le();
static void c_call();
- void call(Common::String name, int nargs);
+ void call(Common::String name, int entityId);
static void c_procret();
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index b3aee97fd8..e525fbad04 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -477,12 +477,12 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id,
_casts[id] = new ButtonCast(castStream, _vm->getVersion());
_casts[id]->type = kCastButton;
break;
- case kCastScript:
+ case kCastLingoScript:
warning("CASt: Script");
Common::hexdump(data, size1 + 16);
_casts[id] = new ScriptCast(castStream, _vm->getVersion());
- _casts[id]->type = kCastScript;
+ _casts[id]->type = kCastLingoScript;
break;
default:
warning("Score::loadCastData(): Unhandled cast type: %d", castType);
@@ -519,7 +519,7 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id,
if (!ci->script.empty()) {
//the script type here could be wrong!
- _lingo->addCode(ci->script.c_str(), _casts[id]->type == kCastScript ? kFrameScript : kSpriteScript, id);
+ _lingo->addCode(ci->script.c_str(), kCastScript, id);
}
_castsInfo[id] = ci;
@@ -898,7 +898,7 @@ void Score::startLoop() {
_lingo->processEvent(kEventStartMovie, 0);
_frames[_currentFrame]->prepareFrame(this);
- while (!_stopPlay && _currentFrame < _frames.size() - 2) {
+ while (!_stopPlay && _currentFrame < _frames.size()) {
debugC(1, kDebugImages, "Current frame: %d", _currentFrame);
update();
processEvents();
diff --git a/engines/director/score.h b/engines/director/score.h
index b665842bb0..cc3289e946 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -47,8 +47,9 @@ enum ScriptType {
kMovieScript = 0,
kSpriteScript = 1,
kFrameScript = 2,
+ kCastScript = 3,
kNoneScript = -1,
- kMaxScriptType = 2
+ kMaxScriptType = 3
};
class Score {