void CPetControl::addToInventory(CGameObject *item) { item->detach(); if (item->getName() == "CarryParcel") { CCarry *child = dynamic_cast<CCarry *>(getLastChild()); if (child) child->detach(); item->petMoveToHiddenRoom(); if (!child) return; item = child; } item->addUnder(this); _inventory.itemsChanged(); setArea(PET_INVENTORY); if (_currentArea == PET_INVENTORY) _inventory.highlightItem(item); makeDirty(); CPETGainedObjectMsg msg; msg.execute(item); }
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 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 CCarryParrot::ActMsg(CActMsg *msg) { if (msg->_action == "FreeParrot" && (CParrot::_v4 == 4 || CParrot::_v4 == 1)) { CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(_string6)); if (npc) startTalking(npc, 0x446BF); setVisible(false); _fieldE0 = 0; if (CParrot::_v4 == 4) { CActMsg actMsg("Shut"); actMsg.execute("ParrotCage"); } else { playSound("z#475.wav"); if (!_feathersFlag) { CCarry *feathers = dynamic_cast<CCarry *>(getRoot()->findByName("Feathers")); if (feathers) { feathers->setVisible(true); feathers->petAddToInventory(); } _feathersFlag = true; } getPetControl()->removeFromInventory(this); getPetControl()->setAreaChangeType(1); moveUnder(getRoom()); } CParrot::_v4 = 2; stopTimer(_timerId); _timerId = 0; } 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 (!_isOn || !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->_condiment == "None" : false; item->setVisible(false); if (_startFrame1 >= 0) { playSound("z#23.wav"); playMovie(_startFrame1, _endFrame1, 0); } if (!chickenFlag) { // Not chicken, or chicken with condiments _field188 = 1; item->addMail(roomFlags); petSetArea(PET_REMOTE); petHighlightGlyph(16); CSUBTransition transMsg; transMsg.execute(this); } else { // Chicken without condiments was passed to SuccUBus, so it'll // eat it immediately if (_okStartFrame >= 0) { startTalking(this, 70219, findView()); playMovie(_okStartFrame, _okEndFrame, 0); } if (_sendStartFrame >= 0) { playMovie(_sendStartFrame, _sendEndFrame, MOVIE_NOTIFY_OBJECT); _sendAction = SA_EATEN; } // WORKAROUND: The original had code below to return the chicken // to the dispensor after eaten, but since _fullViewName isn't // set, it didn't work. I've added code below in the else block // that replicates what happens when the parrot eats the chicken CViewItem *view = parseView(chicken->_fullViewName); if (view) { item->setPosition(item->_origPos); item->moveUnder(view); CSUBTransition transMsg; transMsg.execute(this); } else { CActMsg actMsg("Eaten"); actMsg.execute(chicken); return false; } } } return true; }