diff options
author | Paul Gilbert | 2015-01-23 21:33:18 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-01-23 21:33:18 -0500 |
commit | 7bfc0344210cf1ea85ccbe784ea54d172ebadc40 (patch) | |
tree | 7e9e95610fd1deda2f61247e73146f074d547d1b /engines/xeen/scripts.cpp | |
parent | fac1d0642fe21600c775be6379c5fd4098ab9d4e (diff) | |
download | scummvm-rg350-7bfc0344210cf1ea85ccbe784ea54d172ebadc40.tar.gz scummvm-rg350-7bfc0344210cf1ea85ccbe784ea54d172ebadc40.tar.bz2 scummvm-rg350-7bfc0344210cf1ea85ccbe784ea54d172ebadc40.zip |
XEEN: Implement cmdJumpRnd script opcode
Diffstat (limited to 'engines/xeen/scripts.cpp')
-rw-r--r-- | engines/xeen/scripts.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 247165f085..6a08286148 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -452,8 +452,20 @@ void Scripts::cmdConfirmWord(Common::Array<byte> ¶ms) { } void Scripts::cmdDamage(Common::Array<byte> ¶ms) { error("TODO"); } -void Scripts::cmdJumpRnd(Common::Array<byte> ¶ms) { error("TODO"); } -void Scripts::cmdAfterEvent(Common::Array<byte> ¶ms) { error("TODO"); } + +/** + * Jump if a random number matches a given value + */ +void Scripts::cmdJumpRnd(Common::Array<byte> ¶ms) { + int v = _vm->getRandomNumber(1, params[0]); + if (v == params[1]) + _lineNum = params[2] - 1; + + _var4F = true; + cmdNoAction(params); +} + +void Scripts::cmdAlterEvent(Common::Array<byte> ¶ms) { error("TODO"); } /** * Stores the current location and line for later resuming, and set up to execute |