aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-04-10 06:40:15 +0000
committerTorbjörn Andersson2006-04-10 06:40:15 +0000
commit46ef60e1b93603dc6fc6e7543959ca9efdfd3f2a (patch)
tree374b518a38e58019349f2cc275ccf8ff5d782a73
parent3bc5d5b5856167f44c1b54bdad235a5ad1b3d1b7 (diff)
downloadscummvm-rg350-46ef60e1b93603dc6fc6e7543959ca9efdfd3f2a.tar.gz
scummvm-rg350-46ef60e1b93603dc6fc6e7543959ca9efdfd3f2a.tar.bz2
scummvm-rg350-46ef60e1b93603dc6fc6e7543959ca9efdfd3f2a.zip
Merged o_chance() into o1_chance().
svn-id: r21743
-rw-r--r--engines/simon/items.cpp61
-rw-r--r--engines/simon/simon.h2
2 files changed, 30 insertions, 33 deletions
diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp
index b2d7218945..c3d668a3bb 100644
--- a/engines/simon/items.cpp
+++ b/engines/simon/items.cpp
@@ -447,7 +447,36 @@ void SimonEngine::o1_gtf() {
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 @@ void SimonEngine::o_waitForMark(uint i) {
}
}
-
-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();
diff --git a/engines/simon/simon.h b/engines/simon/simon.h
index 423b03887e..74c73c873e 100644
--- a/engines/simon/simon.h
+++ b/engines/simon/simon.h
@@ -554,8 +554,6 @@ protected:
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);