Example #1
0
Common::Error FullpipeEngine::run() {
	const Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
	// Initialize backend
	initGraphics(800, 600, true, &format);

	_backgroundSurface.create(800, 600, format);

	_origFormat = new Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);

	_console = new Console(this);

	initialize();

	_isSaveAllowed = false;

	int scene = 0;
	if (ConfMan.hasKey("boot_param"))
		scene = convertScene(ConfMan.getInt("boot_param"));

	if (!loadGam("fullpipe.gam", scene))
		return Common::kNoGameDataFoundError;

#if 0
	loadAllScenes();
#endif

	_gameContinue = true;

	while (_gameContinue) {
		updateEvents();

		updateScreen();

		if (_needRestart) {
			if (_modalObject) {
				delete _modalObject;
				_modalObject = 0;
			}

			freeGameLoader();
			_currentScene = 0;
			_updateTicks = 0;

			loadGam("fullpipe.gam");
			_needRestart = false;
		}

		if (_normalSpeed)
			_system->delayMillis(10);
		_system->updateScreen();
	}

	freeGameLoader();

	cleanup();

	return Common::kNoError;
}
Example #2
0
Common::Error FullpipeEngine::run() {
	const Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
	// Initialize backend
	initGraphics(800, 600, true, &format);

	_backgroundSurface = new Graphics::Surface;
	_backgroundSurface->create(800, 600, format);

	_origFormat = new Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);

	_console = new Console(this);

	initialize();

	_isSaveAllowed = false;

	int scene = 0;
	if (ConfMan.hasKey("boot_param"))
		scene = convertScene(ConfMan.getInt("boot_param"));

	if (ConfMan.hasKey("save_slot"))
		scene = -1;

	if (!loadGam("fullpipe.gam", scene))
		return Common::kNoGameDataFoundError;

	if (ConfMan.hasKey("save_slot")) {
		loadGameState(ConfMan.getInt("save_slot"));
	}

#if 0
	loadAllScenes();
#endif

	_gameContinue = true;

	int time1 = g_fp->_system->getMillis();

	// Center mouse
	_system->warpMouse(400, 300);

	while (_gameContinue) {
		updateEvents();

		int time2 = g_fp->_system->getMillis();

		// 30fps
		if (time2 - time1 >= 33 || !_normalSpeed) {
			time1 = time2;
			updateScreen();
		}

		if (_needRestart) {
			if (_modalObject) {
				delete _modalObject;
				_modalObject = 0;
			}

			freeGameLoader();
			_currentScene = 0;
			_updateTicks = 0;

			loadGam("fullpipe.gam");
			_needRestart = false;
		}

		_system->delayMillis(5);
		_system->updateScreen();
	}

	freeGameLoader();

	cleanup();

	return Common::kNoError;
}