aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/simon/items.cpp37
-rw-r--r--engines/simon/simon.cpp2
-rw-r--r--engines/simon/simon.h3
3 files changed, 32 insertions, 10 deletions
diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp
index 03a7f90527..75c06faf2a 100644
--- a/engines/simon/items.cpp
+++ b/engines/simon/items.cpp
@@ -314,6 +314,7 @@ void SimonEngine::setupOpcodes() {
opcode_table[190] = &SimonEngine::o2_waitMark;
break;
case GType_FF:
+ opcode_table[23] = &SimonEngine::o3_chance;
opcode_table[37] = &SimonEngine::o3_jumpOut;
opcode_table[65] = &SimonEngine::o3_addTextBox;
opcode_table[70] = &SimonEngine::o3_printLongText;
@@ -475,22 +476,22 @@ void SimonEngine::o_chance() {
return;
}
- a += _scriptUnk1;
+ a += _chanceModifier;
if (a <= 0) {
- _scriptUnk1 = 0;
+ _chanceModifier = 0;
setScriptCondition(false);
} else if ((uint)_rnd.getRandomNumber(99) < a) {
- if (_scriptUnk1 <= 0)
- _scriptUnk1 -= 5;
+ if (_chanceModifier <= 0)
+ _chanceModifier -= 5;
else
- _scriptUnk1 = 0;
+ _chanceModifier = 0;
setScriptCondition(true);
} else {
- if (_scriptUnk1 >= 0)
- _scriptUnk1 += 5;
+ if (_chanceModifier >= 0)
+ _chanceModifier += 5;
else
- _scriptUnk1 = 0;
+ _chanceModifier = 0;
setScriptCondition(false);
}
}
@@ -1791,6 +1792,26 @@ void SimonEngine::o2_waitMark() {
// Feeble Files Opcodes
// -----------------------------------------------------------------------
+void SimonEngine::o3_chance() {
+ // 23
+ uint a = getVarOrWord();
+
+ if (a == 0) {
+ setScriptCondition(false);
+ return;
+ }
+
+ if (a == 100) {
+ setScriptCondition(true);
+ return;
+ }
+
+ if ((uint)_rnd.getRandomNumber(99) < a)
+ setScriptCondition(true);
+ else
+ setScriptCondition(false);
+}
+
void SimonEngine::o3_jumpOut() {
// 37
getVarOrByte();
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp
index a9f3bed8a3..9adff9ef75 100644
--- a/engines/simon/simon.cpp
+++ b/engines/simon/simon.cpp
@@ -207,7 +207,7 @@ SimonEngine::SimonEngine(OSystem *syst)
_oldMouseAnimMax = 0;
_vgaVar9 = 0;
- _scriptUnk1 = 0;
+ _chanceModifier = 0;
_restoreWindow6 = 0;
_scrollX = 0;
_scrollY = 0;
diff --git a/engines/simon/simon.h b/engines/simon/simon.h
index 2fd6cf720b..b26156e9de 100644
--- a/engines/simon/simon.h
+++ b/engines/simon/simon.h
@@ -264,7 +264,7 @@ protected:
bool _subtitles;
bool _fade;
bool _vgaVar9;
- int16 _scriptUnk1;
+ int16 _chanceModifier;
bool _restoreWindow6;
int _scrollX, _scrollXMax, _scrollWidth;
int _scrollY, _scrollYMax, _scrollHeight;
@@ -971,6 +971,7 @@ public:
void o2_waitMark();
// Opcodes, Feeble Files only
+ void o3_chance();
void o3_jumpOut();
void o3_addTextBox();
void o3_printLongText();