[Scummvm-git-logs] scummvm master -> 856ec09514cb0c298f7b83ed6adfff17296919d1

sev- noreply at scummvm.org
Wed Jul 19 08:52:07 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:
dff38babeb DIRECTOR: Fix palette loading for D2
45f5678eab DIRECTOR: Add ability to fake the current date
2f64b8cd32 DIRECTOR: XOBJ: Add stub for ManiacBg
856ec09514 DIRECTOR: XOBJ: Replace crash in parseMCICommand with warning


Commit: dff38babebd0a2f7d81bb9672fda28e19a180ec7
    https://github.com/scummvm/scummvm/commit/dff38babebd0a2f7d81bb9672fda28e19a180ec7
Author: Scott Percival (code at moral.net.au)
Date: 2023-07-19T10:52:01+02:00

Commit Message:
DIRECTOR: Fix palette loading for D2

PaletteCastMembers exist in D2, and the process for loading them is
the same as in D3. The special case in Cast::loadCast() isn't needed.

In D2 the PaletteCastMember::load() hook wasn't getting called;
we solve this by copying the load() hook to loadCastDataVWCR, which will
get called even if there are no CastInfo objects.

Fixes the colour-cycling Invictus logo in Alice: An Interactive Museum.

Changed paths:
    engines/director/cast.cpp


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index f7ae21bead6..9dbb0c956b1 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -475,19 +475,6 @@ bool Cast::loadConfig() {
 }
 
 void Cast::loadCast() {
-	// Palette Information for D2; D3 and higher call this from the cast
-	if (_version < kFileVer300) {
-		Common::Array<uint16> clutList = _castArchive->getResourceIDList(MKTAG('C', 'L', 'U', 'T'));
-		for (uint i = 0; i < clutList.size(); i++) {
-			Common::SeekableReadStreamEndian *pal = _castArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[i]);
-
-			debugC(2, kDebugLoading, "****** Loading Palette CLUT, #%d", clutList[i]);
-			PaletteV4 palData = loadPalette(*pal, clutList[i]);
-			CastMemberID cid(clutList[i], DEFAULT_CAST_LIB);
-			g_director->addPalette(cid, palData.palette, palData.length);
-			delete pal;
-		}
-	}
 	Common::SeekableReadStreamEndian *r = nullptr;
 
 	// Font Directory
@@ -797,6 +784,8 @@ void Cast::loadCastDataVWCR(Common::SeekableReadStreamEndian &stream) {
 		case kCastPalette:
 			debugC(3, kDebugLoading, "Cast::loadCastDataVWCR(): CastTypes id: %d(%s) PaletteCastMember", id, numToCastNum(id));
 			_loadedCast->setVal(id, new PaletteCastMember(this, id, stream, _version));
+			// load the palette now, as there are no CastInfo structs
+			_loadedCast->getVal(id)->load();
 			break;
 		case kCastFilmLoop:
 			debugC(3, kDebugLoading, "Cast::loadCastDataVWCR(): CastTypes id: %d(%s) FilmLoopCastMember", id, numToCastNum(id));


Commit: 45f5678eab41a056d541b7d2984f2f178db6fa70
    https://github.com/scummvm/scummvm/commit/45f5678eab41a056d541b7d2984f2f178db6fa70
Author: Scott Percival (code at moral.net.au)
Date: 2023-07-19T10:52:01+02:00

Commit Message:
DIRECTOR: Add ability to fake the current date

Required for titles which stop working after a certain date,
e.g. the Hollywood High "Be a Hollywood Hot Shot Contest" promo.

Changed paths:
    engines/director/director.cpp
    engines/director/director.h
    engines/director/game-quirks.cpp
    engines/director/lingo/lingo-the.cpp


diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 41426496a35..be256a357c1 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -98,6 +98,13 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
 	_wmHeight = 768;
 
 	_fpsLimit = 0;
+	_forceDate.tm_sec = -1;
+	_forceDate.tm_min = -1;
+	_forceDate.tm_hour = -1;
+	_forceDate.tm_mday = -1;
+	_forceDate.tm_mon = -1;
+	_forceDate.tm_year = -1;
+	_forceDate.tm_wday = -1;
 
 	_wm = nullptr;
 
diff --git a/engines/director/director.h b/engines/director/director.h
index 75457a90620..f8844427cfa 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -273,9 +273,12 @@ public:
 	uint32 _wmMode;
 	uint16 _wmWidth;
 	uint16 _wmHeight;
-	byte _fpsLimit;
 	CastMemberID _lastPalette;
 
+	// used for quirks
+	byte _fpsLimit;
+	TimeDate _forceDate;
+
 private:
 	byte _currentPalette[768];
 	uint16 _currentPaletteLength;
diff --git a/engines/director/game-quirks.cpp b/engines/director/game-quirks.cpp
index 7ee7a7ebcbb..e1ed785266d 100644
--- a/engines/director/game-quirks.cpp
+++ b/engines/director/game-quirks.cpp
@@ -93,6 +93,15 @@ static void quirk640x480Desktop() {
     g_director->_wmHeight = 480;
 }
 
+static void quirkHollywoodHigh() {
+	// Hollywood High demo has a killswitch that stops playback
+	// if the year is after 1996.
+	g_director->_forceDate.tm_year = 1996 - 1900;
+	g_director->_forceDate.tm_mon = 0;
+	g_director->_forceDate.tm_mday = 1;
+	g_director->_forceDate.tm_wday = 0;
+}
+
 static void quirkLzone() {
 	SearchMan.addSubDirectoryMatching(g_director->_gameDataDir, "win_data", 0, 2);
 }
@@ -180,6 +189,7 @@ struct Quirk {
     // It runs in 640x480; clipping it to this size ensures the main
     // game window takes up the full screen, and only the splash is windowed.
     { "kidsbox", Common::kPlatformMacintosh, &quirk640x480Desktop },
+	{ "hollywoodhigh", Common::kPlatformWindows, &quirkHollywoodHigh },
 	{ "lzone", Common::kPlatformWindows, &quirkLzone },
 	{ "mamauta1", Common::kPlatformMacintosh, &quirk640x480Desktop },
 	{ "mamauta1", Common::kPlatformWindows, &quirk640x480Desktop },
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 5c0bd955e9c..96e0378aded 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -2021,6 +2021,14 @@ Datum Lingo::getTheDate(int field) {
 	TimeDate t;
 	g_system->getTimeAndDate(t);
 
+	if (g_director->_forceDate.tm_year != -1) {
+		// Override date portion
+		t.tm_year = g_director->_forceDate.tm_year;
+		t.tm_mon = g_director->_forceDate.tm_mon;
+		t.tm_wday = g_director->_forceDate.tm_wday;
+		t.tm_mday = g_director->_forceDate.tm_mday;
+	}
+
 	Common::String s;
 
 	Datum d;


Commit: 2f64b8cd32b0bf8cfee52301e8e9b5a689323fdd
    https://github.com/scummvm/scummvm/commit/2f64b8cd32b0bf8cfee52301e8e9b5a689323fdd
Author: Scott Percival (code at moral.net.au)
Date: 2023-07-19T10:52:01+02:00

Commit Message:
DIRECTOR: XOBJ: Add stub for ManiacBg

Changed paths:
  A engines/director/lingo/xlibs/maniacbg.cpp
  A engines/director/lingo/xlibs/maniacbg.h
    devtools/director-generate-xobj-stub.py
    engines/director/lingo/lingo-object.cpp
    engines/director/module.mk


diff --git a/devtools/director-generate-xobj-stub.py b/devtools/director-generate-xobj-stub.py
index 7103a9f16ef..5088352549e 100755
--- a/devtools/director-generate-xobj-stub.py
+++ b/devtools/director-generate-xobj-stub.py
@@ -6,7 +6,7 @@ import re
 import struct
 from typing import BinaryIO
 
-DIRECTOR_SRC_PATH = os.path.abspath(os.path.join(__file__, "..", "engines", "director"))
+DIRECTOR_SRC_PATH = os.path.abspath(os.path.join(__file__, "..", "..", "engines", "director"))
 MAKEFILE_PATH = os.path.join(DIRECTOR_SRC_PATH, "module.mk")
 LINGO_XLIBS_PATH = os.path.join(DIRECTOR_SRC_PATH, "lingo", "xlibs")
 LINGO_OBJECT_PATH = os.path.join(DIRECTOR_SRC_PATH, "lingo", "lingo-object.cpp")
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index e23cecf4ff9..9867ee3cc7c 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -66,6 +66,7 @@
 #include "director/lingo/xlibs/ispippin.h"
 #include "director/lingo/xlibs/jitdraw3.h"
 #include "director/lingo/xlibs/labeldrvxobj.h"
+#include "director/lingo/xlibs/maniacbg.h"
 #include "director/lingo/xlibs/memoryxobj.h"
 #include "director/lingo/xlibs/miscx.h"
 #include "director/lingo/xlibs/moovxobj.h"
@@ -196,6 +197,7 @@ static struct XLibProto {
 	{ JITDraw3XObj::fileNames,			JITDraw3XObj::open,			JITDraw3XObj::close,		kXObj,					400 },	// D4
 	{ JourneyWareXINIXObj::fileNames,	JourneyWareXINIXObj::open,	JourneyWareXINIXObj::close,	kXObj,					400 },	// D4
 	{ LabelDrvXObj::fileNames,			LabelDrvXObj::open,			LabelDrvXObj::close,		kXObj,					400 },	// D4
+	{ ManiacBgXObj::fileNames,			ManiacBgXObj::open,			ManiacBgXObj::close,			kXObj,				300 },	// D3
 	{ MemoryXObj::fileNames,			MemoryXObj::open,			MemoryXObj::close,			kXObj,					300 },	// D3
 	{ MiscX::fileNames,					MiscX::open,				MiscX::close,				kXObj,					400 },	// D4
 	{ MoovXObj::fileNames, 				MoovXObj::open, 			MoovXObj::close,			kXObj,					300 },  // D3
diff --git a/engines/director/lingo/xlibs/maniacbg.cpp b/engines/director/lingo/xlibs/maniacbg.cpp
new file mode 100644
index 00000000000..57f9d614db9
--- /dev/null
+++ b/engines/director/lingo/xlibs/maniacbg.cpp
@@ -0,0 +1,94 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/system.h"
+
+#include "director/director.h"
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-object.h"
+#include "director/lingo/lingo-utils.h"
+#include "director/lingo/xlibs/maniacbg.h"
+
+/**************************************************
+ *
+ * USED IN:
+ * Maniac Sports
+ *
+ **************************************************/
+
+/*
+-- ForeMost XObject. 6/23/94 greg yachuk
+ForeMost
+I      mNew        --Creates a new instance of the XObject
+X      mDispose    --Disposes of XObject instance.
+I      mIsForeMost --Is this Application foremost. 1=Yes, 0=No.
+ */
+
+namespace Director {
+
+const char *ManiacBgXObj::xlibName = "maniacbg";
+const char *ManiacBgXObj::fileNames[] = {
+	"maniacbg",
+	nullptr
+};
+
+static MethodProto xlibMethods[] = {
+	{ "new",				ManiacBgXObj::m_new,		 0, 0,	300 },
+	{ "dispose",				ManiacBgXObj::m_dispose,		 0, 0,	300 },
+	{ "isForeMost",				ManiacBgXObj::m_isForeMost,		 0, 0,	300 },
+	{ nullptr, nullptr, 0, 0, 0 }
+};
+
+ManiacBgXObject::ManiacBgXObject(ObjectType ObjectType) :Object<ManiacBgXObject>("ManiacBgXObj") {
+	_objType = ObjectType;
+}
+
+void ManiacBgXObj::open(int type) {
+	if (type == kXObj) {
+		ManiacBgXObject::initMethods(xlibMethods);
+		ManiacBgXObject *xobj = new ManiacBgXObject(kXObj);
+		g_lingo->exposeXObject(xlibName, xobj);
+	} else if (type == kXtraObj) {
+		// TODO - Implement Xtra
+	}
+}
+
+void ManiacBgXObj::close(int type) {
+	if (type == kXObj) {
+		ManiacBgXObject::cleanupMethods();
+		g_lingo->_globalvars[xlibName] = Datum();
+	} else if (type == kXtraObj) {
+		// TODO - Implement Xtra
+	}
+}
+
+void ManiacBgXObj::m_new(int nargs) {
+	if (nargs != 0) {
+		warning("ManiacBgXObj::m_new: expected 0 arguments");
+		g_lingo->dropStack(nargs);
+	}
+	g_lingo->push(g_lingo->_state->me);
+}
+
+XOBJSTUBNR(ManiacBgXObj::m_dispose)
+XOBJSTUB(ManiacBgXObj::m_isForeMost, 1)
+
+}
diff --git a/engines/director/lingo/xlibs/maniacbg.h b/engines/director/lingo/xlibs/maniacbg.h
new file mode 100644
index 00000000000..ff8632fa1bf
--- /dev/null
+++ b/engines/director/lingo/xlibs/maniacbg.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef DIRECTOR_LINGO_XLIBS_MANIACBG_H
+#define DIRECTOR_LINGO_XLIBS_MANIACBG_H
+
+namespace Director {
+
+class ManiacBgXObject : public Object<ManiacBgXObject> {
+public:
+	ManiacBgXObject(ObjectType objType);
+};
+
+namespace ManiacBgXObj {
+
+extern const char *xlibName;
+extern const char *fileNames[];
+
+void open(int type);
+void close(int type);
+
+void m_new(int nargs);
+void m_dispose(int nargs);
+void m_isForeMost(int nargs);
+
+} // End of namespace ManiacBgXObj
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index e5d003016f0..0048df55f44 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -86,6 +86,7 @@ MODULE_OBJS = \
 	lingo/xlibs/jitdraw3.o \
 	lingo/xlibs/jwxini.o \
 	lingo/xlibs/labeldrvxobj.o \
+	lingo/xlibs/maniacbg.o \
 	lingo/xlibs/memoryxobj.o \
 	lingo/xlibs/miscx.o \
 	lingo/xlibs/moovxobj.o \


Commit: 856ec09514cb0c298f7b83ed6adfff17296919d1
    https://github.com/scummvm/scummvm/commit/856ec09514cb0c298f7b83ed6adfff17296919d1
Author: Scott Percival (code at moral.net.au)
Date: 2023-07-19T10:52:01+02:00

Commit Message:
DIRECTOR: XOBJ: Replace crash in parseMCICommand with warning

Changed paths:
    engines/director/lingo/lingo-mci.cpp


diff --git a/engines/director/lingo/lingo-mci.cpp b/engines/director/lingo/lingo-mci.cpp
index db7b3024017..f1c5e4861ea 100644
--- a/engines/director/lingo/lingo-mci.cpp
+++ b/engines/director/lingo/lingo-mci.cpp
@@ -308,7 +308,10 @@ static MCIError parseMCICommand(const Common::String &name, MCICommand &parsedCm
     }
 
     debugC(5, kDebugLingoExec, "parseMCICommand(): tableStart: %d, tableEnd: %d", tableStart, tableEnd);
-    assert(tableStart >= 0 && tableEnd > 0);
+    if (tableStart == -1 || tableEnd == -1) {
+        warning("parseMCICommand(): Verb %s not found in table", verb.c_str());
+		return MCIERR_UNRECOGNISED_COMMAND;
+	}
 
     auto cmd = table[tableStart];
     parsedCmd.id = (MCITokenType)cmd.flag;




More information about the Scummvm-git-logs mailing list