/*
==============
idSessionLocal::DispatchCommand
==============
*/
void idSessionLocal::DispatchCommand(idUserInterface *gui, const char *menuCommand, bool doIngame)
{

	if (!gui) {
		gui = guiActive;
	}

	if (gui == guiMainMenu) {
		HandleMainMenuCommands(menuCommand);
		return;
	} else if (gui == guiIntro) {
		HandleIntroMenuCommands(menuCommand);
	} else if (gui == guiMsg) {
		HandleMsgCommands(menuCommand);
	} else if (gui == guiTakeNotes) {
		HandleNoteCommands(menuCommand);
	} else if (gui == guiRestartMenu) {
		HandleRestartMenuCommands(menuCommand);
	} else if (game && guiActive && guiActive->State().GetBool("gameDraw")) {
		const char *cmd = game->HandleGuiCommands(menuCommand);

		if (!cmd) {
			guiActive = NULL;
		} else if (idStr::Icmp(cmd, "main") == 0) {
			StartMenu();
		} else if (strstr(cmd, "sound ") == cmd) {
			// pipe the GUI sound commands not handled by the game to the main menu code
			HandleMainMenuCommands(cmd);
		}
	} else if (guiHandle) {
		if ((*guiHandle)(menuCommand)) {
			return;
		}
	} else if (!doIngame) {
		common->DPrintf("idSessionLocal::DispatchCommand: no dispatch found for command '%s'\n", menuCommand);
	}

	if (doIngame) {
		HandleInGameCommands(menuCommand);
	}
}
Esempio n. 2
0
/*
=================
idSessionLocal::StopBox
=================
*/
void idSessionLocal::StopBox() {
	if ( guiActive == guiMsg ) {
		HandleMsgCommands( "stop" );
	}
}