[Scummvm-git-logs] scummvm master -> 039cf08f4fdbbf05798cbf22cec38f7ce76fbda9

bluegr bluegr at gmail.com
Mon Jun 14 00:56:30 UTC 2021


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:
a40a796b9e TRECISION: Add toggle_object command
039cf08f4f TRECISION: Fix drawing frames from disabled animations - bugs #12624, #12626


Commit: a40a796b9e95d885f918ac501310d7d62b554ff5
    https://github.com/scummvm/scummvm/commit/a40a796b9e95d885f918ac501310d7d62b554ff5
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-06-14T03:56:13+03:00

Commit Message:
TRECISION: Add toggle_object command

Changed paths:
    engines/trecision/console.cpp
    engines/trecision/console.h


diff --git a/engines/trecision/console.cpp b/engines/trecision/console.cpp
index 61cc9eaadb..699e2cc941 100644
--- a/engines/trecision/console.cpp
+++ b/engines/trecision/console.cpp
@@ -33,13 +33,14 @@
 namespace Trecision {
 
 Console::Console(TrecisionEngine *vm) : GUI::Debugger(), _vm(vm) {
-	registerCmd("room",			WRAP_METHOD(Console, Cmd_Room));
-	registerCmd("dumpanim",		WRAP_METHOD(Console, Cmd_DumpAnim));
-	registerCmd("dumpfile",		WRAP_METHOD(Console, Cmd_DumpFile));
-	registerCmd("dialog",		WRAP_METHOD(Console, Cmd_Dialog));
-	registerCmd("item",			WRAP_METHOD(Console, Cmd_Item));
-	registerCmd("say",			WRAP_METHOD(Console, Cmd_Say));
-	registerCmd("position",		WRAP_METHOD(Console, Cmd_Position));
+	registerCmd("room",			 WRAP_METHOD(Console, Cmd_Room));
+	registerCmd("dumpanim",		 WRAP_METHOD(Console, Cmd_DumpAnim));
+	registerCmd("dumpfile",		 WRAP_METHOD(Console, Cmd_DumpFile));
+	registerCmd("dialog",		 WRAP_METHOD(Console, Cmd_Dialog));
+	registerCmd("item",			 WRAP_METHOD(Console, Cmd_Item));
+	registerCmd("say",			 WRAP_METHOD(Console, Cmd_Say));
+	registerCmd("position",		 WRAP_METHOD(Console, Cmd_Position));
+	registerCmd("toggle_object", WRAP_METHOD(Console, Cmd_ToggleObject));
 }
 
 Console::~Console() {
@@ -177,4 +178,18 @@ bool Console::Cmd_Position(int argc, const char **argv) {
 	return false;
 }
 
+bool Console::Cmd_ToggleObject(int argc, const char **argv) {
+	if (argc < 3) {
+		debugPrintf("Use %s <objectId> <status> to show or hide an object\n", argv[0]);
+		debugPrintf("Status can be true (or 1) to show an object, or false (or 0) to hide it\n");
+		return true;
+	}
+
+	const uint16 objectId = (uint16)atoi(argv[1]);
+	const bool visible = !strcmp(argv[2], "1") || !scumm_stricmp(argv[2], "true");
+	_vm->setObjectVisible(objectId, visible);
+
+	return false;
+}
+
 } // End of namespace Trecision
diff --git a/engines/trecision/console.h b/engines/trecision/console.h
index ce0f0813be..861fb6277b 100644
--- a/engines/trecision/console.h
+++ b/engines/trecision/console.h
@@ -44,6 +44,7 @@ private:
 	bool Cmd_Item(int argc, const char **argv);
 	bool Cmd_Say(int argc, const char **argv);
 	bool Cmd_Position(int argc, const char **argv);
+	bool Cmd_ToggleObject(int argc, const char **argv);
 };
 
 } // End of namespace Trecision


Commit: 039cf08f4fdbbf05798cbf22cec38f7ce76fbda9
    https://github.com/scummvm/scummvm/commit/039cf08f4fdbbf05798cbf22cec38f7ce76fbda9
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-06-14T03:56:13+03:00

Commit Message:
TRECISION: Fix drawing frames from disabled animations - bugs #12624, #12626

Fixes the chain shown incorrectly when entering the platforms and the
shopkeeper's wife appearing frozen after she's left the storeroom

Changed paths:
    engines/trecision/video.cpp


diff --git a/engines/trecision/video.cpp b/engines/trecision/video.cpp
index 3b74377486..1cbaa88c0e 100644
--- a/engines/trecision/video.cpp
+++ b/engines/trecision/video.cpp
@@ -436,14 +436,16 @@ void AnimManager::refreshSmkAnim(uint16 animation) {
 		handleEndOfVideo(animation, kSmackerAction);
 	}
 
-	for (int32 a = 0; a < MAXCHILD; a++) {
-		if (!(_animTab[animation]._flag & (SMKANIM_OFF1 << a)) && (_animTab[animation]._lim[a].bottom != 0)) {
-			_vm->_graphicsMgr->addDirtyRect(_animTab[animation]._lim[a], true);
+	for (int32 i = 0; i < MAXCHILD; i++) {
+		if (!(_animTab[animation]._flag & (SMKANIM_OFF1 << i)) && _animTab[animation]._lim[i].bottom != 0) {
+			_vm->_graphicsMgr->addDirtyRect(_animTab[animation]._lim[i], true);
 		}
 	}
 }
 
 void AnimManager::handleEndOfVideo(int animation, int slot) {
+	const bool isLoopingOrBackground = (_animTab[animation]._flag & SMKANIM_LOOP) || (_animTab[animation]._flag & SMKANIM_BKG);
+
 	if (_smkAnims[slot] == nullptr) {
 		smkStop(slot);
 		return;
@@ -451,7 +453,7 @@ void AnimManager::handleEndOfVideo(int animation, int slot) {
 	if (!_smkAnims[slot]->endOfFrames())
 		return;
 	
-	if (!(_animTab[animation]._flag & SMKANIM_LOOP) && !(_animTab[animation]._flag & SMKANIM_BKG)) {
+	if (!isLoopingOrBackground) {
 		smkStop(slot);
 		_vm->_flagPaintCharacter = true;
 	} else {
@@ -461,6 +463,10 @@ void AnimManager::handleEndOfVideo(int animation, int slot) {
 	}
 }
 
+static bool rectsIntersect(Common::Rect r1, Common::Rect r2) {
+	return (r1.left <= r2.right) && (r1.right >= r2.left) && (r1.top <= r2.bottom) && (r1.bottom >= r2.top);
+}
+
 void AnimManager::drawSmkBackgroundFrame(int animation) {
 	NightlongSmackerDecoder *smkDecoder = _smkAnims[kSmackerBackground];
 	if (smkDecoder == nullptr)
@@ -473,20 +479,30 @@ void AnimManager::drawSmkBackgroundFrame(int animation) {
 	const byte *palette = smkDecoder->getPalette();
 
 	if (smkDecoder->getCurFrame() == 0 && !_bgAnimRestarted) {
-		_vm->_graphicsMgr->blitToScreenBuffer(frame, 0, TOP, palette, true);
+		bool drawFrame = true;
+
+		for (int32 i = 0; i < MAXCHILD; i++) {
+			if ((_animTab[animation]._flag & (SMKANIM_OFF1 << i))) {
+				drawFrame = false;
+				break;
+			}
+		}
+
+		if (drawFrame)
+			_vm->_graphicsMgr->blitToScreenBuffer(frame, 0, TOP, palette, true);
 	} else {
 		while (lastRect) {
-			bool intersects = false;
-			for (int32 a = 0; a < MAXCHILD; a++) {
-				if (_animTab[animation]._flag & (SMKANIM_OFF1 << a)) {
-					if (_animTab[animation]._lim[a].intersects(*lastRect)) {
-						intersects = true;
-						break;
-					}
+			bool drawDirtyRect = true;
+
+			for (int32 i = 0; i < MAXCHILD; i++) {
+				const bool intersect = rectsIntersect(_animTab[animation]._lim[i], *lastRect);
+				if ((_animTab[animation]._flag & (SMKANIM_OFF1 << i)) && intersect) {
+					drawDirtyRect = false;
+					break;
 				}
 			}
 
-			if (smkDecoder->getCurFrame() > 0 && !intersects) {
+			if (smkDecoder->getCurFrame() > 0 && drawDirtyRect) {
 				Graphics::Surface anim = frame->getSubArea(*lastRect);
 				_vm->_graphicsMgr->blitToScreenBuffer(&anim, lastRect->left, lastRect->top + TOP, palette, true);
 			}




More information about the Scummvm-git-logs mailing list