Skip to content

Commit

Permalink
DIRECTOR: More work to get events triggering. Loop all frames in score.
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenhoefel committed Jan 9, 2017
1 parent 0e20548 commit 60f936d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion engines/director/cast.h
Expand Up @@ -40,7 +40,7 @@ enum CastType {
kCastShape = 8,
kCastMovie = 9,
kCastDigitalVideo = 10,
kCastScript = 11
kCastLingoScript = 11
};

struct Cast {
Expand Down
2 changes: 1 addition & 1 deletion engines/director/lingo/lingo-code.cpp
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion engines/director/lingo/lingo.cpp
Expand Up @@ -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);

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion engines/director/lingo/lingo.h
Expand Up @@ -275,7 +275,7 @@ class Lingo {
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();

Expand Down
8 changes: 4 additions & 4 deletions engines/director/score.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion engines/director/score.h
Expand Up @@ -47,8 +47,9 @@ enum ScriptType {
kMovieScript = 0,
kSpriteScript = 1,
kFrameScript = 2,
kCastScript = 3,
kNoneScript = -1,
kMaxScriptType = 2
kMaxScriptType = 3
};

class Score {
Expand Down

0 comments on commit 60f936d

Please sign in to comment.