[Scummvm-git-logs] scummvm branch-2-3 -> 2a5a4b6fb42a9ff40ba8505d36fb7622c5982e5e

dreammaster dreammaster at scummvm.org
Fri Sep 10 04:48:37 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2a5a4b6fb4 AGS: Fix turning off flashlight in Maniac Mansion Deluxe


Commit: 2a5a4b6fb42a9ff40ba8505d36fb7622c5982e5e
    https://github.com/scummvm/scummvm/commit/2a5a4b6fb42a9ff40ba8505d36fb7622c5982e5e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-09-09T21:48:27-07:00

Commit Message:
AGS: Fix turning off flashlight in Maniac Mansion Deluxe

Changed paths:
    engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
    engines/ags/plugins/ags_flashlight/gfx.cpp


diff --git a/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp b/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
index 62285988fe..f21efe5d9b 100644
--- a/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
+++ b/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
@@ -108,7 +108,8 @@ void AGSFlashlight::syncGame(Serializer &s) {
 	s.syncAsInt(SaveVersion);
 
 	if (s.isLoading() && SaveVersion != SaveMagic) {
-		// Older versions of AGSFlashlight didn't persist their data.
+		// The real AGSFlashlight, or at least the one included with
+		// Maniac Mansion Deluxe, doesn't persist any fields.
 		// So in such a case, revert the 4 bytes and skip everything else
 		s.unreadInt();
 
@@ -200,6 +201,11 @@ void AGSFlashlight::SetFlashlightDarknessSize(ScriptMethodParams &params) {
 		g_BitmapMustBeUpdated = true;
 		g_DarknessSize = Size;
 		g_DarknessDiameter = g_DarknessSize * 2;
+
+		if (g_BrightnessSize > g_DarknessSize) {
+			ScriptMethodParams p(g_DarknessSize);
+			SetFlashlightBrightnessSize(p);
+		}
 	}
 }
 
@@ -230,6 +236,11 @@ void AGSFlashlight::SetFlashlightBrightnessSize(ScriptMethodParams &params) {
 	if (Size != g_BrightnessSize) {
 		g_BitmapMustBeUpdated = true;
 		g_BrightnessSize = Size;
+
+		if (g_DarknessSize < g_BrightnessSize) {
+			ScriptMethodParams p(g_BrightnessSize);
+			SetFlashlightDarknessSize(p);
+		}
 	}
 }
 
diff --git a/engines/ags/plugins/ags_flashlight/gfx.cpp b/engines/ags/plugins/ags_flashlight/gfx.cpp
index ea110f764d..a05b725fc3 100644
--- a/engines/ags/plugins/ags_flashlight/gfx.cpp
+++ b/engines/ags/plugins/ags_flashlight/gfx.cpp
@@ -273,7 +273,7 @@ void AGSFlashlight::CreateLightBitmap() {
 		*pixel++ = (uint32)color;
 
 	// Draw light circle if wanted.
-	if (g_DarknessSize > 0) {
+	if (g_DarknessSize > 0 && g_DarknessLightLevel != g_BrightnessLightLevel) {
 		uint32 current_value = 0;
 		color = (255 - (int)((float)g_BrightnessLightLevel * 2.55f));
 		uint32 targetcolor = ((255 - (int)((float)g_DarknessLightLevel * 2.55f)));




More information about the Scummvm-git-logs mailing list