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

dreammaster dreammaster at scummvm.org
Fri Dec 29 09:37:59 CET 2017


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:
e28f2a75bc XEEN: Properly implement cmdGiveExtended opcode


Commit: e28f2a75bcb1ba363a902d45a62e286979fb75f5
    https://github.com/scummvm/scummvm/commit/e28f2a75bcb1ba363a902d45a62e286979fb75f5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-12-29T03:33:59-05:00

Commit Message:
XEEN: Properly implement cmdGiveExtended opcode

Changed paths:
    engines/xeen/party.cpp
    engines/xeen/party.h
    engines/xeen/scripts.cpp


diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 20a80a0..f0d5816 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -1391,6 +1391,11 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int
 	return false;
 }
 
+bool Party::giveTakeExt(int takeMode, uint takeVal, int giveMode, uint giveVal, int extMode, uint extVal, int charIdx) {
+	// TODO
+	return true;
+}
+
 int Party::howMuch() {
 	return HowMuch::show(_vm);
 }
diff --git a/engines/xeen/party.h b/engines/xeen/party.h
index 31feaec..feb470f 100644
--- a/engines/xeen/party.h
+++ b/engines/xeen/party.h
@@ -227,6 +227,11 @@ public:
 	bool giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int charIdx);
 
 	/**
+	 * Gives and/or takes amounts from various character and/or party properties
+	 */
+	bool giveTakeExt(int takeMode, uint takeVal, int giveMode, uint giveVal, int extMode, uint extVal, int charIdx);
+
+	/**
 	 * Resets the inventory that Blacksmiths sell
 	 */
 	void resetBlacksmithWares();
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index 11d21ce..1307a88 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -873,44 +873,80 @@ bool Scripts::cmdAlterMap(ParamsIterator &params) {
 
 bool Scripts::cmdGiveExtended(ParamsIterator &params) {
 	Party &party = *_vm->_party;
-	uint32 val;
-	int newLineNum;
-	bool result;
+	int mode1, mode2, mode3;
+	uint32 val1, val2, val3;
 
 	_refreshIcons = true;
-	int mode = params.readByte();
-	switch (mode) {
+	mode1 = params.readByte();
+	switch (mode1) {
 	case 16:
 	case 34:
 	case 100:
-		val = params.readUint32LE();
+		val1 = params.readUint32LE();
 		break;
 	case 25:
 	case 35:
 	case 101:
 	case 106:
-		val = params.readUint16LE();
+		val1 = params.readUint16LE();
 		break;
 	default:
-		val = params.readByte();
+		val1 = params.readByte();
 		break;
 	}
-	newLineNum = params.readByte();
 
-	if ((_charIndex != 0 && _charIndex != 8) || mode == 44) {
-		result = ifProc(mode, val, _event->_opcode - OP_If1, _charIndex - 1);
-	} else {
-		result = false;
-		for (int idx = 0; idx < (int)party._activeParty.size() && !result; ++idx) {
-			if (_charIndex == 0 || (_charIndex == 8 && _v2 != idx)) {
-				result = ifProc(mode, val, _event->_opcode - OP_If1, idx);
-			}
-		}
+	mode2 = params.readByte();
+	switch (mode2) {
+	case 16:
+	case 34:
+	case 100:
+		val2 = params.readUint32LE();
+		break;
+	case 25:
+	case 35:
+	case 101:
+	case 106:
+		val2 = params.readUint16LE();
+		break;
+	default:
+		val2 = params.readByte();
+		break;
+	}
+
+	mode3 = params.readByte();
+	switch (mode3) {
+	case 16:
+	case 34:
+	case 100:
+		val3 = params.readUint32LE();
+		break;
+	case 25:
+	case 35:
+	case 101:
+	case 106:
+		val3 = params.readUint16LE();
+		break;
+	default:
+		val3 = params.readByte();
+		break;
 	}
 
+	_scriptExecuted = true;
+	bool result = party.giveTakeExt(mode1, val1, mode2, val2, mode3, val3,
+		(_charIndex > 0) ? _charIndex - 1 : 0);
+
 	if (result) {
-		_lineNum = newLineNum;
-		return false;
+		if (_animCounter == 255) {
+			_animCounter = 0;
+			return cmdExit(params);
+		} else if (mode1 == 67 || mode2 == 67 || mode3 == 67) {
+			_animCounter = 1;
+		} else {
+			return cmdExit(params);
+		}
+	} else {
+		if (mode1 == 67 || mode2 == 67 || mode3 == 67)
+			return cmdExit(params);
 	}
 
 	return true;





More information about the Scummvm-git-logs mailing list