ILLUSIONS: DUCKMAN: Implement opcode 85 and 86, actual save/load not implemented yet

This commit is contained in:
johndoe123 2015-11-28 23:58:00 +01:00 committed by Eugene Sandulenko
parent bbbb0053e0
commit 9a84c0a62e
4 changed files with 53 additions and 2 deletions

View File

@ -1107,4 +1107,34 @@ uint32 IllusionsEngine_Duckman::runTriggerCause(uint32 verbId, uint32 objectId2,
return tempThreadId; return tempThreadId;
} }
bool IllusionsEngine_Duckman::loadSavegame(int16 slotNum, uint32 callingThreadId) {
#if 0
// TODO
bool success = _gameStates->load(slotNum);
if (success) {
_vm->_screen->setDisplayOn(false);
uint32 currSceneId = getCurrentScene();
if (currSceneId != 0x10003)
dumpCurrSceneFiles(currSceneId, callerThreadId);
reset();
stopMidi();
clearMidiPlayList();
_gameStates->readStates();
pushActiveScene(0x10000);
}
_gameStates->freeGameStateReadBuffer();
return success;
#endif
return true;
}
bool IllusionsEngine_Duckman::saveSavegame(int16 slotNum, uint32 callingThreadId) {
#if 0
// TODO
bool success = _gameStates->save(slotNum);
return success;
#endif
return true;
}
} // End of namespace Illusions } // End of namespace Illusions

View File

@ -185,6 +185,9 @@ public:
void playSoundEffect(int index); void playSoundEffect(int index);
bool getTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &outThreadId); bool getTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId, uint32 &outThreadId);
uint32 runTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId); uint32 runTriggerCause(uint32 verbId, uint32 objectId2, uint32 objectId);
bool loadSavegame(int16 slotNum, uint32 callingThreadId);
bool saveSavegame(int16 slotNum, uint32 callingThreadId);
}; };

View File

@ -130,8 +130,8 @@ void ScriptOpcodes_Duckman::initOpcodes() {
OPCODE(82, opSwitchMenuChoice); OPCODE(82, opSwitchMenuChoice);
OPCODE(83, opQuitGame); OPCODE(83, opQuitGame);
OPCODE(84, opResetGame); OPCODE(84, opResetGame);
// TODO OPCODE(85, ); OPCODE(85, opLoadGame);
// TODO OPCODE(86, ); OPCODE(86, opSaveGame);
OPCODE(87, opDeactivateButton); OPCODE(87, opDeactivateButton);
OPCODE(88, opActivateButton); OPCODE(88, opActivateButton);
// 89-95 unused // 89-95 unused
@ -711,6 +711,22 @@ void ScriptOpcodes_Duckman::opResetGame(ScriptThread *scriptThread, OpCall &opCa
// TODO _vm->_gameStates->clear(); // TODO _vm->_gameStates->clear();
} }
void ScriptOpcodes_Duckman::opLoadGame(ScriptThread *scriptThread, OpCall &opCall) {
ARG_SKIP(2);
ARG_INT16(bankNum)
ARG_INT16(slotNum)
bool success = _vm->loadSavegame(slotNum, opCall._callerThreadId);
_vm->_stack->push(success ? 1 : 0);
}
void ScriptOpcodes_Duckman::opSaveGame(ScriptThread *scriptThread, OpCall &opCall) {
ARG_SKIP(2);
ARG_INT16(bankNum)
ARG_INT16(slotNum)
bool success = _vm->saveSavegame(slotNum, opCall._callerThreadId);
_vm->_stack->push(success ? 1 : 0);
}
void ScriptOpcodes_Duckman::opDeactivateButton(ScriptThread *scriptThread, OpCall &opCall) { void ScriptOpcodes_Duckman::opDeactivateButton(ScriptThread *scriptThread, OpCall &opCall) {
ARG_INT16(button) ARG_INT16(button)
_vm->_input->deactivateButton(button); _vm->_input->deactivateButton(button);

View File

@ -105,6 +105,8 @@ protected:
void opSwitchMenuChoice(ScriptThread *scriptThread, OpCall &opCall); void opSwitchMenuChoice(ScriptThread *scriptThread, OpCall &opCall);
void opQuitGame(ScriptThread *scriptThread, OpCall &opCall); void opQuitGame(ScriptThread *scriptThread, OpCall &opCall);
void opResetGame(ScriptThread *scriptThread, OpCall &opCall); void opResetGame(ScriptThread *scriptThread, OpCall &opCall);
void opLoadGame(ScriptThread *scriptThread, OpCall &opCall);
void opSaveGame(ScriptThread *scriptThread, OpCall &opCall);
void opDeactivateButton(ScriptThread *scriptThread, OpCall &opCall); void opDeactivateButton(ScriptThread *scriptThread, OpCall &opCall);
void opActivateButton(ScriptThread *scriptThread, OpCall &opCall); void opActivateButton(ScriptThread *scriptThread, OpCall &opCall);
void opIncBlockCounter(ScriptThread *scriptThread, OpCall &opCall); void opIncBlockCounter(ScriptThread *scriptThread, OpCall &opCall);