[Scummvm-git-logs] scummvm master -> 1ff6239f93f3347ac9b55718d4843196546045ec

dreammaster noreply at scummvm.org
Sat Feb 3 03:53:21 UTC 2024


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:
e153f02a51 M4: Clarify method out of index sprite errors occurs in
1ff6239f93 M4: Added cell console commands


Commit: e153f02a51b4d19d6207a6918db19cb701a66d1a
    https://github.com/scummvm/scummvm/commit/e153f02a51b4d19d6207a6918db19cb701a66d1a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-02-02T19:53:13-08:00

Commit Message:
M4: Clarify method out of index sprite errors occurs in

Changed paths:
    engines/m4/wscript/ws_load.cpp


diff --git a/engines/m4/wscript/ws_load.cpp b/engines/m4/wscript/ws_load.cpp
index b0b68364278..6dabb92ae97 100644
--- a/engines/m4/wscript/ws_load.cpp
+++ b/engines/m4/wscript/ws_load.cpp
@@ -490,7 +490,7 @@ M4sprite *CreateSprite(MemHandle resourceHandle, int32 handleOffset, int32 index
 	// Check that the index into the series requested is within a valid range
 	numCels = FROM_LE_32(celsPtr[CELS_COUNT]);
 	if (index >= (int)numCels) {
-		ws_LogErrorMsg(FL, "Sprite index out of range - max index: %d, requested index: %d", numCels - 1, index);
+		ws_LogErrorMsg(FL, "CreateSprite: Sprite index out of range - max index: %d, requested index: %d", numCels - 1, index);
 		return nullptr;
 	}
 
@@ -1285,7 +1285,8 @@ int32 ws_get_sprite_width(uint32 hash, int32 index) {
 	// Check that the index into the series requested is within a valid range
 	numCels = FROM_LE_32(celsPtr[CELS_COUNT]);
 	if (index >= numCels) {
-		ws_LogErrorMsg(FL, "Sprite index out of range - max index: %d, requested index: %d", numCels - 1, index);
+		ws_LogErrorMsg(FL, "ws_get_sprite_width: Sprite index out of range - max index: %d, requested index: %d, hash: %d",
+			numCels - 1, index, hash);
 		return -1;
 	}
 
@@ -1329,7 +1330,8 @@ int32 ws_get_sprite_height(uint32 hash, int32 index) {
 	// Check that the index into the series requested is within a valid range
 	numCels = FROM_LE_32(celsPtr[CELS_COUNT]);
 	if (index >= numCels) {
-		ws_LogErrorMsg(FL, "Sprite index out of range - max index: %d, requested index: %d", numCels - 1, index);
+		ws_LogErrorMsg(FL, "ws_get_sprite_height: Sprite index out of range - max index: %d, requested index: %d, hash: %d",
+			numCels - 1, index, hash);
 		return -1;
 	}
 


Commit: 1ff6239f93f3347ac9b55718d4843196546045ec
    https://github.com/scummvm/scummvm/commit/1ff6239f93f3347ac9b55718d4843196546045ec
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-02-02T19:53:14-08:00

Commit Message:
M4: Added cell console commands

Changed paths:
    engines/m4/console.cpp
    engines/m4/console.h


diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 95091ec50e3..29a06645641 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -22,6 +22,7 @@
 #include "m4/console.h"
 #include "m4/m4.h"
 #include "m4/vars.h"
+#include "m4/graphics/graphics.h"
 
 namespace M4 {
 
@@ -31,6 +32,8 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("hyperwalk", WRAP_METHOD(Console, cmdHyperwalk));
 	registerCmd("digi",      WRAP_METHOD(Console, cmdDigi));
 	registerCmd("trigger",   WRAP_METHOD(Console, cmdTrigger));
+	registerCmd("cels",      WRAP_METHOD(Console, cmdCels));
+	registerCmd("cel",       WRAP_METHOD(Console, cmdCel));
 }
 
 bool Console::cmdTeleport(int argc, const char **argv) {
@@ -87,4 +90,43 @@ bool Console::cmdTrigger(int argc, const char **argv) {
 	}
 }
 
+bool Console::cmdCels(int argc, const char **argv) {
+	for (int i = 0; i < 256; ++i) {
+		if (_GWS(globalCELSnames)[i]) {
+			uint32 *celsPtr = (uint32 *)((intptr)*_GWS(globalCELSHandles)[i] +
+				_GWS(globalCELSoffsets)[i]);
+			debugPrintf("#%d - %s - count=%d, max w=%d, max h=%d\n",
+				i, _GWS(globalCELSnames)[i], celsPtr[CELS_COUNT],
+				celsPtr[CELS_SS_MAX_W], celsPtr[CELS_SS_MAX_H]);
+		}
+	}
+
+	return true;
+}
+
+bool Console::cmdCel(int argc, const char **argv) {
+	if (argc != 2) {
+		debugPrintf("cel <cel number>\n");
+	} else {
+		int num = atol(argv[1]);
+
+		if (!_GWS(globalCELSHandles)[num]) {
+			debugPrintf("cel index not in use\n");
+		} else {
+			uint32 *data = (uint32 *)((intptr)*_GWS(globalCELSHandles)[num] +
+				_GWS(globalCELSoffsets)[num]);
+
+			for (int i = 0; i < 15; i += 5) {
+				Common::String line = Common::String::format(
+					"%.8x %.8x %.8x %.8x %.8x",
+					data[i], data[i + 1], data[i + 2], data[i + 3], data[i + 4]
+				);
+				debugPrintf("%s\n", line.c_str());
+			}
+		}
+	}
+
+	return true;
+}
+
 } // End of namespace M4
diff --git a/engines/m4/console.h b/engines/m4/console.h
index 429a9ba73a6..dae130e4801 100644
--- a/engines/m4/console.h
+++ b/engines/m4/console.h
@@ -34,6 +34,8 @@ private:
 	bool cmdHyperwalk(int argc, const char **argv);
 	bool cmdDigi(int argc, const char **argv);
 	bool cmdTrigger(int argc, const char **argv);
+	bool cmdCels(int argc, const char **argv);
+	bool cmdCel(int argc, const char **argv);
 
 public:
 	Console();




More information about the Scummvm-git-logs mailing list