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
This commit is contained in:
Torbjörn Andersson 2005-10-08 09:59:36 +00:00
parent a202b15062
commit c4752fc320
3 changed files with 90 additions and 6 deletions

View File

@ -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);

View File

@ -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");
}

View File

@ -304,7 +304,7 @@ protected:
uint16 _stringIdArray3[20];
uint16 _speechIdArray4[20];
uint16 _bitArray[32];
uint16 _bitArray[48];
int16 _variableArray[256];
FillOrCopyStruct *_fcsPtrArray3[8];