diff options
author | Torbjörn Andersson | 2005-10-08 09:59:36 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2005-10-08 09:59:36 +0000 |
commit | c4752fc320456f264042677968362fddf2253fcd (patch) | |
tree | 0599d5b5377c4d504b9f5cd73f549c98c72362ec | |
parent | a202b15062e3f5dc8754f94526bc6a179b70c1d1 (diff) | |
download | scummvm-rg350-c4752fc320456f264042677968362fddf2253fcd.tar.gz scummvm-rg350-c4752fc320456f264042677968362fddf2253fcd.tar.bz2 scummvm-rg350-c4752fc320456f264042677968362fddf2253fcd.zip |
Added/stubbed some Feeble opcodes, and fixed a regression that made it
impossible to load old (and probably new, for that matter) Simon savegames.
svn-id: r18958
-rw-r--r-- | simon/items.cpp | 68 | ||||
-rw-r--r-- | simon/saveload.cpp | 26 | ||||
-rw-r--r-- | simon/simon.h | 2 |
3 files changed, 90 insertions, 6 deletions
diff --git a/simon/items.cpp b/simon/items.cpp index 5869749ea6..f777cb679b 100644 --- a/simon/items.cpp +++ b/simon/items.cpp @@ -1078,6 +1078,74 @@ int SimonEngine::runScript() { } break; + // Feeble opcodes + case 191: + warning("STUB: script opcode 191"); + if (_bitArray[5] & 0x0008) { + // Clear some variables + } else { + // Clear some other variables + } + break; + + case 192:{ + uint a = getVarOrByte(); + uint b = getVarOrByte(); + uint c = getVarOrByte(); + uint d = getVarOrByte(); + if (_bitArray[5] & 0x0008) { + // Set some variables + } else { + // Set some other variables + } + warning("STUB: script opcode 192 (%d, %d, %d, %d)", a, b, c, d); + } + break; + + case 193: + // pause clock + warning("STUB: script opcode 193"); + break; + + case 194: + // resume clock + warning("STUB: script opcode 194"); + break; + + case 195:{ + // Set palette colour? + uint blue = getVarOrByte(); + uint green = getVarOrByte(); + uint red = getVarOrByte(); + uint color = getVarOrByte(); + warning("STUB: script opcode 195 (%d, %d, %d, %d)", blue, green, red, color); + } + break; + + case 196:{ /* set bit3 */ + uint bit = getVarOrByte(); + _bitArray[(bit >> 4) + 32] |= 1 << (bit & 15); + } + break; + + case 197:{ /* clear bit3 */ + uint bit = getVarOrByte(); + _bitArray[(bit >> 4) + 32] &= ~(1 << (bit & 15)); + } + break; + + case 198:{ /* is bit3 clear */ + uint bit = getVarOrByte(); + condition = (_bitArray[(bit >> 4) + 32] & (1 << (bit & 15))) == 0; + } + break; + + case 199:{ /* is bit3 set */ + uint bit = getVarOrByte(); + condition = (_bitArray[(bit >> 4) + 32] & (1 << (bit & 15))) != 0; + } + break; + default: invalid_opcode:; error("Invalid opcode '%d'", opcode); diff --git a/simon/saveload.cpp b/simon/saveload.cpp index 4cee4631f0..c351fba420 100644 --- a/simon/saveload.cpp +++ b/simon/saveload.cpp @@ -412,7 +412,11 @@ bool SimonEngine::save_game(uint slot, char *caption) { return false; } - f->write(caption, 0x12); + if (_game == GAME_FEEBLEFILES) { + f->write(caption, 100); + } else { + f->write(caption, 18); + } f->writeUint32BE(_itemArrayInited - 1); f->writeUint32BE(0xFFFFFFFF); @@ -477,6 +481,12 @@ bool SimonEngine::save_game(uint slot, char *caption) { for (i = 0; i != 32; i++) f->writeUint16BE(_bitArray[i]); + // Write the bits in array 3 + if (_game == GAME_FEEBLEFILES) { + for (i = 33; i != 48; i++) + f->writeUint16BE(_bitArray[i]); + } + delete f; _lockWord &= ~0x100; @@ -514,9 +524,9 @@ bool SimonEngine::load_game(uint slot) { } if (_game == GAME_FEEBLEFILES) { - f->read(ident, 18); - } else { f->read(ident, 100); + } else { + f->read(ident, 18); } num = f->readUint32BE(); @@ -590,15 +600,21 @@ bool SimonEngine::load_game(uint slot) { writeVariable(i, f->readUint16BE()); } - // write the items in array 6 + // read the items in array 6 for (i = 0; i != 10; i++) { _itemArray6[i] = derefItem(f->readUint16BE()); } - // Write the bits in array 1 & 2 + // Read the bits in array 1 & 2 for (i = 0; i != 32; i++) _bitArray[i] = f->readUint16BE(); + // Read the bits in array 3 + if (_game == GAME_FEEBLEFILES) { + for (i = 33; i != 48; i++) + _bitArray[i] = f->readUint16BE(); + } + if (f->ioFailed()) { error("load failed"); } diff --git a/simon/simon.h b/simon/simon.h index 840ac946a9..4e503028a4 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -304,7 +304,7 @@ protected: uint16 _stringIdArray3[20]; uint16 _speechIdArray4[20]; - uint16 _bitArray[32]; + uint16 _bitArray[48]; int16 _variableArray[256]; FillOrCopyStruct *_fcsPtrArray3[8]; |