diff options
-rw-r--r-- | engines/illusions/actor.cpp | 21 | ||||
-rw-r--r-- | engines/illusions/actor.h | 4 | ||||
-rw-r--r-- | engines/illusions/bbdou/illusions_bbdou.cpp | 2 | ||||
-rw-r--r-- | engines/illusions/camera.cpp | 15 | ||||
-rw-r--r-- | engines/illusions/duckman/duckman_dialog.cpp | 4 | ||||
-rw-r--r-- | engines/illusions/duckman/illusions_duckman.cpp | 4 | ||||
-rw-r--r-- | engines/illusions/duckman/menusystem_duckman.cpp | 8 | ||||
-rw-r--r-- | engines/illusions/menusystem.cpp | 6 | ||||
-rw-r--r-- | engines/illusions/sequenceopcodes.cpp | 6 | ||||
-rw-r--r-- | engines/illusions/sequenceopcodes.h | 1 | ||||
-rw-r--r-- | engines/illusions/threads/causethread_duckman.cpp | 4 |
11 files changed, 46 insertions, 29 deletions
diff --git a/engines/illusions/actor.cpp b/engines/illusions/actor.cpp index cb9f3a909d..dba119550d 100644 --- a/engines/illusions/actor.cpp +++ b/engines/illusions/actor.cpp @@ -222,7 +222,7 @@ void Control::pause() { _vm->_dict->setObjectControl(_objectId, 0); - if (_objectId == 0x40004) + if (_objectId == Illusions::CURSOR_OBJECT_ID) _vm->setCursorControl(0); if (_actor && !(_actor->_flags & Illusions::ACTOR_FLAG_200)) @@ -234,7 +234,7 @@ void Control::unpause() { _vm->_dict->setObjectControl(_objectId, this); - if (_objectId == 0x40004) + if (_objectId == Illusions::CURSOR_OBJECT_ID) _vm->setCursorControl(this); if (_actor && !(_actor->_flags & Illusions::ACTOR_FLAG_200)) { @@ -253,7 +253,7 @@ void Control::appearActor() { if (_vm->getGameId() == kGameIdDuckman) { _flags |= 1; _actor->_flags |= Illusions::ACTOR_FLAG_IS_VISIBLE; - if (_objectId == 0x40004) { + if (_objectId == Illusions::CURSOR_OBJECT_ID) { if (_actor->_frameIndex) { _actor->_flags |= Illusions::ACTOR_FLAG_2000; _actor->_flags |= Illusions::ACTOR_FLAG_4000; @@ -261,7 +261,7 @@ void Control::appearActor() { _vm->_input->discardAllEvents(); } } else { - if (_objectId == 0x40004) { + if (_objectId == Illusions::CURSOR_OBJECT_ID) { _vm->showCursor(); } else { if (_actor->_frameIndex || _actorTypeId == 0x50004) @@ -282,7 +282,7 @@ void Control::disappearActor() { _flags &= ~1; _actor->_flags &= ~Illusions::ACTOR_FLAG_IS_VISIBLE; } else { - if (_objectId == 0x40004) { + if (_objectId == Illusions::CURSOR_OBJECT_ID) { _vm->hideCursor(); } else { _actor->_flags &= ~Illusions::ACTOR_FLAG_IS_VISIBLE; @@ -646,7 +646,7 @@ void Control::sequenceActor() { //debug(1, "New frame %d", _actor->_newFrameIndex); setActorFrameIndex(_actor->_newFrameIndex); if (_vm->getGameId() == kGameIdBBDOU && - !(_actor->_flags & Illusions::ACTOR_FLAG_IS_VISIBLE) && (_actor->_flags & Illusions::ACTOR_FLAG_1000) && (_objectId != 0x40004)) { + !(_actor->_flags & Illusions::ACTOR_FLAG_IS_VISIBLE) && (_actor->_flags & Illusions::ACTOR_FLAG_1000) && (_objectId != Illusions::CURSOR_OBJECT_ID)) { appearActor(); _actor->_flags &= ~Illusions::ACTOR_FLAG_1000; } @@ -1105,6 +1105,9 @@ void Controls::placeActor(uint32 actorTypeId, Common::Point placePt, uint32 sequ if (_vm->isCursorObject(actorTypeId, objectId)) _vm->placeCursorControl(control, sequenceId); + // TODO HACK at least we should restrict this to the sequenceId + control->setActorIndex(1); + control->startSequenceActor(sequenceId, 2, notifyThreadId); } @@ -1205,7 +1208,7 @@ void Controls::destroyActiveControls() { destroyControlInternal(*it); it = _controls.erase(it); } else - ++it; + ++it; } } @@ -1216,7 +1219,7 @@ void Controls::destroyControlsBySceneId(uint32 sceneId) { destroyControlInternal(*it); it = _controls.erase(it); } else - ++it; + ++it; } } @@ -1481,7 +1484,7 @@ void Controls::destroyControlInternal(Control *control) { if (!(control->_flags & 4) && control->_pauseCtr <= 0) _vm->_dict->setObjectControl(control->_objectId, 0); - if (!(control->_flags & 4) && control->_objectId == 0x40004 && control->_pauseCtr <= 0) + if (!(control->_flags & 4) && control->_objectId == Illusions::CURSOR_OBJECT_ID && control->_pauseCtr <= 0) _vm->setCursorControl(0); if (control->_actor) { diff --git a/engines/illusions/actor.h b/engines/illusions/actor.h index 7fb99ced81..51f930be11 100644 --- a/engines/illusions/actor.h +++ b/engines/illusions/actor.h @@ -58,6 +58,10 @@ enum ActorFlags { ACTOR_FLAG_8000 = 0x8000 }; +enum ControlObjectID { + CURSOR_OBJECT_ID = 0x40004 +}; + const uint kSubObjectsCount = 15; struct DefaultSequence { diff --git a/engines/illusions/bbdou/illusions_bbdou.cpp b/engines/illusions/bbdou/illusions_bbdou.cpp index b0353c2096..a642835623 100644 --- a/engines/illusions/bbdou/illusions_bbdou.cpp +++ b/engines/illusions/bbdou/illusions_bbdou.cpp @@ -384,7 +384,7 @@ uint32 IllusionsEngine_BBDOU::getPrevScene() { } bool IllusionsEngine_BBDOU::isCursorObject(uint32 actorTypeId, uint32 objectId) { - return actorTypeId == 0x50001 && objectId == 0x40004; + return actorTypeId == 0x50001 && objectId == Illusions::CURSOR_OBJECT_ID; } void IllusionsEngine_BBDOU::setCursorControlRoutine(Control *control) { diff --git a/engines/illusions/camera.cpp b/engines/illusions/camera.cpp index 9e18ff39b6..390dff8b99 100644 --- a/engines/illusions/camera.cpp +++ b/engines/illusions/camera.cpp @@ -25,6 +25,7 @@ #include "illusions/fixedpoint.h" #include "illusions/resources/backgroundresource.h" #include "illusions/time.h" +#include "illusions/actor.h" namespace Illusions { @@ -85,10 +86,16 @@ void Camera::set(Common::Point &panPoint, WidthHeight &dimensions) { void Camera::panCenterObject(uint32 objectId, int16 panSpeed) { Common::Point *actorPosition = _vm->getObjectActorPositionPtr(objectId); - if (_vm->getGameId() == kGameIdDuckman && objectId == 0x40004) { - _activeState._cameraMode = 2; - _activeState._trackingLimits.x = 156; - _activeState._trackingLimits.y = 96; + if (_vm->getGameId() == kGameIdDuckman) { + if(objectId == Illusions::CURSOR_OBJECT_ID) { + _activeState._cameraMode = 2; + _activeState._trackingLimits.x = 156; + _activeState._trackingLimits.y = 96; + } else { + _activeState._cameraMode = 1; + _activeState._trackingLimits.x = 4; + _activeState._trackingLimits.y = 4; + } } else if (_vm->getGameId() == kGameIdBBDOU) { _activeState._cameraMode = 1; _activeState._trackingLimits = _centerObjectTrackingLimits; diff --git a/engines/illusions/duckman/duckman_dialog.cpp b/engines/illusions/duckman/duckman_dialog.cpp index 3e42955ac9..f624ed8d01 100644 --- a/engines/illusions/duckman/duckman_dialog.cpp +++ b/engines/illusions/duckman/duckman_dialog.cpp @@ -85,8 +85,8 @@ void DuckmanDialogSystem::startDialog(int16 *choiceOfsPtr, uint32 actorTypeId, u } else { if (!_vm->_cursor._control) { Common::Point pos = _vm->getNamedPointPosition(0x70001); - _vm->_controls->placeActor(0x50001, pos, 0x60001, 0x40004, 0); - _vm->_cursor._control = _vm->_dict->getObjectControl(0x40004); + _vm->_controls->placeActor(0x50001, pos, 0x60001, Illusions::CURSOR_OBJECT_ID, 0); + _vm->_cursor._control = _vm->_dict->getObjectControl(Illusions::CURSOR_OBJECT_ID); } _vm->_cursor._control->appearActor(); _vm->setCursorActorIndex(6, 1, 0); diff --git a/engines/illusions/duckman/illusions_duckman.cpp b/engines/illusions/duckman/illusions_duckman.cpp index 325b6dca87..0b2bcca52f 100644 --- a/engines/illusions/duckman/illusions_duckman.cpp +++ b/engines/illusions/duckman/illusions_duckman.cpp @@ -944,13 +944,13 @@ void IllusionsEngine_Duckman::pause(uint32 callerThreadId) { _threads->pauseThreads(callerThreadId); _camera->pause(); pauseFader(); - // TODO largeObj_pauseControlActor(0x40004); + // TODO largeObj_pauseControlActor(Illusions::CURSOR_OBJECT_ID); } } void IllusionsEngine_Duckman::unpause(uint32 callerThreadId) { if (--_pauseCtr == 0) { - // TODO largeObj_unpauseControlActor(0x40004); + // TODO largeObj_unpauseControlActor(Illusions::CURSOR_OBJECT_ID); unpauseFader(); _camera->unpause(); _threads->unpauseThreads(callerThreadId); diff --git a/engines/illusions/duckman/menusystem_duckman.cpp b/engines/illusions/duckman/menusystem_duckman.cpp index 621a49cd1f..263cda83ce 100644 --- a/engines/illusions/duckman/menusystem_duckman.cpp +++ b/engines/illusions/duckman/menusystem_duckman.cpp @@ -171,15 +171,15 @@ int DuckmanMenuSystem::convertRootMenuId(uint32 menuId) { bool DuckmanMenuSystem::initMenuCursor() { bool cursorInitialVisibleFlag = false; - Control *cursorControl = _vm->getObjectControl(0x40004); + Control *cursorControl = _vm->getObjectControl(Illusions::CURSOR_OBJECT_ID); if (cursorControl) { if (cursorControl->_flags & 1) cursorInitialVisibleFlag = false; cursorControl->appearActor(); } else { Common::Point pos = _vm->getNamedPointPosition(0x70001); - _vm->_controls->placeActor(0x50001, pos, 0x60001, 0x40004, 0); - cursorControl = _vm->getObjectControl(0x40004); + _vm->_controls->placeActor(0x50001, pos, 0x60001, Illusions::CURSOR_OBJECT_ID, 0); + cursorControl = _vm->getObjectControl(Illusions::CURSOR_OBJECT_ID); } return cursorInitialVisibleFlag; } @@ -189,7 +189,7 @@ int DuckmanMenuSystem::getGameState() { } void DuckmanMenuSystem::setMenuCursorNum(int cursorNum) { - Control *mouseCursor = _vm->getObjectControl(0x40004); + Control *mouseCursor = _vm->getObjectControl(Illusions::CURSOR_OBJECT_ID); _vm->setCursorActorIndex(5, cursorNum, 0); mouseCursor->startSequenceActor(0x60001, 2, 0); } diff --git a/engines/illusions/menusystem.cpp b/engines/illusions/menusystem.cpp index 878dacf0df..3330cb727a 100644 --- a/engines/illusions/menusystem.cpp +++ b/engines/illusions/menusystem.cpp @@ -215,7 +215,7 @@ bool BaseMenuSystem::calcMenuItemIndexAtPoint(Common::Point pt, uint &menuItemIn void BaseMenuSystem::setMousePos(Common::Point &mousePos) { _vm->_input->setCursorPosition(mousePos); - Control *mouseCursor = _vm->getObjectControl(0x40004); + Control *mouseCursor = _vm->getObjectControl(Illusions::CURSOR_OBJECT_ID); mouseCursor->_actor->_position = mousePos; } @@ -332,7 +332,7 @@ void BaseMenuSystem::openMenu(BaseMenu *menu) { _cursorInitialVisibleFlag = initMenuCursor(); _savedCursorPos = _vm->_input->getCursorPosition(); _savedGameState = getGameState(); - Control *cursorControl = _vm->getObjectControl(0x40004); + Control *cursorControl = _vm->getObjectControl(Illusions::CURSOR_OBJECT_ID); _savedCursorActorIndex = cursorControl->_actor->_actorIndex; _savedCursorSequenceId = cursorControl->_actor->_sequenceId; @@ -358,7 +358,7 @@ void BaseMenuSystem::closeMenu() { _vm->_screenText->removeText(); hideActorHoverBackground(); hideActorTextColorRect(); - Control *mouseCursor = _vm->getObjectControl(0x40004); + Control *mouseCursor = _vm->getObjectControl(Illusions::CURSOR_OBJECT_ID); setGameState(_savedGameState); mouseCursor->_actor->_actorIndex = _savedCursorActorIndex; mouseCursor->_actor->_position = _savedCursorPos; diff --git a/engines/illusions/sequenceopcodes.cpp b/engines/illusions/sequenceopcodes.cpp index 21152097d9..b07e9ecbaa 100644 --- a/engines/illusions/sequenceopcodes.cpp +++ b/engines/illusions/sequenceopcodes.cpp @@ -45,12 +45,14 @@ SequenceOpcodes::~SequenceOpcodes() { void SequenceOpcodes::execOpcode(Control *control, OpCall &opCall) { if (!_opcodes[opCall._op]) error("SequenceOpcodes::execOpcode() Unimplemented opcode %d", opCall._op); - debug(3, "execOpcode(%d)", opCall._op); + debug(3, "execSequenceOpcode(%d) %s objectID: %08X", opCall._op, _opcodeNames[opCall._op].c_str(), control->_objectId); (*_opcodes[opCall._op])(control, opCall); } typedef Common::Functor2Mem<Control*, OpCall&, void, SequenceOpcodes> SequenceOpcodeI; -#define OPCODE(op, func) _opcodes[op] = new SequenceOpcodeI(this, &SequenceOpcodes::func); +#define OPCODE(op, func) \ + _opcodes[op] = new SequenceOpcodeI(this, &SequenceOpcodes::func); \ + _opcodeNames[op] = #func; void SequenceOpcodes::initOpcodes() { // First clear everything diff --git a/engines/illusions/sequenceopcodes.h b/engines/illusions/sequenceopcodes.h index 85e5df6c46..8432512372 100644 --- a/engines/illusions/sequenceopcodes.h +++ b/engines/illusions/sequenceopcodes.h @@ -41,6 +41,7 @@ public: protected: IllusionsEngine *_vm; SequenceOpcode *_opcodes[256]; + Common::String _opcodeNames[256]; void initOpcodes(); void freeOpcodes(); diff --git a/engines/illusions/threads/causethread_duckman.cpp b/engines/illusions/threads/causethread_duckman.cpp index 8fb836467a..09f3fa9cf6 100644 --- a/engines/illusions/threads/causethread_duckman.cpp +++ b/engines/illusions/threads/causethread_duckman.cpp @@ -39,14 +39,14 @@ CauseThread_Duckman::CauseThread_Duckman(IllusionsEngine_Duckman *vm, uint32 thr int CauseThread_Duckman::onUpdate() { if (_flag) { if (_vm->getCurrentScene() == _sceneId) { - Control *cursorCursor = _vm->getObjectControl(0x40004); + Control *cursorCursor = _vm->getObjectControl(Illusions::CURSOR_OBJECT_ID); cursorCursor->appearActor(); _vm->_input->discardEvent(kEventLeftClick); } return kTSTerminate; } else { _sceneId = _vm->getCurrentScene(); - Control *cursorCursor = _vm->getObjectControl(0x40004); + Control *cursorCursor = _vm->getObjectControl(Illusions::CURSOR_OBJECT_ID); cursorCursor->disappearActor(); _vm->_input->discardEvent(kEventLeftClick); _vm->startScriptThread(_triggerThreadId, _threadId); |