[Scummvm-git-logs] scummvm master -> 6200935007b9df5f14c529dd3197041cf72d5430

mduggan mgithub at guarana.org
Sun Dec 27 11:11:57 UTC 2020


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

Summary:
8c41551d60 ULTIMA8: const correctness
4ad5bf8b5b ULTIMA8: Add Cruasder shield pickup handling
6200935007 ICB: Fix most of the remaining int/int32 confusions


Commit: 8c41551d60ef56fcb2b2f063f95c3aa7d7bb5ca1
    https://github.com/scummvm/scummvm/commit/8c41551d60ef56fcb2b2f063f95c3aa7d7bb5ca1
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-12-27T19:32:28+09:00

Commit Message:
ULTIMA8: const correctness

Changed paths:
    engines/ultima/ultima8/gumps/cru_pickup_gump.cpp
    engines/ultima/ultima8/gumps/cru_pickup_gump.h


diff --git a/engines/ultima/ultima8/gumps/cru_pickup_gump.cpp b/engines/ultima/ultima8/gumps/cru_pickup_gump.cpp
index 789fb43607..3919101e46 100644
--- a/engines/ultima/ultima8/gumps/cru_pickup_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_pickup_gump.cpp
@@ -47,7 +47,7 @@ CruPickupGump::CruPickupGump() : Gump(), _startFrame(0), _itemShapeNo(0), _q(0),
 	_gumpShapeNo(0), _gumpFrameNo(0) {
 }
 
-CruPickupGump::CruPickupGump(Item *item, int y, uint16 currentq) : Gump(0, y, 5, 5, 0), _startFrame(0) {
+CruPickupGump::CruPickupGump(const Item *item, int y, uint16 currentq) : Gump(0, y, 5, 5, 0), _startFrame(0) {
 	const WeaponInfo *weaponInfo = item->getShapeInfo()->_weaponInfo;
 	if (weaponInfo) {
 		_itemShapeNo = item->getShape();
diff --git a/engines/ultima/ultima8/gumps/cru_pickup_gump.h b/engines/ultima/ultima8/gumps/cru_pickup_gump.h
index c49d4120bd..db27debdf9 100644
--- a/engines/ultima/ultima8/gumps/cru_pickup_gump.h
+++ b/engines/ultima/ultima8/gumps/cru_pickup_gump.h
@@ -41,7 +41,7 @@ public:
 	CruPickupGump();
 	//! Create a new gump for an item pickup. CurrentQ is the value of an existing gump
 	//! so they can be combined (eg, pick up one medikit then another -> show medikit 2)
-	CruPickupGump(Item *item, int y, uint16 currentq);
+	CruPickupGump(const Item *item, int y, uint16 currentq);
 	~CruPickupGump() override;
 
 	// Init the gump, call after construction


Commit: 4ad5bf8b5b3ea589399ff5e3dcfd3336e9165379
    https://github.com/scummvm/scummvm/commit/4ad5bf8b5b3ea589399ff5e3dcfd3336e9165379
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-12-27T19:32:57+09:00

Commit Message:
ULTIMA8: Add Cruasder shield pickup handling

Changed paths:
    engines/ultima/ultima8/world/actors/main_actor.cpp


diff --git a/engines/ultima/ultima8/world/actors/main_actor.cpp b/engines/ultima/ultima8/world/actors/main_actor.cpp
index 3e20a54b3b..8c2ec89785 100644
--- a/engines/ultima/ultima8/world/actors/main_actor.cpp
+++ b/engines/ultima/ultima8/world/actors/main_actor.cpp
@@ -254,8 +254,26 @@ int16 MainActor::addItemCru(Item *item, bool showtoast) {
 			Item *existing = getFirstItemWithShape(shapeno, true);
 			if (!existing) {
 				if ((shapeno == 0x52e) || (shapeno == 0x52f) || (shapeno == 0x530)) {
-					warning("TODO: Properly handle giving avatar a shield 0x%x", shapeno);
-					return 0;
+					int shieldtype;
+					switch (shapeno) {
+						default:
+						case 0x52e:
+							shieldtype = 1;
+							break;
+						case 0x52f:
+							shieldtype = 2;
+							break;
+						case 0x530:
+							shieldtype = 3;
+							break;
+					}
+					if (_shieldType < shieldtype) {
+						_shieldType = shieldtype;
+					}
+					if (showtoast)
+						pickupArea->addPickup(item);
+					item->destroy();
+					return 1;
 				} else {
 					item->setFrame(0);
 					item->setQuality(1);


Commit: 6200935007b9df5f14c529dd3197041cf72d5430
    https://github.com/scummvm/scummvm/commit/6200935007b9df5f14c529dd3197041cf72d5430
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-12-27T20:10:11+09:00

Commit Message:
ICB: Fix most of the remaining int/int32 confusions

Changed paths:
    engines/icb/common/datapacker.cpp
    engines/icb/common/datapacker.h
    engines/icb/function.cpp
    engines/icb/icon_menu.cpp
    engines/icb/icon_menu.h
    engines/icb/map_marker_pc.cpp
    engines/icb/res_man.cpp
    engines/icb/res_man.h
    engines/icb/sound/fx_manager.cpp
    engines/icb/surface_manager.cpp


diff --git a/engines/icb/common/datapacker.cpp b/engines/icb/common/datapacker.cpp
index ca3570a64a..231d5766e5 100644
--- a/engines/icb/common/datapacker.cpp
+++ b/engines/icb/common/datapacker.cpp
@@ -165,7 +165,7 @@ DataPacker::ReturnCodes DataPacker::put(const int value, Common::WriteStream *st
 }
 
 // Get a value from the bit-stream
-DataPacker::ReturnCodes DataPacker::Get(int &value, Common::SeekableReadStream *stream) {
+DataPacker::ReturnCodes DataPacker::Get(int32 &value, Common::SeekableReadStream *stream) {
 	if (iMode != READ) {
 		return BAD_MODE;
 	}
@@ -209,7 +209,7 @@ DataPacker::ReturnCodes DataPacker::Get(int &value, Common::SeekableReadStream *
 		pos = 0;
 	}
 
-	int v = 0;
+	int32 v = 0;
 	// Get the value out of the buffer
 	if (pos == 0) {
 		v = (buffer[0] << 6);  // v's top 8-bits
diff --git a/engines/icb/common/datapacker.h b/engines/icb/common/datapacker.h
index aaad4519d7..e7d88934d7 100644
--- a/engines/icb/common/datapacker.h
+++ b/engines/icb/common/datapacker.h
@@ -61,7 +61,7 @@ public:
 	ReturnCodes put(const int value, Common::WriteStream *fh);
 
 	// Get a value from the bit-stream
-	ReturnCodes Get(int &value, Common::SeekableReadStream *stream);
+	ReturnCodes Get(int32 &value, Common::SeekableReadStream *stream);
 
 	// Stop the bit-packing process : will output any remaining data
 	ReturnCodes close(Common::WriteStream *stream);
diff --git a/engines/icb/function.cpp b/engines/icb/function.cpp
index 783b948ef0..e2aed2550c 100644
--- a/engines/icb/function.cpp
+++ b/engines/icb/function.cpp
@@ -793,7 +793,7 @@ mcodeFunctionReturnCodes _game_session::fn_call_socket(int32 &result, int32 *par
 	//	params   0       ascii name of target object
 	//				1     ascii name of socket script
 
-	int32 retval;
+	int retval;
 	uint32 script_hash;
 
 	const char *target_object_name = (const char *)MemoryUtil::resolvePtr(params[0]);
@@ -895,8 +895,12 @@ bool8 _game_session::Call_socket(uint32 id, const char *script, int32 *retval) {
 			// get the address of the script we want to run
 			const char *pc = (const char *)scripts->Try_fetch_item_by_hash(socket_object->GetScriptNameFullHash(k));
 
+			int result = static_cast<int>(*retval);
+
 			// run the script - pass its object so vars can be accessed
-			RunScript(pc, socket_object, retval);
+			RunScript(pc, socket_object, &result);
+
+			*retval = result;
 
 			return (TRUE8);
 		}
diff --git a/engines/icb/icon_menu.cpp b/engines/icb/icon_menu.cpp
index 524100666a..e05cc47a4c 100644
--- a/engines/icb/icon_menu.cpp
+++ b/engines/icb/icon_menu.cpp
@@ -368,7 +368,7 @@ bool8 _icon_menu::IsAdding() const {
 // Scroll the icons smoothly left or right
 // This returns the x-position to start drawing the icons from (nX)
 // it also sets the first icon to start drawing (nIconIndex)
-int _icon_menu::GetScrollingPosition(const int nInputX, uint &nIconIndex) {
+int _icon_menu::GetScrollingPosition(const int nInputX, uint32 &nIconIndex) {
 	int nX = nInputX;
 
 	// OK are we scrolling
diff --git a/engines/icb/icon_menu.h b/engines/icb/icon_menu.h
index c8321d63c0..804046f17c 100644
--- a/engines/icb/icon_menu.h
+++ b/engines/icb/icon_menu.h
@@ -146,7 +146,7 @@ public:
 	void PreloadIcon(const char *pcIconPath, const char *pcIconName);
 
       private:
-	int GetScrollingPosition(const int nInputX, uint &nIconIndex);
+	int GetScrollingPosition(const int nInputX, uint32 &nIconIndex);
 
 	enum IconMenuGameState { INACTIVE = 0, ACTIVE };
 
diff --git a/engines/icb/map_marker_pc.cpp b/engines/icb/map_marker_pc.cpp
index e376b85822..62756473a3 100644
--- a/engines/icb/map_marker_pc.cpp
+++ b/engines/icb/map_marker_pc.cpp
@@ -61,7 +61,7 @@ void _marker::Write_markers() {
 void _marker::___init() {
 	// read in the session markers file - this is the engine written file not the max Nico file
 	// read data into a structure as it needs to be modifiable and saveable which isnt posible with res_man files
-	int len;
+	int32 len;
 
 	Zdebug("\n\n\n-------------*** Init marker file ***-------------");
 
diff --git a/engines/icb/res_man.cpp b/engines/icb/res_man.cpp
index 96b9b89ff8..3538ebf80c 100644
--- a/engines/icb/res_man.cpp
+++ b/engines/icb/res_man.cpp
@@ -335,7 +335,7 @@ uint32 res_man::Fetch_old_memory(int number_of_cycles) {
 // is computed and stored in hash/cluster_hash
 uint8 *res_man::Res_open(const char *url, uint32 &url_hash, const char *cluster, uint32 &cluster_hash,
                          int compressed, // non zero if the resource is compressed
-                         int *ret_len) {
+                         int32 *ret_len) {
 	// make the hash names if we need to
 	MakeHash(url, url_hash);
 	MakeHash(cluster, cluster_hash);
@@ -705,7 +705,7 @@ uint32 res_man::Check_file_size(const char *url, uint32 url_hash, const char *cl
 	return (0);
 }
 
-uint8 *res_man::Internal_open(RMParams *params, int *ret_len) {
+uint8 *res_man::Internal_open(RMParams *params, int32 *ret_len) {
 	// Loads if not in memory here already
 
 	// resoures cannot be locked in memory
diff --git a/engines/icb/res_man.h b/engines/icb/res_man.h
index 1799a5128c..111ff79fa5 100644
--- a/engines/icb/res_man.h
+++ b/engines/icb/res_man.h
@@ -169,7 +169,7 @@ public:
 	// is computed and stored in hash/cluster_hash
 	uint8 *Res_open(const char *url, uint32 &url_hash, const char *cluster_url, uint32 &cluster_hash,
 	                int compressed = 0, // non zero if the resource is compressed
-	                int *ret_len = NULL);
+	                int32 *ret_len = NULL);
 	// If hash or cluster_hash == NULL_HASH then the hash of url/cluster_url
 	// is computed and stored in hash/cluster_hash
 	uint8 *Res_async_open(const char *url,
@@ -231,7 +231,7 @@ public:
 
 	void Initialise(uint32 memory_tot, uint32 threadFlag);
 
-	uint8 *Internal_open(RMParams *params, int *ret_len = NULL);
+	uint8 *Internal_open(RMParams *params, int32 *ret_len = NULL);
 
 	uint8 *LoadFile(int32 &cluster_search, RMParams *params);
 
diff --git a/engines/icb/sound/fx_manager.cpp b/engines/icb/sound/fx_manager.cpp
index 1dd8c251ee..9af97eedce 100644
--- a/engines/icb/sound/fx_manager.cpp
+++ b/engines/icb/sound/fx_manager.cpp
@@ -296,7 +296,7 @@ int FxManager::GetDefaultRateByName(const char * /*name*/, uint32 byteOffsetInCl
 
 bool8 FxManager::Load(int id, const char * /*name*/, uint32 byteOffsetInCluster) { // TODO: Verify that we are not leaking
 	_wavHeader header;
-	unsigned int length;
+	uint32 length;
 	int lengthInCycles;
 
 	// Open the cluster file and seek to the start of the sample
diff --git a/engines/icb/surface_manager.cpp b/engines/icb/surface_manager.cpp
index 0b4f0e7c9f..61621a16f7 100644
--- a/engines/icb/surface_manager.cpp
+++ b/engines/icb/surface_manager.cpp
@@ -188,7 +188,7 @@ _surface_manager::~_surface_manager() {
 	Zdebug("*SURFACE_MANAGER* Surface Manager Destroyed");
 }
 
-unsigned int _surface_manager::Init_direct_draw() {
+uint32 _surface_manager::Init_direct_draw() {
 	// Debug info
 	Zdebug("*SURFACE_MANAGER* Initalizing the SDL video interface");
 




More information about the Scummvm-git-logs mailing list