Exemple #1
0
void NWNEngine::mainMenuLoop() {
	playMenuMusic();

	// Start sound
	playSound("gui_prompt", Sound::kSoundTypeSFX);

	// Create and fade in the legal billboard
	Legal *legal = new Legal;

	Console console;
	Module module(*_version, console);

	_scriptFuncs->setModule(&module);
	console.setModule(&module);

	while (!EventMan.quitRequested()) {
		GUI *mainMenu = new MainMenu(module);

		EventMan.flushEvents();
		if (legal) {
			// Fade in, show and fade out the legal billboard
			legal->fadeIn();
			mainMenu->show();
			legal->show();

			delete legal;
			legal = 0;
		} else
			mainMenu->show();

		mainMenu->run();
		mainMenu->hide();

		delete mainMenu;

		if (EventMan.quitRequested())
			break;

		stopMenuMusic();

		module.run();
		if (EventMan.quitRequested())
			break;

		playMenuMusic();
		console.hide();
		module.clear();
	}

	_scriptFuncs->setModule(0);
	console.setModule();

	stopMenuMusic();

	delete legal;
}
Exemple #2
0
void Game::mainMenu(bool playStartSound, bool showLegal) {
	playMenuMusic();

	if (playStartSound)
		playSound("gui_prompt", Sound::kSoundTypeSFX);

	EventMan.flushEvents();

	MainMenu menu(*_module, _console);

	if (showLegal) {
		// Fade in, show and fade out the legal billboard

		Legal legal;

		legal.fadeIn();
		menu.show();
		legal.show();
	} else
		menu.show();

	_console->disableCommand("loadcampaign", "not available in the main menu");
	_console->disableCommand("loadmodule"  , "not available in the main menu");
	_console->disableCommand("exitmodule"  , "not available in the main menu");
	_console->disableCommand("listareas"   , "not available in the main menu");
	_console->disableCommand("gotoarea"    , "not available in the main menu");

	menu.run();

	_console->enableCommand("loadcampaign");
	_console->enableCommand("loadmodule");
	_console->enableCommand("exitmodule");
	_console->enableCommand("listareas");
	_console->enableCommand("gotoarea");

	menu.hide();

	stopMenuMusic();
}