[Scummvm-git-logs] scummvm master -> 8eff5a7f433490cb88ca41332fa3c4da72195331

fracturehill noreply at scummvm.org
Sun Oct 1 10:32:14 UTC 2023


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

Summary:
62ea6f4e21 NANCY: Implement MouseLightPuzzle
eca40b5401 NANCY: Remove irrelevant output in console command
206a9b3285 NANCY: Add support for nancy6 AddInventoryNoHS
4e2fc958c8 NANCY: Fix inventory "can't" caption in nancy6
7e4c4f3287 NANCY: Improve support for nancy6 TOD dependency
8eff5a7f43 NANCY: Disable sound in nancy6 movies


Commit: 62ea6f4e2162e33423c3b597bf3c834cc2dbeb1b
    https://github.com/scummvm/scummvm/commit/62ea6f4e2162e33423c3b597bf3c834cc2dbeb1b
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-10-01T13:20:34+03:00

Commit Message:
NANCY: Implement MouseLightPuzzle

Implemented the ActionRecord type responsible for the
nancy6 sequence where the player holds a weak light
(which follows the cursor) in the dark and must use it
to illuminate the path ahead.

Changed paths:
  A engines/nancy/action/puzzle/mouselightpuzzle.cpp
  A engines/nancy/action/puzzle/mouselightpuzzle.h
    engines/nancy/action/arfactory.cpp
    engines/nancy/module.mk


diff --git a/engines/nancy/action/arfactory.cpp b/engines/nancy/action/arfactory.cpp
index 719c19fb397..7fd617dea69 100644
--- a/engines/nancy/action/arfactory.cpp
+++ b/engines/nancy/action/arfactory.cpp
@@ -33,6 +33,7 @@
 #include "engines/nancy/action/puzzle/collisionpuzzle.h"
 #include "engines/nancy/action/puzzle/leverpuzzle.h"
 #include "engines/nancy/action/puzzle/mazechasepuzzle.h"
+#include "engines/nancy/action/puzzle/mouselightpuzzle.h"
 #include "engines/nancy/action/puzzle/orderingpuzzle.h"
 #include "engines/nancy/action/puzzle/overridelockpuzzle.h"
 #include "engines/nancy/action/puzzle/passwordpuzzle.h"
@@ -256,6 +257,8 @@ ActionRecord *ActionManager::createActionRecord(uint16 type) {
 		return new MazeChasePuzzle();
 	case 216:
 		return new PeepholePuzzle();
+	case 217:
+		return new MouseLightPuzzle();
 	case 220:
 		return new TwoDialPuzzle();
 	default:
diff --git a/engines/nancy/action/puzzle/mouselightpuzzle.cpp b/engines/nancy/action/puzzle/mouselightpuzzle.cpp
new file mode 100644
index 00000000000..e8853784946
--- /dev/null
+++ b/engines/nancy/action/puzzle/mouselightpuzzle.cpp
@@ -0,0 +1,112 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "engines/nancy/nancy.h"
+#include "engines/nancy/graphics.h"
+#include "engines/nancy/resource.h"
+#include "engines/nancy/sound.h"
+#include "engines/nancy/input.h"
+#include "engines/nancy/util.h"
+
+#include "engines/nancy/state/scene.h"
+
+#include "engines/nancy/action/puzzle/mouselightpuzzle.h"
+
+namespace Nancy {
+namespace Action {
+
+void MouseLightPuzzle::init() {
+	Common::Rect screenBounds = NancySceneState.getViewport().getBounds();
+	_drawSurface.create(screenBounds.width(), screenBounds.height(), g_nancy->_graphicsManager->getInputPixelFormat());
+	_drawSurface.clear();
+	setVisible(true);
+	moveTo(screenBounds);
+
+	g_nancy->_resource->loadImage(_imageName, _baseImage);
+	
+	_mask.copyFrom(_drawSurface);
+	_maskCircle.create(_radius * 2, _radius * 2, g_nancy->_graphicsManager->getInputPixelFormat());
+	_maskCircle.clear();
+
+	if (_smoothEdges) {
+		for (int y = -_radius; y < _radius; ++y) {
+			for (int x = -_radius; x < _radius; ++x) {
+				_maskCircle.setPixel(x + _radius, y + _radius, (uint16)(expf(-(float)((y * y + x * x) * (y * y + x * x)) / (float)(_radius * _radius * _radius * _radius / 4)) * 0xFF));
+			}
+		}
+	} else {
+		for (int y = -_radius; y < _radius; ++y) {
+			for (int x = -_radius; x < _radius; ++x) {
+				if (sqrt(y * y + x * x) < _radius) {
+					_maskCircle.setPixel(x + _radius, y + _radius, 0xFF);
+				}
+			}
+		}
+	}
+}
+
+void MouseLightPuzzle::execute() {
+	if (_state == kBegin) {
+		init();
+		registerGraphics();
+		_state = kRun;
+	}
+}
+
+void MouseLightPuzzle::readData(Common::SeekableReadStream &stream) {
+	readFilename(stream, _imageName);
+	_radius = stream.readByte();
+	_smoothEdges = stream.readByte();
+}
+
+void MouseLightPuzzle::handleInput(NancyInput &input) {
+	if (_state != kRun) {
+		return;
+	}
+
+	if (_lastMousePos == input.mousePos) {
+		return;
+	}
+
+	_lastMousePos = input.mousePos;
+	_drawSurface.clear();
+	_needsRedraw = true;
+
+	Common::Rect vpScreenPos = NancySceneState.getViewport().convertViewportToScreen(_screenPosition);
+	if (!vpScreenPos.contains(input.mousePos)) {
+		return;
+	}
+
+	Common::Point blitDestPoint = input.mousePos;
+	blitDestPoint -= { vpScreenPos.left, vpScreenPos.top };
+	blitDestPoint -= { _radius, _radius };
+
+	Common::Rect srcRect = _maskCircle.getBounds();
+	Common::Rect::getBlitRect(blitDestPoint, srcRect, _drawSurface.getBounds());
+
+	_mask.clear();
+	_mask.copyRectToSurface(_maskCircle, blitDestPoint.x, blitDestPoint.y, srcRect);
+
+	_drawSurface.transBlitFrom(_baseImage, Common::Point(), _mask);
+}
+
+} // End of namespace Action
+} // End of namespace Nancy
diff --git a/engines/nancy/action/puzzle/mouselightpuzzle.h b/engines/nancy/action/puzzle/mouselightpuzzle.h
new file mode 100644
index 00000000000..195c68d1ebd
--- /dev/null
+++ b/engines/nancy/action/puzzle/mouselightpuzzle.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef NANCY_ACTION_MOUSELIGHTPUZZLE_H
+#define NANCY_ACTION_MOUSELIGHTPUZZLE_H
+
+#include "engines/nancy/action/actionrecord.h"
+
+namespace Nancy {
+namespace Action {
+
+// Shows a single image over the entire frame, with most of it blackened;
+// a circle around that follows the cursor reveals parts of the image.
+// Circle can have smooth or hard edges. Not actually a puzzle.
+class MouseLightPuzzle : public RenderActionRecord {
+public:
+	MouseLightPuzzle() : RenderActionRecord(7) {}
+	virtual ~MouseLightPuzzle() {}
+
+	void init() override;
+
+	void readData(Common::SeekableReadStream &stream) override;
+	void execute() override;
+	void handleInput(NancyInput &input) override;
+
+protected:
+	Common::String getRecordTypeName() const override { return "MouseLightPuzzle"; };
+	bool isViewportRelative() const override { return true; }
+
+	Common::String _imageName;
+	byte _radius = 0;
+	bool _smoothEdges = false;
+
+	Graphics::ManagedSurface _baseImage;
+	Graphics::ManagedSurface _maskCircle;
+	Graphics::ManagedSurface _mask;
+
+	Common::Point _lastMousePos;
+};
+
+} // End of namespace Action
+} // End of namespace Nancy
+
+#endif // NANCY_ACTION_MAZECHASEPUZZLE_H
diff --git a/engines/nancy/module.mk b/engines/nancy/module.mk
index 23ed810caaf..4206126e7d6 100644
--- a/engines/nancy/module.mk
+++ b/engines/nancy/module.mk
@@ -16,6 +16,7 @@ MODULE_OBJS = \
   action/puzzle/collisionpuzzle.o \
   action/puzzle/leverpuzzle.o \
   action/puzzle/mazechasepuzzle.o \
+  action/puzzle/mouselightpuzzle.o \
   action/puzzle/orderingpuzzle.o \
   action/puzzle/overridelockpuzzle.o \
   action/puzzle/passwordpuzzle.o \


Commit: eca40b5401a864474df3fd1539bd2ee5bf6c7a67
    https://github.com/scummvm/scummvm/commit/eca40b5401a864474df3fd1539bd2ee5bf6c7a67
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-10-01T13:20:34+03:00

Commit Message:
NANCY: Remove irrelevant output in console command

Removed a debug text line which must've been the result
of an incorrect copy-paste.

Changed paths:
    engines/nancy/console.cpp


diff --git a/engines/nancy/console.cpp b/engines/nancy/console.cpp
index fc2598e90bc..56a9c85d1f1 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -536,10 +536,9 @@ void NancyConsole::recursePrintDependencies(const Nancy::Action::DependencyRecor
 			debugPrintf("kElapsedPlayerDay");
 			break;
 		case DependencyType::kCursorType :
-			debugPrintf("kCursorType, item %u, %s, %s",
+			debugPrintf("kCursorType, item %u, %s",
 				dep.label,
-				inventoryData->itemDescriptions[dep.label].name.c_str(),
-				dep.condition == ActionManager::kCursInvHolding ? "kCursInvHolding" : "kCursInvNotHolding");
+				inventoryData->itemDescriptions[dep.label].name.c_str());
 			break;
 		case DependencyType::kPlayerTOD :
 			debugPrintf("kPlayerTOD, %s",


Commit: 206a9b328541eedea9c8c0dcef755d5e4e6a3ad5
    https://github.com/scummvm/scummvm/commit/206a9b328541eedea9c8c0dcef755d5e4e6a3ad5
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-10-01T13:20:35+03:00

Commit Message:
NANCY: Add support for nancy6 AddInventoryNoHS

nancy6 added some additional functionality to the
AddInventoryNoHS record, which is now supported.

Changed paths:
    engines/nancy/action/miscrecords.cpp
    engines/nancy/action/miscrecords.h


diff --git a/engines/nancy/action/miscrecords.cpp b/engines/nancy/action/miscrecords.cpp
index fbca13c8b77..831565cc0d3 100644
--- a/engines/nancy/action/miscrecords.cpp
+++ b/engines/nancy/action/miscrecords.cpp
@@ -359,11 +359,30 @@ void WinGame::execute() {
 
 void AddInventoryNoHS::readData(Common::SeekableReadStream &stream) {
 	_itemID = stream.readUint16LE();
+
+	if (g_nancy->getGameType() >= kGameTypeNancy6) {
+		_setCursor = stream.readUint16LE();
+		_forceCursor = stream.readUint16LE();
+	}
 }
 
 void AddInventoryNoHS::execute() {
-	if (NancySceneState.hasItem(_itemID) == g_nancy->_false) {
-		NancySceneState.addItemToInventory(_itemID);
+	if (_setCursor) {
+		if (NancySceneState.getHeldItem() != -1) {
+			// Currently holding another item
+			if (_forceCursor) {
+				NancySceneState.addItemToInventory(NancySceneState.getHeldItem());
+				NancySceneState.setHeldItem(_itemID);
+			} else {
+				NancySceneState.addItemToInventory(_itemID);
+			}
+		} else {
+			NancySceneState.setHeldItem(_itemID);
+		}
+	} else {
+		if (NancySceneState.hasItem(_itemID) == g_nancy->_false) {
+			NancySceneState.addItemToInventory(_itemID);
+		}
 	}
 
 	_isDone = true;
diff --git a/engines/nancy/action/miscrecords.h b/engines/nancy/action/miscrecords.h
index 8be01a9f8f6..00793052e20 100644
--- a/engines/nancy/action/miscrecords.h
+++ b/engines/nancy/action/miscrecords.h
@@ -283,7 +283,9 @@ public:
 	void readData(Common::SeekableReadStream &stream) override;
 	void execute() override;
 
-	uint _itemID;
+	uint16 _itemID = 0;
+	bool _setCursor = false;
+	bool _forceCursor = false;
 
 protected:
 	Common::String getRecordTypeName() const override { return "AddInventoryNoHS"; }


Commit: 4e2fc958c851c90f91c5fffbf4b3513a7e539944
    https://github.com/scummvm/scummvm/commit/4e2fc958c851c90f91c5fffbf4b3513a7e539944
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-10-01T13:20:35+03:00

Commit Message:
NANCY: Fix inventory "can't" caption in nancy6

Like many other places, it seems the captions for item
"can't" sounds can also be broken up into sub-strings.
We now assemble these correctly, which fixes the
item 4 caption in nancy6.

Changed paths:
    engines/nancy/enginedata.cpp


diff --git a/engines/nancy/enginedata.cpp b/engines/nancy/enginedata.cpp
index 5060974d897..86bbf55c555 100644
--- a/engines/nancy/enginedata.cpp
+++ b/engines/nancy/enginedata.cpp
@@ -182,18 +182,18 @@ INV::INV(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
 		if (s.getVersion() == kGameTypeNancy2) {
 			s.syncBytes(textBuf, 60);
 			textBuf[59] = '\0';
-			item.specificCantText = (char *)textBuf;
+			assembleTextLine((char *)textBuf, item.specificCantText, 60);
 
 			s.syncBytes(textBuf, 60);
 			textBuf[59] = '\0';
-			item.generalCantText = (char *)textBuf;
+			assembleTextLine((char *)textBuf, item.generalCantText, 60);
 
 			item.specificCantSound.readNormal(*chunkStream);
 			item.generalCantSound.readNormal(*chunkStream);
 		} else if (s.getVersion() >= kGameTypeNancy3) {
 			s.syncBytes(textBuf, 60);
 			textBuf[59] = '\0';
-			item.specificCantText = (char *)textBuf;
+			assembleTextLine((char *)textBuf, item.specificCantText, 60);
 
 			item.specificCantSound.readNormal(*chunkStream);
 		}


Commit: 7e4c4f3287c3ea69f44849dd136b04a82664c784
    https://github.com/scummvm/scummvm/commit/7e4c4f3287c3ea69f44849dd136b04a82664c784
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-10-01T13:30:05+03:00

Commit Message:
NANCY: Improve support for nancy6 TOD dependency

The time of day in nancy6 now depends on values for day
start and end found inside BSUM. We now correctly read
and use those.

Changed paths:
    engines/nancy/enginedata.cpp
    engines/nancy/enginedata.h
    engines/nancy/state/scene.cpp


diff --git a/engines/nancy/enginedata.cpp b/engines/nancy/enginedata.cpp
index 86bbf55c555..e223dfe283b 100644
--- a/engines/nancy/enginedata.cpp
+++ b/engines/nancy/enginedata.cpp
@@ -97,7 +97,8 @@ BSUM::BSUM(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
 
 	s.syncAsSint16LE(playerTimeMinuteLength);
 	s.syncAsUint16LE(buttonPressTimeDelay);
-	s.skip(4, kGameTypeNancy6);
+	s.syncAsUint16LE(dayStartMinutes, kGameTypeNancy6);
+	s.syncAsUint16LE(dayEndMinutes, kGameTypeNancy6);
 	s.syncAsByte(overrideMovementTimeDeltas);
 	s.syncAsSint16LE(slowMovementTimeDelta);
 	s.syncAsSint16LE(fastMovementTimeDelta);
diff --git a/engines/nancy/enginedata.h b/engines/nancy/enginedata.h
index 0b6b416cb77..ac5ddb5186b 100644
--- a/engines/nancy/enginedata.h
+++ b/engines/nancy/enginedata.h
@@ -73,6 +73,8 @@ struct BSUM : public EngineData {
 
 	uint16 playerTimeMinuteLength;
 	uint16 buttonPressTimeDelay;
+	uint16 dayStartMinutes = 0;
+	uint16 dayEndMinutes = 0;
 	byte overrideMovementTimeDeltas;
 	uint16 slowMovementTimeDelta;
 	uint16 fastMovementTimeDelta;
diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index cd0ae17ace3..2ed63f6ca0d 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -267,13 +267,25 @@ byte Scene::getPlayerTOD() const {
 		} else {
 			return kPlayerDuskDawn;
 		}
-	} else {
+	} else if (g_nancy->getGameType() <= kGameTypeNancy5) {
 		// nancy2 and up removed dusk/dawn
 		if (_timers.playerTime.getHours() >= 6 && _timers.playerTime.getHours() < 18) {
 			return kPlayerDay;
 		} else {
 			return kPlayerNight;
 		}
+	} else {
+		// nancy6 added the day start/end times (in minutes) to BSUM
+		const BSUM *bootSummary = (const BSUM *)g_nancy->getEngineData("BSUM");
+		assert(bootSummary);
+
+		uint16 minutes = _timers.playerTime.getHours() * 60 + _timers.playerTime.getMinutes();
+
+		if (minutes >= bootSummary->dayStartMinutes && minutes < bootSummary->dayEndMinutes) {
+			return kPlayerDay;
+		} else {
+			return kPlayerNight;
+		}
 	}
 }
 


Commit: 8eff5a7f433490cb88ca41332fa3c4da72195331
    https://github.com/scummvm/scummvm/commit/8eff5a7f433490cb88ca41332fa3c4da72195331
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-10-01T13:30:05+03:00

Commit Message:
NANCY: Disable sound in nancy6 movies

Changed paths:
    engines/nancy/action/secondarymovie.cpp


diff --git a/engines/nancy/action/secondarymovie.cpp b/engines/nancy/action/secondarymovie.cpp
index ae4d7d9d073..0103e948816 100644
--- a/engines/nancy/action/secondarymovie.cpp
+++ b/engines/nancy/action/secondarymovie.cpp
@@ -80,6 +80,11 @@ void PlaySecondaryMovie::readData(Common::SeekableReadStream &stream) {
 	for (uint i = 0; i < numVideoDescs; ++i) {
 		_videoDescs[i].readData(stream);
 	}
+
+	if (ser.getVersion() >= kGameTypeNancy6) {
+		// Movie sound was deliberately disabled in nancy6
+		_sound.name = "NO SOUND";
+	}
 }
 
 void PlaySecondaryMovie::init() {




More information about the Scummvm-git-logs mailing list