Common::Error Parallaction_br::go() {

	bool splash = true;

	while (!shouldQuit()) {

		if (getFeatures() & GF_DEMO) {
			scheduleLocationSwitch("camalb");
			_nextPart = 1;
			_input->_inputMode = Input::kInputModeGame;
		} else {
			startGui(splash);
			 // don't show splash after first time
			splash = false;
		}

//		initCharacter();

		while (((_engineFlags & kEngineReturn) == 0) && (!shouldQuit())) {
			runGame();
		}
		_engineFlags &= ~kEngineReturn;

		cleanupGame();
	}

	return Common::kNoError;
}
Example #2
0
void cleanup()
{
	curs_set(1); // set cursor back to being visible
	cleanupMenu();
	cleanupGame();
	clear();
	refresh();
	delwin(w);
    	endwin();
}
void Parallaction_br::changeLocation() {
	if (_newLocationName.empty()) {
		return;
	}

	if (_nextPart != -1) {
		cleanupGame();

		// more cleanup needed for part changes (see also saveload)
		_globalFlags = 0;
		cleanInventory(true);
		strcpy(_characterName1, "null");

		_part = _nextPart;

		if (getFeatures() & GF_DEMO) {
			assert(_part == 1);
		} else {
			assert(_part >= 0 && _part <= 4);
		}

		_disk->selectArchive(_partNames[_part]);

		memset(_counters, 0, ARRAYSIZE(_counters));

		_globalFlagsNames = _disk->loadTable("global");
		_objectsNames = _disk->loadTable("objects");
		_countersNames = _disk->loadTable("counters");

		// TODO: maybe handle this into Disk
		delete _objects;
		if (getPlatform() == Common::kPlatformPC) {
			_objects = _disk->loadObjects("icone.ico");
		} else {
			_objects = _disk->loadObjects("icons.ico", _part);
		}

		parseLocation("common.slf");
	}

	freeLocation(false);
	// load new location
	strcpy(_location._name, _newLocationName.c_str());
	parseLocation(_location._name);

	if (_location._startPosition.x != -1000) {
		_char._ani->setFoot(_location._startPosition);
		_char._ani->setF(_location._startFrame);
	}

	// re-link the follower animation
	setFollower(_followerName);
	if (_follower) {
		Common::Point p = _location._followerStartPosition;
		if (p.x == -1000) {
			_char._ani->getFoot(p);
		}
		_follower->setFoot(p);
		_follower->setF(_location._followerStartFrame);
	}

	_location._startPosition.x = -1000;
	_location._startPosition.y = -1000;
	_location._followerStartPosition.x = -1000;
	_location._followerStartPosition.y = -1000;

	_gfx->setScrollPosX(0);
	_gfx->setScrollPosY(0);
	if (_char._ani->gfxobj) {
		Common::Point foot;
		_char._ani->getFoot(foot);

		if (foot.x > 550)
			_gfx->setScrollPosX(320);

		if (foot.y > 350)
			_gfx->setScrollPosY(foot.y - 350);
	}

	// kFlagsRemove is cleared because the character is visible by default.
	// Commands can hide the character, anyway.
	_char._ani->_flags &= ~kFlagsRemove;
	_cmdExec->run(_location._commands);

	doLocationEnterTransition();

	_cmdExec->run(_location._aCommands);

	// NOTE: music should not started here!
	// TODO: implement the music commands which control music execution
	_soundMan->execute(SC_PLAYMUSIC);

	_engineFlags &= ~kEngineChangeLocation;
	_newLocationName.clear();
	_nextPart = -1;
}