void CMainGameWindow::drawViewContents(CScreenManager *screenManager) { // Get a reference to the reference, validating that it's present if (!screenManager) return; CViewItem *view = _gameManager->getView(); if (!view) return; CNodeItem *node = view->findNode(); if (!node) return; CRoomItem *room = node->findRoom(); if (!room) return; double xVal = 0.0, yVal = 0.0; room->calcNodePosition(node->_nodePos, xVal, yVal); // Iterate through drawing all the items in the scene except any item // that's currently being dragged for (CTreeItem *treeItem = view; treeItem; treeItem = treeItem->scan(view)) { if (treeItem != _gameManager->_dragItem) treeItem->draw(screenManager); } // Finally draw the drag item if there is one if (_gameManager->_dragItem) _gameManager->_dragItem->draw(screenManager); }
void CPetControl::moveToHiddenRoom(CTreeItem *item) { CRoomItem *room = getHiddenRoom(); if (room) { item->detach(); room->addUnder(item); } }
bool CPetControl::checkNode(const CString &name) { CGameManager *gameManager = getGameManager(); if (!gameManager) return true; if (name == "NULL") return false; CViewItem *view = gameManager->getView(); if (!view) return true; CNodeItem *node = view->findNode(); if (!node) return true; CString viewName = view->getName(); CString nodeName = node->getName(); CRoomItem *room = getGameManager()->getRoom(); if (room) { CString roomName = room->getName(); CString newNode; if (roomName == "1stClassRestaurant") { } else if (nodeName == "Lobby Node") { nodeName = "Node 1"; } else if (nodeName == "Entrance Node") { nodeName = "Node 2"; } else if (nodeName == "MaitreD Node") { nodeName = "Node 3"; } else if (nodeName == "Scraliontis Table Standing Node") { nodeName = "Node 4"; } else if (nodeName == "Pellerator Node") { nodeName = "Node 5"; } else if (nodeName == "SUB Node") { nodeName = "Node 6"; } else if (nodeName == "Phonograph Node") { nodeName = "Node 7"; } else if (nodeName == "Scraliontis Table Seated Node") { nodeName = "Node 8"; } if (roomName == "MusicRoom") { if (nodeName == "Musical Instruments") nodeName = "Node 1"; if (nodeName == "Phonograph Node") nodeName = "Node 2"; } } CString str = CString::format("%s.%s", nodeName.c_str(), viewName.c_str()); str = str.right(5); str.toLowercase(); CString nameLower = name; nameLower.toLowercase(); return nameLower.contains(str); }
CString CGameManager::getFullViewName() { CViewItem *view = getView(); CNodeItem *node = view->findNode(); CRoomItem *room = node->findRoom(); return CString::format("%s.%s.%s", room->getName().c_str(), node->getName().c_str(), view->getName().c_str()); }
TTroomScript *CTrueTalkManager::getRoomScript() const { CRoomItem *room = _gameManager->getRoom(); TTroomScript *script = nullptr; if (room) { int scriptId = room->getScriptId(); if (scriptId) script = _scripts.getRoomScript(scriptId); } if (!script) { // Fall back on the default Room script script = _scripts.getRoomScript(110); } return script; }
CViewItem *CProjectItem::findView(int roomNumber, int nodeNumber, int viewNumber) { CTreeItem *treeItem = getFirstChild(); CRoomItem *roomItem = nullptr; // Scan for the specified room if (treeItem) { do { CTreeItem *childItem = treeItem->getFirstChild(); CRoomItem *rItem = dynamic_cast<CRoomItem *>(childItem); if (rItem && rItem->_roomNumber == roomNumber) { roomItem = rItem; break; } } while ((treeItem = treeItem->getNextSibling()) != nullptr); } if (!roomItem) return nullptr; // Scan for the specified node within the room CNodeItem *nodeItem = nullptr; CNodeItem *nItem = dynamic_cast<CNodeItem *>( roomItem->findChildInstanceOf(CNodeItem::_type)); for (; nItem && !nodeItem; nItem = dynamic_cast<CNodeItem *>( findNextInstanceOf(CNodeItem::_type, nItem))) { if (nItem->_nodeNumber == nodeNumber) nodeItem = nItem; } if (!nodeItem) return nullptr; // Scan for the specified view within the node CViewItem *viewItem = dynamic_cast<CViewItem *>( nodeItem->findChildInstanceOf(CViewItem::_type)); for (; viewItem; viewItem = dynamic_cast<CViewItem *>( findNextInstanceOf(CViewItem::_type, viewItem))) { if (viewItem->_viewNumber == viewNumber) return viewItem; } return nullptr; }
int CPetRemote::getHighlightIndex(RemoteGlyph val) { CRoomItem *room = getRoom(); if (!room) return -1; int roomIndex = roomIndexOf(room->getName()); if (roomIndex == -1) return -1; Common::Array<uint> remoteData; getRemoteData(roomIndex, remoteData); // Loop through the data for the room for (uint idx = 0; idx < remoteData.size(); ++idx) { if ((RemoteGlyph)remoteData[idx + 1] == val) return idx; } return -1; }