CGameObject *CInputHandler::dragEnd(const Point &pt, CTreeItem *dragItem) { CViewItem *view = _gameManager->getView(); if (!view) return nullptr; // Scan through the view items to find the item being dropped on CGameObject *target = nullptr; for (CTreeItem *treeItem = view->scan(view); treeItem; treeItem = treeItem->scan(view)) { CGameObject *gameObject = dynamic_cast<CGameObject *>(treeItem); if (gameObject && gameObject != dragItem) { if (gameObject->checkPoint(pt)) target = gameObject; } } if (target) { // Check if the cursor is on the PET. If so, pass to the PET // to see what specific element the drag ended on CProjectItem *project = view->getRoot(); if (project) { CPetControl *petControl = project->getPetControl(); if (petControl && petControl->contains(pt)) { target = petControl->dragEnd(pt); if (!target) target = petControl; } } } return target; }
bool CBilgeSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { CPetControl *pet = getPetControl(); if (_style) { if (_receiveStartFrame >= 0) playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_WAIT_FOR_FINISH); if (_afterReceiveStartFrame >= 0) playMovie(_afterReceiveStartFrame, _afterReceiveEndFrame, MOVIE_WAIT_FOR_FINISH); playSound("z#28.wav", 70); } else if (!_isOn) { petDisplayMessage(2, SUCCUBUS_IS_IN_STANDBY); return false; } else if (!pet) { return false; } else { uint roomFlags = pet->getRoomFlags(); CGameObject *mailObject = findMailByFlags( _enabled && compareRoomNameTo("Titania") ? RFC_TITANIA : _flagsComparison, roomFlags); if (mailObject) { _mailP = mailObject; if (_receiveStartFrame >= 0) playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_WAIT_FOR_FINISH); } else { petDisplayMessage(2, NOTHING_TO_DELIVER); } } return true; }
bool CSuccUBus::TurnOn(CTurnOn *msg) { if (getRandomNumber(9) == 0) { CParrotSpeakMsg speakMsg("SuccUBus", "TurnOn"); speakMsg.execute("PerchedParrot"); } CPetControl *pet = getPetControl(); if (pet) { if (!_field15C && _startFrame8 >= 0) { playMovie(_startFrame8, _endFrame8, 0); playSound("z#30.wav", 100); } if (_startFrame9 >= 0) { playMovie(_startFrame9, _endFrame9, MOVIE_NOTIFY_OBJECT); playSound("z#26.wav", 100); } uint petRoomFlags = pet->getRoomFlags(); if (mailExists(petRoomFlags) && _endFrame1 >= 0) playMovie(_endFrame1, _endFrame1, 0); _enabled = true; CSUBTransition transMsg; transMsg.execute(this); setTalking(this, true, findView()); petSetArea(PET_REMOTE); petHighlightGlyph(16); } return true; }
bool CSuccUBus::SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg) { if (!msg->_item) return false; CPetControl *pet = getPetControl(); CCarry *item = dynamic_cast<CCarry *>(msg->_item); Rect tempRect = _rect2; tempRect.translate(_bounds.left, _bounds.top); uint roomFlags = pet ? pet->getRoomFlags() : 0; if (!_enabled || !pet || !item || !tempRect.contains(item->getControid())) { item->petAddToInventory(); } else if (mailExists(roomFlags)) { petDisplayMessage(SUCCUBUS_DESCRIPTION); item->petAddToInventory(); } else { petContainerRemove(item); pet->phonographAction(""); CChicken *chicken = dynamic_cast<CChicken *>(item); bool chickenFlag = chicken ? chicken->_string6 != "None" : false; item->setVisible(false); if (_startFrame1 >= 0) { playSound("z#23.wav"); playMovie(_startFrame1, _endFrame1, 0); } if (!chickenFlag) { _field188 = 1; item->addMail(roomFlags); petSetArea(PET_REMOTE); petHighlightGlyph(16); CSUBTransition transMsg; transMsg.execute(this); } else { if (_startFrame2 >= 0) { startTalking(this, 70219, findView()); playMovie(_startFrame2, _endFrame2, 0); } if (_startFrame3 >= 0) { playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT); _field158 = 2; } CViewItem *view = parseView(chicken->_fullViewName); if (!view) return false; item->setPosition(item->_origPos); item->moveUnder(view); CSUBTransition transMsg; transMsg.execute(this); } } return true; }
bool CSuccUBus::TurnOn(CTurnOn *msg) { if (getRandomNumber(9) == 0) { CParrotSpeakMsg speakMsg("SuccUBus", "TurnOn"); speakMsg.execute("PerchedParrot"); } CPetControl *pet = getPetControl(); if (pet) { if (!_signalFlag && _initialStartFrame >= 0) { playMovie(_initialStartFrame, _initialEndFrame, 0); playSound("z#30.wav", 100); } if (_onStartFrame >= 0) { playMovie(_onStartFrame, _onEndFrame, MOVIE_NOTIFY_OBJECT); playSound("z#26.wav", 100); } uint petRoomFlags = pet->getRoomFlags(); if (mailExists(petRoomFlags) && _endFrame1 >= 0) // Mail canister present playMovie(_endFrame1, _endFrame1, 0); _isOn = true; CSUBTransition transMsg; transMsg.execute(this); setTalking(this, true, findView()); petSetArea(PET_REMOTE); petHighlightGlyph(16); } return true; }
bool CBilgeSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { CPetControl *pet = getPetControl(); if (_v2) { if (_startFrame4 >= 0) playMovie(_startFrame4, _endFrame4, MOVIE_GAMESTATE); if (_startFrame5 >= 0) playMovie(_startFrame5, _endFrame5, MOVIE_GAMESTATE); playSound("z#28.wav", 70); } else if (!_enabled) { petDisplayMessage(2, SUCCUBUS_IS_IN_STANDBY); return false; } else if (!pet) { return false; } else { uint roomFlags = pet->getRoomFlags(); CGameObject *mailObject = findMailByFlags( _v3 && compareRoomNameTo("Titania") ? 3 : _field140, roomFlags); if (mailObject) { _mailP = mailObject; if (_startFrame4 >= 0) playMovie(_startFrame4, _endFrame4, MOVIE_GAMESTATE); } else { petDisplayMessage(2, NOTHING_TO_DELIVER); } } return true; }
void CMainGameWindow::drawPet(CScreenManager *screenManager) { if (_gameView && _gameView->_surface) { CPetControl *petControl = _gameManager->_project->getPetControl(); if (petControl) petControl->draw(screenManager); } }
bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) { CPetControl *pet = getPetControl(); if (_flag) { _flag = false; setVisible(true); starFn(STAR_HIDE); playMovie(61, 120, MOVIE_NOTIFY_OBJECT); playSound("a#47.wav"); playSound("a#48.wav"); if (pet) { pet->decAreaLocks(); pet->setArea(PET_REMOTE); } decTransitions(); } else { incTransitions(); _flag = true; setVisible(true); playMovie(0, 60, MOVIE_NOTIFY_OBJECT); playSound("a#48.wav"); playSound("a#47.wav"); } return true; }
bool CBilgeSuccUBus::SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg) { CPetControl *pet = getPetControl(); if (!msg->_item) return false; CCarry *item = dynamic_cast<CCarry *>(msg->_item); if (!_enabled || !pet || !item) { item->petAddToInventory(); return true; } uint petRoomFlags = pet->getRoomFlags(); if (mailExists(petRoomFlags)) { petDisplayMessage(2, SUCCUBUS_SINGLE_DELIVERY); item->petAddToInventory(); return true; } petContainerRemove(item); pet->phonographAction(""); playSound("z#23.wav"); CChicken *chicken = dynamic_cast<CChicken *>(item); bool chickenFlag = chicken ? chicken->_string6 == "None" : false; if (chickenFlag) { if (_startFrame2 >= 0) { startTalking(this, 70219); playMovie(_startFrame2, _endFrame2, 0); } if (_startFrame3 >= 0) { _field158 = 5; playMovie(_startFrame3, _endFrame3, MOVIE_NOTIFY_OBJECT); } CViewItem *view = parseView(item->_fullViewName); if (view) { item->setVisible(false); setPosition(item->_origPos); item->moveUnder(view); CSUBTransition transMsg; transMsg.execute(this); } else { return false; } } else { item->addMail(petRoomFlags); if (_startFrame2 >= 0) playMovie(_startFrame2, _endFrame2, 0); petSetArea(PET_REMOTE); CSUBTransition transMsg; transMsg.execute(this); } return true; }
bool CLightSwitch::EnterRoomMsg(CEnterRoomMsg *msg) { _flag = true; CPetControl *pet = getPetControl(); if (pet) _turnOnTV = pet->isFirstClassSuite(); return true; }
bool CEnterSecClassState::MovieEndMsg(CMovieEndMsg *msg) { CPetControl *pet = getPetControl(); if (pet) { pet->setRooms1CC(_mode); pet->resetRoomsHighlight(); } return true; }
bool CBellBot::TrueTalkGetStateValueMsg(CTrueTalkGetStateValueMsg *msg) { CPetControl *pet = getPetControl(); bool flag = pet ? pet->isRoom59706() : false; if (msg->_stateNum == 7) msg->_stateVal = flag ? 1 : 0; return true; }
bool CSGTNavigation::EnterViewMsg(CEnterViewMsg *msg) { if (isEquals("SGTLL")) { static const int FRAMES[3] = { 0, 36, 74 }; CPetControl *pet = getPetControl(); loadFrame(FRAMES[pet->getRooms1CC() - 1]); } return true; }
void CProjectItem::postLoad() { CGameManager *gameManager = getGameManager(); if (gameManager) gameManager->postLoad(this); CPetControl *petControl = getPetControl(); if (petControl) petControl->postLoad(); }
bool CSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { CPetControl *pet = getPetControl(); if (_inProgress || !pet) return true; if (!_isOn) { petDisplayMessage(2, SUCCUBUS_IS_IN_STANDBY); return true; } uint petRoomFlags = pet->getRoomFlags(); if (mailExists(petRoomFlags)) { // There's already something to send in the tray, so you can't receive switch (getRandomNumber(2)) { case 0: startTalking(this, 70080, findView()); break; case 1: startTalking(this, 70081, findView()); break; case 2: startTalking(this, 70082, findView()); break; default: break; } } else { CGameObject *mailObject = findMailByFlags( _enabled && compareRoomNameTo("Titania") ? RFC_TITANIA : _flagsComparison, petRoomFlags); if (!mailObject) { // No mail for this SuccUBus if (getRandomNumber(1) == 0) { startTalking(this, 70104, findView()); } else { startTalking(this, 70105, findView()); } playMovie(_emptyStartFrame, _emptyEndFrame, 0); playMovie(_smokeStartFrame, _smokeEndFrame, 0); petDisplayMessage(2, NOTHING_TO_DELIVER); } else { // Receive the mail addressed to this SuccUBus _mailP = mailObject; startTalking(this, 230004, findView()); if (_receiveStartFrame >= 0) { _sendAction = SA_FEATHERS; _inProgress = true; incTransitions(); playMovie(_receiveStartFrame, _receiveEndFrame, MOVIE_NOTIFY_OBJECT); } } } return true; }
void CTrueTalkNPC::performAction(bool startTalkingFlag, CViewItem *destView) { CPetControl *pet = getPetControl(); if (pet) pet->resetActiveNPC(); if (startTalkingFlag) startTalker(destView); if (pet) pet->convResetNPC(); }
bool CPetQuit::MouseButtonUpMsg(const Point &pt) { CPetControl *pet = getPetControl(); if (_btnYes.MouseButtonUpMsg(pt) && pet) { CGameManager *gameManager = pet->getGameManager(); if (gameManager) gameManager->_gameState._quitGame = true; return true; } else { return false; } }
void CPetLoad::execute() { CPetControl *pet = getPetControl(); if (_savegameSlotNum >= 0 && _slotInUse[_savegameSlotNum]) { CMainGameWindow *window = g_vm->_window; // WORKAROUND: Schedule the savegame to be loaded after frame rendering ends window->loadGame(_savegameSlotNum); } else if (pet) { pet->displayMessage(SELECT_GAME_TO_LOAD); } }
bool TitanicEngine::canLoadGameStateCurrently() { if (!_window->_inputAllowed) return false; CProjectItem *project = _window->_gameManager->_project; if (project) { CPetControl *pet = project->getPetControl(); if (pet && !pet->isAreaUnlocked()) return false; } return true; }
bool CTelevision::LightsMsg(CLightsMsg *msg) { CPetControl *pet = getPetControl(); bool flag = false; if (pet) flag = pet->isRoom59706(); if (msg->_flag2 || !flag) _turnOn = true; return true; }
bool CTelevision::LightsMsg(CLightsMsg *msg) { CPetControl *pet = getPetControl(); bool isYourStateroom = false; if (pet) isYourStateroom = pet->isFirstClassSuite(); if (msg->_topLeft || !isYourStateroom) _turnOn = true; return true; }
bool CEnterExitSecClassMiniLift::StatusChangeMsg(CStatusChangeMsg *msg) { _statics->_state = msg->_newStatus; if (msg->_newStatus == 3) _statics->_state = 2; CPetControl *pet = getPetControl(); if (pet) pet->setRoomsSublevel(_statics->_state); _cursorId = _statics->_state == 1 ? CURSOR_MOVE_FORWARD : CURSOR_INVALID; return true; }
bool CSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { CPetControl *pet = getPetControl(); if (_field1D8 || !pet) return true; if (!_enabled) { petDisplayMessage(2, SUCCUBUS_IS_IN_STANDBY); return true; } uint petRoomFlags = pet->getRoomFlags(); if (mailExists(petRoomFlags)) { switch (getRandomNumber(2)) { case 0: startTalking(this, 70080, findView()); break; case 1: startTalking(this, 70081, findView()); break; case 2: startTalking(this, 70082, findView()); break; default: break; } } else { CGameObject *mailObject = findMailByFlags(compareRoomNameTo("Titania") ? 3 : _field140, petRoomFlags); if (!mailObject) { if (getRandomNumber(1) == 0) { startTalking(this, 70104, findView()); } else { startTalking(this, 70105, findView()); } playMovie(_startFrame6, _endFrame6, 0); playMovie(_startFrame7, _endFrame7, 0); petDisplayMessage(2, NOTHING_TO_DELIVER); } else { startTalking(this, 230004, findView()); if (_startFrame4 >= 0) { _field158 = 1; _field1D8 = 1; incTransitions(); playMovie(_startFrame4, _endFrame4, MOVIE_NOTIFY_OBJECT); } } } return true; }
bool CSGTStateRoom::LeaveRoomMsg(CLeaveRoomMsg *msg) { CPetControl *pet = getPetControl(); uint roomFlags = pet->getRoomFlags(); uint assignedRoom = pet->getAssignedRoomFlags(); if (roomFlags == assignedRoom) { _savedFrame = getMovieFrame(); _savedIsClosed = _isClosed; _savedVisible = _visible; } _statics->_roomFlags = roomFlags; return true; }
void CPetSave::execute() { CPetControl *pet = getPetControl(); if (_savegameSlotNum >= 0) { highlightSlot(-1); CProjectItem *project = pet ? pet->getRoot() : nullptr; if (project) { project->saveGame(_savegameSlotNum, _slotNames[_savegameSlotNum].getText()); pet->displayMessage(BLANK); } } else if (pet) { pet->displayMessage(SELECT_GAME_TO_SAVE); } }
bool CLiftbotHead::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (msg->_other->getName() == "LiftbotWithoutHead") { CPetControl *pet = getPetControl(); if (!CLift::_hasHead && pet->getRoomsElevatorNum() == 4) { _flag = true; CActMsg actMsg("AddRightHead"); actMsg.execute("FaultyLiftbot"); setVisible(false); } return true; } else { return CCarry::UseWithOtherMsg(msg); } }
bool CPetDragChev::MouseDragEndMsg(CMouseDragEndMsg *msg) { CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_dropTarget); if (succubus) { CSetChevRoomBits chevMsg(_destRoomFlags); chevMsg.execute(succubus); } else { CPetControl *petControl = getPetControl(); if (!petControl || !petControl->contains(msg->_mousePos) || msg->_mousePos.x >= 528 || !petControl->checkDragEnd(this)) petMoveToHiddenRoom(); } return true; }
bool CParrotSuccUBus::HoseConnectedMsg(CHoseConnectedMsg *msg) { CPetControl *pet = getPetControl(); if (msg->_value == _field1DC) return true; if (mailExists(pet->getRoomFlags())) return false; _field1DC = msg->_value; if (_field1DC) { CGameObject *item = msg->_object; _string3 = item->getName(); CHoseConnectedMsg hoseMsg(1, this); hoseMsg.execute(msg->_object); item->petMoveToHiddenRoom(); CPumpingMsg pumpingMsg(1, this); pumpingMsg.execute(this); _field1DC = 1; if (_enabled) { _enabled = false; } else { playMovie(_startFrame9, _endFrame9, 0); playSound("z#26.wav"); } playMovie(_field1C4, _field1C8, MOVIE_NOTIFY_OBJECT); } else { stopMovie(); stopSound(_field1EC); playMovie(_field1F0, _field1F4, MOVIE_NOTIFY_OBJECT); CPumpingMsg pumpingMsg(0, this); pumpingMsg.execute(_string3); CGameObject *obj = getHiddenObject(_string3); if (obj) { obj->petAddToInventory(); obj->setVisible(true); } _enabled = true; CTurnOff offMsg; offMsg.execute(this); } return true; }
bool CPETTransition::EnterViewMsg(CEnterViewMsg *msg) { CPetControl *pet = getPetControl(); if (compareRoomNameTo("1stClassLobby") && pet) { int elevatorNum = pet->getRoomsElevatorNum(); CString nodeView = msg->_newView->getNodeViewName(); if (nodeView == "Node 1.E") { pet->setRoomsElevatorNum((elevatorNum == 1 || elevatorNum == 2) ? 1 : 3); } else if (nodeView == "Node 1.W") { pet->setRoomsElevatorNum((elevatorNum == 1 || elevatorNum == 2) ? 2 : 4); } } return true; }
bool CLiftbotHead::UseWithCharMsg(CUseWithCharMsg *msg) { CLift *lift = dynamic_cast<CLift *>(msg->_character); if (lift) { CPetControl *pet = getPetControl(); if (lift->isEquals("Well") && !CLift::_hasHead && pet->getRoomsElevatorNum() == 4) { _flag = true; CActMsg actMsg("AddRightHead"); actMsg.execute(lift); setVisible(false); return true; } } return CCarry::UseWithCharMsg(msg); }