[Scummvm-git-logs] scummvm-tools master -> dcf34e24123cd40c04aca77415fe60d7d3c10de7

sdelamarre noreply at scummvm.org
Thu Mar 23 22:32:15 UTC 2023


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

Summary:
dcf34e2412 GOB: revert "ensure degob gives opcode offsets from their beginning"


Commit: dcf34e24123cd40c04aca77415fe60d7d3c10de7
    https://github.com/scummvm/scummvm-tools/commit/dcf34e24123cd40c04aca77415fe60d7d3c10de7
Author: Simon Delamarre (simon.delamarre14 at gmail.com)
Date: 2023-03-23T23:31:31+01:00

Commit Message:
GOB: revert "ensure degob gives opcode offsets from their beginning"

This reverts commit c48f216d7e9d9ca46afb40b6fc9a1cd3c51a1afd.

This change has been made obsolete by PR#65, which uses the beginning of the current OpcodeFunc for the displayed offset, instead of the current position when printIndent() is called.

Changed paths:
    engines/gob/degob_script.cpp
    engines/gob/degob_script.h
    engines/gob/degob_script_v1.cpp
    engines/gob/degob_script_v2.cpp
    engines/gob/degob_script_v5.cpp
    engines/gob/degob_script_v6.cpp
    engines/gob/degob_script_v7.cpp


diff --git a/engines/gob/degob_script.cpp b/engines/gob/degob_script.cpp
index 028c70fe..f93f5312 100644
--- a/engines/gob/degob_script.cpp
+++ b/engines/gob/degob_script.cpp
@@ -218,11 +218,6 @@ void Script::printIndent() const {
 	for (uint32 i = 0; i < _indent; i++)
 		putString("	");
 }
-void Script::printIndent(uint32 pos) const {
-	print("%08d:", pos);
-	for (uint32 i = 0; i < _indent; i++)
-		putString("	");
-}
 void Script::printLine(const char *str) const {
 	printIndent(); putString(str); putString("\n");
 }
diff --git a/engines/gob/degob_script.h b/engines/gob/degob_script.h
index 9f280eb5..1ce5692f 100644
--- a/engines/gob/degob_script.h
+++ b/engines/gob/degob_script.h
@@ -129,7 +129,6 @@ protected:
 	void putString(const char *s) const;
 	void print(const char *s, ...) const;
 	void printIndent() const;
-	void printIndent(uint32 pos) const;
 	void printLine(const char *s) const;
 	std::string printStr(const char *s, ...) const;
 
diff --git a/engines/gob/degob_script_v1.cpp b/engines/gob/degob_script_v1.cpp
index c8f3ea0e..cf1e82c9 100644
--- a/engines/gob/degob_script_v1.cpp
+++ b/engines/gob/degob_script_v1.cpp
@@ -741,9 +741,10 @@ void Script_v1::o1_goblinFunc(FuncParams &params) {
 }
 
 void Script_v1::o1_callSub(FuncParams &params) {
-	printIndent();
 	uint16 offset = readUint16();
 
+	printIndent();
+
 	uint32 pos = getPos();
 
 	seek(offset);
@@ -897,9 +898,9 @@ void Script_v1::o1_assign(FuncParams &params) {
 }
 
 void Script_v1::o1_palLoad(FuncParams &params) {
-	startFunc(params);
 	byte cmd = readUint8();
 
+	startFunc(params);
 	print("%d, %d", (cmd & 0x80) != 0, cmd & 0x7F);
 	endFunc();
 
@@ -1018,9 +1019,9 @@ void Script_v1::o1_loadSound(FuncParams &params) {
 }
 
 void Script_v1::o1_loadMult(FuncParams &params) {
-	startFunc(params);
 	uint16 id = readUint16();
 
+	startFunc(params);
 	print("%d", id);
 	endFunc();
 
diff --git a/engines/gob/degob_script_v2.cpp b/engines/gob/degob_script_v2.cpp
index 1e4371b0..162737c6 100644
--- a/engines/gob/degob_script_v2.cpp
+++ b/engines/gob/degob_script_v2.cpp
@@ -727,7 +727,6 @@ void Script_v2::o2_totSub(FuncParams &params) {
 }
 
 void Script_v2::o2_assign(FuncParams &params) {
-	uint32 pos = getPos();
 	uint8 type = peekUint8();
 	std::string varIndex = readVarIndex();
 
@@ -737,29 +736,22 @@ void Script_v2::o2_assign(FuncParams &params) {
 
 		for (uint16 i = 0; i < loopCount; i++) {
 			std::string expr = readExpr();
-			if (i == 0)
-				printIndent(pos);
-			else
-				printIndent();
+			printIndent();
 			print("%s[%d] = %s;\n", varIndex.c_str(), (type == 24) ? (i * 2) : i, expr.c_str());
 		}
 	} else {
 		std::string expr = readExpr();
 
-		printIndent(pos);
+		printIndent();
 		print("%s = %s;\n", varIndex.c_str(), expr.c_str());
 	}
 }
 
 void Script_v2::o2_pushVars(FuncParams &params) {
-	uint32 pos = getPos();
 	uint8 count = readUint8();
 
 	for (uint16 i = 0; i < count; i++) {
-		if (i == 0)
-			printIndent(pos);
-		else
-			printIndent();
+		printIndent();
 		if ((peekUint8() == 25) || (peekUint8() == 28)) {
 			print("push(%s, animDataSize);\n", readVarIndex().c_str());
 			skip(1);
@@ -769,14 +761,10 @@ void Script_v2::o2_pushVars(FuncParams &params) {
 }
 
 void Script_v2::o2_popVars(FuncParams &params) {
-	uint32 pos = getPos();
 	uint8 count = readUint8();
 
 	for (uint16 i = 0; i < count; i++) {
-		if (i == 0)
-			printIndent(pos);
-		else
-			printIndent();
+		printIndent();
 		print("pop(%s);\n", readVarIndex().c_str());
 	}
 }
@@ -788,7 +776,6 @@ void Script_v2::o2_loadSound(FuncParams &params) {
 void Script_v2::o2_loadMult(FuncParams &params) {
 	uint16 id;
 	bool hasImds;
-	startFunc(params);
 
 	id = readUint16();
 	if (id & 0x8000) {
@@ -796,6 +783,7 @@ void Script_v2::o2_loadMult(FuncParams &params) {
 		skip(1);
 	}
 
+	startFunc(params);
 	print("%d", id);
 	endFunc();
 
@@ -909,9 +897,9 @@ void Script_v2::o2_loadMapObjects(FuncParams &params) {
 }
 
 void Script_v2::o2_playMult(FuncParams &params) {
-	startFunc(params);
 	uint16 multData = readUint16();
 
+	startFunc(params);
 	print("%d, %d", multData >> 1, multData & 0x01);
 	endFunc();
 }
diff --git a/engines/gob/degob_script_v5.cpp b/engines/gob/degob_script_v5.cpp
index 82ffd8cf..8cf6eedd 100644
--- a/engines/gob/degob_script_v5.cpp
+++ b/engines/gob/degob_script_v5.cpp
@@ -705,9 +705,9 @@ void Script_v5::goblinOpcode(int i, FuncParams &params) {
 }
 
 void Script_v5::o5_spaceShooter(FuncParams &params) {
-	startFunc(params);
 	int16 paramCount = readUint16();
 
+	startFunc(params);
 	print("%d, ", params.extraData);
 	for (int i = 0; i < paramCount; i++) {
 		uint16 n = readUint16();
@@ -724,10 +724,10 @@ void Script_v5::o5_spaceShooter(FuncParams &params) {
 }
 
 void Script_v5::o5_istrlen(FuncParams &params) {
-	startFunc(params);
 	if (peekUint8() == 0x80)
 		skip(1);
 
+	startFunc(params);
 	print("%s, ", readVarIndex().c_str());
 	print("%s", readVarIndex().c_str());
 	endFunc();
diff --git a/engines/gob/degob_script_v6.cpp b/engines/gob/degob_script_v6.cpp
index 00ee6d91..9979b28a 100644
--- a/engines/gob/degob_script_v6.cpp
+++ b/engines/gob/degob_script_v6.cpp
@@ -705,9 +705,9 @@ void Script_v6::o6_createSprite(FuncParams &params) {
 	uint32 pos;
 
 	pos = getPos();
-	startFunc(params);
 	skip(1);
 
+	startFunc(params);
 	if (peekUint8() == 0) {
 		seek(pos);
 		print("%d, ", readUint16());
@@ -724,9 +724,9 @@ void Script_v6::o6_createSprite(FuncParams &params) {
 }
 
 void Script_v6::o6_loadCursor(FuncParams &params) {
-	startFunc(params);
 	int16 id = (int16) readUint16();
 
+	startFunc(params);
 	print("%d, ", id);
 	if (id == -1) {
 		print("%s, ", peekString());
@@ -744,7 +744,6 @@ void Script_v6::o6_loadCursor(FuncParams &params) {
 }
 
 void Script_v6::o6_assign(FuncParams &params) {
-	uint32 pos = getPos();
 	uint8 type = peekUint8();
 	uint16 var_0, var_4;
 	std::string varIndex = readVarIndex(&var_0, &var_4);
@@ -757,7 +756,7 @@ void Script_v6::o6_assign(FuncParams &params) {
 
 		varIndex2 = readVarIndex(&var_6, 0);
 
-		printIndent(pos);
+		printIndent();
 		print("memcpy(%s, %s, %d);\n", varIndex.c_str(), varIndex2.c_str(), var_6 * 4);
 
 		seek(savedPos);
@@ -775,10 +774,7 @@ void Script_v6::o6_assign(FuncParams &params) {
 			uint8 c = readUint8();
 			uint16 n = readUint16();
 
-			if (i == 0)
-				printIndent(pos);
-			else
-				printIndent();
+			printIndent();
 			print("memset(%s + %d, %d, %d);\n", varIndex.c_str(), off, c, n);
 
 			off += n;
@@ -789,16 +785,13 @@ void Script_v6::o6_assign(FuncParams &params) {
 
 		for (uint16 i = 0; i < loopCount; i++) {
 			std::string expr = readExpr();
-			if (i == 0)
-				printIndent(pos);
-			else
-				printIndent();
+			printIndent();
 			print("%s[%d] = %s;\n", varIndex.c_str(), (type == 24) ? (i * 2) : i, expr.c_str());
 		}
 	} else {
 		std::string expr = readExpr();
 
-		printIndent(pos);
+		printIndent();
 		print("%s = %s;\n", varIndex.c_str(), expr.c_str());
 	}
 }
diff --git a/engines/gob/degob_script_v7.cpp b/engines/gob/degob_script_v7.cpp
index 1c1ab069..5eb12bcc 100644
--- a/engines/gob/degob_script_v7.cpp
+++ b/engines/gob/degob_script_v7.cpp
@@ -706,9 +706,9 @@ void Script_v7::goblinOpcode(int i, FuncParams &params) {
 }
 
 void Script_v7::o7_loadCursor(FuncParams &params) {
-	startFunc(params);
-	int16 id = (int16) readUint16();
+    int16 id = (int16) readUint16();
 
+    startFunc(params);
     print("%d, ", id);
     if (id == -1) {
 	print("%s, ", peekString());




More information about the Scummvm-git-logs mailing list