diff options
author | johndoe123 | 2014-04-02 10:53:40 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-07-20 06:43:33 +0000 |
commit | 8d7d6599b9bc29152cbccbcec6b2e25b66272715 (patch) | |
tree | f8c0edc525b3429911463405bac7cc7171a42148 /engines/illusions/bbdou | |
parent | 7dc8533f730645e7177bbdc4d214664d82856963 (diff) | |
download | scummvm-rg350-8d7d6599b9bc29152cbccbcec6b2e25b66272715.tar.gz scummvm-rg350-8d7d6599b9bc29152cbccbcec6b2e25b66272715.tar.bz2 scummvm-rg350-8d7d6599b9bc29152cbccbcec6b2e25b66272715.zip |
ILLUSIONS: Fix special code functions thread notifying (used wrong thread value)
- Add more script and sequence opcodes
Diffstat (limited to 'engines/illusions/bbdou')
-rw-r--r-- | engines/illusions/bbdou/bbdou_specialcode.cpp | 69 | ||||
-rw-r--r-- | engines/illusions/bbdou/bbdou_specialcode.h | 11 |
2 files changed, 70 insertions, 10 deletions
diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp index a3a3149e03..f4c23bb97a 100644 --- a/engines/illusions/bbdou/bbdou_specialcode.cpp +++ b/engines/illusions/bbdou/bbdou_specialcode.cpp @@ -105,6 +105,8 @@ void BbdouSpecialCode::init() { SPECIAL(0x0016001E, spcRemoveInventoryItem); SPECIAL(0x0016001F, spcHasInventoryItem); SPECIAL(0x00160025, spcCloseInventory); + SPECIAL(0x00160037, spcIsCursorHoldingObjectId); + SPECIAL(0x0016003A, spcSaladCtl); } void BbdouSpecialCode::run(uint32 specialCodeId, OpCall &opCall) { @@ -113,7 +115,7 @@ void BbdouSpecialCode::run(uint32 specialCodeId, OpCall &opCall) { (*(*it)._value)(opCall); } else { debug("BbdouSpecialCode::run() Unimplemented special code %08X", specialCodeId); - _vm->notifyThreadId(opCall._callerThreadId); + _vm->notifyThreadId(opCall._threadId); } } @@ -129,19 +131,19 @@ void BbdouSpecialCode::spcInitCursor(OpCall &opCall) { ARG_UINT32(progResKeywordId); _cursor->init(objectId, progResKeywordId); setCursorControlRoutine(objectId, 0); - _vm->notifyThreadId(opCall._callerThreadId); + _vm->notifyThreadId(opCall._threadId); } void BbdouSpecialCode::spcEnableCursor(OpCall &opCall) { ARG_UINT32(objectId); _cursor->enable(objectId); - _vm->notifyThreadId(opCall._callerThreadId); + _vm->notifyThreadId(opCall._threadId); } void BbdouSpecialCode::spcDisableCursor(OpCall &opCall) { ARG_UINT32(objectId); _cursor->disable(objectId); - _vm->notifyThreadId(opCall._callerThreadId); + _vm->notifyThreadId(opCall._threadId); } void BbdouSpecialCode::spcAddCursorSequence(OpCall &opCall) { @@ -149,7 +151,7 @@ void BbdouSpecialCode::spcAddCursorSequence(OpCall &opCall) { ARG_UINT32(objectId); ARG_UINT32(sequenceId); _cursor->addCursorSequence(objectId, sequenceId); - _vm->notifyThreadId(opCall._callerThreadId); + _vm->notifyThreadId(opCall._threadId); } void BbdouSpecialCode::spcCursorStartHoldingObjectId(OpCall &opCall) { @@ -157,7 +159,7 @@ void BbdouSpecialCode::spcCursorStartHoldingObjectId(OpCall &opCall) { ARG_UINT32(holdingObjectId); ARG_INT16(doPlaySound); startHoldingObjectId(objectId, holdingObjectId, doPlaySound != 0); - _vm->notifyThreadId(opCall._callerThreadId); + _vm->notifyThreadId(opCall._threadId); } void BbdouSpecialCode::spcCursorStopHoldingObjectId(OpCall &opCall) { @@ -165,12 +167,12 @@ void BbdouSpecialCode::spcCursorStopHoldingObjectId(OpCall &opCall) { ARG_INT16(doPlaySound); stopHoldingObjectId(objectId, doPlaySound != 0); _cursor->_data._mode = 1; - _vm->notifyThreadId(opCall._callerThreadId); + _vm->notifyThreadId(opCall._threadId); } void BbdouSpecialCode::spcInitBubble(OpCall &opCall) { _bubble->init(); - _vm->notifyThreadId(opCall._callerThreadId); + _vm->notifyThreadId(opCall._threadId); } void BbdouSpecialCode::spcSetupBubble(OpCall &opCall) { @@ -181,7 +183,7 @@ void BbdouSpecialCode::spcSetupBubble(OpCall &opCall) { ARG_INT16(count); _bubble->addItem0(sequenceId1, sequenceId2, progResKeywordId, namedPointId, count, (uint32*)opCall._code); - _vm->notifyThreadId(opCall._callerThreadId); + _vm->notifyThreadId(opCall._threadId); } void BbdouSpecialCode::spcSetObjectInteractMode(OpCall &opCall) { @@ -189,7 +191,7 @@ void BbdouSpecialCode::spcSetObjectInteractMode(OpCall &opCall) { ARG_UINT32(objectId); ARG_INT16(value); _cursor->setStruct8bsValue(objectId, value); - _vm->notifyThreadId(opCall._callerThreadId); + _vm->notifyThreadId(opCall._threadId); } void BbdouSpecialCode::spcRegisterInventoryBag(OpCall &opCall) { @@ -225,12 +227,33 @@ void BbdouSpecialCode::spcRemoveInventoryItem(OpCall &opCall) { void BbdouSpecialCode::spcHasInventoryItem(OpCall &opCall) { ARG_UINT32(objectId); _vm->_scriptMan->_stack.push(_inventory->hasInventoryItem(objectId) ? 1 : 0); +debug("_inventory->hasInventoryItem(%08X) = %d", objectId, _inventory->hasInventoryItem(objectId)); } void BbdouSpecialCode::spcCloseInventory(OpCall &opCall) { _inventory->close(); } +void BbdouSpecialCode::spcIsCursorHoldingObjectId(OpCall &opCall) { + ARG_UINT32(cursorObjectId); + ARG_UINT32(objectId); + _vm->_scriptMan->_stack.push(isHoldingObjectId(objectId) ? 1 : 0); + _vm->notifyThreadId(opCall._threadId); +} + +void BbdouSpecialCode::spcSaladCtl(OpCall &opCall) { + ARG_UINT32(cmd); + ARG_UINT32(sequenceId); + switch (cmd) { + case 1: + initSalad(); + break; + case 2: + addSalad(sequenceId); + break; + } +} + void BbdouSpecialCode::playSoundEffect(int soundIndex) { static const uint32 kSoundEffectIds[] = { 0, 1, @@ -644,4 +667,30 @@ void BbdouSpecialCode::stopHoldingObjectId(uint32 objectId1, bool doPlaySound) { _inventory->putBackInventoryItem(holdingObjectId, control->_actor->_position); } +bool BbdouSpecialCode::isHoldingObjectId(uint32 objectId) { + return _cursor->_data._holdingObjectId == objectId; +} + +void BbdouSpecialCode::initSalad() { + for (uint i = 0; i < 12; ++i) { + _saladObjectIds[i] = _vm->_controls->newTempObjectId(); + _vm->_controls->placeActor(0x00050192, Common::Point(0, 0), 0x00060C26, _saladObjectIds[i], 0); + } + _saladCount = 0; +} + +void BbdouSpecialCode::addSalad(uint32 sequenceId) { + if (_saladCount >= 12) { + Control *control = _vm->_dict->getObjectControl(_saladObjectIds[_saladCount - 1]); + control->unlinkObject(); + } else { + ++_saladCount; + } + Control *control = _vm->_dict->getObjectControl(_saladObjectIds[_saladCount - 1]); + control->linkToObject(0x00040309, _saladCount); + control->startSequenceActor(sequenceId, 2, 0); + control->setPriority(_saladCount + 9); + control->deactivateObject(); +} + } // End of namespace Illusions diff --git a/engines/illusions/bbdou/bbdou_specialcode.h b/engines/illusions/bbdou/bbdou_specialcode.h index 734e8e8755..f272193bd7 100644 --- a/engines/illusions/bbdou/bbdou_specialcode.h +++ b/engines/illusions/bbdou/bbdou_specialcode.h @@ -76,6 +76,11 @@ public: BbdouCursor *_cursor; BbdouBubble *_bubble; BbdouInventory *_inventory; + + // Salad + uint _saladCount; + uint32 _saladObjectIds[12]; + // Special code interface functions void spcInitCursor(OpCall &opCall); void spcEnableCursor(OpCall &opCall); @@ -94,11 +99,14 @@ public: void spcRemoveInventoryItem(OpCall &opCall); void spcHasInventoryItem(OpCall &opCall); void spcCloseInventory(OpCall &opCall); + void spcIsCursorHoldingObjectId(OpCall &opCall); + void spcSaladCtl(OpCall &opCall); void playSoundEffect(int soundIndex); void resetItem10(uint32 objectId, Item10 *item10); void startHoldingObjectId(uint32 objectId1, uint32 holdingObjectId, bool doPlaySound); void stopHoldingObjectId(uint32 objectId1, bool doPlaySound); + bool isHoldingObjectId(uint32 objectId); protected: // Internal functions @@ -116,6 +124,9 @@ protected: bool runCause(Control *cursorControl, CursorData &cursorData, uint32 verbId, uint32 objectId2, uint32 objectId, int soundIndex); uint32 startCauseThread(uint32 cursorObjectId, uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId); + // Salad + void initSalad(); + void addSalad(uint32 sequenceId); }; } // End of namespace Illusions |