[Scummvm-git-logs] scummvm master -> 36fe1cdff420399b5fd4abb559d12a45b4ea2987

mduggan noreply at scummvm.org
Wed Oct 16 08:52:36 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:
8b5bc71a02 DGDS: Clean up scene functions a little
36fe1cdff4 DGDS: Fix ADS execution order again


Commit: 8b5bc71a025ec29fea2b2b6171e2bb8f60160105
    https://github.com/scummvm/scummvm/commit/8b5bc71a025ec29fea2b2b6171e2bb8f60160105
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-10-16T19:51:23+11:00

Commit Message:
DGDS: Clean up scene functions a little

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


diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index 3436f52744f..60975f610af 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -1054,7 +1054,7 @@ void SDSScene::enableTrigger(uint16 num, bool enable /* = true */) {
 		}
 	}
 
-	warning("Trigger %d not found", num);
+	warning("enableTrigger: Trigger %d not found", num);
 }
 
 bool SDSScene::isTriggerEnabled(uint16 num) {
@@ -1064,14 +1064,11 @@ bool SDSScene::isTriggerEnabled(uint16 num) {
 		}
 	}
 
-	warning("Trigger %d not found", num);
+	warning("isTriggerEnabled: Trigger %d not found", num);
 	return false;
 }
 
 void SDSScene::checkTriggers() {
-	// scene can change on these triggers.  if that happens we stop.
-	int startSceneNum = _num;
-
 	for (SceneTrigger &trigger : _triggers) {
 		if (!trigger._enabled)
 			continue;
@@ -1085,10 +1082,10 @@ void SDSScene::checkTriggers() {
 			continue;
 
 		trigger._enabled = false;
-		runOps(trigger.sceneOpList);
+		bool keepGoing = runOps(trigger.sceneOpList);
 
 		// If the scene changed, the list is no longer valid. Abort!
-		if (_num != startSceneNum)
+		if (!keepGoing)
 			return;
 	}
 }
@@ -1694,8 +1691,9 @@ void SDSScene::mouseLDown(const Common::Point &pt) {
 	if (!area)
 		return;
 
-	debug(9, "Mouse LDown on area %d (%d,%d,%d,%d) cursor %d", area->_num, area->_rect.x, area->_rect.y,
-			area->_rect.width, area->_rect.height, area->_cursorNum);
+	debug(9, "Mouse LDown on area %d (%d,%d,%d,%d) cursor %d. Run %d ops", area->_num,
+			area->_rect.x, area->_rect.y, area->_rect.width, area->_rect.height,
+			area->_cursorNum, area->onLDownOps.size());
 
 	DgdsEngine *engine = DgdsEngine::getInstance();
 	int16 addmins = engine->getGameGlobals()->getGameMinsToAddOnStartDrag();
@@ -1763,7 +1761,7 @@ void SDSScene::mouseLUp(const Common::Point &pt) {
 			addInvButtonToHotAreaList();
 	} else {
 		if (_rbuttonDown) {
-			debug(" --> exec %d both-button click ops for area %d", area->onLClickOps.size(), area->_num);
+			debug(" --> exec both-button click ops for area %d", area->_num);
 			// A both-button-click event, find the interaction list.
 			const GameItem *activeItem = engine->getGDSScene()->getActiveItem();
 			if (activeItem) {
diff --git a/engines/dgds/scene.h b/engines/dgds/scene.h
index 5811319f7d5..3736256cd4f 100644
--- a/engines/dgds/scene.h
+++ b/engines/dgds/scene.h
@@ -307,13 +307,13 @@ public:
 
 	uint32 getMagic() const { return _magic; }
 	const Common::String &getVersion() const { return _version; }
+
 	bool runPreTickOps() { return runOps(_preTickOps); }
 	bool runPostTickOps() { return runOps(_postTickOps); }
 
 	static bool runOps(const Common::Array<SceneOp> ops, int16 addMinutes = 0);
+
 	virtual Common::Error syncState(Common::Serializer &s) = 0;
-	virtual void enableTrigger(uint16 numm, bool enable = true) {}
-	virtual void showDialog(uint16 fileNum, uint16 dlgNum) {}
 
 protected:
 	bool readConditionList(Common::SeekableReadStream *s, Common::Array<SceneConditions> &list) const;
@@ -448,7 +448,7 @@ public:
 	Common::Error syncState(Common::Serializer &s) override;
 
 	void onDragFinish(const Common::Point &pt);
-	void enableTrigger(uint16 num, bool enable = true) override;
+	void enableTrigger(uint16 num, bool enable = true);
 
 	Dialog *loadDialogData(uint16 num);
 	void freeDialogData(uint16 num);
@@ -468,7 +468,7 @@ public:
 	bool isTriggerEnabled(uint16 num);
 	bool isLButtonDown() const { return _lbuttonDown; }
 	bool isRButtonDown() const { return _rbuttonDown; }
-	void showDialog(uint16 fileNum, uint16 dlgNum) override;
+	void showDialog(uint16 fileNum, uint16 dlgNum);
 	const Common::Array<ConditionalSceneOp> &getConditionalOps() { return _conditionalOps; }
 
 protected:


Commit: 36fe1cdff420399b5fd4abb559d12a45b4ea2987
    https://github.com/scummvm/scummvm/commit/36fe1cdff420399b5fd4abb559d12a45b4ea2987
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-10-16T19:52:19+11:00

Commit Message:
DGDS: Fix ADS execution order again

Closer inspection shows the "move to front" and "move to back" ADS ops were the
wrong way around.

Unfortunately this breaks the rendering a bit - blade's shirt flashes on the
floor of the apartment at the start of dragon.

However, it's more correct and fixes other things - eg, turning off the tap in
the apartment.  The rendering problem will need a different fix.

Changed paths:
    engines/dgds/ads.cpp
    engines/dgds/scene.cpp
    engines/dgds/ttm.h


diff --git a/engines/dgds/ads.cpp b/engines/dgds/ads.cpp
index ba77fdf2d72..ad5f4c2dc51 100644
--- a/engines/dgds/ads.cpp
+++ b/engines/dgds/ads.cpp
@@ -342,14 +342,14 @@ bool ADSInterpreter::logicOpResult(uint16 code, const TTMEnviro *env, const TTMS
 	assert(seq || code == 0x1380 || code == 0x1390);
 
 	switch (code) {
-	case 0x1010: // WHILE runtype 5
-	case 0x1310: // IF runtype 5, 2 params
-		debugN(10, "ADS 0x%04x: %s runtype 5 env %d seq %d (%s)", code, optype, envNum, seqNum, tag);
-		return seq->_runFlag == kRunType5;
-	case 0x1020: // WHILE not runtype 5
-	case 0x1320: // IF not runtype 5, 2 params
-		debugN(10, "ADS 0x%04x: %s not runtype 5 env %d seq %d (%s)", code, optype, envNum, seqNum, tag);
-		return seq->_runFlag != kRunType5;
+	case 0x1010: // WHILE paused
+	case 0x1310: // IF paused, 2 params
+		debugN(10, "ADS 0x%04x: %s paused env %d seq %d (%s)", code, optype, envNum, seqNum, tag);
+		return seq->_runFlag == kRunTypePaused;
+	case 0x1020: // WHILE not paused
+	case 0x1320: // IF not paused, 2 params
+		debugN(10, "ADS 0x%04x: %s not paused env %d seq %d (%s)", code, optype, envNum, seqNum, tag);
+		return seq->_runFlag != kRunTypePaused;
 	case 0x1030: // WHILE NOT PLAYED
 	case 0x1330: // IF_NOT_PLAYED, 2 params
 		debugN(10, "ADS 0x%04x: %s not played env %d seq %d (%s)", code, optype, envNum, seqNum, tag);
@@ -529,8 +529,8 @@ bool ADSInterpreter::handleOperation(uint16 code, Common::SeekableReadStream *sc
 	case 0x1070: // WHILE running, 2 params
 	case 0x1080: // WHILE count?, 1 param (HOC+ only)
 	case 0x1090: // WHILE ??, 1 param (HOC+ only)
-	case 0x1310: // IF runtype 5, 2 params
-	case 0x1320: // IF not runtype 5, 2 params
+	case 0x1310: // IF paused, 2 params
+	case 0x1320: // IF not paused, 2 params
 	case 0x1330: // IF NOT_PLAYED, 2 params
 	case 0x1340: // IF PLAYED, 2 params
 	case 0x1350: // IF FINISHED, 2 params
@@ -597,16 +597,16 @@ bool ADSInterpreter::handleOperation(uint16 code, Common::SeekableReadStream *sc
 			_currentTTMSeq->_runFlag = kRunTypeStopped;
 		break;
 	}
-	case 0x2015: { // SET RUNFLAG 5, 3 params (ttmenv, ttmseq, proportion)
+	case 0x2015: { // SET RUNFLAG 5, 3 params (ttmenv, ttmseq, proportion) (pause)
 		enviro = scr->readUint16LE();
 		seqnum = scr->readUint16LE();
 		uint16 unk = scr->readUint16LE();
 		_currentTTMSeq = findTTMSeq(enviro, seqnum);
 		const TTMEnviro *env = findTTMEnviro(enviro);
-		debug(10, "ADS 0x2015: set runflag5 env %d seq %d (%s) prop %d", enviro, seqnum,
+		debug(10, "ADS 0x2015: set paused env %d seq %d (%s) prop %d", enviro, seqnum,
 				env->_tags.getValOrDefault(seqnum).c_str(), unk);
 		if (_currentTTMSeq)
-			_currentTTMSeq->_runFlag = kRunType5;
+			_currentTTMSeq->_runFlag = kRunTypePaused;
 		break;
 	}
 	case 0x2020: { // RESET SEQ, 2 params (env, seq, proportion)
@@ -633,10 +633,10 @@ bool ADSInterpreter::handleOperation(uint16 code, Common::SeekableReadStream *sc
 		handleRandomOp(code, scr);
 		break;
 
-	case 0x4000: { // MOVE SEQ TO BACK
+	case 0x4000: { // MOVE SEQ TO FRONT
 		enviro = scr->readUint16LE();
 		seqnum = scr->readUint16LE();
-		debug(10, "ADS 0x%04x: mov seq to back env %d seq %d", code, enviro, seqnum);
+		debug(10, "ADS 0x%04x: mov seq to front env %d seq %d", code, enviro, seqnum);
 		/*uint16 unk = */scr->readUint16LE();
 		// This is O(N) but the N is small and it's not called often.
 		TTMSeq seq;
@@ -651,7 +651,7 @@ bool ADSInterpreter::handleOperation(uint16 code, Common::SeekableReadStream *sc
 		}
 
 		if (success)
-			_adsData->_ttmSeqs.push_back(seq);
+			_adsData->_ttmSeqs.insert_at(0, seq);
 		else
 			warning("ADS: 0x4000 Request to move env %d seq %d which doesn't exist", enviro, seqnum);
 
@@ -661,7 +661,7 @@ bool ADSInterpreter::handleOperation(uint16 code, Common::SeekableReadStream *sc
 	case 0x4010: { // MOVE SEQ TO FRONT
 		enviro = scr->readUint16LE();
 		seqnum = scr->readUint16LE();
-		debug(10, "ADS 0x%04x: mov seq to front env %d seq %d", code, enviro, seqnum);
+		debug(10, "ADS 0x%04x: mov seq to back env %d seq %d", code, enviro, seqnum);
 		/*uint16 unk = */scr->readUint16LE();
 		// This is O(N) but the N is small and it's not called often.
 		TTMSeq seq;
@@ -676,7 +676,7 @@ bool ADSInterpreter::handleOperation(uint16 code, Common::SeekableReadStream *sc
 		}
 
 		if (success)
-			_adsData->_ttmSeqs.insert_at(0, seq);
+			_adsData->_ttmSeqs.push_back(seq);
 		else
 			warning("ADS: 0x4010 Request to move env %d seq %d which doesn't exist", enviro, seqnum);
 
@@ -706,7 +706,7 @@ bool ADSInterpreter::handleOperation(uint16 code, Common::SeekableReadStream *sc
 	case 0xF200: { // RUN_SCRIPT, 1 param
 		int16 segment = scr->readSint16LE();
 		int16 idx = getArrIndexOfSegNum(segment);
-		debug(10, "ADS 0x%04x: add 4 remove 8 to state seg %d idx %d", code, segment, idx);
+		debug(10, "ADS 0x%04x: run seg %d idx %d", code, segment, idx);
 		if (segment >= 0 && idx >= 0) {
 			int state = (_adsData->_state[idx] & 8) | 4;
 			_adsData->_state[idx] = state;
@@ -714,10 +714,10 @@ bool ADSInterpreter::handleOperation(uint16 code, Common::SeekableReadStream *sc
 		return true;
 	}
 
-	case 0xF210: { // RUN_SCRIPT, 1 param
+	case 0xF210: { // RESTART_SCRIPT, 1 param
 		int16 segment = scr->readSint16LE();
 		int16 idx = getArrIndexOfSegNum(segment);
-		debug(10, "ADS 0x%04x: add 3 remove 8 to state seg %d idx %d", code, segment, idx);
+		debug(10, "ADS 0x%04x: restart seg %d idx %d", code, segment, idx);
 		if (segment >= 0 && idx >= 0) {
 			int state = (_adsData->_state[idx] & 8) | 3;
 			_adsData->_state[idx] = state;
@@ -831,7 +831,7 @@ bool ADSInterpreter::run() {
 		seq._lastFrame = -1;
 		int sflag = seq._scriptFlag;
 		TTMRunType rflag = seq._runFlag;
-		if (sflag == 6 || (rflag != kRunType1 && rflag != kRunTypeTimeLimited && rflag != kRunTypeMulti && rflag != kRunType5)) {
+		if (sflag == 6 || (rflag != kRunType1 && rflag != kRunTypeTimeLimited && rflag != kRunTypeMulti && rflag != kRunTypePaused)) {
 			if (sflag != 6 && sflag != 5 && rflag == kRunTypeFinished) {
 				seq._runFlag = kRunTypeStopped;
 			}
@@ -863,7 +863,7 @@ bool ADSInterpreter::run() {
 						if (seq._currentFrame == _adsData->_gotoTarget)
 							seq._selfLoop = true;
 					}
-					if (seq._runFlag != kRunType5)
+					if (seq._runFlag != kRunTypePaused)
 						updateSeqTimeAndFrame(env, seq);
 				} else {
 					seq._gotoFrame = seq._startFrame;
diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index 60975f610af..f44ad98f19d 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -577,16 +577,16 @@ void Scene::segmentStateOps(const Common::Array<uint16> &args) {
 		if (!subop && !arg)
 			return;
 		switch (subop) {
-		case 1:
+		case 1: // Restart
 			interp->segmentOrState(arg, 3);
 			break;
-		case 2:
+		case 2: // Start
 			interp->segmentOrState(arg, 4);
 			break;
-		case 3:
+		case 3: // Stop
 			interp->segmentSetState(arg, 6);
 			break;
-		case 4:
+		case 4: // Pause
 			interp->segmentSetState(arg, 5);
 			break;
 		case 9:
diff --git a/engines/dgds/ttm.h b/engines/dgds/ttm.h
index 9436d063c7f..d58d99b9214 100644
--- a/engines/dgds/ttm.h
+++ b/engines/dgds/ttm.h
@@ -73,7 +73,7 @@ enum TTMRunType {
 	kRunTypeMulti = 2,
 	kRunTypeTimeLimited = 3,
 	kRunTypeFinished = 4,
-	kRunType5 = 5,
+	kRunTypePaused = 5,
 };
 
 




More information about the Scummvm-git-logs mailing list