示例#1
0
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);
}
示例#2
0
void CGameState::changeView(CViewItem *newView, CMovieClip *clip) {
	// Signal the old view that it's being left
	CViewItem *oldView = _gameLocation.getView();
	oldView->leaveView(newView);

	// If Shift key is pressed, skip showing the transition clip
	if (g_vm->_events->isSpecialPressed(MK_SHIFT))
		clip = nullptr;

	if (_mode == GSMODE_CUTSCENE) {
		_movieList._destView = newView;
		_movieList._movieClip = clip;
		_gameManager->incTransitions();
	} else {
		oldView->preEnterView(newView);
		_gameManager->_gameView->setView(newView);
		CRoomItem *oldRoom = oldView->findNode()->findRoom();
		CRoomItem *newRoom = newView->findNode()->findRoom();

		// If a transition clip is defined, play it
		if (clip)
			_gameManager->playClip(clip, oldRoom, newRoom);

		// Final view change handling
		_gameManager->_sound.preEnterView(newView, newRoom != oldRoom);
		oldView->enterView(newView);
	}
}
示例#3
0
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);
}
示例#4
0
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());
}
示例#5
0
void CGameState::enterView() {
	CViewItem *oldView = _gameLocation.getView();
	CViewItem *newView = _movieList._destView;
	oldView->preEnterView(newView);

	_gameManager->_gameView->setView(newView);
	CRoomItem *oldRoom = oldView->findNode()->findRoom();
	CRoomItem *newRoom = newView->findNode()->findRoom();
	_gameManager->playClip(_movieList._movieClip, oldRoom, newRoom);

	_gameManager->_sound.preEnterView(newView, newRoom != oldRoom);
	_gameManager->decTransitions();
	oldView->enterView(newView);

	_movieList._destView = nullptr;
	_movieList._movieClip = nullptr;
}
示例#6
0
void CMainGameWindow::applicationStarting() {
	// Set the video mode
	CScreenManager *screenManager = CScreenManager::setCurrent();
	screenManager->setMode(640, 480, 16, 0, true);

#if 0
	// Show the initial copyright & info screen for the game
	if (gDebugLevel <= 0) {
		Image image;
		image.load("Bitmap/TITANIC");
		_vm->_screen->blitFrom(image, Point(
			SCREEN_WIDTH / 2 - image.w / 2,
			SCREEN_HEIGHT / 2 - image.h / 2
		));
		_vm->_events->sleep(5000);
	}
#endif

	// Set up the game project, and get game slot
	int saveSlot = getSavegameSlot();
	if (saveSlot == -2)
		return;

	// Create game view and manager
	_gameView = new CSTGameView(this);
	_gameManager = new CGameManager(_project, _gameView, g_vm->_mixer);
	_gameView->setGameManager(_gameManager);

	// Load either a new game or selected existing save
	_project->loadGame(saveSlot);
	_inputAllowed = true;
	_gameManager->_gameState.setMode(GSMODE_INTERACTIVE);

	// TODO: Cursor/image

	// Generate starting messages for entering the view, node, and room.
	// Note the old fields are nullptr, since there's no previous view/node/room
	CViewItem *view = _gameManager->_gameState._gameLocation.getView();
	CEnterViewMsg enterViewMsg(nullptr, view);
	enterViewMsg.execute(view, nullptr, MSGFLAG_SCAN);

	CNodeItem *node = view->findNode();
	CEnterNodeMsg enterNodeMsg(nullptr, node);
	enterNodeMsg.execute(node, nullptr, MSGFLAG_SCAN);

	CRoomItem *room = view->findRoom();
	CEnterRoomMsg enterRoomMsg(nullptr, room);
	enterRoomMsg.execute(room, nullptr, MSGFLAG_SCAN);

	_gameManager->initBounds();
}