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 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::LeaveViewMsg(CLeaveViewMsg *msg) { petDisplayMessage(2, BLANK); if (_startFrame8 >= 0) loadFrame(_startFrame8); else if (!_field15C && _startFrame9 >= 0) loadFrame(_startFrame9); petClear(); if (_soundHandle != -1) { stopSound(_soundHandle, 1); _soundHandle = -1; } if (_enabled) { _enabled = false; if (_startFrame10 >= 0) playSound("z#27.wav", 100); if (_field15C) setVisible(false); } performAction(true, findView()); 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 CSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) { petDisplayMessage(2, BLANK); if (_initialStartFrame >= 0) loadFrame(_initialStartFrame); else if (!_signalFlag && _onStartFrame >= 0) loadFrame(_onStartFrame); petClear(); if (_soundHandle != -1) { stopSound(_soundHandle, 1); _soundHandle = -1; } if (_isOn) { _isOn = false; if (_offStartFrame >= 0) playSound("z#27.wav", 100); if (_signalFlag) setVisible(false); } performAction(true, findView()); CSUBTransition transMsg; transMsg.execute(this); return true; }
bool CBilgeSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) { petDisplayMessage(2, BLANK); petClear(); if (_soundHandle != -1) { stopSound(_soundHandle); _soundHandle = -1; } if (_enabled) { _enabled = false; if (_startFrame10 >= 0) playSound("z#27.wav"); } performAction(true); CSUBTransition transMsg; transMsg.execute(this); return true; }
bool CSuccUBus::TurnOff(CTurnOff *msg) { if (_soundHandle != -1) { stopSound(_soundHandle); _soundHandle = -1; } if (_startFrame10 >= 0) { playSound("z#27.wav", 100); playMovie(_startFrame10, _endFrame10, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); } if (!_field15C && _startFrame11 >= 0) playMovie(_startFrame11, _endFrame11, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); _enabled = false; performAction(true); CSUBTransition transMsg; transMsg.execute(this); return true; }
bool CSuccUBus::TurnOff(CTurnOff *msg) { if (_soundHandle != -1) { stopSound(_soundHandle); _soundHandle = -1; } if (_offStartFrame >= 0) { playSound("z#27.wav", 100); playMovie(_offStartFrame, _offEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); } if (!_signalFlag && _endingStartFrame >= 0) playMovie(_endingStartFrame, _endingEndFrame, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); _isOn = false; performAction(true); CSUBTransition transMsg; transMsg.execute(this); return true; }
bool CSuccUBus::MouseDragStartMsg(CMouseDragStartMsg *msg) { CPetControl *pet = getPetControl(); Rect tempRect = _rect1; tempRect.translate(_bounds.left, _bounds.top); if (_field1D8 || !_enabled || !_field188 || !tempRect.contains(msg->_mousePos) || !pet) return true; uint petRoomFlags = pet->getRoomFlags(); CGameObject *mailObject = findMail(petRoomFlags); if (!mailObject) return true; petAddToCarryParcel(mailObject); CViewItem *view = getView(); if (!view) return true; mailObject->moveUnder(view); mailObject->setPosition(Point(msg->_mousePos.x + mailObject->_bounds.width() / 2, msg->_mousePos.y + mailObject->_bounds.height() / 2)); CVisibleMsg visibleMsg(true); visibleMsg.execute(mailObject); CPassOnDragStartMsg dragMsg; dragMsg._mousePos = msg->_mousePos; dragMsg._value3 = 1; dragMsg.execute(mailObject); if (!dragMsg._value4) msg->_dragItem = mailObject; loadFrame(_field184); _field188 = 0; CSUBTransition transMsg; transMsg.execute(this); return true; }
bool CBilgeSuccUBus::TurnOn(CTurnOn *msg) { CPetControl *pet = getPetControl(); if (pet) { if (_startFrame9 >= 0) { playMovie(_startFrame9, _endFrame9, MOVIE_NOTIFY_OBJECT); playSound("z#26.wav"); } if (mailExists(pet->getRoomFlags()) && _startFrame2 >= 0) playMovie(_startFrame2, _endFrame2, 0); _enabled = true; CSUBTransition transMsg; transMsg.execute(this); setTalking(this, true); petSetArea(PET_REMOTE); petHighlightGlyph(16); } return true; }
bool CBilgeSuccUBus::TurnOff(CTurnOff *msg) { CPetControl *pet = getPetControl(); if (pet && mailExists(pet->getRoomFlags()) && _startFrame12 >= 0) playMovie(_startFrame12, _endFrame12, MOVIE_NOTIFY_OBJECT); else if (_endFrame12 >= 0) playMovie(_endFrame12, _endFrame12, MOVIE_NOTIFY_OBJECT); if (_soundHandle != -1) { stopSound(_soundHandle); _soundHandle = -1; } if (_startFrame10 >= 0) playMovie(_startFrame10, _endFrame10, MOVIE_NOTIFY_OBJECT); _enabled = false; performAction(true); CSUBTransition transMsg; transMsg.execute(this); return true; }
bool CBilgeSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { CPetControl *pet = getPetControl(); if (msg->_endFrame == _endFrame12) { if (_startFrame10 >= 0) playSound("z#27.wav"); } else if (msg->_endFrame == _endFrame10) { if (_startFrame11 >= 0) playSound("z#30.wav"); } else { if (_endFrame9 == _endFrame10 && pet) { if (_v2) { startTalking(this, getRandomNumber(1) ? 230062 : 230063); } else if (!findMail(pet->getRoomFlags())) { switch (getRandomNumber(4)) { case 0: startTalking(this, 230001); break; case 1: startTalking(this, 230002); break; case 2: startTalking(this, 230003); break; default: break; } } } if (msg->_endFrame == _endFrame3) { switch (_field158) { case 1: stopSound(_soundHandle); _soundHandle = playSound("z#3.wav"); break; case 2: stopSound(_soundHandle); _soundHandle = playSound("z#12.wav"); break; case 3: if (_isChicken) { startTalking(this, 230018); _isChicken = false; } else { startTalking(this, 230013); } break; case 4: startTalking(this, 230017); break; default: break; } CSUBTransition transMsg; transMsg.execute(this); } else if (msg->_endFrame == _bilgeEndFrame2) { playSound("z#25.wav", 70); playSound("z#24.wav", 70); } else if (msg->_endFrame == _endFrame4) { if (_mailP) { _mailP->petAddToInventory(); CVisibleMsg visibleMsg(true); visibleMsg.execute(_mailP); _mailP = nullptr; petSetArea(PET_INVENTORY); CSUBTransition transMsg; transMsg.execute(this); } } else if (msg->_endFrame == _bilgeEndFrame1) { changeView("BilgeRoomWith.Node 1.N", ""); _v2 = 0; resetMail(); if (_mailP) { _mailP->petAddToInventory(); CVisibleMsg visibleMsg(true); visibleMsg.execute(_mailP); _mailP = nullptr; petSetArea(PET_INVENTORY); } startTalking(this, 150); CBodyInBilgeRoomMsg bodyMsg; bodyMsg.execute("Service Elevator Entity"); decTransitions(); _field158 = 0; } else { _field158 = 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; }
bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { CPetControl *pet = getPetControl(); uint petRoomFlags = pet ? pet->getRoomFlags() : 0; if (msg->_endFrame == _offEndFrame) { if (_endingStartFrame >= 0) playSound("z#30.wav", 100); if (_signalFlag) { _signalFlag = false; setVisible(false); CSignalObject signalMsg; signalMsg._numValue = 1; signalMsg.execute(_signalTarget); } } if (msg->_endFrame == _onEndFrame) { bool flag = false; if (pet && !mailExists(petRoomFlags)) { CGameObject *mailObject = _enabled && compareRoomNameTo("Titania") ? findMailByFlags(RFC_TITANIA, petRoomFlags) : findMailByFlags(_flagsComparison, petRoomFlags); if (mailObject) { switch (getRandomNumber(4)) { case 0: startTalking(this, 70094, findView()); break; case 1: startTalking(this, 70095, findView()); break; case 2: startTalking(this, 70096, findView()); break; case 3: startTalking(this, 70098, findView()); break; case 4: startTalking(this, 70099, findView()); break; default: break; } flag = true; } } if (!_field188 && !flag) { stopSound(_soundHandle); _soundHandle = -1; switch (getRandomNumber(_style ? 7 : 5, &_priorRandomVal2)) { case 2: startTalking(this, 230001, findView()); break; case 3: startTalking(this, 230002, findView()); break; case 4: startTalking(this, 230003, findView()); break; case 5: startTalking(this, 230064, findView()); break; case 6: startTalking(this, 230062, findView()); break; case 7: startTalking(this, 230063, findView()); break; default: break; } } } if (msg->_endFrame == _sendEndFrame) { if (_sendAction == SA_FEATHERS) { startTalking(this, 230022, findView()); } else if (_sendAction == SA_EATEN) { startTalking(this, 230017, findView()); } else if (_sendLost) { startTalking(this, 230019, findView()); _sendLost = false; } else if (_isChicken) { startTalking(this, 230018, findView()); _isChicken = false; } else { startTalking(this, 230013, findView()); } if (_inProgress) { _inProgress = false; decTransitions(); } CSUBTransition transMsg; transMsg.execute(this); } if (msg->_endFrame == _receiveEndFrame) { // SuccUBus disgorged mail if (pet && _mailP) { _mailP->setMailDest(petRoomFlags); } _field188 = 1; _mailP = nullptr; if (_inProgress) { _inProgress = false; decTransitions(); } CSUBTransition transMsg; transMsg.execute(this); } return true; }
bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { CPetControl *pet = getPetControl(); uint petRoomFlags = pet ? pet->getRoomFlags() : 0; if (msg->_endFrame == _endFrame10) { if (_startFrame11 >= 0) playSound("z#30.wav", 100); if (_field15C) { _field15C = false; setVisible(false); CSignalObject signalMsg; signalMsg._numValue = 1; signalMsg.execute(_string2); } } if (msg->_endFrame == _endFrame9) { bool flag = false; if (pet && mailExists(petRoomFlags)) { CGameObject *mailObject = _v3 && compareRoomNameTo("Titania") ? findMailByFlags(3, petRoomFlags) : findMailByFlags(_field140, petRoomFlags); if (mailObject) { switch (getRandomNumber(4)) { case 0: startTalking(this, 70094, findView()); break; case 1: startTalking(this, 70095, findView()); break; case 2: startTalking(this, 70096, findView()); break; case 3: startTalking(this, 70098, findView()); break; case 4: startTalking(this, 70099, findView()); break; default: break; } flag = true; } } if (!_field188 && !flag) { stopSound(_soundHandle); _soundHandle = -1; switch (getRandomNumber(_v2 ? 7 : 5, &_field1B0)) { case 2: startTalking(this, 230001, findView()); break; case 3: startTalking(this, 230002, findView()); break; case 4: startTalking(this, 230003, findView()); break; case 5: startTalking(this, 230064, findView()); break; case 6: startTalking(this, 230062, findView()); break; case 7: startTalking(this, 230063, findView()); break; default: break; } } } if (msg->_endFrame == _endFrame3) { if (_field158 == 1) { startTalking(this, 230022, findView()); } else if (_field158 == 2) { startTalking(this, 230017, findView()); } else if (_field19C) { startTalking(this, 230019, findView()); _field19C = 0; } else if (_isChicken) { startTalking(this, 230018, findView()); _isChicken = false; } else { startTalking(this, 230013, findView()); } if (_field1D8) { _field1D8 = 0; decTransitions(); } CSUBTransition transMsg; transMsg.execute(this); } if (msg->_endFrame == _endFrame4) { if (pet && _mailP) { _mailP->setMailId(petRoomFlags); } _field188 = 1; _mailP = 0; if (_field1D8) { _field1D8 = 0; decTransitions(); } CSUBTransition transMsg; transMsg.execute(this); } return true; }
bool CBilgeSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { CPetControl *pet = getPetControl(); if (msg->_endFrame == _trayOutEndFrame) { if (_offStartFrame >= 0) playSound("z#27.wav"); } else if (msg->_endFrame == _offEndFrame) { if (_endingStartFrame >= 0) playSound("z#30.wav"); } else { if (msg->_endFrame == _onEndFrame && pet) { if (_style) { startTalking(this, getRandomNumber(1) ? 230062 : 230063); } else if (!findMail(pet->getRoomFlags())) { switch (getRandomNumber(4)) { case 0: startTalking(this, 230001); break; case 1: startTalking(this, 230002); break; case 2: startTalking(this, 230003); break; default: break; } } } else if (msg->_endFrame == _sendEndFrame) { switch (_sendAction) { case SA_EATEN: stopSound(_soundHandle, 1); _soundHandle = playSound("z#3.wav", 1); break; case SA_BILGE_FEATHERS: stopSound(_soundHandle); _soundHandle = playSound("z#12.wav"); break; case SA_BILGE_SENT: if (_isChicken) { startTalking(this, 230018); _isChicken = false; } else { startTalking(this, 230013); } break; case SA_BILGE_EATEN: startTalking(this, 230017); break; default: break; } CSUBTransition transMsg; transMsg.execute(this); } else if (msg->_endFrame == _receiveEndFrame) { if (_mailP) { _mailP->petAddToInventory(); CVisibleMsg visibleMsg(true); visibleMsg.execute(_mailP); _mailP = nullptr; petSetArea(PET_INVENTORY); CSUBTransition transMsg; transMsg.execute(this); } } else if (msg->_endFrame == _sneezing1EndFrame) { playSound("z#25.wav", 70); playSound("z#24.wav", 70); } else if (msg->_endFrame == _sneezing2EndFrame) { changeView("BilgeRoomWith.Node 1.N", ""); _style = false; resetMail(); if (_mailP) { _mailP->petAddToInventory(); CVisibleMsg visibleMsg(true); visibleMsg.execute(_mailP); _mailP = nullptr; petSetArea(PET_INVENTORY); } startTalking(this, 150); CBodyInBilgeRoomMsg bodyMsg; bodyMsg.execute("Service Elevator Entity"); decTransitions(); _sendAction = SA_SENT; } else { _sendAction = SA_SENT; } } return true; }