diff options
author | Paul Gilbert | 2015-01-24 19:38:58 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-01-24 19:38:58 -0500 |
commit | fe6b580ff11e3ee7b518e478f20a5a7423afb425 (patch) | |
tree | 2614a9186823a9300371e438b85eaaa5d0fa46ee | |
parent | 0d8d66cb82c4b6236af4b05e36f5a69461597580 (diff) | |
download | scummvm-rg350-fe6b580ff11e3ee7b518e478f20a5a7423afb425.tar.gz scummvm-rg350-fe6b580ff11e3ee7b518e478f20a5a7423afb425.tar.bz2 scummvm-rg350-fe6b580ff11e3ee7b518e478f20a5a7423afb425.zip |
XEEN: Implement cmdCheckProtection and cmdAlterEvent opcodes
-rw-r--r-- | engines/xeen/scripts.cpp | 38 | ||||
-rw-r--r-- | engines/xeen/scripts.h | 4 |
2 files changed, 36 insertions, 6 deletions
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 6df53450d6..5abd63a77e 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -178,7 +178,7 @@ void Scripts::doOpcode(MazeEvent &event) { &Scripts::cmdAlterHed, &Scripts::cmdDisplayStat, &Scripts::cmdTakeOrGive, &Scripts::cmdSeatTextSml, &Scripts::cmdPlayEventVoc, &Scripts::cmdDisplayBottom, &Scripts::cmdIfMapFlag, &Scripts::cmdSelRndChar, &Scripts::cmdGiveEnchanted, - &Scripts::cmdItemType, &Scripts::cmdMakeNothingHere, &Scripts::cmdNoAction2, + &Scripts::cmdItemType, &Scripts::cmdMakeNothingHere, &Scripts::cmdCheckProtection, &Scripts::cmdChooseNumeric, &Scripts::cmdDisplayBottomTwoLines, &Scripts::cmdDisplayLarge, &Scripts::cmdExchObj, &Scripts::cmdFallToMap, &Scripts::cmdDisplayMain, &Scripts::cmdGoto, &Scripts::cmdConfirmWord, @@ -534,7 +534,25 @@ void Scripts::cmdJumpRnd(Common::Array<byte> ¶ms) { cmdNoAction(params); } -void Scripts::cmdAlterEvent(Common::Array<byte> ¶ms) { error("TODO"); } +/** + * Alter an existing event + */ +void Scripts::cmdAlterEvent(Common::Array<byte> ¶ms) { + Map &map = *_vm->_map; + Party &party = *_vm->_party; + + for (uint idx = 0; idx < map._events.size(); ++idx) { + MazeEvent &evt = map._events[idx]; + if (evt._position == party._mazePosition && + (evt._direction == DIR_ALL || evt._direction == party._mazeDirection) && + evt._line == params[0]) { + evt._opcode = (Opcode)params[1]; + } + } + + _var4F = true; + cmdNoAction(params); +} /** * Stores the current location and line for later resuming, and set up to execute @@ -607,7 +625,13 @@ void Scripts::cmdMakeNothingHere(Common::Array<byte> ¶ms) { cmdExit(params); } -void Scripts::cmdNoAction2(Common::Array<byte> ¶ms) { error("TODO"); } +void Scripts::cmdCheckProtection(Common::Array<byte> ¶ms) { + if (copyProtectionCheck()) + cmdNoAction(params); + else + cmdExit(params); +} + void Scripts::cmdChooseNumeric(Common::Array<byte> ¶ms) { error("TODO"); } void Scripts::cmdDisplayBottomTwoLines(Common::Array<byte> ¶ms) { error("TODO"); } void Scripts::cmdDisplayLarge(Common::Array<byte> ¶ms) { error("TODO"); } @@ -907,8 +931,7 @@ bool Scripts::ifProc(int action, uint32 mask, int mode, int charIndex) { break; case 44: v = YesNo::show(_vm, mask, 0); - if (!mask && v) - v = 0; + v = (!v && !mask) ? 2 : mask; break; case 45: // Might base (before bonus) @@ -1101,4 +1124,9 @@ bool Scripts::ifProc(int action, uint32 mask, int mode, int charIndex) { } } +bool Scripts::copyProtectionCheck() { + // Currentl not implemented + return true; +} + } // End of namespace Xeen diff --git a/engines/xeen/scripts.h b/engines/xeen/scripts.h index 9725825513..66dcb9b70b 100644 --- a/engines/xeen/scripts.h +++ b/engines/xeen/scripts.h @@ -183,7 +183,7 @@ private: void cmdGiveEnchanted(Common::Array<byte> ¶ms); void cmdItemType(Common::Array<byte> ¶ms); void cmdMakeNothingHere(Common::Array<byte> ¶ms); - void cmdNoAction2(Common::Array<byte> ¶ms); + void cmdCheckProtection(Common::Array<byte> ¶ms); void cmdChooseNumeric(Common::Array<byte> ¶ms); void cmdDisplayBottomTwoLines(Common::Array<byte> ¶ms); void cmdDisplayLarge(Common::Array<byte> ¶ms); @@ -208,6 +208,8 @@ private: void doEnding(const Common::String &endStr, int v2); bool ifProc(int action, uint32 mask, int mode, int charIndex); + + bool copyProtectionCheck(); public: int _animCounter; bool _eventSkipped; |