int isEquals(struct node* a, struct node* b) { if (a==NULL && b==NULL){return(1);} else if (a!=NULL && b!=NULL) { return(a->data == b->data && isEquals(a->left, b->left) && isEquals(a->right, b->right)); } else return(0); }
bool CBrain::UseWithOtherMsg(CUseWithOtherMsg *msg) { CBrainSlot *slot = dynamic_cast<CBrainSlot *>(msg->_other); if (!slot) return CCarry::UseWithOtherMsg(msg); if (isEquals("CentralCore")) { setVisible(false); petMoveToHiddenRoom(); CAddHeadPieceMsg headpieceMsg(getName()); headpieceMsg.execute("CentralCoreSlot"); } else if (!slot->_occupied && slot->getName() != "CentralCoreSlot") { // Brain card goes into vacant slot setVisible(false); petMoveToHiddenRoom(); CAddHeadPieceMsg headpieceMsg(getName()); headpieceMsg.execute(msg->_other); playSound(TRANSLATE("z#116.wav", "z#647.wav")); setPosition(Point(0, 0)); setVisible(false); _pieceAdded = true; } else { // Trying to put brain card into an already occupied slot petAddToInventory(); } return true; }
bool CShipSetting::MouseDragStartMsg(CMouseDragStartMsg *msg) { if (!checkStartDragging(msg)) return false; if (_itemName == "NULL") return true; CTurnOff offMsg; offMsg.execute(_target); if (isEquals("ChickenSetting") || _itemName == "ChickenBridge") { CActMsg actMsg("IncreaseQuantity"); actMsg.execute("ChickenDispenser"); } if (_itemName != "NULL") { CPassOnDragStartMsg passMsg(msg->_mousePos, 1); passMsg.execute(_itemName); msg->_dragItem = getRoot()->findByName(_itemName); CVisibleMsg visibleMsg(true); visibleMsg.execute(_itemName); } CSetFrameMsg frameMsg(0); frameMsg.execute(_frameTarget); _itemName = "NULL"; _cursorId = CURSOR_ARROW; return true; }
bool CPlugIn::UseWithOtherMsg(CUseWithOtherMsg *msg) { CGameObject *other = msg->_other; CString otherName = other->getName(); if (otherName == "PET") { return CCarry::UseWithOtherMsg(msg); } else if (isEquals("DatasideTransporter")) { CShowTextMsg textMsg("This item is incorrectly calibrated."); textMsg.execute("PET"); } else if (isEquals("DatasideTransporter")) { error("TODO: Set msg->_other->fieldC4 = 2"); } else if (isEquals("SendYourself")) { error("TODO: Set msg->_other->fieldC8 = 1"); } 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; }
bool CBrainSlot::AddHeadPieceMsg(CAddHeadPieceMsg *msg) { _added = true; _cursorId = CURSOR_HAND; CAddHeadPieceMsg addMsg("NULL"); if (isEquals("AuditoryCentreSlot")) { if (msg->_value == "AuditoryCentre") addMsg._value = "AuditoryCentre"; } else if (isEquals("SpeechCentreSlot")) { if (msg->_value == "SpeechCentre") addMsg._value = "SpeechCentre"; } else if (isEquals("OlfactoryCentreSlot")) { if (msg->_value == "OlfactoryCentre") addMsg._value = "OlfactoryCentre"; } else if (isEquals("VisionCentreSlot")) { if (msg->_value == "VisionCentre") addMsg._value = "VisionCentre"; } else if (isEquals("CentralCoreSlot")) { if (msg->_value == "CentralCore") addMsg._value = "CentralCore"; } if (addMsg._value != "NULL") addMsg.execute("TitaniaControl"); if (addMsg._value == "OlfactoryCentre") loadFrame(2); else if (addMsg._value == "AuditoryCentre") loadFrame(1); else if (addMsg._value == "SpeechCentre") loadFrame(3); else if (addMsg._value == "VisionCentre") loadFrame(4); else if (addMsg._value == "CentralCore") { CActMsg actMsg("Insert Central Core"); actMsg.execute("CentralCoreSlot"); } _target = msg->_value; _value1 = 1; return true; }
bool CBottomOfWellMonitor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (isEquals("BOWTelevisionMonitor")) { if (_tvPresent) changeView("BottomOfWell.Node 7.N", ""); } else { if (_headPresent) changeView("BottomOfWell.Node 8.N", ""); } return true; }
bool CSGTStateRoom::EnterRoomMsg(CEnterRoomMsg *msg) { CPetControl *pet = getPetControl(); uint roomFlags = pet->getRoomFlags(); uint assignedRoom = pet->getAssignedRoomFlags(); if (roomFlags == assignedRoom) { loadFrame(_savedFrame); _isClosed = _savedIsClosed; setVisible(_savedVisible); if (isEquals("Desk") && _statics->_desk == "Closed") loadFrame(1); } if (isEquals("Drawer")) { petSetArea(PET_REMOTE); if (roomFlags == assignedRoom && getPassengerClass() == 3 && _statics->_announcementFlag) { // Congratulations, you may have won an upgrade playSound("b#21.wav"); _statics->_announcementFlag = false; } _statics->_drawer = "Closed"; setVisible(false); _isClosed = true; } else if (roomFlags != assignedRoom) { loadFrame(0); if (_displayFlag) { setVisible(true); if (isEquals("Desk")) loadFrame(1); } else { setVisible(false); } } return true; }
bool CCentralCore::DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg) { CString name = msg->_object->getName(); if (name == "PerchCoreHolder") { CParrot::_v2 = 1; if (isEquals("CentralCore")) CParrot::_v5 = 0; CActMsg actMsg("LosePerch"); actMsg.execute("ParrotLobbyController"); } else if (name == "PerchHolder") { CActMsg actMsg("LoseStick"); actMsg.execute("ParrotLobbyController"); } return true; }
bool CBottomOfWellMonitor::EnterViewMsg(CEnterViewMsg *msg) { if (_flag) { if (isEquals("BOWTelevisionMonitor")) { if (_tvPresent) { changeView("BottomOfWell.Node 7.N", ""); _flag = false; } } else { if (_headPresent) { changeView("BottomOfWell.Node 8.N", ""); _flag = false; } } } return true; }
bool CShipSetting::AddHeadPieceMsg(CAddHeadPieceMsg *msg) { _cursorId = CURSOR_HAND; if (msg->_value == "Enable") { CTurnOn onMsg; onMsg.execute(_target); if (isEquals("ChickenSetting")) { CActMsg actMsg("DecreaseQuantity"); actMsg.execute("ChickenDispenser"); } } else { CTurnOff offMsg; offMsg.execute(_target); } return true; }
bool CCentralCore::DropZoneGotObjectMsg(CDropZoneGotObjectMsg *msg) { CString name = msg->_object->getName(); if (name == "PerchCoreHolder") { if (isEquals("CentralCore")) { CParrot::_v5 = 1; CActMsg actMsg("CoreReplaced"); actMsg.execute("ParrotCage"); } CActMsg actMsg("GainPerch"); actMsg.execute("ParrotLobbyController"); } else if (name == "PerchHolder") { CActMsg actMsg("GainStick"); actMsg.execute("ParrotLobbyController"); } return true; }
bool CParrotLobbyLinkUpdater::ActMsg(CActMsg *msg) { if (msg->_action != "Refresh") return false; CNodeItem *node = findNode(); LinkUpdatorEntries *entriesP; if (isEquals("ParrotLobbyUpdater_TOW")) { entriesP = &_entries[4]; } else { if (node->_nodeNumber > 3) return true; entriesP = &_entries[node->_nodeNumber]; } int count = entriesP->size(); for (CTreeItem *item = node->getFirstChild(); item; item = item->scan(node)) { CLinkItem *link = dynamic_cast<CLinkItem *>(item); if (!link || count == 0) continue; CString linkName = link->getName(); char c = linkName.lastChar(); if (c >= 'a' && c <= 'd') linkName.deleteLastChar(); for (uint idx = 0; idx < entriesP->size(); ++idx) { const LinkUpdatorEntry &entry = (*entriesP)[idx]; if (entry._linkStr == linkName) { int val = entry._vals[CParrotLobbyObject::_flags]; if (val) linkName += (char)(0x60 + val); link->_name = linkName; break; } } } return true; }
bool CBrainSlot::MouseDragStartMsg(CMouseDragStartMsg *msg) { if (!_value1 || _woken || !checkPoint(msg->_mousePos, false, true)) return false; _cursorId = CURSOR_ARROW; CVisibleMsg visibleMsg(true); visibleMsg.execute(_target); CTakeHeadPieceMsg takeMsg(_target); takeMsg.execute("TitaniaControl"); loadFrame(isEquals("CentralCoreSlot") ? 21 : 0); _value1 = 0; CPassOnDragStartMsg passMsg; passMsg._mousePos = msg->_mousePos; passMsg.execute(_target); msg->_dragItem = getRoot()->findByName(_target); _added = false; return true; }
bool CSGTNavigation::StatusChangeMsg(CStatusChangeMsg *msg) { CPetControl *pet = getPetControl(); if (isEquals("SGTLL")) { static const int FRAMES[7] = { 0, 149, 112, 74, 0, 36, 74 }; _statics->_changeViewNum = msg->_newStatus; if (pet->getRooms1CC() != _statics->_changeViewNum) { changeView("SGTLittleLift.Node 1.N"); } int startVal = pet->getRooms1CC(); if (startVal > _statics->_changeViewNum) playMovie(FRAMES[startVal], FRAMES[_statics->_changeViewNum], MOVIE_WAIT_FOR_FINISH); else playMovie(FRAMES[startVal + 3], FRAMES[_statics->_changeViewNum + 3], MOVIE_WAIT_FOR_FINISH); _cursorId = _statics->_changeViewNum != 1 ? CURSOR_MOVE_FORWARD : CURSOR_INVALID; pet->setRooms1CC(_statics->_changeViewNum); pet->resetRoomsHighlight(); } return true; }
bool CParrot::ParrotSpeakMsg(CParrotSpeakMsg *msg) { static const char *const ROOM_NAMES[] = { "SGTState", "SGTLittleLift", "SecClassLittleLift", "SecClassState", "Lift", "ServiceElevator", "Dome", "Home", "MoonEmbLobby", nullptr }; if (!stateGet24() || _v4 == 3 || compareViewNameTo("Titania.Node 18.N")) return true; // Check for rooms not to speak in for (const char *const *s = &ROOM_NAMES[0]; *s; ++s) { if (isEquals(*s)) return true; } // Don't have the parrot speak too often if ((getTicksCount() - _field120) < 20000 || _speechCounter) return true; playSound("z#475.wav", 50); if (msg->_target == "Bomb") { startTalking("PerchedParrot", 280236); } else if (msg->_target == "Announcements") { startTalking("PerchedParrot", 280263); } else if (msg->_target == "Television") { startTalking("PerchedParrot", 280264); } else if (msg->_target == "Barbot") { if (msg->_action == "AskForDrink") startTalking("PerchedParrot", 280262); } else if (msg->_target == "SuccUBus") { if (msg->_action == "TurnOn") startTalking("PerchedParrot", 80161); else if (msg->_action == "EnterView") startTalking("PerchedParrot", 80159); } else if (msg->_target == "Cellpoints") { if (getRandomNumber(2) == 0) { switch (getRandomNumber(2)) { case 0: startTalking("PerchedParrot", 80193); break; case 1: startTalking("PerchedParrot", 80197); break; case 2: startTalking("PerchedParrot", 80198); break; default: break; } } else if (msg->_action == "DoorBot") { startTalking("PerchedParrot", 80195); } else if (msg->_action == "DeskBot") { startTalking("PerchedParrot", 80194); } else if (msg->_action == "BarBot") { startTalking("PerchedParrot", 80191); } else if (msg->_action == "BellBot") { startTalking("PerchedParrot", 80192); } else if (msg->_action == "LiftBot") { startTalking("PerchedParrot", 80196); } } _field120 = getTicksCount(); return true; }