示例#1
0
/*
=================
UI_SetActiveMenu - 
	this should be the ONLY way the menu system is brought up
 
=================
*/
void UI_SetActiveMenu( const char* menuname,const char *menuID ) 
{
	// this should be the ONLY way the menu system is brought up (besides the UI_ConsoleCommand below)

	if (cls.state != CA_DISCONNECTED && !ui.SG_GameAllowedToSaveHere(qtrue))	//don't check full sytem, only if incamera
	{
		return;
	}

	if ( !menuname ) {
		UI_ForceMenuOff();
		return;
	}

	//make sure force-speed and slowmodeath doesn't slow down menus - NOTE: they should reset the timescale when the game un-pauses
	Cvar_SetValue( "timescale", 1.0f );

	UI_Cursor_Show(qtrue);

	// enusure minumum menu data is cached
	Menu_Cache();

	if ( Q_stricmp (menuname, "mainMenu") == 0 ) 
	{
		UI_MainMenu();
		return;
	}

	if ( Q_stricmp (menuname, "ingame") == 0 ) 
	{
		ui.Cvar_Set( "cl_paused", "1" );
		UI_InGameMenu(menuID);
		return;
	}

	if ( Q_stricmp (menuname, "datapad") == 0 ) 
	{
		ui.Cvar_Set( "cl_paused", "1" );
		UI_DataPadMenu();
		return;
	}
}
示例#2
0
/*
===============
UI_RankStatusMenu
===============
*/
void UI_RankStatusMenu(void)
{

	s_status = (grank_status_t)trap_Cvar_VariableValue("client_status");

	switch (s_status)
	{
	case QGR_STATUS_NEW:
		return;
	case QGR_STATUS_PENDING:
		// GRANK_FIXME
		return;
	case QGR_STATUS_NO_USER:
		// GRANK_FIXME - get this when user exists
		s_rankstatus_message = "Username unavailable";
		break;
	case QGR_STATUS_BAD_PASSWORD:
		s_rankstatus_message = "Invalid password";
		break;
	case QGR_STATUS_TIMEOUT:
		s_rankstatus_message = "Timed out";
		break;
	case QGR_STATUS_NO_MEMBERSHIP:
		s_rankstatus_message = "No membership";
		break;
	case QGR_STATUS_INVALIDUSER:
		s_rankstatus_message = "Validation failed";
		break;
	case QGR_STATUS_ERROR:
		s_rankstatus_message = "Error";
		break;
	case QGR_STATUS_SPECTATOR:
	case QGR_STATUS_ACTIVE:
		UI_ForceMenuOff();
		return;
	default:
		return;
	}
	RankStatus_MenuInit();
	trap_CL_UI_RankUserReset();
	UI_PushMenu (&s_rankstatus.menu);
}
示例#3
0
/*
=================
UI_PopMenu
=================
*/
void UI_PopMenu (void)
{
	// popmenu sound has some priority, but pushmenu has more priority
	UI_StartSound( menu_out_sound );
	soundTime = uis.realtime + 150;

	uis.menusp--;

	if (uis.menusp < 0)
		trap_Error ("UI_PopMenu: menu stack underflow");

	if (uis.menusp) {
		uis.activemenu = uis.stack[uis.menusp-1];
		uis.firstdraw = qtrue;
	}
	else {
		UI_ForceMenuOff ();
	}

}
示例#4
0
/*
 * =================
 * UI_PopMenu
 * =================
 */
void UI_PopMenu(void)
{
    S_StartLocalSound(menu_out_sound);
    if (m_menudepth < 1)
    {
        Com_Error(ERR_FATAL, "UI_PopMenu: depth < 1");
    }
    m_menudepth--;

    m_drawfunc = m_layers[m_menudepth].draw;
    m_keyfunc  = m_layers[m_menudepth].key;

    // Knightmare- added Psychospaz's mouse support
    UI_RefreshCursorLink();
    UI_RefreshCursorButtons();

    if (!m_menudepth)
    {
        UI_ForceMenuOff();
    }
}
示例#5
0
void LoadGameCallback(void *self)
{
    menuaction_s *a = ( menuaction_s * )self;

    // set saveshot name here
    if (m_saveshotvalid[a->generic.localdata[0]])
    {
        Com_sprintf(loadshotname, sizeof(loadshotname), "/save/kmq2save%i/shot.jpg", a->generic.localdata[0]);
        load_saveshot = loadshotname;
    }
    else
    {
        load_saveshot = NULL;
    }

    if (m_savevalid[a->generic.localdata[0]])
    {
        Cbuf_AddText(va("load kmq2save%i\n", a->generic.localdata[0]));
    }
    UI_ForceMenuOff();
}
示例#6
0
/*
=================
UI_SoundOptionsMenu_Event
=================
*/
static void UI_SoundOptionsMenu_Event(void* ptr, int event) {
    if (event != QM_ACTIVATED) {
        return;
    }

    switch (((menucommon_s*)ptr)->id) {
        case ID_GRAPHICS:
            UI_PopMenu();
            UI_GraphicsOptionsMenu();
            break;

        case ID_DISPLAY:
            UI_PopMenu();
            UI_DisplayOptionsMenu();
            break;

        case ID_SOUND:
            break;

        case ID_NETWORK:
            UI_PopMenu();
            UI_NetworkOptionsMenu();
            break;
            /*
                case ID_A3D:
                    if( soundOptionsInfo.a3d.curvalue ) {
                        trap_Cmd_ExecuteText( EXEC_NOW, "s_enable_a3d\n" );
                    }
                    else {
                        trap_Cmd_ExecuteText( EXEC_NOW, "s_disable_a3d\n" );
                    }
                    soundOptionsInfo.a3d.curvalue = (int)trap_Cvar_VariableValue( "s_usingA3D" );
                    break;
            */
        case ID_BACK:
            UI_PopMenu();
            break;

        case ID_APPLY:
            trap_Cvar_SetValue("s_volume", soundOptionsInfo.sfxvolume.curvalue / 10);
            soundOptionsInfo.sfxvolume_original = soundOptionsInfo.sfxvolume.curvalue;

            trap_Cvar_SetValue("s_musicvolume", soundOptionsInfo.musicvolume.curvalue / 10);
            soundOptionsInfo.musicvolume_original = soundOptionsInfo.musicvolume.curvalue;

            // Check if something changed that requires the sound system to be restarted.
            if (soundOptionsInfo.quality_original != soundOptionsInfo.quality.curvalue
                    || soundOptionsInfo.soundSystem_original != soundOptionsInfo.soundSystem.curvalue) {
                int speed;

                switch (soundOptionsInfo.quality.curvalue) {
                    default:
                    case 0:
                        speed = 11025;
                        break;
                    case 1:
                        speed = 22050;
                        break;
                    case 2:
                        speed = 44100;
                        break;
                }

                if (speed == DEFAULT_SDL_SND_SPEED)
                    speed = 0;

                trap_Cvar_SetValue("s_sdlSpeed", speed);
                soundOptionsInfo.quality_original = soundOptionsInfo.quality.curvalue;

                trap_Cvar_SetValue("s_useOpenAL", (soundOptionsInfo.soundSystem.curvalue == UISND_OPENAL));
                soundOptionsInfo.soundSystem_original = soundOptionsInfo.soundSystem.curvalue;

                UI_ForceMenuOff();
                trap_Cmd_ExecuteText(EXEC_APPEND, "snd_restart\n");
            }
            break;
    }
}
示例#7
0
/*
=================
M_Turbolift_Event
=================
*/
static void M_Turbolift_Event (void* ptr, int notification)
{
	int	id;
	menubitmap_s	*holdDeck;

	id = ((menucommon_s*)ptr)->id;

	/*if ( notification != QM_ACTIVATED )
	{
		return;
	}*/

	switch (id)
	{
		case ID_QUIT:
			if ( notification == QM_ACTIVATED )
				UI_PopMenu();
			break;
		case ID_DECK1:
		case ID_DECK2:
		case ID_DECK3:
		case ID_DECK4:
		case ID_DECK5:
		case ID_DECK6:
		case ID_DECK7:
		case ID_DECK8:
		case ID_DECK9:
		case ID_DECK10:
		case ID_DECK11:
		case ID_DECK12:
		case ID_DECK13:
		case ID_DECK14:
		case ID_DECK15:
		case ID_DECK16:

			if ( notification == QM_ACTIVATED )
			{
				if (s_turbolift.chosenDeck >= 0)
				{
					holdDeck = &s_turbolift.deck1;
					holdDeck += s_turbolift.chosenDeck;
					holdDeck->textcolor	= CT_BLACK;
				}

				s_turbolift.chosenDeck	= id - ID_DECK1;
				s_turbolift.engage.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;

				holdDeck = &s_turbolift.deck1;
				holdDeck += s_turbolift.chosenDeck;
				//holdDeck->textcolor	= CT_WHITE;//CT_LTGOLD1;
			}
			else if ( notification == QM_GOTFOCUS )
			{
				s_turbolift.highLightedDeck = id - ID_DECK1;
			}
			break;
		case ID_ENGAGE:		// Active only if a deck has been chosen
			if ( notification == QM_ACTIVATED ) {
				UI_ForceMenuOff();
				trap_Cmd_ExecuteText( EXEC_APPEND, va( "deck %i %i", s_turbolift.liftNum, s_turbolift.deckData[s_turbolift.chosenDeck].deckNum ) );
			}
			break;
	}
}
示例#8
0
文件: sound.c 项目: icanhas/yantar
/*
 * UI_SoundOptionsMenu_Event
 */
static void
UI_SoundOptionsMenu_Event(void* ptr, int event)
{
	if(event != QM_ACTIVATED)
		return;

	switch(((menucommon_s*)ptr)->id){
	case ID_GRAPHICS:
		UI_PopMenu();
		UI_GraphicsOptionsMenu();
		break;

	case ID_DISPLAY:
		UI_PopMenu();
		UI_DisplayOptionsMenu();
		break;

	case ID_SOUND:
		break;

	case ID_NETWORK:
		UI_PopMenu();
		UI_NetworkOptionsMenu();
		break;

	case ID_BACK:
		UI_PopMenu();
		break;

	case ID_APPLY:
		trap_cvarsetf("s_volume",
			soundOptionsInfo.sfxvolume.curvalue / 10);
		soundOptionsInfo.sfxvolume_original =
			soundOptionsInfo.sfxvolume.curvalue;

		trap_cvarsetf("s_musicvolume",
			soundOptionsInfo.musicvolume.curvalue / 10);
		soundOptionsInfo.musicvolume_original =
			soundOptionsInfo.musicvolume.curvalue;

		/* Check if something changed that requires the sound system to be restarted. */
		if(soundOptionsInfo.quality_original !=
		   soundOptionsInfo.quality.curvalue
		   || soundOptionsInfo.soundSystem_original !=
		   soundOptionsInfo.soundSystem.curvalue){
			int speed;

			switch(soundOptionsInfo.quality.curvalue){
			default:
			case 0:
				speed = 11025;
				break;
			case 1:
				speed = 22050;
				break;
			case 2:
				speed = 44100;
				break;
			}

			if(speed == DEFAULT_SDL_SND_SPEED)
				speed = 0;

			trap_cvarsetf("s_sdlSpeed", speed);
			soundOptionsInfo.quality_original =
				soundOptionsInfo.quality.curvalue;

			soundOptionsInfo.soundSystem_original =
				soundOptionsInfo.soundSystem.curvalue;

			UI_ForceMenuOff();
			trap_Cmd_ExecuteText(EXEC_APPEND, "snd_restart\n");
		}
		break;
	}
}
示例#9
0
/*
===============
Demos_MenuEvent
===============
*/
static void Demos_MenuEvent( void *ptr, int event ) 
{
	int index;

	if( event != QM_ACTIVATED ) 
	{
		return;
	}

	switch( ((menucommon_s*)ptr)->id ) 
	{
		case ID_UP:
			s_demos.currentDemoIndex--;

			if ( s_demos.currentDemoIndex < 0 )
				s_demos.currentDemoIndex = 0;

			DemoMenu_PopulateList( s_demos.currentDemoIndex );
			break;

		case ID_DOWN:
			s_demos.currentDemoIndex++;

			//TiM - cap it when the final entry is in view
			if ( s_demos.list.numitems > MAX_DEMODISP 
				 && ( s_demos.currentDemoIndex + MAX_DEMODISP ) > s_demos.list.numitems )
				s_demos.currentDemoIndex = s_demos.list.numitems-MAX_DEMODISP;

			DemoMenu_PopulateList( s_demos.currentDemoIndex );
			break;

		case ID_DEMOCOMMENT1:
		case ID_DEMOCOMMENT2:
		case ID_DEMOCOMMENT3:
		case ID_DEMOCOMMENT4:
		case ID_DEMOCOMMENT5:
		case ID_DEMOCOMMENT6:
		case ID_DEMOCOMMENT7:
		case ID_DEMOCOMMENT8:
		case ID_DEMOCOMMENT9:
		case ID_DEMOCOMMENT10:
		case ID_DEMOCOMMENT11:
		case ID_DEMOCOMMENT12:
			index = ((menucommon_s*)ptr)->id - ID_DEMOCOMMENT1;
			if (((menubitmap_s *)g_demoline[index])->textPtr)
			{
				//s_demos.currentDemoIndex = index;
				s_demos.currentFile.textPtr = (((menubitmap_s *)g_demoline[index])->textPtr);
				//make it so
				s_demos.engage.generic.flags	= QMF_HIGHLIGHT_IF_FOCUS;
			}
			break;


		case ID_ENGAGE:
			UI_ForceMenuOff ();
			trap_Cmd_ExecuteText( EXEC_APPEND, va( "demo %s.efdemo\n", s_demos.currentFile.textPtr) );
			break;

		case ID_MAINMENU:
			UI_PopMenu();
			break;
	}
}