From 7dc8533f730645e7177bbdc4d214664d82856963 Mon Sep 17 00:00:00 2001 From: johndoe123 Date: Tue, 1 Apr 2014 16:56:58 +0200 Subject: ILLUSIONS: Fix thread camera panning - Minor fixes and corrections --- engines/illusions/actor.cpp | 1 - engines/illusions/bbdou/bbdou_cursor.cpp | 2 +- engines/illusions/bbdou/bbdou_inventory.cpp | 14 +++++++++++--- engines/illusions/bbdou/bbdou_inventory.h | 1 + engines/illusions/bbdou/bbdou_specialcode.cpp | 8 +++++++- engines/illusions/bbdou/bbdou_specialcode.h | 1 + engines/illusions/scriptopcodes.cpp | 16 +++++++++------- engines/illusions/talkthread.cpp | 2 +- engines/illusions/thread.cpp | 5 ++--- 9 files changed, 33 insertions(+), 17 deletions(-) (limited to 'engines') diff --git a/engines/illusions/actor.cpp b/engines/illusions/actor.cpp index 42f16ca951..75b49004b6 100644 --- a/engines/illusions/actor.cpp +++ b/engines/illusions/actor.cpp @@ -668,7 +668,6 @@ void Control::stopSubSequence(int linkIndex) { Actor *linkedActor = linkedControl->_actor; uint32 notifyThreadId2 = _actor->_notifyThreadId2; _actor->_linkIndex2 = linkIndex; -//TODO BUGGY! if (_actor->_entryTblPtr) { linkedActor->_flags |= 0x80; linkedActor->_entryTblPtr = _actor->_entryTblPtr; diff --git a/engines/illusions/bbdou/bbdou_cursor.cpp b/engines/illusions/bbdou/bbdou_cursor.cpp index ec877556db..4aca265f6d 100644 --- a/engines/illusions/bbdou/bbdou_cursor.cpp +++ b/engines/illusions/bbdou/bbdou_cursor.cpp @@ -351,7 +351,7 @@ void BbdouCursor::hide(uint32 objectId) { if (_data._visibleCtr == 0) { Control *control = _vm->_dict->getObjectControl(objectId); control->startSequenceActor(0x60029, 2, 0); - // TODO item10_sub_10005040(objectId, &cursorData->item10); + _bbdou->resetItem10(objectId, &_data._item10); _vm->_camera->popCameraMode(); } _vm->_input->discardButtons(0xFFFF); diff --git a/engines/illusions/bbdou/bbdou_inventory.cpp b/engines/illusions/bbdou/bbdou_inventory.cpp index 5502616337..26265a706d 100644 --- a/engines/illusions/bbdou/bbdou_inventory.cpp +++ b/engines/illusions/bbdou/bbdou_inventory.cpp @@ -162,6 +162,14 @@ void BbdouInventory::removeInventoryItem(uint32 objectId) { } } +bool BbdouInventory::hasInventoryItem(uint32 objectId) { + for (uint i = 0; i < _inventoryItems.size(); ++i) + if (_inventoryItems[i]->_objectId == objectId && + _inventoryItems[i]->_assigned) + return true; + return false; +} + void BbdouInventory::open() { _activeBagSceneId = 0; InventoryBag *inventoryBag = getInventoryBag(_vm->getCurrentScene()); @@ -203,8 +211,8 @@ void BbdouInventory::close() { Control *control = _vm->_dict->getObjectControl(inventorySlot->_objectId); control->startSequenceActor(0x00060187, 2, 0); } - inventoryBag->_isActive = false; - _activeInventorySceneId = 0; + inventoryBag->_isActive = false; + _activeInventorySceneId = 0; } InventoryBag *BbdouInventory::getInventoryBag(uint32 sceneId) { @@ -245,7 +253,7 @@ void BbdouInventory::buildItems(InventoryBag *inventoryBag) { inventoryBag->buildItems(); for (InventoryItemsIterator it = _inventoryItems.begin(); it != _inventoryItems.end(); ++it) { InventoryItem *inventoryItem = *it; - if (inventoryItem->_assigned && !inventoryItem->_flag && + if (inventoryItem->_assigned && !inventoryItem->_flag && inventoryItem->_timesPresent == 0 && inventoryItem->_objectId != _bbdou->_cursor->_data._holdingObjectId) inventoryBag->addInventoryItem(inventoryItem, 0); diff --git a/engines/illusions/bbdou/bbdou_inventory.h b/engines/illusions/bbdou/bbdou_inventory.h index 3c211e5340..e4ee28fc08 100644 --- a/engines/illusions/bbdou/bbdou_inventory.h +++ b/engines/illusions/bbdou/bbdou_inventory.h @@ -79,6 +79,7 @@ public: void registerInventorySlot(uint32 namedPointId); void addInventoryItem(uint32 objectId); void removeInventoryItem(uint32 objectId); + bool hasInventoryItem(uint32 objectId); void open(); void close(); InventoryBag *getInventoryBag(uint32 sceneId); diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp index 1547aabf1b..a3a3149e03 100644 --- a/engines/illusions/bbdou/bbdou_specialcode.cpp +++ b/engines/illusions/bbdou/bbdou_specialcode.cpp @@ -103,6 +103,7 @@ void BbdouSpecialCode::init() { SPECIAL(0x0016001C, spcOpenInventory); SPECIAL(0x0016001D, spcAddInventoryItem); SPECIAL(0x0016001E, spcRemoveInventoryItem); + SPECIAL(0x0016001F, spcHasInventoryItem); SPECIAL(0x00160025, spcCloseInventory); } @@ -221,6 +222,11 @@ void BbdouSpecialCode::spcRemoveInventoryItem(OpCall &opCall) { _inventory->removeInventoryItem(objectId); } +void BbdouSpecialCode::spcHasInventoryItem(OpCall &opCall) { + ARG_UINT32(objectId); + _vm->_scriptMan->_stack.push(_inventory->hasInventoryItem(objectId) ? 1 : 0); +} + void BbdouSpecialCode::spcCloseInventory(OpCall &opCall) { _inventory->close(); } @@ -349,7 +355,7 @@ bool BbdouSpecialCode::findVerbId(Item10 *item10, uint32 currOverlappedObjectId, void BbdouSpecialCode::cursorInteractControlRoutine(Control *cursorControl, uint32 deltaTime) { Actor *actor = cursorControl->_actor; CursorData &cursorData = _cursor->_data; - + if (cursorData._visibleCtr > 0) { Common::Point cursorPos = _vm->_input->getCursorPosition(); diff --git a/engines/illusions/bbdou/bbdou_specialcode.h b/engines/illusions/bbdou/bbdou_specialcode.h index d018f3859d..734e8e8755 100644 --- a/engines/illusions/bbdou/bbdou_specialcode.h +++ b/engines/illusions/bbdou/bbdou_specialcode.h @@ -92,6 +92,7 @@ public: void spcOpenInventory(OpCall &opCall); void spcAddInventoryItem(OpCall &opCall); void spcRemoveInventoryItem(OpCall &opCall); + void spcHasInventoryItem(OpCall &opCall); void spcCloseInventory(OpCall &opCall); void playSoundEffect(int soundIndex); diff --git a/engines/illusions/scriptopcodes.cpp b/engines/illusions/scriptopcodes.cpp index aa63512142..d94b96d9fc 100644 --- a/engines/illusions/scriptopcodes.cpp +++ b/engines/illusions/scriptopcodes.cpp @@ -263,17 +263,19 @@ void ScriptOpcodes::opEnterScene(ScriptThread *scriptThread, OpCall &opCall) { } //DEBUG Scenes -//uint32 dsceneId = 0x00010031, dthreadId = 0x00020036;//MAP +uint32 dsceneId = 0x00010031, dthreadId = 0x00020036;//MAP //uint32 dsceneId = 0x00010028, dthreadId = 0x000202A1; //uint32 dsceneId = 0x00010007, dthreadId = 0x0002000C;//Auditorium //uint32 dsceneId = 0x0001000B, dthreadId = 0x00020010; -uint32 dsceneId = 0x00010013, dthreadId = 0x00020018;// +//uint32 dsceneId = 0x00010013, dthreadId = 0x00020018;//Therapist +//uint32 dsceneId = 0x00010016, dthreadId = 0x0002001B;//Dorms ext +//uint32 dsceneId = 0x00010017, dthreadId = 0x0002001C;//Dorms int void ScriptOpcodes::opChangeScene(ScriptThread *scriptThread, OpCall &opCall) { ARG_SKIP(2); ARG_UINT32(sceneId); ARG_UINT32(threadId); - + if (dsceneId) { sceneId = dsceneId; threadId = dthreadId; @@ -338,21 +340,21 @@ void ScriptOpcodes::opPanToObject(ScriptThread *scriptThread, OpCall &opCall) { ARG_UINT32(objectId); Control *control = _vm->_dict->getObjectControl(objectId); Common::Point pos = control->getActorPosition(); - _vm->_camera->panToPoint(pos, speed, opCall._callerThreadId); + _vm->_camera->panToPoint(pos, speed, opCall._threadId); } void ScriptOpcodes::opPanToNamedPoint(ScriptThread *scriptThread, OpCall &opCall) { ARG_INT16(speed); ARG_UINT32(namedPointId); Common::Point pos = _vm->getNamedPointPosition(namedPointId); - _vm->_camera->panToPoint(pos, speed, opCall._callerThreadId); + _vm->_camera->panToPoint(pos, speed, opCall._threadId); } void ScriptOpcodes::opPanToPoint(ScriptThread *scriptThread, OpCall &opCall) { ARG_INT16(speed); ARG_INT16(x); ARG_INT16(y); - _vm->_camera->panToPoint(Common::Point(x, y), speed, opCall._callerThreadId); + _vm->_camera->panToPoint(Common::Point(x, y), speed, opCall._threadId); } void ScriptOpcodes::opPanStop(ScriptThread *scriptThread, OpCall &opCall) { @@ -609,7 +611,7 @@ void ScriptOpcodes::opActivateButton(ScriptThread *scriptThread, OpCall &opCall) } void ScriptOpcodes::opJumpIf(ScriptThread *scriptThread, OpCall &opCall) { - ARG_INT16(jumpOffs) + ARG_INT16(jumpOffs); int16 value = _vm->_scriptMan->_stack.pop(); if (value == 0) opCall._deltaOfs += jumpOffs; diff --git a/engines/illusions/talkthread.cpp b/engines/illusions/talkthread.cpp index c8bee715ce..be745f6e99 100644 --- a/engines/illusions/talkthread.cpp +++ b/engines/illusions/talkthread.cpp @@ -262,7 +262,7 @@ uint32 TalkThread::sendMessage(int msgNum, uint32 msgValue) { // TODO switch (msgNum) { case kMsgQueryTalkThreadActive: - if (_status != 1 && _status != 2) + if (_status != 1 && _status != 2) return 1; break; case kMsgClearSequenceId1: diff --git a/engines/illusions/thread.cpp b/engines/illusions/thread.cpp index cac13d9760..3a5a4a94e1 100644 --- a/engines/illusions/thread.cpp +++ b/engines/illusions/thread.cpp @@ -111,9 +111,8 @@ int Thread::update() { void Thread::terminate() { if (!_terminated) { - if (!(_notifyFlags & 1)) { + if (!(_notifyFlags & 1)) _vm->notifyThreadId(_callingThreadId); - } _callingThreadId = 0; onTerminated(); _terminated = true; @@ -127,7 +126,7 @@ ThreadList::ThreadList(IllusionsEngine *vm) } void ThreadList::startThread(Thread *thread) { - // TODO tag has to be set by the Thread class scrmgrGetCurrentScene(); + // TODO tag has to be set by the Thread class _threads.push_back(thread); } -- cgit v1.2.3