[Scummvm-git-logs] scummvm master -> 9cdd15f9859d2635de3f528ebfa6b272f97cce5c

mduggan mgithub at guarana.org
Wed Feb 24 12:19:54 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:
9cdd15f985 ULTIMA8: Allow stacking of fire reagents.


Commit: 9cdd15f9859d2635de3f528ebfa6b272f97cce5c
    https://github.com/scummvm/scummvm/commit/9cdd15f9859d2635de3f528ebfa6b272f97cce5c
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-02-24T21:16:21+09:00

Commit Message:
ULTIMA8: Allow stacking of fire reagents.

Also limit stacks to 666 items. Both to better match original game behavior.
Fixes bug #12183.

Changed paths:
    engines/ultima/ultima8/gumps/container_gump.cpp
    engines/ultima/ultima8/world/item.cpp


diff --git a/engines/ultima/ultima8/gumps/container_gump.cpp b/engines/ultima/ultima8/gumps/container_gump.cpp
index 2994aea5b1..f4ca09337e 100644
--- a/engines/ultima/ultima8/gumps/container_gump.cpp
+++ b/engines/ultima/ultima8/gumps/container_gump.cpp
@@ -490,12 +490,19 @@ void ContainerGump::DropItem(Item *item, int mx, int my) {
 	if (targetitem && item->getShapeInfo()->hasQuantity()) {
 		// try to combine items
 		if (item->canMergeWith(targetitem)) {
-			targetitem->setQuality(targetitem->getQuality() +
-			                       item->getQuality());
-			targetitem->callUsecodeEvent_combine();
-
-			// combined, so delete item
-			item->destroy();
+			uint16 newquant = targetitem->getQuality() + item->getQuality();
+			// easter egg as in original: items stack to max quantity of 666
+			if (newquant > 666) {
+				item->setQuality(newquant - 666);
+				targetitem->setQuality(666);
+				// maybe this isn't needed? original doesn't do it here..
+				targetitem->callUsecodeEvent_combine();
+			} else {
+				item->setQuality(newquant);
+				targetitem->callUsecodeEvent_combine();
+				// combined, so delete other
+				item->destroy();
+			}
 			return;
 		}
 	}
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index f7c27236e4..bcf68dd903 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -2366,15 +2366,17 @@ bool Item::canMergeWith(Item *other) {
 	// 		ex.hood: frame 10-12
 	// 		blackmoor: frame 14-15
 	// 		dead man's elbow: frame 16-20
-	// sorcery reagents (shape 398).
-	// Disabled because the usecode doesn't support saying how many there are.
+	// sorcery reagents (shape 398)
 	//		volcanic ash: frame 0-1
 	//		pumice: frame 2-5
 	//		obsidian: 6-9
 	//		iron: 10-13
 	//		brimstone: 14-17
 	// 		daemon bones: 18-20
-	// 3. ether reagents (shape 399) (also not supported in usecode)
+	// ether reagents (shape 399)
+	//      only one frame per type, no special case needed
+	// Note: necromancy reagents are special-cased to be plural in their look()
+	// function, but the sorcery ones aren't, but the original game is the same.
 	//
 	if (GAME_IS_U8) {
 		if (getShape() == 395) {
@@ -2389,7 +2391,7 @@ bool Item::canMergeWith(Item *other) {
 			if (bothInRange(frame1, frame2, 16, 20))
 				return true;
 		}
-		/*if (getShape() == 398) {
+		if (getShape() == 398) {
 			if (bothInRange(frame1, frame2, 0, 1))
 				return true;
 			if (bothInRange(frame1, frame2, 2, 5))
@@ -2402,7 +2404,7 @@ bool Item::canMergeWith(Item *other) {
 				return true;
 			if (bothInRange(frame1, frame2, 18, 20))
 				return true;
-		}*/
+		}
 	}
 	return false;
 }




More information about the Scummvm-git-logs mailing list