[Scummvm-git-logs] scummvm master -> 9ee0740844691f6e66fe3eccbfc8215da53c9ef7
sev-
noreply at scummvm.org
Fri Jan 27 12:31:28 UTC 2023
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6444b9dfd5 DIRECTOR: For disposed objects, make getMethod return a warning
ecaed41e59 DIRECTOR: Implement b_ilk
e93583bbf0 DIRECTOR: Fix memory leak in Window::loadEXE()
9ee0740844 DIRECTOR: Reset Channel::_movieTime when loading a new video
Commit: 6444b9dfd50715c74b53cc47eb0c08fabc7c2298
https://github.com/scummvm/scummvm/commit/6444b9dfd50715c74b53cc47eb0c08fabc7c2298
Author: Scott Percival (code at moral.net.au)
Date: 2023-01-27T13:31:21+01:00
Commit Message:
DIRECTOR: For disposed objects, make getMethod return a warning
D4 will throw an exception if you try and use a method on a disposed
object. In the editor this halts execution, in the projector this seems
to just be ignored. As there are games which rely on this ignorance,
we can't halt on a disposed object.
Fixes the EXE loader in Opera Fatal.
Changed paths:
engines/director/lingo/lingo-object.h
diff --git a/engines/director/lingo/lingo-object.h b/engines/director/lingo/lingo-object.h
index cb65915aaec..71e72f29ebc 100644
--- a/engines/director/lingo/lingo-object.h
+++ b/engines/director/lingo/lingo-object.h
@@ -132,8 +132,11 @@ public:
};
Symbol getMethod(const Common::String &methodName) override {
+ Symbol sym;
+
if (_disposed) {
- error("Method '%s' called on disposed object <%s>", methodName.c_str(), asString().c_str());
+ warning("Method '%s' called on disposed object <%s>, returning VOID", methodName.c_str(), asString().c_str());
+ return sym;
}
Common::String methodId;
@@ -143,8 +146,6 @@ public:
methodId = methodName;
}
-
- Symbol sym;
if (_methods && _methods->contains(methodId)) {
sym = (*_methods)[methodId];
sym.target = this;
Commit: ecaed41e59379353e607261015819faa2dda30e7
https://github.com/scummvm/scummvm/commit/ecaed41e59379353e607261015819faa2dda30e7
Author: Scott Percival (code at moral.net.au)
Date: 2023-01-27T13:31:21+01:00
Commit Message:
DIRECTOR: Implement b_ilk
Changed paths:
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/lingo/tests/ilk.lingo
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 1cf038cd857..cc15196e19b 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1689,8 +1689,42 @@ void LB::b_floatP(int nargs) {
}
void LB::b_ilk(int nargs) {
- Datum d = g_lingo->pop();
- Datum res(Common::String(d.type2str(true)));
+ Datum res(0);
+ if (nargs == 1) {
+ // Single-argument mode returns the type of the item as a symbol.
+ // D4 is inconsistent about what types this variant is allowed to work with; e.g. #integer is fine,
+ // but #proplist is not. For now, give a response for all types.
+ Datum item = g_lingo->pop();
+ res = Datum(Common::String(item.type2str(true)));
+ res.type = SYMBOL;
+ g_lingo->push(res);
+ return;
+ }
+
+ if (nargs > 2) {
+ warning("b_ilk: dropping %d extra args", nargs - 2);
+ g_lingo->dropStack(nargs - 2);
+ }
+
+ // Two argument mode checks the type of the item against a symbol.
+ Datum type = g_lingo->pop();
+ Datum item = g_lingo->pop();
+ if (type.type != SYMBOL) {
+ warning("b_ilk: expected a symbol for second arg");
+ } else {
+ Common::String typeCopy = type.asString();
+
+ // A special case is #list, which is the equivalent of checking the item type is one of #linearlist,
+ // #proplist, #point and #rect.
+ if (typeCopy.equalsIgnoreCase("list")) {
+ res.u.i = item.type == ARRAY ? 1 : 0;
+ res.u.i |= item.type == PARRAY ? 1 : 0;
+ res.u.i |= item.type == POINT ? 1 : 0;
+ res.u.i |= item.type == RECT ? 1 : 0;
+ } else {
+ res.u.i = typeCopy.equalsIgnoreCase(item.type2str(true)) ? 1 : 0;
+ }
+ }
g_lingo->push(res);
}
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index a1039d3ff31..e305acf64d5 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -1161,16 +1161,16 @@ bool Datum::isCastRef() const {
return (type == CASTREF || type == FIELDREF);
}
-const char *Datum::type2str(bool isk) const {
+const char *Datum::type2str(bool ilk) const {
static char res[20];
- switch (isk ? u.i : type) {
+ switch (type) {
case ARGC:
return "ARGC";
case ARGCNORET:
return "ARGCNORET";
case ARRAY:
- return "ARRAY";
+ return ilk ? "linearlist" : "ARRAY";
case CASTREF:
return "CASTREF";
case CHUNKREF:
@@ -1178,33 +1178,33 @@ const char *Datum::type2str(bool isk) const {
case FIELDREF:
return "FIELDREF";
case FLOAT:
- return isk ? "#float" : "FLOAT";
+ return ilk ? "float" : "FLOAT";
case GLOBALREF:
return "GLOBALREF";
case INT:
- return isk ? "#integer" : "INT";
+ return ilk ? "integer" : "INT";
case LOCALREF:
return "LOCALREF";
case MENUREF:
return "MENUREF";
case OBJECT:
- return isk ? "#object" : "OBJECT";
+ return ilk ? "object" : "OBJECT";
case PARRAY:
- return "PARRAY";
+ return ilk ? "proplist" : "PARRAY";
case POINT:
- return isk ? "#point" : "POINT";
+ return ilk ? "point" : "POINT";
case PROPREF:
return "PROPREF";
case RECT:
- return "RECT";
+ return ilk ? "rect" : "RECT";
case STRING:
- return isk ? "#string" : "STRING";
+ return ilk ? "string" : "STRING";
case SYMBOL:
- return isk ? "#symbol" : "SYMBOL";
+ return ilk ? "symbol" : "SYMBOL";
case VARREF:
return "VARREF";
case VOID:
- return isk ? "#void" : "VOID";
+ return ilk ? "void" : "VOID";
default:
snprintf(res, 20, "-- (%d) --", type);
return res;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 1696527d1f5..12498e33b7c 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -175,7 +175,7 @@ struct Datum { /* interpreter stack type */
bool isVarRef() const;
bool isCastRef() const;
- const char *type2str(bool isk = false) const;
+ const char *type2str(bool ilk = false) const;
int equalTo(Datum &d, bool ignoreCase = false) const;
CompareResult compareTo(Datum &d) const;
diff --git a/engines/director/lingo/tests/ilk.lingo b/engines/director/lingo/tests/ilk.lingo
index 686d9a51188..20bd514e77a 100644
--- a/engines/director/lingo/tests/ilk.lingo
+++ b/engines/director/lingo/tests/ilk.lingo
@@ -1,3 +1,4 @@
+-- single arg variant, return type
put ilk(10)
put ilk(20.0)
put ilk("Macromedia")
@@ -5,3 +6,12 @@ put ilk(point(10, 20))
put ilk(ilk(10))
set x = point(10, 20)
put ilk(x)
+
+-- two arg variant, return if type matches
+put ilk(10, #integer)
+put ilk("Macromedia", #string)
+set x = list(1,2,3)
+put ilk(x, #list)
+put ilk(x, #linearlist)
+put ilk(x, #integer)
+
Commit: e93583bbf019473f14636ef2abd4582fe6e2724e
https://github.com/scummvm/scummvm/commit/e93583bbf019473f14636ef2abd4582fe6e2724e
Author: Scott Percival (code at moral.net.au)
Date: 2023-01-27T13:31:21+01:00
Commit Message:
DIRECTOR: Fix memory leak in Window::loadEXE()
Changed paths:
engines/director/resource.cpp
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 976276dfc64..63651b581c9 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -260,6 +260,7 @@ Archive *Window::loadEXE(const Common::String movie) {
Common::WinResources *exe = Common::WinResources::createFromEXE(movie);
if (!exe) {
warning("Window::loadEXE(): Failed to open EXE '%s'", g_director->getEXEName().c_str());
+ delete exeStream;
return nullptr;
}
Commit: 9ee0740844691f6e66fe3eccbfc8215da53c9ef7
https://github.com/scummvm/scummvm/commit/9ee0740844691f6e66fe3eccbfc8215da53c9ef7
Author: Scott Percival (code at moral.net.au)
Date: 2023-01-27T13:31:21+01:00
Commit Message:
DIRECTOR: Reset Channel::_movieTime when loading a new video
Fixes the animation of turning the ship in Gadget: Invention,
Travel and Adventure.
Changed paths:
engines/director/channel.cpp
diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index 0cf6231ebe2..3bf07254721 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -398,6 +398,7 @@ void Channel::setClean(Sprite *nextSprite, int spriteId, bool partial) {
if (!path.empty()) {
((DigitalVideoCastMember *)nextSprite->_cast)->loadVideo(pathMakeRelative(path, true, false));
+ _movieTime = 0;
((DigitalVideoCastMember *)nextSprite->_cast)->startVideo(this);
}
} else if (nextSprite->_cast->_type == kCastFilmLoop) {
More information about the Scummvm-git-logs
mailing list