[Scummvm-git-logs] scummvm master -> 91dc8efe6b79c20099331eabdbaa6debc4631580

mduggan mgithub at guarana.org
Sun Oct 11 11:34:17 UTC 2020


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:
d59cc0802d ULTIMA8: Improve loading of Crusader shape data
91dc8efe6b ULTIMA8: Support param for unequip usecode event


Commit: d59cc0802da9c514af2c38e7cb9eb60992011ff1
    https://github.com/scummvm/scummvm/commit/d59cc0802da9c514af2c38e7cb9eb60992011ff1
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-10-11T20:31:01+09:00

Commit Message:
ULTIMA8: Improve loading of Crusader shape data

Changed paths:
    engines/ultima/ultima8/graphics/type_flags.cpp


diff --git a/engines/ultima/ultima8/graphics/type_flags.cpp b/engines/ultima/ultima8/graphics/type_flags.cpp
index dd0e338919..753e04219e 100644
--- a/engines/ultima/ultima8/graphics/type_flags.cpp
+++ b/engines/ultima/ultima8/graphics/type_flags.cpp
@@ -102,7 +102,6 @@ void TypeFlags::load(Common::SeekableReadStream *rs) {
 			if (data[5] & 0x80) si._flags |= ShapeInfo::SI_UNKNOWN47;
 
 			si._weight = data[6];
-
 			si._volume = data[7];
 
 		} else if (GAME_IS_CRUSADER) {
@@ -129,15 +128,12 @@ void TypeFlags::load(Common::SeekableReadStream *rs) {
 
 			uint32 unk2data = (data[2] >> 1) & 0xF;
 
-			// (copied from old/viewer/ShapeManager.h)
 			si._x = ((data[3] << 3) | (data[2] >> 5)) & 0x1F;
 			si._y = (data[3] >> 2) & 0x1F;
 			si._z = ((data[4] << 1) | (data[3] >> 7)) & 0x1F;
 
-			si._unknown = (unk2data << 24) + (((data[4] & 0xF0) << 16) | (data[5] << 8) | data[8]);
-
-			// This seems to be how it's used..
-			si._weight = data[7];
+			// Left over bits we're not sure what to do with yet..
+			si._unknown = (unk2data << 16) | (((data[4] & 0xF0) << 8) | data[5]);
 
 			if (data[6] & 0x01) si._flags |= ShapeInfo::SI_EDITOR;
 			if (data[6] & 0x02) si._flags |= ShapeInfo::SI_SELECTABLE;
@@ -148,6 +144,9 @@ void TypeFlags::load(Common::SeekableReadStream *rs) {
 			if (data[6] & 0x40) si._flags |= ShapeInfo::SI_CRUSUNK66;
 			if (data[6] & 0x80) si._flags |= ShapeInfo::SI_CRUSUNK67;
 
+			si._weight = data[7];
+			si._volume = data[8];
+
 			// FIXME: this is not exactly right, but it is close and at
 			// least it animates the main items that need
 			// continuously animating
@@ -157,7 +156,8 @@ void TypeFlags::load(Common::SeekableReadStream *rs) {
 				// reactor) has this type what should it do?
 				si._animType = 1;
 			}
-
+		} else {
+			error("unknown game type in type flags");
 		}
 
 		si._weaponInfo = nullptr;


Commit: 91dc8efe6b79c20099331eabdbaa6debc4631580
    https://github.com/scummvm/scummvm/commit/91dc8efe6b79c20099331eabdbaa6debc4631580
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-10-11T20:32:55+09:00

Commit Message:
ULTIMA8: Support param for unequip usecode event

Changed paths:
    engines/ultima/ultima8/world/item.cpp
    engines/ultima/ultima8/world/item.h


diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index dbb5706f48..bcd2fb89fe 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -1398,6 +1398,12 @@ uint32 Item::callUsecodeEvent_unequip() {                       // event B
 	return callUsecodeEvent(0xB); // CONSTANT
 }
 
+uint32 Item::callUsecodeEvent_unequipWithParam(ObjId param) {   // event B
+	DynamicUCStack  arg_stack(2);
+	arg_stack.push2(param);
+	return callUsecodeEvent(0xB, arg_stack.access(), 2);
+}
+
 uint32 Item::callUsecodeEvent_combine() {                       // event C
 	return callUsecodeEvent(0xC);   // CONSTANT
 }
@@ -2725,25 +2731,32 @@ uint32 Item::I_use(const uint8 *args, unsigned int /*argsize*/) {
 uint32 Item::I_gotHit(const uint8 *args, unsigned int /*argsize*/) {
 	ARG_ITEM_FROM_PTR(item);
 	ARG_UINT16(hitter);
-	ARG_SINT16(unk);
+	ARG_SINT16(force);
 	if (!item) return 0;
 
-	return item->callUsecodeEvent_gotHit(hitter, unk);
+	return item->callUsecodeEvent_gotHit(hitter, force);
 }
 
-uint32 Item::I_equip(const uint8 *args, unsigned int /*argsize*/) {
+uint32 Item::I_equip(const uint8 *args, unsigned int argsize) {
 	ARG_ITEM_FROM_PTR(item);
-	ARG_UINT16(unk);
 	if (!item) return 0;
 
-	return item->callUsecodeEvent_equipWithParam(unk);
+	// Note: The U8 version (no param) is never actually called in the usecode.
+	assert(argsize > 4);
+
+	ARG_UINT16(val);
+	return item->callUsecodeEvent_equipWithParam(val);
 }
 
-uint32 Item::I_unequip(const uint8 *args, unsigned int /*argsize*/) {
+uint32 Item::I_unequip(const uint8 *args, unsigned int argsize) {
 	ARG_ITEM_FROM_PTR(item);
 	if (!item) return 0;
 
-	return item->callUsecodeEvent_unequip();
+	// Note: The U8 version (no param) is never actually called in the usecode.
+	assert(argsize > 4);
+
+	ARG_UINT16(val)
+	return item->callUsecodeEvent_unequipWithParam(val);
 }
 
 uint32 Item::I_enterFastArea(const uint8 *args, unsigned int /*argsize*/) {
diff --git a/engines/ultima/ultima8/world/item.h b/engines/ultima/ultima8/world/item.h
index c69a1c218c..000dc1e65d 100644
--- a/engines/ultima/ultima8/world/item.h
+++ b/engines/ultima/ultima8/world/item.h
@@ -428,6 +428,7 @@ public:
 	uint32 callUsecodeEvent_equip();                            // event A
 	uint32 callUsecodeEvent_equipWithParam(ObjId param);        // event A
 	uint32 callUsecodeEvent_unequip();                          // event B
+	uint32 callUsecodeEvent_unequipWithParam(ObjId param);      // event B
 	uint32 callUsecodeEvent_combine();                          // event C
 	uint32 callUsecodeEvent_calledFromAnim();                   // event E
 	uint32 callUsecodeEvent_enterFastArea();                    // event F




More information about the Scummvm-git-logs mailing list