thirtyflightsofloving/ui/menu_options.c
Knightmare66 1e5348cbe0 Refactoring and rearrangment of menu code.
Added new graphic for text box.
Made edict_t pointer arrays static in 3ZB2, Awakening2, and Zaero DLLs due to stack size concerns.
2021-08-12 15:30:51 -04:00

165 lines
6.1 KiB
C

/*
===========================================================================
Copyright (C) 1997-2001 Id Software, Inc.
This file is part of Quake 2 source code.
Quake 2 source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake 2 source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Quake 2 source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// menu_options.c -- the options menu
#include <ctype.h>
#ifdef _WIN32
#include <io.h>
#endif
#include "../client/client.h"
#include "ui_local.h"
/*
=======================================================================
OPTIONS MENU
=======================================================================
*/
static menuframework_s s_options_menu;
static menuaction_s s_options_sound_section;
static menuaction_s s_options_controls_section;
static menuaction_s s_options_screen_section;
static menuaction_s s_options_effects_section;
static menuaction_s s_options_interface_section;
static menuaction_s s_options_back_action;
static void MenuSoundFunc (void *unused)
{
Menu_Options_Sound_f ();
}
static void MenuControlsFunc (void *unused)
{
Menu_Options_Controls_f ();
}
static void MenuScreenFunc (void *unused)
{
Menu_Options_Screen_f ();
}
static void MenuEffectsFunc (void *unused)
{
Menu_Options_Effects_f ();
}
static void MenuInterfaceFunc (void *unused)
{
Menu_Options_Interface_f ();
}
//=======================================================================
void Menu_Options_Init (void)
{
s_options_menu.x = SCREEN_WIDTH*0.5 - 24;
s_options_menu.y = SCREEN_HEIGHT*0.5 - 58;
s_options_menu.nitems = 0;
s_options_sound_section.generic.type = MTYPE_ACTION;
s_options_sound_section.generic.textSize = MENU_FONT_SIZE;
s_options_sound_section.generic.flags = QMF_LEFT_JUSTIFY;
s_options_sound_section.generic.name = " sound";
s_options_sound_section.generic.x = 0;
s_options_sound_section.generic.y = MENU_FONT_SIZE * 2;
s_options_sound_section.generic.callback = MenuSoundFunc;
s_options_sound_section.generic.statusbar = "change sound settings";
// s_options_sound_section.generic.cursor_offset = -(MENU_FONT_SIZE*10);
s_options_controls_section.generic.type = MTYPE_ACTION;
s_options_controls_section.generic.textSize = MENU_FONT_SIZE;
s_options_controls_section.generic.flags = QMF_LEFT_JUSTIFY;
s_options_controls_section.generic.name = " controls";
s_options_controls_section.generic.x = 0;
s_options_controls_section.generic.y = MENU_FONT_SIZE * 4;
s_options_controls_section.generic.callback = MenuControlsFunc;
s_options_controls_section.generic.statusbar = "change control settings and bind keys";
// s_options_controls_section.generic.cursor_offset = -(MENU_FONT_SIZE*10);
s_options_screen_section.generic.type = MTYPE_ACTION;
s_options_screen_section.generic.textSize = MENU_FONT_SIZE;
s_options_screen_section.generic.flags = QMF_LEFT_JUSTIFY;
s_options_screen_section.generic.name = " screen";
s_options_screen_section.generic.x = 0;
s_options_screen_section.generic.y = MENU_FONT_SIZE * 6;
s_options_screen_section.generic.callback = MenuScreenFunc;
s_options_screen_section.generic.statusbar = "change HUD/crosshair settings";
// s_options_screen_section.generic.cursor_offset = -(MENU_FONT_SIZE*10);
s_options_effects_section.generic.type = MTYPE_ACTION;
s_options_effects_section.generic.textSize = MENU_FONT_SIZE;
s_options_effects_section.generic.flags = QMF_LEFT_JUSTIFY;
s_options_effects_section.generic.name = " effects";
s_options_effects_section.generic.x = 0;
s_options_effects_section.generic.y = MENU_FONT_SIZE * 8;
s_options_effects_section.generic.callback = MenuEffectsFunc;
s_options_effects_section.generic.statusbar = "change ingame effects settings";
// s_options_effects_section.generic.cursor_offset = -(MENU_FONT_SIZE*10);
s_options_interface_section.generic.type = MTYPE_ACTION;
s_options_interface_section.generic.textSize = MENU_FONT_SIZE;
s_options_interface_section.generic.flags = QMF_LEFT_JUSTIFY;
s_options_interface_section.generic.name = " interface";
s_options_interface_section.generic.x = 0;
s_options_interface_section.generic.y = MENU_FONT_SIZE * 10;
s_options_interface_section.generic.callback = MenuInterfaceFunc;
s_options_interface_section.generic.statusbar = "change menu/console settings";
// s_options_interface_section.generic.cursor_offset = -(MENU_FONT_SIZE*10);
s_options_back_action.generic.type = MTYPE_ACTION;
s_options_back_action.generic.textSize = MENU_FONT_SIZE;
s_options_back_action.generic.flags = QMF_LEFT_JUSTIFY;
s_options_back_action.generic.name = " back to main";
s_options_back_action.generic.x = 0;
s_options_back_action.generic.y = MENU_FONT_SIZE * 13;
s_options_back_action.generic.callback = UI_BackMenu;
// s_options_back_action.generic.cursor_offset = -(MENU_FONT_SIZE*10);
UI_AddMenuItem (&s_options_menu, (void *) &s_options_sound_section);
UI_AddMenuItem (&s_options_menu, (void *) &s_options_controls_section);
UI_AddMenuItem (&s_options_menu, (void *) &s_options_screen_section);
UI_AddMenuItem (&s_options_menu, (void *) &s_options_effects_section);
UI_AddMenuItem (&s_options_menu, (void *) &s_options_interface_section);
UI_AddMenuItem (&s_options_menu, (void *) &s_options_back_action);
}
void Menu_Options_Draw (void)
{
UI_DrawBanner ("m_banner_options");
UI_AdjustMenuCursor (&s_options_menu, 1);
UI_DrawMenu (&s_options_menu);
}
const char *Menu_Options_Key (int key)
{
return UI_DefaultMenuKey (&s_options_menu, key);
}
void Menu_Options_f (void)
{
Menu_Options_Init ();
UI_PushMenu (Menu_Options_Draw, Menu_Options_Key);
}