diff options
-rw-r--r-- | engines/illusions/bbdou/bbdou_cursor.cpp | 117 | ||||
-rw-r--r-- | engines/illusions/bbdou/bbdou_cursor.h | 38 | ||||
-rw-r--r-- | engines/illusions/bbdou/bbdou_specialcode.cpp | 114 | ||||
-rw-r--r-- | engines/illusions/bbdou/bbdou_specialcode.h | 8 |
4 files changed, 135 insertions, 142 deletions
diff --git a/engines/illusions/bbdou/bbdou_cursor.cpp b/engines/illusions/bbdou/bbdou_cursor.cpp index 090c80946b..a6bc4a90ba 100644 --- a/engines/illusions/bbdou/bbdou_cursor.cpp +++ b/engines/illusions/bbdou/bbdou_cursor.cpp @@ -63,18 +63,18 @@ void BbdouCursor::init(uint32 objectId, uint32 progResKeywordId) { _data._causeThreadId2 = 0; _data._field90 = 0; _data._flags = 0; - _data._item10._field58 = 1; - _data._sequenceId98 = 0; + _data._verbState._minPriority = 1; + _data._currCursorTrackingSequenceId = 0; _data._idleCtr = 0; - _data._item10._verbId = 0x1B0000; - _data._item10._field0 = 1; - _data._item10._playSound48 = 0; - _data._item10._objectIds[0] = 0; - _data._item10._objectIds[1] = 0; - _data._item10._index = 0; - _data._item10._flag56 = 0; + _data._verbState._verbId = 0x1B0000; + _data._verbState._cursorState = 1; + _data._verbState._isBubbleVisible = 0; + _data._verbState._objectIds[0] = 0; + _data._verbState._objectIds[1] = 0; + _data._verbState._index = 0; + _data._verbState._flag56 = false; - clearCursorDataField14(); + resetActiveVerbs(); control->setActorIndexTo1(); @@ -99,7 +99,7 @@ void BbdouCursor::disable(uint32 objectId) { void BbdouCursor::reset(uint32 objectId) { Control *control = _vm->_dict->getObjectControl(objectId); - _data._item10._field0 = 1; + _data._verbState._cursorState = 1; _data._mode = 1; _data._mode2 = 0; _data._verbId1 = 0x1B0000; @@ -111,25 +111,25 @@ void BbdouCursor::reset(uint32 objectId) { _data._visibleCtr = 0; _data._causeThreadId1 = 0; _data._flags = 0; - _data._item10._field58 = 1; - _data._sequenceId98 = 0; + _data._verbState._minPriority = 1; + _data._currCursorTrackingSequenceId = 0; _data._idleCtr = 0; - _data._item10._verbId = 0x1B0000; - _data._item10._playSound48 = 0; - _data._item10._objectIds[0] = 0; - _data._item10._objectIds[1] = 0; - _data._item10._index = 0; - _data._item10._flag56 = 0; - clearCursorDataField14(); + _data._verbState._verbId = 0x1B0000; + _data._verbState._isBubbleVisible = 0; + _data._verbState._objectIds[0] = 0; + _data._verbState._objectIds[1] = 0; + _data._verbState._index = 0; + _data._verbState._flag56 = false; + resetActiveVerbs(); control->setActorIndexTo1(); control->startSequenceActor(0x60029, 2, 0); - _bbdou->resetItem10(control->_objectId, &_data._item10); + _bbdou->hideVerbBubble(control->_objectId, &_data._verbState); // TODO? control->_actor->setControlRoutine(new Common::Functor2Mem<Control*, uint32, void, BbdouCursor>(this, &BbdouCursor::cursorInteractControlRoutine)); } -void BbdouCursor::addCursorSequence(uint32 objectId, uint32 sequenceId) { +void BbdouCursor::addCursorSequenceId(uint32 objectId, uint32 sequenceId) { for (uint i = 0; i < kMaxCursorSequences; ++i) if (_cursorSequences[i]._objectId == 0) { _cursorSequences[i]._objectId = objectId; @@ -145,49 +145,48 @@ uint32 BbdouCursor::findCursorSequenceId(uint32 objectId) { return 0; } -void BbdouCursor::setStruct8bsValue(uint32 objectId, int value) { - // TODO Clean this up, preliminary - Struct8b *struct8b = 0; - for (uint i = 0; i < 512; ++i) - if (_cursorStruct8bs[i]._objectId == objectId) { - struct8b = &_cursorStruct8bs[i]; +void BbdouCursor::setObjectInteractMode(uint32 objectId, int value) { + ObjectInteractMode *objectInteractMode = 0; + for (uint i = 0; i < ARRAYSIZE(_objectVerbs); ++i) + if (_objectVerbs[i]._objectId == objectId) { + objectInteractMode = &_objectVerbs[i]; break; } - if (!struct8b) { - for (uint i = 0; i < 512; ++i) - if (_cursorStruct8bs[i]._objectId == 0) { - struct8b = &_cursorStruct8bs[i]; + if (!objectInteractMode) { + for (uint i = 0; i < ARRAYSIZE(_objectVerbs); ++i) + if (_objectVerbs[i]._objectId == 0) { + objectInteractMode = &_objectVerbs[i]; break; } } if (value != 11) { - struct8b->_objectId = objectId; - struct8b->_value = value; - } else if (struct8b->_objectId == objectId) { - struct8b->_objectId = 0; - struct8b->_value = 0; + objectInteractMode->_objectId = objectId; + objectInteractMode->_interactMode = value; + } else if (objectInteractMode->_objectId == objectId) { + objectInteractMode->_objectId = 0; + objectInteractMode->_interactMode = 0; } } -int BbdouCursor::findStruct8bsValue(uint32 objectId) { - for (uint i = 0; i < 512; ++i) - if (_cursorStruct8bs[i]._objectId == objectId) - return _cursorStruct8bs[i]._value; +int BbdouCursor::getObjectInteractMode(uint32 objectId) { + for (uint i = 0; i < ARRAYSIZE(_objectVerbs); ++i) + if (_objectVerbs[i]._objectId == objectId) + return _objectVerbs[i]._interactMode; return 11; } bool BbdouCursor::updateTrackingCursor(Control *control) { uint32 sequenceId; if (getTrackingCursorSequenceId(control, sequenceId)) { - if (_data._sequenceId98 != sequenceId) { + if (_data._currCursorTrackingSequenceId != sequenceId) { saveBeforeTrackingCursor(control, sequenceId); show(control); - _data._sequenceId98 = sequenceId; + _data._currCursorTrackingSequenceId = sequenceId; } return true; } else { - if (_data._sequenceId98) { - _data._sequenceId98 = 0; + if (_data._currCursorTrackingSequenceId) { + _data._currCursorTrackingSequenceId = 0; restoreAfterTrackingCursor(); show(control); } @@ -215,9 +214,9 @@ void BbdouCursor::saveBeforeTrackingCursor(Control *control, uint32 sequenceId) if (_data._mode == 3) restoreInfo(); control->setActorIndexTo1(); - if (_data._item10._playSound48) + if (_data._verbState._isBubbleVisible) _bbdou->playSoundEffect(4); - _bbdou->resetItem10(control->_objectId, &_data._item10); + _bbdou->hideVerbBubble(control->_objectId, &_data._verbState); } _data._currOverlappedObjectId = 0; if (_data._mode != 4) { @@ -240,7 +239,7 @@ void BbdouCursor::restoreAfterTrackingCursor() { _data._mode2 = 0; _data._sequenceId2 = 0; _data._holdingObjectId2 = 0; - _data._sequenceId98 = 0; + _data._currCursorTrackingSequenceId = 0; } uint32 BbdouCursor::getSequenceId1(int sequenceIndex) { @@ -360,17 +359,17 @@ bool BbdouCursor::getTrackingCursorSequenceId(Control *control, uint32 &outSeque return outSequenceId != 0; } -void BbdouCursor::clearCursorDataField14() { +void BbdouCursor::resetActiveVerbs() { for (uint i = 0; i < 32; ++i) - _data._item10._verbActive[i] = 0; - if (_data._item10._field0 == 1) { - _data._item10._verbActive[1] = 1; - _data._item10._verbActive[2] = 1; - _data._item10._verbActive[3] = 1; - _data._item10._verbActive[5] = 1; - } else if (_data._item10._field0 == 3) { - _data._item10._verbActive[1] = 1; - _data._item10._verbActive[2] = 1; + _data._verbState._verbActive[i] = false; + if (_data._verbState._cursorState == 1) { + _data._verbState._verbActive[1] = true; + _data._verbState._verbActive[2] = true; + _data._verbState._verbActive[3] = true; + _data._verbState._verbActive[5] = true; + } else if (_data._verbState._cursorState == 3) { + _data._verbState._verbActive[1] = true; + _data._verbState._verbActive[2] = true; } } @@ -384,7 +383,7 @@ void BbdouCursor::hide(uint32 objectId) { if (_data._visibleCtr == 0) { Control *control = _vm->_dict->getObjectControl(objectId); control->startSequenceActor(0x60029, 2, 0); - _bbdou->resetItem10(objectId, &_data._item10); + _bbdou->hideVerbBubble(objectId, &_data._verbState); _vm->_camera->popCameraMode(); } _vm->_input->discardAllEvents(); diff --git a/engines/illusions/bbdou/bbdou_cursor.h b/engines/illusions/bbdou/bbdou_cursor.h index 8f454b76cc..c3f023a5e9 100644 --- a/engines/illusions/bbdou/bbdou_cursor.h +++ b/engines/illusions/bbdou/bbdou_cursor.h @@ -30,18 +30,16 @@ namespace Illusions { class IllusionsEngine_BBDOU; class BbdouSpecialCode; class Control; -struct Item10; -struct Item10 { - int _field0; - int16 _verbActive[32]; +struct VerbState { + int _cursorState; + bool _verbActive[32]; uint32 _verbId; - int16 _playSound48; - //field_4A dw + bool _isBubbleVisible; uint32 _objectIds[2]; int16 _index; - int16 _flag56; - int _field58; + bool _flag56; + int _minPriority; }; struct CursorData { @@ -49,7 +47,7 @@ struct CursorData { int _mode2; uint32 _verbId1; uint32 _progResKeywordId; - Item10 _item10; + VerbState _verbState; uint32 _currOverlappedObjectId; uint32 _overlappedObjectId; uint32 _sequenceId; @@ -57,16 +55,12 @@ struct CursorData { uint32 _holdingObjectId; uint32 _holdingObjectId2; int _visibleCtr; - //field_86 dw uint32 _causeThreadId1; uint32 _causeThreadId2; int16 _field90; - //field_92 dw uint _flags; - uint32 _sequenceId98; + uint32 _currCursorTrackingSequenceId; int16 _idleCtr; - //field_9E db - //field_9F db }; struct CursorSequence { @@ -75,10 +69,10 @@ struct CursorSequence { CursorSequence() : _objectId(0), _sequenceId(0) {} }; -struct Struct8b { +struct ObjectInteractMode { uint32 _objectId; - int _value; - Struct8b() : _objectId(0), _value(0) {} + int _interactMode; + ObjectInteractMode() : _objectId(0), _interactMode(0) {} }; const uint kMaxCursorSequences = 100; @@ -91,10 +85,10 @@ public: void enable(uint32 objectId); void disable(uint32 objectId); void reset(uint32 objectId); - void addCursorSequence(uint32 objectId, uint32 sequenceId); + void addCursorSequenceId(uint32 objectId, uint32 sequenceId); uint32 findCursorSequenceId(uint32 objectId); - void setStruct8bsValue(uint32 objectId, int value); - int findStruct8bsValue(uint32 objectId); + void setObjectInteractMode(uint32 objectId, int value); + int getObjectInteractMode(uint32 objectId); bool updateTrackingCursor(Control *control); void saveInfo(); void restoreInfo(); @@ -110,8 +104,8 @@ public: Control *_control; CursorData _data; CursorSequence _cursorSequences[kMaxCursorSequences]; - Struct8b _cursorStruct8bs[512]; - void clearCursorDataField14(); + ObjectInteractMode _objectVerbs[512]; + void resetActiveVerbs(); void show(Control *control); void hide(uint32 objectId); }; diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp index 727be8eab3..540a31e1a0 100644 --- a/engines/illusions/bbdou/bbdou_specialcode.cpp +++ b/engines/illusions/bbdou/bbdou_specialcode.cpp @@ -200,7 +200,7 @@ void BbdouSpecialCode::spcAddCursorSequence(OpCall &opCall) { ARG_SKIP(4); ARG_UINT32(objectId); ARG_UINT32(sequenceId); - _cursor->addCursorSequence(objectId, sequenceId); + _cursor->addCursorSequenceId(objectId, sequenceId); _vm->notifyThreadId(opCall._threadId); } @@ -223,8 +223,8 @@ void BbdouSpecialCode::spcCursorStopHoldingObjectId(OpCall &opCall) { void BbdouSpecialCode::spcSetCursorState(OpCall &opCall) { ARG_UINT32(objectId); ARG_UINT32(newState); - _cursor->_data._item10._field0 = newState; - _cursor->clearCursorDataField14(); + _cursor->_data._verbState._cursorState = newState; + _cursor->resetActiveVerbs(); if (newState == 5) setCursorControlRoutine(objectId, 1); else @@ -252,7 +252,7 @@ void BbdouSpecialCode::spcSetObjectInteractMode(OpCall &opCall) { ARG_SKIP(4); ARG_UINT32(objectId); ARG_INT16(value); - _cursor->setStruct8bsValue(objectId, value); + _cursor->setObjectInteractMode(objectId, value); _vm->notifyThreadId(opCall._threadId); } @@ -466,13 +466,13 @@ void BbdouSpecialCode::playSoundEffect(int soundIndex) { } } -void BbdouSpecialCode::resetItem10(uint32 objectId, Item10 *item10) { - if (item10->_playSound48 == 1) { +void BbdouSpecialCode::hideVerbBubble(uint32 objectId, VerbState *verbState) { + if (verbState->_isBubbleVisible) { _bubble->hide(); - item10->_verbId = 0x1B0000; - item10->_playSound48 = 0; - item10->_objectIds[0] = 0; - item10->_objectIds[1] = 0; + verbState->_verbId = 0x1B0000; + verbState->_isBubbleVisible = false; + verbState->_objectIds[0] = 0; + verbState->_objectIds[1] = 0; } _vm->_input->discardAllEvents(); } @@ -499,7 +499,7 @@ Common::Point BbdouSpecialCode::getBackgroundCursorPos(Common::Point cursorPos) } void BbdouSpecialCode::showBubble(uint32 objectId, uint32 overlappedObjectId, uint32 holdingObjectId, - Item10 *item10, uint32 progResKeywordId) { + VerbState *verbState, uint32 progResKeywordId) { Common::Rect collisionRect; Control *overlappedControl, *control2, *control3; @@ -526,44 +526,44 @@ void BbdouSpecialCode::showBubble(uint32 objectId, uint32 overlappedObjectId, ui _bubble->setup(1, bubbleSourcePt, bubbleDestPt, progResKeywordId); - item10->_objectIds[0] = _bubble->addItem(0, 0x6005A); - item10->_objectIds[1] = _bubble->addItem(0, 0x6005A); - item10->_index = 0; + verbState->_objectIds[0] = _bubble->addItem(0, 0x6005A); + verbState->_objectIds[1] = _bubble->addItem(0, 0x6005A); + verbState->_index = 0; - int value = _cursor->findStruct8bsValue(overlappedControl->_objectId); + int value = _cursor->getObjectInteractMode(overlappedControl->_objectId); if (holdingObjectId) { - item10->_verbId = 0x1B0003; + verbState->_verbId = 0x1B0003; } else if (value == 9) { - item10->_verbId = 0x1B0005; + verbState->_verbId = 0x1B0005; } else if (value == 8) { - item10->_verbId = 0x1B0005; + verbState->_verbId = 0x1B0005; } else { - item10->_verbId = 0x1B0002; + verbState->_verbId = 0x1B0002; } - uint32 sequenceId = kStruct10s[item10->_verbId & 0xFFFF]._sequenceId2; + uint32 sequenceId = kStruct10s[verbState->_verbId & 0xFFFF]._sequenceId2; _bubble->show(); - control3 = _vm->_dict->getObjectControl(item10->_objectIds[0]); + control3 = _vm->_dict->getObjectControl(verbState->_objectIds[0]); control3->startSequenceActor(sequenceId, 2, 0); control3->appearActor(); control3->deactivateObject(); - item10->_playSound48 = 1; + verbState->_isBubbleVisible = true; _vm->_input->discardAllEvents(); } -bool BbdouSpecialCode::findVerbId(Item10 *item10, uint32 currOverlappedObjectId, int always0, uint32 &outVerbId) { - if (item10->_playSound48) { - int verbNum = item10->_verbId & 0xFFFF; +bool BbdouSpecialCode::findVerbId(VerbState *verbState, uint32 currOverlappedObjectId, int always0, uint32 &outVerbId) { + if (verbState->_isBubbleVisible) { + int verbNum = verbState->_verbId & 0xFFFF; int verbNumI = verbNum + 1; while (1) { if (verbNumI >= 32) verbNumI = 0; if (verbNumI++ == verbNum) break; - if (item10->_verbActive[verbNumI] && testVerbId(verbNumI | 0x1B0000, always0, currOverlappedObjectId)) { + if (verbState->_verbActive[verbNumI] && testVerbId(verbNumI | 0x1B0000, always0, currOverlappedObjectId)) { outVerbId = verbNumI | 0x1B0000; return true; } @@ -603,18 +603,18 @@ void BbdouSpecialCode::cursorInteractControlRoutine(Control *cursorControl, uint foundOverlapped = false; } else if (_vm->getCurrentScene() == 0x1000D) { foundOverlapped = _vm->_controls->getOverlappedObjectAccurate(cursorControl, cursorPos, - &overlappedControl, cursorData._item10._field58); + &overlappedControl, cursorData._verbState._minPriority); } else { foundOverlapped = _vm->_controls->getOverlappedObject(cursorControl, cursorPos, - &overlappedControl, cursorData._item10._field58); + &overlappedControl, cursorData._verbState._minPriority); } if (foundOverlapped) { if (overlappedControl->_objectId != cursorData._currOverlappedObjectId) { - if (cursorData._item10._playSound48) + if (cursorData._verbState._isBubbleVisible) playSoundEffect(4); - resetItem10(cursorControl->_objectId, &cursorData._item10); - int value = _cursor->findStruct8bsValue(overlappedControl->_objectId); + hideVerbBubble(cursorControl->_objectId, &cursorData._verbState); + int value = _cursor->getObjectInteractMode(overlappedControl->_objectId); if (!testValueRange(value)) { if (cursorData._mode == 3) _cursor->restoreInfo(); @@ -626,17 +626,17 @@ void BbdouSpecialCode::cursorInteractControlRoutine(Control *cursorControl, uint } if (value == 10) { if (cursorData._holdingObjectId) { - cursorData._item10._verbId = 0x1B0003; + cursorData._verbState._verbId = 0x1B0003; cursorData._currOverlappedObjectId = overlappedControl->_objectId; } else { - cursorData._item10._verbId = 0x1B0002; + cursorData._verbState._verbId = 0x1B0002; cursorData._currOverlappedObjectId = overlappedControl->_objectId; } } else { playSoundEffect(3); showBubble(cursorControl->_objectId, overlappedControl->_objectId, - cursorData._holdingObjectId, &cursorData._item10, + cursorData._holdingObjectId, &cursorData._verbState, cursorData._progResKeywordId); cursorData._currOverlappedObjectId = overlappedControl->_objectId; } @@ -644,7 +644,7 @@ void BbdouSpecialCode::cursorInteractControlRoutine(Control *cursorControl, uint if (cursorData._mode != 3) { _cursor->saveInfo(); cursorData._mode = 3; - cursorData._item10._verbId = 0x1B0006; + cursorData._verbState._verbId = 0x1B0006; cursorData._holdingObjectId = 0; } cursorData._sequenceId = _cursor->getSequenceId1(value); @@ -662,9 +662,9 @@ void BbdouSpecialCode::cursorInteractControlRoutine(Control *cursorControl, uint _cursor->restoreInfo(); _cursor->show(cursorControl); cursorControl->setActorIndexTo1(); - if (cursorData._item10._playSound48) + if (cursorData._verbState._isBubbleVisible) playSoundEffect(4); - resetItem10(cursorControl->_objectId, &cursorData._item10); + hideVerbBubble(cursorControl->_objectId, &cursorData._verbState); } cursorData._currOverlappedObjectId = 0; } @@ -685,8 +685,8 @@ void BbdouSpecialCode::cursorInteractControlRoutine(Control *cursorControl, uint } else if (cursorData._currOverlappedObjectId) { if (_vm->_input->pollEvent(kEventLeftClick)) { cursorData._idleCtr = 0; - if (runCause(cursorControl, cursorData, cursorData._item10._verbId, cursorData._holdingObjectId, cursorData._currOverlappedObjectId, 1)) { - resetItem10(cursorControl->_objectId, &cursorData._item10); + if (runCause(cursorControl, cursorData, cursorData._verbState._verbId, cursorData._holdingObjectId, cursorData._currOverlappedObjectId, 1)) { + hideVerbBubble(cursorControl->_objectId, &cursorData._verbState); cursorData._currOverlappedObjectId = 0; cursorControl->setActorIndexTo1(); } @@ -696,9 +696,9 @@ void BbdouSpecialCode::cursorInteractControlRoutine(Control *cursorControl, uint if (cursorData._holdingObjectId) { runCause(cursorControl, cursorData, 0x1B000B, 0, 0x40003, 0); cursorData._currOverlappedObjectId = 0; - } else if (findVerbId(&cursorData._item10, cursorData._currOverlappedObjectId, 0, verbId) && + } else if (findVerbId(&cursorData._verbState, cursorData._currOverlappedObjectId, 0, verbId) && runCause(cursorControl, cursorData, verbId, cursorData._holdingObjectId, cursorData._currOverlappedObjectId, 1)) { - resetItem10(cursorControl->_objectId, &cursorData._item10); + hideVerbBubble(cursorControl->_objectId, &cursorData._verbState); cursorData._currOverlappedObjectId = 0; cursorControl->setActorIndexTo1(); } @@ -709,7 +709,7 @@ void BbdouSpecialCode::cursorInteractControlRoutine(Control *cursorControl, uint runCause(cursorControl, cursorData, 0x1B0002, 0, 0x40003, 0); } else if (_vm->_input->pollEvent(kEventInventory)) { cursorData._idleCtr = 0; - if (cursorData._item10._field58 <= 1) + if (cursorData._verbState._minPriority <= 1) runCause(cursorControl, cursorData, cursorData._holdingObjectId != 0 ? 0x1B000B : 0x1B0004, 0, 0x40003, 0); } } @@ -779,18 +779,18 @@ void BbdouSpecialCode::cursorCrosshairControlRoutine(Control *cursorControl, uin foundOverlapped = false; else { foundOverlapped = _vm->_controls->getOverlappedObjectAccurate(cursorControl, cursorPos, - &overlappedControl, cursorData._item10._field58); + &overlappedControl, cursorData._verbState._minPriority); } if (foundOverlapped) { if (overlappedControl->_objectId != cursorData._currOverlappedObjectId) { - resetItem10(cursorControl->_objectId, &cursorData._item10); - int value = _cursor->findStruct8bsValue(overlappedControl->_objectId); + hideVerbBubble(cursorControl->_objectId, &cursorData._verbState); + int value = _cursor->getObjectInteractMode(overlappedControl->_objectId); if (value == 2 || value == 3 || value == 4 || value == 5 || value == 6 || value == 7) { if (cursorData._mode != 3) { _cursor->saveInfo(); cursorData._mode = 3; - cursorData._item10._verbId = 0x1B0006; + cursorData._verbState._verbId = 0x1B0006; cursorData._holdingObjectId = 0; } switch (value) { @@ -821,10 +821,10 @@ void BbdouSpecialCode::cursorCrosshairControlRoutine(Control *cursorControl, uin _cursor->show(cursorControl); cursorControl->setActorIndexTo2(); if (overlappedControl->_objectId) { - cursorData._item10._verbId = 0x1B0003; + cursorData._verbState._verbId = 0x1B0003; cursorData._currOverlappedObjectId = overlappedControl->_objectId; } else { - cursorData._item10._verbId = 0x1B0002; + cursorData._verbState._verbId = 0x1B0002; cursorData._currOverlappedObjectId = overlappedControl->_objectId; } } @@ -835,7 +835,7 @@ void BbdouSpecialCode::cursorCrosshairControlRoutine(Control *cursorControl, uin _cursor->restoreInfo(); _cursor->show(cursorControl); cursorControl->setActorIndexTo1(); - resetItem10(cursorControl->_objectId, &cursorData._item10); + hideVerbBubble(cursorControl->_objectId, &cursorData._verbState); } cursorData._currOverlappedObjectId = 0; } @@ -848,7 +848,7 @@ void BbdouSpecialCode::cursorCrosshairControlRoutine(Control *cursorControl, uin uint32 outSceneId, outVerbId, outObjectId2, outObjectId; bool success = getShooterCause(_vm->getCurrentScene(), - cursorData._item10._verbId, cursorData._holdingObjectId, cursorData._currOverlappedObjectId, + cursorData._verbState._verbId, cursorData._holdingObjectId, cursorData._currOverlappedObjectId, outSceneId, outVerbId, outObjectId2, outObjectId); uint index = (uint)_vm->getRandom(2); @@ -878,15 +878,15 @@ void BbdouSpecialCode::cursorCrosshairControlRoutine(Control *cursorControl, uin } cursorData._causeThreadId1 = _vm->causeTrigger(outSceneId, outVerbId, outObjectId2, outObjectId, threadId); cursorData._causeThreadId2 = cursorData._causeThreadId1; - resetItem10(cursorControl->_objectId, &cursorData._item10); + hideVerbBubble(cursorControl->_objectId, &cursorData._verbState); cursorData._currOverlappedObjectId = 0; cursorControl->setActorIndexTo1(); } - } else if (_vm->_input->pollEvent(kEventRightClick) && cursorData._item10._playSound48 == 1 && !cursorData._item10._flag56) { - // TODO I don't think this is used; _playSound48 seems to be always 0 here + } else if (_vm->_input->pollEvent(kEventRightClick) && cursorData._verbState._isBubbleVisible && !cursorData._verbState._flag56) { + // TODO I don't think this is used; _isBubbleVisible seems to be always 0 here debug("Cursor_sub_10004DD0 TODO"); - // TODO Cursor_sub_10004DD0(controla->objectId, cursorData->currOverlappedObjectId, cursorData->holdingObjectId, &cursorData->item10); + // TODO Cursor_sub_10004DD0(controla->objectId, cursorData->currOverlappedObjectId, cursorData->holdingObjectId, &cursorData->verbState); } } else if (_vm->_input->pollEvent(kEventLeftClick)) { @@ -921,7 +921,7 @@ bool BbdouSpecialCode::testVerbId(uint32 verbId, uint32 holdingObjectId, uint32 static const uint32 kVerbIdsH8[] = {0x001B0003, 0x001B0001, 0}; const uint32 *verbIds; - int value = _cursor->findStruct8bsValue(overlappedObjectId); + int value = _cursor->getObjectInteractMode(overlappedObjectId); if (holdingObjectId) { if (value == 9) @@ -1034,7 +1034,7 @@ void BbdouSpecialCode::startHoldingObjectId(uint32 objectId1, uint32 holdingObje if (_cursor->_data._visibleCtr > 0) _cursor->show(control); _cursor->_data._mode = 2; - _cursor->_data._item10._verbId = 0x1B0003; + _cursor->_data._verbState._verbId = 0x1B0003; if (!doPlaySound) playSoundEffect(5); _inventory->removeInventoryItem(holdingObjectId); @@ -1049,7 +1049,7 @@ void BbdouSpecialCode::stopHoldingObjectId(uint32 objectId1, bool doPlaySound) { playSoundEffect(6); if (_cursor->_data._visibleCtr > 0) _cursor->show(control); - _cursor->_data._item10._verbId = 0x1B0001; + _cursor->_data._verbState._verbId = 0x1B0001; if (_cursor->_data._mode == 3) holdingObjectId = _cursor->_data._holdingObjectId2; if (holdingObjectId) diff --git a/engines/illusions/bbdou/bbdou_specialcode.h b/engines/illusions/bbdou/bbdou_specialcode.h index 40ed53d749..567c9562ee 100644 --- a/engines/illusions/bbdou/bbdou_specialcode.h +++ b/engines/illusions/bbdou/bbdou_specialcode.h @@ -36,7 +36,7 @@ class BbdouCursor; class BbdouFoodCtl; class BbdouInventory; struct CursorData; -struct Item10; +struct VerbState; typedef Common::Functor1<OpCall&, void> SpecialCodeFunction; @@ -152,7 +152,7 @@ public: void spcRunCause(OpCall &opCall); void playSoundEffect(int soundIndex); - void resetItem10(uint32 objectId, Item10 *item10); + void hideVerbBubble(uint32 objectId, VerbState *verbState); void startHoldingObjectId(uint32 objectId1, uint32 holdingObjectId, bool doPlaySound); void stopHoldingObjectId(uint32 objectId1, bool doPlaySound); bool isHoldingObjectId(uint32 objectId); @@ -163,8 +163,8 @@ protected: void setCursorControlRoutine(uint32 objectId, int num); Common::Point getBackgroundCursorPos(Common::Point cursorPos); void showBubble(uint32 objectId, uint32 overlappedObjectId, uint32 holdingObjectId, - Item10 *item10, uint32 progResKeywordId); - bool findVerbId(Item10 *item10, uint32 currOverlappedObjectId, int always0, uint32 &outVerbId); + VerbState *verbState, uint32 progResKeywordId); + bool findVerbId(VerbState *verbState, uint32 currOverlappedObjectId, int always0, uint32 &outVerbId); void cursorInteractControlRoutine(Control *cursorControl, uint32 deltaTime); void cursorCrosshairControlRoutine(Control *cursorControl, uint32 deltaTime); bool testVerbId(uint32 verbId, uint32 holdingObjectId, uint32 overlappedObjectId); |