[Scummvm-cvs-logs] SF.net SVN: scummvm: [21743] scummvm/trunk/engines/simon

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sun Apr 9 23:41:00 CEST 2006


Revision: 21743
Author:   eriktorbjorn
Date:     2006-04-09 23:40:15 -0700 (Sun, 09 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21743&view=rev

Log Message:
-----------
Merged o_chance() into o1_chance().

Modified Paths:
--------------
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/simon.h
Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-10 06:18:39 UTC (rev 21742)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-10 06:40:15 UTC (rev 21743)
@@ -447,7 +447,36 @@
 
 void SimonEngine::o1_chance() {
 	// 23
-	setScriptCondition(o_chance(getVarOrWord()));
+	uint a = getVarOrWord();
+
+	if (a == 0) {
+		setScriptCondition(false);
+		return;
+	}
+
+	if (a == 100) {
+		setScriptCondition(true);
+		return;
+	}
+
+	a += _scriptUnk1;
+
+	if (a <= 0) {
+		_scriptUnk1 = 0;
+		setScriptCondition(false);
+	} else if ((uint)_rnd.getRandomNumber(99) < a) {
+		if (_scriptUnk1 <= 0)
+			_scriptUnk1 -= 5;
+		else
+			_scriptUnk1 = 0;
+		setScriptCondition(true);
+	} else {
+		if (_scriptUnk1 >= 0)
+			_scriptUnk1 += 5;
+		else
+			_scriptUnk1 = 0;
+		setScriptCondition(false);
+	}
 }
 
 void SimonEngine::o1_isRoom() {
@@ -1717,36 +1746,6 @@
 	}
 }
 
-
-bool SimonEngine::o_chance(uint a) {
-	if (a == 0)
-		return 0;
-
-	if (a == 100)
-		return 1;
-
-	a += _scriptUnk1;
-	if (a <= 0) {
-		_scriptUnk1 = 0;
-		return 0;
-	}
-
-	if ((uint)_rnd.getRandomNumber(99) < a) {
-		if (_scriptUnk1 <= 0)
-			_scriptUnk1 -= 5;
-		else
-			_scriptUnk1 = 0;
-		return 1;
-	}
-
-	if (_scriptUnk1 >= 0)
-		_scriptUnk1 += 5;
-	else
-		_scriptUnk1 = 0;
-
-	return 0;
-}
-
 void SimonEngine::o_inventory_descriptions() {
 	uint vgaSpriteId = getVarOrByte();
 	uint color = getVarOrByte();

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-10 06:18:39 UTC (rev 21742)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-10 06:40:15 UTC (rev 21743)
@@ -554,8 +554,6 @@
 	void unlinkItem(Item *item);
 	void linkItem(Item *item, Item *parent);
 
-	bool o_chance(uint a);
-
 	void o_kill_sprite_simon1(uint a);
 	void o_kill_sprite_simon2(uint a, uint b);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list