Beispiel #1
0
void MohawkEngine_Riven::refreshCard() {
	// Clear any timer still floating around
	removeTimer();

	loadHotspots(_curCard);

	_gfx->_updatesEnabled = true;
	_gfx->clearWaterEffects();
	_gfx->_activatedPLSTs.clear();
	_video->stopVideos();
	_gfx->drawPLST(1);
	_activatedSLST = false;

	runCardScript(kCardLoadScript);
	_gfx->updateScreen();
	runCardScript(kCardOpenScript);

	// Activate the first sound list if none have been activated
	if (!_activatedSLST)
		_sound->playSLST(1, _curCard);

	if (_showHotspots)
		for (uint16 i = 0; i < _hotspotCount; i++)
			_gfx->drawRect(_hotspots[i].rect, _hotspots[i].enabled);

	// Now we need to redraw the cursor if necessary and handle mouse over scripts
	updateCurrentHotspot();

	// Finally, install any hardcoded timer
	installCardTimer();
}
Beispiel #2
0
void Database::loadRoomNodeScripts(Common::SeekableSubReadStreamEndian *file, Common::Array<NodePtr> &nodes) {
	uint zipIndex = 0;
	while (1) {
		int16 id = file->readUint16();

		// End of list
		if (id == 0)
			break;

		if (id <= -10)
			error("Unimplemented node list command");

		if (id > 0) {
			// Normal node
			NodePtr node = NodePtr(new NodeData());
			node->id = id;
			node->zipBitIndex = zipIndex;
			node->scripts = loadCondScripts(*file);
			node->hotspots = loadHotspots(*file);

			nodes.push_back(node);
		} else {
			// Several nodes sharing the same scripts
			Common::Array<int16> nodeIds;

			for (int i = 0; i < -id; i++) {
				nodeIds.push_back(file->readUint16());
			}

			Common::Array<CondScript> scripts = loadCondScripts(*file);
			Common::Array<HotSpot> hotspots = loadHotspots(*file);

			for (int i = 0; i < -id; i++) {
				NodePtr node = NodePtr(new NodeData());
				node->id = nodeIds[i];
				node->zipBitIndex = zipIndex;
				node->scripts = scripts;
				node->hotspots = hotspots;

				nodes.push_back(node);
			}
		}

		zipIndex++;
	}
}
Beispiel #3
0
void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) {
	// Store the previously active scene number and set the new one
	_priorSceneId = _currentSceneId;
	_currentSceneId = sceneId;

	_variant = 0;
	if (palFlag)
		_vm->_palette->resetGamePalette(18, 10);

	_spriteSlots.reset(false);
	_sequences.clear();
	_kernelMessages.clear();
	_vm->_palette->_paletteUsage.load(&_scenePaletteUsage);

	int flags = SCENEFLAG_LOAD_SHADOW;
	if (_vm->_dithering)
		flags |= SCENEFLAG_DITHER;

	_sceneInfo = SceneInfo::init(_vm);
	_sceneInfo->load(_currentSceneId, _variant, Common::String(), flags,
		_depthSurface, _backgroundSurface);

	// Initialize palette animation for the scene
	initPaletteAnimation(_sceneInfo->_paletteCycles, false);

	// Copy over nodes
	_rails.load(_sceneInfo->_nodes, &_depthSurface, _sceneInfo->_depthStyle);

	// Load hotspots
	loadHotspots();

	// Load vocab
	loadVocab();

	// Load palette usage
	_vm->_palette->_paletteUsage.load(&_paletteUsageF);

	// Load interface
	flags = PALFLAG_RESERVED | ANIMFLAG_LOAD_BACKGROUND;
	if (_vm->_dithering)
		flags |= ANIMFLAG_DITHER;
	if (_vm->_textWindowStill)
		flags |= ANIMFLAG_LOAD_BACKGROUND_ONLY;

	_animationData = Animation::init(_vm, this);
	DepthSurface depthSurface;
	_animationData->load(_userInterface, depthSurface, prefix, flags, nullptr, nullptr);

	_vm->_palette->_paletteUsage.load(&_scenePaletteUsage);

	_bandsRange = _sceneInfo->_yBandsEnd - _sceneInfo->_yBandsStart;
	_scaleRange = _sceneInfo->_maxScale - _sceneInfo->_minScale;

	_spriteSlots.reset(false);
	_interfaceY = MADS_SCENE_HEIGHT;
	_spritesCount = _sprites.size();

	_userInterface.setup(_vm->_game->_screenObjects._inputMode);

	_vm->_game->_screenObjects._category = CAT_NONE;
	_vm->_events->showCursor();
}