[Scummvm-git-logs] scummvm master -> 87aacc623b751d5b186dd2a32f0976c7231d7097

elasota noreply at scummvm.org
Tue Jul 5 04:24:32 UTC 2022


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:
41f5fd10df MTROPOLIS: Fix single-note error in Obsidian Cloud Ring minigame
87aacc623b MTROPOLIS: Fix incorrect mToon mouse collision frame offset handling


Commit: 41f5fd10df7d8734e23f52c24b4cfe9f61bc6367
    https://github.com/scummvm/scummvm/commit/41f5fd10df7d8734e23f52c24b4cfe9f61bc6367
Author: elasota (ejlasota at gmail.com)
Date: 2022-07-05T00:23:44-04:00

Commit Message:
MTROPOLIS: Fix single-note error in Obsidian Cloud Ring minigame

Changed paths:
    engines/mtropolis/miniscript.cpp
    engines/mtropolis/miniscript.h
    engines/mtropolis/plugin/standard.cpp


diff --git a/engines/mtropolis/miniscript.cpp b/engines/mtropolis/miniscript.cpp
index 57ef7cb3cbf..492d5cbd5d0 100644
--- a/engines/mtropolis/miniscript.cpp
+++ b/engines/mtropolis/miniscript.cpp
@@ -28,7 +28,7 @@
 
 namespace MTropolis {
 
-static bool miniscriptEvaluateTruth(const DynamicValue& value) {
+bool miniscriptEvaluateTruth(const DynamicValue &value) {
 	// NOTE: Comparing equal to "true" only passes for 1 exactly, but for conditions,
 	// any non-zero value is true.
 	switch (value.getType()) {
diff --git a/engines/mtropolis/miniscript.h b/engines/mtropolis/miniscript.h
index a8e971541a2..92898f67853 100644
--- a/engines/mtropolis/miniscript.h
+++ b/engines/mtropolis/miniscript.h
@@ -31,6 +31,8 @@ class MiniscriptThread;
 struct MiniscriptStackValue;
 struct IMiniscriptInstructionFactory;
 
+bool miniscriptEvaluateTruth(const DynamicValue &value);
+
 class MiniscriptInstruction {
 public:
 	virtual ~MiniscriptInstruction();
diff --git a/engines/mtropolis/plugin/standard.cpp b/engines/mtropolis/plugin/standard.cpp
index b17af3e9cf8..12754554c76 100644
--- a/engines/mtropolis/plugin/standard.cpp
+++ b/engines/mtropolis/plugin/standard.cpp
@@ -27,6 +27,7 @@
 #include "audio/midiparser.h"
 #include "audio/midiparser_smf.h"
 
+#include "mtropolis/miniscript.h"
 #include "mtropolis/plugin/standard.h"
 #include "mtropolis/plugins.h"
 
@@ -2273,10 +2274,7 @@ MiniscriptInstructionOutcome MidiModifier::scriptSetTempo(MiniscriptThread *thre
 }
 
 MiniscriptInstructionOutcome MidiModifier::scriptSetPlayNote(MiniscriptThread *thread, const DynamicValue &value) {
-	if (value.getType() != DynamicValueTypes::kBoolean)
-		return kMiniscriptInstructionOutcomeFailed;
-
-	if (value.getBool())
+	if (miniscriptEvaluateTruth(value))
 		playSingleNote(thread->getRuntime());
 	else
 		stopSingleNote();


Commit: 87aacc623b751d5b186dd2a32f0976c7231d7097
    https://github.com/scummvm/scummvm/commit/87aacc623b751d5b186dd2a32f0976c7231d7097
Author: elasota (ejlasota at gmail.com)
Date: 2022-07-05T00:24:05-04:00

Commit Message:
MTROPOLIS: Fix incorrect mToon mouse collision frame offset handling

Changed paths:
    engines/mtropolis/elements.cpp


diff --git a/engines/mtropolis/elements.cpp b/engines/mtropolis/elements.cpp
index 55f8f353f4d..ec11bbccee1 100644
--- a/engines/mtropolis/elements.cpp
+++ b/engines/mtropolis/elements.cpp
@@ -1348,14 +1348,7 @@ bool MToonElement::isMouseCollisionAtPoint(int32 relativeX, int32 relativeY) con
 	if (_renderSurface) {
 		Common::Rect frameRect = _metadata->frames[_renderedFrame].rect;
 
-		if (frameRect.width() == _renderSurface->w && frameRect.height() == _renderSurface->h) {
-			// Frame rect is the size of the render surface, meaning the frame rect is an offset
-			relativeX -= frameRect.left;
-			relativeY -= frameRect.top;
-		}
-		// ... otherwise it's a sub-area of the rendered rect, meaning we shouldn't adjust coordinates
-
-		if (relativeX < 0 || relativeY < 0 || relativeX >= frameRect.width() || relativeY >= frameRect.height())
+		if (relativeX < frameRect.left || relativeY < frameRect.top || relativeX >= frameRect.right || relativeY >= frameRect.bottom)
 			return false;
 
 		if (_renderProps.getInkMode() == VisualElementRenderProperties::kInkModeBackgroundMatte) {
@@ -1363,8 +1356,15 @@ bool MToonElement::isMouseCollisionAtPoint(int32 relativeX, int32 relativeY) con
 			ColorRGB8 transColorRGB8 = _renderProps.getBackColor();
 			uint32 transColor = _renderSurface->format.ARGBToColor(255, transColorRGB8.r, transColorRGB8.g, transColorRGB8.b);
 
+			if (frameRect.width() == _renderSurface->w && frameRect.height() == _renderSurface->h) {
+				// Frame rect is the size of the render surface, meaning the frame is floating and we need to adjust to its coordinates
+				relativeX -= frameRect.left;
+				relativeY -= frameRect.top;
+			}
+			// ... otherwise it's a sub-area of the rendered rect, meaning we shouldn't adjust coordinates
+
 			// Sanity-check
-			if (relativeX >= _renderSurface->w || relativeY >= _renderSurface->h)
+			if (relativeX < 0 || relativeY < 0 || relativeX >= _renderSurface->w || relativeY >= _renderSurface->h)
 				return false;
 
 			// Check if the pixel is transparent




More information about the Scummvm-git-logs mailing list