/* =============== UI_SaveConfigMenu_SaveEvent =============== */ static void UI_SaveConfigMenu_SaveEvent( void *ptr, int event ) { char configname[MAX_QPATH]; if( event != QM_ACTIVATED ) { return; } if( !saveConfig.savename.field.buffer[0] ) { return; } COM_StripExtension(saveConfig.savename.field.buffer, configname ); Cbuf_ExecuteText( EXEC_APPEND, va( "writeconfig config\\%s.cfg\n", configname ) ); UI_PopMenu(); }
/* ================= PlayerSettings_MenuEvent ================= */ static void PlayerSettings_MenuEvent( void* ptr, int event ) { if( event != QM_ACTIVATED ) { return; } switch( ((menucommon_s*)ptr)->id ) { case ID_MODEL: PlayerSettings_SaveChanges(); UI_PlayerModelMenu(); break; case ID_BACK: PlayerSettings_SaveChanges(); UI_PopMenu(); break; } }
/* =============== UI_JoystickMenu_Event =============== */ static void UI_JoystickMenu_Event( void *ptr, int event ) { if( event != QM_ACTIVATED ) { return; } if (((menucommon_s*)ptr)->id >= ID_JOYSTICK && ((menucommon_s*)ptr)->id < ID_JOYSTICK + MAX_JOYSTICKS) { int joystick = ((menucommon_s*)ptr)->id - ID_JOYSTICK; int i; if (joystick == 0) { // Disable joystick trap_Cvar_SetValue(Com_LocalClientCvarName(joystickMenu.localClient, "in_joystick"), 0); trap_Cvar_SetValue(Com_LocalClientCvarName(joystickMenu.localClient, "in_joystickNo"), 0); } else { // Enable joystick trap_Cvar_SetValue(Com_LocalClientCvarName(joystickMenu.localClient, "in_joystick"), 1); trap_Cvar_SetValue(Com_LocalClientCvarName(joystickMenu.localClient, "in_joystickNo"), joystick-1); } // Disable last selected joystick. for (i = 0; i < MAX_JOYSTICKS; i++) { joystickMenu.joysticks[i].generic.flags |= QMF_PULSEIFFOCUS; joystickMenu.joysticks[i].generic.flags &= ~(QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS); } // Select joystick. ((menucommon_s*)ptr)->flags &= ~QMF_PULSEIFFOCUS; ((menucommon_s*)ptr)->flags |= (QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS); joystickMenu.changed = (joystick != joystickMenu.originalJoystick); return; } switch( ((menucommon_s*)ptr)->id ) { case ID_BACK: if (joystickMenu.changed) { trap_Cmd_ExecuteText( EXEC_APPEND, "in_restart\n" ); } UI_PopMenu(); break; } }
/* =============== RankStatus_MenuEvent =============== */ static void RankStatus_MenuEvent(void* ptr, int event) { if (event != QM_ACTIVATED) { return; } switch (((menucommon_s*)ptr)->id) { case ID_OK: UI_PopMenu(); switch (s_status) { case QGR_STATUS_NO_USER: UI_RankingsMenu(); break; case QGR_STATUS_BAD_PASSWORD: UI_RankingsMenu(); UI_LoginMenu(); break; case QGR_STATUS_USER_EXISTS: UI_RankingsMenu(); UI_SignupMenu(); break; case QGR_STATUS_NO_MEMBERSHIP: UI_RankingsMenu(); break; case QGR_STATUS_TIMEOUT: UI_RankingsMenu(); break; case QGR_STATUS_INVALIDUSER: UI_RankingsMenu(); break; case QGR_STATUS_ERROR: UI_RankingsMenu(); break; default: break; } break; } }
/* =============== UI_SetupMenu_Event =============== */ static void UI_SetupMenu_Event( void *ptr, int event ) { if( event != QM_ACTIVATED ) { return; } switch( ((menucommon_s*)ptr)->id ) { case ID_CUSTOMIZEPLAYER: UI_PlayerSettingsMenu(); break; case ID_CUSTOMIZECONTROLS: UI_ControlsMenu(); break; case ID_SYSTEMCONFIG: UI_GraphicsOptionsMenu(); break; case ID_GAME: UI_PreferencesMenu(); break; case ID_CDKEY: UI_CDKeyMenu(); break; // case ID_LOAD: // UI_LoadConfigMenu(); // break; // case ID_SAVE: // UI_SaveConfigMenu(); // break; case ID_DEFAULTS: UI_ConfirmMenu( "SET TO DEFAULTS?", Setup_ResetDefaults_Draw, Setup_ResetDefaults_Action ); break; case ID_BACK: UI_PopMenu(); break; } }
/* ================== UI_Performance_Callback ================== */ static void UI_Performance_Callback (void *self, int event){ menuCommon_t *item = (menuCommon_t *)self; if (event == QM_CHANGED){ UI_Performance_UpdateConfig(); UI_Performance_SetConfig(); return; } if (event != QM_ACTIVATED) return; switch (item->id){ case ID_BACK: UI_PopMenu(); break; } }
/* =============== Signup_MenuEvent =============== */ static void Signup_MenuEvent( void* ptr, int event ) { //char cmd[1024]; if( event != QM_ACTIVATED ) { return; } switch( ((menucommon_s*)ptr)->id ) { case ID_SIGNUP: if( strcmp(s_signup.password_box.field.buffer, s_signup.again_box.field.buffer) != 0 ) { // GRANK_FIXME - password mismatch break; } // set name //trap_Cvar_Set( "name", s_signup.name_box.field.buffer ); /* trap_Cvar_Set( "rank_name", s_signup.name_box.field.buffer ); trap_Cvar_Set( "rank_pwd", s_signup.password_box.field.buffer ); */ // create account /* sprintf( cmd, "cmd rank_create \"%s\" \"%s\" \"%s\"\n", s_signup.name_box.field.buffer, s_signup.password_box.field.buffer, s_signup.email_box.field.buffer ); trap_Cmd_ExecuteText( EXEC_APPEND, cmd ); */ trap_CL_UI_RankUserCreate( s_signup.name_box.field.buffer, s_signup.password_box.field.buffer, s_signup.email_box.field.buffer ); UI_ForceMenuOff(); break; case ID_CANCEL: UI_PopMenu(); break; } }
/* ======================================================================================================================================= SpecifyLeague_Event ======================================================================================================================================= */ static void SpecifyLeague_Event(void *ptr, int event) { int id; id = ((menucommon_s *)ptr)->id; //if (event != QM_ACTIVATED && id != ID_SPECIFYLEAGUELIST) { // return; //} switch (id) { case ID_SPECIFYLEAGUELIST: if (event == QM_GOTFOCUS) { //ArenaServers_UpdatePicture(); } break; case ID_SPECIFYLEAGUEUP: if (event == QM_ACTIVATED) { ScrollList_Key(&s_specifyleague.list, K_UPARROW); } break; case ID_SPECIFYLEAGUEDOWN: if (event == QM_ACTIVATED) { ScrollList_Key(&s_specifyleague.list, K_DOWNARROW); } break; case ID_SPECIFYLEAGUENAME: if ((event == QM_LOSTFOCUS) && (Q_strncmp(playername, s_specifyleague.rankname.field.buffer, strlen(s_specifyleague.rankname.field.buffer)) != 0)) { SpecifyLeague_GetList(); } break; case ID_SPECIFYLEAGUEBACK: if (event == QM_ACTIVATED) { trap_Cvar_Set("sv_leagueName", league_table[s_specifyleague.list.curvalue].leaguename); UI_PopMenu(); } break; } }
const char *M_Credits_Key(int key) { char *sound = NULL; switch (key) { case K_ESCAPE: //case K_MOUSE2 if (creditsBuffer) { FS_FreeFile(creditsBuffer); } UI_PopMenu(); sound = menu_out_sound; break; } return sound; }
/* ================= UI_PlayRec_Callback ================= */ static void UI_PlayRec_Callback( void *self, int event ) { menuCommon_s *item = (menuCommon_s *)self; if( event != QM_ACTIVATED ) return; switch( item->id ) { case ID_PLAY: UI_PlayDemo_Menu(); break; case ID_RECORD: UI_RecDemo_Menu(); break; case ID_DONE: UI_PopMenu(); break; } }
/* ================= ConfirmMenu_Event ================= */ static void ConfirmMenu_Event( void* ptr, int event ) { qboolean result; if( event != QM_ACTIVATED ) { return; } UI_PopMenu(); if( ((menucommon_s*)ptr)->id == ID_CONFIRM_NO ) { result = qfalse; } else { result = qtrue; } if( s_confirm.action ) { s_confirm.action( result ); } }
/* ================= UI_SPPostgameMenu_NextEvent ================= */ static void UI_SPPostgameMenu_NextEvent( void* ptr, int event ) { int level; const char *arenaInfo; if (event != QM_ACTIVATED) { return; } UI_PopMenu(); // handle specially if we just won the training map if( postgameMenuInfo.won == 0 ) { level = 0; } else { level = postgameMenuInfo.level + 1; } #if 0 currentLevel = UI_GetCurrentGame(); if( currentLevel == -1 ) { currentLevel = postgameMenuInfo.level; } currentSet = currentLevel / ARENAS_PER_TIER; if( levelSet > currentSet || levelSet == UI_GetNumSPTiers() ) { level = currentLevel; } #else level = UI_GetCurrentGame(postgameMenuInfo.level); if (level == UI_GetNumSPArenas()) { level = 0; } #endif arenaInfo = UI_GetArenaInfoByNumber( level ); if ( !arenaInfo ) { return; } UI_SPArena_Start( arenaInfo ); }
/* ================= M_sql_Event ================= */ static void M_sql_Event(void *ptr, int notification) { int id; id = ((menucommon_s*)ptr)->id; switch (id) { case ID_QUIT: if(notification == QM_ACTIVATED) { UI_PopMenu(); } break; case ID_LOGIN: if(notification == QM_ACTIVATED) { // do login } break; default: break; } }
/* ================= PlayerSettings_MenuEvent ================= */ static void PlayerSettings_MenuEvent(void* ptr, int event) { if (event != QM_ACTIVATED) { return; } switch (((menucommon_s*)ptr)->id) { case ID_HANDICAP: trap_Cvar_Set("handicap", va("%i", 100 - 25 * s_playersettings.handicap.curvalue)); break; case ID_MODEL: PlayerSettings_SaveChanges(); UI_PlayerModelMenu(); break; case ID_BACK: PlayerSettings_SaveChanges(); UI_PopMenu(); break; } }
/* ================= UI_Credits_DrawFunc ================= */ static void UI_Credits_DrawFunc( void ) { int i, y; float speed = 32.0f * (768.0f / ScreenHeight); int w = UI_SMALL_CHAR_WIDTH; int h = UI_SMALL_CHAR_HEIGHT; int color = 0x00FFA000; // draw the background first UI_FillRect( 0, 0, ScreenWidth, ScreenHeight, uiColorBlack ); // now draw the credits UI_ScaleCoords( NULL, NULL, &w, &h ); y = ScreenHeight - (((gpGlobals->time * 1000) - uiCredits.startTime ) / speed ); // draw the credits for ( i = 0; i < uiCredits.numLines && uiCredits.credits[i]; i++, y += h ) { // skip not visible lines, but always draw end line if( y <= -h && i != uiCredits.numLines - 1 ) continue; if(( y < ( ScreenHeight - h ) / 2 ) && i == uiCredits.numLines - 1 ) { if( !uiCredits.fadeTime ) uiCredits.fadeTime = (gpGlobals->time * 1000); color = UI_FadeAlpha( uiCredits.fadeTime, uiCredits.showTime ); if( UnpackAlpha( color )) UI_DrawString( 0, ( ScreenHeight - h ) / 2, ScreenWidth, h, uiCredits.credits[i], color, true, w, h, 1, true ); } else UI_DrawString( 0, y, ScreenWidth, h, uiCredits.credits[i], uiColorWhite, false, w, h, 1, true ); } if( y < 0 && UnpackAlpha( color ) == 0 ) { uiCredits.active = false; // end of credits } if( !uiCredits.active ) UI_PopMenu(); }
/* ================== UI_Cinematics_Callback ================== */ static void UI_Cinematics_Callback (void *self, int event){ menuCommon_t *item = (menuCommon_t *)self; if (event == QM_CHANGED){ // if (uiStatic.playingCinematic) // CIN_StopCinematic(); // uiStatic.playingCinematic = CIN_PlayCinematic(uiCinematics.cinematicFiles[uiCinematics.cinList.curItem], CIN_LOOPING | CIN_SILENT); return; } if (event != QM_ACTIVATED) return; switch (item->id){ case ID_BACK: if (uiStatic.playingCinematic){ uiStatic.playingCinematic = false; // CIN_StopCinematic(); } UI_PopMenu(); break; case ID_PLAY: case ID_CINPREVIEW: if (uiStatic.playingCinematic){ uiStatic.playingCinematic = false; // CIN_StopCinematic(); } Cmd_ExecuteText(CMD_EXEC_APPEND, Str_VarArgs("playCinematic %s\n", uiCinematics.cinematics[uiCinematics.cinList.curItem])); break; } }
/* =============== UI_TeamOrdersMenu_ListEvent =============== */ static void UI_TeamOrdersMenu_ListEvent(void *ptr, int event) { int id; int selection; char message[256]; if (event != QM_ACTIVATED) return; id = ((menulist_s *)ptr)->generic.id; selection = ((menulist_s *)ptr)->curvalue; if (id == ID_LIST_BOTS) { teamOrdersMenuInfo.selectedBot = selection; if (teamOrdersMenuInfo.gametype == GT_CTF || teamOrdersMenuInfo.gametype == GT_INVASION) { UI_TeamOrdersMenu_SetList(ID_LIST_CTF_ORDERS); } else { UI_TeamOrdersMenu_SetList(ID_LIST_TEAM_ORDERS); } return; } if (id == ID_LIST_CTF_ORDERS) { Com_sprintf(message, sizeof(message), ctfMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot]); } else { Com_sprintf(message, sizeof(message), teamMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot]); } trap_Cmd_ExecuteText(EXEC_APPEND, va("say_team \"%s\"\n", message)); UI_PopMenu(); }
/* ================= SpecifyPassword_Event ================= */ static void SpecifyPassword_Event( void* ptr, int event ) { switch (((menucommon_s*)ptr)->id) { case ID_SPECIFYPASSWORDGO: if (event != QM_ACTIVATED) break; if (s_specifypassword.password.field.buffer[0]) { trap_Cvar_Set("password",s_specifypassword.password.field.buffer); trap_Cmd_ExecuteText( EXEC_APPEND, s_specifypassword.connectstring ); } break; case ID_SPECIFYPASSWORDBACK: if (event != QM_ACTIVATED) break; UI_PopMenu(); break; } }
/* ================== UI_Mods_Callback ================== */ static void UI_Mods_Callback (void *self, int event){ menuCommon_t *item = (menuCommon_t *)self; if (event == QM_CHANGED){ // See if the load button should be grayed if (!Str_ICompare(CVar_GetVariableString("fs_game"), uiMods.modsDir[uiMods.modList.curItem])) uiMods.load.generic.flags |= QMF_GRAYED; else uiMods.load.generic.flags &= ~QMF_GRAYED; return; } if (event != QM_ACTIVATED) return; switch (item->id){ case ID_BACK: UI_PopMenu(); break; case ID_LOAD: if (cls.state == CA_ACTIVE) break; // Don't f**k up the game // Update fs_game CVar_ForceSet("fs_game", uiMods.modsDir[uiMods.modList.curItem]); // Restart file system FS_Restart(); // Flush all data so it will be forced to reload Cmd_ExecuteText(CMD_EXEC_APPEND, "restartVideo\n"); break; } }
/* ================= UI_CreateGame_Callback ================= */ static void UI_CreateGame_Callback( void *self, int event ) { menuCommon_s *item = (menuCommon_s *)self; switch( item->id ) { case ID_HLTV: case ID_DEDICATED: if( event == QM_PRESSED ) ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED; else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS; break; } if( event != QM_ACTIVATED ) return; switch( item->id ) { case ID_ADVOPTIONS: // UNDONE: not implemented break; case ID_DONE: UI_PromptDialog(); break; case ID_CANCEL: UI_PopMenu(); break; case ID_YES: UI_CreateGame_Begin(); break; case ID_NO: UI_PromptDialog(); break; } }
/* ================== UI_Video_Callback ================== */ static void UI_Video_Callback (void *self, int event){ menuCommon_t *item = (menuCommon_t *)self; if (event == QM_CHANGED){ UI_Video_UpdateConfig(); return; } if (event != QM_ACTIVATED) return; switch (item->id){ case ID_CANCEL: UI_PopMenu(); break; case ID_ADVANCED: UI_Advanced_Menu(); break; case ID_APPLY: UI_Video_SetConfig(); break; } }
/* =============== UI_MultiplayerMenu_Event =============== */ static void UI_MultiplayerMenu_Event( void *ptr, int event ) { if( event != QM_ACTIVATED ) { return; } switch( ((menucommon_s*)ptr)->id ) { case ID_CREATEGAME: UI_StartServerMenu( qtrue ); break; case ID_JOINSEARCH: UI_PlayerSetupMenu(MAX_SPLITVIEW, UI_ArenaServersMenu, qfalse); break; case ID_JOINSPECIFY: UI_PlayerSetupMenu(MAX_SPLITVIEW, UI_JoinSpecifyMenu, qfalse); break; case ID_BACK: UI_PopMenu(); break; } }
sfxHandle_t Menu_DefaultKey(menuframework_s *m, int key) { sfxHandle_t sound = 0; menucommon_s *item; int cursor_prev; // menu system keys switch (key) { case K_MOUSE2: case K_ESCAPE: UI_PopMenu(); return menu_out_sound; } if (!m || !m->nitems) { return 0; } // route key stimulus to widget item = Menu_ItemAtCursor(m); if (item && !(item->flags & (QMF_GRAYED|QMF_INACTIVE))) { switch (item->type) { case MTYPE_SPINCONTROL: sound = SpinControl_Key((menulist_s*)item, key); break; case MTYPE_RADIOBUTTON: sound = RadioButton_Key((menuradiobutton_s*)item, key); break; case MTYPE_SLIDER: sound = Slider_Key((menuslider_s*)item, key); break; case MTYPE_SCROLLLIST: sound = ScrollList_Key((menulist_s*)item, key); break; case MTYPE_FIELD: sound = MenuField_Key((menufield_s*)item, &key); break; } if (sound) { // key was handled return sound; } } // default handling switch (key) { #ifndef NDEBUG case K_F11: uis.debug ^= 1; break; case K_F12: trap_Cmd_ExecuteText(EXEC_APPEND, "screenshot\n"); break; #endif case K_KP_UPARROW: case K_UPARROW: cursor_prev = m->cursor; m->cursor_prev = m->cursor; m->cursor--; Menu_AdjustCursor(m, -1); if (cursor_prev != m->cursor) { Menu_CursorMoved(m); sound = menu_move_sound; } break; case K_TAB: case K_KP_DOWNARROW: case K_DOWNARROW: cursor_prev = m->cursor; m->cursor_prev = m->cursor; m->cursor++; Menu_AdjustCursor(m, 1); if (cursor_prev != m->cursor) { Menu_CursorMoved(m); sound = menu_move_sound; } break; case K_MOUSE1: case K_MOUSE3: if (item) if ((item->flags & QMF_HASMOUSEFOCUS) && !(item->flags & (QMF_GRAYED|QMF_INACTIVE))) return (Menu_ActivateItem(m, item)); break; case K_JOY1: case K_JOY2: case K_JOY3: case K_JOY4: case K_AUX1: case K_AUX2: case K_AUX3: case K_AUX4: case K_AUX5: case K_AUX6: case K_AUX7: case K_AUX8: case K_AUX9: case K_AUX10: case K_AUX11: case K_AUX12: case K_AUX13: case K_AUX14: case K_AUX15: case K_AUX16: case K_KP_ENTER: case K_ENTER: if (item && !(item->flags & (QMF_MOUSEONLY|QMF_GRAYED|QMF_INACTIVE))) { return (Menu_ActivateItem(m, item)); } break; } return sound; }
static void UI_SPLevelMenu_MenuDraw( void ) { int n, i; int x, y; vec4_t color; int level; // int fraglimit; int pad; char buf[MAX_INFO_VALUE]; char string[64]; if( levelMenuInfo.reinit ) { UI_PopMenu(); UI_SPLevelMenu(); return; } // draw player name trap_Cvar_VariableStringBuffer( "name", string, 32 ); Q_CleanStr( string ); UI_DrawProportionalString( 320, PLAYER_Y, string, UI_CENTER|UI_SMALLFONT, color_orange ); // check for model changes trap_Cvar_VariableStringBuffer( "model", buf, sizeof(buf) ); if( Q_stricmp( buf, levelMenuInfo.playerModel ) != 0 ) { Q_strncpyz( levelMenuInfo.playerModel, buf, sizeof(levelMenuInfo.playerModel) ); PlayerIcon( levelMenuInfo.playerModel, levelMenuInfo.playerPicName, sizeof(levelMenuInfo.playerPicName) ); levelMenuInfo.item_player.shader = 0; } // standard menu drawing Menu_Draw( &levelMenuInfo.menu ); // draw player award levels y = AWARDS_Y; i = 0; for( n = 0; n < 6; n++ ) { level = levelMenuInfo.awardLevels[n]; if( level > 0 ) { if( i & 1 ) { x = 224 - (i - 1 ) / 2 * (48 + 16); } else { x = 368 + i / 2 * (48 + 16); } i++; if( level == 1 ) { continue; } if( level >= 1000000 ) { Com_sprintf( string, sizeof(string), "%im", level / 1000000 ); } else if( level >= 1000 ) { Com_sprintf( string, sizeof(string), "%ik", level / 1000 ); } else { Com_sprintf( string, sizeof(string), "%i", level ); } UI_DrawString( x + 24, y + 48, string, UI_CENTER, color_yellow ); } } UI_DrawProportionalString( 18, 38, va( "Tier %i", selectedArenaSet + 1 ), UI_LEFT|UI_SMALLFONT, color_orange ); for ( n = 0; n < levelMenuInfo.numMaps; n++ ) { x = levelMenuInfo.item_maps[n].generic.x; y = levelMenuInfo.item_maps[n].generic.y; UI_FillRect( x, y + 96, 128, 18, color_black ); } if ( selectedArenaSet > currentSet ) { UI_DrawProportionalString( 320, 216, "ACCESS DENIED", UI_CENTER|UI_BIGFONT, color_red ); return; } // show levelshots for levels of current tier Vector4Copy( color_white, color ); color[3] = 0.5+0.5*sin(uis.realtime/PULSE_DIVISOR); for ( n = 0; n < levelMenuInfo.numMaps; n++ ) { x = levelMenuInfo.item_maps[n].generic.x; y = levelMenuInfo.item_maps[n].generic.y; UI_DrawString( x + 64, y + 96, levelMenuInfo.levelNames[n], UI_CENTER|UI_SMALLFONT, color_orange ); if( levelMenuInfo.levelScores[n] == 1 ) { UI_DrawHandlePic( x, y, 128, 96, levelMenuInfo.levelCompletePic[levelMenuInfo.levelScoresSkill[n] - 1] ); } if ( n == selectedArena ) { if( Menu_ItemAtCursor( &levelMenuInfo.menu ) == &levelMenuInfo.item_maps[n] ) { trap_R_SetColor( color ); } UI_DrawHandlePic( x-1, y-1, 130, 130 - 14, levelMenuInfo.levelSelectedPic ); trap_R_SetColor( NULL ); } else if( Menu_ItemAtCursor( &levelMenuInfo.menu ) == &levelMenuInfo.item_maps[n] ) { trap_R_SetColor( color ); UI_DrawHandlePic( x-31, y-30, 256, 256-27, levelMenuInfo.levelFocusPic); trap_R_SetColor( NULL ); } } // show map name and long name of selected level y = 192; Q_strncpyz( buf, Info_ValueForKey( levelMenuInfo.selectedArenaInfo, "map" ), 20 ); Q_strupr( buf ); Com_sprintf( string, sizeof(string), "%s: %s", buf, Info_ValueForKey( levelMenuInfo.selectedArenaInfo, "longname" ) ); UI_DrawProportionalString( 320, y, string, UI_CENTER|UI_SMALLFONT, color_orange ); // fraglimit = atoi( Info_ValueForKey( levelMenuInfo.selectedArenaInfo, "fraglimit" ) ); // UI_DrawString( 18, 212, va("Frags %i", fraglimit) , UI_LEFT|UI_SMALLFONT, color_orange ); // draw bot opponents y += 24; pad = (7 - levelMenuInfo.numBots) * (64 + 26) / 2; for( n = 0; n < levelMenuInfo.numBots; n++ ) { x = 18 + pad + (64 + 26) * n; if( levelMenuInfo.botPics[n] ) { UI_DrawHandlePic( x, y, 64, 64, levelMenuInfo.botPics[n]); } else { UI_FillRect( x, y, 64, 64, color_black ); UI_DrawProportionalString( x+22, y+18, "?", UI_BIGFONT, color_orange ); } UI_DrawString( x, y + 64, levelMenuInfo.botNames[n], UI_SMALLFONT|UI_LEFT, color_orange ); } }
/* ================= Menu_DefaultKey ================= */ sfxHandle_t Menu_DefaultKey( menuframework_s *m, int key ) { sfxHandle_t sound = 0; menucommon_s *item; int cursor_prev; // menu system keys switch ( key ) { case K_JOY_B: case K_2JOY_B: case K_3JOY_B: case K_4JOY_B: #ifndef TA_MISC // MENU: Right Mouse button = left arrow case K_MOUSE2: #endif case K_ESCAPE: #ifdef IOQ3ZTM if (uis.activemenu->noEscape) { return sound; } else { #endif UI_PopMenu(); return menu_out_sound; #ifdef IOQ3ZTM } #endif } if (!m || !m->nitems) return 0; // route key stimulus to widget item = Menu_ItemAtCursor( m ); if (item && !(item->flags & (QMF_GRAYED|QMF_INACTIVE))) { switch (item->type) { case MTYPE_SPINCONTROL: sound = SpinControl_Key( (menulist_s*)item, key ); break; case MTYPE_RADIOBUTTON: sound = RadioButton_Key( (menuradiobutton_s*)item, key ); break; case MTYPE_SLIDER: sound = Slider_Key( (menuslider_s*)item, key ); break; case MTYPE_SCROLLLIST: sound = ScrollList_Key( (menulist_s*)item, key ); break; case MTYPE_FIELD: sound = MenuField_Key( (menufield_s*)item, &key ); break; } if (sound) { // key was handled return sound; } } // default handling switch ( key ) { case K_F11: if ( trap_Cvar_VariableValue( "developer" ) ) { uis.debug ^= 1; } break; case K_F12: if ( trap_Cvar_VariableValue( "developer" ) ) { trap_Cmd_ExecuteText( EXEC_APPEND, "screenshot\n" ); } break; case K_JOY_DPAD_UP: case K_JOY_LEFTSTICK_UP: case K_2JOY_DPAD_UP: case K_2JOY_LEFTSTICK_UP: case K_3JOY_DPAD_UP: case K_3JOY_LEFTSTICK_UP: case K_4JOY_DPAD_UP: case K_4JOY_LEFTSTICK_UP: case K_KP_UPARROW: case K_UPARROW: cursor_prev = m->cursor; m->cursor_prev = m->cursor; m->cursor--; Menu_AdjustCursor( m, -1 ); if ( cursor_prev != m->cursor ) { Menu_CursorMoved( m ); sound = menu_move_sound; } break; case K_TAB: case K_JOY_DPAD_DOWN: case K_JOY_LEFTSTICK_DOWN: case K_2JOY_DPAD_DOWN: case K_2JOY_LEFTSTICK_DOWN: case K_3JOY_DPAD_DOWN: case K_3JOY_LEFTSTICK_DOWN: case K_4JOY_DPAD_DOWN: case K_4JOY_LEFTSTICK_DOWN: case K_KP_DOWNARROW: case K_DOWNARROW: cursor_prev = m->cursor; m->cursor_prev = m->cursor; m->cursor++; Menu_AdjustCursor( m, 1 ); if ( cursor_prev != m->cursor ) { Menu_CursorMoved( m ); sound = menu_move_sound; } break; case K_MOUSE1: case K_MOUSE3: if (item) if ((item->flags & QMF_HASMOUSEFOCUS) && !(item->flags & (QMF_GRAYED|QMF_INACTIVE))) return (Menu_ActivateItem( m, item )); break; case K_JOY_A: case K_2JOY_A: case K_3JOY_A: case K_4JOY_A: case K_AUX1: case K_AUX2: case K_AUX3: case K_AUX4: case K_AUX5: case K_AUX6: case K_AUX7: case K_AUX8: case K_AUX9: case K_AUX10: case K_AUX11: case K_AUX12: case K_AUX13: case K_AUX14: case K_AUX15: case K_AUX16: case K_KP_ENTER: case K_ENTER: if (item) if (!(item->flags & (QMF_MOUSEONLY|QMF_GRAYED|QMF_INACTIVE))) return (Menu_ActivateItem( m, item )); break; } return sound; }
static void Preferences_Event( void* ptr, int notification ) { if( notification != QM_ACTIVATED ) { return; } switch( ((menucommon_s*)ptr)->id ) { #ifndef TURTLEARENA case ID_CROSSHAIR: trap_Cvar_SetValue( "cg_drawCrosshair", s_preferences.crosshair.curvalue ); break; case ID_CROSSHAIRHEALTH: trap_Cvar_SetValue( "cg_crosshairHealth", s_preferences.crosshairhealth.curvalue ); break; case ID_VIEWBOB: trap_Cvar_SetValue( "cg_viewbob", s_preferences.viewbob.curvalue ); break; #endif case ID_SIMPLEITEMS: trap_Cvar_SetValue( "cg_simpleItems", s_preferences.simpleitems.curvalue ); break; case ID_HIGHQUALITYSKY: trap_Cvar_SetValue( "r_fastsky", !s_preferences.highqualitysky.curvalue ); break; #ifndef TURTLEARENA case ID_EJECTINGBRASS: if ( s_preferences.brass.curvalue ) trap_Cvar_Reset( "cg_brassTime" ); else trap_Cvar_SetValue( "cg_brassTime", 0 ); break; #endif case ID_WALLMARKS: trap_Cvar_SetValue( "cg_marks", s_preferences.wallmarks.curvalue ); break; case ID_DYNAMICLIGHTS: trap_Cvar_SetValue( "r_dynamiclight", s_preferences.dynamiclights.curvalue ); break; case ID_IDENTIFYTARGET: trap_Cvar_SetValue( "cg_drawCrosshairNames", s_preferences.identifytarget.curvalue ); break; case ID_SYNCEVERYFRAME: trap_Cvar_SetValue( "r_finish", s_preferences.synceveryframe.curvalue ); break; case ID_FORCEMODEL: #ifdef TURTLEARENA // NO_CGFORCEMODLE trap_Cvar_SetValue( "cg_deferPlayers", s_preferences.forcemodel.curvalue ); #else trap_Cvar_SetValue( "cg_forcemodel", s_preferences.forcemodel.curvalue ); #endif break; case ID_DRAWTEAMOVERLAY: trap_Cvar_SetValue( "cg_drawTeamOverlay", s_preferences.drawteamoverlay.curvalue ); break; case ID_ALLOWDOWNLOAD: trap_Cvar_SetValue( "cl_allowDownload", s_preferences.allowdownload.curvalue ); trap_Cvar_SetValue( "sv_allowDownload", s_preferences.allowdownload.curvalue ); break; case ID_SPLITVERTICAL: trap_Cvar_SetValue( "cg_splitviewVertical", s_preferences.splitvertical.curvalue ); break; case ID_SPLITTEXTSIZE: trap_Cvar_SetValue( "cg_splitviewTextScale", 1.0f + (float)s_preferences.splittextsize.curvalue/2.0f ); break; case ID_THIRDSIZE: trap_Cvar_SetValue( "cg_splitviewThirdEqual", s_preferences.thirdsize.curvalue ); break; #ifdef IOQ3ZTM // CONTENT_FILTERING #ifndef NOBLOOD case ID_SHOWBLOOD: trap_Cvar_SetValue( "com_blood", s_preferences.showblood.curvalue ); break; #endif #ifndef NOTRATEDM case ID_SHOWGIBS: trap_Cvar_SetValue( "cg_gibs", s_preferences.showgibs.curvalue ); break; #endif #endif case ID_BACK: UI_PopMenu(); break; } }
/* ================= GraphicsOptions_Event ================= */ static void GraphicsOptions_Event(void* ptr, int event) { InitialVideoOptions_s *ivo; if (event != QM_ACTIVATED) { return; } switch (((menucommon_s*)ptr)->id) { case ID_MODE: // clamp 3dfx video modes if (s_graphicsoptions.driver.curvalue == 1) { if (s_graphicsoptions.mode.curvalue < 2) s_graphicsoptions.mode.curvalue = 2; else if (s_graphicsoptions.mode.curvalue > 6) s_graphicsoptions.mode.curvalue = 6; } break; case ID_LIST: ivo = &s_ivo_templates[s_graphicsoptions.list.curvalue]; s_graphicsoptions.mode.curvalue = ivo->mode; s_graphicsoptions.tq.curvalue = ivo->tq; s_graphicsoptions.lighting.curvalue = ivo->lighting; s_graphicsoptions.colordepth.curvalue = ivo->colordepth; s_graphicsoptions.texturebits.curvalue = ivo->texturebits; s_graphicsoptions.geometry.curvalue = ivo->geometry; s_graphicsoptions.filter.curvalue = ivo->filter; s_graphicsoptions.fs.curvalue = ivo->fullscreen; break; case ID_DRIVERINFO: UI_DriverInfo_Menu(); break; case ID_BACK2: UI_PopMenu(); break; case ID_GRAPHICS: break; case ID_DISPLAY: UI_PopMenu(); UI_DisplayOptionsMenu(); break; case ID_SOUND: UI_PopMenu(); UI_SoundOptionsMenu(); break; case ID_NETWORK: UI_PopMenu(); UI_NetworkOptionsMenu(); break; } }
/* =============== UI_TeamOrdersMenu_BackEvent =============== */ static void UI_TeamOrdersMenu_BackEvent(void* ptr, int event) { if (event != QM_ACTIVATED) { return; } UI_PopMenu(); }
/* ================= ArenaServers_Event ================= */ static void ArenaServers_Event( void* ptr, int event ) { int id; id = ((menucommon_s*)ptr)->id; if( event != QM_ACTIVATED && id != ID_LIST ) { return; } switch( id ) { case ID_MASTER: g_arenaservers.master.curvalue = ArenaServers_SetType(g_arenaservers.master.curvalue); cvarSystem->SetValue( "ui_browserMaster", g_arenaservers.master.curvalue); break; case ID_GAMETYPE: cvarSystem->SetValue( "ui_browserGameType", g_arenaservers.gametype.curvalue ); g_gametype = g_arenaservers.gametype.curvalue; ArenaServers_UpdateMenu(); break; case ID_SORTKEY: cvarSystem->SetValue( "ui_browserSortKey", g_arenaservers.sortkey.curvalue ); ArenaServers_Sort( g_arenaservers.sortkey.curvalue ); ArenaServers_UpdateMenu(); break; case ID_SHOW_FULL: cvarSystem->SetValue( "ui_browserShowFull", g_arenaservers.showfull.curvalue ); g_fullservers = g_arenaservers.showfull.curvalue; ArenaServers_UpdateMenu(); break; case ID_SHOW_EMPTY: cvarSystem->SetValue( "ui_browserShowEmpty", g_arenaservers.showempty.curvalue ); g_emptyservers = g_arenaservers.showempty.curvalue; ArenaServers_UpdateMenu(); break; case ID_LIST: if( event == QM_GOTFOCUS ) { ArenaServers_UpdatePicture(); } break; case ID_SCROLL_UP: ScrollList_Key( &g_arenaservers.list, K_UPARROW ); break; case ID_SCROLL_DOWN: ScrollList_Key( &g_arenaservers.list, K_DOWNARROW ); break; case ID_BACK: ArenaServers_StopRefresh(); ArenaServers_SaveChanges(); UI_PopMenu(); break; case ID_REFRESH: ArenaServers_StartRefresh(); break; case ID_SPECIFY: UI_SpecifyServerMenu(); break; case ID_CREATE: UI_StartServerMenu( true ); break; case ID_CONNECT: ArenaServers_Go(); break; case ID_REMOVE: ArenaServers_Remove(); ArenaServers_UpdateMenu(); break; case ID_PUNKBUSTER: if (g_arenaservers.punkbuster.curvalue) { UI_ConfirmMenu_Style( "Enable Punkbuster?", UI_CENTER|UI_INVERSE|UI_SMALLFONT, 0, Punkbuster_ConfirmEnable ); } else { UI_ConfirmMenu_Style( "Disable Punkbuster?", UI_CENTER|UI_INVERSE|UI_SMALLFONT, 0, Punkbuster_ConfirmDisable ); } break; } }
/* ================= 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; } }