aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);