ILLUSIONS: Fix thread camera panning

- Minor fixes and corrections
This commit is contained in:
johndoe123 2014-04-01 16:56:58 +02:00 committed by Eugene Sandulenko
parent d67021b32c
commit 7dc8533f73
9 changed files with 33 additions and 17 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

@ -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;

View File

@ -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:

View File

@ -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);
}