[Scummvm-git-logs] scummvm master -> bb9789daeb44011c39fe21e42d859dc6e66929cf
moralrecordings
noreply at scummvm.org
Sun Jul 14 10:13:01 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e56d8497e9 DIRECTOR: LINGO: Fix handling of Lingo factory methods
bb9789daeb DIRECTOR: Fix cursors with hotspots outside of crop area
Commit: e56d8497e93f7cb5b2e27389ebc8a50829421dd8
https://github.com/scummvm/scummvm/commit/e56d8497e93f7cb5b2e27389ebc8a50829421dd8
Author: Scott Percival (code at moral.net.au)
Date: 2024-07-14T15:39:25+08:00
Commit Message:
DIRECTOR: LINGO: Fix handling of Lingo factory methods
Fixes director-tests/D4-unit/T_LING01.DIR
Changed paths:
engines/director/lingo/lingo-bytecode.cpp
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index afc5ff4e168..603459a85e0 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -627,15 +627,9 @@ void LC::cb_thepush() {
return;
}
- if (name == "me") {
- // Special case: push the me object itself
- g_lingo->push(g_lingo->_state->me);
- return;
- }
-
warning("cb_thepush: me object has no property '%s', type: %d", name.c_str(), g_lingo->_state->me.type);
} else {
- g_lingo->lingoError("cb_thepush: no me object");
+ debugC(1, kDebugLingoExec, "cb_thepush: attempted to access property '%s' with no me object, returning VOID", name.c_str());
}
g_lingo->pushVoid();
}
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 3819f4d4c77..a28d9f222cc 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -267,13 +267,13 @@ void Lingo::pushContext(const Symbol funcSym, bool allowRetVal, Datum defaultRet
}
if (funcSym.argNames) {
- if ((int)funcSym.argNames->size() > fp->paramList.size()) {
+ if (funcSym.argNames->size() > fp->paramList.size()) {
debugC(1, kDebugLingoExec, "%d arg names defined for %d args! Ignoring the last %d names", funcSym.argNames->size(), fp->paramList.size(), funcSym.argNames->size() - fp->paramList.size());
}
for (int i = (int)funcSym.argNames->size() - 1; i >= 0; i--) {
Common::String name = (*funcSym.argNames)[i];
if (!localvars->contains(name)) {
- if (i < fp->paramList.size()) {
+ if (i < (int)fp->paramList.size()) {
Datum value = fp->paramList[i];
(*localvars)[name] = value;
} else {
@@ -1597,23 +1597,18 @@ void LC::call(const Common::String &name, int nargs, bool allowRetVal) {
}
}
- // Fallback for the edge case where a local factory method is called,
- // but with an invalid first argument.
- // If there is a current me object, and it has a function handler
- // with a matching name, then the first argument will be replaced with the me object.
- // If there are no arguments at all, one will be added.
+ // If we're calling from within a me object, and it has a function handler with a
+ // matching name, include the me object in the CFrame (so we still get property lookups).
+ // Doesn't matter that the first arg isn't the me object (which would have been caught
+ // by the Factory/XObject code above).
+ //
+ // If the method is called from outside and without the object as the first arg,
+ // it will still work using the normal getHandler lookup.
+ // However properties will return garbage (the number 3??).
if (g_lingo->_state->me.type == OBJECT) {
AbstractObject *target = g_lingo->_state->me.u.obj;
funcSym = target->getMethod(name);
if (funcSym.type != VOIDSYM) {
- if (nargs == 0) {
- debugC(3, kDebugLingoExec, "Factory method call detected with missing first arg");
- g_lingo->_stack.push_back(Datum());
- nargs = 1;
- } else {
- debugC(3, kDebugLingoExec, "Factory method call detected with invalid first arg: <%s>", g_lingo->_stack[g_lingo->_stack.size() - nargs].asString(true).c_str());
- }
- g_lingo->_stack[g_lingo->_stack.size() - nargs] = funcSym.target; // Set first arg to target
call(funcSym, nargs, allowRetVal);
return;
}
Commit: bb9789daeb44011c39fe21e42d859dc6e66929cf
https://github.com/scummvm/scummvm/commit/bb9789daeb44011c39fe21e42d859dc6e66929cf
Author: Scott Percival (code at moral.net.au)
Date: 2024-07-14T18:12:28+08:00
Commit Message:
DIRECTOR: Fix cursors with hotspots outside of crop area
Fixes the cursor position in Blinky Bill's Ghost Cave.
Changed paths:
engines/director/cursor.cpp
diff --git a/engines/director/cursor.cpp b/engines/director/cursor.cpp
index dac60f201f1..f1ddc55b28f 100644
--- a/engines/director/cursor.cpp
+++ b/engines/director/cursor.cpp
@@ -124,8 +124,17 @@ void Cursor::readFromCast(Datum cursorCasts) {
}
BitmapCastMember *bc = (BitmapCastMember *)(cursorCast);
- _hotspotX = bc->_regX - bc->_initialRect.left;
- _hotspotY = bc->_regY - bc->_initialRect.top;
+ int offX = bc->_regX - bc->_initialRect.left;
+ int offY = bc->_regY - bc->_initialRect.top;
+ if ((offX < 0) || (offX >= 16) || (offY < 0) || (offY >= 16) ||
+ (g_director->getVersion() < 500 && g_director->getPlatform() == Common::kPlatformWindows)) {
+ // Hotspots that are outside the 16x16 crop will be recentered in the middle.
+ // Pre-5 versions of Windows Director do not respect hotspots at all?
+ offX = 8;
+ offY = 8;
+ }
+ _hotspotX = (uint16)offX;
+ _hotspotY = (uint16)offY;
}
void Cursor::readBuiltinType(Datum resourceId) {
More information about the Scummvm-git-logs
mailing list