| 1 |
/* Emacs style mode select -*- C -*- |
| 2 |
*----------------------------------------------------------------------------- |
| 3 |
* |
| 4 |
* |
| 5 |
* PrBoom: a Doom port merged with LxDoom and LSDLDoom |
| 6 |
* based on BOOM, a modified and improved DOOM engine |
| 7 |
* Copyright (C) 1999 by |
| 8 |
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman |
| 9 |
* Copyright (C) 1999-2000 by |
| 10 |
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze |
| 11 |
* Copyright 2005, 2006 by |
| 12 |
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko |
| 13 |
* |
| 14 |
* This program is free software; you can redistribute it and/or |
| 15 |
* modify it under the terms of the GNU General Public License |
| 16 |
* as published by the Free Software Foundation; either version 2 |
| 17 |
* of the License, or (at your option) any later version. |
| 18 |
* |
| 19 |
* This program is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
* GNU General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU General Public License |
| 25 |
* along with this program; if not, write to the Free Software |
| 26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 27 |
* 02111-1307, USA. |
| 28 |
* |
| 29 |
* DESCRIPTION: |
| 30 |
* Menu widget stuff, episode selection and such. |
| 31 |
* |
| 32 |
*-----------------------------------------------------------------------------*/ |
| 33 |
|
| 34 |
#ifndef __M_MENU__ |
| 35 |
#define __M_MENU__ |
| 36 |
|
| 37 |
#include "d_event.h" |
| 38 |
|
| 39 |
#include "dsda/configuration.h" |
| 40 |
|
| 41 |
// |
| 42 |
// MENUS |
| 43 |
// |
| 44 |
// Called by main loop, |
| 45 |
// saves config file and calls I_Quit when user exits. |
| 46 |
// Even when the menu is not displayed, |
| 47 |
// this can resize the view and change game parameters. |
| 48 |
// Does all the real work of the menu interaction. |
| 49 |
|
| 50 |
dboolean M_Responder (event_t *ev); |
| 51 |
|
| 52 |
dboolean fadeBG(void); |
| 53 |
dboolean M_MenuIsShaded(void); |
| 54 |
void M_ShadedScreen(int scrn); |
| 55 |
|
| 56 |
#define FULLSHADE 20 |
| 57 |
|
| 58 |
// Called by main loop, |
| 59 |
// only used for menu (skull cursor) animation. |
| 60 |
|
| 61 |
void M_Ticker (void); |
| 62 |
|
| 63 |
// Called by main loop, |
| 64 |
// draws the menus directly into the screen buffer. |
| 65 |
|
| 66 |
void M_Drawer (void); |
| 67 |
|
| 68 |
// Called by D_DoomMain, |
| 69 |
// loads the config file. |
| 70 |
|
| 71 |
void M_Init (void); |
| 72 |
|
| 73 |
// Called by intro code to force menu up upon a keypress, |
| 74 |
// does nothing if menu is already up. |
| 75 |
|
| 76 |
void M_StartControlPanel (void); |
| 77 |
|
| 78 |
void M_ForcedLoadGame(const char *msg); // killough 5/15/98: forced loadgames |
| 79 |
|
| 80 |
void M_ResetMenu(void); // killough 11/98: reset main menu ordering |
| 81 |
|
| 82 |
void M_DrawCredits(void); |
| 83 |
void M_DrawCreditsDynamic(void); // killough 11/98 |
| 84 |
|
| 85 |
void M_DrawTabs(const char **pages, int m, int y); |
| 86 |
|
| 87 |
/**************************** |
| 88 |
* |
| 89 |
* The setup_group enum is used to show which 'groups' keys fall into so |
| 90 |
* that you can bind a key differently in each 'group'. |
| 91 |
* It also applies behaviour to other types of settings. |
| 92 |
*/ |
| 93 |
|
| 94 |
typedef enum { |
| 95 |
m_null, // Has no meaning; not applicable |
| 96 |
m_scrn, // A key can not be assigned to more than one action |
| 97 |
m_map, // in the same group. A key can be assigned to one |
| 98 |
m_menu, // action in one group, and another action in another. |
| 99 |
m_build, |
| 100 |
|
| 101 |
m_conf, // migrate to new config process |
| 102 |
} setup_group; |
| 103 |
|
| 104 |
/**************************** |
| 105 |
* |
| 106 |
* phares 4/17/98: |
| 107 |
* State definition for each item. |
| 108 |
* This is the definition of the structure for each setup item. Not all |
| 109 |
* fields are used by all items. |
| 110 |
* |
| 111 |
* A setup screen is defined by an array of these items specific to |
| 112 |
* that screen. |
| 113 |
* |
| 114 |
* killough 11/98: |
| 115 |
* |
| 116 |
* Restructured to allow simpler table entries, |
| 117 |
* and to Xref with defaults[] array in m_misc.c. |
| 118 |
* Moved from m_menu.c to m_menu.h so that m_misc.c can use it. |
| 119 |
*/ |
| 120 |
|
| 121 |
typedef struct setup_menu_s |
| 122 |
{ |
| 123 |
const char *m_text; /* text to display */ |
| 124 |
int m_flags; /* phares 4/17/98: flag bits S_* (defined above) */ |
| 125 |
setup_group m_group; /* Group */ |
| 126 |
short m_x; /* screen x position (left is 0) */ |
| 127 |
dsda_config_identifier_t config_id; |
| 128 |
int input; // composite input identifier |
| 129 |
const char **selectstrings; /* list of strings for choice value */ |
| 130 |
struct setup_menu_s *menu; /* next or prev menu */ |
| 131 |
} setup_menu_t; |
| 132 |
|
| 133 |
// |
| 134 |
// MENU TYPEDEFS |
| 135 |
// |
| 136 |
|
| 137 |
typedef struct |
| 138 |
{ |
| 139 |
short status; // 0 = no cursor here, 1 = ok, 2 = arrows ok |
| 140 |
char name[10]; |
| 141 |
|
| 142 |
// choice = menu item #. |
| 143 |
// if status = 2, |
| 144 |
// choice=0:leftarrow,1:rightarrow |
| 145 |
void (*routine)(int choice); |
| 146 |
char alphaKey; // hotkey in menu |
| 147 |
const char *alttext; |
| 148 |
int color; |
| 149 |
} menuitem_t; |
| 150 |
|
| 151 |
#define MENUF_TEXTINPUT 0x01 |
| 152 |
|
| 153 |
typedef struct menu_s |
| 154 |
{ |
| 155 |
short numitems; // # of menu items |
| 156 |
struct menu_s* prevMenu; // previous menu |
| 157 |
menuitem_t* menuitems; // menu items |
| 158 |
void (*routine)(); // draw routine |
| 159 |
short x; |
| 160 |
short y; // x,y of menu |
| 161 |
short lastOn; // last item user was on in menu |
| 162 |
byte flags; |
| 163 |
} menu_t; |
| 164 |
|
| 165 |
#define SAVESTRINGSIZE 24 |
| 166 |
|
| 167 |
#define MENU_NULL -1 |
| 168 |
#define MENU_LEFT -2 |
| 169 |
#define MENU_RIGHT -3 |
| 170 |
#define MENU_UP -4 |
| 171 |
#define MENU_DOWN -5 |
| 172 |
#define MENU_BACKSPACE -6 |
| 173 |
#define MENU_ENTER -7 |
| 174 |
#define MENU_ESCAPE -8 |
| 175 |
#define MENU_CLEAR -9 |
| 176 |
|
| 177 |
void M_SetupNextMenu(menu_t *menudef); |
| 178 |
void M_DrawDelVerify(void); |
| 179 |
void M_ChangeMessages(void); |
| 180 |
void M_LeaveSetupMenu(void); |
| 181 |
void M_ClearMenus(void); |
| 182 |
|
| 183 |
extern dboolean delete_verify; |
| 184 |
|
| 185 |
dboolean M_ConsoleOpen(void); |
| 186 |
|
| 187 |
#endif |