/* ================= UI_LoadGame_KeyFunc ================= */ static const char *UI_LoadGame_KeyFunc( int key, int down ) { if( down && key == K_ESCAPE && uiLoadGame.load.generic.flags & QMF_INACTIVE ) { UI_DeleteDialog(); return uiSoundNull; } return UI_DefaultKey( &uiLoadGame.menu, key, down ); }
/* ================= UI_InternetGames_KeyFunc ================= */ static const char *UI_InternetGames_KeyFunc( int key, int down ) { if( down && key == K_ESCAPE && !( uiInternetGames.dlgMessage1.generic.flags & QMF_HIDDEN )) { UI_PromptDialog(); return uiSoundNull; } return UI_DefaultKey( &uiInternetGames.menu, key, down ); }
/* ================= UI_PlayDemo_KeyFunc ================= */ static const char *UI_PlayDemo_KeyFunc( int key, int down ) { if( down && key == K_ESCAPE && uiPlayDemo.play.generic.flags & QMF_INACTIVE ) { UI_DeleteDialog(); return uiSoundNull; } return UI_DefaultKey( &uiPlayDemo.menu, key, down ); }
/* ================= UI_NewGame_KeyFunc ================= */ static const char *UI_NewGame_KeyFunc( int key, int down ) { if( down && key == K_ESCAPE && !( uiNewGame.dlgMessage1.generic.flags & QMF_HIDDEN )) { UI_PromptDialog( 0.0f ); // clear skill return uiSoundNull; } return UI_DefaultKey( &uiNewGame.menu, key, down ); }
/* ================== UI_Cinematics_KeyFunc ================== */ static const char *UI_Cinematics_KeyFunc (int key){ switch (key){ case K_ESCAPE: case K_MOUSE2: if (uiStatic.playingCinematic){ uiStatic.playingCinematic = false; // CIN_StopCinematic(); } break; } return UI_DefaultKey(&uiCinematics.menu, key); }
/* ================= UI_Main_KeyFunc ================= */ static const char *UI_Main_KeyFunc( int key, int down ) { if( down && key == K_ESCAPE ) { if ( CL_IsActive( )) { if(!( uiMain.dlgMessage1.generic.flags & QMF_HIDDEN )) UI_PromptDialog(); else if(!( uiMain.quitMessage.generic.flags & QMF_HIDDEN )) UI_QuitDialog(); else UI_CloseMenu(); } else UI_QuitDialog(); return uiSoundNull; } return UI_DefaultKey( &uiMain.menu, key, down ); }
/* ================= UI_KeyEvent ================= */ void UI_KeyEvent( int key, int down ) { const char *sound; if( !uiStatic.initialized ) return; if( !uiStatic.visible ) return; if( !uiStatic.menuActive ) return; if( uiStatic.menuActive->keyFunc ) sound = uiStatic.menuActive->keyFunc( key, down ); else sound = UI_DefaultKey( uiStatic.menuActive, key, down ); if( !down ) return; if( sound && sound != uiSoundNull ) UI_StartSound( sound ); }
/* ================= UI_GameOptions_KeyFunc ================= */ static const char *UI_GameOptions_KeyFunc( int key, int down ) { if( down && key == K_ESCAPE ) UI_GameOptions_DiscardChanges (); return UI_DefaultKey( &uiGameOptions.menu, key, down ); }
/* ================= UI_Controls_KeyFunc ================= */ static const char *UI_Controls_KeyFunc( int key, int down ) { char cmd[128]; if( uiControls.msgBox1.generic.flags & QMF_HIDDEN ) { if( down && key == K_ESCAPE && uiControls.defaults.generic.flags & QMF_INACTIVE ) { UI_ResetToDefaultsDialog(); return uiSoundNull; } } if( down ) { if( uiControls.bind_grab ) // assume we are in grab-mode { // defining a key if( key == '`' || key == '~' ) { return uiSoundBuzz; } else if( key != K_ESCAPE ) { const char *bindName = uiControls.keysBind[uiControls.keysList.curItem]; sprintf( cmd, "bind \"%s\" \"%s\"\n", KEY_KeynumToString( key ), bindName ); CLIENT_COMMAND( TRUE, cmd ); } uiControls.bind_grab = false; UI_Controls_RestartMenu(); return uiSoundLaunch; } if( key == K_ENTER && uiControls.dlgMessage.generic.flags & QMF_HIDDEN ) { if( !strlen( uiControls.keysBind[uiControls.keysList.curItem] )) { // probably it's a seperator return uiSoundBuzz; } // entering to grab-mode const char *bindName = uiControls.keysBind[uiControls.keysList.curItem]; int keys[2]; UI_Controls_GetKeyBindings( bindName, keys ); if( keys[1] != -1 ) UI_UnbindCommand( bindName ); uiControls.bind_grab = true; UI_PromptDialog(); // show prompt return uiSoundKey; } if(( key == K_BACKSPACE || key == K_DEL ) && uiControls.dlgMessage.generic.flags & QMF_HIDDEN ) { // delete bindings if( !strlen( uiControls.keysBind[uiControls.keysList.curItem] )) { // probably it's a seperator return uiSoundNull; } const char *bindName = uiControls.keysBind[uiControls.keysList.curItem]; UI_UnbindCommand( bindName ); UI_StartSound( uiSoundRemoveKey ); UI_Controls_RestartMenu(); return uiSoundNull; } } return UI_DefaultKey( &uiControls.menu, key, down ); }