[Scummvm-git-logs] scummvm master -> 83f4b713bc2265c27a40f10cf53622cf3f41628c

dreammaster dreammaster at scummvm.org
Fri Sep 10 04:48:12 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:
83f4b713bc AGS: Fix turning off flashlight in Maniac Mansion Deluxe


Commit: 83f4b713bc2265c27a40f10cf53622cf3f41628c
    https://github.com/scummvm/scummvm/commit/83f4b713bc2265c27a40f10cf53622cf3f41628c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-09-09T21:47:59-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