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 | |
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')
-rw-r--r-- | engines/xeen/scripts.cpp | 16 | ||||
-rw-r--r-- | engines/xeen/scripts.h | 2 |
2 files changed, 15 insertions, 3 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 diff --git a/engines/xeen/scripts.h b/engines/xeen/scripts.h index 2924d43b7e..862c54d229 100644 --- a/engines/xeen/scripts.h +++ b/engines/xeen/scripts.h @@ -165,7 +165,7 @@ private: void cmdConfirmWord(Common::Array<byte> ¶ms); void cmdDamage(Common::Array<byte> ¶ms); void cmdJumpRnd(Common::Array<byte> ¶ms); - void cmdAfterEvent(Common::Array<byte> ¶ms); + void cmdAlterEvent(Common::Array<byte> ¶ms); void cmdCallEvent(Common::Array<byte> ¶ms); void cmdReturn(Common::Array<byte> ¶ms); void cmdSetVar(Common::Array<byte> ¶ms); |