[Scummvm-cvs-logs] scummvm master -> 949c8e97f5e54232b1b1277e39920f591aeedbcd

Strangerke Strangerke at scummvm.org
Tue Feb 14 20:16:01 CET 2012


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

Summary:
654016c927 TSAGE: R2R - Scene 1337: Implement AI function subC2C2F
1dcc8402b8 TSAGE: R2R - Scene 1337: Implement on more AI function
f380d3ded2 TSAGE: R2R - Scene 1337: Implement one more large AI function (subCDB90)
949c8e97f5 TSAGE: R2R - Scene 1337: Implement another large AI function (subCF979)


Commit: 654016c9273bf5fc3810af8b55bf6f0c7694d982
    https://github.com/scummvm/scummvm/commit/654016c9273bf5fc3810af8b55bf6f0c7694d982
Author: Strangerke (strangerke at scummvm.org)
Date: 2012-02-14T11:10:17-08:00

Commit Message:
TSAGE: R2R - Scene 1337: Implement AI function subC2C2F

Changed paths:
    engines/tsage/ringworld2/ringworld2_scenes1.cpp



diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index f410de3..456cfb0 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -1658,7 +1658,7 @@ void Scene1337::synchronize(Serializer &s) {
 }
 
 void Scene1337::Action1337::subD18B5(int resNum, int stripNum, int frameNum) {
-	warning("STUBBED: Action1337::sub53CD5()");
+	warning("STUBBED: Action1337::subD18B5()");
 }
 
 void Scene1337::Action1337::skipFrames(int32 skipCount) {
@@ -4285,7 +4285,184 @@ bool Scene1337::subC2BF8(unkObj1337sub1 *subObj1, Common::Point pt) {
 }
 
 void Scene1337::subC2C2F() {
-	warning("STUBBED Scene1337::subC2C2F()");
+	bool found = true;
+
+	if (_arrunkObj1337[3]._arr3[0]._field34 != 0) {
+		switch (_arrunkObj1337[3]._arr3[0]._field34) {
+		case 10:
+		// No break on purpose
+		case 12:
+		// No break on purpose
+		case 15:
+		// No break on purpose
+		case 17:
+		// No break on purpose
+		case 18:
+		// No break on purpose
+		case 19:
+		// No break on purpose
+		case 20:
+		// No break on purpose
+		case 21:
+			subC4A39(&_arrunkObj1337[3]._arr3[0]);
+			found = false;
+			break;
+		default:
+			found = false;
+			int i;
+			for (i = 0; i <= 3; i++) {
+				if (subC3386(_arrunkObj1337[3]._arr3[0]._field34, _arrunkObj1337[3]._arr1[i]._field34)) {
+					found = true;
+					break;
+				}
+			}
+
+			if (found) {
+				found = false;
+				subC34A1(&_arrunkObj1337[3]._arr1[i], &_arrunkObj1337[3]._arr3[0]);
+			}
+			break;
+		}
+	}
+
+	if (!found)
+		return;
+
+	int randIndx = R2_GLOBALS._randomSource.getRandomNumber(3);
+	
+	if (_arrunkObj1337[3]._arr1[randIndx]._field34 == 1) {
+		found = false;
+
+		for (int i = 0; i <= 7; i++) {
+			if ((_arrunkObj1337[3]._arr2[i]._field34 == 0) && (!subC2687(_arrunkObj1337[3]._arr3[0]._field34))) {
+				subC340B(&_arrunkObj1337[3]._arr1[randIndx], &_arrunkObj1337[3]._arr2[i]);
+				found = true;
+				break;
+			}
+		}
+
+		if (found) {
+			return;
+		}
+	} else if (_arrunkObj1337[3]._arr1[randIndx]._field34 <= 9) {
+		found = false;
+
+		for (int i = 0; i <= 7; i++) {
+			if (_arrunkObj1337[3]._arr2[i]._field34 == _arrunkObj1337[3]._arr1[randIndx]._field34) {
+				found = true;
+				break;
+			}
+		}
+
+		if (!found) {
+			for (int i = 0; i <= 7; i++) {
+				if ((_arrunkObj1337[3]._arr2[i]._field34 == 1) && (!subC2687(_arrunkObj1337[3]._arr3[i]._field34))) {
+					int tmpVal = 0;
+					
+					for (int i = 0; i <= 7; i++) {
+						if ((_arrunkObj1337[3]._arr2[i]._field34 > 1) && (_arrunkObj1337[3]._arr2[i]._field34 <= 9))
+							++tmpVal;
+					}
+					
+					if (tmpVal == 7)
+						_field424A = 3;
+					
+					subC33C0(&_arrunkObj1337[3]._arr1[randIndx], &_arrunkObj1337[3]._arr2[i]);
+					found = true;
+					break;
+				}
+			}
+			if (found)
+				return;
+		}
+	} else if (_arrunkObj1337[3]._arr1[randIndx]._field34 == 13) {
+		int tmpVal = subC331B(3);
+
+		if (tmpVal != -1) {
+			subC358E(&_arrunkObj1337[3]._arr1[randIndx], tmpVal);
+			return;
+		}
+	} else if (_arrunkObj1337[3]._arr1[randIndx]._field34 == 25) {
+		int tmpVal = -1;
+		found = false;
+		int tmpRandIndx = R2_GLOBALS._randomSource.getRandomNumber(3);
+		
+		for (int i = 0; i <= 3; i++) {
+			if (  (tmpRandIndx != 3)
+			  && (  (_arrunkObj1337[tmpRandIndx]._arr1[0]._field34 != 0)
+			     || (_arrunkObj1337[tmpRandIndx]._arr1[1]._field34 != 0)
+			     || (_arrunkObj1337[tmpRandIndx]._arr1[2]._field34 != 0)
+			     || (_arrunkObj1337[tmpRandIndx]._arr1[3]._field34 != 0) )) {
+				tmpVal = tmpRandIndx;
+				break;
+			}
+			
+			++tmpRandIndx;
+			if (tmpRandIndx > 3)
+				tmpRandIndx = 0;
+		}
+
+		if (tmpVal != -1) {
+			subC318B(3, &_arrunkObj1337[3]._arr1[randIndx], tmpVal);
+			return;
+		}
+	} else {
+		switch (_arrunkObj1337[3]._arr1[randIndx]._field34) {
+		case 10:
+		// No break on purpose
+		case 11:
+		// No break on purpose
+		case 12:
+		// No break on purpose
+		case 14:
+		// No break on purpose
+		case 15:
+		// No break on purpose
+		case 16:
+		// No break on purpose
+		case 17:
+		// No break on purpose
+		case 18:
+		// No break on purpose
+		case 19:
+		// No break on purpose
+		case 20:
+		// No break on purpose
+		case 21:
+		// No break on purpose
+		case 24: {
+			int tmpVal = -1;
+			int tmpRandIndx = R2_GLOBALS._randomSource.getRandomNumber(3);
+			
+			for (int i = 0; i <= 3; i++) {
+				if (tmpRandIndx != 3) {
+					for (int j = 0; j <= 7; j++) {
+						if ((_arrunkObj1337[j]._arr3[0]._field34 == 0) && (subC32B1(j, _arrunkObj1337[3]._arr1[randIndx]._field34))) {
+							tmpVal = j;
+						}
+					}
+				}
+
+				++tmpRandIndx;
+				if (tmpRandIndx > 3)
+					tmpRandIndx = 0;
+				
+				if (tmpVal != -1)
+					break;
+			}
+			
+			if (tmpVal != -1) {
+				// Useless second identical check skipped
+				subC3456(&_arrunkObj1337[3]._arr1[randIndx], &_arrunkObj1337[tmpVal]._arr3[0]);
+				return;
+			}
+			}
+		default:
+			break;
+		}
+	}
+
+	subC4A39(&_arrunkObj1337[3]._arr1[randIndx]);
 }
 
 void Scene1337::subC318B(int arg1, unkObj1337sub1 *subObj1, int arg3) {


Commit: 1dcc8402b8dd57bbf5174a6d7a0c99b39fae7ccb
    https://github.com/scummvm/scummvm/commit/1dcc8402b8dd57bbf5174a6d7a0c99b39fae7ccb
Author: Strangerke (strangerke at scummvm.org)
Date: 2012-02-14T11:10:18-08:00

Commit Message:
TSAGE: R2R - Scene 1337: Implement on more AI function

Changed paths:
    engines/tsage/ringworld2/ringworld2_scenes1.cpp



diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index 456cfb0..0745855 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -4616,7 +4616,18 @@ void Scene1337::subC34A1(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
 }
 
 Scene1337::unkObj1337sub1 *Scene1337::subC34EC(int arg1) {
-	warning("STUBBED Scene1337::subC34EC()");
+	for (int i = 0; i <= 7; i++) {
+		if (_arrunkObj1337[arg1]._arr2[i]._field34 == 1) {
+			return &_arrunkObj1337[arg1]._arr2[i];
+		}
+	}
+	
+	for (int i = 0; i <= 7; i++) {
+		if ((_arrunkObj1337[arg1]._arr2[i]._field34 != 0) && (_arrunkObj1337[arg1]._arr2[i]._field34 < 10)) {
+			return &_arrunkObj1337[arg1]._arr2[i];
+		}
+	}
+	
 	return NULL;
 }
 


Commit: f380d3ded235297a4162ff0735dcb037da813faa
    https://github.com/scummvm/scummvm/commit/f380d3ded235297a4162ff0735dcb037da813faa
Author: Strangerke (strangerke at scummvm.org)
Date: 2012-02-14T11:10:20-08:00

Commit Message:
TSAGE: R2R - Scene 1337: Implement one more large AI function (subCDB90)

Changed paths:
    engines/tsage/ringworld2/ringworld2_scenes1.cpp
    engines/tsage/ringworld2/ringworld2_scenes1.h



diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index 0745855..769fd58 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -4667,6 +4667,10 @@ void Scene1337::subC51A0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2) {
 	_item1.setAction(&_action13);
 }
 
+void Scene1337::subC6235(int arg1) {
+	warning("STUBBED: subC6235()");
+}
+
 void Scene1337::subPostInit() {
 	R2_GLOBALS._v57709 = 0;
 	R2_GLOBALS._v5780C = 0;
@@ -4895,9 +4899,311 @@ void Scene1337::subCCF26() {
 	shuffleCards();
 	_item1.setAction(&_action3);
 }
+void Scene1337::subCD193() {
+	warning("STUBBED: subCD193()");
+}
 
-void Scene1337::subCDB90(int arg1, Common::Point *pt) {
-	warning("STUBBED: subCDB90()");
+void Scene1337::subCDB90(int arg1, Common::Point pt) {
+	bool found = false;
+	int curReg = R2_GLOBALS._sceneRegions.indexOf(g_globals->_events._mousePos);
+	
+	if (arg1 == 3) {
+		int i;
+		for (i = 0; i <= 7; i++) {
+			if ( (subC2BF8(&_arrunkObj1337[2]._arr2[i], pt))
+			  || (subC2BF8(&_arrunkObj1337[0]._arr2[i], pt))
+			  || (subC2BF8(&_arrunkObj1337[1]._arr2[i], pt))
+			  || (subC2BF8(&_arrunkObj1337[3]._arr2[i], pt)) ) {
+				found = true;
+				break;
+			}
+		}
+		
+		if (found) {
+			switch (curReg) {
+			case 5:
+				if (_arrunkObj1337[2]._arr2[i]._field34 != 0)
+					subC6235(_arrunkObj1337[2]._arr2[i]._field34);
+				else
+					actionDisplay(1330, 20, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				break;
+			case 10:
+				if (_arrunkObj1337[3]._arr2[i]._field34 != 0)
+					subC6235(_arrunkObj1337[3]._arr2[i]._field34);
+				else
+					actionDisplay(1330, 22, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				break;
+			case 15:
+				if (_arrunkObj1337[0]._arr2[i]._field34 != 0)
+					subC6235(_arrunkObj1337[0]._arr2[i]._field34);
+				else
+					actionDisplay(1330, 21, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				break;
+			case 20:
+				if (_arrunkObj1337[1]._arr2[i]._field34 != 0)
+					subC6235(_arrunkObj1337[1]._arr2[i]._field34);
+				else
+					actionDisplay(1330, 23, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				break;
+			default:
+				break;
+			}
+		} else {
+			if ( (subC2BF8(&_arrunkObj1337[2]._arr3[0], pt))
+			  || (subC2BF8(&_arrunkObj1337[0]._arr3[0], pt))
+			  || (subC2BF8(&_arrunkObj1337[1]._arr3[0], pt))
+			  || (subC2BF8(&_arrunkObj1337[3]._arr3[0], pt)) ) {
+				found = true;
+			}
+			
+			if (found) {
+				switch (curReg) {
+				case 5:
+					if (_arrunkObj1337[2]._arr3[0]._field34 != 0)
+						subC6235(_arrunkObj1337[2]._arr3[0]._field34);
+					else
+						actionDisplay(1330, 10, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+					break;
+				case 10:
+					if (_arrunkObj1337[3]._arr3[0]._field34 != 0)
+						subC6235(_arrunkObj1337[3]._arr3[0]._field34);
+					else
+						actionDisplay(1330, 16, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+					break;
+				case 15:
+					if (_arrunkObj1337[0]._arr3[0]._field34 != 0)
+						subC6235(_arrunkObj1337[3]._arr3[0]._field34);
+					else
+						actionDisplay(1330, 13, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+					break;
+				case 20:
+					if (_arrunkObj1337[1]._arr3[0]._field34 != 0)
+						subC6235(_arrunkObj1337[1]._arr3[0]._field34);
+					else
+						actionDisplay(1330, 18, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+					break;
+				default:
+					break;
+				}
+			} else {
+				if (subC2BF8(&_item7, pt)) {
+					if (_item7._field34 != 0)
+						subC6235(_item7._field34);
+					else
+						actionDisplay(1330, 7, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				} else if (_background1._bounds.contains(pt)) {
+					actionDisplay(1330, 43, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				} else if (subC2BF8(&_item8, pt)) {
+					actionDisplay(1330, 4, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				} else if ( (subC2BF8(&_arrunkObj1337[2]._arr4[0], pt))
+					       || (subC2BF8(&_arrunkObj1337[3]._arr4[0], pt))
+					       || (subC2BF8(&_arrunkObj1337[0]._arr4[0], pt))
+					       || (subC2BF8(&_arrunkObj1337[1]._arr4[0], pt)) ) {
+					actionDisplay(1330, 32, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				} else {
+					if (subC2BF8(&_arrunkObj1337[2]._arr1[0], pt))
+						subC6235(_arrunkObj1337[2]._arr1[0]._field34);
+					else if (subC2BF8(&_arrunkObj1337[2]._arr1[1], pt))
+						subC6235(_arrunkObj1337[2]._arr1[1]._field34);
+					else if (subC2BF8(&_arrunkObj1337[2]._arr1[2], pt))
+						subC6235(_arrunkObj1337[2]._arr1[2]._field34);
+					else if (subC2BF8(&_arrunkObj1337[2]._arr1[3], pt))
+						subC6235(_arrunkObj1337[2]._arr1[3]._field34);
+					else if ((curReg >= 6) || (curReg <= 9))
+						actionDisplay(1330, 29, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+					else if ((curReg >= 11) || (curReg <= 14))
+						actionDisplay(1330, 31, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+					else if ((curReg >= 16) || (curReg <= 19))
+						actionDisplay(1330, 30, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+					else {
+						switch (curReg) {
+						case 0:
+							actionDisplay(1330, 2, 159, 134, 1, 200, 0, 7, 0, 105, 105);
+							break;
+						case 5:
+							actionDisplay(1330, 25, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+							break;
+						case 10:
+							actionDisplay(1330, 27, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+							break;
+						case 15:
+							actionDisplay(1330, 26, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+							break;
+						case 20:
+							actionDisplay(1330, 28, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+							break;
+						case 21:
+							actionDisplay(1330, 24, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+							break;
+						default:
+							break;
+						}
+					}
+				}
+			}
+		}
+	}
+	
+	if (arg1 != 1)
+		return;
+		
+	for (int i = 0; i <= 7; i++) {
+		if (subC2BF8(&_arrunkObj1337[2]._arr2[i], pt)) {
+			switch (_arrunkObj1337[2]._arr2[i]._field34) {
+			case 0:
+				actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				break;
+			case 1:
+				actionDisplay(1330, 54, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				break;
+			default:
+				actionDisplay(1330, 34, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				break;
+			}
+			found = true;
+			break;
+		} else if (subC2BF8(&_arrunkObj1337[0]._arr2[i], pt)) {
+			switch (_arrunkObj1337[0]._arr2[i]._field34) {
+			case 0:
+				actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				break;
+			default:
+				actionDisplay(1330, 1, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+				break;
+			}
+			found = true;
+			break;
+		} else if (subC2BF8(&_arrunkObj1337[1]._arr2[i], pt)) {
+			switch (_arrunkObj1337[1]._arr2[i]._field34) {
+			case 0:
+				actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+				break;
+			default:
+				actionDisplay(1330, 144, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+				break;
+			}
+			found = true;
+			break;
+		} else if (subC2BF8(&_arrunkObj1337[3]._arr2[i], pt)) {
+			switch (_arrunkObj1337[3]._arr2[i]._field34) {
+			case 0:
+				actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+				break;
+			default:
+				actionDisplay(1330, 145, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+				break;
+			}
+			found = true;
+			break;
+		}
+	}
+
+	if (subC2BF8(&_arrunkObj1337[2]._arr3[0], pt)) {
+		if (_arrunkObj1337[0]._arr3[0]._field34 != 0) {
+			actionDisplay(1330, 39, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+		} else {
+			actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+		}
+		found = true;
+	}
+	
+	if (subC2BF8(&_arrunkObj1337[3]._arr3[0], pt)) {
+		if (_arrunkObj1337[3]._arr3[0]._field34 != 0) {
+			actionDisplay(1330, 145, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+		} else {
+			actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+		}
+		found = true;
+	}
+	
+	if (subC2BF8(&_arrunkObj1337[1]._arr3[0], pt)) {
+		if (_arrunkObj1337[1]._arr3[0]._field34 != 0) {
+			actionDisplay(1330, 144, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+		} else {
+			actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+		}
+		found = true;
+	}
+	
+	if (subC2BF8(&_arrunkObj1337[0]._arr3[0], pt)) {
+		if (_arrunkObj1337[0]._arr3[0]._field34 != 0) {
+			actionDisplay(1330, 1, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+		} else {
+			actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+		}
+		found = true;
+	}
+
+	if (subC2BF8(&_arrunkObj1337[3]._arr4[0], pt)) {
+		actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+		found = true;
+	}
+
+	if (subC2BF8(&_arrunkObj1337[1]._arr4[0], pt)) {
+		actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+		found = true;
+	}
+
+	if (subC2BF8(&_arrunkObj1337[0]._arr4[0], pt)) {
+		actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+		found = true;
+	}
+
+	if (found)
+		return;
+	
+	if (_background1._bounds.contains(pt)) {
+		subCD193();
+		return;
+	}
+	
+	if (subC2BF8(&_item7, pt))
+		actionDisplay(1330, 9, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+	else if (subC2BF8(&_item8, pt))
+		actionDisplay(1330, 5, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+	else {
+		switch (curReg) {
+		case 0:
+			actionDisplay(1330, 3, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+			break;
+		case 6:
+		// no break on purpose
+		case 7:
+		// no break on purpose
+		case 8:
+		// no break on purpose
+		case 9:
+			actionDisplay(1330, 145, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+			break;
+		case 10:
+			actionDisplay(1330, 147, 20, 99, 1, 136, 0, 7, 0, 172, 172);
+			break;
+		case 11:
+		// no break on purpose
+		case 12:
+		// no break on purpose
+		case 13:
+		// no break on purpose
+		case 14:
+			actionDisplay(1330, 1, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+			break;
+		case 16:
+		// no break on purpose
+		case 17:
+		// no break on purpose
+		case 18:
+		// no break on purpose
+		case 19:
+			actionDisplay(1330, 144, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+			break;
+		case 20:
+			actionDisplay(1330, 146, 300, 99, 1, 136, 0, 7, 0, 117, 117);
+			break;
+		default:
+			actionDisplay(1330, 11, 159, 10, 1, 200, 0, 7, 0, 154, 154);
+			break;
+		}
+	}
 }
 
 void Scene1337::subCF31D() {
@@ -5197,12 +5503,12 @@ void Scene1337::subD02CA() {
 		}
 		
 		if (di == 4) {
-			subCDB90(1, &_item6._field36);
+			subCDB90(1, _item6._field36);
 			subD0281();
 			return;
 		}
 	} else if (R2_GLOBALS._v57810 == 300) {
-		subCDB90(3, &_item6._field36);
+		subCDB90(3, _item6._field36);
 		subD0281();
 		return;
 	} else {
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h
index 0f22ca6..913550c 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.h
@@ -343,12 +343,14 @@ public:
 	void subC4CD2();
 	void subC4CEC();
 	void subC51A0(unkObj1337sub1 *subObj1, unkObj1337sub1 *subObj2);
+	void subC6235(int arg1);
 	void subPostInit();
 	void subCB59B();
 	void suggestInstructions();
 	void shuffleCards();
 	void subCCF26();
-	void subCDB90(int arg1, Common::Point *pt);
+	void subCD193();
+	void subCDB90(int arg1, Common::Point pt);
 	void subCF31D();
 	void subCF979();
 	void subD026D();


Commit: 949c8e97f5e54232b1b1277e39920f591aeedbcd
    https://github.com/scummvm/scummvm/commit/949c8e97f5e54232b1b1277e39920f591aeedbcd
Author: Strangerke (strangerke at scummvm.org)
Date: 2012-02-14T11:10:21-08:00

Commit Message:
TSAGE: R2R - Scene 1337: Implement another large AI function (subCF979)

Changed paths:
    engines/tsage/ringworld2/ringworld2_scenes1.cpp



diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index 769fd58..bdafd3b 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -5424,7 +5424,255 @@ void Scene1337::subCF31D() {
 }
 
 void Scene1337::subCF979() {
-	warning("STUBBED Scene1337::subCF979()");
+	bool found = true;
+
+	if (_arrunkObj1337[0]._arr3[0]._field34 != 0) {
+		switch (_arrunkObj1337[0]._arr3[0]._field34) {
+		case 10:
+		//No break on purpose
+		case 12:
+		//No break on purpose
+		case 15:
+		//No break on purpose
+		case 17:
+		//No break on purpose
+		case 18:
+		//No break on purpose
+		case 19:
+		//No break on purpose
+		case 20:
+		//No break on purpose
+		case 21:
+			subC4A39(&_arrunkObj1337[0]._arr3[0]);
+			found = false;
+			break;
+		default:
+			int i;
+			found = false;
+
+			for (i = 0; i <= 3; i++) {
+				if (subC3386(_arrunkObj1337[0]._arr3[0]._field34, _arrunkObj1337[0]._arr1[i]._field34)) {
+					found = true;
+					break;
+				}
+			}
+
+			if (found) {
+				found = false;
+				subC34A1(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[0]._arr3[0]);
+			}
+			break;
+		}
+	}
+	
+	if (found)
+		return;
+	
+	int tmpVal;
+	found = false;
+	for (int i = 0; i <= 3; i++) {
+		tmpVal = subC26CB(0, i);
+
+		if (tmpVal != -1) {
+			bool flag = false;;
+			for (int j = 0; j <= 7; j++) {
+				if (_arrunkObj1337[0]._arr2[j]._field34 == _arrunkObj1337[0]._arr1[tmpVal]._field34) {
+					flag = true;
+					break;
+				}
+			}
+			
+			if (!flag) {
+				for (int j = 0; j <= 7; j++) {
+					if ((_arrunkObj1337[0]._arr2[j]._field34 == 1) && (!subC2687(_arrunkObj1337[0]._arr3[0]._field34))) {
+						int count = 0;
+						for (int k = 0; k <= 7; k++) {
+							if ((_arrunkObj1337[0]._arr2[k]._field34 > 1) && (_arrunkObj1337[0]._arr2[k]._field34 <= 9)) {
+								++count;
+							}
+						}
+
+						if (count == 7)
+							_field424A = 0;
+						
+						subC33C0(&_arrunkObj1337[0]._arr1[tmpVal], &_arrunkObj1337[0]._arr2[j]);
+						found = true;
+					}
+				}
+			}
+		}
+		
+		if (found)
+			break;
+	}
+
+	if (found)
+		return;
+	
+	found = false;
+	tmpVal = subC2719(0);
+
+	if (tmpVal != -1) {
+		for (int i = 0; i <= 7; i++) {
+			if ((_arrunkObj1337[0]._arr2[i]._field34 == 0) && (!subC2687(_arrunkObj1337[0]._arr3[0]._field34))) {
+				subC340B(&_arrunkObj1337[0]._arr1[tmpVal], &_arrunkObj1337[0]._arr2[i]);
+				found = true;
+				break;
+			}
+		}
+	}
+	
+	if (found)
+		return;
+	
+	tmpVal = subC274D(0);
+	if (tmpVal != -1) {
+		for (int i = 0; i <= 7; i++) {
+			if (_arrunkObj1337[2]._arr2[i]._field34 != 0) {
+				subC358E(&_arrunkObj1337[0]._arr1[tmpVal], 2);
+				found = true;
+				break;
+			}
+		}
+	}
+	
+	if (found) 
+		return;
+	
+	tmpVal = subC2781(0);
+	if (tmpVal != -1) {
+		if ( (_arrunkObj1337[2]._arr1[0]._field34 != 0)
+		  || (_arrunkObj1337[2]._arr1[1]._field34 != 0)
+		  || (_arrunkObj1337[2]._arr1[2]._field34 != 0)
+		  || (_arrunkObj1337[2]._arr1[3]._field34 != 0) ) {
+			subC318B(0, &_arrunkObj1337[0]._arr1[tmpVal], 2);
+			found = true;
+		}
+	}
+	
+	if (found) 
+		return;
+	
+	for (int i = 0; i <= 3; i++) {
+		if (subC27B5(_arrunkObj1337[0]._arr1[i]._field34) != -1) {
+			// The variable 'j' is not used in the inner code of the loop. It's suspect
+			for (int j = 0; j <= 7; j++) {
+				if ((_arrunkObj1337[2]._arr3[0]._field34 == 0) && (subC32B1(2, _arrunkObj1337[0]._arr1[i]._field34))) {
+					subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[2]._arr3[0]);
+					found = true;
+					break;
+				}
+			}
+
+			if (found)
+				break;
+		}
+	}
+
+	if (found) 
+		return;
+
+	for (int i = 0; i <= 3; i++) {
+		if (subC27F9(_arrunkObj1337[0]._arr1[i]._field34) != -1) {
+			for (int j = 0; j <= 7; j++) {
+				if ((_arrunkObj1337[2]._arr3[0]._field34 == 0) && (subC32B1(2, _arrunkObj1337[0]._arr1[j]._field34))) {
+					subC3456(&_arrunkObj1337[0]._arr1[j], &_arrunkObj1337[2]._arr3[0]);
+					found = true;
+				}
+			}
+			
+			if (found)
+				break;
+		}
+	}
+		
+	if (found) 
+		return;
+
+	tmpVal = subC274D(0);
+	int tmpVal2 = subC331B(0);
+	
+	if ((tmpVal != -1) && (tmpVal2 != -1)) {
+		subC358E(&_arrunkObj1337[0]._arr1[tmpVal], tmpVal2);
+		found = true;
+	}
+	
+	if (found)
+		return;
+	
+	tmpVal = subC2781(0);
+	if (tmpVal != -1) {
+		if ( (_arrunkObj1337[1]._arr1[0]._field34 != 0)
+		  || (_arrunkObj1337[1]._arr1[1]._field34 != 0)
+		  || (_arrunkObj1337[1]._arr1[2]._field34 != 0)
+		  || (_arrunkObj1337[1]._arr1[3]._field34 != 0) ) {
+			subC318B(0, &_arrunkObj1337[0]._arr1[tmpVal], 1);
+			found = true;
+		}
+	}
+	
+	if (found)
+		return;
+
+	for (int i = 0; i <= 3; i++) {
+		tmpVal = subC27F9(_arrunkObj1337[0]._arr1[i]._field34);
+		if (tmpVal != -1) {
+			// The variable 'j' is not used in the inner code of the loop. It's suspect.
+			for (int j = 0; j <= 7; j++) {
+				if ((_arrunkObj1337[1]._arr3[0]._field34 == 0) && (subC32B1(1, _arrunkObj1337[0]._arr1[i]._field34))) {
+					subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[1]._arr3[0]);
+					found = true;
+				}
+			}
+			
+			if (!found) {
+			// The variable 'j' is not used in the inner code of the loop. It's suspect.
+				for (int j = 0; j <= 7; j++) {
+					if ((_arrunkObj1337[3]._arr3[0]._field34 == 0) && (subC32B1(3, _arrunkObj1337[0]._arr1[i]._field34))) {
+					subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[3]._arr3[0]);
+					found = true;
+					}
+				}
+			}
+			
+			if (found)
+				break;
+		}
+	}
+
+	if (found)
+		return;
+
+	for (int i = 0; i <= 3; i++) {
+		tmpVal = subC27B5(_arrunkObj1337[0]._arr1[i]._field34);
+		if (tmpVal != -1) {
+			// The variable 'j' is not used in the inner code of the loop. It's suspect.
+			for (int j = 0; j <= 7; j++) {
+				if ((_arrunkObj1337[1]._arr3[0]._field34 == 0) && (subC32B1(1, _arrunkObj1337[0]._arr1[i]._field34))) {
+					subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[1]._arr3[0]);
+					found = true;
+				}
+			}
+
+			if (!found) {
+			// The variable 'j' is not used in the inner code of the loop. It's suspect.
+				for (int j = 0; j <= 7; j++) {
+					if ((_arrunkObj1337[3]._arr3[0]._field34 == 0) && (subC32B1(3, _arrunkObj1337[0]._arr1[i]._field34))) {
+					subC3456(&_arrunkObj1337[0]._arr1[i], &_arrunkObj1337[3]._arr3[0]);
+					found = true;
+					}
+				}
+			}
+			
+			if (found)
+				break;
+		}
+	}
+	
+	if (found)
+		return;
+
+	subC2835(0);
 }
 
 void Scene1337::subD026D() {






More information about the Scummvm-git-logs mailing list