[Scummvm-git-logs] scummvm master -> d8d8f0d3733819ab4a5cdcaf25f0f79e86b1b5e6

mduggan noreply at scummvm.org
Mon Jul 15 06:39:43 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:
a208ce2ae3 DGDS: Don't show inventory button on demos
d8d8f0d373 DGDS: Fix more TTM for HoC


Commit: a208ce2ae3266297c2e54d13c95494510462cb0d
    https://github.com/scummvm/scummvm/commit/a208ce2ae3266297c2e54d13c95494510462cb0d
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-07-15T16:29:57+10:00

Commit Message:
DGDS: Don't show inventory button on demos

Changed paths:
    engines/dgds/dgds.cpp
    engines/dgds/dgds.h


diff --git a/engines/dgds/dgds.cpp b/engines/dgds/dgds.cpp
index 903deb1f434..90b4ef4881d 100644
--- a/engines/dgds/dgds.cpp
+++ b/engines/dgds/dgds.cpp
@@ -79,23 +79,27 @@ DgdsEngine::DgdsEngine(OSystem *syst, const ADGameDescription *gameDesc)
 	_gdsScene(nullptr), _resource(nullptr), _gamePals(nullptr), _gameGlobals(nullptr),
 	_detailLevel(kDgdsDetailHigh), _textSpeed(1), _justChangedScene1(false), _justChangedScene2(false),
 	_random("dgds"), _currentCursor(-1), _menuToTrigger(kMenuNone), _isLoading(true),
-	_rstFileName(nullptr), _difficulty(1), _menu(nullptr), _adsInterp(nullptr) {
+	_rstFileName(nullptr), _difficulty(1), _menu(nullptr), _adsInterp(nullptr), _isDemo(false) {
 	syncSoundSettings();
 
 	_platform = gameDesc->platform;
 
-	if (!strcmp(gameDesc->gameId, "rise"))
+	if (!strcmp(gameDesc->gameId, "rise")) {
 		_gameId = GID_DRAGON;
-	else if (!strcmp(gameDesc->gameId, "china"))
+	} else if (!strcmp(gameDesc->gameId, "china")) {
 		_gameId = GID_HOC;
-	else if (!strcmp(gameDesc->gameId, "beamish"))
+	} else if (!strcmp(gameDesc->gameId, "beamish")) {
+		_isDemo = (gameDesc->flags & ADGF_DEMO);
 		_gameId = GID_WILLY;
-	else if (!strcmp(gameDesc->gameId, "sq5demo"))
+	} else if (!strcmp(gameDesc->gameId, "sq5demo")) {
+		_isDemo = true;
 		_gameId = GID_SQ5DEMO;
-	else if (!strcmp(gameDesc->gameId, "comingattractions"))
+	} else if (!strcmp(gameDesc->gameId, "comingattractions")) {
+		_isDemo = true;
 		_gameId = GID_COMINGATTRACTIONS;
-	else
+	} else {
 		error("Unknown game ID");
+	}
 
 	const Common::FSNode gameDataDir(ConfMan.getPath("path"));
 	SearchMan.addSubDirectoryMatching(gameDataDir, "patches");
@@ -186,7 +190,8 @@ bool DgdsEngine::changeScene(int sceneNum) {
 
 	_scene->load(sceneFile, _resource, _decompressor);
 	// These are done inside the load function in the original.. cleaner here..
-	_scene->addInvButtonToHotAreaList();
+	if (!_isDemo)
+		_scene->addInvButtonToHotAreaList();
 	if (_gameId == GID_DRAGON)
 		_clock.setVisibleScript(true);
 
@@ -647,14 +652,13 @@ Common::SeekableReadStream *DgdsEngine::getResource(const Common::String &name,
 
 
 bool DgdsEngine::canLoadGameStateCurrently(Common::U32String *msg /*= nullptr*/) {
-	return _gdsScene != nullptr;
+	return !_isDemo && _gdsScene != nullptr;
 }
 
 
 bool DgdsEngine::canSaveGameStateCurrently(Common::U32String *msg /*= nullptr*/) {
-	// Doesn't make sense to save non-interactive demos..
-	bool isSavableGame = getGameId() != GID_SQ5DEMO && getGameId() != GID_COMINGATTRACTIONS;
-	return isSavableGame && _gdsScene && _scene && _scene->getNum() != 2
+	// The demos are all non-interactive, so it doesn't make sense to save them.
+	return !_isDemo && _gdsScene && _scene && _scene->getNum() != 2
 			&& _scene->getDragItem() == nullptr && !_isLoading;
 }
 
@@ -697,7 +701,8 @@ Common::Error DgdsEngine::syncGame(Common::Serializer &s) {
 		_scene->unload();
 		_adsInterp->unload();
 		_scene->load(sceneFile, _resource, _decompressor);
-		_scene->addInvButtonToHotAreaList();
+		if (!_isDemo)
+			_scene->addInvButtonToHotAreaList();
 	}
 
 	result = _scene->syncState(s);
diff --git a/engines/dgds/dgds.h b/engines/dgds/dgds.h
index 464d020e80b..00913c14bbb 100644
--- a/engines/dgds/dgds.h
+++ b/engines/dgds/dgds.h
@@ -137,6 +137,8 @@ private:
 	bool _isLoading;
 	const char *_rstFileName;
 
+	bool _isDemo;
+
 public:
 	DgdsEngine(OSystem *syst, const ADGameDescription *gameDesc);
 	virtual ~DgdsEngine();


Commit: d8d8f0d3733819ab4a5cdcaf25f0f79e86b1b5e6
    https://github.com/scummvm/scummvm/commit/d8d8f0d3733819ab4a5cdcaf25f0f79e86b1b5e6
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-07-15T16:29:57+10:00

Commit Message:
DGDS: Fix more TTM for HoC

* Implement opcode B606 (copy buffer region)
* Correctly read 0xAFxF (draw poly) opcode data - we don't yet draw the poly,
  but at least this stops the game from crashing.

Changed paths:
    engines/dgds/ttm.cpp


diff --git a/engines/dgds/ttm.cpp b/engines/dgds/ttm.cpp
index fd959cd3aa7..1097adc4db3 100644
--- a/engines/dgds/ttm.cpp
+++ b/engines/dgds/ttm.cpp
@@ -199,6 +199,8 @@ static const char *ttmOpName(uint16 op) {
 	case 0xa520: return "DRAW SPRITE FLIPH";
 	case 0xa530: return "DRAW SPRITE FLIPHV";
 	case 0xa600: return "DRAW GETPUT";
+	case 0xaf10: return "DRAW EMPTY POLY";
+	case 0xaf20: return "DRAW FILLED POLY";
 	case 0xb000: return "INIT CREDITS SCROLL";
 	case 0xb010: return "DRAW CREDITS SCROLL";
 	case 0xf010: return "LOAD SCR";
@@ -221,7 +223,7 @@ static const char *ttmOpName(uint16 op) {
 	case 0x00C0: return "FREE BACKGROUND";
 	case 0x0230: return "reset current music?";
 	case 0x1310: return "STOP SFX";
-	case 0xb600: return "DRAW SCREEN";
+	case 0xb600: return "COPY BUFFER";
 	case 0xc020: return "LOAD_SAMPLE";
 	case 0xc030: return "SELECT_SAMPLE";
 	case 0xc040: return "DESELECT_SAMPLE";
@@ -798,6 +800,12 @@ void TTMInterpreter::handleOperation(TTMEnviro &env, TTMSeq &seq, uint16 op, byt
 						Common::Point(r.left, r.top));
 		break;
 	}
+	case 0xaf10:
+		warning("TT3 TODO: Implement 0xAF10 DRAW EMPTY POLY");
+		break;
+	case 0xaf20:
+		warning("TT3 TODO: Implement 0xAF20 DRAW FILLED POLY");
+		break;
 	case 0xb000:
 		if (seq._executed) // this is a one-shot op
 			break;
@@ -815,6 +823,21 @@ void TTMInterpreter::handleOperation(TTMEnviro &env, TTMSeq &seq, uint16 op, byt
 		}
 		break;
 	}
+	case 0xb600: { // COPY BUFFER: x, y, w, h, buf1, buf2
+		// buf1 and buf2 are buffer numbers.
+		// 	0 - composition
+		// 	1 - stored area
+		// 	2 - background
+		if (seq._executed) // this is a one-shot op
+			break;
+		const Common::Rect r(Common::Point(ivals[0], ivals[1]), ivals[2], ivals[3]);
+		int16 b1 = ivals[4];
+		int16 b2 = ivals[5];
+		Graphics::ManagedSurface &s1 = ((b1 == 0) ? _vm->_compositionBuffer : (b1 == 2 ? _vm->getBackgroundBuffer() : _vm->getStoredAreaBuffer()));
+		Graphics::ManagedSurface &s2 = ((b2 == 0) ? _vm->_compositionBuffer : (b2 == 2 ? _vm->getBackgroundBuffer() : _vm->getStoredAreaBuffer()));
+		s2.blitFrom(s1, r, r);
+		break;
+	}
 	case 0xc020: {	// LOAD SAMPLE: filename:str
 		_vm->_soundPlayer->loadMacMusic(sval.c_str());
 		break;
@@ -894,7 +917,6 @@ void TTMInterpreter::handleOperation(TTMEnviro &env, TTMSeq &seq, uint16 op, byt
 	case 0x2010: // SET FRAME?? x,y
 	case 0xa400: // DRAW FILLED CIRCLE
 	case 0xa420: // DRAW EMPTY CIRCLE
-	case 0xb600: // DRAW SCREEN?? 6 args		// HoC onward
 	case 0xc040: // DESELECT_SAMPLE				// SQ5 demo onward
 	case 0xc060: // STOP_SAMPLE					// SQ5 demo onward
 	case 0xc0e0: // FADE SONG songnum, destvol, ticks (1/60th sec)
@@ -930,19 +952,31 @@ bool TTMInterpreter::run(TTMEnviro &env, TTMSeq &seq) {
 			error("Invalid TTM opcode %04x requires %d locals", code, count);
 
 		debugN(10, "\tOP: 0x%4.4x %2u ", op, count);
+
 		if (count == 0x0F) {
-			byte ch[2];
-
-			do {
-				ch[0] = scr->readByte();
-				ch[1] = scr->readByte();
-				if (ch[0])
-					sval += ch[0];
-				if (ch[1])
-					sval += ch[1];
-			} while (ch[0] != 0 && ch[1] != 0);
-
-			debugN(10, "\"%s\"", sval.c_str());
+			// Special case for these codes, they are data blocks
+			// with length arg rather than strings.
+			if (code == 0xaf1f || code == 0xaf2f) {
+				int16 nbytes = scr->readSint16LE() * 4;
+				byte *buf = new byte[nbytes + 1];
+				scr->read(buf, nbytes);
+				buf[nbytes] = 0;
+				debugN(10, "\"%d bytes\"", nbytes);
+				delete [] buf; // TODO: use this data as a set of points in a polygon
+			} else {
+				byte ch[2];
+
+				do {
+					ch[0] = scr->readByte();
+					ch[1] = scr->readByte();
+					if (ch[0])
+						sval += ch[0];
+					if (ch[1])
+						sval += ch[1];
+				} while (ch[0] != 0 && ch[1] != 0);
+				debugN(10, "\"%s\"", sval.c_str());
+			}
+
 		} else {
 			for (byte i = 0; i < count; i++) {
 				ivals[i] = scr->readSint16LE();
@@ -989,8 +1023,6 @@ void TTMInterpreter::findAndAddSequences(TTMEnviro &env, Common::Array<TTMSeq> &
 		op = env.scr->readUint16LE();
 		while (op != 0x0ff0 && env.scr->pos() < env.scr->size()) {
 			//debug("findAndAddSequences: check ttm op %04x", op);
-			if (op == 0xaf1f || op == 0xaf2f)
-				warning("TODO: Fix findAndAddSequences for opcode %x which has variable length arg", op);
 			switch (op & 0xf) {
 			case 0:
 				break;
@@ -1009,12 +1041,17 @@ void TTMInterpreter::findAndAddSequences(TTMEnviro &env, Common::Array<TTMSeq> &
 				}
 				break;
 			case 0xf: {
-				byte ch[2];
-				do {
-					ch[0] = env.scr->readByte();
-					ch[1] = env.scr->readByte();
-				} while (ch[0] != 0 && ch[1] != 0);
-				break;
+				if (op == 0xaf1f || op == 0xaf2f) {
+					int16 nbytes = env.scr->readUint16LE() * 4;
+					env.scr->skip(nbytes);
+				} else {
+					byte ch[2];
+					do {
+						ch[0] = env.scr->readByte();
+						ch[1] = env.scr->readByte();
+					} while (ch[0] != 0 && ch[1] != 0);
+					break;
+				}
 			}
 			default:
 				env.scr->skip((op & 0xf) * 2);




More information about the Scummvm-git-logs mailing list