[Scummvm-git-logs] scummvm-tools master -> 27d0a70ebf29d228e888f8055bb8f2143408cd1e

sev- noreply at scummvm.org
Sun Oct 23 07:59:36 UTC 2022


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

Summary:
ffc3808182 SCUMM: fix string concatenation
17b859357e SCUMM: add missing semicolon
ecd9979544 SCUMM: remove wrong semicolon / fix evaluation order
27d0a70ebf SCUMM: remove inconsistent space


Commit: ffc38081820e10dd5f46824c875c382cd2618f11
    https://github.com/scummvm/scummvm-tools/commit/ffc38081820e10dd5f46824c875c382cd2618f11
Author: Oliver Siegmar (oliver at siegmar.de)
Date: 2022-10-23T09:59:32+02:00

Commit Message:
SCUMM: fix string concatenation

change this:

Text(getString(VAR_HEAPSPACE)keepText())

into this:

Text(getString(VAR_HEAPSPACE) + keepText())

Changed paths:
    engines/scumm/descumm-common.cpp


diff --git a/engines/scumm/descumm-common.cpp b/engines/scumm/descumm-common.cpp
index 65eb1c22..2e6757ce 100644
--- a/engines/scumm/descumm-common.cpp
+++ b/engines/scumm/descumm-common.cpp
@@ -264,17 +264,21 @@ extern char *get_var6(char *buf);
 char *get_string(char *buf) {
 	byte cmd;
 	char *e = buf;
+	bool first = true;
 	bool in = false;
-	bool in_function = false;
 	int i;
 
 	while ((cmd = get_byte()) != 0) {
 		if (cmd == 0xFF || cmd == 0xFE) {
 			if (in) {
-				e += sprintf(e, "\" + ");
+				e += sprintf(e, "\"");
 				in = false;
 			}
-			in_function = true;
+			if (first) {
+				first = false;
+			} else {
+				e += sprintf(e, " + ");
+			}
 			i = get_byte();
 			switch (i) {
 			case 1: // newline
@@ -350,11 +354,12 @@ char *get_string(char *buf) {
 				e += sprintf(e, "unknown%d(%d)", i, get_word());
 			}
 		} else {
-			if (in_function) {
-				e += sprintf(e, " + ");
-				in_function = false;
-			}
 			if (!in) {
+				if (first) {
+					first = false;
+				} else {
+					e += sprintf(e, " + ");
+				}
 				*e++ = '"';
 				in = true;
 			}


Commit: 17b859357e093c32da01af1c9f6019f7144e5540
    https://github.com/scummvm/scummvm-tools/commit/17b859357e093c32da01af1c9f6019f7144e5540
Author: Oliver Siegmar (oliver at siegmar.de)
Date: 2022-10-23T09:59:32+02:00

Commit Message:
SCUMM: add missing semicolon

Changed paths:
    engines/scumm/descumm.cpp


diff --git a/engines/scumm/descumm.cpp b/engines/scumm/descumm.cpp
index 4c23fd4e..e71677bd 100644
--- a/engines/scumm/descumm.cpp
+++ b/engines/scumm/descumm.cpp
@@ -1194,7 +1194,7 @@ void do_room_ops_old(char *buf, byte opcode) {
 		buf = strecpy(buf, a);
 		buf = strecpy(buf, ",");
 		buf = strecpy(buf, b);
-		buf = strecpy(buf, ")");
+		buf = strecpy(buf, ");");
 		break;
 	case 0x02:
 		if (g_options.scriptVersion > 3) {
@@ -1205,7 +1205,7 @@ void do_room_ops_old(char *buf, byte opcode) {
 		buf = strecpy(buf, a);
 		buf = strecpy(buf, ",");
 		buf = strecpy(buf, b);
-		buf = strecpy(buf, ")");
+		buf = strecpy(buf, ");");
 		break;
 	case 0x03:
 		if (g_options.scriptVersion > 3) {
@@ -1216,7 +1216,7 @@ void do_room_ops_old(char *buf, byte opcode) {
 		buf = strecpy(buf, a);
 		buf = strecpy(buf, ",");
 		buf = strecpy(buf, b);
-		buf = strecpy(buf, ")");
+		buf = strecpy(buf, ");");
 		break;
 	case 0x04:
 		if (g_options.scriptVersion > 3) {
@@ -1227,7 +1227,7 @@ void do_room_ops_old(char *buf, byte opcode) {
 		buf = strecpy(buf, a);
 		buf = strecpy(buf, ",");
 		buf = strecpy(buf, b);
-		buf = strecpy(buf, ")");
+		buf = strecpy(buf, ");");
 		break;
 	case 0x05:
 		do_tok(buf, "ShakeOn", 0);


Commit: ecd99795448f0fef9b61be62f5df23180ac87b16
    https://github.com/scummvm/scummvm-tools/commit/ecd99795448f0fef9b61be62f5df23180ac87b16
Author: Oliver Siegmar (oliver at siegmar.de)
Date: 2022-10-23T09:59:32+02:00

Commit Message:
SCUMM: remove wrong semicolon / fix evaluation order

fixes situations like this:

VerbOps(Var[100],[SetXY(16,Var[228]),SetToString(24),On(),Key(Var[229]);]);
-----------------------------------------------------------------------^

Changed paths:
    engines/scumm/descumm.cpp


diff --git a/engines/scumm/descumm.cpp b/engines/scumm/descumm.cpp
index e71677bd..a7753d6d 100644
--- a/engines/scumm/descumm.cpp
+++ b/engines/scumm/descumm.cpp
@@ -1328,16 +1328,16 @@ void do_verbops(char *buf, byte opcode) {
 		first = 0;
 		switch (opcode & 0x1F) {
 		case 0x1:
-			buf = do_tok(buf, "Image", (opcode & 0x80) ? A1V : A1W | ANOENDSEMICOLON);
+			buf = do_tok(buf, "Image", ((opcode & 0x80) ? A1V : A1W) | ANOENDSEMICOLON);
 			break;
 		case 0x2:
 			buf = do_tok(buf, "Text", A1ASCII | ANOENDSEMICOLON);
 			break;
 		case 0x3:
-			buf = do_tok(buf, "Color", (opcode & 0x80) ? A1V : A1B | ANOENDSEMICOLON);
+			buf = do_tok(buf, "Color", ((opcode & 0x80) ? A1V : A1B) | ANOENDSEMICOLON);
 			break;
 		case 0x4:
-			buf = do_tok(buf, "HiColor", (opcode & 0x80) ? A1V : A1B | ANOENDSEMICOLON);
+			buf = do_tok(buf, "HiColor", ((opcode & 0x80) ? A1V : A1B) | ANOENDSEMICOLON);
 			break;
 		case 0x5:
 			buf = do_tok(buf, "SetXY", ((opcode & 0x80) ? A1V : A1W) | ((opcode & 0x40) ? A2V : A2W) | ANOENDSEMICOLON);
@@ -1355,26 +1355,26 @@ void do_verbops(char *buf, byte opcode) {
 			buf = do_tok(buf, "New", ANOENDSEMICOLON);
 			break;
 		case 0x10:
-			buf = do_tok(buf, "DimColor", (opcode & 0x80) ? A1V : A1B | ANOENDSEMICOLON);
+			buf = do_tok(buf, "DimColor", ((opcode & 0x80) ? A1V : A1B) | ANOENDSEMICOLON);
 			break;
 		case 0x11:
 			buf = do_tok(buf, "Dim", ANOENDSEMICOLON);
 			break;
 		case 0x12:
-			buf = do_tok(buf, "Key", (opcode & 0x80) ? A1V : A1B | ANOENDSEMICOLON);
+			buf = do_tok(buf, "Key", ((opcode & 0x80) ? A1V : A1B) | ANOENDSEMICOLON);
 			break;
 		case 0x13:
 			buf = do_tok(buf, "Center", ANOENDSEMICOLON);
 			break;
 		case 0x14:
-			buf = do_tok(buf, "SetToString", (opcode & 0x80) ? A1V : A1W | ANOENDSEMICOLON);
+			buf = do_tok(buf, "SetToString", ((opcode & 0x80) ? A1V : A1W) | ANOENDSEMICOLON);
 			break;
 		case 0x16:
 			buf =
 				do_tok(buf, "SetToObject", ((opcode & 0x80) ? A1V : A1W) | ((opcode & 0x40) ? A2V : A2B) | ANOENDSEMICOLON);
 			break;
 		case 0x17:
-			buf = do_tok(buf, "BackColor", (opcode & 0x80) ? A1V : A1B | ANOENDSEMICOLON);
+			buf = do_tok(buf, "BackColor", ((opcode & 0x80) ? A1V : A1B) | ANOENDSEMICOLON);
 			break;
 		default:
 			buf += sprintf(buf, "Invalid%.2X()", opcode);


Commit: 27d0a70ebf29d228e888f8055bb8f2143408cd1e
    https://github.com/scummvm/scummvm-tools/commit/27d0a70ebf29d228e888f8055bb8f2143408cd1e
Author: Oliver Siegmar (oliver at siegmar.de)
Date: 2022-10-23T09:59:32+02:00

Commit Message:
SCUMM: remove inconsistent space

Not a big deal just an inconsistency:

PutCodeInString(30, "Threepwood");
-------------------^

...spaces after argument separators are not used elsewhere in this code.

Changed paths:
    engines/scumm/descumm.cpp


diff --git a/engines/scumm/descumm.cpp b/engines/scumm/descumm.cpp
index a7753d6d..3ee05a06 100644
--- a/engines/scumm/descumm.cpp
+++ b/engines/scumm/descumm.cpp
@@ -910,7 +910,7 @@ void do_load_code_to_string(char *buf, byte opcode) {
 
 	buf = strchr(strcpy(buf, "PutCodeInString("), 0);
 	buf = get_var_or_byte(buf, opcode & 0x80);
-	buf = strchr(strcpy(buf, ", "), 0);
+	buf = strchr(strcpy(buf, ","), 0);
 	buf = get_string(buf);
 	strcpy(buf, ");");
 }




More information about the Scummvm-git-logs mailing list