[Scummvm-git-logs] scummvm master -> c7da2f38c38a8dc7ad3d88149b24d69d0e84a21a

sev- sev at scummvm.org
Sun Nov 3 01:16:47 CET 2019


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

Summary:
c7da2f38c3 SCUMM HE: MBC: Properly create arrays on receiving. We now can join the game!


Commit: c7da2f38c38a8dc7ad3d88149b24d69d0e84a21a
    https://github.com/scummvm/scummvm/commit/c7da2f38c38a8dc7ad3d88149b24d69d0e84a21a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-11-03T01:16:19+01:00

Commit Message:
SCUMM HE: MBC: Properly create arrays on receiving. We now can join the game!

Changed paths:
    engines/scumm/he/intern_he.h
    engines/scumm/he/moonbase/net_main.cpp
    engines/scumm/he/script_v72he.cpp


diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index d1487c7..90f78f0 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -306,7 +306,7 @@ protected:
 	virtual void redrawBGAreas();
 	virtual void checkExecVerbs();
 
-	byte *defineArray(int array, int type, int dim2start, int dim2end, int dim1start, int dim1end);
+	byte *defineArray(int array, int type, int dim2start, int dim2end, int dim1start, int dim1end, bool newArray = false, int *newid = NULL);
 	virtual int readArray(int array, int idx2, int idx1);
 	virtual void writeArray(int array, int idx2, int idx1, int value);
 	void redimArray(int arrayId, int newDim2start, int newDim2end,
diff --git a/engines/scumm/he/moonbase/net_main.cpp b/engines/scumm/he/moonbase/net_main.cpp
index d29154b..519a802 100644
--- a/engines/scumm/he/moonbase/net_main.cpp
+++ b/engines/scumm/he/moonbase/net_main.cpp
@@ -566,20 +566,18 @@ bool Net::remoteReceiveData() {
 
 	case PACKETTYPE_REMOTESENDSCUMMARRAY:
 		{
-			int newArray;
+			int newArray = 0;
 
 			// Assume that the packet data contains a "SCUMM PACKAGE"
 			// and unpack it into an scumm array :-)
 
-			newArray = _vm->findFreeArrayId();
-
 			int dim1start = _packetdata->child("data")->child("dim1start")->asIntegerNumber();
 			int dim1end   = _packetdata->child("data")->child("dim1end")->asIntegerNumber();
 			int dim2start = _packetdata->child("data")->child("dim2start")->asIntegerNumber();
 			int dim2end   = _packetdata->child("data")->child("dim2end")->asIntegerNumber();
 			int atype     = _packetdata->child("data")->child("type")->asIntegerNumber();
 
-			byte *data = _vm->defineArray(newArray, atype, dim2start, dim2end, dim1start, dim1end);
+			byte *data = _vm->defineArray(0, atype, dim2start, dim2end, dim1start, dim1end, true, &newArray);
 
 			int32 size = (dim1end - dim1start + 1) * (dim2end - dim2start + 1);
 
diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp
index b2af816..d86b0ce 100644
--- a/engines/scumm/he/script_v72he.cpp
+++ b/engines/scumm/he/script_v72he.cpp
@@ -102,7 +102,7 @@ void ScummEngine_v72he::setupOpcodes() {
 static const int arrayDataSizes[] = { 0, 1, 4, 8, 8, 16, 32 };
 
 byte *ScummEngine_v72he::defineArray(int array, int type, int dim2start, int dim2end,
-											int dim1start, int dim1end) {
+											int dim1start, int dim1end, bool newArray, int *newid) {
 	int id;
 	int size;
 	ArrayHeader *ah;
@@ -115,13 +115,17 @@ byte *ScummEngine_v72he::defineArray(int array, int type, int dim2start, int dim
 	if (type == kBitArray || type == kNibbleArray)
 		type = kByteArray;
 
-	nukeArray(array);
+	if (!newArray)
+		nukeArray(array);
 
 	id = findFreeArrayId();
 
+	if (newid != NULL)
+		*newid = id;
+
 	debug(9, "defineArray (array %d, dim2start %d, dim2end %d dim1start %d dim1end %d", id, dim2start, dim2end, dim1start, dim1end);
 
-	if (array & 0x80000000) {
+	if (!newArray && (array & 0x80000000)) {
 		error("Can't define bit variable as array pointer");
 	}
 
@@ -130,7 +134,8 @@ byte *ScummEngine_v72he::defineArray(int array, int type, int dim2start, int dim
 	if (_game.heversion >= 80)
 		id |= 0x33539000;
 
-	writeVar(array, id);
+	if (!newArray)
+		writeVar(array, id);
 
 	if (_game.heversion >= 80)
 		id &= ~0x33539000;





More information about the Scummvm-git-logs mailing list