From d8e86249c7fef61e42dab54df3570b4c8d49c557 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Thu, 3 Dec 2015 10:21:52 +0100 Subject: ILLUSIONS: DUCKMAN: Implement special opcode 16001A --- engines/illusions/duckman/duckman_specialcode.cpp | 29 ++++++++++++++++++++++ engines/illusions/duckman/duckman_specialcode.h | 10 ++++---- engines/illusions/duckman/illusions_duckman.cpp | 8 +++++- .../illusions/duckman/scriptopcodes_duckman.cpp | 3 ++- 4 files changed, 43 insertions(+), 7 deletions(-) (limited to 'engines/illusions/duckman') diff --git a/engines/illusions/duckman/duckman_specialcode.cpp b/engines/illusions/duckman/duckman_specialcode.cpp index 6b67f1214f..b0b859c30e 100644 --- a/engines/illusions/duckman/duckman_specialcode.cpp +++ b/engines/illusions/duckman/duckman_specialcode.cpp @@ -41,6 +41,8 @@ DuckmanSpecialCode::DuckmanSpecialCode(IllusionsEngine_Duckman *vm) _propertyTimers = new PropertyTimers(_vm); _inventory = new DuckmanInventory(_vm); + _wasCursorHoldingElvisPoster = false; + _counter = 0; } DuckmanSpecialCode::~DuckmanSpecialCode() { @@ -69,6 +71,7 @@ void DuckmanSpecialCode::init() { SPECIAL(0x00160012, spcStopScreenShaker); SPECIAL(0x00160013, spcIncrCounter); SPECIAL(0x00160014, spcUpdateObject272Sequence); + SPECIAL(0x0016001A, spcHoldGlowingElvisPoster); SPECIAL(0x0016001C, spcSetCursorInventoryMode); SPECIAL(0x0016001D, spcCenterCurrentScreenText); SPECIAL(0x0016001E, spcSetDefaultTextCoords); @@ -283,6 +286,32 @@ void DuckmanSpecialCode::spcUpdateObject272Sequence(OpCall &opCall) { control->startSequenceActor(sequenceId, 2, opCall._threadId); } +void DuckmanSpecialCode::spcHoldGlowingElvisPoster(OpCall &opCall) { + const uint32 kPosterObjectId = 0x40072; + const uint32 kPosterSequenceId = 0x60034; + ARG_BYTE(mode); + switch (mode) { + case 0: + if (_vm->_cursor._objectId == kPosterObjectId) { + _wasCursorHoldingElvisPoster = true; + _inventory->addInventoryItem(_vm->_cursor._objectId); + _vm->stopCursorHoldingObject(); + } else { + _wasCursorHoldingElvisPoster = false; + } + break; + case 1: + if (_wasCursorHoldingElvisPoster) { + _inventory->clearInventorySlot(kPosterObjectId); + _vm->_cursor._objectId = kPosterObjectId; + _vm->_cursor._sequenceId2 = kPosterSequenceId; + _vm->_cursor._field14[_vm->_cursor._actorIndex - 1] = true; + } + break; + } + _vm->notifyThreadId(opCall._threadId); +} + void DuckmanSpecialCode::spcSetCursorInventoryMode(OpCall &opCall) { ARG_BYTE(mode); ARG_BYTE(value); diff --git a/engines/illusions/duckman/duckman_specialcode.h b/engines/illusions/duckman/duckman_specialcode.h index b8bf79c929..83430a49ba 100644 --- a/engines/illusions/duckman/duckman_specialcode.h +++ b/engines/illusions/duckman/duckman_specialcode.h @@ -48,15 +48,14 @@ public: IllusionsEngine_Duckman *_vm; SpecialCodeMap _specialCodeMap; + PropertyTimers *_propertyTimers; + DuckmanInventory *_inventory; + uint _chinesePuzzleIndex; byte _chinesePuzzleAnswers[3]; - Common::Point _teleporterPosition; - - PropertyTimers *_propertyTimers; - DuckmanInventory *_inventory; - int16 _counter; + bool _wasCursorHoldingElvisPoster; // Special code interface functions void runSpecialCode(uint32 specialCodeId, OpCall &opCall); @@ -76,6 +75,7 @@ public: void spcStopScreenShaker(OpCall &opCall); void spcIncrCounter(OpCall &opCall); void spcUpdateObject272Sequence(OpCall &opCall); + void spcHoldGlowingElvisPoster(OpCall &opCall); void spcSetCursorInventoryMode(OpCall &opCall); void spcCenterCurrentScreenText(OpCall &opCall); void spcSetDefaultTextCoords(OpCall &opCall); diff --git a/engines/illusions/duckman/illusions_duckman.cpp b/engines/illusions/duckman/illusions_duckman.cpp index 4f21e6bb17..8df01a8f6e 100644 --- a/engines/illusions/duckman/illusions_duckman.cpp +++ b/engines/illusions/duckman/illusions_duckman.cpp @@ -167,11 +167,17 @@ Common::Error IllusionsEngine_Duckman::run() { _scriptResource->_properties.set(0x000E0024, true); #endif -#if 1 +#if 0 // DEBUG Enterprise _scriptResource->_blockCounters.set(238, 1); #endif +#if 1 + // DEBUG Map / special code 0016001A + _scriptResource->_properties.set(0x000E0017, true); + _scriptResource->_properties.set(0x000E0022, false); +#endif + while (!shouldQuit()) { runUpdateFunctions(); _system->updateScreen(); diff --git a/engines/illusions/duckman/scriptopcodes_duckman.cpp b/engines/illusions/duckman/scriptopcodes_duckman.cpp index 60256b972f..263c27fb9a 100644 --- a/engines/illusions/duckman/scriptopcodes_duckman.cpp +++ b/engines/illusions/duckman/scriptopcodes_duckman.cpp @@ -274,7 +274,8 @@ void ScriptOpcodes_Duckman::opUnloadResourcesBySceneId(ScriptThread *scriptThrea //static uint dsceneId = 0x0001005B, dthreadId = 0x00020341; //static uint dsceneId = 0x00010010, dthreadId = 0x0002008A; //static uint dsceneId = 0x10002, dthreadId = 0x20001;//Debug menu, not supported -static uint dsceneId = 0x10044, dthreadId = 0x000202B8; // Starship Enterprise +//static uint dsceneId = 0x10044, dthreadId = 0x000202B8; // Starship Enterprise +static uint dsceneId = 0x00010039, dthreadId = 0x00020089; void ScriptOpcodes_Duckman::opChangeScene(ScriptThread *scriptThread, OpCall &opCall) { ARG_SKIP(2); -- cgit v1.2.3