[Scummvm-git-logs] scummvm master -> 8d22aa3af1ef7a84c9721394fdaf702f67d2f9a2
rvanlaar
noreply at scummvm.org
Fri Mar 11 21:00:34 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8d22aa3af1 DIRECTOR: LINGO: Implement the actorList property
Commit: 8d22aa3af1ef7a84c9721394fdaf702f67d2f9a2
https://github.com/scummvm/scummvm/commit/8d22aa3af1ef7a84c9721394fdaf702f67d2f9a2
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-03-11T21:58:15+01:00
Commit Message:
DIRECTOR: LINGO: Implement the actorList property
The actorList is a global array property. Birthed scripts can be added
to it. The `stepFrame` method is called on all objects in the array on
every frame. < D4 had an executePerFrameHook for this.
Changed paths:
engines/director/lingo/lingo-bytecode.cpp
engines/director/lingo/lingo-the.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 7603ea6a80d..f18ea536912 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -598,7 +598,10 @@ void LC::cb_theassign2() {
// only seen in louis catorze with searchPath
Common::String name = g_lingo->readString();
Datum value = g_lingo->pop();
- if (name == "searchPath") {
+
+ if (name == "actorList") {
+ g_lingo->_actorList = value;
+ } else if (name == "searchPath") {
g_lingo->_searchPath = value;
} else {
warning("BUILDBOT: cb_theassign2 unkown name: %s", name.c_str());
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 965ea990830..7620c3dd2ae 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -373,7 +373,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
switch (entity) {
case kTheActorList:
- getTheEntitySTUB(kTheActorList);
+ d = g_lingo->_actorList;
break;
case kTheBeepOn:
getTheEntitySTUB(kTheBeepOn);
@@ -921,7 +921,7 @@ void Lingo::setTheEntity(int entity, Datum &id, int field, Datum &d) {
switch (entity) {
case kTheActorList:
- setTheEntitySTUB(kTheActorList);
+ g_lingo->_actorList = d;
break;
case kTheBeepOn:
setTheEntitySTUB(kTheBeepOn);
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index ebab001e631..f8e27aeec44 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -162,12 +162,16 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_localvars = nullptr;
//kTheEntities
+ _actorList.type = ARRAY;
+ _actorList.u.farr = new FArray;
+
_itemDelimiter = ',';
+ _exitLock = false;
+
_searchPath.type = ARRAY;
_searchPath.u.farr = new FArray;
- _exitLock = false;
// events
_passEvent = false;
@@ -1151,14 +1155,25 @@ void Lingo::executeImmediateScripts(Frame *frame) {
}
void Lingo::executePerFrameHook(int frame, int subframe) {
- if (_perFrameHook.type == OBJECT) {
- Symbol method = _perFrameHook.u.obj->getMethod("mAtFrame");
- if (method.type != VOIDSYM) {
- debugC(1, kDebugLingoExec, "Executing perFrameHook : <%s>(mAtFrame, %d, %d)", _perFrameHook.asString(true).c_str(), frame, subframe);
- push(_perFrameHook);
- push(frame);
- push(subframe);
- LC::call(method, 3, false);
+ if (_vm->getVersion() < 400) {
+ if (_perFrameHook.type == OBJECT) {
+ Symbol method = _perFrameHook.u.obj->getMethod("mAtFrame");
+ if (method.type != VOIDSYM) {
+ debugC(1, kDebugLingoExec, "Executing perFrameHook : <%s>(mAtFrame, %d, %d)", _perFrameHook.asString(true).c_str(), frame, subframe);
+ push(_perFrameHook);
+ push(frame);
+ push(subframe);
+ LC::call(method, 3, false);
+ execute();
+ }
+ }
+ } else if (_actorList.u.farr->arr.size() > 0) {
+ for (uint i = 0; i < _actorList.u.farr->arr.size(); i++) {
+ Datum actor = _actorList.u.farr->arr[i];
+ Symbol method = actor.u.obj->getMethod("stepFrame");
+ if (method.nargs == 1)
+ push(actor);
+ LC::call(method, method.nargs, false);
execute();
}
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 192e3f4ef68..518fbd888a8 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -378,9 +378,10 @@ public:
const char *field2str(int id);
// global kTheEntity
+ Datum _actorList;
Common::u32char_type_t _itemDelimiter;
- Datum _searchPath;
bool _exitLock;
+ Datum _searchPath;
Datum getTheEntity(int entity, Datum &id, int field);
void setTheEntity(int entity, Datum &id, int field, Datum &d);
More information about the Scummvm-git-logs
mailing list