Esempio n. 1
0
//	displays transition before a new location
//
//	clears screen (in white??)
//	shows location comment (if any)
//	waits for mouse click
//	fades towards game palette
//
void Parallaction::doLocationEnterTransition() {
	debugC(2, kDebugExec, "doLocationEnterTransition");

	if (_location._comment.empty()) {
		return;
	}

	if (getLocationFlags() & kFlagsVisited) {
		debugC(2, kDebugExec, "skipping location transition");
		return; // visited
	}

	Palette pal(_gfx->_palette);
	pal.makeGrayscale();
	_gfx->setPalette(pal);

	_programExec->runScripts(_location._programs.begin(), _location._programs.end());
	updateZones();
	showLocationComment(_location._comment, false);
	_gfx->updateScreen();

	_input->waitForButtonEvent(kMouseLeftUp);
	_gfx->freeDialogueObjects();

	// fades maximum intensity palette towards approximation of main palette
	for (uint16 _si = 0; _si<6; _si++) {
		pal.fadeTo(_gfx->_palette, 4);
		_gfx->setPalette(pal);
		_gfx->updateScreen();
		_system->delayMillis(20);
	}

	_gfx->setPalette(_gfx->_palette);

	debugC(2, kDebugExec, "doLocationEnterTransition completed");
}
Esempio n. 2
0
// FIXME: Parallaction_br::parseLocation() is now a verbatim copy of the same routine from Parallaction_ns.
void Parallaction_br::parseLocation(const char *filename) {
	debugC(1, kDebugParser, "parseLocation('%s')", filename);

	// find a new available slot
	allocateLocationSlot(filename);
	Script *script = _disk->loadLocation(filename);

	// parse the text file
	LocationParserOutput_br out;
	_locationParser->parse(script, &out);
	assert(out._info);
	delete script;

	bool visited = getLocationFlags() & kFlagsVisited;

	// load background, mask and path
	_disk->loadScenery(*out._info,
		out._backgroundName.empty() ? 0 : out._backgroundName.c_str(),
		out._maskName.empty()       ? 0 : out._maskName.c_str(),
		out._pathName.empty()       ? 0 : out._pathName.c_str());
	// assign background
	_gfx->setBackground(kBackgroundLocation, out._info);


	// process zones
	ZoneList::iterator zit = _location._zones.begin();
	for ( ; zit != _location._zones.end(); ++zit) {
		ZonePtr z = *zit;
		// restore the flags if the location has already been visited
		restoreOrSaveZoneFlags(z, visited);

		// (re)link the bounding animation if needed
		if (z->_flags & kFlagsAnimLinked) {
			z->_linkedAnim = _location.findAnimation(z->_linkedName.c_str());
		}

		bool visible = (z->_flags & kFlagsRemove) == 0;
		if (visible) {
			showZone(z, visible);
		}
	}

	// load the character (must be done before animations are processed)
	if (!out._characterName.empty()) {
		changeCharacter(out._characterName.c_str());
	}

	// process animations
	AnimationList::iterator ait = _location._animations.begin();
	for ( ; ait != _location._animations.end(); ++ait) {
		// restore the flags if the location has already been visited
		restoreOrSaveZoneFlags(*ait, visited);

		// load the script
		if ((*ait)->_scriptName) {
			loadProgram(*ait, (*ait)->_scriptName);
		}
	}

	debugC(1, kDebugParser, "parseLocation('%s') done", filename);
	return;
}