void M_Menu_PlayerConfig_f (void) { if (!PlayerConfig_MenuInit()) { Menu_SetStatusBar( &s_multiplayer_menu, "No valid player models found" ); return; } Menu_SetStatusBar( &s_multiplayer_menu, NULL ); UI_PushMenu( PlayerConfig_MenuDraw, PlayerConfig_MenuKey ); }
void M_Menu_TeamConfig_f( void ) { if( !TeamConfig_MenuInit() ) { Menu_SetStatusBar( &s_team_config_menu, "No valid player models found" ); return; } Menu_SetStatusBar( &s_team_config_menu, NULL ); M_PushMenu( &s_team_config_menu, TeamConfig_MenuDraw, TeamConfig_MenuKey, TeamConfig_MenuCharEvent ); }
static void Keys_MenuInit( void ) { int BINDS_MAX; int i = 0; s_keys_menu.x = SCREEN_WIDTH*0.5; s_keys_menu.y = SCREEN_HEIGHT*0.5 - 72; // s_keys_menu.x = viddef.width * 0.50; // s_keys_menu.y = viddef.height * 0.50 - SCR_ScaledVideo(9 * MENU_FONT_SIZE); //was 7.25 s_keys_menu.nitems = 0; s_keys_menu.cursordraw = KeyCursorDrawFunc; BINDS_MAX = listSize(bindnames); for (i=0;i<BINDS_MAX;i++) addBindOption(i, bindnames); s_keys_back_action.generic.type = MTYPE_ACTION; s_keys_back_action.generic.flags = QMF_LEFT_JUSTIFY; s_keys_back_action.generic.x = 0; s_keys_back_action.generic.y = (BINDS_MAX+2)*MENU_LINE_SIZE; s_keys_back_action.generic.name = " Done"; s_keys_back_action.generic.callback = UI_BackMenu; s_keys_back_action.generic.cursordraw = KeysBackCursorDrawFunc; for (i=0;i<BINDS_MAX;i++) Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_binds[i] ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_back_action ); Menu_SetStatusBar( &s_keys_menu, "Press ENTER or LEFT CLICK to change the key. Press BACKSPACE to clear." ); // Don't center it- it's too large //Menu_Center( &s_keys_menu ); }
static void M_Custom_Init( void ) { menucommon_t *menuitem = NULL; int yoffset = 40; int i, count; s_custom_menu.nitems = 0; // parse the command line to create the buttons if( trap_Cmd_Argc() < 1 ) return; // first one is always the tittle menuitem = UI_InitMenuItem( "m_custom_title1", trap_Cmd_Argv( 1 ), 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL ); Menu_AddItem( &s_custom_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); yoffset += trap_SCR_strHeight( menuitem->font ); // from now on each 2 new arguments define a new button for( i = 2, count = 0; i < trap_Cmd_Argc(); i += 2, count++ ) { menuitem = UI_InitMenuItem( va( "m_custom_button%i", count ), trap_Cmd_Argv( i ), 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_Custom_ExecuteButton ); menuitem->itemlocal = UI_CopyString( trap_Cmd_Argv( i + 1 ) ); Menu_AddItem( &s_custom_menu, menuitem ); yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE; } Menu_Center( &s_custom_menu ); Menu_Init( &s_custom_menu, qtrue ); Menu_SetStatusBar( &s_custom_menu, NULL ); }
static const char *Keys_MenuKey( menuframework_s *self, int key ) { menuaction_s *item = ( menuaction_s * ) Menu_ItemAtCursor( &s_keys_menu ); if ( bind_grab ) { if ( key != K_ESCAPE && key != '`' ) { char cmd[1024]; Com_sprintf (cmd, sizeof(cmd), "bind \"%s\" \"%s\"", Key_KeynumToString(key), bindnames[item->generic.localdata[0]][0]); Cbuf_InsertText (cmd); } Menu_SetStatusBar( &s_keys_menu, "enter to change, backspace to clear" ); bind_grab = false; return menu_out_sound; } switch ( key ) { case K_KP_ENTER: case K_ENTER: case K_MOUSE1: KeyBindingFunc( item ); return menu_in_sound; case K_BACKSPACE: // delete bindings case K_DEL: // delete bindings case K_KP_DEL: M_UnbindCommand( bindnames[item->generic.localdata[0]][0] ); return menu_out_sound; default: return Default_MenuKey( self, key ); } }
void M_Menu_StartServer_f( void ) { if( !StartServer_MenuInit() ) return; Menu_SetStatusBar( &s_startserver_menu, NULL ); M_PushMenu( &s_startserver_menu, StartServer_MenuDraw, StartServer_MenuKey, StartServer_MenuCharEvent ); }
static void M_MainInit( void ) { int yoffset = 0; menucommon_t *menuitem; s_main_menu.nitems = 0; menuitem = UI_InitMenuItem( "m_main_title1", "MAIN MENU", 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL ); Menu_AddItem( &s_main_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_main_join_game", "find a game", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, JoinNetworkServerFunc ); Menu_AddItem( &s_main_menu, menuitem ); yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE; #ifdef MATCHMAKER_SUPPORT menuitem = UI_InitMenuItem( "m_main_matchmaker", "match maker", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, MatchMakerFunc ); Menu_AddItem( &s_main_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); #endif menuitem = UI_InitMenuItem( "m_main_tutorials", "tutorials", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, TutorialsFunc ); Menu_AddItem( &s_main_menu, menuitem ); yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE; menuitem = UI_InitMenuItem( "m_main_setup", "setup", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, SetUpMenuFunc ); Menu_AddItem( &s_main_menu, menuitem ); yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE; menuitem = UI_InitMenuItem( "m_main_start_server", "start local game", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, StartNetworkServerFunc ); Menu_AddItem( &s_main_menu, menuitem ); yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE; menuitem = UI_InitMenuItem( "m_main_demos", "demos", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, DemosMenuFunc ); Menu_AddItem( &s_main_menu, menuitem ); yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE; menuitem = UI_InitMenuItem( "m_main_mods", "mods", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, ModsMenuFunc ); Menu_AddItem( &s_main_menu, menuitem ); yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE; menuitem = UI_InitMenuItem( "m_main_console", "console", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, ConsoleFunc ); Menu_AddItem( &s_main_menu, menuitem ); yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE; menuitem = UI_InitMenuItem( "m_main_quit", "quit", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, QuitMenuFunc ); Menu_AddItem( &s_main_menu, menuitem ); yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE; Menu_Center( &s_main_menu ); Menu_Init( &s_main_menu, qtrue ); Menu_SetStatusBar( &s_main_menu, main_menu_statusbar[0] ? main_menu_statusbar : NULL ); }
static void M_Login_Login( menucommon_t *unused ) { char *email, *pass; email = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_login_email" ) ); pass = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_login_pass" ) ); if( !email || !*email ) { Menu_SetStatusBar( &s_login_menu, "please enter an email address" ); return; } if( !pass || !*pass ) { Menu_SetStatusBar( &s_login_menu, "please enter a password" ); return; } UI_AuthReply_Callback = Login_AuthReply_Callback; //trap_Auth_CheckUser( email, pass ); }
void Multiplayer_MenuInit( void ) { s_multiplayer_menu.x = SCREEN_WIDTH*0.5 - 64; // s_multiplayer_menu.y = 0; s_multiplayer_menu.nitems = 0; s_join_network_server_action.generic.type = MTYPE_ACTION; s_join_network_server_action.generic.flags = QMF_LEFT_JUSTIFY; s_join_network_server_action.generic.x = 0; s_join_network_server_action.generic.y = 0; s_join_network_server_action.generic.name = " join network server"; s_join_network_server_action.generic.callback = JoinNetworkServerFunc; s_start_network_server_action.generic.type = MTYPE_ACTION; s_start_network_server_action.generic.flags = QMF_LEFT_JUSTIFY; s_start_network_server_action.generic.x = 0; s_start_network_server_action.generic.y = 2*MENU_FONT_SIZE; s_start_network_server_action.generic.name = " start network server"; s_start_network_server_action.generic.callback = StartNetworkServerFunc; s_player_setup_action.generic.type = MTYPE_ACTION; s_player_setup_action.generic.flags = QMF_LEFT_JUSTIFY; s_player_setup_action.generic.x = 0; s_player_setup_action.generic.y = 4*MENU_FONT_SIZE; s_player_setup_action.generic.name = " player setup"; s_player_setup_action.generic.callback = PlayerSetupFunc; s_download_options_action.generic.type = MTYPE_ACTION; s_download_options_action.generic.flags = QMF_LEFT_JUSTIFY; s_download_options_action.generic.x = 0; s_download_options_action.generic.y = 6*MENU_FONT_SIZE; s_download_options_action.generic.name = " download options"; s_download_options_action.generic.callback = DownloadOptionsFunc; s_backmain_action.generic.type = MTYPE_ACTION; s_backmain_action.generic.flags = QMF_LEFT_JUSTIFY; s_backmain_action.generic.x = 0; s_backmain_action.generic.y = 9*MENU_FONT_SIZE; s_backmain_action.generic.name = " back to main"; s_backmain_action.generic.callback = UI_BackMenu; Menu_AddItem( &s_multiplayer_menu, ( void * ) &s_join_network_server_action ); Menu_AddItem( &s_multiplayer_menu, ( void * ) &s_start_network_server_action ); Menu_AddItem( &s_multiplayer_menu, ( void * ) &s_player_setup_action ); Menu_AddItem( &s_multiplayer_menu, ( void * ) &s_download_options_action ); Menu_AddItem( &s_multiplayer_menu, ( void * ) &s_backmain_action ); Menu_SetStatusBar( &s_multiplayer_menu, NULL ); Menu_Center( &s_multiplayer_menu ); }
static void KeyBindingFunc( void *self ) { menuaction_s *a = ( menuaction_s * ) self; int keys[2]; M_FindKeysForCommand( bindnames[a->generic.localdata[0]][0], keys ); if (keys[1] != -1) M_UnbindCommand( bindnames[a->generic.localdata[0]][0]); bind_grab = true; Menu_SetStatusBar( &s_keys_menu, "Press a key or button." ); }
static void Login_AuthReply_Callback( auth_reply_t reply ) { if( reply == AUTH_VALID ) { if( M_Login_Callback ) { M_Login_Callback( qtrue ); M_Login_Callback = NULL; } M_genericBackFunc( NULL ); return; } if( reply == AUTH_INVALID ) { Menu_SetStatusBar( &s_login_menu, "email address or password incorrect" ); return; } if( reply == AUTH_CHECKING ) { Menu_SetStatusBar( &s_login_menu, "contacting auth server" ); return; } }
static const char *Keys_MenuKey( int key ) { menuaction_s *item = ( menuaction_s * ) Menu_ItemAtCursor( &s_keys_menu ); //pressing mouse1 to pick a new bind wont force bind/unbind itself - spaz if ( bind_grab && !(cursor.buttonused[MOUSEBUTTON1]&&key==K_MOUSE1)) { if ( key != K_ESCAPE && key != '`' ) { char cmd[1024]; Com_sprintf (cmd, sizeof(cmd), "bind \"%s\" \"%s\"\n", Key_KeynumToString(key), bindnames[item->generic.localdata[0]][0]); Cbuf_InsertText (cmd); } // Knightmare- added Psychospaz's mouse support //dont let selecting with mouse buttons screw everything up UI_RefreshCursorButtons(); if (key==K_MOUSE1) cursor.buttonclicks[MOUSEBUTTON1] = -1; //Menu_SetStatusBar( &s_keys_menu, "enter to change, backspace to clear" ); Menu_SetStatusBar( &s_keys_menu, "Press ENTER or LEFT CLICK to change the key. Press BACKSPACE to clear." ); bind_grab = false; return menu_out_sound; } switch ( key ) { case K_KP_ENTER: case K_ENTER: if (item == &s_keys_back_action) { // back action hack UI_BackMenu(item); return NULL; } KeyBindingFunc( item ); return menu_in_sound; case K_BACKSPACE: // delete bindings case K_DEL: // delete bindings case K_KP_DEL: M_UnbindCommand( bindnames[item->generic.localdata[0]][0] ); return menu_out_sound; default: return Default_MenuKey( &s_keys_menu, key ); } }
static void Keys_MenuInit( void ) { int y = 0; int i = 0; memset(&s_keys_menu, 0, sizeof(s_keys_menu)); s_keys_menu.x = viddef.width * 0.50; s_keys_menu.nitems = 0; s_keys_menu.cursordraw = KeyCursorDrawFunc; s_keys_attack_action.generic.type = MTYPE_ACTION; s_keys_attack_action.generic.flags = QMF_GRAYED; s_keys_attack_action.generic.x = 0; s_keys_attack_action.generic.y = y; s_keys_attack_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_attack_action.generic.localdata[0] = i; s_keys_attack_action.generic.name = bindnames[s_keys_attack_action.generic.localdata[0]][1]; s_keys_change_weapon_action.generic.type = MTYPE_ACTION; s_keys_change_weapon_action.generic.flags = QMF_GRAYED; s_keys_change_weapon_action.generic.x = 0; s_keys_change_weapon_action.generic.y = y += 9; s_keys_change_weapon_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_change_weapon_action.generic.localdata[0] = ++i; s_keys_change_weapon_action.generic.name = bindnames[s_keys_change_weapon_action.generic.localdata[0]][1]; s_keys_walk_forward_action.generic.type = MTYPE_ACTION; s_keys_walk_forward_action.generic.flags = QMF_GRAYED; s_keys_walk_forward_action.generic.x = 0; s_keys_walk_forward_action.generic.y = y += 9; s_keys_walk_forward_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_walk_forward_action.generic.localdata[0] = ++i; s_keys_walk_forward_action.generic.name = bindnames[s_keys_walk_forward_action.generic.localdata[0]][1]; s_keys_backpedal_action.generic.type = MTYPE_ACTION; s_keys_backpedal_action.generic.flags = QMF_GRAYED; s_keys_backpedal_action.generic.x = 0; s_keys_backpedal_action.generic.y = y += 9; s_keys_backpedal_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_backpedal_action.generic.localdata[0] = ++i; s_keys_backpedal_action.generic.name = bindnames[s_keys_backpedal_action.generic.localdata[0]][1]; s_keys_turn_left_action.generic.type = MTYPE_ACTION; s_keys_turn_left_action.generic.flags = QMF_GRAYED; s_keys_turn_left_action.generic.x = 0; s_keys_turn_left_action.generic.y = y += 9; s_keys_turn_left_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_turn_left_action.generic.localdata[0] = ++i; s_keys_turn_left_action.generic.name = bindnames[s_keys_turn_left_action.generic.localdata[0]][1]; s_keys_turn_right_action.generic.type = MTYPE_ACTION; s_keys_turn_right_action.generic.flags = QMF_GRAYED; s_keys_turn_right_action.generic.x = 0; s_keys_turn_right_action.generic.y = y += 9; s_keys_turn_right_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_turn_right_action.generic.localdata[0] = ++i; s_keys_turn_right_action.generic.name = bindnames[s_keys_turn_right_action.generic.localdata[0]][1]; s_keys_run_action.generic.type = MTYPE_ACTION; s_keys_run_action.generic.flags = QMF_GRAYED; s_keys_run_action.generic.x = 0; s_keys_run_action.generic.y = y += 9; s_keys_run_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_run_action.generic.localdata[0] = ++i; s_keys_run_action.generic.name = bindnames[s_keys_run_action.generic.localdata[0]][1]; s_keys_step_left_action.generic.type = MTYPE_ACTION; s_keys_step_left_action.generic.flags = QMF_GRAYED; s_keys_step_left_action.generic.x = 0; s_keys_step_left_action.generic.y = y += 9; s_keys_step_left_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_step_left_action.generic.localdata[0] = ++i; s_keys_step_left_action.generic.name = bindnames[s_keys_step_left_action.generic.localdata[0]][1]; s_keys_step_right_action.generic.type = MTYPE_ACTION; s_keys_step_right_action.generic.flags = QMF_GRAYED; s_keys_step_right_action.generic.x = 0; s_keys_step_right_action.generic.y = y += 9; s_keys_step_right_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_step_right_action.generic.localdata[0] = ++i; s_keys_step_right_action.generic.name = bindnames[s_keys_step_right_action.generic.localdata[0]][1]; s_keys_sidestep_action.generic.type = MTYPE_ACTION; s_keys_sidestep_action.generic.flags = QMF_GRAYED; s_keys_sidestep_action.generic.x = 0; s_keys_sidestep_action.generic.y = y += 9; s_keys_sidestep_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_sidestep_action.generic.localdata[0] = ++i; s_keys_sidestep_action.generic.name = bindnames[s_keys_sidestep_action.generic.localdata[0]][1]; s_keys_look_up_action.generic.type = MTYPE_ACTION; s_keys_look_up_action.generic.flags = QMF_GRAYED; s_keys_look_up_action.generic.x = 0; s_keys_look_up_action.generic.y = y += 9; s_keys_look_up_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_look_up_action.generic.localdata[0] = ++i; s_keys_look_up_action.generic.name = bindnames[s_keys_look_up_action.generic.localdata[0]][1]; s_keys_look_down_action.generic.type = MTYPE_ACTION; s_keys_look_down_action.generic.flags = QMF_GRAYED; s_keys_look_down_action.generic.x = 0; s_keys_look_down_action.generic.y = y += 9; s_keys_look_down_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_look_down_action.generic.localdata[0] = ++i; s_keys_look_down_action.generic.name = bindnames[s_keys_look_down_action.generic.localdata[0]][1]; s_keys_center_view_action.generic.type = MTYPE_ACTION; s_keys_center_view_action.generic.flags = QMF_GRAYED; s_keys_center_view_action.generic.x = 0; s_keys_center_view_action.generic.y = y += 9; s_keys_center_view_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_center_view_action.generic.localdata[0] = ++i; s_keys_center_view_action.generic.name = bindnames[s_keys_center_view_action.generic.localdata[0]][1]; s_keys_mouse_look_action.generic.type = MTYPE_ACTION; s_keys_mouse_look_action.generic.flags = QMF_GRAYED; s_keys_mouse_look_action.generic.x = 0; s_keys_mouse_look_action.generic.y = y += 9; s_keys_mouse_look_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_mouse_look_action.generic.localdata[0] = ++i; s_keys_mouse_look_action.generic.name = bindnames[s_keys_mouse_look_action.generic.localdata[0]][1]; s_keys_keyboard_look_action.generic.type = MTYPE_ACTION; s_keys_keyboard_look_action.generic.flags = QMF_GRAYED; s_keys_keyboard_look_action.generic.x = 0; s_keys_keyboard_look_action.generic.y = y += 9; s_keys_keyboard_look_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_keyboard_look_action.generic.localdata[0] = ++i; s_keys_keyboard_look_action.generic.name = bindnames[s_keys_keyboard_look_action.generic.localdata[0]][1]; s_keys_move_up_action.generic.type = MTYPE_ACTION; s_keys_move_up_action.generic.flags = QMF_GRAYED; s_keys_move_up_action.generic.x = 0; s_keys_move_up_action.generic.y = y += 9; s_keys_move_up_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_move_up_action.generic.localdata[0] = ++i; s_keys_move_up_action.generic.name = bindnames[s_keys_move_up_action.generic.localdata[0]][1]; s_keys_move_down_action.generic.type = MTYPE_ACTION; s_keys_move_down_action.generic.flags = QMF_GRAYED; s_keys_move_down_action.generic.x = 0; s_keys_move_down_action.generic.y = y += 9; s_keys_move_down_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_move_down_action.generic.localdata[0] = ++i; s_keys_move_down_action.generic.name = bindnames[s_keys_move_down_action.generic.localdata[0]][1]; s_keys_inventory_action.generic.type = MTYPE_ACTION; s_keys_inventory_action.generic.flags = QMF_GRAYED; s_keys_inventory_action.generic.x = 0; s_keys_inventory_action.generic.y = y += 9; s_keys_inventory_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_inventory_action.generic.localdata[0] = ++i; s_keys_inventory_action.generic.name = bindnames[s_keys_inventory_action.generic.localdata[0]][1]; s_keys_inv_use_action.generic.type = MTYPE_ACTION; s_keys_inv_use_action.generic.flags = QMF_GRAYED; s_keys_inv_use_action.generic.x = 0; s_keys_inv_use_action.generic.y = y += 9; s_keys_inv_use_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_inv_use_action.generic.localdata[0] = ++i; s_keys_inv_use_action.generic.name = bindnames[s_keys_inv_use_action.generic.localdata[0]][1]; s_keys_inv_drop_action.generic.type = MTYPE_ACTION; s_keys_inv_drop_action.generic.flags = QMF_GRAYED; s_keys_inv_drop_action.generic.x = 0; s_keys_inv_drop_action.generic.y = y += 9; s_keys_inv_drop_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_inv_drop_action.generic.localdata[0] = ++i; s_keys_inv_drop_action.generic.name = bindnames[s_keys_inv_drop_action.generic.localdata[0]][1]; s_keys_inv_prev_action.generic.type = MTYPE_ACTION; s_keys_inv_prev_action.generic.flags = QMF_GRAYED; s_keys_inv_prev_action.generic.x = 0; s_keys_inv_prev_action.generic.y = y += 9; s_keys_inv_prev_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_inv_prev_action.generic.localdata[0] = ++i; s_keys_inv_prev_action.generic.name = bindnames[s_keys_inv_prev_action.generic.localdata[0]][1]; s_keys_inv_next_action.generic.type = MTYPE_ACTION; s_keys_inv_next_action.generic.flags = QMF_GRAYED; s_keys_inv_next_action.generic.x = 0; s_keys_inv_next_action.generic.y = y += 9; s_keys_inv_next_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_inv_next_action.generic.localdata[0] = ++i; s_keys_inv_next_action.generic.name = bindnames[s_keys_inv_next_action.generic.localdata[0]][1]; s_keys_help_computer_action.generic.type = MTYPE_ACTION; s_keys_help_computer_action.generic.flags = QMF_GRAYED; s_keys_help_computer_action.generic.x = 0; s_keys_help_computer_action.generic.y = y += 9; s_keys_help_computer_action.generic.ownerdraw = DrawKeyBindingFunc; s_keys_help_computer_action.generic.localdata[0] = ++i; s_keys_help_computer_action.generic.name = bindnames[s_keys_help_computer_action.generic.localdata[0]][1]; s_keys_menu.draw = Keys_MenuDraw; s_keys_menu.key = Keys_MenuKey; Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_attack_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_change_weapon_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_walk_forward_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_backpedal_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_turn_left_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_turn_right_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_run_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_step_left_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_step_right_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_sidestep_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_look_up_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_look_down_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_center_view_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_mouse_look_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_keyboard_look_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_move_up_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_move_down_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_inventory_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_inv_use_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_inv_drop_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_inv_prev_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_inv_next_action ); Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_help_computer_action ); Menu_SetStatusBar( &s_keys_menu, "enter to change, backspace to clear" ); Menu_Center( &s_keys_menu ); }
void M_Menu_Main_Statusbar_f( void ) { Q_strncpyz( main_menu_statusbar, trap_Cmd_Args(), sizeof( main_menu_statusbar ) ); Menu_SetStatusBar( &s_main_menu, main_menu_statusbar[0] ? main_menu_statusbar : NULL ); }
void DMOptions_MenuInit( void ) { static const char *yes_no_names[] = { "no", "yes", 0 }; static const char *teamplay_names[] = { "disabled", "by skin", "by model", 0 }; int32_t dmflags = Cvar_VariableValue( "dmflags" ); int32_t y = 0; s_dmoptions_menu.x = SCREEN_WIDTH*0.5; // s_dmoptions_menu.x = viddef.width * 0.50; s_dmoptions_menu.y = SCREEN_HEIGHT*0.5 - 80; s_dmoptions_menu.nitems = 0; s_falls_box.generic.type = MTYPE_SPINCONTROL; s_falls_box.generic.x = 0; s_falls_box.generic.y = y; // 0 s_falls_box.generic.name = "falling damage"; s_falls_box.generic.callback = DMFlagCallback; s_falls_box.itemnames = yes_no_names; s_falls_box.curvalue = ( dmflags & DF_NO_FALLING ) == 0; s_weapons_stay_box.generic.type = MTYPE_SPINCONTROL; s_weapons_stay_box.generic.x = 0; s_weapons_stay_box.generic.y = y += MENU_LINE_SIZE; s_weapons_stay_box.generic.name = "weapons stay"; s_weapons_stay_box.generic.callback = DMFlagCallback; s_weapons_stay_box.itemnames = yes_no_names; s_weapons_stay_box.curvalue = ( dmflags & DF_WEAPONS_STAY ) != 0; s_instant_powerups_box.generic.type = MTYPE_SPINCONTROL; s_instant_powerups_box.generic.x = 0; s_instant_powerups_box.generic.y = y += MENU_LINE_SIZE; s_instant_powerups_box.generic.name = "instant powerups"; s_instant_powerups_box.generic.callback = DMFlagCallback; s_instant_powerups_box.itemnames = yes_no_names; s_instant_powerups_box.curvalue = ( dmflags & DF_INSTANT_ITEMS ) != 0; s_powerups_box.generic.type = MTYPE_SPINCONTROL; s_powerups_box.generic.x = 0; s_powerups_box.generic.y = y += MENU_LINE_SIZE; s_powerups_box.generic.name = "allow powerups"; s_powerups_box.generic.callback = DMFlagCallback; s_powerups_box.itemnames = yes_no_names; s_powerups_box.curvalue = ( dmflags & DF_NO_ITEMS ) == 0; s_health_box.generic.type = MTYPE_SPINCONTROL; s_health_box.generic.x = 0; s_health_box.generic.y = y += MENU_LINE_SIZE; s_health_box.generic.callback = DMFlagCallback; s_health_box.generic.name = "allow health"; s_health_box.itemnames = yes_no_names; s_health_box.curvalue = ( dmflags & DF_NO_HEALTH ) == 0; s_armor_box.generic.type = MTYPE_SPINCONTROL; s_armor_box.generic.x = 0; s_armor_box.generic.y = y += MENU_LINE_SIZE; s_armor_box.generic.name = "allow armor"; s_armor_box.generic.callback = DMFlagCallback; s_armor_box.itemnames = yes_no_names; s_armor_box.curvalue = ( dmflags & DF_NO_ARMOR ) == 0; s_spawn_farthest_box.generic.type = MTYPE_SPINCONTROL; s_spawn_farthest_box.generic.x = 0; s_spawn_farthest_box.generic.y = y += MENU_LINE_SIZE; s_spawn_farthest_box.generic.name = "spawn farthest"; s_spawn_farthest_box.generic.callback = DMFlagCallback; s_spawn_farthest_box.itemnames = yes_no_names; s_spawn_farthest_box.curvalue = ( dmflags & DF_SPAWN_FARTHEST ) != 0; s_samelevel_box.generic.type = MTYPE_SPINCONTROL; s_samelevel_box.generic.x = 0; s_samelevel_box.generic.y = y += MENU_LINE_SIZE; s_samelevel_box.generic.name = "same map"; s_samelevel_box.generic.callback = DMFlagCallback; s_samelevel_box.itemnames = yes_no_names; s_samelevel_box.curvalue = ( dmflags & DF_SAME_LEVEL ) != 0; s_force_respawn_box.generic.type = MTYPE_SPINCONTROL; s_force_respawn_box.generic.x = 0; s_force_respawn_box.generic.y = y += MENU_LINE_SIZE; s_force_respawn_box.generic.name = "force respawn"; s_force_respawn_box.generic.callback = DMFlagCallback; s_force_respawn_box.itemnames = yes_no_names; s_force_respawn_box.curvalue = ( dmflags & DF_FORCE_RESPAWN ) != 0; s_teamplay_box.generic.type = MTYPE_SPINCONTROL; s_teamplay_box.generic.x = 0; s_teamplay_box.generic.y = y += MENU_LINE_SIZE; s_teamplay_box.generic.name = "teamplay"; s_teamplay_box.generic.callback = DMFlagCallback; s_teamplay_box.itemnames = teamplay_names; s_allow_exit_box.generic.type = MTYPE_SPINCONTROL; s_allow_exit_box.generic.x = 0; s_allow_exit_box.generic.y = y += MENU_LINE_SIZE; s_allow_exit_box.generic.name = "allow exit"; s_allow_exit_box.generic.callback = DMFlagCallback; s_allow_exit_box.itemnames = yes_no_names; s_allow_exit_box.curvalue = ( dmflags & DF_ALLOW_EXIT ) != 0; s_infinite_ammo_box.generic.type = MTYPE_SPINCONTROL; s_infinite_ammo_box.generic.x = 0; s_infinite_ammo_box.generic.y = y += MENU_LINE_SIZE; s_infinite_ammo_box.generic.name = "infinite ammo"; s_infinite_ammo_box.generic.callback = DMFlagCallback; s_infinite_ammo_box.itemnames = yes_no_names; s_infinite_ammo_box.curvalue = ( dmflags & DF_INFINITE_AMMO ) != 0; s_fixed_fov_box.generic.type = MTYPE_SPINCONTROL; s_fixed_fov_box.generic.x = 0; s_fixed_fov_box.generic.y = y += MENU_LINE_SIZE; s_fixed_fov_box.generic.name = "fixed FOV"; s_fixed_fov_box.generic.callback = DMFlagCallback; s_fixed_fov_box.itemnames = yes_no_names; s_fixed_fov_box.curvalue = ( dmflags & DF_FIXED_FOV ) != 0; s_quad_drop_box.generic.type = MTYPE_SPINCONTROL; s_quad_drop_box.generic.x = 0; s_quad_drop_box.generic.y = y += MENU_LINE_SIZE; s_quad_drop_box.generic.name = "quad drop"; s_quad_drop_box.generic.callback = DMFlagCallback; s_quad_drop_box.itemnames = yes_no_names; s_quad_drop_box.curvalue = ( dmflags & DF_QUAD_DROP ) != 0; s_friendlyfire_box.generic.type = MTYPE_SPINCONTROL; s_friendlyfire_box.generic.x = 0; s_friendlyfire_box.generic.y = y += MENU_LINE_SIZE; s_friendlyfire_box.generic.name = "friendly fire"; s_friendlyfire_box.generic.callback = DMFlagCallback; s_friendlyfire_box.itemnames = yes_no_names; s_friendlyfire_box.curvalue = ( dmflags & DF_NO_FRIENDLY_FIRE ) == 0; // Knightmare added if (modType("xatrix")) { s_quadfire_drop_box.generic.type = MTYPE_SPINCONTROL; s_quadfire_drop_box.generic.x = 0; s_quadfire_drop_box.generic.y = y += MENU_LINE_SIZE; s_quadfire_drop_box.generic.name = "dualfire drop"; s_quadfire_drop_box.generic.callback = DMFlagCallback; s_quadfire_drop_box.itemnames = yes_no_names; s_quadfire_drop_box.curvalue = ( dmflags & DF_QUADFIRE_DROP ) != 0; } //============ //ROGUE //Knightmare 12/23/2001 else if (roguepath()) { s_no_mines_box.generic.type = MTYPE_SPINCONTROL; s_no_mines_box.generic.x = 0; s_no_mines_box.generic.y = y += MENU_LINE_SIZE; s_no_mines_box.generic.name = "remove mines"; s_no_mines_box.generic.callback = DMFlagCallback; s_no_mines_box.itemnames = yes_no_names; s_no_mines_box.curvalue = ( dmflags & DF_NO_MINES ) != 0; s_no_nukes_box.generic.type = MTYPE_SPINCONTROL; s_no_nukes_box.generic.x = 0; s_no_nukes_box.generic.y = y += MENU_LINE_SIZE; s_no_nukes_box.generic.name = "remove nukes"; s_no_nukes_box.generic.callback = DMFlagCallback; s_no_nukes_box.itemnames = yes_no_names; s_no_nukes_box.curvalue = ( dmflags & DF_NO_NUKES ) != 0; s_stack_double_box.generic.type = MTYPE_SPINCONTROL; s_stack_double_box.generic.x = 0; s_stack_double_box.generic.y = y += MENU_LINE_SIZE; s_stack_double_box.generic.name = "2x/4x stacking off"; s_stack_double_box.generic.callback = DMFlagCallback; s_stack_double_box.itemnames = yes_no_names; s_stack_double_box.curvalue = ( dmflags & DF_NO_STACK_DOUBLE ) != 0; s_no_spheres_box.generic.type = MTYPE_SPINCONTROL; s_no_spheres_box.generic.x = 0; s_no_spheres_box.generic.y = y += MENU_LINE_SIZE; s_no_spheres_box.generic.name = "remove spheres"; s_no_spheres_box.generic.callback = DMFlagCallback; s_no_spheres_box.itemnames = yes_no_names; s_no_spheres_box.curvalue = ( dmflags & DF_NO_SPHERES ) != 0; } //ROGUE //============ // Knightmare added else if (CTF_menumode()) { s_ctf_forceteam_box.generic.type = MTYPE_SPINCONTROL; s_ctf_forceteam_box.generic.x = 0; s_ctf_forceteam_box.generic.y = y += MENU_LINE_SIZE; s_ctf_forceteam_box.generic.name = "force team join"; s_ctf_forceteam_box.generic.callback = DMFlagCallback; s_ctf_forceteam_box.itemnames = yes_no_names; s_ctf_forceteam_box.curvalue = ( dmflags & DF_CTF_FORCEJOIN ) != 0; s_ctf_armor_protect_box.generic.type = MTYPE_SPINCONTROL; s_ctf_armor_protect_box.generic.x = 0; s_ctf_armor_protect_box.generic.y = y += MENU_LINE_SIZE; s_ctf_armor_protect_box.generic.name = "team armor protect"; s_ctf_armor_protect_box.generic.callback = DMFlagCallback; s_ctf_armor_protect_box.itemnames = yes_no_names; s_ctf_armor_protect_box.curvalue = ( dmflags & DF_ARMOR_PROTECT ) != 0; s_ctf_notechs_box.generic.type = MTYPE_SPINCONTROL; s_ctf_notechs_box.generic.x = 0; s_ctf_notechs_box.generic.y = y += MENU_LINE_SIZE; s_ctf_notechs_box.generic.name = "disable techs"; s_ctf_notechs_box.generic.callback = DMFlagCallback; s_ctf_notechs_box.itemnames = yes_no_names; s_ctf_notechs_box.curvalue = ( dmflags & DF_CTF_NO_TECH ) != 0; } s_dmoptions_back_action.generic.type = MTYPE_ACTION; s_dmoptions_back_action.generic.flags = QMF_LEFT_JUSTIFY; s_dmoptions_back_action.generic.x = 0; s_dmoptions_back_action.generic.y = y += 3*MENU_LINE_SIZE; s_dmoptions_back_action.generic.name = " back"; s_dmoptions_back_action.generic.callback = UI_BackMenu; Menu_AddItem( &s_dmoptions_menu, &s_falls_box ); Menu_AddItem( &s_dmoptions_menu, &s_weapons_stay_box ); Menu_AddItem( &s_dmoptions_menu, &s_instant_powerups_box ); Menu_AddItem( &s_dmoptions_menu, &s_powerups_box ); Menu_AddItem( &s_dmoptions_menu, &s_health_box ); Menu_AddItem( &s_dmoptions_menu, &s_armor_box ); Menu_AddItem( &s_dmoptions_menu, &s_spawn_farthest_box ); Menu_AddItem( &s_dmoptions_menu, &s_samelevel_box ); Menu_AddItem( &s_dmoptions_menu, &s_force_respawn_box ); Menu_AddItem( &s_dmoptions_menu, &s_teamplay_box ); Menu_AddItem( &s_dmoptions_menu, &s_allow_exit_box ); Menu_AddItem( &s_dmoptions_menu, &s_infinite_ammo_box ); Menu_AddItem( &s_dmoptions_menu, &s_fixed_fov_box ); Menu_AddItem( &s_dmoptions_menu, &s_quad_drop_box ); Menu_AddItem( &s_dmoptions_menu, &s_friendlyfire_box ); // Xatrix if (modType("xatrix")) Menu_AddItem( &s_dmoptions_menu, &s_quadfire_drop_box ); // Rogue else if (roguepath()) { Menu_AddItem( &s_dmoptions_menu, &s_no_mines_box ); Menu_AddItem( &s_dmoptions_menu, &s_no_nukes_box ); Menu_AddItem( &s_dmoptions_menu, &s_stack_double_box ); Menu_AddItem( &s_dmoptions_menu, &s_no_spheres_box ); } // CTF else if (CTF_menumode()) { Menu_AddItem( &s_dmoptions_menu, &s_ctf_forceteam_box ); Menu_AddItem( &s_dmoptions_menu, &s_ctf_armor_protect_box ); Menu_AddItem( &s_dmoptions_menu, &s_ctf_notechs_box ); } Menu_AddItem( &s_dmoptions_menu, &s_dmoptions_back_action ); // Menu_Center( &s_dmoptions_menu ); // set the original dmflags statusbar DMFlagCallback( 0 ); Menu_SetStatusBar( &s_dmoptions_menu, dmoptions_statusbar ); }
static void M_Msgbox_Init( void ) { int i, j, s; int lineend, len; int n = 0; const char *p; menucommon_t *menuitem = NULL; char menuitem_name[40]; char scnd_btn_name[120] = { '\0' }, scnd_btn_action[120] = { '\0' }; int width = 0, yoffset = 40; s_msgbox_menu.nitems = 0; mbtext[0] = 0; for( i = 1; i < trap_Cmd_Argc(); i++ ) { Q_strncpyz( mbtext, trap_Cmd_Argv(i), sizeof( mbtext ) ); len = strlen( mbtext ); // a secret second button if( !strncmp( mbtext, "\\btn\\", 5 ) ) { p = strstr( mbtext + 6, "\\" ); if( p ) { mbtext[p - mbtext] = '\0'; Q_strncpyz( scnd_btn_name, mbtext + 5, sizeof( scnd_btn_name ) ); Q_strncpyz( scnd_btn_action, p + 1, sizeof( scnd_btn_action ) ); } continue; } // split the text into lines for( s = 0; s <= len; s += j + 1 ) { lineend = min( len - s, M_MSGBOX_LINELEN ); for( j = lineend; j && mbtext[s+j] && mbtext[s+j] != ' '; j-- ); if( !j ) j = lineend; mbtext[s+j] = '\0'; Q_snprintfz( menuitem_name, sizeof( menuitem_name ), "m_msgbox_textline_%i", n ); menuitem = UI_InitMenuItem( menuitem_name, mbtext + s, 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_msgbox_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); n++; } } //if we printed something, add one line separation if( menuitem ) yoffset += trap_SCR_strHeight( menuitem->font ); if( scnd_btn_name[0] && scnd_btn_action[0] ) width = UI_StringWidth( "close", uis.fontSystemBig ); else width = 0; menuitem = UI_InitMenuItem( "m_msgbox_close", "close", -width, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_genericBackFunc ); Menu_AddItem( &s_msgbox_menu, menuitem ); if( scnd_btn_name[0] && scnd_btn_action[0] ) { UI_SetupButton( menuitem, qtrue ); menuitem = UI_InitMenuItem( "m_msgbox_connect", scnd_btn_name, width, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_Msgbox_SecondButton ); menuitem->itemlocal = UI_CopyString( scnd_btn_action ); Menu_AddItem( &s_msgbox_menu, menuitem ); } yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE; Menu_Center( &s_msgbox_menu ); Menu_Init( &s_msgbox_menu, qfalse ); Menu_SetStatusBar( &s_msgbox_menu, NULL ); }
void DMOptions_MenuInit( void ) { static const char *yes_no_names[] = { "no", "yes", 0 }; static const char *teamplay_names[] = { "disabled", "by skin", "by model", 0 }; int dmflags = Cvar_VariableIntValue( "dmflags" ); int y = 0; memset(&s_dmoptions_menu, 0, sizeof(s_dmoptions_menu)); s_dmoptions_menu.x = viddef.width * 0.50; s_dmoptions_menu.nitems = 0; s_falls_box.generic.type = MTYPE_SPINCONTROL; s_falls_box.generic.x = 0; s_falls_box.generic.y = y; s_falls_box.generic.name = "falling damage"; s_falls_box.generic.callback = DMFlagCallback; s_falls_box.itemnames = yes_no_names; s_falls_box.curvalue = ( dmflags & DF_NO_FALLING ) == 0; s_weapons_stay_box.generic.type = MTYPE_SPINCONTROL; s_weapons_stay_box.generic.x = 0; s_weapons_stay_box.generic.y = y += 10; s_weapons_stay_box.generic.name = "weapons stay"; s_weapons_stay_box.generic.callback = DMFlagCallback; s_weapons_stay_box.itemnames = yes_no_names; s_weapons_stay_box.curvalue = ( dmflags & DF_WEAPONS_STAY ) != 0; s_instant_powerups_box.generic.type = MTYPE_SPINCONTROL; s_instant_powerups_box.generic.x = 0; s_instant_powerups_box.generic.y = y += 10; s_instant_powerups_box.generic.name = "instant powerups"; s_instant_powerups_box.generic.callback = DMFlagCallback; s_instant_powerups_box.itemnames = yes_no_names; s_instant_powerups_box.curvalue = ( dmflags & DF_INSTANT_ITEMS ) != 0; s_powerups_box.generic.type = MTYPE_SPINCONTROL; s_powerups_box.generic.x = 0; s_powerups_box.generic.y = y += 10; s_powerups_box.generic.name = "allow powerups"; s_powerups_box.generic.callback = DMFlagCallback; s_powerups_box.itemnames = yes_no_names; s_powerups_box.curvalue = ( dmflags & DF_NO_ITEMS ) == 0; s_health_box.generic.type = MTYPE_SPINCONTROL; s_health_box.generic.x = 0; s_health_box.generic.y = y += 10; s_health_box.generic.callback = DMFlagCallback; s_health_box.generic.name = "allow health"; s_health_box.itemnames = yes_no_names; s_health_box.curvalue = ( dmflags & DF_NO_HEALTH ) == 0; s_armor_box.generic.type = MTYPE_SPINCONTROL; s_armor_box.generic.x = 0; s_armor_box.generic.y = y += 10; s_armor_box.generic.name = "allow armor"; s_armor_box.generic.callback = DMFlagCallback; s_armor_box.itemnames = yes_no_names; s_armor_box.curvalue = ( dmflags & DF_NO_ARMOR ) == 0; s_spawn_farthest_box.generic.type = MTYPE_SPINCONTROL; s_spawn_farthest_box.generic.x = 0; s_spawn_farthest_box.generic.y = y += 10; s_spawn_farthest_box.generic.name = "spawn farthest"; s_spawn_farthest_box.generic.callback = DMFlagCallback; s_spawn_farthest_box.itemnames = yes_no_names; s_spawn_farthest_box.curvalue = ( dmflags & DF_SPAWN_FARTHEST ) != 0; s_samelevel_box.generic.type = MTYPE_SPINCONTROL; s_samelevel_box.generic.x = 0; s_samelevel_box.generic.y = y += 10; s_samelevel_box.generic.name = "same map"; s_samelevel_box.generic.callback = DMFlagCallback; s_samelevel_box.itemnames = yes_no_names; s_samelevel_box.curvalue = ( dmflags & DF_SAME_LEVEL ) != 0; s_force_respawn_box.generic.type = MTYPE_SPINCONTROL; s_force_respawn_box.generic.x = 0; s_force_respawn_box.generic.y = y += 10; s_force_respawn_box.generic.name = "force respawn"; s_force_respawn_box.generic.callback = DMFlagCallback; s_force_respawn_box.itemnames = yes_no_names; s_force_respawn_box.curvalue = ( dmflags & DF_FORCE_RESPAWN ) != 0; s_teamplay_box.generic.type = MTYPE_SPINCONTROL; s_teamplay_box.generic.x = 0; s_teamplay_box.generic.y = y += 10; s_teamplay_box.generic.name = "teamplay"; s_teamplay_box.generic.callback = DMFlagCallback; s_teamplay_box.itemnames = teamplay_names; s_allow_exit_box.generic.type = MTYPE_SPINCONTROL; s_allow_exit_box.generic.x = 0; s_allow_exit_box.generic.y = y += 10; s_allow_exit_box.generic.name = "allow exit"; s_allow_exit_box.generic.callback = DMFlagCallback; s_allow_exit_box.itemnames = yes_no_names; s_allow_exit_box.curvalue = ( dmflags & DF_ALLOW_EXIT ) != 0; s_infinite_ammo_box.generic.type = MTYPE_SPINCONTROL; s_infinite_ammo_box.generic.x = 0; s_infinite_ammo_box.generic.y = y += 10; s_infinite_ammo_box.generic.name = "infinite ammo"; s_infinite_ammo_box.generic.callback = DMFlagCallback; s_infinite_ammo_box.itemnames = yes_no_names; s_infinite_ammo_box.curvalue = ( dmflags & DF_INFINITE_AMMO ) != 0; s_fixed_fov_box.generic.type = MTYPE_SPINCONTROL; s_fixed_fov_box.generic.x = 0; s_fixed_fov_box.generic.y = y += 10; s_fixed_fov_box.generic.name = "fixed FOV"; s_fixed_fov_box.generic.callback = DMFlagCallback; s_fixed_fov_box.itemnames = yes_no_names; s_fixed_fov_box.curvalue = ( dmflags & DF_FIXED_FOV ) != 0; s_quad_drop_box.generic.type = MTYPE_SPINCONTROL; s_quad_drop_box.generic.x = 0; s_quad_drop_box.generic.y = y += 10; s_quad_drop_box.generic.name = "quad drop"; s_quad_drop_box.generic.callback = DMFlagCallback; s_quad_drop_box.itemnames = yes_no_names; s_quad_drop_box.curvalue = ( dmflags & DF_QUAD_DROP ) != 0; s_friendlyfire_box.generic.type = MTYPE_SPINCONTROL; s_friendlyfire_box.generic.x = 0; s_friendlyfire_box.generic.y = y += 10; s_friendlyfire_box.generic.name = "friendly fire"; s_friendlyfire_box.generic.callback = DMFlagCallback; s_friendlyfire_box.itemnames = yes_no_names; s_friendlyfire_box.curvalue = ( dmflags & DF_NO_FRIENDLY_FIRE ) == 0; //============ //ROGUE if(Developer_searchpath() == 2) { s_no_mines_box.generic.type = MTYPE_SPINCONTROL; s_no_mines_box.generic.x = 0; s_no_mines_box.generic.y = y += 10; s_no_mines_box.generic.name = "remove mines"; s_no_mines_box.generic.callback = DMFlagCallback; s_no_mines_box.itemnames = yes_no_names; s_no_mines_box.curvalue = ( dmflags & DF_NO_MINES ) != 0; s_no_nukes_box.generic.type = MTYPE_SPINCONTROL; s_no_nukes_box.generic.x = 0; s_no_nukes_box.generic.y = y += 10; s_no_nukes_box.generic.name = "remove nukes"; s_no_nukes_box.generic.callback = DMFlagCallback; s_no_nukes_box.itemnames = yes_no_names; s_no_nukes_box.curvalue = ( dmflags & DF_NO_NUKES ) != 0; s_stack_double_box.generic.type = MTYPE_SPINCONTROL; s_stack_double_box.generic.x = 0; s_stack_double_box.generic.y = y += 10; s_stack_double_box.generic.name = "2x/4x stacking off"; s_stack_double_box.generic.callback = DMFlagCallback; s_stack_double_box.itemnames = yes_no_names; s_stack_double_box.curvalue = ( dmflags & DF_NO_STACK_DOUBLE ) != 0; s_no_spheres_box.generic.type = MTYPE_SPINCONTROL; s_no_spheres_box.generic.x = 0; s_no_spheres_box.generic.y = y += 10; s_no_spheres_box.generic.name = "remove spheres"; s_no_spheres_box.generic.callback = DMFlagCallback; s_no_spheres_box.itemnames = yes_no_names; s_no_spheres_box.curvalue = ( dmflags & DF_NO_SPHERES ) != 0; } //ROGUE //============ s_dmoptions_menu.draw = NULL; s_dmoptions_menu.key = NULL; Menu_AddItem( &s_dmoptions_menu, &s_falls_box ); Menu_AddItem( &s_dmoptions_menu, &s_weapons_stay_box ); Menu_AddItem( &s_dmoptions_menu, &s_instant_powerups_box ); Menu_AddItem( &s_dmoptions_menu, &s_powerups_box ); Menu_AddItem( &s_dmoptions_menu, &s_health_box ); Menu_AddItem( &s_dmoptions_menu, &s_armor_box ); Menu_AddItem( &s_dmoptions_menu, &s_spawn_farthest_box ); Menu_AddItem( &s_dmoptions_menu, &s_samelevel_box ); Menu_AddItem( &s_dmoptions_menu, &s_force_respawn_box ); Menu_AddItem( &s_dmoptions_menu, &s_teamplay_box ); Menu_AddItem( &s_dmoptions_menu, &s_allow_exit_box ); Menu_AddItem( &s_dmoptions_menu, &s_infinite_ammo_box ); Menu_AddItem( &s_dmoptions_menu, &s_fixed_fov_box ); Menu_AddItem( &s_dmoptions_menu, &s_quad_drop_box ); Menu_AddItem( &s_dmoptions_menu, &s_friendlyfire_box ); //======= //ROGUE if(Developer_searchpath() == 2) { Menu_AddItem( &s_dmoptions_menu, &s_no_mines_box ); Menu_AddItem( &s_dmoptions_menu, &s_no_nukes_box ); Menu_AddItem( &s_dmoptions_menu, &s_stack_double_box ); Menu_AddItem( &s_dmoptions_menu, &s_no_spheres_box ); } //ROGUE //======= Menu_Center( &s_dmoptions_menu ); // set the original dmflags statusbar DMFlagCallback( 0 ); Menu_SetStatusBar( &s_dmoptions_menu, dmoptions_statusbar ); }
static void M_TV_Init( void ) { int i, yoffset, xoffset, vspacing; static char titlename[64]; menucommon_t *menuitem; int scrollwindow_height, scrollwindow_width, scrollbar_id; yoffset = 0; xoffset = 0; s_tv_menu.nitems = 0; Q_snprintfz( titlename, sizeof( titlename ), "%s TV", trap_Cvar_String( "gamename" ) ); menuitem = UI_InitMenuItem( "m_tv_title1", titlename, 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL ); Menu_AddItem( &s_tv_menu, menuitem ); yoffset += 2 *trap_SCR_strHeight( menuitem->font ); // scrollbar if( uis.vidWidth < 800 ) scrollwindow_width = uis.vidWidth * 0.85; else scrollwindow_width = uis.vidWidth * 0.75; xoffset = scrollwindow_width / 2; vspacing = trap_SCR_strHeight( uis.fontSystemSmall ) + 4; scrollwindow_height = uis.vidHeight - ( yoffset + ( 16 * trap_SCR_strHeight( uis.fontSystemBig ) ) ); max_menu_channels = scrollwindow_height / vspacing; if( max_menu_channels < 5 ) max_menu_channels = 5; menuitem = UI_InitMenuItem( "m_tv_titlerow", NULL, -xoffset, yoffset, MTYPE_SEPARATOR, ALIGN_LEFT_TOP, uis.fontSystemSmall, NULL ); Q_snprintfz( menuitem->title, MAX_STRING_CHARS, ROW_PATTERN, COLUMN_WIDTH_NO, "No", COLUMN_WIDTH_NAME, "", "Server", COLUMN_WIDTH_PLAYERS, "", " Pl/Sp", COLUMN_WIDTH_GAMETYPE, "", "Gametype", COLUMN_WIDTH_MAPNAME, "", "Map", COLUMN_WIDTH_MATCHNAME, "", "Match" ); Menu_AddItem( &s_tv_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_tv_scrollbar", NULL, xoffset, yoffset, MTYPE_SCROLLBAR, ALIGN_LEFT_TOP, uis.fontSystemSmall, M_TV_UpdateScrollbar ); menuitem->vspacing = vspacing; menuitem->scrollbar_id = scrollbar_id = s_tv_menu.nitems; //give the scrollbar an id to pass onto its list Q_strncpyz( menuitem->title, va( "ui_tv_scrollbar%i_curvalue", scrollbar_id ), sizeof( menuitem->title ) ); if( !trap_Cvar_Value( menuitem->title ) ) trap_Cvar_SetValue( menuitem->title, 0 ); UI_SetupScrollbar( menuitem, max_menu_channels, trap_Cvar_Value( menuitem->title ), 0, 0 ); Menu_AddItem( &s_tv_menu, menuitem ); for( i = 0; i < max_menu_channels; i++ ) { menuitem = UI_InitMenuItem( va( "m_tv_button_%i", i ), NO_CHANNEL_STRING, -xoffset, yoffset, MTYPE_ACTION, ALIGN_LEFT_TOP, uis.fontSystemSmall, NULL ); menuitem->callback_doubleclick = M_TV_JoinChannel; menuitem->scrollbar_id = scrollbar_id; //id of the scrollbar so that mwheelup/down can scroll from the list menuitem->height = vspacing; menuitem->statusbar = "press ENTER to watch"; menuitem->ownerdraw = M_UpdateChannelButton; menuitem->localdata[0] = i; // line in the window menuitem->localdata[1] = i; // line in list menuitem->width = scrollwindow_width; // adjust strings to this width Menu_AddItem( &s_tv_menu, menuitem ); // create an associated picture to the items to act as window background menuitem->pict.shader = uis.whiteShader; menuitem->pict.shaderHigh = uis.whiteShader; Vector4Copy( colorWhite, menuitem->pict.colorHigh ); Vector4Copy( ( i & 1 ) ? colorDkGrey : colorMdGrey, menuitem->pict.color ); menuitem->pict.color[3] = menuitem->pict.colorHigh[3] = 0.65f; menuitem->pict.yoffset = 0; menuitem->pict.xoffset = 0; menuitem->pict.width = scrollwindow_width; menuitem->pict.height = vspacing; yoffset += vspacing; } yoffset += 1.5 * trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_tv_refresh", "refresh", -xoffset, yoffset, MTYPE_ACTION, ALIGN_LEFT_TOP, uis.fontSystemBig, M_TV_RefreshFunc ); Menu_AddItem( &s_tv_menu, menuitem ); UI_SetupButton( menuitem, qtrue ); menuitem = UI_InitMenuItem( "m_tv_disconnect", "watch", xoffset, yoffset, MTYPE_ACTION, ALIGN_RIGHT_TOP, uis.fontSystemBig, M_TV_JoinChannel ); Menu_AddItem( &s_tv_menu, menuitem ); UI_SetupButton( menuitem, qtrue ); xoffset -= ( menuitem->width + 16 ); menuitem = UI_InitMenuItem( "m_tv_setup", "main menu", xoffset, yoffset, MTYPE_ACTION, ALIGN_RIGHT_TOP, uis.fontSystemBig, M_TV_MenuMainFunc ); Menu_AddItem( &s_tv_menu, menuitem ); UI_SetupButton( menuitem, qtrue ); xoffset -= ( menuitem->width + 16 ); if( uis.clientState >= CA_ACTIVE ) { menuitem = UI_InitMenuItem( "m_tv_chasecam", "chasecam", xoffset, yoffset, MTYPE_ACTION, ALIGN_RIGHT_TOP, uis.fontSystemBig, M_TV_SpecModeMenuFunc ); Menu_AddItem( &s_tv_menu, menuitem ); UI_SetupButton( menuitem, qtrue ); xoffset -= ( menuitem->width + 16 ); } Menu_Center( &s_tv_menu ); Menu_Init( &s_tv_menu, qfalse ); Menu_SetStatusBar( &s_tv_menu, NULL ); }
static void MapsList_CreateItems( const char *lastmap ) { int i, j, validmaps; int order; maplist_item_t *items; char mapinfo[MAX_CONFIGSTRING_CHARS], *mapname, *fullname; UI_FreeScrollItemList( &mapList ); for( validmaps = 0; trap_ML_GetMapByNum( validmaps, NULL, 0 ); validmaps++ ) ; if( !validmaps ) { Menu_SetStatusBar( &s_startserver_menu, "No maps found" ); return; } order = trap_Cvar_Value( "ui_maplist_sortmethod" ); items = UI_Malloc( sizeof( *items ) * validmaps ); for( i = 0; i < validmaps; i++ ) { trap_ML_GetMapByNum( i, mapinfo, sizeof( mapinfo ) ); mapname = mapinfo; fullname = mapinfo + strlen( mapname ) + 1; if( order ) items[i].name = UI_CopyString( *fullname ? fullname : mapname ); else items[i].name = UI_CopyString( mapname ); items[i].mapname = UI_CopyString( mapname ); items[i].index = i; // uppercase the first letter and letters that follow whitespaces if( order ) { if( *fullname ) { items[i].name[0] = toupper( items[i].name[0] ); for( j = 1; items[i].name[j]; j++ ) if( items[i].name[j-1] == ' ' ) items[i].name[j] = toupper( items[i].name[j] ); } else { Q_strlwr( items[i].name ); } } else { Q_strlwr( items[i].name ); } } qsort( items, validmaps, sizeof( *items ), ( int ( * )( const void *, const void * ) )MapList_MapSort ); for( i = 0; i < validmaps; i++ ) { if( !strcmp( items[i].mapname, lastmap ) ) mapList_cur_idx = i; UI_AddItemToScrollList( &mapList, items[i].name, (void *)((size_t)(items[i].index)) ); UI_Free( items[i].mapname ); UI_Free( items[i].name ); } UI_Free( items ); }