diff options
author | Paul Gilbert | 2014-08-09 19:18:10 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-09 19:18:10 -0400 |
commit | 33f432d9891fd07a9d8d6130ef76a8bb14b13a4b (patch) | |
tree | 3fa25f034450aa06c9c3659cc608a5d62f539de0 | |
parent | 127a0eeadd16719e212c19d7938158d75f51568e (diff) | |
download | scummvm-rg350-33f432d9891fd07a9d8d6130ef76a8bb14b13a4b.tar.gz scummvm-rg350-33f432d9891fd07a9d8d6130ef76a8bb14b13a4b.tar.bz2 scummvm-rg350-33f432d9891fd07a9d8d6130ef76a8bb14b13a4b.zip |
ACCESS: Fix skipping bytes in executeScript method
-rw-r--r-- | engines/access/scripts.cpp | 11 | ||||
-rw-r--r-- | engines/access/scripts.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp index 66b16e9826..dc3c62a9c1 100644 --- a/engines/access/scripts.cpp +++ b/engines/access/scripts.cpp @@ -70,8 +70,8 @@ int Scripts::executeScript() { do { // Get next command, skipping over script start start if it's being pointed to - for (_scriptCommand = _data->readByte(); _scriptCommand == SCRIPT_START_BYTE; - _data->skip(2)); + while ((_scriptCommand = _data->readByte()) == SCRIPT_START_BYTE) + _data->skip(2); assert(_scriptCommand >= 0x80); executeCommand(_scriptCommand - 0x80); @@ -86,7 +86,7 @@ void Scripts::executeCommand(int commandIndex) { &Scripts::cmdJumpHelp, &Scripts::cmdJumpGet, &Scripts::cmdJumpMove, &Scripts::cmdJumpUse, &Scripts::cmdJumpTalk, &Scripts::cmdNull, &Scripts::CMDPRINT, &Scripts::cmdRetPos, &Scripts::CMDANIM, - &Scripts::cmdSetFlag, &Scripts::CMDCHECKFLAG, &Scripts::cmdGoto, + &Scripts::cmdSetFlag, &Scripts::cmdCheckFlag, &Scripts::cmdGoto, &Scripts::cmdSetInventory, &Scripts::cmdSetInventory, &Scripts::cmdCheckInventory, &Scripts::CMDSETTEX, &Scripts::CMDNEWROOM, &Scripts::CMDCONVERSE, &Scripts::CMDCHECKFRAME, &Scripts::CMDCHECKANIM, &Scripts::CMDSND, @@ -176,15 +176,16 @@ void Scripts::cmdSetFlag() { int flagNum = _data->readByte(); byte flagVal = _data->readByte(); + assert(flagNum < 256); _vm->_flags[flagNum] = flagVal; } -void Scripts::CMDCHECKFLAG() { +void Scripts::cmdCheckFlag() { int flagNum = _data->readUint16LE(); int flagVal = _data->readUint16LE(); assert(flagNum < 100); - if (_vm->_flags[flagNum] == (flagVal & 0xff)) + if (_vm->_flags[flagNum] == flagVal) cmdGoto(); else _data->skip(2); diff --git a/engines/access/scripts.h b/engines/access/scripts.h index 6bf69c4ee3..30bffe8112 100644 --- a/engines/access/scripts.h +++ b/engines/access/scripts.h @@ -54,7 +54,7 @@ protected: void cmdRetPos(); void CMDANIM(); void cmdSetFlag(); - void CMDCHECKFLAG(); + void cmdCheckFlag(); /** * Jump to another script |