bool CTriggerAutoMusicPlayer::TriggerAutoMusicPlayerMsg(CTriggerAutoMusicPlayerMsg *msg) { CRoomItem *room1 = msg->_value == 1 ? locateRoom(_roomName) : findRoom(); CRoomItem *room2 = msg->_value == 2 ? locateRoom(_roomName) : findRoom(); CChangeMusicMsg changeMsg; changeMsg._flags = 1; changeMsg.execute(room1, CAutoMusicPlayer::_type, MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN); changeMsg._flags = 2; changeMsg.execute(room2, CAutoMusicPlayer::_type, MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN); return true; }
bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { stopMovie(); if (msg->_mousePos.y >= 360) { petAddToInventory(); return true; } if (compareViewNameTo("ParrotLobby.Node 1.N")) { if (msg->_mousePos.x >= 75 && msg->_mousePos.x <= 565 && !CParrot::_v2 && !CCage::_open) { setVisible(false); _fieldE0 = 0; CTreeItem *perchedParrot = findUnder(getRoot(), "PerchedParrot"); detach(); addUnder(perchedParrot); sound8(true); CPutParrotBackMsg backMsg(msg->_mousePos.x); backMsg.execute(perchedParrot); } else { setVisible(false); _fieldE0 = 0; CParrot::_v4 = 2; playSound("z#475.wav"); sound8(true); moveUnder(findRoom()); CActMsg actMsg("Shut"); actMsg.execute("ParrotCage"); } } else { CCharacter *character = dynamic_cast<CCharacter *>(msg->_dropTarget); if (character) { CUseWithCharMsg charMsg(character); charMsg.execute(this, nullptr, 0); } else { setVisible(false); _fieldE0 = 0; playSound("z#475.wav"); sound8(true); moveUnder(findRoom()); } } showMouse(); return true; }
bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { if (CParrot::_v4 != 3) { moveToView(); setPosition(Point(0, 0)); setVisible(true); playClip("Pick Up", 2); playClip("Flapping", 1); stopTimer(_timerId); _timerId = addTimer(1000, 1000); _freeCounter = 0; CParrot::_v4 = 1; msg->_value3 = 1; return CCarry::PassOnDragStartMsg(msg); } CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(_string6)); if (npc) startTalking(npc, 0x446BF); _fieldE0 = 0; playSound("z#475.wav"); moveUnder(findRoom()); msg->_value4 = 1; return true; }
bool CEmmaControl::StatusChangeMsg(CStatusChangeMsg *msg) { _flag = !_flag; setVisible(_flag); CChangeMusicMsg changeMsg(_flag ? _visibleSoundName : _hiddenSoundName, 0); changeMsg.execute(findRoom(), CAutoMusicPlayer::_type, MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_CLASS_DEF); return true; }
bool CUpLighter::TimerMsg(CTimerMsg *msg) { if (_isSpring && _inRoom & !_hosePumping) { CActMsg actMsg("Sneeze"); actMsg.execute(findRoom()->findByName("NoseHolder")); addTimer(1000 + getRandomNumber(19000), 0); } return true; }
bool CAutoMusicPlayer::EnterRoomMsg(CEnterRoomMsg *msg) { if (!_isRepeated) { CRoomItem *room = findRoom(); if (msg->_newRoom == room) addTimer(2000); } return true; }
void Server::deleteRoom(QString const& pRoomName) { auto room = findRoom(pRoomName); disconnect(*room, &Room::roomEmpty, this, &Server::deleteRoom); disconnect(*room, &Room::commandSended, this, &Server::handleCommand); (*room)->deleteLater(); m_rooms.erase(room); }
bool CMissiveOMat::TimerMsg(CTimerMsg *msg) { if (_mode == 3) { CTreeItem *loginControl = findRoom()->findByName("MissiveOMat Login Control"); CEditControlMsg editMsg; editMsg._mode = 10; editMsg._param = 8; editMsg.execute(loginControl); } return true; }
bool CEarSweetBowl::MovieEndMsg(CMovieEndMsg *msg) { CIsEarBowlPuzzleDone doneMsg; doneMsg.execute(findRoom()); if (!doneMsg._value) { CPetControl *pet = getPetControl(); if (pet) pet->hasRoomFlags(); CIsParrotPresentMsg parrotMsg; parrotMsg.execute(findRoom()); if (parrotMsg._value) { CNutPuzzleMsg nutMsg("Jiggle"); nutMsg.execute("NutsParrotPlayer"); } } return true; }
bool CMusicSystemLock::MovieEndMsg(CMovieEndMsg *msg) { CTreeItem *phonograph = findRoom()->findByName("Restaurant Phonograph"); // Toggle the locked status of the music system CQueryPhonographState queryMsg; queryMsg.execute(phonograph); CLockPhonographMsg lockMsg(!queryMsg._value); lockMsg.execute(phonograph, nullptr, MSGFLAG_SCAN); setVisible(false); return true; }
bool CAutoMusicPlayer::LeaveRoomMsg(CLeaveRoomMsg *msg) { if (_isEnabled) { CRoomItem *room = findRoom(); if (msg->_oldRoom == room) { CChangeMusicMsg changeMsg; changeMsg._action = MUSIC_STOP; changeMsg.execute(this); } } if (!_leaveRoomSound.empty()) playSound(_leaveRoomSound); return true; }
bool CAutoMusicPlayer::LeaveRoomMsg(CLeaveRoomMsg *msg) { if (_isRepeated) { CRoomItem *room = findRoom(); if (msg->_oldRoom == room) { CChangeMusicMsg changeMsg; changeMsg._flags = 1; changeMsg.execute(this); } } if (!_leaveRoomSound.empty()) playSound(_leaveRoomSound); return true; }
bool CTelevision::MovieEndMsg(CMovieEndMsg *msg) { if (getRandomNumber(6) == 0) { CParrotSpeakMsg parrotMsg("Television", ""); parrotMsg.execute("PerchedParrot"); } if (_channelNum == 3 && compareRoomNameTo("SGTState") && getPassengerClass() == THIRD_CLASS) { // WORKAROUND: The original allowed the magazine to be "won" multiple times. We // now search for magazine within the room (which is it's initial, hidden location). // That way, when it's 'Won', it's no longer present and can't be won again CMagazine *magazine = dynamic_cast<CMagazine *>(findRoom()->findByName("Magazine")); if (magazine) { // You may be a winner CProximity prox1, prox2; prox1._soundType = prox2._soundType = Audio::Mixer::kSpeechSoundType; playSound(TRANSLATE("z#47.wav", "z#578.wav"), prox1); _soundHandle = playSound(TRANSLATE("b#20.wav", "b#1.wav"), prox2); // Get the room flags for the SGT floor we're on CPetControl *pet = getPetControl(); uint roomFlags = pet->getRoomFlags(); // Send the magazine to the SuccUBus debugC(DEBUG_INTERMEDIATE, kDebugScripts, "Assigned room - %d", roomFlags); magazine->addMail(roomFlags); magazine->sendMail(roomFlags, roomFlags); loadFrame(561); } else { petDisplayMessage(NOTHING_ON_CHANNEL); } } else if (_channelNum == 2) { loadFrame(_seasonFrame); } else if (_channelNum == 4 && _channel4Glyph) { if (_turnOn) loadFrame(502); else petDisplayMessage(NOTHING_ON_CHANNEL); } else if (_channelNum == 5 && *CGetLiftEye2::_destObject != "NULL") { loadFrame(393 + _eyeFloorNum); } else { petDisplayMessage(NOTHING_ON_CHANNEL); } return true; }
bool CAutoMusicPlayerBase::LoadSuccessMsg(CLoadSuccessMsg *msg) { if (_isEnabled) { // WORKAROUND: A problem was encountered with the EmbLobby music player // not getting turned off when room was left, so was turned on again // when loading a savegame elsewhere. This guards against it CRoomItem *newRoom = getGameManager()->getRoom(); if (findRoom() != newRoom) { _isEnabled = false; return true; } playAmbientSound(_filename, _volumeMode, _initialMute, true, 0, Audio::Mixer::kMusicSoundType); } return true; }
bool CRestaurantPhonograph::PhonographPlayMsg(CPhonographPlayMsg *msg) { if (_fieldE0) { if (findView() == getView() && (!_fieldE8 || !_field114)) { loadFrame(_fieldEC); playSound(_ejectSoundName); } CQueryCylinderNameMsg nameMsg; nameMsg.execute(this); CRestaurantMusicChanged musicMsg(nameMsg._name); musicMsg.execute(findRoom()); } else { loadFrame(_fieldF0); } return true; }
bool CViewAutoSoundPlayer::EnterViewMsg(CEnterViewMsg *msg) { CViewItem *view = findView(); CRoomItem *room = findRoom(); if (view == msg->_newView) { CTurnOn onMsg; onMsg.execute(this); if (_enabled) { CChangeMusicMsg changeMsg; changeMsg._action = MUSIC_STOP; changeMsg.execute(room, CAutoMusicPlayer::_type, MSGFLAG_CLASS_DEF |MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN); } } return true; }
bool CNodeAutoSoundPlayer::LeaveNodeMsg(CLeaveNodeMsg *msg) { CNodeItem *node = findNode(); CRoomItem *room = findRoom(); if (node == msg->_oldNode) { CTurnOff offMsg; offMsg.execute(this); if (_enabled) { CChangeMusicMsg changeMsg; changeMsg._action = MUSIC_START; changeMsg.execute(room, CAutoMusicPlayer::_type, MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN); } } return true; }
void Server::addUserInRoom(const QString &pRoomName, Entity::Client *pClient) { auto room = findRoom(pRoomName); if (room != m_rooms.end()) { (*room)->addClient(pClient); } else { auto room = new Room{pRoomName, this}; room->addClient(pClient); connect(room, &Room::roomEmpty, this, &Server::deleteRoom); connect(room, &Room::commandSended, this, &Server::handleCommand); m_rooms.push_back(room); } }
bool CMaitreD::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { if (msg->_action == 8) { _field12C = 1; stopAnimTimer(_timerId); _timerId = startAnimTimer("MD Fight", 3500, 0); } else if (msg->_action == 9) { stopAnimTimer(_timerId); _timerId = 0; } else if (msg->_action == 10) { _field12C = 0; _v1 = 1; stopAnimTimer(_timerId); _timerId = 0; CMaitreDDefeatedMsg defeatedMsg; defeatedMsg.execute(findRoom()); } return true; }
bool CParrot::MouseDragStartMsg(CMouseDragStartMsg *msg) { if (_field118 && !_v4 && checkPoint(msg->_mousePos, false, true)) { setVisible(false); CRoomItem *room = findRoom(); moveUnder(room); startTalking(this, 280129); performAction(true); CCarry *item = dynamic_cast<CCarry *>(getRoot()->findByName(_string2)); if (item) { item->_fieldE0 = 1; CPassOnDragStartMsg passMsg; passMsg._mousePos = msg->_mousePos; passMsg.execute(item); msg->_dragItem = item; CActMsg actMsg("LoseParrot"); actMsg.execute("ParrotLobbyController"); } } return true; }
bool CMusicConsoleButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_isActive) { CStopMusicMsg stopMsg(this); stopMsg.execute(this); stopMovie(); loadFrame(0); } else { CStartMusicMsg startMsg(this); startMsg.execute(this); playMovie(MOVIE_REPEAT); CMusicHasStartedMsg startedMsg; startedMsg.execute("Music Room Phonograph"); if (CMusicRoom::_musicHandler->checkSound(1) && CMusicRoom::_musicHandler->checkSound(2) && CMusicRoom::_musicHandler->checkSound(3)) { CCorrectMusicPlayedMsg correctMsg; correctMsg.execute(findRoom()); } } return true; }
bool CMissiveOMat::MissiveOMatActionMsg(CMissiveOMatActionMsg *msg) { CTreeItem *welcome = findByName("MissiveOMat Welcome"); switch (msg->_action) { case MESSAGE_SHOW: { CTreeItem *btnOk = findRoom()->findByName("MissiveOMat OK Button"); CTreeItem *btnNext = findRoom()->findByName("MissiveOMat Next Button"); CTreeItem *btnPrev = findRoom()->findByName("MissiveOMat Prev Button"); CTreeItem *btnLogout = findRoom()->findByName("MissiveOMat Logout Button"); _mode = MESSAGE_5; CVisibleMsg visibleMsg; visibleMsg._visible = false; visibleMsg.execute(btnOk); visibleMsg._visible = true; visibleMsg.execute(btnNext); visibleMsg.execute(btnPrev); visibleMsg.execute(btnLogout); _messageNum = 0; _totalMessages = 0; CString *strP = &_messages[_personIndex * 19]; for (_totalMessages = 0; !strP->empty(); ++strP, ++_totalMessages) ; CMissiveOMatActionMsg actionMsg; actionMsg._action = REDRAW_MESSAGE; actionMsg.execute(this); break; } case NEXT_MESSAGE: if (_messageNum < (_totalMessages - 1)) { ++_messageNum; CMissiveOMatActionMsg actionMsg; actionMsg._action = REDRAW_MESSAGE; actionMsg.execute(this); } break; case PRIOR_MESSAGE: if (_messageNum > 0) { --_messageNum; CMissiveOMatActionMsg actionMsg; actionMsg._action = REDRAW_MESSAGE; actionMsg.execute(this); } break; case MESSAGE_5: { CMissiveOMatActionMsg actionMsg; actionMsg._action = MESSAGE_9; actionMsg.execute(this); break; } case MESSAGE_DOWN: if (welcome) scrollTextDown(); break; case MESSAGE_UP: if (welcome) scrollTextUp(); break; case REDRAW_MESSAGE: if (welcome) { CString str = CString::format( "Missive %d of %d.\nFrom: %s\nTo: %s\n\n%s\n", _messageNum + 1, _totalMessages, _from[_messageNum].c_str(), _to[_messageNum].c_str(), _messages[_messageNum].c_str()); setText(str); } break; case MESSAGE_9: { loadFrame(1); _mode = MESSAGE_NONE; _personIndex = -1; static const char *const WIDGETS[7] = { "MissiveOMat Login Control", "MissiveOMat OK Button", "MissiveOMat Next Button", "MissiveOMat Prev Button", "MissiveOMat Logout Button", "MissiveOMat ScrollDown Button", "MissiveOMat ScrollUp Button" }; CEditControlMsg editMsg; for (int idx = 0; idx < 7; ++idx) { editMsg._mode = 0; editMsg._param = 12; editMsg.execute(WIDGETS[idx]); editMsg._mode = 1; editMsg.execute(WIDGETS[idx]); editMsg._mode = 13; editMsg.execute(WIDGETS[idx]); } editMsg._mode = 12; editMsg.execute("MissiveOMat Login Control"); editMsg._mode = 10; editMsg._param = 8; editMsg.execute("MissiveOMat Login Control"); editMsg._mode = 8; editMsg.execute("MissiveOMat Login Control"); _string1.clear(); _string2.clear(); break; } default: break; } return true; }
bool CMissiveOMat::KeyCharMsg(CKeyCharMsg *msg) { CTreeItem *loginControl = findRoom()->findByName("MissiveOMat Login Control"); CTreeItem *welcome = findRoom()->findByName("MissiveOMat Welcome"); CTreeItem *scrollUp = findRoom()->findByName("MissiveOMat ScrollUp Button"); CEditControlMsg editMsg; switch (_mode) { case 1: { playSound("z#228.wav"); editMsg._mode = 6; editMsg._param = msg->_key; editMsg.execute(loginControl); if (editMsg._param == 1000) { editMsg._mode = 3; editMsg.execute(loginControl); _string1 = editMsg._text; if (!_string1.empty()) { loadFrame(2); _mode = 2; editMsg._mode = 1; editMsg.execute(loginControl); editMsg._mode = 10; editMsg._param = 24; editMsg.execute(loginControl); } } break; } case 2: { playSound("z#228.wav"); editMsg._mode = 6; editMsg._param = msg->_key; editMsg.execute(loginControl); _string2 = editMsg._text; if (_string1 == "Droot Scraliontis") { _string1 = "Scraliontis"; } else if (_string1 == "Antar Brobostigon") { _string1 = "Brobostigon"; } else if (_string1 == "colin") { _string1 = "Leovinus"; } bool flag = false; if (_string1 == "Leovinus") { if (_string2 == "Other") { flag = true; _personIndex = 0; } } else if (_string1 == "Scraliontis") { if (_string2 == "This") { flag = true; _personIndex = 1; } } else if (_string1 == "Brobostigon") { if (_string2 == "That") { flag = true; _personIndex = 2; } } if (flag) { _mode = 4; loadFrame(4); editMsg._mode = 1; editMsg.execute(loginControl); getTextCursor()->hide(); editMsg._mode = 13; editMsg.execute(loginControl); editMsg._mode = 12; editMsg.execute(welcome); editMsg._mode = 2; editMsg._text = _welcomeMessages[_personIndex]; editMsg.execute(welcome); editMsg._mode = 12; editMsg._text = "MissiveOMat OK Button"; editMsg.execute(welcome); editMsg.execute(scrollUp); } else { _mode = 3; loadFrame(3); addTimer(1500); editMsg._mode = 1; editMsg.execute(loginControl); getTextCursor()->hide(); } break; } default: break; } return true; }
bool CParrot::MovieEndMsg(CMovieEndMsg *msg) { if ((_npcFlags & NPCFLAG_2000000) && clipExistsByEnd("Take Off", msg->_endFrame)) { setVisible(false); moveUnder(findRoom()); stopMovie(); CActMsg actMsg1("LoseParrot"); actMsg1.execute("ParrotLobbyController"); if (_field134) { CActMsg actMsg2("PanAwayFromParrot"); actMsg2.execute(_field134); _field134 = nullptr; } else { CActMsg actMsg2("Shut"); actMsg2.execute("ParrotCage"); } _npcFlags &= ~NPCFLAG_2000000; _v4 = 2; } else if (_npcFlags & NPCFLAG_10000) { if (_npcFlags & NPCFLAG_20000) { _npcFlags = (_npcFlags & ~NPCFLAG_20000) | NPCFLAG_40000; if (_npcFlags & NPCFLAG_100000) { playClip("Walk Left Loop", MOVIE_NOTIFY_OBJECT); movieEvent(236); } else { playClip("Walk Right Loop", MOVIE_NOTIFY_OBJECT); } } else if (_npcFlags & NPCFLAG_40000) { int xp = _bounds.left + _bounds.width() / 2; if (_npcFlags & NPCFLAG_100000) { if ((xp - _field128) > 32) { setPosition(Point(_bounds.left - 40, _bounds.top)); playClip("Walk Left Loop", MOVIE_NOTIFY_OBJECT); movieEvent(236); } else { setPosition(Point(_bounds.left - 10, _bounds.top)); playClip("Walk Left Outro", MOVIE_NOTIFY_OBJECT); _npcFlags = (_npcFlags & ~NPCFLAG_40000) | NPCFLAG_80000; } } else { if ((_field128 - xp) > 32) { playClip("Walk Right Loop", MOVIE_NOTIFY_OBJECT); movieEvent(244); } else { playClip("Walk Right Outro", MOVIE_NOTIFY_OBJECT); _npcFlags = (_npcFlags & NPCFLAG_40000) | NPCFLAG_80000; } } } else if (_npcFlags & NPCFLAG_80000) { loadFrame(0); if (_npcFlags & NPCFLAG_100000) setPosition(Point(_bounds.left - 30, _bounds.top)); else setPosition(Point(_bounds.left + 14, _bounds.top)); _npcFlags &= ~(NPCFLAG_10000 | NPCFLAG_80000 | NPCFLAG_100000 | NPCFLAG_200000); CTrueTalkNPC::MovieEndMsg(msg); } else { if (_npcFlags & NPCFLAG_1000000) { Point pt = getMousePos(); if (pt.x > 70 || pt.y < 90 || pt.y > 280) { stopMovie(); loadFrame(0); _npcFlags &= ~NPCFLAG_1000000; } if (clipExistsByEnd("Walk Left Loop", msg->_endFrame)) { playClip("Lean Over To Chicken", MOVIE_NOTIFY_OBJECT); setPosition(Point(_bounds.left - 55, _bounds.top)); _field130 = (-100 - _bounds.left) / 5; movieEvent(261); movieEvent(262); movieEvent(265); movieEvent(268); movieEvent(271); return true; } else if (clipExistsByEnd("Lean Over To Chicken", msg->_endFrame)) { playClip("Eat Chicken", 0); playClip("Eat Chicken 2", MOVIE_NOTIFY_OBJECT); _v1 = 1; CStatusChangeMsg statusMsg; statusMsg._newStatus = 0; statusMsg.execute("PerchCoreHolder"); CTrueTalkTriggerActionMsg actionMsg; actionMsg._param1 = 280266; actionMsg._param2 = 1; actionMsg.execute(this); CCarry *chicken = dynamic_cast<CCarry *>(findUnder(getRoot(), "Chicken")); if (chicken) { CActMsg actMsg("Eaten"); actMsg.execute(chicken); } _npcFlags &= ~NPCFLAG_1000000; return true; } } if (clipExistsByEnd("Eat Chicken 2", msg->_endFrame)) { CStatusChangeMsg statusMsg; statusMsg._newStatus = 1; statusMsg.execute("PerchCoreHolder"); if (_v2) { loadMovie("z168.avi", false); playClip("Take Off", MOVIE_NOTIFY_OBJECT); setPosition(Point(20, 10)); _npcFlags |= NPCFLAG_2000000; } else { _npcFlags &= ~(NPCFLAG_10000 | NPCFLAG_20000 | NPCFLAG_40000 | NPCFLAG_80000 | NPCFLAG_100000 | NPCFLAG_200000); _npcFlags |= NPCFLAG_400000; stopMovie(); loadFrame(0); setPosition(Point(-90, _bounds.top)); } } else { CTrueTalkNPC::MovieEndMsg(msg); } } } return true; }
void IRCSession::processCommandMode(shared_ptr<IRCCommandMode> command) { OS_ASSERT(command != nullptr); if(command->getTargetType() != ircTargetTypeChannel) return; shared_ptr<IRCRoom> room = findRoom(command->getTarget()); if(room == nullptr) { OS_ASSERTFALSE(); return; } shared_ptr<IRCUser> user; if(command->hasArg()) user = findUser(command->getArg()); shared_ptr<IRCRoom::UserDetails> userDetails; if(user != nullptr) userDetails = room->getUserDetails(user->getID()); const IRCCommandMode::ModeOptions &modes = command->getModeOptions(); for(IRCCommandMode::ModeOptions::const_iterator i = modes.begin(); i != modes.end(); ++i) { switch(i->first) { case ircModeTypeUnknown: break; case ircModeTypeOperator: if(userDetails != nullptr) userDetails->setType(i->second ? ircUserTypeOperator : ircUserTypeNormal); break; case ircModeTypeHalfOperator: if(userDetails != nullptr) userDetails->setType(i->second ? ircUserTypeHalfOperator : ircUserTypeNormal); break; case ircModeTypeVoice: if(userDetails != nullptr) userDetails->setVoice(i->second); break; case ircModeTypeInvisible: if(userDetails != nullptr) userDetails->setInvisible(i->second); break; case ircModeTypeBan: if(userDetails != nullptr) userDetails->setBanned(i->second); break; default: OS_ASSERTFALSE(); break; } } updateRoom(room, false); }