[Scummvm-git-logs] scummvm master -> bb949430b621bb10f0c401a6d667ed6397e0e66f

fracturehill noreply at scummvm.org
Thu Aug 10 22:39:10 UTC 2023


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:
a6e5c8c83a NANCY: Implement nancy3 object use flags
bb949430b6 NANCY: Fix MSVC build error


Commit: a6e5c8c83a41b0aa0245b048b07b3b0cb4e87c39
    https://github.com/scummvm/scummvm/commit/a6e5c8c83a41b0aa0245b048b07b3b0cb4e87c39
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-08-11T01:02:10+03:00

Commit Message:
NANCY: Implement nancy3 object use flags

nancy3 changed the way the kKeepAlways inventory flag
worked, and added a third flag with the old behavior. As
a result of this change, the suitcase key in nancy3 no longer
disappears after being used.

Changed paths:
    engines/nancy/action/actionmanager.cpp
    engines/nancy/console.cpp


diff --git a/engines/nancy/action/actionmanager.cpp b/engines/nancy/action/actionmanager.cpp
index be3418cd481..3934cbf68d0 100644
--- a/engines/nancy/action/actionmanager.cpp
+++ b/engines/nancy/action/actionmanager.cpp
@@ -77,11 +77,22 @@ void ActionManager::handleInput(NancyInput &input) {
 
 						// Re-add the object to the inventory unless it's marked as a one-time use
 						if (item == NancySceneState.getHeldItem() && item != -1) {
-							if (g_nancy->_inventoryData->itemDescriptions[item].keepItem == kInvItemKeepAlways) {
+							switch (g_nancy->_inventoryData->itemDescriptions[item].keepItem) {
+							case kInvItemKeepAlways :
+								if (g_nancy->getGameType() >= kGameTypeNancy3) {
+									// In nancy3 and up this means the object remains in hand, so do nothing
+									// Older games had the kInvItemReturn behavior instead
+									break;
+								}
+
+								// fall through
+							case kInvItemReturn :
 								NancySceneState.addItemToInventory(item);
+								// fall through
+							case kInvItemUseThenLose :
+								NancySceneState.setHeldItem(-1);
+								break;
 							}
-
-							NancySceneState.setHeldItem(-1);
 						}
 
 						rec->_cursorDependency = nullptr;
diff --git a/engines/nancy/console.cpp b/engines/nancy/console.cpp
index 58ed01fc5ae..9d94e08ecdd 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -727,14 +727,16 @@ bool NancyConsole::Cmd_getInventory(int argc, const char **argv) {
 
 	if (argc == 1) {
 		for (uint i = 0; i < numItems; ++i) {
+			byte keep = g_nancy->_inventoryData->itemDescriptions[i].keepItem;
 			debugPrintf("\nItem %u, %s, %s, %s",
 				i,
 				g_nancy->_inventoryData->itemDescriptions[i].name.c_str(),
-				g_nancy->_inventoryData->itemDescriptions[i].keepItem == 0 ? "UseThenLose" : "KeepAlways",
+				keep == 0 ? "UseThenLose" : keep == 1 ? "KeepAlways" : "ReturnToInventory",
 				NancySceneState.hasItem(i) == g_nancy->_true ? "true" : "false");
 		}
 	} else {
 		for (int i = 1; i < argc; ++i) {
+			byte keep = g_nancy->_inventoryData->itemDescriptions[i].keepItem;
 			int flagID = atoi(argv[i]);
 			if (flagID < 0 || flagID >= (int)numItems) {
 				debugPrintf("\nInvalid flag %s", argv[i]);
@@ -743,7 +745,7 @@ bool NancyConsole::Cmd_getInventory(int argc, const char **argv) {
 			debugPrintf("\nItem %u, %s, %s, %s",
 				flagID,
 				g_nancy->_inventoryData->itemDescriptions[flagID].name.c_str(),
-				g_nancy->_inventoryData->itemDescriptions[i].keepItem == 0 ? "UseThenLose" : "KeepAlways",
+				keep == 0 ? "UseThenLose" : keep == 1 ? "KeepAlways" : "ReturnToInventory",
 				NancySceneState.hasItem(i) == g_nancy->_true ? "true" : "false");
 
 		}


Commit: bb949430b621bb10f0c401a6d667ed6397e0e66f
    https://github.com/scummvm/scummvm/commit/bb949430b621bb10f0c401a6d667ed6397e0e66f
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-08-11T01:38:59+03:00

Commit Message:
NANCY: Fix MSVC build error

Changed paths:
    engines/nancy/commontypes.cpp


diff --git a/engines/nancy/commontypes.cpp b/engines/nancy/commontypes.cpp
index 9332ff37cd1..65ccbe49ef7 100644
--- a/engines/nancy/commontypes.cpp
+++ b/engines/nancy/commontypes.cpp
@@ -276,8 +276,8 @@ void SoundChannelInfo::readData(Common::SeekableReadStream &stream) {
 }
 
 void StaticData::readData(Common::SeekableReadStream &stream, Common::Language language, uint32 endPos) {
-	uint16 num;
-	int languageID;
+	uint16 num = 0;
+	int languageID = -1;
 
 	while (stream.pos() < endPos) {
 		uint32 nextSectionOffset = stream.readUint32LE();




More information about the Scummvm-git-logs mailing list