[Scummvm-git-logs] scummvm master -> c8a269cb918f0a9b5affb16c3aad19b7cd5bd603
sev-
noreply at scummvm.org
Sat Apr 18 20:17:36 UTC 2026
This automated email contains information about 15 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
99281458c2 DIRECTOR: Add Zero Critical to detection table
81eef69c94 DIRECTOR: Align BitmapCastMember pitch to 2 bytes in D3
f09f5146d5 DIRECTOR: Invert pixels for 2-bit and 4-bit DIBDecoder images
73582ae9e7 GRAPHICS: Fix crash in MacFont renderer
90e5b8988b DIRECTOR: Add patch for jman inventory buttons
c72d00db53 MACGUI: Revert getMouseItem and getMouseWord to use getRowCol
e238e2a087 DIRECTOR: Add Lingo patcher bodge for Journeyman Project
549a4d3927 DIRECTOR: LINGO: Remove hard crash for invalid b_member call
05be994d4c DIRECTOR: LINGO: Fix bytecode for fieldrefs in D5
76387aa7b8 DIRECTOR: LINGO: Don't zero out _lastClickedSpriteId
7d673a0dda MACGUI: Include line breaks in MacText::getChunkPosFromIndex
75b308f808 DIRECTOR: Fix crash in FilmLoopCastMember::formatInfo
45301da942 DIRECTOR: LINGO: Fix newlines in console debug stack output
46ae24cdbb DIRECTOR: Use castLibMapping start and end records
c8a269cb91 DIRECTOR: Improve accuracy of sprite intersection
Commit: 99281458c28a90496b366c4a0be0cd3f3bf2515d
https://github.com/scummvm/scummvm/commit/99281458c28a90496b366c4a0be0cd3f3bf2515d
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: Add Zero Critical to detection table
Changed paths:
engines/director/detection_tables.h
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index ea3e2e8555f..360c0c5d4c7 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -593,6 +593,7 @@ static const PlainGameDescriptor directorGames[] = {
{ "y2lsnoopy", "Yearn2Learn: Snoopy" },
{ "y2lspelling", "Yearn2Learn: Master Snoopy's Spelling" },
{ "ybr1", "Yellow Brick Road" },
+ { "zerocritical", "Zero Critical" },
{ "zerozero", "Zero Zero" },
// Multimedia or reference products
@@ -9372,6 +9373,9 @@ static const DirectorGameDescription gameDescriptions[] = {
MACGAME1_l("yokai400", "", "xn--2-we0by4fq4jlr4e", "r:d14bf1f7a413df29a04b8fbc7a0fe81f", 1033295, Common::JA_JPN, 601),
WINGAME1_l("yokai400", "", "YOUKAI2.EXE", "t:f43e37dd62ff37b9ac4734f45e105c93", 1512615, Common::JA_JPN, 601),
+ MACGAME1f("zerocritical", "", "Zero Critical Folder/Zero Critical", "rt:aafa56b07820caeb33fe5329088eb7b5", 1031489, 650, GF_32BPP),
+ WINGAME1f("zerocritical", "", "Zero Critical.exe", "t:8fa5dacb308c5db71db0abc91e8e2ba7", 24238200, 602, GF_32BPP),
+
//////////////////////////////////////////////////
//
// Macromedia Director v7
Commit: 81eef69c9448ffd9300e99c7b7c8309398f45662
https://github.com/scummvm/scummvm/commit/81eef69c9448ffd9300e99c7b7c8309398f45662
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: Align BitmapCastMember pitch to 2 bytes in D3
Fixes crash decoding 4-bit image in amandastories-mac
Changed paths:
engines/director/castmember/bitmap.cpp
diff --git a/engines/director/castmember/bitmap.cpp b/engines/director/castmember/bitmap.cpp
index 6fa40e136b2..e1991e72cf8 100644
--- a/engines/director/castmember/bitmap.cpp
+++ b/engines/director/castmember/bitmap.cpp
@@ -101,11 +101,11 @@ BitmapCastMember::BitmapCastMember(Cast *cast, uint16 castId, Common::SeekableRe
}
_pitch = _initialRect.width();
- if (_pitch % 16)
- _pitch += 16 - (_initialRect.width() % 16);
_pitch *= _bitsPerPixel;
_pitch >>= 3;
+ if (_pitch % 2)
+ _pitch += 2 - (_pitch % 2);
} else if (version >= kFileVer400 && version < kFileVer600) {
_flags1 = flags1;
Commit: f09f5146d58bb1bf1f5b64727ad17cdea1d50b55
https://github.com/scummvm/scummvm/commit/f09f5146d58bb1bf1f5b64727ad17cdea1d50b55
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: Invert pixels for 2-bit and 4-bit DIBDecoder images
Fixes incorrect colours in amandastories-win
Changed paths:
engines/director/images.cpp
diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index 398c19722fa..ad1537d38c7 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -108,7 +108,23 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
}
// For some reason, DIB cast members have the palette indices reversed
- if (_bitsPerPixel == 8) {
+ if (_bitsPerPixel == 2) {
+ for (int y = 0; y < _surface->h; y++) {
+ for (int x = 0; x < _surface->w; x++) {
+ // We're not su[pposed to modify the image that is coming from the decoder
+ // However, in this case, we know what we're doing.
+ *const_cast<byte *>((const byte *)_surface->getBasePtr(x, y)) = 3 - *(const byte *)_surface->getBasePtr(x, y);
+ }
+ }
+ } else if (_bitsPerPixel == 4) {
+ for (int y = 0; y < _surface->h; y++) {
+ for (int x = 0; x < _surface->w; x++) {
+ // We're not su[pposed to modify the image that is coming from the decoder
+ // However, in this case, we know what we're doing.
+ *const_cast<byte *>((const byte *)_surface->getBasePtr(x, y)) = 15 - *(const byte *)_surface->getBasePtr(x, y);
+ }
+ }
+ } else if (_bitsPerPixel == 8) {
for (int y = 0; y < _surface->h; y++) {
for (int x = 0; x < _surface->w; x++) {
// We're not su[pposed to modify the image that is coming from the decoder
Commit: 73582ae9e7f215352cbbc0c7ce13e4609f6c11e0
https://github.com/scummvm/scummvm/commit/73582ae9e7f215352cbbc0c7ce13e4609f6c11e0
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
GRAPHICS: Fix crash in MacFont renderer
The modification for the kerning offset needs to be before the bounds
rectification, or else the code will try and access invalid memory.
Fixes heap overflow on the Mars colony death screen in Journeyman
Project.
Changed paths:
graphics/fonts/macfont.cpp
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index fa0ee96c734..834133df221 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -412,16 +412,16 @@ void MacFONTFont::drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color)
if (x + glyph->bitmapWidth < 0 || y + _data._fRectHeight < 0)
return;
+ // due to the way we are handling the generated fonts. we only add the kerning offset for the original font
+ if (!_data._slant)
+ x += glyph->kerningOffset;
+
// Make sure we do not draw outside the surface
uint16 yStart = (y < 0) ? -y : 0;
uint16 yStop = _data._fRectHeight;
uint16 xStart = (x < 0) ? -x : 0;
uint16 xStop = glyph->bitmapWidth;
- // due to the way we are handling the generated fonts. we only add the kerning offset for the original font
- if (!_data._slant)
- x += glyph->kerningOffset;
-
if (x >= dst->w)
return;
Commit: 90e5b8988b8d0c63c29157ae41d9914c778670af
https://github.com/scummvm/scummvm/commit/90e5b8988b8d0c63c29157ae41d9914c778670af
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: Add patch for jman inventory buttons
Previously, the scrolling repeat speed was tied to the computer speed.
As this is a bug, the easy fix is to remove the repeat.
Changed paths:
engines/director/cast.cpp
engines/director/lingo/lingo-patcher.cpp
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index f5c3a0dd7af..838c4b521b6 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -1838,6 +1838,7 @@ void Cast::loadScriptV2(Common::SeekableReadStreamEndian &stream, uint16 id) {
dumpScript(script.c_str(), kMovieScript, id);
_lingoArchive->addCode(script.decode(Common::kMacRoman), kMovieScript, id, nullptr, kLPPForceD2|kLPPTrimGarbage);
+ _lingoArchive->patchScriptHandler(kMovieScript, CastMemberID(id, _castLibID));
}
void Cast::dumpScript(const char *script, ScriptType type, uint16 id) {
diff --git a/engines/director/lingo/lingo-patcher.cpp b/engines/director/lingo/lingo-patcher.cpp
index 794a3c6f5bb..95f597b5b8f 100644
--- a/engines/director/lingo/lingo-patcher.cpp
+++ b/engines/director/lingo/lingo-patcher.cpp
@@ -522,6 +522,20 @@ on checkFiles\r\
end\r\
";
+/*
+ * Journeyman Project has inventory scroll buttons which repeat while the mouse button
+ * is held down. On fast systems (i.e. us) this is quite unpleasant to use.
+ */
+const char *const jmanInventory = "\
+macro InventoryArrowsClicked\r\
+ if the castnum of sprite 9 = the number of cast \"MsgBoxGraphic\" then\r\
+ CloseMessageBox\r\
+ end if\r\
+ ScrollIt\r\
+ set the castnum of sprite 13 to the number of cast \"InventoryArrows\"\r\
+ updateStage\r\
+";
+
struct ScriptHandlerPatch {
const char *gameId;
const char *extra;
@@ -570,6 +584,7 @@ struct ScriptHandlerPatch {
{"mcmillennium", nullptr, kPlatformWindows, "PC\\SHARED.DXR", kMovieScript, 1013, DEFAULT_CAST_LIB, &mcmillenniumDriveDetectionFix},
{"mcmillennium", nullptr, kPlatformMacintosh, "Mission Code Millennium:SHARED.Dxr", kMovieScript, 1013, DEFAULT_CAST_LIB, &mcmillenniumDriveDetectionFix},
{"gordak", nullptr, kPlatformWindows, "GORDAKCD.EXE", kMovieScript, 2, DEFAULT_CAST_LIB, &gordakDetectionFix},
+ {"jman", nullptr, kPlatformMacintosh, "Support Files:Mars ESG Upper 03", kMovieScript, 322, DEFAULT_CAST_LIB, &jmanInventory},
{nullptr, nullptr, kPlatformUnknown, nullptr, kNoneScript, 0, 0, nullptr},
};
Commit: c72d00db530380b20558a81708c7867859b0652e
https://github.com/scummvm/scummvm/commit/c72d00db530380b20558a81708c7867859b0652e
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
MACGUI: Revert getMouseItem and getMouseWord to use getRowCol
Fixes putting the oxygen mask on before asphyxiating in Journeyman Project.
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 682ad7bf91a..310a7847d6a 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -1676,7 +1676,7 @@ int MacText::getMouseWord(int x, int y) {
y += _scrollPos;
int dx, dy, row, col;
- getLineCharacter(x, y, &dx, &dy, &row, &col);
+ getRowCol(x, y, &dx, &dy, &row, &col);
int index = 1;
bool inWhitespace = true;
@@ -1748,7 +1748,7 @@ int MacText::getMouseItem(int x, int y) {
y += _scrollPos;
int dx, dy, row, col;
- getLineCharacter(x, y, &dx, &dy, &row, &col);
+ getRowCol(x, y, &dx, &dy, &row, &col);
// getMouseItem
// - starts from index 1
Commit: e238e2a087cb966878c6ec889c0476c6fff3ed25
https://github.com/scummvm/scummvm/commit/e238e2a087cb966878c6ec889c0476c6fff3ed25
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: Add Lingo patcher bodge for Journeyman Project
Changed paths:
engines/director/lingo/lingo-patcher.cpp
diff --git a/engines/director/lingo/lingo-patcher.cpp b/engines/director/lingo/lingo-patcher.cpp
index 95f597b5b8f..f83bf587adf 100644
--- a/engines/director/lingo/lingo-patcher.cpp
+++ b/engines/director/lingo/lingo-patcher.cpp
@@ -170,6 +170,9 @@ struct ScriptPatch {
191, "set the castnum of sprite 19 to the number of cast \"Description\"", "updateStage"},
{"jman", "", kPlatformWindows, "MMM:Shared Cast B&W", kMovieScript, 323, DEFAULT_CAST_LIB,
192, "updateStage", "set the trails of sprite 19 to 0"},
+ // FIXME: the Lingo parser treats ".5" as "5"
+ {"jman", "v1.2", kPlatformMacintosh, "Support Files:Mars ESG 07", kMovieScript, 129, DEFAULT_CAST_LIB,
+ 169, "LoopIt .5", ""},
{"snh", "Hybrid release", kPlatformWindows, "SNHstart", kMovieScript, 0, DEFAULT_CAST_LIB,
@@ -584,7 +587,7 @@ struct ScriptHandlerPatch {
{"mcmillennium", nullptr, kPlatformWindows, "PC\\SHARED.DXR", kMovieScript, 1013, DEFAULT_CAST_LIB, &mcmillenniumDriveDetectionFix},
{"mcmillennium", nullptr, kPlatformMacintosh, "Mission Code Millennium:SHARED.Dxr", kMovieScript, 1013, DEFAULT_CAST_LIB, &mcmillenniumDriveDetectionFix},
{"gordak", nullptr, kPlatformWindows, "GORDAKCD.EXE", kMovieScript, 2, DEFAULT_CAST_LIB, &gordakDetectionFix},
- {"jman", nullptr, kPlatformMacintosh, "Support Files:Mars ESG Upper 03", kMovieScript, 322, DEFAULT_CAST_LIB, &jmanInventory},
+ {"jman", "v1.2", kPlatformMacintosh, "Support Files:Mars ESG Upper 03", kMovieScript, 322, DEFAULT_CAST_LIB, &jmanInventory},
{nullptr, nullptr, kPlatformUnknown, nullptr, kNoneScript, 0, 0, nullptr},
};
Commit: 549a4d39272ac10dfd940b1cc0ac7d6054de8585
https://github.com/scummvm/scummvm/commit/549a4d39272ac10dfd940b1cc0ac7d6054de8585
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: LINGO: Remove hard crash for invalid b_member call
Allows avoiding a game bug when playing the intro cutscene in Mission to Planet X.
Changed paths:
engines/director/lingo/lingo-builtins.cpp
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index a5d83adde2c..32cf63b7b44 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -4069,9 +4069,9 @@ void LB::b_member(int nargs) {
}
if (res.member > g_lingo->getMembersNum(res.castLib)) {
+ // D6 and up does not error on non-existing cast members
if (g_director->getVersion() < 600) {
g_lingo->lingoError("b_member: Cast member ID out of range");
- return;
}
}
g_lingo->push(res);
Commit: 05be994d4c7b7f6ed24d73546a0f377a0b9772ca
https://github.com/scummvm/scummvm/commit/05be994d4c7b7f6ed24d73546a0f377a0b9772ca
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: LINGO: Fix bytecode for fieldrefs in D5
Fixes a crash when first viewing the web browser in Mission to Planet X.
Changed paths:
engines/director/lingo/lingo-bytecode.cpp
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index efca15424dc..037b58415cf 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -983,7 +983,14 @@ void LC::cb_v4theentityassign() {
break;
case kTEAChunk:
{
- Datum fieldRef = g_lingo->pop().asMemberID();
+ Datum fieldRef;
+ if (g_director->getVersion() < 500) {
+ fieldRef = g_lingo->pop().asMemberID();
+ } else {
+ Datum castLib = g_lingo->pop();
+ Datum fieldID = g_lingo->pop();
+ fieldRef = Datum(CastMemberID(fieldID.asInt(), castLib.asInt()));
+ }
fieldRef.type = FIELDREF;
Datum chunkRef = readChunkRef(fieldRef);
g_lingo->setTheEntity(entity, chunkRef, field, value);
Commit: 76387aa7b81c8dade1be2ac0a83ce82cf8c95150
https://github.com/scummvm/scummvm/commit/76387aa7b81c8dade1be2ac0a83ce82cf8c95150
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: LINGO: Don't zero out _lastClickedSpriteId
It is possible for a higher-level click handler (e.g. a cast or frame
script) to interrogate the clickOn, and erasing the value early when the
sprite handler event is aborted means you can't do this.
Fixes the sliding puzzle in Mission to Planet X.
Changed paths:
engines/director/lingo/lingo-events.cpp
diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index 614d4aab008..d1f6326719f 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -263,12 +263,10 @@ void Movie::resolveScriptEvent(LingoEvent &event) {
initializerParams = sprite->_behaviors[event.behaviorIndex].initializerParams;
}
} else {
- _lastClickedSpriteId = 0;
return;
}
} else {
if (!sprite->_scriptId.member) {
- _lastClickedSpriteId = 0;
return;
}
Commit: 7d673a0ddaf595dcad3b288ed483dc0735192638
https://github.com/scummvm/scummvm/commit/7d673a0ddaf595dcad3b288ed483dc0735192638
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
MACGUI: Include line breaks in MacText::getChunkPosFromIndex
Fixes offsets of text colouring in Mission to Planet X.
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 310a7847d6a..5ab3792ac95 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -487,7 +487,8 @@ void MacText::getChunkPosFromIndex(int index, uint &lineNum, uint &chunkNum, uin
}
for (uint i = 0; i < _canvas._text.size(); i++) {
if (_canvas.getLineCharWidth(i) <= index) {
- index -= _canvas.getLineCharWidth(i);
+ // include carriage return
+ index -= _canvas.getLineCharWidth(i) + 1;
} else {
lineNum = i;
chunkNum = _canvas._text[i].getChunkNum(&index);
Commit: 75b308f80821ccf415c2ff50ced88a439c7dfaeb
https://github.com/scummvm/scummvm/commit/75b308f80821ccf415c2ff50ced88a439c7dfaeb
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: Fix crash in FilmLoopCastMember::formatInfo
Changed paths:
engines/director/castmember/filmloop.cpp
diff --git a/engines/director/castmember/filmloop.cpp b/engines/director/castmember/filmloop.cpp
index 59956a7dd4e..cc4133c68f4 100644
--- a/engines/director/castmember/filmloop.cpp
+++ b/engines/director/castmember/filmloop.cpp
@@ -48,6 +48,7 @@ FilmLoopCastMember::FilmLoopCastMember(Cast *cast, uint16 castId, Common::Seekab
_crop = false;
_center = false;
_index = -1;
+ _score = nullptr;
if (cast->_version >= kFileVer400) {
_initialRect = Movie::readRect(stream);
@@ -200,7 +201,7 @@ Common::String FilmLoopCastMember::formatInfo() {
_initialRect.left, _initialRect.top,
_boundingRect.width(), _boundingRect.height(),
_boundingRect.left, _boundingRect.top,
- _score->_scoreCache.size(), _subchannels.size(), _enableSound, _looping,
+ _score ? _score->_scoreCache.size() : -1, _score ? _subchannels.size() : -1, _enableSound, _looping,
_crop, _center
);
}
Commit: 45301da942a48f4b232659784638f64d0a4a4332
https://github.com/scummvm/scummvm/commit/45301da942a48f4b232659784638f64d0a4a4332
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: LINGO: Fix newlines in console debug stack output
Changed paths:
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index c3a2681de79..146be8eeb44 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -422,7 +422,7 @@ Common::String Lingo::formatStack() {
for (uint i = 0; i < _state->stack.size(); i++) {
Datum d = _state->stack[i];
- stack += Common::String::format("<%s> ", d.asString(true).c_str());
+ stack += Common::String::format("<%s> ", formatStringForDump(d.asString(true)).c_str());
}
return stack;
}
Commit: 46ae24cdbbed5faf7ab5ba25ce30525160253530
https://github.com/scummvm/scummvm/commit/46ae24cdbbed5faf7ab5ba25ce30525160253530
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: Use castLibMapping start and end records
Without this, multiple internal castLibs will have incorrect start and
end records. This is especially a problem when the start index is
greater than zero, as the member numbers will be wrong.
Fixes showing emails on Mars in Mission to Planet X.
Changed paths:
engines/director/cast.cpp
engines/director/movie.cpp
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 838c4b521b6..2e09762116e 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -386,8 +386,20 @@ bool Cast::loadConfig() {
else
_movieRect = g_director->_fixStageRect;
- _castArrayStart = stream->readUint16();
- _castArrayEnd = stream->readUint16();
+ if (_isExternal || (g_director->getVersion() < 500)) {
+ // For D4 and below, and for external castlibs,
+ // the config chunk is the source of truth about
+ // where the members start and end.
+ _castArrayStart = stream->readUint16();
+ _castArrayEnd = stream->readUint16();
+ } else {
+ // castArrayStart and castArrayEnd are defined
+ // in the MCsL chunk read by Movie::loadCastLibMapping,
+ // the one in the config chunk is likely to be incorrect
+ // (e.g. multiple internal casts)
+ stream->readUint16();
+ stream->readUint16();
+ }
// D3 and below use this, override for D4 and over
// actual framerates are, on average: { 3.75, 4, 4.35, 4.65, 5, 5.5, 6, 6.6, 7.5, 8.5, 10, 12, 20, 30, 60 }
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
index 8f0f978527b..09735609545 100644
--- a/engines/director/movie.cpp
+++ b/engines/director/movie.cpp
@@ -163,12 +163,12 @@ void Movie::loadCastLibMapping(Common::SeekableReadStreamEndian &stream) {
stream.readByte(); // null
if (pathSize > 1)
stream.readUint16();
- stream.readUint16();
- uint16 itemCount = stream.readUint16();
+ uint16 minMember = stream.readUint16();
+ uint16 maxMember = stream.readUint16();
stream.readUint16();
uint16 libResourceId = stream.readUint16();
uint16 libId = i + 1;
- debugC(5, kDebugLoading, "Movie::loadCastLibMapping: name: %s, path: %s, itemCount: %d, libResourceId: %d, libId: %d", utf8ToPrintable(name).c_str(), utf8ToPrintable(path).c_str(), itemCount, libResourceId, libId);
+ debugC(5, kDebugLoading, "Movie::loadCastLibMapping: name: %s, path: %s, minMember: %d, maxMember: %d, libResourceId: %d, libId: %d", utf8ToPrintable(name).c_str(), utf8ToPrintable(path).c_str(), minMember, maxMember, libResourceId, libId);
Archive *castArchive = _movieArchive;
bool isExternal = !path.empty();
if (isExternal) {
@@ -189,6 +189,12 @@ void Movie::loadCastLibMapping(Common::SeekableReadStreamEndian &stream) {
}
_castNames[name] = libId;
cast->setArchive(castArchive);
+ // For multiple internal casts, inject the cast array start and end indexes,
+ // as the single pair in the config chunk won't be correct.
+ if (!isExternal) {
+ cast->_castArrayStart = minMember;
+ cast->_castArrayEnd = maxMember;
+ }
}
return;
}
Commit: c8a269cb918f0a9b5affb16c3aad19b7cd5bd603
https://github.com/scummvm/scummvm/commit/c8a269cb918f0a9b5affb16c3aad19b7cd5bd603
Author: Scott Percival (code at moral.net.au)
Date: 2026-04-18T22:17:25+02:00
Commit Message:
DIRECTOR: Improve accuracy of sprite intersection
Fixes the Irritating Stick-style maze in the Uranus hatch in Mission to
Planet X.
Changed paths:
engines/director/channel.cpp
engines/director/channel.h
engines/director/lingo/lingo-code.cpp
engines/director/sprite.cpp
diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index 916038bba78..277e5e5ac82 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -371,6 +371,32 @@ bool Channel::isMatteIntersect(Channel *channel) {
return false;
}
+bool Channel::isMatteBoxIntersect(Channel *channel) {
+ Common::Rect myBbox = getBbox();
+ Common::Rect yourBbox = channel->getBbox();
+ Common::Rect intersectRect = myBbox.findIntersectingRect(yourBbox);
+
+ if (intersectRect.isEmpty())
+ return false;
+ Graphics::Surface *myMatte = nullptr;
+
+ if (_sprite->_cast && _sprite->_cast->_type == kCastBitmap)
+ myMatte = ((BitmapCastMember *)_sprite->_cast)->getMatte(myBbox);
+
+ if (myMatte) {
+ for (int i = intersectRect.top; i < intersectRect.bottom; i++) {
+ const byte *my = (const byte *)myMatte->getBasePtr(intersectRect.left - myBbox.left, i - myBbox.top);
+
+ for (int j = intersectRect.left; j < intersectRect.right; j++, my++)
+ if (*my)
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
// this contains channel. i.e. myBox contain yourBox
bool Channel::isMatteWithin(Channel *channel) {
Common::Rect myBbox = getBbox();
diff --git a/engines/director/channel.h b/engines/director/channel.h
index 69bde1c55ce..c32f4e766c2 100644
--- a/engines/director/channel.h
+++ b/engines/director/channel.h
@@ -60,6 +60,7 @@ public:
bool isActiveText();
CollisionTest isMouseIn(const Common::Point &pos);
bool isMatteIntersect(Channel *channel);
+ bool isMatteBoxIntersect(Channel *channel);
bool isMatteWithin(Channel *channel);
bool isActiveVideo();
bool isVideoDirectToStage();
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index afd1a64a041..987abadbc11 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -1001,9 +1001,17 @@ void LC::c_intersects() {
return;
}
+ // tested in D6:
+ // both sprites matte: do a matte-on-matte intersection
+ // just S1 matte: do a box-on-box intersection
+ // just S2 matte: do a box-on-matte intersection
+ // neither sprite matte: do a box-on-box intersection
+
// don't regard quick draw shape as matte type
if ((!sprite1->_sprite->isQDShape() && sprite1->_sprite->_ink == kInkTypeMatte) && (!sprite2->_sprite->isQDShape() && sprite2->_sprite->_ink == kInkTypeMatte)) {
g_lingo->push(Datum(sprite2->isMatteIntersect(sprite1)));
+ } else if ((!sprite2->_sprite->isQDShape() && sprite2->_sprite->_ink == kInkTypeMatte)) {
+ g_lingo->push(Datum(sprite2->isMatteBoxIntersect(sprite1)));
} else {
g_lingo->push(Datum(sprite2->getBbox().intersects(sprite1->getBbox())));
}
diff --git a/engines/director/sprite.cpp b/engines/director/sprite.cpp
index 850abd687e9..f96ed373d02 100644
--- a/engines/director/sprite.cpp
+++ b/engines/director/sprite.cpp
@@ -368,8 +368,8 @@ bool Sprite::isActive() {
if (_cast && _cast->_type == kCastButton)
return true;
- return _movie->getScriptContext(kScoreScript, _scriptId) != nullptr
- || _movie->getScriptContext(kCastScript, _castId) != nullptr;
+ return (_movie->getScriptContext(kScoreScript, _scriptId) != nullptr)
+ || (_movie->getScriptContext(kCastScript, _castId) != nullptr);
}
bool Sprite::shouldHilite() {
More information about the Scummvm-git-logs
mailing list