| 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 |
* DOOM selection menu, options, episode etc. (aka Big Font menus) |
| 31 |
* Sliders and icons. Kinda widget stuff. |
| 32 |
* Setup Menus. |
| 33 |
* Extended HELP screens. |
| 34 |
* |
| 35 |
*-----------------------------------------------------------------------------*/ |
| 36 |
|
| 37 |
#ifdef HAVE_CONFIG_H |
| 38 |
#include "config.h" |
| 39 |
#endif |
| 40 |
|
| 41 |
#ifdef _MSC_VER |
| 42 |
#include <io.h> |
| 43 |
#else |
| 44 |
#include <unistd.h> |
| 45 |
#endif |
| 46 |
|
| 47 |
#include <stdio.h> |
| 48 |
#include <time.h> |
| 49 |
|
| 50 |
#include "SDL.h" |
| 51 |
|
| 52 |
#include "doomdef.h" |
| 53 |
#include "doomstat.h" |
| 54 |
#include "dstrings.h" |
| 55 |
#include "d_main.h" |
| 56 |
#include "v_video.h" |
| 57 |
#include "w_wad.h" |
| 58 |
#include "r_main.h" |
| 59 |
#include "hu_stuff.h" |
| 60 |
#include "st_stuff.h" |
| 61 |
#include "g_game.h" |
| 62 |
#include "s_sound.h" |
| 63 |
#include "sounds.h" |
| 64 |
#include "m_menu.h" |
| 65 |
#include "d_deh.h" |
| 66 |
#include "m_file.h" |
| 67 |
#include "m_misc.h" |
| 68 |
#include "lprintf.h" |
| 69 |
#include "am_map.h" |
| 70 |
#include "i_glob.h" |
| 71 |
#include "i_main.h" |
| 72 |
#include "i_system.h" |
| 73 |
#include "i_video.h" |
| 74 |
#include "i_sound.h" |
| 75 |
#include "smooth.h" |
| 76 |
#include "r_fps.h" |
| 77 |
#include "r_main.h" |
| 78 |
#include "r_segs.h" |
| 79 |
#include "f_finale.h" |
| 80 |
#include "e6y.h"//e6y |
| 81 |
|
| 82 |
#include "dsda/episode.h" |
| 83 |
#include "dsda/exhud.h" |
| 84 |
#include "dsda/features.h" |
| 85 |
#include "dsda/font.h" |
| 86 |
#include "dsda/game_controller.h" |
| 87 |
#include "dsda/global.h" |
| 88 |
#include "dsda/mapinfo.h" |
| 89 |
#include "dsda/messenger.h" |
| 90 |
#include "dsda/settings.h" |
| 91 |
#include "dsda/key_frame.h" |
| 92 |
#include "dsda/input.h" |
| 93 |
#include "dsda/palette.h" |
| 94 |
#include "dsda/save.h" |
| 95 |
#include "dsda/skill_info.h" |
| 96 |
#include "dsda/skip.h" |
| 97 |
#include "dsda/time.h" |
| 98 |
#include "dsda/console.h" |
| 99 |
#include "dsda/stretch.h" |
| 100 |
#include "dsda/text_color.h" |
| 101 |
#include "dsda/utility.h" |
| 102 |
#include "dsda/wad_stats.h" |
| 103 |
|
| 104 |
#include "heretic/mn_menu.h" |
| 105 |
#include "heretic/sb_bar.h" |
| 106 |
#include "heretic/dstrings.h" |
| 107 |
|
| 108 |
/**************************** |
| 109 |
* |
| 110 |
* The following #defines are for the m_flags field of each item on every |
| 111 |
* Setup Screen. They can be OR'ed together where appropriate |
| 112 |
*/ |
| 113 |
|
| 114 |
#define S_HILITE 0x00000001 // Cursor is sitting on this item |
| 115 |
#define S_SELECT 0x00000002 // We're changing this item |
| 116 |
#define S_TITLE 0x00000004 // Title item |
| 117 |
#define S_YESNO 0x00000008 // Yes or No item |
| 118 |
#define S_CRITEM 0x00000010 // Message color |
| 119 |
#define S_COLOR 0x00000020 // Automap color |
| 120 |
#define S_LABEL 0x00000040 |
| 121 |
#define S_TC_SEL 0x00000080 |
| 122 |
#define S_PREV 0x00000100 // Previous menu exists |
| 123 |
#define S_NEXT 0x00000200 // Next menu exists |
| 124 |
#define S_INPUT 0x00000400 // Composite input binding |
| 125 |
#define S_WEAP 0x00000800 // Weapon # |
| 126 |
#define S_NUM 0x00001000 // Numerical item |
| 127 |
#define S_SKIP 0x00002000 // Cursor can't land here |
| 128 |
#define S_KEEP 0x00004000 // Don't swap key out |
| 129 |
#define S_END 0x00008000 // Last item in list (dummy) |
| 130 |
#define S_LEVWARN 0x00010000 // killough 8/30/98: Always warn about pending change |
| 131 |
#define S_NOSELECT 0x00020000 |
| 132 |
#define S_CENTER 0x00040000 |
| 133 |
#define S_FILE 0x00080000 // killough 10/98: Filenames |
| 134 |
#define S_LEFTJUST 0x00100000 // killough 10/98: items which are left-justified |
| 135 |
#define S_CREDIT 0x00200000 // killough 10/98: credit |
| 136 |
#define S_THERMO 0x00400000 // Slider for choosing a value |
| 137 |
#define S_CHOICE 0x00800000 // this item has several values |
| 138 |
// #define S_ 0x01000000 |
| 139 |
#define S_NAME 0x02000000 |
| 140 |
#define S_RESET_Y 0x04000000 |
| 141 |
// #define S_ 0x08000000 |
| 142 |
// #define S_ 0x10000000 |
| 143 |
// #define S_ 0x20000000 |
| 144 |
#define S_STR 0x40000000 // need to refactor things... |
| 145 |
#define S_NOCLEAR 0x80000000 |
| 146 |
|
| 147 |
/* S_SHOWDESC = the set of items whose description should be displayed |
| 148 |
* S_SHOWSET = the set of items whose setting should be displayed |
| 149 |
* S_STRING = the set of items whose settings are strings -- killough 10/98: |
| 150 |
* S_HASDEFPTR = the set of items whose var field points to default array |
| 151 |
*/ |
| 152 |
|
| 153 |
#define S_SHOWDESC (S_LABEL|S_TITLE|S_YESNO|S_CRITEM|S_COLOR|S_PREV|S_NEXT|S_INPUT|S_WEAP|S_NUM|S_FILE|S_CREDIT|S_CHOICE|S_THERMO|S_NAME) |
| 154 |
|
| 155 |
#define S_SHOWSET (S_YESNO|S_CRITEM|S_COLOR|S_INPUT|S_WEAP|S_NUM|S_FILE|S_CHOICE|S_THERMO|S_NAME) |
| 156 |
|
| 157 |
#define S_STRING (S_FILE|S_NAME) |
| 158 |
|
| 159 |
#define S_HASDEFPTR (S_STRING|S_YESNO|S_NUM|S_WEAP|S_COLOR|S_CRITEM|S_CHOICE) |
| 160 |
|
| 161 |
///////////////////////////// |
| 162 |
// |
| 163 |
// booleans for setup screens |
| 164 |
// these tell you what state the setup screens are in, and whether any of |
| 165 |
// the overlay screens (automap colors, reset button message) should be |
| 166 |
// displayed |
| 167 |
|
| 168 |
static dboolean setup_active = false; // in one of the setup screens |
| 169 |
static dboolean set_general_active = false; |
| 170 |
static dboolean set_keybnd_active = false; // in key binding setup screens |
| 171 |
static dboolean set_display_active = false; |
| 172 |
static dboolean set_demos_active = false; // in demos setup screen |
| 173 |
static dboolean set_compatibility_active = false; |
| 174 |
static dboolean set_weapon_active = false; // in weapons setup screen |
| 175 |
static dboolean set_auto_active = false; // in automap setup screen |
| 176 |
static dboolean level_table_active = false; |
| 177 |
static dboolean setup_select = false; // changing an item |
| 178 |
static dboolean setup_gather = false; // gathering keys for value |
| 179 |
static dboolean colorbox_active = false; // color palette being shown |
| 180 |
|
| 181 |
|
| 182 |
extern const char* g_menu_flat; |
| 183 |
extern int g_menu_save_page_size; |
| 184 |
extern int g_menu_font_spacing; |
| 185 |
|
| 186 |
#define QUICKSAVESLOT 0 |
| 187 |
|
| 188 |
static int messageToPrint; // 1 = message to be printed |
| 189 |
|
| 190 |
// CPhipps - static const |
| 191 |
static const char* messageString; // ...and here is the message string! |
| 192 |
|
| 193 |
static int messageLastMenuActive; |
| 194 |
|
| 195 |
static dboolean messageNeedsInput; // timed message = no input from user |
| 196 |
|
| 197 |
static void (*messageRoutine)(int response); |
| 198 |
|
| 199 |
static void M_DrawBackground(const char *flat, int scrn) |
| 200 |
{ |
| 201 |
if (dsda_IntConfig(dsda_config_menu_background) == 2) |
| 202 |
V_DrawBackground(flat, scrn); |
| 203 |
} |
| 204 |
|
| 205 |
// we are going to be entering a savegame string |
| 206 |
|
| 207 |
int saveStringEnter; |
| 208 |
int saveSlot; // which slot to save in |
| 209 |
int saveCharIndex; // which char we're editing |
| 210 |
// old save description before edit |
| 211 |
static char saveOldString[SAVESTRINGSIZE]; |
| 212 |
|
| 213 |
dboolean inhelpscreens; // indicates we are in or just left a help screen |
| 214 |
|
| 215 |
dboolean BorderNeedRefresh; |
| 216 |
|
| 217 |
menuactive_t menuactive; // The menus are up |
| 218 |
|
| 219 |
#define SKULLXOFF -32 |
| 220 |
#define LINEHEIGHT 16 |
| 221 |
|
| 222 |
char savegamestrings[10][SAVESTRINGSIZE]; |
| 223 |
|
| 224 |
short itemOn; // menu item skull is on (for Big Font menus) |
| 225 |
static short skullAnimCounter; // skull animation counter |
| 226 |
static short whichSkull; // which skull to draw (he blinks) |
| 227 |
|
| 228 |
// graphic name of skulls |
| 229 |
|
| 230 |
static const char skullName[2][/*8*/9] = {"M_SKULL1","M_SKULL2"}; |
| 231 |
|
| 232 |
menu_t* currentMenu; // current menudef |
| 233 |
|
| 234 |
extern menu_t InfoDef1; |
| 235 |
extern menu_t InfoDef4; |
| 236 |
extern menuitem_t InfoMenu4[]; |
| 237 |
|
| 238 |
static int current_page; |
| 239 |
static int previous_page; |
| 240 |
|
| 241 |
// |
| 242 |
// PROTOTYPES |
| 243 |
// |
| 244 |
void M_NewGame(int choice); |
| 245 |
void M_Episode(int choice); |
| 246 |
void M_ChooseSkill(int choice); |
| 247 |
void M_LoadGame(int choice); |
| 248 |
void M_SaveGame(int choice); |
| 249 |
void M_Options(int choice); |
| 250 |
void M_EndGame(int choice); |
| 251 |
void M_ReadThis(int choice); |
| 252 |
void M_ReadThis2(int choice); |
| 253 |
void M_QuitDOOM(int choice); |
| 254 |
|
| 255 |
static void M_SfxVol(int choice); |
| 256 |
static void M_MusicVol(int choice); |
| 257 |
static void M_SizeDisplay(int choice); |
| 258 |
static void M_Sound(int choice); |
| 259 |
|
| 260 |
static void M_FinishReadThis(int choice); |
| 261 |
static void M_FinishHelp(int choice); // killough 10/98 |
| 262 |
static void M_LoadSelect(int choice); |
| 263 |
static void M_SaveSelect(int choice); |
| 264 |
static void M_ReadSaveStrings(void); |
| 265 |
static void M_QuickSave(void); |
| 266 |
static void M_QuickLoad(void); |
| 267 |
|
| 268 |
static void M_DrawMainMenu(void); |
| 269 |
static void M_DrawReadThis1(void); |
| 270 |
static void M_DrawReadThis2(void); |
| 271 |
static void M_DrawSkillMenu(void); |
| 272 |
static void M_DrawEpisode(void); |
| 273 |
static void M_DrawOptions(void); |
| 274 |
static void M_DrawSound(void); |
| 275 |
static void M_DrawLoad(void); |
| 276 |
static void M_DrawSave(void); |
| 277 |
static void M_DrawHelp (void); // phares 5/04/98 |
| 278 |
static void M_DrawAd(void); |
| 279 |
|
| 280 |
static void M_DrawSaveLoadBorder(int x,int y); |
| 281 |
static void M_DrawThermo(int x,int y,int thermWidth,int thermRange,int thermDot); |
| 282 |
static void M_DrawEmptyCell(menu_t *menu,int item); |
| 283 |
static void M_DrawSelCell(menu_t *menu,int item); |
| 284 |
static void M_WriteText(int x, int y, const char *string, int cm); |
| 285 |
static int M_StringWidth(const char *string); |
| 286 |
static int M_StringHeight(const char *string); |
| 287 |
static void M_DrawTitle(int y, const char *text, int cm); |
| 288 |
static void M_StartMessage(const char *string,void *routine,dboolean input); |
| 289 |
static void M_StopMessage(void); |
| 290 |
|
| 291 |
void M_ChangeMenu(menu_t *menu, menuactive_t mnact); |
| 292 |
void M_ClearMenus (void); |
| 293 |
|
| 294 |
// phares 3/30/98 |
| 295 |
// prototypes added to support Setup Menus and Extended HELP screens |
| 296 |
|
| 297 |
static void M_General(int); // killough 10/98 |
| 298 |
static void M_KeyBindings(int choice); |
| 299 |
static void M_Display(int); |
| 300 |
static void M_Demos(int); |
| 301 |
static void M_Compatibility(int); |
| 302 |
static void M_Weapons(int); |
| 303 |
static void M_Automap(int); |
| 304 |
static void M_LevelTable(int); |
| 305 |
static void M_DrawGeneral(void); // killough 10/98 |
| 306 |
static void M_DrawKeybnd(void); |
| 307 |
static void M_DrawDisplay(void); |
| 308 |
static void M_DrawDemos(void); |
| 309 |
static void M_DrawCompatibility(void); |
| 310 |
static void M_DrawWeapons(void); |
| 311 |
static void M_DrawAutoMap(void); |
| 312 |
static void M_DrawLevelTable(void); |
| 313 |
static void M_DrawExtHelp(void); |
| 314 |
|
| 315 |
static int M_GetPixelWidth(const char*); |
| 316 |
static void M_DrawString(int cx, int cy, int color, const char* ch); |
| 317 |
static void M_DrawMenuString(int,int,int); |
| 318 |
static void M_DrawStringCentered(int,int,int,const char*); |
| 319 |
|
| 320 |
static void M_InitExtendedHelp(void); |
| 321 |
static void M_ExtHelpNextScreen(int); |
| 322 |
static void M_ExtHelp(int); |
| 323 |
static int M_GetKeyString(int,int); |
| 324 |
|
| 325 |
void M_ChangeDemoSmoothTurns(void); |
| 326 |
void M_ChangeFullScreen(void); |
| 327 |
void M_ChangeVideoMode(void); |
| 328 |
void M_ChangeUseGLSurface(void); |
| 329 |
void M_ChangeApplyPalette(void); |
| 330 |
|
| 331 |
menu_t SkillDef; // phares 5/04/98 |
| 332 |
|
| 333 |
// end of prototypes added to support Setup Menus and Extended HELP screens |
| 334 |
|
| 335 |
static const char shiftxform[] = |
| 336 |
{ |
| 337 |
0, |
| 338 |
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| 339 |
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
| 340 |
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, |
| 341 |
31, |
| 342 |
' ', '!', '"', '#', '$', '%', '&', |
| 343 |
'"', // shift-' |
| 344 |
'(', ')', '*', '+', |
| 345 |
'<', // shift-, |
| 346 |
'_', // shift-- |
| 347 |
'>', // shift-. |
| 348 |
'?', // shift-/ |
| 349 |
')', // shift-0 |
| 350 |
'!', // shift-1 |
| 351 |
'@', // shift-2 |
| 352 |
'#', // shift-3 |
| 353 |
'$', // shift-4 |
| 354 |
'%', // shift-5 |
| 355 |
'^', // shift-6 |
| 356 |
'&', // shift-7 |
| 357 |
'*', // shift-8 |
| 358 |
'(', // shift-9 |
| 359 |
';', |
| 360 |
':', // shift-; |
| 361 |
'<', |
| 362 |
'+', // shift-= |
| 363 |
'>', '?', '@', |
| 364 |
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', |
| 365 |
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
| 366 |
'{', // shift-[ |
| 367 |
'|', // shift-backslash |
| 368 |
'}', // shift-] |
| 369 |
'"', '_', |
| 370 |
'~', // shift-` |
| 371 |
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', |
| 372 |
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
| 373 |
'{', '|', '}', '~', 127 |
| 374 |
}; |
| 375 |
|
| 376 |
static int cr_title; |
| 377 |
static int cr_tab; |
| 378 |
static int cr_tab_highlight; |
| 379 |
static int cr_label; |
| 380 |
static int cr_label_highlight; |
| 381 |
static int cr_label_edit; |
| 382 |
static int cr_value; |
| 383 |
static int cr_value_highlight; |
| 384 |
static int cr_value_edit; |
| 385 |
static int cr_info_highlight; |
| 386 |
static int cr_info_edit; |
| 387 |
static int cr_warning; |
| 388 |
static int cr_scrollbar; |
| 389 |
|
| 390 |
static void M_LoadTextColors(void) |
| 391 |
{ |
| 392 |
cr_title = dsda_TextCR(dsda_tc_menu_title); |
| 393 |
cr_tab = dsda_TextCR(dsda_tc_menu_tab); |
| 394 |
cr_tab_highlight = dsda_TextCR(dsda_tc_menu_tab_highlight); |
| 395 |
cr_label = dsda_TextCR(dsda_tc_menu_label); |
| 396 |
cr_label_highlight = dsda_TextCR(dsda_tc_menu_label_highlight); |
| 397 |
cr_label_edit = dsda_TextCR(dsda_tc_menu_label_edit); |
| 398 |
cr_value = dsda_TextCR(dsda_tc_menu_value); |
| 399 |
cr_value_highlight = dsda_TextCR(dsda_tc_menu_value_highlight); |
| 400 |
cr_value_edit = dsda_TextCR(dsda_tc_menu_value_edit); |
| 401 |
cr_info_highlight = dsda_TextCR(dsda_tc_menu_info_highlight); |
| 402 |
cr_info_edit = dsda_TextCR(dsda_tc_menu_info_edit); |
| 403 |
cr_warning = dsda_TextCR(dsda_tc_menu_warning); |
| 404 |
cr_scrollbar = dsda_TextCR(dsda_tc_menu_scrollbar); |
| 405 |
} |
| 406 |
|
| 407 |
static const dsda_font_t *menu_font; |
| 408 |
|
| 409 |
static void M_LoadMenuFont(void) |
| 410 |
{ |
| 411 |
menu_font = &hud_font; |
| 412 |
} |
| 413 |
|
| 414 |
///////////////////////////////////////////////////////////////////////////// |
| 415 |
// |
| 416 |
// DOOM MENUS |
| 417 |
// |
| 418 |
|
| 419 |
///////////////////////////// |
| 420 |
// |
| 421 |
// The menu_buffer is used to construct strings for display on the screen. |
| 422 |
|
| 423 |
#define MENU_BUFFER_SIZE 128 |
| 424 |
|
| 425 |
static char menu_buffer[MENU_BUFFER_SIZE]; |
| 426 |
|
| 427 |
///////////////////////////// |
| 428 |
// |
| 429 |
// MAIN MENU |
| 430 |
// |
| 431 |
|
| 432 |
// main_e provides numerical values for which Big Font screen you're on |
| 433 |
|
| 434 |
enum |
| 435 |
{ |
| 436 |
newgame = 0, |
| 437 |
loadgame, |
| 438 |
savegame, |
| 439 |
options, |
| 440 |
readthis, |
| 441 |
quitdoom, |
| 442 |
main_end |
| 443 |
} main_e; |
| 444 |
|
| 445 |
// |
| 446 |
// MainMenu is the definition of what the main menu Screen should look |
| 447 |
// like. Each entry shows that the cursor can land on each item (1), the |
| 448 |
// built-in graphic lump (i.e. "M_NGAME") that should be displayed, |
| 449 |
// the program which takes over when an item is selected, and the hotkey |
| 450 |
// associated with the item. |
| 451 |
// |
| 452 |
|
| 453 |
static menuitem_t MainMenu[]= |
| 454 |
{ |
| 455 |
{1,"M_NGAME", M_NewGame, 'n', "NEW GAME"}, |
| 456 |
{1,"M_OPTION",M_Options, 'o', "OPTIONS"}, |
| 457 |
{1,"M_LOADG", M_LoadGame,'l', "LOAD GAME"}, |
| 458 |
{1,"M_SAVEG", M_SaveGame,'s', "SAVE GAME"}, |
| 459 |
{1,"M_RDTHIS",M_ReadThis,'r', "READ THIS"}, |
| 460 |
{1,"M_QUITG", M_QuitDOOM,'q', "QUIT GAME"} |
| 461 |
}; |
| 462 |
|
| 463 |
menu_t MainDef = |
| 464 |
{ |
| 465 |
main_end, // number of menu items |
| 466 |
NULL, // previous menu screen |
| 467 |
MainMenu, // table that defines menu items |
| 468 |
M_DrawMainMenu, // drawing routine |
| 469 |
97,64, // initial cursor position |
| 470 |
0 // last menu item the user was on |
| 471 |
}; |
| 472 |
|
| 473 |
// |
| 474 |
// M_DrawMainMenu |
| 475 |
// |
| 476 |
|
| 477 |
static void M_DrawMainMenu(void) |
| 478 |
{ |
| 479 |
if (raven) return MN_DrawMainMenu(); |
| 480 |
|
| 481 |
// CPhipps - patch drawing updated |
| 482 |
V_DrawNamePatch(94, 2, 0, "M_DOOM", CR_DEFAULT, VPT_STRETCH); |
| 483 |
} |
| 484 |
|
| 485 |
///////////////////////////// |
| 486 |
// |
| 487 |
// Read This! MENU 1 & 2 |
| 488 |
// |
| 489 |
|
| 490 |
// There are no menu items on the Read This! screens, so read_e just |
| 491 |
// provides a placeholder to maintain structure. |
| 492 |
|
| 493 |
enum |
| 494 |
{ |
| 495 |
rdthsempty1, |
| 496 |
read1_end |
| 497 |
} read_e; |
| 498 |
|
| 499 |
enum |
| 500 |
{ |
| 501 |
rdthsempty2, |
| 502 |
read2_end |
| 503 |
} read_e2; |
| 504 |
|
| 505 |
enum // killough 10/98 |
| 506 |
{ |
| 507 |
helpempty, |
| 508 |
help_end |
| 509 |
} help_e; |
| 510 |
|
| 511 |
|
| 512 |
// The definitions of the Read This! screens |
| 513 |
|
| 514 |
static menuitem_t ReadMenu1[] = |
| 515 |
{ |
| 516 |
{1,"",M_ReadThis2,0} |
| 517 |
}; |
| 518 |
|
| 519 |
static menuitem_t ReadMenu2[]= |
| 520 |
{ |
| 521 |
{1,"",M_FinishReadThis,0} |
| 522 |
}; |
| 523 |
|
| 524 |
static menuitem_t HelpMenu[]= // killough 10/98 |
| 525 |
{ |
| 526 |
{1,"",M_FinishHelp,0} |
| 527 |
}; |
| 528 |
|
| 529 |
static menu_t ReadDef1 = |
| 530 |
{ |
| 531 |
read1_end, |
| 532 |
&MainDef, |
| 533 |
ReadMenu1, |
| 534 |
M_DrawReadThis1, |
| 535 |
330,175, |
| 536 |
//280,185, // killough 2/21/98: fix help screens |
| 537 |
0 |
| 538 |
}; |
| 539 |
|
| 540 |
static menu_t ReadDef2 = |
| 541 |
{ |
| 542 |
read2_end, |
| 543 |
&ReadDef1, |
| 544 |
ReadMenu2, |
| 545 |
M_DrawReadThis2, |
| 546 |
330,175, |
| 547 |
0 |
| 548 |
}; |
| 549 |
|
| 550 |
static menu_t HelpDef = // killough 10/98 |
| 551 |
{ |
| 552 |
help_end, |
| 553 |
&HelpDef, |
| 554 |
HelpMenu, |
| 555 |
M_DrawHelp, |
| 556 |
330,175, |
| 557 |
0 |
| 558 |
}; |
| 559 |
|
| 560 |
// |
| 561 |
// M_ReadThis |
| 562 |
// |
| 563 |
|
| 564 |
void M_ReadThis(int choice) |
| 565 |
{ |
| 566 |
M_SetupNextMenu(&ReadDef1); |
| 567 |
} |
| 568 |
|
| 569 |
void M_ReadThis2(int choice) |
| 570 |
{ |
| 571 |
M_SetupNextMenu(&ReadDef2); |
| 572 |
} |
| 573 |
|
| 574 |
static void M_FinishReadThis(int choice) |
| 575 |
{ |
| 576 |
M_SetupNextMenu(&MainDef); |
| 577 |
} |
| 578 |
|
| 579 |
static void M_FinishHelp(int choice) // killough 10/98 |
| 580 |
{ |
| 581 |
M_SetupNextMenu(&MainDef); |
| 582 |
} |
| 583 |
|
| 584 |
// |
| 585 |
// Read This Menus |
| 586 |
// Had a "quick hack to fix romero bug" |
| 587 |
// |
| 588 |
// killough 10/98: updated with new screens |
| 589 |
|
| 590 |
static void M_DrawReadThis1(void) |
| 591 |
{ |
| 592 |
inhelpscreens = true; |
| 593 |
|
| 594 |
if (pwad_help2_check || gamemode == shareware) |
| 595 |
M_DrawAd(); |
| 596 |
else |
| 597 |
M_DrawCredits(); |
| 598 |
} |
| 599 |
|
| 600 |
// |
| 601 |
// Read This Menus - optional second page. |
| 602 |
// |
| 603 |
// killough 10/98: updated with new screens |
| 604 |
|
| 605 |
static void M_DrawReadThis2(void) |
| 606 |
{ |
| 607 |
const char* helplump = (gamemode == commercial) ? "HELP" : "HELP1"; |
| 608 |
int pwadmaps = W_PWADMapExists(); // show help screen for IWAD |
| 609 |
|
| 610 |
inhelpscreens = true; |
| 611 |
|
| 612 |
if (W_PWADLumpNameExists(helplump) || !pwadmaps) |
| 613 |
M_DrawHelp(); |
| 614 |
else if (W_PWADLumpNameExists("CREDIT")) |
| 615 |
M_DrawCredits(); |
| 616 |
else |
| 617 |
M_DrawCreditsDynamic(); |
| 618 |
} |
| 619 |
|
| 620 |
///////////////////////////// |
| 621 |
// |
| 622 |
// EPISODE SELECT |
| 623 |
// |
| 624 |
|
| 625 |
// The definitions of the Episodes menu |
| 626 |
|
| 627 |
menu_t EpiDef = |
| 628 |
{ |
| 629 |
.prevMenu = &MainDef, |
| 630 |
.routine = M_DrawEpisode, |
| 631 |
.x = 48, |
| 632 |
.y = 63, |
| 633 |
}; |
| 634 |
|
| 635 |
// |
| 636 |
// M_Episode |
| 637 |
// |
| 638 |
|
| 639 |
static int chosen_episode; |
| 640 |
|
| 641 |
static void M_DrawEpisode(void) |
| 642 |
{ |
| 643 |
if (raven) return MN_DrawEpisode(); |
| 644 |
|
| 645 |
// CPhipps - patch drawing updated |
| 646 |
V_DrawNamePatch(54, EpiDef.y - 25, 0, "M_EPISOD", CR_DEFAULT, VPT_STRETCH); |
| 647 |
} |
| 648 |
|
| 649 |
void M_Episode(int choice) |
| 650 |
{ |
| 651 |
if (gamemode == shareware && choice && !episodes[choice].vanilla) { |
| 652 |
M_StartMessage(s_SWSTRING, NULL, false); // Ty 03/27/98 - externalized |
| 653 |
M_SetupNextMenu(&ReadDef1); |
| 654 |
return; |
| 655 |
} |
| 656 |
|
| 657 |
// Heretic shareware is different than Doom shareware in that it shows |
| 658 |
// the episode select, but will display a message when selecting |
| 659 |
// other episodes. This code shows that message and avoids a crash. |
| 660 |
// |
| 661 |
if (heretic && gamemode == shareware && choice && episodes[choice].vanilla) { |
| 662 |
M_StartMessage(HERETIC_SWSTRING, NULL, false); // externalized |
| 663 |
M_SetupNextMenu(&InfoDef1); |
| 664 |
return; |
| 665 |
} |
| 666 |
|
| 667 |
chosen_episode = choice; |
| 668 |
|
| 669 |
if (hexen) // hack hexen class as "episode menu" |
| 670 |
MN_UpdateClass(chosen_episode); |
| 671 |
|
| 672 |
M_SetupNextMenu(&SkillDef); |
| 673 |
} |
| 674 |
|
| 675 |
///////////////////////////// |
| 676 |
// |
| 677 |
// SKILL SELECT |
| 678 |
// |
| 679 |
|
| 680 |
// The definitions of the Skill Select menu |
| 681 |
|
| 682 |
menu_t SkillDef = |
| 683 |
{ |
| 684 |
.prevMenu = &EpiDef, |
| 685 |
.routine = M_DrawSkillMenu, |
| 686 |
.x = 48, |
| 687 |
.y = 63, |
| 688 |
}; |
| 689 |
|
| 690 |
// |
| 691 |
// M_NewGame |
| 692 |
// |
| 693 |
|
| 694 |
static void M_DrawSkillMenu(void) |
| 695 |
{ |
| 696 |
if (raven) return MN_DrawSkillMenu(); |
| 697 |
|
| 698 |
// CPhipps - patch drawing updated |
| 699 |
V_DrawNamePatch(96, 14, 0, "M_NEWG", CR_DEFAULT, VPT_STRETCH); |
| 700 |
V_DrawNamePatch(54, 38, 0, "M_SKILL",CR_DEFAULT, VPT_STRETCH); |
| 701 |
} |
| 702 |
|
| 703 |
void M_NewGame(int choice) |
| 704 |
{ |
| 705 |
if (demorecording) { /* killough 5/26/98: exclude during demo recordings */ |
| 706 |
M_StartMessage("you can't start a new game\n" |
| 707 |
"while recording a demo!\n\n"PRESSKEY, |
| 708 |
NULL, false); // killough 5/26/98: not externalized |
| 709 |
return; |
| 710 |
} |
| 711 |
|
| 712 |
// Chex Quest disabled the episode select screen, as did Doom II. |
| 713 |
if (num_episodes <= 1 && !hexen) |
| 714 |
M_SetupNextMenu(&SkillDef); |
| 715 |
else |
| 716 |
M_SetupNextMenu(&EpiDef); |
| 717 |
} |
| 718 |
|
| 719 |
static int chosen_skill; |
| 720 |
|
| 721 |
static void M_FinishGameSelection(void) |
| 722 |
{ |
| 723 |
int episode, map; |
| 724 |
|
| 725 |
if (num_episodes) |
| 726 |
{ |
| 727 |
episode = episodes[chosen_episode].start_episode; |
| 728 |
map = episodes[chosen_episode].start_map; |
| 729 |
} |
| 730 |
else |
| 731 |
{ |
| 732 |
episode = 1; |
| 733 |
map = 1; |
| 734 |
} |
| 735 |
|
| 736 |
G_DeferedInitNew(chosen_skill, episode, map); |
| 737 |
|
| 738 |
if (hexen) |
| 739 |
SB_SetClassData(); |
| 740 |
|
| 741 |
M_ClearMenus(); |
| 742 |
} |
| 743 |
|
| 744 |
// CPhipps - static |
| 745 |
static void M_VerifySkill(dboolean affirmative) |
| 746 |
{ |
| 747 |
if (!affirmative) |
| 748 |
return; |
| 749 |
|
| 750 |
M_FinishGameSelection(); |
| 751 |
} |
| 752 |
|
| 753 |
void M_ChooseSkill(int choice) |
| 754 |
{ |
| 755 |
extern skill_info_t *skill_infos; |
| 756 |
|
| 757 |
chosen_skill = choice; |
| 758 |
|
| 759 |
if (choice < num_skills && skill_infos[choice].flags & SI_MUST_CONFIRM) |
| 760 |
{ |
| 761 |
const char* message; |
| 762 |
|
| 763 |
if (skill_infos[choice].must_confirm) |
| 764 |
message = skill_infos[choice].must_confirm; |
| 765 |
else |
| 766 |
message = s_NIGHTMARE; // Ty 03/27/98 - externalized |
| 767 |
|
| 768 |
M_StartMessage(message, M_VerifySkill, true); |
| 769 |
|
| 770 |
return; |
| 771 |
} |
| 772 |
|
| 773 |
M_FinishGameSelection(); |
| 774 |
} |
| 775 |
|
| 776 |
///////////////////////////// |
| 777 |
// |
| 778 |
// LOAD GAME MENU |
| 779 |
// |
| 780 |
|
| 781 |
// numerical values for the Load Game slots |
| 782 |
|
| 783 |
enum |
| 784 |
{ |
| 785 |
load1, |
| 786 |
load2, |
| 787 |
load3, |
| 788 |
load4, |
| 789 |
load5, |
| 790 |
load6, |
| 791 |
load7, |
| 792 |
load_end |
| 793 |
} load_e; |
| 794 |
|
| 795 |
static int current_save_page = 1; // 0 is the quicksaves page |
| 796 |
static int current_save_item = 0; |
| 797 |
|
| 798 |
const int save_page_limit = 17; |
| 799 |
const char *saves_pages[] = |
| 800 |
{ |
| 801 |
"Q", "1", "2", "3", |
| 802 |
"4", "5", "6", "7", |
| 803 |
"8", "9", "10", "11", |
| 804 |
"12", "13", "14", "15", |
| 805 |
"16", NULL |
| 806 |
}; |
| 807 |
|
| 808 |
// The definitions of the Load Game screen |
| 809 |
|
| 810 |
menuitem_t LoadMenue[]= |
| 811 |
{ |
| 812 |
{1,"", M_LoadSelect,'1'}, |
| 813 |
{1,"", M_LoadSelect,'2'}, |
| 814 |
{1,"", M_LoadSelect,'3'}, |
| 815 |
{1,"", M_LoadSelect,'4'}, |
| 816 |
{1,"", M_LoadSelect,'5'}, |
| 817 |
{1,"", M_LoadSelect,'6'}, |
| 818 |
{1,"", M_LoadSelect,'7'}, //jff 3/15/98 extend number of slots |
| 819 |
{1,"", M_LoadSelect,'8'}, |
| 820 |
}; |
| 821 |
|
| 822 |
menu_t LoadDef = |
| 823 |
{ |
| 824 |
load_end, |
| 825 |
&MainDef, |
| 826 |
LoadMenue, |
| 827 |
M_DrawLoad, |
| 828 |
80,34, //jff 3/15/98 move menu up |
| 829 |
0 |
| 830 |
}; |
| 831 |
|
| 832 |
#define LOADGRAPHIC_Y 8 |
| 833 |
|
| 834 |
// [FG] delete a savegame |
| 835 |
|
| 836 |
dboolean delete_verify = false; |
| 837 |
|
| 838 |
static void M_DeleteSaveGame(int slot) |
| 839 |
{ |
| 840 |
char *name; |
| 841 |
|
| 842 |
if (dsda_LastSaveSlot() == slot) |
| 843 |
dsda_ResetLastSaveSlot(); |
| 844 |
|
| 845 |
name = dsda_SaveGameName(slot, false); |
| 846 |
remove(name); |
| 847 |
Z_Free(name); |
| 848 |
|
| 849 |
M_ReadSaveStrings(); |
| 850 |
} |
| 851 |
|
| 852 |
// |
| 853 |
// M_LoadGame & Cie. |
| 854 |
// |
| 855 |
|
| 856 |
static void M_DrawLoad(void) |
| 857 |
{ |
| 858 |
int i; |
| 859 |
current_save_page = current_page; |
| 860 |
current_save_item = itemOn; |
| 861 |
|
| 862 |
if (raven) return MN_DrawLoad(); |
| 863 |
|
| 864 |
//jff 3/15/98 use symbolic load position |
| 865 |
// CPhipps - patch drawing updated |
| 866 |
V_DrawNamePatch(72 ,LOADGRAPHIC_Y, 0, "M_LOADG", CR_DEFAULT, VPT_STRETCH); |
| 867 |
for (i = 0 ; i < load_end ; i++) { |
| 868 |
M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i); |
| 869 |
M_WriteText(LoadDef.x,LoadDef.y+LINEHEIGHT*i,savegamestrings[i], CR_DEFAULT); |
| 870 |
} |
| 871 |
|
| 872 |
M_DrawTabs(saves_pages, 5, 145); |
| 873 |
|
| 874 |
if (delete_verify) |
| 875 |
M_DrawDelVerify(); |
| 876 |
} |
| 877 |
|
| 878 |
// |
| 879 |
// Draw border for the savegame description |
| 880 |
// |
| 881 |
|
| 882 |
static void M_DrawSaveLoadBorder(int x,int y) |
| 883 |
{ |
| 884 |
int i; |
| 885 |
|
| 886 |
V_DrawNamePatch(x-8, y+7, 0, "M_LSLEFT", CR_DEFAULT, VPT_STRETCH); |
| 887 |
|
| 888 |
for (i = 0 ; i < 24 ; i++) |
| 889 |
{ |
| 890 |
V_DrawNamePatch(x, y+7, 0, "M_LSCNTR", CR_DEFAULT, VPT_STRETCH); |
| 891 |
x += 8; |
| 892 |
} |
| 893 |
|
| 894 |
V_DrawNamePatch(x, y+7, 0, "M_LSRGHT", CR_DEFAULT, VPT_STRETCH); |
| 895 |
} |
| 896 |
|
| 897 |
// |
| 898 |
// User wants to load this game |
| 899 |
// |
| 900 |
|
| 901 |
void M_LoadSelect(int choice) |
| 902 |
{ |
| 903 |
if (!dsda_AllowMenuLoad(choice + current_page * g_menu_save_page_size)) |
| 904 |
{ |
| 905 |
M_StartMessage( |
| 906 |
"you can't load this game\n" |
| 907 |
"under these conditions!\n\n"PRESSKEY, |
| 908 |
NULL, false); // killough 5/26/98: not externalized |
| 909 |
return; |
| 910 |
} |
| 911 |
|
| 912 |
// CPhipps - Modified so savegame filename is worked out only internal |
| 913 |
// to g_game.c, this only passes the slot. |
| 914 |
|
| 915 |
// killough 3/16/98, 5/15/98: add slot, cmd |
| 916 |
G_LoadGame(choice + current_page * g_menu_save_page_size); |
| 917 |
M_ClearMenus(); |
| 918 |
} |
| 919 |
|
| 920 |
// |
| 921 |
// killough 5/15/98: add forced loadgames |
| 922 |
// |
| 923 |
|
| 924 |
static char *forced_loadgame_message; |
| 925 |
|
| 926 |
static void M_VerifyForcedLoadGame(int ch) |
| 927 |
{ |
| 928 |
if (ch=='y') |
| 929 |
G_ForcedLoadGame(); |
| 930 |
Z_Free(forced_loadgame_message); // free the message Z_Strdup()'ed below |
| 931 |
M_ClearMenus(); |
| 932 |
} |
| 933 |
|
| 934 |
void M_ForcedLoadGame(const char *msg) |
| 935 |
{ |
| 936 |
forced_loadgame_message = Z_Strdup(msg); // Z_Free()'d above |
| 937 |
M_StartMessage(forced_loadgame_message, M_VerifyForcedLoadGame, true); |
| 938 |
} |
| 939 |
|
| 940 |
// |
| 941 |
// Selected from DOOM menu |
| 942 |
// |
| 943 |
|
| 944 |
void M_LoadGame (int choice) |
| 945 |
{ |
| 946 |
delete_verify = false; |
| 947 |
|
| 948 |
if (!dsda_AllowAnyMenuLoad()) |
| 949 |
{ |
| 950 |
M_StartMessage( |
| 951 |
"you can't load a game\n" |
| 952 |
"under these conditions!\n\n"PRESSKEY, |
| 953 |
NULL, false); // killough 5/26/98: not externalized |
| 954 |
return; |
| 955 |
} |
| 956 |
|
| 957 |
M_SetupNextMenu(&LoadDef); |
| 958 |
current_page = current_save_page; |
| 959 |
itemOn = current_save_item; |
| 960 |
M_ReadSaveStrings(); |
| 961 |
} |
| 962 |
|
| 963 |
///////////////////////////// |
| 964 |
// |
| 965 |
// SAVE GAME MENU |
| 966 |
// |
| 967 |
|
| 968 |
// The definitions of the Save Game screen |
| 969 |
|
| 970 |
static menuitem_t SaveMenu[]= |
| 971 |
{ |
| 972 |
{1,"", M_SaveSelect,'1'}, |
| 973 |
{1,"", M_SaveSelect,'2'}, |
| 974 |
{1,"", M_SaveSelect,'3'}, |
| 975 |
{1,"", M_SaveSelect,'4'}, |
| 976 |
{1,"", M_SaveSelect,'5'}, |
| 977 |
{1,"", M_SaveSelect,'6'}, |
| 978 |
{1,"", M_SaveSelect,'7'}, //jff 3/15/98 extend number of slots |
| 979 |
{1,"", M_SaveSelect,'8'}, |
| 980 |
}; |
| 981 |
|
| 982 |
menu_t SaveDef = |
| 983 |
{ |
| 984 |
load_end, // same number of slots as the Load Game screen |
| 985 |
&MainDef, |
| 986 |
SaveMenu, |
| 987 |
M_DrawSave, |
| 988 |
80,34, //jff 3/15/98 move menu up |
| 989 |
0 |
| 990 |
}; |
| 991 |
|
| 992 |
// |
| 993 |
// M_ReadSaveStrings |
| 994 |
// read the strings from the savegame files |
| 995 |
// |
| 996 |
static void M_ReadSaveStrings(void) |
| 997 |
{ |
| 998 |
int i; |
| 999 |
|
| 1000 |
for (i = 0 ; i < load_end ; i++) { |
| 1001 |
char *name; // killough 3/22/98 |
| 1002 |
FILE *fp; // killough 11/98: change to use stdio |
| 1003 |
|
| 1004 |
// killough 3/22/98 |
| 1005 |
name = dsda_SaveGameName(i + current_page * g_menu_save_page_size, false); |
| 1006 |
|
| 1007 |
fp = M_OpenFile(name,"rb"); |
| 1008 |
Z_Free(name); |
| 1009 |
|
| 1010 |
if (!fp || !fread(&savegamestrings[i], SAVESTRINGSIZE, 1, fp)) |
| 1011 |
{ |
| 1012 |
strcpy(&savegamestrings[i][0],s_EMPTYSTRING); // Ty 03/27/98 - externalized |
| 1013 |
LoadMenue[i].status = 0; |
| 1014 |
} |
| 1015 |
else |
| 1016 |
{ |
| 1017 |
LoadMenue[i].status = 1; |
| 1018 |
} |
| 1019 |
|
| 1020 |
if (fp) |
| 1021 |
{ |
| 1022 |
fclose(fp); |
| 1023 |
} |
| 1024 |
} |
| 1025 |
} |
| 1026 |
|
| 1027 |
#define SLOT_SCAN_MAX 112 |
| 1028 |
|
| 1029 |
static int M_AutoSaveSlot(const char *target_name) |
| 1030 |
{ |
| 1031 |
char name_in_file[SAVESTRINGSIZE]; |
| 1032 |
char slots[SLOT_SCAN_MAX] = { 0 }; |
| 1033 |
int return_slot = -1; |
| 1034 |
glob_t *glob; |
| 1035 |
FILE *fp; |
| 1036 |
const char *file_name; |
| 1037 |
int i; |
| 1038 |
|
| 1039 |
// First page is reserved to quicksaves |
| 1040 |
for (i = 0; i < g_menu_save_page_size; i++) |
| 1041 |
slots[i] = 1; |
| 1042 |
|
| 1043 |
glob = I_StartGlob(dsda_SaveDir(), "*savegame*.dsg", 0); |
| 1044 |
while (return_slot < 0) |
| 1045 |
{ |
| 1046 |
file_name = I_NextGlob(glob); |
| 1047 |
if (!file_name) |
| 1048 |
break; |
| 1049 |
|
| 1050 |
fp = M_OpenFile(file_name, "rb"); |
| 1051 |
if (fp) |
| 1052 |
{ |
| 1053 |
int slot; |
| 1054 |
|
| 1055 |
if (sscanf(dsda_BaseName(file_name), "%*[^0-9]%d.dsg", &slot)) |
| 1056 |
{ |
| 1057 |
if (slot < SLOT_SCAN_MAX) |
| 1058 |
slots[slot] = 1; |
| 1059 |
|
| 1060 |
if (fread(name_in_file, SAVESTRINGSIZE, 1, fp) && !strcmp(name_in_file, target_name)) |
| 1061 |
{ |
| 1062 |
return_slot = slot; |
| 1063 |
slots[slot] = 0; |
| 1064 |
} |
| 1065 |
} |
| 1066 |
|
| 1067 |
fclose(fp); |
| 1068 |
} |
| 1069 |
} |
| 1070 |
|
| 1071 |
I_EndGlob(glob); |
| 1072 |
|
| 1073 |
if (return_slot < 0) |
| 1074 |
return_slot = strnlen(slots, SLOT_SCAN_MAX); |
| 1075 |
|
| 1076 |
if (slots[return_slot] == 1) |
| 1077 |
return_slot = -1; |
| 1078 |
|
| 1079 |
return return_slot; |
| 1080 |
} |
| 1081 |
|
| 1082 |
void M_AutoSave(void) |
| 1083 |
{ |
| 1084 |
int slot; |
| 1085 |
char target_name[SAVESTRINGSIZE]; |
| 1086 |
|
| 1087 |
snprintf(target_name, SAVESTRINGSIZE, "auto-%s", dsda_MapLumpName(gameepisode, gamemap)); |
| 1088 |
|
| 1089 |
slot = M_AutoSaveSlot(target_name); |
| 1090 |
G_SaveGame(slot, target_name); |
| 1091 |
doom_printf("autosave"); |
| 1092 |
} |
| 1093 |
|
| 1094 |
// |
| 1095 |
// M_SaveGame & Cie. |
| 1096 |
// |
| 1097 |
static void M_DrawSave(void) |
| 1098 |
{ |
| 1099 |
int i; |
| 1100 |
current_save_page = current_page; |
| 1101 |
current_save_item = itemOn; |
| 1102 |
|
| 1103 |
if (raven) return MN_DrawSave(); |
| 1104 |
|
| 1105 |
//jff 3/15/98 use symbolic load position |
| 1106 |
// CPhipps - patch drawing updated |
| 1107 |
V_DrawNamePatch(72, LOADGRAPHIC_Y, 0, "M_SAVEG", CR_DEFAULT, VPT_STRETCH); |
| 1108 |
for (i = 0 ; i < load_end ; i++) |
| 1109 |
{ |
| 1110 |
M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i); |
| 1111 |
M_WriteText(LoadDef.x,LoadDef.y+LINEHEIGHT*i,savegamestrings[i], current_page == 0 ? CR_DARKEN : CR_DEFAULT); |
| 1112 |
} |
| 1113 |
|
| 1114 |
M_DrawTabs(saves_pages, 5, 145); |
| 1115 |
|
| 1116 |
if (saveStringEnter) |
| 1117 |
{ |
| 1118 |
i = M_StringWidth(savegamestrings[saveSlot]); |
| 1119 |
M_WriteText(LoadDef.x + i,LoadDef.y+LINEHEIGHT*saveSlot,"_", CR_DEFAULT); |
| 1120 |
} |
| 1121 |
|
| 1122 |
if (delete_verify) |
| 1123 |
M_DrawDelVerify(); |
| 1124 |
} |
| 1125 |
|
| 1126 |
// |
| 1127 |
// M_Responder calls this when user is finished |
| 1128 |
// |
| 1129 |
static void M_DoSave(int choice) |
| 1130 |
{ |
| 1131 |
G_SaveGame(choice + current_page * g_menu_save_page_size, savegamestrings[choice]); |
| 1132 |
M_ClearMenus(); |
| 1133 |
} |
| 1134 |
|
| 1135 |
// |
| 1136 |
// User wants to save. Start string input for M_Responder |
| 1137 |
// |
| 1138 |
static inline dboolean IsMapName(char *str) |
| 1139 |
{ |
| 1140 |
if (strlen(str) == 4 && |
| 1141 |
str[0] == 'E' && isdigit(str[1]) && |
| 1142 |
str[2] == 'M' && isdigit(str[3])) |
| 1143 |
{ |
| 1144 |
return true; |
| 1145 |
} |
| 1146 |
|
| 1147 |
if (strlen(str) == 5 && |
| 1148 |
str[0] == 'M' && str[1] == 'A' && str[2] == 'P' && |
| 1149 |
isdigit(str[3]) && isdigit(str[4])) |
| 1150 |
{ |
| 1151 |
return true; |
| 1152 |
} |
| 1153 |
|
| 1154 |
return false; |
| 1155 |
} |
| 1156 |
|
| 1157 |
static void M_SaveSelect(int choice) |
| 1158 |
{ |
| 1159 |
if (current_save_page == 0) |
| 1160 |
return; |
| 1161 |
|
| 1162 |
// we are going to be intercepting all chars |
| 1163 |
saveStringEnter = 1; |
| 1164 |
|
| 1165 |
saveSlot = choice; |
| 1166 |
strcpy(saveOldString,savegamestrings[choice]); |
| 1167 |
if (!strcmp(savegamestrings[choice],s_EMPTYSTRING) || // Ty 03/27/98 - externalized |
| 1168 |
IsMapName(savegamestrings[choice])) |
| 1169 |
{ |
| 1170 |
snprintf(savegamestrings[choice], SAVESTRINGSIZE, "%s", dsda_MapLumpName(gameepisode, gamemap)); |
| 1171 |
savegamestrings[choice][SAVESTRINGSIZE - 1] = 0; |
| 1172 |
} |
| 1173 |
saveCharIndex = strlen(savegamestrings[choice]); |
| 1174 |
} |
| 1175 |
|
| 1176 |
// |
| 1177 |
// Selected from DOOM menu |
| 1178 |
// |
| 1179 |
void M_SaveGame (int choice) |
| 1180 |
{ |
| 1181 |
delete_verify = false; |
| 1182 |
|
| 1183 |
if (gamestate != GS_LEVEL) |
| 1184 |
return; |
| 1185 |
|
| 1186 |
if (!dsda_AllowAnyMenuSave()) |
| 1187 |
{ |
| 1188 |
M_StartMessage( |
| 1189 |
"you can't save the game\n" |
| 1190 |
"under these conditions!\n\n"PRESSKEY, |
| 1191 |
NULL, false); // killough 5/26/98: not externalized |
| 1192 |
return; |
| 1193 |
} |
| 1194 |
|
| 1195 |
M_SetupNextMenu(&SaveDef); |
| 1196 |
current_page = current_save_page; |
| 1197 |
itemOn = current_save_item; |
| 1198 |
M_ReadSaveStrings(); |
| 1199 |
} |
| 1200 |
|
| 1201 |
///////////////////////////// |
| 1202 |
// |
| 1203 |
// OPTIONS MENU |
| 1204 |
// |
| 1205 |
|
| 1206 |
// numerical values for the Options menu items |
| 1207 |
|
| 1208 |
enum |
| 1209 |
{ |
| 1210 |
opt_general, // killough 10/98 |
| 1211 |
opt_bindings, |
| 1212 |
opt_display, |
| 1213 |
opt_demos, |
| 1214 |
opt_compatibility, |
| 1215 |
opt_weapons, |
| 1216 |
opt_automap, |
| 1217 |
// opt_soundvol, |
| 1218 |
opt_level_table, |
| 1219 |
opt_end |
| 1220 |
} options_e; |
| 1221 |
|
| 1222 |
// The definitions of the Options menu |
| 1223 |
|
| 1224 |
static menuitem_t OptionsMenu[]= |
| 1225 |
{ |
| 1226 |
{ 1, "M_GENERL", M_General, 'g', "GENERAL" }, // killough 10/98 |
| 1227 |
{ 1, "M_KEYBND", M_KeyBindings,'k', "KEY BINDINGS" }, |
| 1228 |
{ 1, "M_DSPLAY", M_Display, 'd', "DISPLAY" }, |
| 1229 |
{ 1, "M_DEMOS", M_Demos, 'm', "DEMOS" }, |
| 1230 |
{ 1, "M_COMP", M_Compatibility, 'c', "COMPATIBILITY" }, |
| 1231 |
{ 1, "M_WEAP", M_Weapons, 'w', "WEAPONS" }, |
| 1232 |
{ 1, "M_AUTO", M_Automap, 'a', "AUTOMAP" }, |
| 1233 |
// { 1, "M_SVOL", M_Sound, 's', "SOUND VOLUME" }, only available using the keybind |
| 1234 |
{ 1, "M_LVLTBL", M_LevelTable, 'l', "LEVEL TABLE" }, |
| 1235 |
}; |
| 1236 |
|
| 1237 |
menu_t OptionsDef = |
| 1238 |
{ |
| 1239 |
opt_end, |
| 1240 |
&MainDef, |
| 1241 |
OptionsMenu, |
| 1242 |
M_DrawOptions, |
| 1243 |
60,37, |
| 1244 |
0 |
| 1245 |
}; |
| 1246 |
|
| 1247 |
// |
| 1248 |
// M_Options |
| 1249 |
// |
| 1250 |
|
| 1251 |
static void M_DrawOptions(void) |
| 1252 |
{ |
| 1253 |
if (raven) return MN_DrawOptions(); |
| 1254 |
|
| 1255 |
// CPhipps - patch drawing updated |
| 1256 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 1257 |
V_DrawNamePatch(108, 15, 0, "M_OPTTTL", CR_DEFAULT, VPT_STRETCH); |
| 1258 |
} |
| 1259 |
|
| 1260 |
void M_Options(int choice) |
| 1261 |
{ |
| 1262 |
M_SetupNextMenu(&OptionsDef); |
| 1263 |
} |
| 1264 |
|
| 1265 |
///////////////////////////// |
| 1266 |
// |
| 1267 |
// M_QuitDOOM |
| 1268 |
// |
| 1269 |
int quitsounds[8] = |
| 1270 |
{ |
| 1271 |
sfx_pldeth, |
| 1272 |
sfx_dmpain, |
| 1273 |
sfx_popain, |
| 1274 |
sfx_slop, |
| 1275 |
sfx_telept, |
| 1276 |
sfx_posit1, |
| 1277 |
sfx_posit3, |
| 1278 |
sfx_sgtatk |
| 1279 |
}; |
| 1280 |
|
| 1281 |
int quitsounds2[8] = |
| 1282 |
{ |
| 1283 |
sfx_vilact, |
| 1284 |
sfx_getpow, |
| 1285 |
sfx_boscub, |
| 1286 |
sfx_slop, |
| 1287 |
sfx_skeswg, |
| 1288 |
sfx_kntdth, |
| 1289 |
sfx_bspact, |
| 1290 |
sfx_sgtatk |
| 1291 |
}; |
| 1292 |
|
| 1293 |
static void M_QuitResponse(dboolean affirmative) |
| 1294 |
{ |
| 1295 |
if (!affirmative) |
| 1296 |
return; |
| 1297 |
|
| 1298 |
if (!netgame // killough 12/98 |
| 1299 |
&& !nosfxparm |
| 1300 |
&& dsda_IntConfig(dsda_config_quit_sounds)) |
| 1301 |
{ |
| 1302 |
int i; |
| 1303 |
|
| 1304 |
if (gamemode == commercial) |
| 1305 |
S_StartVoidSound(quitsounds2[(gametic>>2)&7]); |
| 1306 |
else |
| 1307 |
S_StartVoidSound(quitsounds[(gametic>>2)&7]); |
| 1308 |
|
| 1309 |
// wait till all sounds stopped or 3 seconds are over |
| 1310 |
i = 30; |
| 1311 |
while (i > 0) { |
| 1312 |
I_uSleep(100000); // CPhipps - don't thrash cpu in this loop |
| 1313 |
if (!I_AnySoundStillPlaying()) |
| 1314 |
break; |
| 1315 |
i--; |
| 1316 |
} |
| 1317 |
} |
| 1318 |
|
| 1319 |
//e6y: I_SafeExit instead of exit - prevent recursive exits |
| 1320 |
I_SafeExit(0); // killough |
| 1321 |
} |
| 1322 |
|
| 1323 |
void M_QuitDOOM(int choice) |
| 1324 |
{ |
| 1325 |
static char endstring[160]; |
| 1326 |
setup_active = false; |
| 1327 |
currentMenu = NULL; |
| 1328 |
|
| 1329 |
// We pick index 0 which is language sensitive, |
| 1330 |
// or one at random, between 1 and maximum number. |
| 1331 |
// Ty 03/27/98 - externalized DOSY as a string s_DOSY that's in the sprintf |
| 1332 |
if (language != english) |
| 1333 |
snprintf(endstring, sizeof(endstring), "%s\n\n%s",s_DOSY, *endmsg[0] ); |
| 1334 |
else // killough 1/18/98: fix endgame message calculation: |
| 1335 |
snprintf(endstring, sizeof(endstring), "%s\n\n%s", *endmsg[gametic%(NUM_QUITMESSAGES-1)+1], s_DOSY); |
| 1336 |
|
| 1337 |
if (dsda_SkipQuitPrompt()) |
| 1338 |
M_QuitResponse(true); |
| 1339 |
else |
| 1340 |
M_StartMessage(endstring,M_QuitResponse,true); |
| 1341 |
} |
| 1342 |
|
| 1343 |
///////////////////////////// |
| 1344 |
// |
| 1345 |
// SOUND VOLUME MENU |
| 1346 |
// |
| 1347 |
|
| 1348 |
// numerical values for the Sound Volume menu items |
| 1349 |
// The 'empty' slots are where the sliding scales appear. |
| 1350 |
|
| 1351 |
enum |
| 1352 |
{ |
| 1353 |
sfx_vol, |
| 1354 |
sfx_empty1, |
| 1355 |
music_vol, |
| 1356 |
sfx_empty2, |
| 1357 |
sound_end |
| 1358 |
} sound_e; |
| 1359 |
|
| 1360 |
// The definitions of the Sound Volume menu |
| 1361 |
|
| 1362 |
menuitem_t SoundMenu[]= |
| 1363 |
{ |
| 1364 |
{2,"M_SFXVOL",M_SfxVol,'s'}, |
| 1365 |
{-1,"",0}, |
| 1366 |
{2,"M_MUSVOL",M_MusicVol,'m'}, |
| 1367 |
{-1,"",0} |
| 1368 |
}; |
| 1369 |
|
| 1370 |
menu_t SoundDef = |
| 1371 |
{ |
| 1372 |
sound_end, |
| 1373 |
&OptionsDef, |
| 1374 |
SoundMenu, |
| 1375 |
M_DrawSound, |
| 1376 |
80,64, |
| 1377 |
0 |
| 1378 |
}; |
| 1379 |
|
| 1380 |
// |
| 1381 |
// Change Sfx & Music volumes |
| 1382 |
// |
| 1383 |
|
| 1384 |
static void M_DrawSound(void) |
| 1385 |
{ |
| 1386 |
char num[4]; |
| 1387 |
|
| 1388 |
if (raven) return MN_DrawSound(); |
| 1389 |
|
| 1390 |
// CPhipps - patch drawing updated |
| 1391 |
V_DrawNamePatch(60, 38, 0, "M_SVOL", CR_DEFAULT, VPT_STRETCH); |
| 1392 |
|
| 1393 |
M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(sfx_vol+1),16,16,snd_SfxVolume); |
| 1394 |
snprintf(num, sizeof(num), "%3d", snd_SfxVolume); |
| 1395 |
strcpy(menu_buffer, num); |
| 1396 |
M_DrawMenuString(SoundDef.x + 150, SoundDef.y+LINEHEIGHT*(sfx_vol+1) + 3, cr_value_edit); |
| 1397 |
|
| 1398 |
M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(music_vol+1),16,16,snd_MusicVolume); |
| 1399 |
snprintf(num, sizeof(num), "%3d", snd_MusicVolume); |
| 1400 |
strcpy(menu_buffer, num); |
| 1401 |
M_DrawMenuString(SoundDef.x + 150, SoundDef.y+LINEHEIGHT*(music_vol+1) + 3, cr_value_edit); |
| 1402 |
} |
| 1403 |
|
| 1404 |
static void M_Sound(int choice) |
| 1405 |
{ |
| 1406 |
M_SetupNextMenu(&SoundDef); |
| 1407 |
} |
| 1408 |
|
| 1409 |
static void M_SfxVol(int choice) |
| 1410 |
{ |
| 1411 |
switch(choice) |
| 1412 |
{ |
| 1413 |
case 0: |
| 1414 |
if (dsda_IntConfig(dsda_config_sfx_volume) > 0) |
| 1415 |
dsda_DecrementIntConfig(dsda_config_sfx_volume, true); |
| 1416 |
break; |
| 1417 |
case 1: |
| 1418 |
dsda_IncrementIntConfig(dsda_config_sfx_volume, true); |
| 1419 |
break; |
| 1420 |
} |
| 1421 |
|
| 1422 |
// Unmute the sfx if we are adjusting the volume |
| 1423 |
if (dsda_IntConfig(dsda_config_mute_sfx)) |
| 1424 |
dsda_ToggleConfig(dsda_config_mute_sfx, true); |
| 1425 |
} |
| 1426 |
|
| 1427 |
static void M_MusicVol(int choice) |
| 1428 |
{ |
| 1429 |
switch(choice) |
| 1430 |
{ |
| 1431 |
case 0: |
| 1432 |
if (dsda_IntConfig(dsda_config_music_volume) > 0) |
| 1433 |
dsda_DecrementIntConfig(dsda_config_music_volume, true); |
| 1434 |
break; |
| 1435 |
case 1: |
| 1436 |
dsda_IncrementIntConfig(dsda_config_music_volume, true); |
| 1437 |
break; |
| 1438 |
} |
| 1439 |
|
| 1440 |
// Unmute the music if we are adjusting the volume |
| 1441 |
if (dsda_IntConfig(dsda_config_mute_music)) |
| 1442 |
dsda_ToggleConfig(dsda_config_mute_music, true); |
| 1443 |
} |
| 1444 |
|
| 1445 |
///////////////////////////// |
| 1446 |
// |
| 1447 |
// M_QuickSave |
| 1448 |
// |
| 1449 |
|
| 1450 |
static void M_QuickSave(void) |
| 1451 |
{ |
| 1452 |
int i; |
| 1453 |
char description[SAVESTRINGSIZE]; |
| 1454 |
time_t now; |
| 1455 |
struct tm *timeinfo; |
| 1456 |
|
| 1457 |
if (gamestate != GS_LEVEL) |
| 1458 |
return; |
| 1459 |
|
| 1460 |
if (!dsda_AllowAnyMenuSave()) |
| 1461 |
{ |
| 1462 |
M_StartMessage( |
| 1463 |
"you can't save the game\n" |
| 1464 |
"under these conditions!\n\n"PRESSKEY, |
| 1465 |
NULL, false); // killough 5/26/98: not externalized |
| 1466 |
return; |
| 1467 |
} |
| 1468 |
|
| 1469 |
// Move all quicksaves downwards to make space for a new one |
| 1470 |
M_DeleteSaveGame(g_menu_save_page_size - 1); |
| 1471 |
for (i = g_menu_save_page_size - 2; i >= 0; i--) |
| 1472 |
{ |
| 1473 |
char *oldname = dsda_SaveGameName(i, false); |
| 1474 |
char *newname = dsda_SaveGameName(i + 1, false); |
| 1475 |
|
| 1476 |
rename(oldname, newname); |
| 1477 |
|
| 1478 |
Z_Free(oldname); |
| 1479 |
Z_Free(newname); |
| 1480 |
} |
| 1481 |
|
| 1482 |
time (&now); |
| 1483 |
timeinfo = localtime (&now); |
| 1484 |
|
| 1485 |
strftime(description, sizeof(description), "quick %x %X", timeinfo); |
| 1486 |
|
| 1487 |
G_SaveGame(QUICKSAVESLOT, description); |
| 1488 |
doom_printf("%s", description); |
| 1489 |
|
| 1490 |
M_ReadSaveStrings(); |
| 1491 |
} |
| 1492 |
|
| 1493 |
///////////////////////////// |
| 1494 |
// |
| 1495 |
// M_QuickLoad |
| 1496 |
// |
| 1497 |
|
| 1498 |
static void M_QuickLoad(void) |
| 1499 |
{ |
| 1500 |
char *name; |
| 1501 |
|
| 1502 |
if (!dsda_AllowAnyMenuLoad()) |
| 1503 |
{ |
| 1504 |
M_StartMessage( |
| 1505 |
"you can't load a game\n" |
| 1506 |
"under these conditions!\n\n"PRESSKEY, |
| 1507 |
NULL, false); // killough 5/26/98: not externalized |
| 1508 |
return; |
| 1509 |
} |
| 1510 |
|
| 1511 |
if (!dsda_AllowMenuLoad(QUICKSAVESLOT)) |
| 1512 |
{ |
| 1513 |
M_StartMessage( |
| 1514 |
"you can't load this game\n" |
| 1515 |
"under these conditions!\n\n"PRESSKEY, |
| 1516 |
NULL, false); // killough 5/26/98: not externalized |
| 1517 |
return; |
| 1518 |
} |
| 1519 |
|
| 1520 |
name = dsda_SaveGameName(QUICKSAVESLOT, false); |
| 1521 |
|
| 1522 |
if (M_FileExists(name)) |
| 1523 |
{ |
| 1524 |
G_LoadGame(QUICKSAVESLOT); |
| 1525 |
doom_printf("quickload"); |
| 1526 |
} |
| 1527 |
else |
| 1528 |
{ |
| 1529 |
doom_printf("no save file"); |
| 1530 |
} |
| 1531 |
|
| 1532 |
Z_Free(name); |
| 1533 |
} |
| 1534 |
|
| 1535 |
///////////////////////////// |
| 1536 |
// |
| 1537 |
// M_EndGame |
| 1538 |
// |
| 1539 |
|
| 1540 |
static void M_EndGameResponse(dboolean affirmative) |
| 1541 |
{ |
| 1542 |
if (!affirmative) |
| 1543 |
return; |
| 1544 |
|
| 1545 |
// killough 5/26/98: make endgame quit if recording or playing back demo |
| 1546 |
if (demorecording || userplayback) |
| 1547 |
G_CheckDemoStatus(); |
| 1548 |
|
| 1549 |
currentMenu->lastOn = itemOn; |
| 1550 |
M_ClearMenus (); |
| 1551 |
D_StartTitle (); |
| 1552 |
} |
| 1553 |
|
| 1554 |
void M_EndGame(int choice) |
| 1555 |
{ |
| 1556 |
if (netgame) |
| 1557 |
{ |
| 1558 |
M_StartMessage(s_NETEND,NULL,false); // Ty 03/27/98 - externalized |
| 1559 |
return; |
| 1560 |
} |
| 1561 |
M_StartMessage(s_ENDGAME,M_EndGameResponse,true); // Ty 03/27/98 - externalized |
| 1562 |
} |
| 1563 |
|
| 1564 |
void M_ChangeMessages(void) |
| 1565 |
{ |
| 1566 |
if (!dsda_ShowMessages()) |
| 1567 |
dsda_AddUnblockableMessage(s_MSGOFF); |
| 1568 |
else |
| 1569 |
dsda_AddMessage(s_MSGON); |
| 1570 |
} |
| 1571 |
|
| 1572 |
///////////////////////////// |
| 1573 |
// |
| 1574 |
// CHANGE DISPLAY SIZE |
| 1575 |
// |
| 1576 |
// jff 2/23/98 restored to pre-HUD state |
| 1577 |
// hud_active controlled soley by F5=key_detail (key_hud) |
| 1578 |
// hud_displayed is toggled by + or = in fullscreen |
| 1579 |
// hud_displayed is cleared by - |
| 1580 |
|
| 1581 |
static void M_SizeDisplay(int choice) |
| 1582 |
{ |
| 1583 |
switch(choice) { |
| 1584 |
case 0: |
| 1585 |
if (R_FullView()) |
| 1586 |
dsda_DecrementIntConfig(dsda_config_screenblocks, true); |
| 1587 |
break; |
| 1588 |
case 1: |
| 1589 |
if (R_PartialView()) |
| 1590 |
dsda_IncrementIntConfig(dsda_config_screenblocks, true); |
| 1591 |
else |
| 1592 |
dsda_ToggleConfig(dsda_config_hud_displayed, true); |
| 1593 |
break; |
| 1594 |
case 2: |
| 1595 |
if (R_PartialView()) { |
| 1596 |
dsda_UpdateIntConfig(dsda_config_screenblocks, 11, true); |
| 1597 |
dsda_UpdateIntConfig(dsda_config_hud_displayed, true, true); |
| 1598 |
} |
| 1599 |
else { |
| 1600 |
dsda_ToggleConfig(dsda_config_hud_displayed, true); |
| 1601 |
if (dsda_IntConfig(dsda_config_hud_displayed)) |
| 1602 |
dsda_DecrementIntConfig(dsda_config_screenblocks, true); |
| 1603 |
} |
| 1604 |
break; |
| 1605 |
} |
| 1606 |
} |
| 1607 |
|
| 1608 |
// |
| 1609 |
// End of Original Menus |
| 1610 |
// |
| 1611 |
///////////////////////////////////////////////////////////////////////////// |
| 1612 |
|
| 1613 |
///////////////////////////////////////////////////////////////////////////// |
| 1614 |
// |
| 1615 |
// SETUP MENU (phares) |
| 1616 |
// |
| 1617 |
// We've added a set of Setup Screens from which you can configure a number |
| 1618 |
// of variables w/o having to restart the game. There are 7 screens: |
| 1619 |
// |
| 1620 |
// Key Bindings |
| 1621 |
// Weapons |
| 1622 |
// Status Bar / HUD |
| 1623 |
// Automap |
| 1624 |
// |
| 1625 |
// killough 10/98: added Compatibility and General menus |
| 1626 |
// |
| 1627 |
|
| 1628 |
///////////////////////////// |
| 1629 |
// |
| 1630 |
// set_menu_itemon is an index that starts at zero, and tells you which |
| 1631 |
// item on the current screen the cursor is sitting on. |
| 1632 |
// |
| 1633 |
// current_setup_menu is a pointer to the current setup menu table. |
| 1634 |
|
| 1635 |
static int set_menu_itemon; // which setup item is selected? // phares 3/98 |
| 1636 |
static setup_menu_t* current_setup_menu; // points to current setup menu table |
| 1637 |
|
| 1638 |
// save the setup menu's itemon value in the S_END element's x coordinate |
| 1639 |
|
| 1640 |
static int M_GetSetupMenuItemOn (void) |
| 1641 |
{ |
| 1642 |
const setup_menu_t* menu = current_setup_menu; |
| 1643 |
|
| 1644 |
if (menu) |
| 1645 |
{ |
| 1646 |
while (!(menu->m_flags & S_END)) |
| 1647 |
menu++; |
| 1648 |
|
| 1649 |
return menu->m_x; |
| 1650 |
} |
| 1651 |
|
| 1652 |
return 0; |
| 1653 |
} |
| 1654 |
|
| 1655 |
static void M_SetSetupMenuItemOn (const int x) |
| 1656 |
{ |
| 1657 |
setup_menu_t* menu = current_setup_menu; |
| 1658 |
|
| 1659 |
if (menu) |
| 1660 |
{ |
| 1661 |
while (!(menu->m_flags & S_END)) |
| 1662 |
menu++; |
| 1663 |
|
| 1664 |
menu->m_x = x; |
| 1665 |
} |
| 1666 |
} |
| 1667 |
|
| 1668 |
static void M_UpdateSetupMenu(setup_menu_t *new_setup_menu) |
| 1669 |
{ |
| 1670 |
current_setup_menu = new_setup_menu; |
| 1671 |
set_menu_itemon = M_GetSetupMenuItemOn(); |
| 1672 |
if (current_setup_menu[set_menu_itemon].m_flags & S_NOSELECT) |
| 1673 |
return; |
| 1674 |
while (current_setup_menu[set_menu_itemon++].m_flags & S_SKIP); |
| 1675 |
current_setup_menu[--set_menu_itemon].m_flags |= S_HILITE; |
| 1676 |
} |
| 1677 |
|
| 1678 |
///////////////////////////// |
| 1679 |
// |
| 1680 |
// M_DoNothing does just that: nothing. Just a placeholder. |
| 1681 |
|
| 1682 |
static void M_DoNothing(int choice) |
| 1683 |
{ |
| 1684 |
} |
| 1685 |
|
| 1686 |
///////////////////////////// |
| 1687 |
// |
| 1688 |
// Items needed to satisfy the 'Big Font' menu structures: |
| 1689 |
// |
| 1690 |
// the generic_setup_e enum mimics the 'Big Font' menu structures, but |
| 1691 |
// means nothing to the Setup Menus. |
| 1692 |
|
| 1693 |
enum |
| 1694 |
{ |
| 1695 |
generic_setupempty1, |
| 1696 |
generic_setup_end |
| 1697 |
} generic_setup_e; |
| 1698 |
|
| 1699 |
// Generic_Setup is a do-nothing definition that the mainstream Menu code |
| 1700 |
// can understand, while the Setup Menu code is working. Another placeholder. |
| 1701 |
|
| 1702 |
static menuitem_t Generic_Setup[] = |
| 1703 |
{ |
| 1704 |
{1,"",M_DoNothing,0} |
| 1705 |
}; |
| 1706 |
|
| 1707 |
static menu_t GeneralDef = // killough 10/98 |
| 1708 |
{ |
| 1709 |
generic_setup_end, |
| 1710 |
&OptionsDef, |
| 1711 |
Generic_Setup, |
| 1712 |
M_DrawGeneral, |
| 1713 |
34,5, // skull drawn here |
| 1714 |
0 |
| 1715 |
}; |
| 1716 |
|
| 1717 |
static menu_t KeybndDef = |
| 1718 |
{ |
| 1719 |
generic_setup_end, |
| 1720 |
&OptionsDef, |
| 1721 |
Generic_Setup, |
| 1722 |
M_DrawKeybnd, |
| 1723 |
34,5, // skull drawn here |
| 1724 |
0 |
| 1725 |
}; |
| 1726 |
|
| 1727 |
static menu_t DisplayDef = // killough 10/98 |
| 1728 |
{ |
| 1729 |
generic_setup_end, |
| 1730 |
&OptionsDef, |
| 1731 |
Generic_Setup, |
| 1732 |
M_DrawDisplay, |
| 1733 |
34,5, // skull drawn here |
| 1734 |
0 |
| 1735 |
}; |
| 1736 |
|
| 1737 |
static menu_t DemosDef = |
| 1738 |
{ |
| 1739 |
generic_setup_end, |
| 1740 |
&OptionsDef, |
| 1741 |
Generic_Setup, |
| 1742 |
M_DrawDemos, |
| 1743 |
34,5, // skull drawn here |
| 1744 |
0 |
| 1745 |
}; |
| 1746 |
|
| 1747 |
static menu_t CompatibilityDef = // killough 10/98 |
| 1748 |
{ |
| 1749 |
generic_setup_end, |
| 1750 |
&OptionsDef, |
| 1751 |
Generic_Setup, |
| 1752 |
M_DrawCompatibility, |
| 1753 |
34,5, // skull drawn here |
| 1754 |
0 |
| 1755 |
}; |
| 1756 |
|
| 1757 |
static menu_t WeaponDef = |
| 1758 |
{ |
| 1759 |
generic_setup_end, |
| 1760 |
&OptionsDef, |
| 1761 |
Generic_Setup, |
| 1762 |
M_DrawWeapons, |
| 1763 |
34,5, // skull drawn here |
| 1764 |
0 |
| 1765 |
}; |
| 1766 |
|
| 1767 |
static menu_t AutoMapDef = |
| 1768 |
{ |
| 1769 |
generic_setup_end, |
| 1770 |
&OptionsDef, |
| 1771 |
Generic_Setup, |
| 1772 |
M_DrawAutoMap, |
| 1773 |
34,5, // skull drawn here |
| 1774 |
0 |
| 1775 |
}; |
| 1776 |
|
| 1777 |
static menu_t LevelTableDef = |
| 1778 |
{ |
| 1779 |
generic_setup_end, |
| 1780 |
&OptionsDef, |
| 1781 |
Generic_Setup, |
| 1782 |
M_DrawLevelTable, |
| 1783 |
34,5, // skull drawn here |
| 1784 |
0 |
| 1785 |
}; |
| 1786 |
|
| 1787 |
// Data used by the Automap color selection code |
| 1788 |
|
| 1789 |
#define CHIP_SIZE 8 // size of color block for colored items |
| 1790 |
|
| 1791 |
#define COLORPALXORIG ((320 - 16*(CHIP_SIZE))/2) |
| 1792 |
#define COLORPALYORIG ((200 - 16*(CHIP_SIZE))/2) |
| 1793 |
|
| 1794 |
#define TABS_Y 20 |
| 1795 |
#define DEFAULT_LIST_Y (TABS_Y + 14) |
| 1796 |
|
| 1797 |
// Data used by the string editing code |
| 1798 |
|
| 1799 |
#define ENTRY_STRING_BFR_SIZE 128 |
| 1800 |
|
| 1801 |
// strings must fit in this screen space |
| 1802 |
// killough 10/98: reduced, for more general uses |
| 1803 |
#define MAXENTRYWIDTH 272 |
| 1804 |
|
| 1805 |
static int entry_index; |
| 1806 |
static char entry_string_index[ENTRY_STRING_BFR_SIZE]; // points to new strings while editing |
| 1807 |
static int choice_value; |
| 1808 |
|
| 1809 |
///////////////////////////// |
| 1810 |
// |
| 1811 |
// phares 4/18/98: |
| 1812 |
// Consolidate Item drawing code |
| 1813 |
// |
| 1814 |
// M_DrawItem draws the description of the provided item (the left-hand |
| 1815 |
// part). A different color is used for the text depending on whether the |
| 1816 |
// item is selected or not, or whether it's about to change. |
| 1817 |
|
| 1818 |
// CPhipps - static, hanging else removed, const parameter |
| 1819 |
static void M_DrawItem(const setup_menu_t* s, int y) |
| 1820 |
{ |
| 1821 |
int x = s->m_x; |
| 1822 |
int flags = s->m_flags; |
| 1823 |
char *p, *t; |
| 1824 |
int w = 0; |
| 1825 |
int color = |
| 1826 |
dsda_StrictMode() && dsda_IsStrictConfig(s->config_id) ? cr_label + CR_DARKEN : |
| 1827 |
flags & (S_SELECT|S_TC_SEL) ? cr_label_edit : |
| 1828 |
flags & S_HILITE ? cr_label_highlight : |
| 1829 |
flags & (S_TITLE|S_NEXT|S_PREV) ? cr_title : |
| 1830 |
cr_label; // killough 10/98 |
| 1831 |
|
| 1832 |
/* killough 10/98: |
| 1833 |
* Enhance to support multiline text separated by newlines. |
| 1834 |
* This supports multiline items on horizontally-crowded menus. |
| 1835 |
*/ |
| 1836 |
|
| 1837 |
for (p = t = Z_Strdup(s->m_text); (p = strtok(p,"\n")); y += 8, p = NULL) |
| 1838 |
{ /* killough 10/98: support left-justification: */ |
| 1839 |
if (flags & S_CENTER) |
| 1840 |
w = M_GetPixelWidth(p) / 2; |
| 1841 |
else if (!(flags & S_LEFTJUST)) |
| 1842 |
w = M_GetPixelWidth(p) + 4; |
| 1843 |
M_DrawString(x - w, y ,color, p); |
| 1844 |
// print a blinking "arrow" next to the currently highlighted menu item |
| 1845 |
if (s == current_setup_menu + set_menu_itemon && whichSkull && !(flags & S_NOSELECT)) |
| 1846 |
M_DrawString(x - w - 8, y, color, ">"); |
| 1847 |
} |
| 1848 |
Z_Free(t); |
| 1849 |
} |
| 1850 |
|
| 1851 |
// If a number item is being changed, allow up to N keystrokes to 'gather' |
| 1852 |
// the value. Gather_count tells you how many you have so far. The legality |
| 1853 |
// of what is gathered is determined by the low/high settings for the item. |
| 1854 |
|
| 1855 |
#define MAXGATHER 5 |
| 1856 |
static int gather_count; |
| 1857 |
static char gather_buffer[MAXGATHER+1]; // killough 10/98: make input character-based |
| 1858 |
|
| 1859 |
///////////////////////////// |
| 1860 |
// |
| 1861 |
// phares 4/18/98: |
| 1862 |
// Consolidate Item Setting drawing code |
| 1863 |
// |
| 1864 |
// M_DrawSetting draws the setting of the provided item (the right-hand |
| 1865 |
// part. It determines the text color based on whether the item is |
| 1866 |
// selected or being changed. Then, depending on the type of item, it |
| 1867 |
// displays the appropriate setting value: yes/no, a key binding, a number, |
| 1868 |
// a paint chip, etc. |
| 1869 |
|
| 1870 |
static void M_DrawSetting(const setup_menu_t* s, int y) |
| 1871 |
{ |
| 1872 |
int x = s->m_x, flags = s->m_flags, color; |
| 1873 |
|
| 1874 |
// Determine color of the text. This may or may not be used later, |
| 1875 |
// depending on whether the item is a text string or not. |
| 1876 |
|
| 1877 |
color = |
| 1878 |
dsda_StrictMode() && dsda_IsStrictConfig(s->config_id) ? cr_value + CR_DARKEN : |
| 1879 |
flags & S_SELECT ? cr_value_edit : |
| 1880 |
flags & S_HILITE ? cr_value_highlight : |
| 1881 |
cr_value; |
| 1882 |
|
| 1883 |
// Is the item a YES/NO item? |
| 1884 |
|
| 1885 |
if (flags & S_YESNO) { |
| 1886 |
strcpy(menu_buffer, dsda_IntConfig(s->config_id) ? "YES" : "NO"); |
| 1887 |
|
| 1888 |
if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select) |
| 1889 |
strcat(menu_buffer, " <"); |
| 1890 |
M_DrawMenuString(x,y,color); |
| 1891 |
return; |
| 1892 |
} |
| 1893 |
|
| 1894 |
// Is the item a simple number? |
| 1895 |
|
| 1896 |
if (flags & (S_NUM | S_WEAP | S_CRITEM)) { |
| 1897 |
// killough 10/98: We must draw differently for items being gathered. |
| 1898 |
if (flags & (S_HILITE | S_SELECT) && setup_gather) { |
| 1899 |
gather_buffer[gather_count] = 0; |
| 1900 |
strcpy(menu_buffer, gather_buffer); |
| 1901 |
} |
| 1902 |
else { |
| 1903 |
int value; |
| 1904 |
|
| 1905 |
value = dsda_IntConfig(s->config_id); |
| 1906 |
|
| 1907 |
snprintf(menu_buffer, sizeof(menu_buffer), "%d", value); |
| 1908 |
|
| 1909 |
if (flags & S_CRITEM) |
| 1910 |
{ |
| 1911 |
color = value; |
| 1912 |
if (dsda_StrictMode() && dsda_IsStrictConfig(s->config_id)) |
| 1913 |
color += CR_DARKEN; |
| 1914 |
} |
| 1915 |
} |
| 1916 |
if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select) |
| 1917 |
strcat(menu_buffer, " <"); |
| 1918 |
M_DrawMenuString(x, y, color); |
| 1919 |
return; |
| 1920 |
} |
| 1921 |
|
| 1922 |
// Is the item a key binding? |
| 1923 |
|
| 1924 |
if (flags & S_INPUT) { |
| 1925 |
int i; |
| 1926 |
int offset = 0; |
| 1927 |
const char* format; |
| 1928 |
dboolean any_input = false; |
| 1929 |
dsda_input_t* input; |
| 1930 |
input = dsda_Input(s->input); |
| 1931 |
|
| 1932 |
// Draw the input bound to the action |
| 1933 |
menu_buffer[0] = '\0'; |
| 1934 |
|
| 1935 |
for (i = 0; i < input->num_keys; ++i) |
| 1936 |
{ |
| 1937 |
if (any_input) |
| 1938 |
{ |
| 1939 |
menu_buffer[offset++] = '/'; |
| 1940 |
menu_buffer[offset] = '\0'; |
| 1941 |
} |
| 1942 |
|
| 1943 |
offset = M_GetKeyString(input->key[i], offset); |
| 1944 |
any_input = true; |
| 1945 |
} |
| 1946 |
|
| 1947 |
if (input->mouseb != -1) |
| 1948 |
{ |
| 1949 |
if (any_input) |
| 1950 |
format = "/MB%d"; |
| 1951 |
else |
| 1952 |
format = "MB%d"; |
| 1953 |
|
| 1954 |
snprintf(menu_buffer + strlen(menu_buffer), sizeof(menu_buffer) - strlen(menu_buffer),format, input->mouseb + 1); |
| 1955 |
any_input = true; |
| 1956 |
} |
| 1957 |
|
| 1958 |
if (input->joyb != -1) |
| 1959 |
{ |
| 1960 |
if (any_input) |
| 1961 |
format = "/%s"; |
| 1962 |
else |
| 1963 |
format = "%s"; |
| 1964 |
|
| 1965 |
snprintf(menu_buffer + strlen(menu_buffer), sizeof(menu_buffer) - strlen(menu_buffer), format, |
| 1966 |
dsda_GameControllerButtonName(input->joyb)); |
| 1967 |
any_input = true; |
| 1968 |
} |
| 1969 |
|
| 1970 |
// "NONE" |
| 1971 |
if (!any_input) |
| 1972 |
M_GetKeyString(0, 0); |
| 1973 |
|
| 1974 |
if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select) |
| 1975 |
strcat(menu_buffer, " <"); |
| 1976 |
|
| 1977 |
M_DrawMenuString(x, y, color); |
| 1978 |
|
| 1979 |
return; |
| 1980 |
} |
| 1981 |
|
| 1982 |
// Is the item a paint chip? |
| 1983 |
|
| 1984 |
if (flags & S_COLOR) // Automap paint chip |
| 1985 |
{ |
| 1986 |
int ch; |
| 1987 |
|
| 1988 |
ch = dsda_IntConfig(s->config_id); |
| 1989 |
// proff 12/6/98: Drawing of colorchips completly changed for hi-res, it now uses a patch |
| 1990 |
// draw the paint chip |
| 1991 |
// e6y: wide-res |
| 1992 |
{ |
| 1993 |
int xx = x, yy = y - 1, ww = 8, hh = 8; |
| 1994 |
V_GetWideRect(&xx, &yy, &ww, &hh, VPT_STRETCH); |
| 1995 |
V_FillRect(0, xx, yy, ww, hh, playpal_darkest); |
| 1996 |
xx = x + 1, yy = y, ww = 6, hh = 6; |
| 1997 |
V_GetWideRect(&xx, &yy, &ww, &hh, VPT_STRETCH); |
| 1998 |
V_FillRect(0, xx, yy, ww, hh, (byte)ch); |
| 1999 |
} |
| 2000 |
|
| 2001 |
if (!ch) // don't show this item in automap mode |
| 2002 |
V_DrawNamePatch(x+1,y,0,"M_PALNO", CR_DEFAULT, VPT_STRETCH); |
| 2003 |
if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select) |
| 2004 |
M_DrawString(x + 8, y, color, " <"); |
| 2005 |
return; |
| 2006 |
} |
| 2007 |
|
| 2008 |
// Is the item a string? |
| 2009 |
if (flags & S_STRING) { |
| 2010 |
static char text[ENTRY_STRING_BFR_SIZE]; |
| 2011 |
|
| 2012 |
// Are we editing this string? If so, display a cursor under |
| 2013 |
// the correct character. |
| 2014 |
if (setup_select && (s->m_flags & (S_HILITE|S_SELECT))) { |
| 2015 |
int cursor_start, char_width; |
| 2016 |
char c[2]; |
| 2017 |
|
| 2018 |
strcpy(text, entry_string_index); |
| 2019 |
|
| 2020 |
// If the string is too wide for the screen, trim it back, |
| 2021 |
// one char at a time until it fits. This should only occur |
| 2022 |
// while you're editing the string. |
| 2023 |
|
| 2024 |
while (M_GetPixelWidth(text) >= MAXENTRYWIDTH) { |
| 2025 |
int len = strlen(text); |
| 2026 |
text[--len] = 0; |
| 2027 |
if (entry_index > len) |
| 2028 |
entry_index--; |
| 2029 |
} |
| 2030 |
|
| 2031 |
// Find the distance from the beginning of the string to |
| 2032 |
// where the cursor should be drawn, plus the width of |
| 2033 |
// the char the cursor is under.. |
| 2034 |
|
| 2035 |
*c = text[entry_index]; // hold temporarily |
| 2036 |
c[1] = 0; |
| 2037 |
char_width = M_GetPixelWidth(c); |
| 2038 |
if (char_width == 1) |
| 2039 |
char_width = 7; // default for end of line |
| 2040 |
text[entry_index] = 0; // NULL to get cursor position |
| 2041 |
cursor_start = M_GetPixelWidth(text); |
| 2042 |
text[entry_index] = *c; // replace stored char |
| 2043 |
|
| 2044 |
// Now draw the cursor |
| 2045 |
// proff 12/6/98: Drawing of cursor changed for hi-res |
| 2046 |
// e6y: wide-res |
| 2047 |
if (x + cursor_start + char_width < BASE_WIDTH) |
| 2048 |
{ |
| 2049 |
int xx = (x+cursor_start-1), yy = y, ww = char_width, hh = 9; |
| 2050 |
V_GetWideRect(&xx, &yy, &ww, &hh, VPT_STRETCH); |
| 2051 |
V_FillRect(0, xx, yy, ww, hh, playpal_lightest); |
| 2052 |
} |
| 2053 |
} |
| 2054 |
else { |
| 2055 |
strncpy(text, dsda_StringConfig(s->config_id), ENTRY_STRING_BFR_SIZE - 1); |
| 2056 |
} |
| 2057 |
|
| 2058 |
// Draw the setting for the item |
| 2059 |
|
| 2060 |
strcpy(menu_buffer, text); |
| 2061 |
if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select) |
| 2062 |
strcat(menu_buffer, " <"); |
| 2063 |
M_DrawMenuString(x, y, color); |
| 2064 |
return; |
| 2065 |
} |
| 2066 |
|
| 2067 |
// Is the item a selection of choices? |
| 2068 |
|
| 2069 |
if (flags & S_CHOICE) { |
| 2070 |
if (flags & S_STR) |
| 2071 |
{ |
| 2072 |
if (setup_select && (s->m_flags & (S_HILITE | S_SELECT))) |
| 2073 |
snprintf(menu_buffer, sizeof(menu_buffer), "%s", entry_string_index); |
| 2074 |
else |
| 2075 |
snprintf(menu_buffer, sizeof(menu_buffer), "%s", dsda_StringConfig(s->config_id)); |
| 2076 |
} |
| 2077 |
else |
| 2078 |
{ |
| 2079 |
int value; |
| 2080 |
|
| 2081 |
if (setup_select && (s->m_flags & (S_HILITE | S_SELECT))) |
| 2082 |
value = choice_value; |
| 2083 |
else |
| 2084 |
value = dsda_IntConfig(s->config_id); |
| 2085 |
|
| 2086 |
if (s->selectstrings == NULL) { |
| 2087 |
snprintf(menu_buffer, sizeof(menu_buffer), "%d", value); |
| 2088 |
} else { |
| 2089 |
strcpy(menu_buffer, s->selectstrings[value]); |
| 2090 |
} |
| 2091 |
} |
| 2092 |
|
| 2093 |
if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select) |
| 2094 |
strcat(menu_buffer, " <"); |
| 2095 |
M_DrawMenuString(x,y,color); |
| 2096 |
return; |
| 2097 |
} |
| 2098 |
|
| 2099 |
if (flags & S_THERMO) { |
| 2100 |
M_DrawThermo(x, y, 8, 16, dsda_IntConfig(s->config_id)); |
| 2101 |
|
| 2102 |
snprintf(menu_buffer, sizeof(menu_buffer), "%d", dsda_IntConfig(s->config_id)); |
| 2103 |
|
| 2104 |
if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select) |
| 2105 |
strcat(menu_buffer, " <"); |
| 2106 |
M_DrawMenuString(x + 80, y + 3, color); |
| 2107 |
return; |
| 2108 |
} |
| 2109 |
} |
| 2110 |
|
| 2111 |
///////////////////////////// |
| 2112 |
// |
| 2113 |
// M_DrawScreenItems takes the data for each menu item and gives it to |
| 2114 |
// the drawing routines above. |
| 2115 |
|
| 2116 |
// CPhipps - static, const parameter, formatting |
| 2117 |
static void M_DrawScreenItems(const setup_menu_t* base_src, int base_y) |
| 2118 |
{ |
| 2119 |
int i = 0; |
| 2120 |
int end_y; |
| 2121 |
int carry_y = 0; // Bigger elements (like S_THERMO) needs a bigger offset that carries over for all settings |
| 2122 |
int scroll_i = 0; |
| 2123 |
int current_i = 0; |
| 2124 |
int max_i = 0; |
| 2125 |
int excess_i = 0; |
| 2126 |
int limit_i = 0; |
| 2127 |
int buffer_i = 0; |
| 2128 |
int line_height = 0; |
| 2129 |
float scrollbar_scale = 0; |
| 2130 |
const setup_menu_t* src; |
| 2131 |
|
| 2132 |
i = 0; |
| 2133 |
for (src = base_src; !(src->m_flags & S_END); src++) { |
| 2134 |
if (src == ¤t_setup_menu[set_menu_itemon]) |
| 2135 |
current_i = i; |
| 2136 |
|
| 2137 |
if (src->m_flags & (S_NEXT | S_PREV)) { |
| 2138 |
// nothing |
| 2139 |
} |
| 2140 |
else if (src->m_flags & S_RESET_Y) { |
| 2141 |
i = 0; |
| 2142 |
} |
| 2143 |
else { |
| 2144 |
if (i > max_i) |
| 2145 |
max_i = i; |
| 2146 |
|
| 2147 |
++i; |
| 2148 |
} |
| 2149 |
} |
| 2150 |
|
| 2151 |
|
| 2152 |
line_height = menu_font->line_height < 9 ? menu_font->line_height : 9; |
| 2153 |
|
| 2154 |
end_y = base_y + (max_i + 1) * line_height; |
| 2155 |
if (end_y > 190) |
| 2156 |
excess_i = (end_y - 190 + line_height - 1) / line_height; |
| 2157 |
|
| 2158 |
limit_i = max_i - excess_i; |
| 2159 |
buffer_i = (max_i - current_i > 3 ? 3 : max_i - current_i); |
| 2160 |
|
| 2161 |
if (excess_i && !inhelpscreens) |
| 2162 |
{ |
| 2163 |
int xx, yy, ww, hh; |
| 2164 |
while (current_i - scroll_i > limit_i - buffer_i) |
| 2165 |
++scroll_i; |
| 2166 |
|
| 2167 |
// Draw scrollbar if needed |
| 2168 |
scrollbar_scale = (185 - DEFAULT_LIST_Y) / (float)max_i; |
| 2169 |
|
| 2170 |
xx = 310, yy = base_y + scroll_i * scrollbar_scale, ww = 2, hh = limit_i * scrollbar_scale; |
| 2171 |
V_GetWideRect(&xx, &yy, &ww, &hh, VPT_STRETCH); |
| 2172 |
V_FillRect(0, xx, yy, ww, hh, colrngs[cr_scrollbar][playpal_lightest]); |
| 2173 |
} |
| 2174 |
|
| 2175 |
i = 0; |
| 2176 |
for (src = base_src; !(src->m_flags & S_END); src++) { |
| 2177 |
int desc_y; |
| 2178 |
int set_y; |
| 2179 |
dboolean skip_entry = false; |
| 2180 |
|
| 2181 |
if (src->m_flags & (S_NEXT | S_PREV)) { |
| 2182 |
desc_y = 190 - line_height - 2; |
| 2183 |
} |
| 2184 |
else if (src->m_flags & S_RESET_Y) { |
| 2185 |
skip_entry = true; |
| 2186 |
i = 0; |
| 2187 |
} |
| 2188 |
else { |
| 2189 |
desc_y = base_y + (i - scroll_i) * line_height + carry_y; |
| 2190 |
|
| 2191 |
if (i - scroll_i < 0 || i - scroll_i > limit_i) |
| 2192 |
skip_entry = true; |
| 2193 |
|
| 2194 |
++i; |
| 2195 |
} |
| 2196 |
|
| 2197 |
if (skip_entry) |
| 2198 |
continue; |
| 2199 |
|
| 2200 |
set_y = desc_y; |
| 2201 |
if (src->m_flags & S_THERMO) |
| 2202 |
{ |
| 2203 |
carry_y += 6; |
| 2204 |
desc_y += 3; |
| 2205 |
} |
| 2206 |
|
| 2207 |
// See if we're to draw the item description (left-hand part) |
| 2208 |
if (src->m_flags & S_SHOWDESC) |
| 2209 |
M_DrawItem(src, desc_y); |
| 2210 |
|
| 2211 |
// See if we're to draw the setting (right-hand part) |
| 2212 |
if (src->m_flags & S_SHOWSET) |
| 2213 |
M_DrawSetting(src, set_y); |
| 2214 |
} |
| 2215 |
} |
| 2216 |
|
| 2217 |
// Draws the name of each page. If there are more than m, uses a carousel |
| 2218 |
void M_DrawTabs(const char **pages, int m, int y) |
| 2219 |
{ |
| 2220 |
int x = 0; |
| 2221 |
int w = 0; |
| 2222 |
int i = 0; |
| 2223 |
int start_i = 0; |
| 2224 |
int end_i = m - 1; |
| 2225 |
int s = (m / 2); // halfway point |
| 2226 |
|
| 2227 |
// Figure out what tabs should be drawn if using carousel |
| 2228 |
if (current_page > s) |
| 2229 |
{ |
| 2230 |
while (pages[current_page + i] != NULL) |
| 2231 |
i++; |
| 2232 |
|
| 2233 |
if (i <= s) |
| 2234 |
{ |
| 2235 |
start_i = current_page + i - m; |
| 2236 |
end_i = current_page + i; |
| 2237 |
} |
| 2238 |
else |
| 2239 |
{ |
| 2240 |
start_i = current_page - s; |
| 2241 |
end_i = current_page + s; |
| 2242 |
} |
| 2243 |
} |
| 2244 |
|
| 2245 |
// Find the initial offset to center text |
| 2246 |
for (i = start_i; (i <= end_i && pages[i] != NULL); i++) |
| 2247 |
{ |
| 2248 |
w = M_GetPixelWidth(pages[i]); |
| 2249 |
x += w + 6; |
| 2250 |
} |
| 2251 |
x = (320 - x + 6) / 2; |
| 2252 |
|
| 2253 |
// Draw the arrows on the sides |
| 2254 |
if (start_i > 0) |
| 2255 |
M_DrawString(x - M_GetPixelWidth("<-") - 2, y , cr_tab, "<-"); |
| 2256 |
if (pages[i] != NULL) |
| 2257 |
M_DrawString(320 - x + 2, y , cr_tab, "->"); |
| 2258 |
|
| 2259 |
// Draw the page names |
| 2260 |
for (i = start_i; (i <= end_i && pages[i] != NULL); i++) |
| 2261 |
{ |
| 2262 |
M_DrawString(x, y,i == current_page ? cr_tab_highlight: cr_tab, pages[i]); |
| 2263 |
|
| 2264 |
w = M_GetPixelWidth(pages[i]); |
| 2265 |
x += w + 6; |
| 2266 |
} |
| 2267 |
} |
| 2268 |
|
| 2269 |
///////////////////////////// |
| 2270 |
// |
| 2271 |
// Data used to draw the "are you sure?" dialogue box when resetting |
| 2272 |
// to defaults. |
| 2273 |
|
| 2274 |
#define VERIFYBOXXORG 66 |
| 2275 |
#define VERIFYBOXYORG 88 |
| 2276 |
|
| 2277 |
// And the routine to draw it. |
| 2278 |
|
| 2279 |
// [FG] delete a savegame |
| 2280 |
|
| 2281 |
void M_DrawDelVerify(void) |
| 2282 |
{ |
| 2283 |
V_DrawNamePatch(VERIFYBOXXORG,VERIFYBOXYORG,0,"M_VBOX",CR_DEFAULT,VPT_STRETCH); |
| 2284 |
|
| 2285 |
if (whichSkull) { |
| 2286 |
strcpy(menu_buffer,"Delete savegame? (Y or N)"); |
| 2287 |
M_DrawMenuString(VERIFYBOXXORG + 8, VERIFYBOXYORG + 8, cr_warning); |
| 2288 |
} |
| 2289 |
} |
| 2290 |
|
| 2291 |
///////////////////////////// |
| 2292 |
// |
| 2293 |
// phares 4/18/98: |
| 2294 |
// M_DrawInstructions writes the instruction text just below the screen title |
| 2295 |
// |
| 2296 |
// cph 2006/08/06 - go back to the Boom version, and then clean up by using |
| 2297 |
// M_DrawStringCentered (much better than all those magic 'x' valies!) |
| 2298 |
|
| 2299 |
#define INSTRUCTION_Y 190 |
| 2300 |
|
| 2301 |
static void M_DrawInstructionString(int cr, const char *str) |
| 2302 |
{ |
| 2303 |
M_DrawStringCentered(160, INSTRUCTION_Y, cr, str); |
| 2304 |
} |
| 2305 |
|
| 2306 |
static void M_DrawInstructions(void) |
| 2307 |
{ |
| 2308 |
int flags = current_setup_menu[set_menu_itemon].m_flags; |
| 2309 |
|
| 2310 |
// There are different instruction messages depending on whether you |
| 2311 |
// are changing an item or just sitting on it. |
| 2312 |
|
| 2313 |
if (setup_select) { |
| 2314 |
switch (flags & (S_INPUT | S_YESNO | S_WEAP | S_NUM | S_COLOR | S_CRITEM | S_FILE | S_CHOICE | S_THERMO | S_NAME)) { |
| 2315 |
case S_INPUT: |
| 2316 |
M_DrawInstructionString(cr_info_edit, "Press key or button for this action"); |
| 2317 |
break; |
| 2318 |
case S_YESNO: |
| 2319 |
M_DrawInstructionString(cr_info_edit, "Press ENTER key to toggle"); |
| 2320 |
break; |
| 2321 |
case S_WEAP: |
| 2322 |
M_DrawInstructionString(cr_info_edit, "Enter weapon number"); |
| 2323 |
break; |
| 2324 |
case S_NUM: |
| 2325 |
M_DrawInstructionString(cr_info_edit, "Enter value. Press ENTER when finished."); |
| 2326 |
break; |
| 2327 |
case S_COLOR: |
| 2328 |
M_DrawInstructionString(cr_info_edit, "Select color and press enter"); |
| 2329 |
break; |
| 2330 |
case S_CRITEM: |
| 2331 |
M_DrawInstructionString(cr_info_edit, "Enter value"); |
| 2332 |
break; |
| 2333 |
case S_FILE: |
| 2334 |
M_DrawInstructionString(cr_info_edit, "Type/edit filename and Press ENTER"); |
| 2335 |
break; |
| 2336 |
case S_CHOICE: |
| 2337 |
M_DrawInstructionString(cr_info_edit, "Press left or right to choose"); |
| 2338 |
break; |
| 2339 |
case S_THERMO: |
| 2340 |
M_DrawInstructionString(cr_info_edit, "Press left or right to choose"); |
| 2341 |
break; |
| 2342 |
case S_NAME: |
| 2343 |
M_DrawInstructionString(cr_info_edit, "Type / edit author and Press ENTER"); |
| 2344 |
break; |
| 2345 |
default: |
| 2346 |
break; |
| 2347 |
} |
| 2348 |
} |
| 2349 |
else { |
| 2350 |
if (flags & S_INPUT) |
| 2351 |
M_DrawInstructionString(cr_info_highlight, "Press Enter to Change, Del to Clear"); |
| 2352 |
else |
| 2353 |
M_DrawInstructionString(cr_info_highlight, "Press Enter to Change"); |
| 2354 |
} |
| 2355 |
} |
| 2356 |
|
| 2357 |
#define TITLE(page_name, offset_x) { page_name, S_SKIP | S_TITLE, m_null, offset_x} |
| 2358 |
#define NEXT_PAGE(page) { "", S_SKIP | S_NEXT, m_null, 318, .menu = page } |
| 2359 |
#define PREV_PAGE(page) { "", S_SKIP | S_PREV | S_LEFTJUST, m_null, 2, .menu = page } |
| 2360 |
#define FINAL_ENTRY { 0, S_SKIP | S_END, m_null } |
| 2361 |
#define EMPTY_LINE { 0, S_SKIP, m_null } |
| 2362 |
#define NEW_COLUMN { 0, S_SKIP | S_RESET_Y, m_null } |
| 2363 |
|
| 2364 |
static void M_EnterSetup(menu_t *menu, dboolean *setup_flag, setup_menu_t *setup_menu) |
| 2365 |
{ |
| 2366 |
M_SetupNextMenu(menu); |
| 2367 |
|
| 2368 |
setup_active = true; |
| 2369 |
*setup_flag = true; |
| 2370 |
setup_select = false; |
| 2371 |
colorbox_active = false; |
| 2372 |
setup_gather = false; |
| 2373 |
|
| 2374 |
M_UpdateSetupMenu(setup_menu); |
| 2375 |
} |
| 2376 |
|
| 2377 |
///////////////////////////// |
| 2378 |
// |
| 2379 |
// The Key Binding Screen tables. |
| 2380 |
|
| 2381 |
#define KB_X 170 |
| 2382 |
|
| 2383 |
// Definitions of the (in this case) four key binding screens. |
| 2384 |
|
| 2385 |
static const char *keys_pages[] = |
| 2386 |
{ |
| 2387 |
"Movement", |
| 2388 |
"Weapons", |
| 2389 |
"Automap", |
| 2390 |
"Game", |
| 2391 |
"Misc", |
| 2392 |
"Toggles", |
| 2393 |
"Menus", |
| 2394 |
"Raven", |
| 2395 |
"Cheats", |
| 2396 |
"Scripts", |
| 2397 |
"Build", |
| 2398 |
NULL |
| 2399 |
}; |
| 2400 |
|
| 2401 |
setup_menu_t keys_movement_settings[]; |
| 2402 |
setup_menu_t keys_weapons_settings[]; |
| 2403 |
setup_menu_t keys_automap_settings[]; |
| 2404 |
setup_menu_t keys_game_settings[]; |
| 2405 |
setup_menu_t keys_misc_settings[]; |
| 2406 |
setup_menu_t keys_toggles_settings[]; |
| 2407 |
setup_menu_t keys_menus_settings[]; |
| 2408 |
setup_menu_t keys_raven_settings[]; |
| 2409 |
setup_menu_t keys_cheats_settings[]; |
| 2410 |
setup_menu_t keys_scripts_settings[]; |
| 2411 |
setup_menu_t keys_build_settings[]; |
| 2412 |
|
| 2413 |
// The table which gets you from one screen table to the next. |
| 2414 |
|
| 2415 |
setup_menu_t* keys_settings[] = |
| 2416 |
{ |
| 2417 |
keys_movement_settings, |
| 2418 |
keys_weapons_settings, |
| 2419 |
keys_automap_settings, |
| 2420 |
keys_game_settings, |
| 2421 |
keys_misc_settings, |
| 2422 |
keys_toggles_settings, |
| 2423 |
keys_menus_settings, |
| 2424 |
keys_raven_settings, |
| 2425 |
keys_cheats_settings, |
| 2426 |
keys_scripts_settings, |
| 2427 |
keys_build_settings, |
| 2428 |
NULL |
| 2429 |
}; |
| 2430 |
|
| 2431 |
// The first Key Binding screen table. |
| 2432 |
// Note that the Y values are ascending. If you need to add something to |
| 2433 |
// this table, (well, this one's not a good example, because it's full) |
| 2434 |
// you need to make sure the Y values still make sense so everything gets |
| 2435 |
// displayed. |
| 2436 |
// |
| 2437 |
// Note also that the first screen of each set has a line for the reset |
| 2438 |
// button. If there is more than one screen in a set, the others don't get |
| 2439 |
// the reset button. |
| 2440 |
// |
| 2441 |
// Note also that this screen has a "->" line. This acts like an |
| 2442 |
// item, in that 'activating' it moves you along to the next screen. If |
| 2443 |
// there's a "<-" item on a screen, it behaves similarly, moving you |
| 2444 |
// to the previous screen. If you leave these off, you can't move from |
| 2445 |
// screen to screen. |
| 2446 |
|
| 2447 |
setup_menu_t keys_movement_settings[] = // Key Binding screen strings |
| 2448 |
{ |
| 2449 |
{ "INPUT PROFILE", S_NUM, m_conf, KB_X, dsda_config_input_profile }, |
| 2450 |
EMPTY_LINE, |
| 2451 |
{"FORWARD" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_forward}, |
| 2452 |
{"BACKWARD" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_backward}, |
| 2453 |
{"TURN LEFT" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_turnleft}, |
| 2454 |
{"TURN RIGHT" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_turnright}, |
| 2455 |
{"RUN" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_speed}, |
| 2456 |
{"STRAFE LEFT" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_strafeleft}, |
| 2457 |
{"STRAFE RIGHT",S_INPUT ,m_scrn,KB_X,0,dsda_input_straferight}, |
| 2458 |
{"STRAFE" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_strafe}, |
| 2459 |
{"180 TURN" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_reverse}, |
| 2460 |
EMPTY_LINE, |
| 2461 |
{"TOGGLES" ,S_SKIP|S_TITLE,m_null,KB_X}, |
| 2462 |
{"AUTORUN" ,S_INPUT,m_scrn,KB_X,0,dsda_input_autorun}, |
| 2463 |
{"FREE LOOK",S_INPUT,m_scrn,KB_X,0,dsda_input_mlook}, |
| 2464 |
{"VERTMOUSE",S_INPUT,m_scrn,KB_X,0,dsda_input_novert}, |
| 2465 |
|
| 2466 |
NEXT_PAGE(keys_weapons_settings), |
| 2467 |
FINAL_ENTRY |
| 2468 |
}; |
| 2469 |
|
| 2470 |
setup_menu_t keys_weapons_settings[] = // Key Binding screen strings |
| 2471 |
{ |
| 2472 |
{"FIRE" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_fire}, |
| 2473 |
{"USE" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_use}, |
| 2474 |
EMPTY_LINE, |
| 2475 |
{"FIST" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_weapon1}, |
| 2476 |
{"PISTOL" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_weapon2}, |
| 2477 |
{"SHOTGUN" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_weapon3}, |
| 2478 |
{"CHAINGUN",S_INPUT ,m_scrn,KB_X,0,dsda_input_weapon4}, |
| 2479 |
{"ROCKET" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_weapon5}, |
| 2480 |
{"PLASMA" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_weapon6}, |
| 2481 |
{"BFG", S_INPUT ,m_scrn,KB_X,0,dsda_input_weapon7}, |
| 2482 |
{"CHAINSAW",S_INPUT ,m_scrn,KB_X,0,dsda_input_weapon8}, |
| 2483 |
{"SSG" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_weapon9}, |
| 2484 |
EMPTY_LINE, |
| 2485 |
{"NEXT" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_nextweapon}, |
| 2486 |
{"PREVIOUS",S_INPUT ,m_scrn,KB_X,0,dsda_input_prevweapon}, |
| 2487 |
{"BEST" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_toggleweapon}, |
| 2488 |
|
| 2489 |
PREV_PAGE(keys_movement_settings), |
| 2490 |
NEXT_PAGE(keys_automap_settings), |
| 2491 |
FINAL_ENTRY |
| 2492 |
}; |
| 2493 |
|
| 2494 |
setup_menu_t keys_automap_settings[] = // Key Binding screen strings |
| 2495 |
{ |
| 2496 |
{"TOGGLE AUTOMAP" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_map}, |
| 2497 |
EMPTY_LINE, |
| 2498 |
{"FOLLOW" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_follow}, |
| 2499 |
{"ZOOM IN" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_zoomin}, |
| 2500 |
{"ZOOM OUT" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_zoomout}, |
| 2501 |
{"SHIFT UP" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_up}, |
| 2502 |
{"SHIFT DOWN" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_down}, |
| 2503 |
{"SHIFT LEFT" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_left}, |
| 2504 |
{"SHIFT RIGHT",S_INPUT ,m_map ,KB_X,0,dsda_input_map_right}, |
| 2505 |
{"MARK PLACE" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_mark}, |
| 2506 |
{"CLEAR MARKS",S_INPUT ,m_map ,KB_X,0,dsda_input_map_clear}, |
| 2507 |
{"FULL/ZOOM" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_gobig}, |
| 2508 |
{"GRID" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_grid}, |
| 2509 |
{"ROTATE" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_rotate}, |
| 2510 |
{"OVERLAY" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_overlay}, |
| 2511 |
{"TEXTURED" ,S_INPUT ,m_map ,KB_X,0,dsda_input_map_textured}, |
| 2512 |
{ "HIGHLIGHT BY TAG", S_INPUT, m_map, KB_X, 0, dsda_input_map_highlight_by_tag }, |
| 2513 |
|
| 2514 |
PREV_PAGE(keys_weapons_settings), |
| 2515 |
NEXT_PAGE(keys_game_settings), |
| 2516 |
FINAL_ENTRY |
| 2517 |
}; |
| 2518 |
|
| 2519 |
setup_menu_t keys_game_settings[] = // Key Binding screen strings |
| 2520 |
{ |
| 2521 |
{"SAVE" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_savegame}, |
| 2522 |
{"LOAD" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_loadgame}, |
| 2523 |
{"QUICKSAVE" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_quicksave}, |
| 2524 |
{"QUICKLOAD" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_quickload}, |
| 2525 |
{"LEVEL TABLE" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_level_table}, |
| 2526 |
{"CONSOLE" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_console}, |
| 2527 |
{"END GAME" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_endgame}, |
| 2528 |
{"QUIT" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_quit}, |
| 2529 |
EMPTY_LINE, |
| 2530 |
{"SCREEN" ,S_SKIP|S_TITLE,m_null,KB_X}, |
| 2531 |
|
| 2532 |
// phares 4/13/98: |
| 2533 |
// key_escape can no longer be rebound. This keeps the |
| 2534 |
// player from getting themselves in a bind where they can't remember how |
| 2535 |
// to get to the menus |
| 2536 |
// {"MENU" ,S_SKIP|S_KEEP|S_INPUT ,m_scrn,0 ,0,dsda_input_escape}, |
| 2537 |
{"HELP" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_help}, |
| 2538 |
{"PAUSE" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_pause}, |
| 2539 |
{"VOLUME" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_soundvolume}, |
| 2540 |
{"HUD" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_hud}, |
| 2541 |
{"GAMMA FIX" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_gamma}, |
| 2542 |
{"SPY" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_spy}, |
| 2543 |
{"LARGER VIEW" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_zoomin}, |
| 2544 |
{"SMALLER VIEW",S_INPUT ,m_scrn,KB_X,0,dsda_input_zoomout}, |
| 2545 |
{"SCREENSHOT" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_screenshot}, |
| 2546 |
{"REPEAT MESSAGE",S_INPUT ,m_scrn,KB_X,0,dsda_input_repeat_message}, |
| 2547 |
|
| 2548 |
PREV_PAGE(keys_automap_settings), |
| 2549 |
NEXT_PAGE(keys_misc_settings), |
| 2550 |
FINAL_ENTRY |
| 2551 |
}; |
| 2552 |
|
| 2553 |
#define MS_X 200 |
| 2554 |
|
| 2555 |
setup_menu_t keys_misc_settings[] = |
| 2556 |
{ |
| 2557 |
{"Restart Map/Demo" ,S_INPUT ,m_scrn,MS_X,0,dsda_input_restart}, |
| 2558 |
{"Next Level" ,S_INPUT ,m_scrn,MS_X,0,dsda_input_nextlevel}, |
| 2559 |
{"Previous Level" ,S_INPUT ,m_scrn,MS_X,0,dsda_input_prevlevel}, |
| 2560 |
{ "Rewind", S_INPUT, m_scrn, MS_X, 0, dsda_input_rewind }, |
| 2561 |
{ "Store Quick Key Frame", S_INPUT, m_scrn, MS_X, 0, dsda_input_store_quick_key_frame }, |
| 2562 |
{ "Restore Quick Key Frame", S_INPUT, m_scrn, MS_X, 0, dsda_input_restore_quick_key_frame }, |
| 2563 |
{ "Fake Archvile Jump", S_INPUT, m_scrn, MS_X, 0, dsda_input_avj }, |
| 2564 |
EMPTY_LINE, |
| 2565 |
{"GAME SPEED" ,S_SKIP|S_TITLE,m_null,MS_X}, |
| 2566 |
{"SPEED UP" ,S_INPUT ,m_scrn,MS_X,0,dsda_input_speed_up}, |
| 2567 |
{"SPEED DOWN" ,S_INPUT ,m_scrn,MS_X,0,dsda_input_speed_down}, |
| 2568 |
{"RESET TO DEFAULT" ,S_INPUT ,m_scrn,MS_X,0,dsda_input_speed_default}, |
| 2569 |
EMPTY_LINE, |
| 2570 |
{"Demos" ,S_SKIP|S_TITLE,m_null,MS_X}, |
| 2571 |
{"START/STOP SKIPPING" ,S_INPUT ,m_scrn,MS_X,0,dsda_input_demo_skip}, |
| 2572 |
{"END LEVEL" ,S_INPUT ,m_scrn,MS_X,0,dsda_input_demo_endlevel}, |
| 2573 |
{"JOIN" ,S_INPUT ,m_scrn,MS_X,0,dsda_input_join_demo}, |
| 2574 |
{"CAMERA MODE" ,S_INPUT ,m_scrn,MS_X,0,dsda_input_walkcamera}, |
| 2575 |
|
| 2576 |
PREV_PAGE(keys_game_settings), |
| 2577 |
NEXT_PAGE(keys_toggles_settings), |
| 2578 |
FINAL_ENTRY |
| 2579 |
}; |
| 2580 |
|
| 2581 |
setup_menu_t keys_toggles_settings[] = { |
| 2582 |
{ "Command Display", S_INPUT, m_scrn, KB_X, 0, dsda_input_command_display }, |
| 2583 |
{ "Coordinate Display", S_INPUT, m_scrn, KB_X, 0, dsda_input_coordinate_display }, |
| 2584 |
{ "Strict Mode", S_INPUT, m_scrn, KB_X, 0, dsda_input_strict_mode }, |
| 2585 |
{ "Extended HUD", S_INPUT, m_scrn, KB_X, 0, dsda_input_exhud }, |
| 2586 |
{ "SFX", S_INPUT, m_scrn, KB_X, 0, dsda_input_mute_sfx }, |
| 2587 |
{ "Music", S_INPUT, m_scrn, KB_X, 0, dsda_input_mute_music }, |
| 2588 |
{ "Messages" ,S_INPUT ,m_scrn, KB_X, 0, dsda_input_messages}, |
| 2589 |
{ "Cheat Code Entry", S_INPUT, m_scrn, KB_X, 0, dsda_input_cheat_codes }, |
| 2590 |
{ "Render Stats", S_INPUT, m_scrn, KB_X, 0, dsda_input_idrate }, |
| 2591 |
{ "FPS", S_INPUT, m_scrn, KB_X, 0, dsda_input_fps }, |
| 2592 |
{"Show Alive Monsters" ,S_INPUT ,m_scrn,KB_X,0,dsda_input_showalive}, |
| 2593 |
EMPTY_LINE, |
| 2594 |
{ "Cycle", S_SKIP | S_TITLE, m_null, KB_X}, |
| 2595 |
{ "Cycle Input Profile", S_INPUT, m_scrn, KB_X, 0, dsda_input_cycle_profile }, |
| 2596 |
{ "Cycle Palette", S_INPUT, m_scrn, KB_X, 0, dsda_input_cycle_palette }, |
| 2597 |
|
| 2598 |
PREV_PAGE(keys_misc_settings), |
| 2599 |
NEXT_PAGE(keys_menus_settings), |
| 2600 |
FINAL_ENTRY |
| 2601 |
}; |
| 2602 |
|
| 2603 |
setup_menu_t keys_menus_settings[] = |
| 2604 |
{ |
| 2605 |
{"NEXT ITEM" ,S_INPUT ,m_menu,KB_X,0,dsda_input_menu_down}, |
| 2606 |
{"PREV ITEM" ,S_INPUT ,m_menu,KB_X,0,dsda_input_menu_up}, |
| 2607 |
{"LEFT" ,S_INPUT ,m_menu,KB_X,0,dsda_input_menu_left}, |
| 2608 |
{"RIGHT" ,S_INPUT ,m_menu,KB_X,0,dsda_input_menu_right}, |
| 2609 |
{"BACKSPACE" ,S_INPUT ,m_menu,KB_X,0,dsda_input_menu_backspace}, |
| 2610 |
{ "SELECT ITEM", S_INPUT | S_NOCLEAR, m_menu, KB_X, 0, dsda_input_menu_enter }, |
| 2611 |
{"EXIT" ,S_INPUT ,m_menu,KB_X,0,dsda_input_menu_escape}, |
| 2612 |
{"CLEAR" ,S_INPUT ,m_menu,KB_X,0,dsda_input_menu_clear}, |
| 2613 |
|
| 2614 |
PREV_PAGE(keys_toggles_settings), |
| 2615 |
NEXT_PAGE(keys_raven_settings), |
| 2616 |
FINAL_ENTRY |
| 2617 |
}; |
| 2618 |
|
| 2619 |
setup_menu_t keys_raven_settings[] = { |
| 2620 |
{ "LOOK UP", S_INPUT, m_scrn, MS_X, 0, dsda_input_lookup }, |
| 2621 |
{ "LOOK DOWN", S_INPUT, m_scrn, MS_X, 0, dsda_input_lookdown }, |
| 2622 |
{ "LOOK CENTER", S_INPUT, m_scrn, MS_X, 0, dsda_input_lookcenter }, |
| 2623 |
{ "FLY UP", S_INPUT, m_scrn, MS_X, 0, dsda_input_flyup }, |
| 2624 |
{ "FLY DOWN", S_INPUT, m_scrn, MS_X, 0, dsda_input_flydown }, |
| 2625 |
{ "FLY CENTER", S_INPUT, m_scrn, MS_X, 0, dsda_input_flycenter }, |
| 2626 |
{ "JUMP", S_INPUT, m_scrn, MS_X, 0, dsda_input_jump }, |
| 2627 |
EMPTY_LINE, |
| 2628 |
{ "INVENTORY LEFT", S_INPUT, m_scrn, MS_X, 0, dsda_input_invleft }, |
| 2629 |
{ "INVENTORY RIGHT", S_INPUT, m_scrn, MS_X, 0, dsda_input_invright }, |
| 2630 |
{ "USE ARTIFACT", S_INPUT, m_scrn, MS_X, 0, dsda_input_use_artifact }, |
| 2631 |
EMPTY_LINE, |
| 2632 |
{ "HERETIC INVENTORY", S_SKIP | S_TITLE, m_null, MS_X}, |
| 2633 |
{ "USE TOME OF POWER", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_tome }, |
| 2634 |
{ "USE QUARTZ FLASK", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_quartz }, |
| 2635 |
{ "USE MYSTIC URN", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_urn }, |
| 2636 |
{ "USE TIMEBOMB", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_bomb }, |
| 2637 |
{ "USE RING OF INVINCIBILITY", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_ring }, |
| 2638 |
{ "USE CHAOS DEVICE", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_chaosdevice }, |
| 2639 |
{ "USE SHADOWSPHERE", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_shadowsphere }, |
| 2640 |
{ "USE WINGS OF WRATH", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_wings }, |
| 2641 |
{ "USE TORCH", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_torch }, |
| 2642 |
{ "USE MORPH OVUM", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_morph }, |
| 2643 |
EMPTY_LINE, |
| 2644 |
{ "HEXEN INVENTORY", S_SKIP | S_TITLE, m_null, MS_X}, |
| 2645 |
{ "USE ICON OF THE DEFENDER", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_ring }, |
| 2646 |
{ "USE QUARTZ FLASK", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_quartz }, |
| 2647 |
{ "USE MYSTIC URN", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_urn }, |
| 2648 |
{ "USE MYSTIC AMBIT INCANT", S_INPUT, m_scrn, MS_X, 0, dsda_input_hexen_arti_incant }, |
| 2649 |
{ "USE DARK SERVANT", S_INPUT, m_scrn, MS_X, 0, dsda_input_hexen_arti_summon }, |
| 2650 |
{ "USE TORCH", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_torch }, |
| 2651 |
{ "USE PORKALATOR", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_morph }, |
| 2652 |
{ "USE WINGS OF WRATH", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_wings }, |
| 2653 |
{ "USE DISC OF REPULSION", S_INPUT, m_scrn, MS_X, 0, dsda_input_hexen_arti_disk }, |
| 2654 |
{ "USE FLECHETTE", S_INPUT, m_scrn, MS_X, 0, dsda_input_hexen_arti_flechette }, |
| 2655 |
{ "USE BANISHMENT DEVICE", S_INPUT, m_scrn, MS_X, 0, dsda_input_hexen_arti_banishment }, |
| 2656 |
{ "USE BOOTS OF SPEED", S_INPUT, m_scrn, MS_X, 0, dsda_input_hexen_arti_boots }, |
| 2657 |
{ "USE KRATER OF MIGHT", S_INPUT, m_scrn, MS_X, 0, dsda_input_hexen_arti_krater }, |
| 2658 |
{ "USE DRAGONSKIN BRACERS", S_INPUT, m_scrn, MS_X, 0, dsda_input_hexen_arti_bracers }, |
| 2659 |
{ "USE CHAOS DEVICE", S_INPUT, m_scrn, MS_X, 0, dsda_input_arti_chaosdevice }, |
| 2660 |
|
| 2661 |
PREV_PAGE(keys_menus_settings), |
| 2662 |
NEXT_PAGE(keys_cheats_settings), |
| 2663 |
FINAL_ENTRY |
| 2664 |
}; |
| 2665 |
|
| 2666 |
setup_menu_t keys_cheats_settings[] = |
| 2667 |
{ |
| 2668 |
{ "God Mode", S_INPUT, m_scrn, KB_X, 0, dsda_input_iddqd }, |
| 2669 |
{ "Ammo & Keys", S_INPUT, m_scrn, KB_X, 0, dsda_input_idkfa }, |
| 2670 |
{ "Ammo", S_INPUT, m_scrn, KB_X, 0, dsda_input_idfa }, |
| 2671 |
{ "No Clipping", S_INPUT, m_scrn, KB_X, 0, dsda_input_idclip }, |
| 2672 |
{ "Health", S_INPUT, m_scrn, KB_X, 0, dsda_input_idbeholdh }, |
| 2673 |
{ "Armor", S_INPUT, m_scrn, KB_X, 0, dsda_input_idbeholdm }, |
| 2674 |
{ "Invulnerability", S_INPUT, m_scrn, KB_X, 0, dsda_input_idbeholdv }, |
| 2675 |
{ "Berserk", S_INPUT, m_scrn, KB_X, 0, dsda_input_idbeholds }, |
| 2676 |
{ "Partial Invisibility", S_INPUT, m_scrn, KB_X, 0, dsda_input_idbeholdi }, |
| 2677 |
{ "Radiation Suit", S_INPUT, m_scrn, KB_X, 0, dsda_input_idbeholdr }, |
| 2678 |
{ "Computer Area Map", S_INPUT, m_scrn, KB_X, 0, dsda_input_idbeholda }, |
| 2679 |
{ "Light Amplification", S_INPUT, m_scrn, KB_X, 0, dsda_input_idbeholdl }, |
| 2680 |
{ "Show Position", S_INPUT, m_scrn, KB_X, 0, dsda_input_idmypos }, |
| 2681 |
{ "Reveal Map", S_INPUT, m_scrn, KB_X, 0, dsda_input_iddt }, |
| 2682 |
{ "Reset Health", S_INPUT, m_scrn, KB_X, 0, dsda_input_ponce }, |
| 2683 |
{ "Tome of Power", S_INPUT, m_scrn, KB_X, 0, dsda_input_shazam }, |
| 2684 |
{ "Chicken", S_INPUT, m_scrn, KB_X, 0, dsda_input_chicken }, |
| 2685 |
{ "No Target", S_INPUT, m_scrn, KB_X, 0, dsda_input_notarget }, |
| 2686 |
{ "Freeze", S_INPUT, m_scrn, KB_X, 0, dsda_input_freeze }, |
| 2687 |
|
| 2688 |
PREV_PAGE(keys_raven_settings), |
| 2689 |
NEXT_PAGE(keys_scripts_settings), |
| 2690 |
FINAL_ENTRY |
| 2691 |
}; |
| 2692 |
|
| 2693 |
setup_menu_t keys_scripts_settings[] = { |
| 2694 |
{ "Script 0", S_INPUT, m_scrn, KB_X, 0, dsda_input_script_0 }, |
| 2695 |
{ "Script 1", S_INPUT, m_scrn, KB_X, 0, dsda_input_script_1 }, |
| 2696 |
{ "Script 2", S_INPUT, m_scrn, KB_X, 0, dsda_input_script_2 }, |
| 2697 |
{ "Script 3", S_INPUT, m_scrn, KB_X, 0, dsda_input_script_3 }, |
| 2698 |
{ "Script 4", S_INPUT, m_scrn, KB_X, 0, dsda_input_script_4 }, |
| 2699 |
{ "Script 5", S_INPUT, m_scrn, KB_X, 0, dsda_input_script_5 }, |
| 2700 |
{ "Script 6", S_INPUT, m_scrn, KB_X, 0, dsda_input_script_6 }, |
| 2701 |
{ "Script 7", S_INPUT, m_scrn, KB_X, 0, dsda_input_script_7 }, |
| 2702 |
{ "Script 8", S_INPUT, m_scrn, KB_X, 0, dsda_input_script_8 }, |
| 2703 |
{ "Script 9", S_INPUT, m_scrn, KB_X, 0, dsda_input_script_9 }, |
| 2704 |
|
| 2705 |
PREV_PAGE(keys_cheats_settings), |
| 2706 |
NEXT_PAGE(keys_build_settings), |
| 2707 |
FINAL_ENTRY |
| 2708 |
}; |
| 2709 |
|
| 2710 |
setup_menu_t keys_build_settings[] = { |
| 2711 |
{ "Toggle Build Mode", S_INPUT, m_scrn, KB_X, 0, dsda_input_build }, |
| 2712 |
EMPTY_LINE, |
| 2713 |
{ "Advance Frame", S_INPUT, m_build, KB_X, 0, dsda_input_build_advance_frame }, |
| 2714 |
{ "Reverse Frame", S_INPUT, m_build, KB_X, 0, dsda_input_build_reverse_frame }, |
| 2715 |
{ "Reset Command", S_INPUT, m_build, KB_X, 0, dsda_input_build_reset_command }, |
| 2716 |
{ "Toggle Source", S_INPUT, m_build, KB_X, 0, dsda_input_build_source }, |
| 2717 |
EMPTY_LINE, |
| 2718 |
{ "Controls", S_SKIP | S_TITLE, m_null, KB_X}, |
| 2719 |
{ "Forward", S_INPUT, m_build, KB_X, 0, dsda_input_build_forward }, |
| 2720 |
{ "Backward", S_INPUT, m_build, KB_X, 0, dsda_input_build_backward }, |
| 2721 |
{ "Fine Forward", S_INPUT, m_build, KB_X, 0, dsda_input_build_fine_forward }, |
| 2722 |
{ "Fine Backward", S_INPUT, m_build, KB_X, 0, dsda_input_build_fine_backward }, |
| 2723 |
{ "Turn Left", S_INPUT, m_build, KB_X, 0, dsda_input_build_turn_left }, |
| 2724 |
{ "Turn Right", S_INPUT, m_build, KB_X, 0, dsda_input_build_turn_right }, |
| 2725 |
{ "Strafe Left", S_INPUT, m_build, KB_X, 0, dsda_input_build_strafe_left }, |
| 2726 |
{ "Strafe Right", S_INPUT, m_build, KB_X, 0, dsda_input_build_strafe_right }, |
| 2727 |
{ "Fine Strafe Left", S_INPUT, m_build, KB_X, 0, dsda_input_build_fine_strafe_left }, |
| 2728 |
{ "Fine Strafe Right", S_INPUT, m_build, KB_X, 0, dsda_input_build_fine_strafe_right }, |
| 2729 |
EMPTY_LINE, |
| 2730 |
{ "Use", S_INPUT, m_build, KB_X, 0, dsda_input_build_use }, |
| 2731 |
{ "Fire", S_INPUT, m_build, KB_X, 0, dsda_input_build_fire }, |
| 2732 |
{ "Fist", S_INPUT, m_build, KB_X, 0, dsda_input_build_weapon1 }, |
| 2733 |
{ "Pistol", S_INPUT, m_build, KB_X, 0, dsda_input_build_weapon2 }, |
| 2734 |
{ "Shotgun", S_INPUT, m_build, KB_X, 0, dsda_input_build_weapon3 }, |
| 2735 |
{ "Chaingun", S_INPUT, m_build, KB_X, 0, dsda_input_build_weapon4 }, |
| 2736 |
{ "Rocket", S_INPUT, m_build, KB_X, 0, dsda_input_build_weapon5 }, |
| 2737 |
{ "Plasma", S_INPUT, m_build, KB_X, 0, dsda_input_build_weapon6 }, |
| 2738 |
{ "BFG", S_INPUT, m_build, KB_X, 0, dsda_input_build_weapon7 }, |
| 2739 |
{ "Chainsaw", S_INPUT, m_build, KB_X, 0, dsda_input_build_weapon8 }, |
| 2740 |
{ "SSG", S_INPUT, m_build, KB_X, 0, dsda_input_build_weapon9 }, |
| 2741 |
|
| 2742 |
PREV_PAGE(keys_scripts_settings), |
| 2743 |
FINAL_ENTRY |
| 2744 |
}; |
| 2745 |
|
| 2746 |
// Setting up for the Key Binding screen. Turn on flags, set pointers, |
| 2747 |
// locate the first item on the screen where the cursor is allowed to |
| 2748 |
// land. |
| 2749 |
|
| 2750 |
static void M_KeyBindings(int choice) |
| 2751 |
{ |
| 2752 |
M_EnterSetup(&KeybndDef, &set_keybnd_active, keys_settings[0]); |
| 2753 |
} |
| 2754 |
|
| 2755 |
// The drawing part of the Key Bindings Setup initialization. Draw the |
| 2756 |
// background, title, instruction line, and items. |
| 2757 |
|
| 2758 |
static void M_DrawKeybnd(void) |
| 2759 |
{ |
| 2760 |
M_ChangeMenu(NULL, mnact_full); |
| 2761 |
|
| 2762 |
// Set up the Key Binding screen |
| 2763 |
|
| 2764 |
M_DrawBackground(g_menu_flat, 0); // Draw background |
| 2765 |
|
| 2766 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 2767 |
M_DrawTitle(2, "KEY BINDINGS", cr_title); // M_KEYBND |
| 2768 |
M_DrawInstructions(); |
| 2769 |
M_DrawTabs(keys_pages, 5, TABS_Y); |
| 2770 |
M_DrawScreenItems(current_setup_menu, DEFAULT_LIST_Y); |
| 2771 |
} |
| 2772 |
|
| 2773 |
///////////////////////////// |
| 2774 |
// |
| 2775 |
// The Weapon Screen tables. |
| 2776 |
|
| 2777 |
#define WP_X 203 |
| 2778 |
|
| 2779 |
static const char *weapon_attack_alignment_strings[] = { |
| 2780 |
"OFF", "HORIZONTAL", "CENTERED", "BOBBING", NULL |
| 2781 |
}; |
| 2782 |
|
| 2783 |
// There's only one weapon settings screen (for now). But since we're |
| 2784 |
// trying to fit a common description for screens, it gets a setup_menu_t, |
| 2785 |
// which only has one screen definition in it. |
| 2786 |
// |
| 2787 |
// Note that this screen has no PREV or NEXT items, since there are no |
| 2788 |
// neighboring screens. |
| 2789 |
|
| 2790 |
static const char *weap_pages[] = |
| 2791 |
{ |
| 2792 |
"Priority", |
| 2793 |
NULL |
| 2794 |
}; |
| 2795 |
|
| 2796 |
setup_menu_t weap_priority_settings[]; |
| 2797 |
|
| 2798 |
setup_menu_t* weap_settings[] = |
| 2799 |
{ |
| 2800 |
weap_priority_settings, |
| 2801 |
NULL |
| 2802 |
}; |
| 2803 |
|
| 2804 |
setup_menu_t weap_priority_settings[] = // Weapons Settings screen |
| 2805 |
{ |
| 2806 |
{ "1ST CHOICE WEAPON", S_WEAP, m_conf, WP_X, dsda_config_weapon_choice_1 }, |
| 2807 |
{ "2nd CHOICE WEAPON", S_WEAP, m_conf, WP_X, dsda_config_weapon_choice_2 }, |
| 2808 |
{ "3rd CHOICE WEAPON", S_WEAP, m_conf, WP_X, dsda_config_weapon_choice_3 }, |
| 2809 |
{ "4th CHOICE WEAPON", S_WEAP, m_conf, WP_X, dsda_config_weapon_choice_4 }, |
| 2810 |
{ "5th CHOICE WEAPON", S_WEAP, m_conf, WP_X, dsda_config_weapon_choice_5 }, |
| 2811 |
{ "6th CHOICE WEAPON", S_WEAP, m_conf, WP_X, dsda_config_weapon_choice_6 }, |
| 2812 |
{ "7th CHOICE WEAPON", S_WEAP, m_conf, WP_X, dsda_config_weapon_choice_7 }, |
| 2813 |
{ "8th CHOICE WEAPON", S_WEAP, m_conf, WP_X, dsda_config_weapon_choice_8 }, |
| 2814 |
{ "9th CHOICE WEAPON", S_WEAP, m_conf, WP_X, dsda_config_weapon_choice_9 }, |
| 2815 |
|
| 2816 |
FINAL_ENTRY |
| 2817 |
}; |
| 2818 |
|
| 2819 |
// Setting up for the Weapons screen. Turn on flags, set pointers, |
| 2820 |
// locate the first item on the screen where the cursor is allowed to |
| 2821 |
// land. |
| 2822 |
|
| 2823 |
static void M_Weapons(int choice) |
| 2824 |
{ |
| 2825 |
M_EnterSetup(&WeaponDef, &set_weapon_active, weap_settings[0]); |
| 2826 |
} |
| 2827 |
|
| 2828 |
|
| 2829 |
// The drawing part of the Weapons Setup initialization. Draw the |
| 2830 |
// background, title, instruction line, and items. |
| 2831 |
|
| 2832 |
static void M_DrawWeapons(void) |
| 2833 |
{ |
| 2834 |
M_ChangeMenu(NULL, mnact_full); |
| 2835 |
|
| 2836 |
M_DrawBackground(g_menu_flat, 0); // Draw background |
| 2837 |
|
| 2838 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 2839 |
M_DrawTitle(2, "WEAPONS", cr_title); // M_WEAP |
| 2840 |
M_DrawInstructions(); |
| 2841 |
M_DrawTabs(weap_pages, sizeof(weap_pages), TABS_Y); |
| 2842 |
M_DrawScreenItems(current_setup_menu, DEFAULT_LIST_Y); |
| 2843 |
} |
| 2844 |
|
| 2845 |
///////////////////////////// |
| 2846 |
// |
| 2847 |
// The Demos tables. |
| 2848 |
|
| 2849 |
#define DM_X 203 |
| 2850 |
|
| 2851 |
// Screen table definitions |
| 2852 |
|
| 2853 |
static const char *demos_pages[] = |
| 2854 |
{ |
| 2855 |
"Options", |
| 2856 |
"TAS", |
| 2857 |
NULL |
| 2858 |
}; |
| 2859 |
|
| 2860 |
setup_menu_t demos_options_settings[]; |
| 2861 |
setup_menu_t demos_tas_settings[]; |
| 2862 |
|
| 2863 |
setup_menu_t* demos_settings[] = |
| 2864 |
{ |
| 2865 |
demos_options_settings, |
| 2866 |
demos_tas_settings, |
| 2867 |
NULL |
| 2868 |
}; |
| 2869 |
|
| 2870 |
setup_menu_t demos_options_settings[] = // Demos Settings screen |
| 2871 |
{ |
| 2872 |
{ "Show Demo Attempts", S_YESNO, m_conf, DM_X, dsda_config_show_demo_attempts }, |
| 2873 |
{ "Show Split Data", S_YESNO, m_conf, DM_X, dsda_config_show_split_data }, |
| 2874 |
{ "Precise Intermission Time", S_YESNO, m_conf, DM_X, dsda_config_show_level_splits }, |
| 2875 |
{ "Quickstart Cache Tics", S_NUM, m_conf, DM_X, dsda_config_quickstart_cache_tics }, |
| 2876 |
{ "Text File Author", S_NAME, m_conf, DM_X, dsda_config_player_name }, |
| 2877 |
EMPTY_LINE, |
| 2878 |
{ "Playback Progress Bar", S_YESNO, m_conf, DM_X, dsda_config_hudadd_demoprogressbar }, |
| 2879 |
{ "Playback Mouse Controls", S_YESNO, m_conf, DM_X, dsda_config_playback_mouse_controls }, |
| 2880 |
{ "Smooth Playback", S_YESNO, m_conf, DM_X, dsda_config_demo_smoothturns }, |
| 2881 |
{ "Smooth Playback Factor", S_NUM, m_conf, DM_X, dsda_config_demo_smoothturnsfactor }, |
| 2882 |
{ "Cycle Ghost Colors", S_YESNO, m_conf, DM_X, dsda_config_cycle_ghost_colors }, |
| 2883 |
{ "Organize Failed Demos", S_YESNO, m_conf, DM_X, dsda_config_organize_failed_demos }, |
| 2884 |
|
| 2885 |
NEXT_PAGE(demos_tas_settings), |
| 2886 |
FINAL_ENTRY |
| 2887 |
}; |
| 2888 |
|
| 2889 |
setup_menu_t demos_tas_settings[] = |
| 2890 |
{ |
| 2891 |
{ "Strict Mode", S_YESNO, m_conf, DM_X, dsda_config_strict_mode }, |
| 2892 |
EMPTY_LINE, |
| 2893 |
{ "Wipe At Full Speed", S_YESNO, m_conf, DM_X, dsda_config_wipe_at_full_speed }, |
| 2894 |
{ "Show Command Display", S_YESNO, m_conf, DM_X, dsda_config_command_display }, |
| 2895 |
{ "Command History", S_NUM, m_conf, DM_X, dsda_config_command_history_size }, |
| 2896 |
{ "Hide Empty Commands", S_YESNO, m_conf, DM_X, dsda_config_hide_empty_commands }, |
| 2897 |
{ "Show Coordinate Display", S_YESNO, m_conf, DM_X, dsda_config_coordinate_display }, |
| 2898 |
EMPTY_LINE, |
| 2899 |
{ "Permanent Strafe50", S_YESNO, m_conf, DM_X, dsda_config_movement_strafe50 }, |
| 2900 |
{ "Strafe50 On Turns", S_YESNO, m_conf, DM_X, dsda_config_movement_strafe50onturns }, |
| 2901 |
|
| 2902 |
PREV_PAGE(demos_options_settings), |
| 2903 |
FINAL_ENTRY |
| 2904 |
}; |
| 2905 |
|
| 2906 |
// Setting up for the Demos screen. Turn on flags, set pointers, |
| 2907 |
// locate the first item on the screen where the cursor is allowed to |
| 2908 |
// land. |
| 2909 |
|
| 2910 |
static void M_Demos(int choice) |
| 2911 |
{ |
| 2912 |
M_EnterSetup(&DemosDef, &set_demos_active, demos_settings[0]); |
| 2913 |
} |
| 2914 |
|
| 2915 |
// The drawing part of the Demos Setup initialization. Draw the |
| 2916 |
// background, title, instruction line, and items. |
| 2917 |
|
| 2918 |
static void M_DrawDemos(void) |
| 2919 |
{ |
| 2920 |
M_ChangeMenu(NULL, mnact_full); |
| 2921 |
|
| 2922 |
M_DrawBackground(g_menu_flat, 0); // Draw background |
| 2923 |
|
| 2924 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 2925 |
M_DrawTitle(2, "DEMOS", cr_title); // M_DEMOS |
| 2926 |
M_DrawInstructions(); |
| 2927 |
M_DrawTabs(demos_pages, sizeof(demos_pages), TABS_Y); |
| 2928 |
M_DrawScreenItems(current_setup_menu, DEFAULT_LIST_Y); |
| 2929 |
} |
| 2930 |
|
| 2931 |
|
| 2932 |
///////////////////////////// |
| 2933 |
// |
| 2934 |
// The Automap tables. |
| 2935 |
|
| 2936 |
#define AU_X 260 |
| 2937 |
#define AA_X 240 |
| 2938 |
|
| 2939 |
static const char *auto_pages[] = |
| 2940 |
{ |
| 2941 |
"Options", |
| 2942 |
"Appearance", |
| 2943 |
"Colors", |
| 2944 |
NULL |
| 2945 |
}; |
| 2946 |
|
| 2947 |
setup_menu_t auto_options_settings[]; |
| 2948 |
setup_menu_t auto_appearance_settings[]; |
| 2949 |
setup_menu_t auto_colors_settings[]; |
| 2950 |
|
| 2951 |
setup_menu_t* auto_settings[] = |
| 2952 |
{ |
| 2953 |
auto_options_settings, |
| 2954 |
auto_appearance_settings, |
| 2955 |
auto_colors_settings, |
| 2956 |
NULL |
| 2957 |
}; |
| 2958 |
|
| 2959 |
static const char *map_things_appearance_list[] = |
| 2960 |
{ |
| 2961 |
"classic", |
| 2962 |
"scaled", |
| 2963 |
#if defined(HAVE_LIBSDL2_IMAGE) |
| 2964 |
"icons", |
| 2965 |
#endif |
| 2966 |
"hitboxes", |
| 2967 |
NULL |
| 2968 |
}; |
| 2969 |
|
| 2970 |
setup_menu_t auto_options_settings[] = |
| 2971 |
{ |
| 2972 |
{ "Locked doors blink", S_YESNO, m_conf, AU_X, dsda_config_map_blinking_locks }, |
| 2973 |
{ "Show Secrets only after entering", S_YESNO, m_conf, AU_X, dsda_config_map_secret_after }, |
| 2974 |
{ "Grid cell size 8..256, -1 for auto", S_NUM, m_conf, AU_X, dsda_config_map_grid_size }, |
| 2975 |
{ "Pan speed (1..32)", S_NUM, m_conf, AU_X, dsda_config_map_pan_speed }, |
| 2976 |
{ "Zoom speed (1..32)", S_NUM, m_conf, AU_X, dsda_config_map_scroll_speed }, |
| 2977 |
{ "Use mouse wheel for zooming", S_YESNO, m_conf, AU_X, dsda_config_map_wheel_zoom }, |
| 2978 |
{ "Show Minimap", S_YESNO, m_conf, AU_X, dsda_config_show_minimap }, |
| 2979 |
EMPTY_LINE, |
| 2980 |
{ "Components", S_SKIP | S_TITLE, m_null, AU_X}, |
| 2981 |
{ "Stat Totals", S_YESNO, m_conf, AU_X, dsda_config_map_totals }, |
| 2982 |
{ "Player Coordinates", S_YESNO, m_conf, AU_X, dsda_config_map_coordinates }, |
| 2983 |
{ "Level / Total Time", S_YESNO, m_conf, AU_X, dsda_config_map_time }, |
| 2984 |
{ "Level Title", S_YESNO, m_conf, AU_X, dsda_config_map_title }, |
| 2985 |
|
| 2986 |
NEXT_PAGE(auto_appearance_settings), |
| 2987 |
FINAL_ENTRY |
| 2988 |
}; |
| 2989 |
|
| 2990 |
#define T_X 180 |
| 2991 |
|
| 2992 |
setup_menu_t auto_appearance_settings[] = |
| 2993 |
{ |
| 2994 |
{ "Enable textured display", S_YESNO, m_conf, AA_X, dsda_config_map_textured }, |
| 2995 |
{ "Things appearance", S_CHOICE, m_conf, AA_X, dsda_config_map_things_appearance, 0, map_things_appearance_list }, |
| 2996 |
EMPTY_LINE, |
| 2997 |
{ "Translucency percentage", S_SKIP | S_TITLE, m_null, AA_X}, |
| 2998 |
{ "Textured automap", S_NUM, m_conf, AA_X, dsda_config_map_textured_trans }, |
| 2999 |
{ "Textured automap on overlay", S_NUM, m_conf, AA_X, dsda_config_map_textured_overlay_trans }, |
| 3000 |
{ "Lines on overlay", S_NUM, m_conf, AA_X, dsda_config_map_lines_overlay_trans }, |
| 3001 |
EMPTY_LINE, |
| 3002 |
{ "Trail", S_SKIP | S_TITLE, m_null, AA_X}, |
| 3003 |
{ "Player Trail", S_YESNO, m_conf, AA_X, dsda_config_map_trail }, |
| 3004 |
{ "Include Collisions", S_YESNO, m_conf, AA_X, dsda_config_map_trail_collisions }, |
| 3005 |
{ "Player Trail Size", S_NUM, m_conf, AA_X, dsda_config_map_trail_size }, |
| 3006 |
|
| 3007 |
PREV_PAGE(auto_options_settings), |
| 3008 |
NEXT_PAGE(auto_colors_settings), |
| 3009 |
FINAL_ENTRY |
| 3010 |
}; |
| 3011 |
|
| 3012 |
setup_menu_t auto_colors_settings[] = // 2st AutoMap Settings screen |
| 3013 |
{ |
| 3014 |
{"background", S_COLOR, m_conf, AU_X, dsda_config_mapcolor_back}, |
| 3015 |
{"grid lines", S_COLOR, m_conf, AU_X, dsda_config_mapcolor_grid}, |
| 3016 |
{"normal 1s wall", S_COLOR, m_conf,AU_X, dsda_config_mapcolor_wall}, |
| 3017 |
{"line at floor height change", S_COLOR, m_conf, AU_X, dsda_config_mapcolor_fchg}, |
| 3018 |
{"line at ceiling height change" ,S_COLOR,m_conf,AU_X, dsda_config_mapcolor_cchg}, |
| 3019 |
{"line at sector with floor = ceiling",S_COLOR,m_conf,AU_X, dsda_config_mapcolor_clsd}, |
| 3020 |
{"red key" ,S_COLOR,m_conf,AU_X, dsda_config_mapcolor_rkey}, |
| 3021 |
{"blue key" ,S_COLOR,m_conf,AU_X, dsda_config_mapcolor_bkey}, |
| 3022 |
{"yellow key" ,S_COLOR,m_conf,AU_X, dsda_config_mapcolor_ykey}, |
| 3023 |
{"red door" ,S_COLOR,m_conf,AU_X, dsda_config_mapcolor_rdor}, |
| 3024 |
{"blue door" ,S_COLOR,m_conf,AU_X, dsda_config_mapcolor_bdor}, |
| 3025 |
{"yellow door" ,S_COLOR,m_conf,AU_X, dsda_config_mapcolor_ydor}, |
| 3026 |
EMPTY_LINE, |
| 3027 |
{"teleporter line" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_tele}, |
| 3028 |
{"secret sector boundary" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_secr}, |
| 3029 |
{"revealed secret sector boundary",S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_revsecr}, |
| 3030 |
{"tag finder line" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_tagfinder}, |
| 3031 |
//jff 4/23/98 add exit line to automap |
| 3032 |
{"exit line" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_exit}, |
| 3033 |
{"alt secret exit line" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_exitsecr}, |
| 3034 |
{"computer map unseen line" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_unsn}, |
| 3035 |
{"line w/no floor/ceiling changes",S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_flat}, |
| 3036 |
{"general sprite" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_sprt}, |
| 3037 |
{"pickup sprite" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_pickup}, |
| 3038 |
{"countable enemy sprite" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_enemy}, // cph 2006/06/30 |
| 3039 |
{"countable item sprite" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_item}, // mead 3/4/2003 |
| 3040 |
{"crosshair" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_hair}, |
| 3041 |
{"single player arrow" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_sngl}, |
| 3042 |
{"your colour in multiplayer" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_me}, |
| 3043 |
EMPTY_LINE, |
| 3044 |
{"friends" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_frnd}, // killough 8/8/98 |
| 3045 |
EMPTY_LINE, |
| 3046 |
{"player trail 1" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_trail_1}, |
| 3047 |
{"player trail 2" ,S_COLOR ,m_conf,AU_X, dsda_config_mapcolor_trail_2}, |
| 3048 |
|
| 3049 |
PREV_PAGE(auto_appearance_settings), |
| 3050 |
FINAL_ENTRY |
| 3051 |
}; |
| 3052 |
|
| 3053 |
// Setting up for the Automap screen. Turn on flags, set pointers, |
| 3054 |
// locate the first item on the screen where the cursor is allowed to |
| 3055 |
// land. |
| 3056 |
|
| 3057 |
static void M_Automap(int choice) |
| 3058 |
{ |
| 3059 |
M_EnterSetup(&AutoMapDef, &set_auto_active, auto_settings[0]); |
| 3060 |
} |
| 3061 |
|
| 3062 |
// Data used by the color palette that is displayed for the player to |
| 3063 |
// select colors. |
| 3064 |
|
| 3065 |
int color_palette_x; // X position of the cursor on the color palette |
| 3066 |
int color_palette_y; // Y position of the cursor on the color palette |
| 3067 |
|
| 3068 |
// M_DrawColPal() draws the color palette when the user needs to select a |
| 3069 |
// color. |
| 3070 |
|
| 3071 |
// phares 4/1/98: now uses a single lump for the palette instead of |
| 3072 |
// building the image out of individual paint chips. |
| 3073 |
|
| 3074 |
static void M_DrawColPal(void) |
| 3075 |
{ |
| 3076 |
int cpx, cpy; |
| 3077 |
|
| 3078 |
// Draw a background, border, and paint chips |
| 3079 |
|
| 3080 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 3081 |
// CPhipps - patch drawing updated |
| 3082 |
V_DrawNamePatch(COLORPALXORIG-5, COLORPALYORIG-5, 0, "M_COLORS", CR_DEFAULT, VPT_STRETCH); |
| 3083 |
|
| 3084 |
// Draw the cursor around the paint chip |
| 3085 |
// (cpx,cpy) is the upper left-hand corner of the paint chip |
| 3086 |
|
| 3087 |
cpx = COLORPALXORIG+color_palette_x*(CHIP_SIZE)-1; |
| 3088 |
cpy = COLORPALYORIG+color_palette_y*(CHIP_SIZE)-1; |
| 3089 |
// proff 12/6/98: Drawing of colorchips completly changed for hi-res, it now uses a patch |
| 3090 |
V_DrawNamePatch(cpx,cpy,0,"M_PALSEL",CR_DEFAULT,VPT_STRETCH); // PROFF_GL_FIX |
| 3091 |
} |
| 3092 |
|
| 3093 |
// The drawing part of the Automap Setup initialization. Draw the |
| 3094 |
// background, title, instruction line, and items. |
| 3095 |
|
| 3096 |
static void M_DrawAutoMap(void) |
| 3097 |
{ |
| 3098 |
M_ChangeMenu(NULL, mnact_full); |
| 3099 |
|
| 3100 |
M_DrawBackground(g_menu_flat, 0); // Draw background |
| 3101 |
|
| 3102 |
// CPhipps - patch drawing updated |
| 3103 |
M_DrawTitle(2, "AUTOMAP", cr_title); // M_AUTO |
| 3104 |
M_DrawInstructions(); |
| 3105 |
M_DrawTabs(auto_pages, sizeof(auto_pages), TABS_Y); |
| 3106 |
M_DrawScreenItems(current_setup_menu, DEFAULT_LIST_Y); |
| 3107 |
|
| 3108 |
// If a color is being selected, need to show color paint chips |
| 3109 |
|
| 3110 |
if (colorbox_active) |
| 3111 |
M_DrawColPal(); |
| 3112 |
} |
| 3113 |
|
| 3114 |
///////////////////////////// |
| 3115 |
// |
| 3116 |
// The General table. |
| 3117 |
// killough 10/10/98 |
| 3118 |
|
| 3119 |
static const char *gen_pages[] = |
| 3120 |
{ |
| 3121 |
"Video", |
| 3122 |
"Audio", |
| 3123 |
"Mouse", |
| 3124 |
"Controller", |
| 3125 |
"Misc", |
| 3126 |
NULL |
| 3127 |
}; |
| 3128 |
|
| 3129 |
setup_menu_t gen_video_settings[], gen_audio_settings[], gen_mouse_settings[]; |
| 3130 |
setup_menu_t gen_controller_settings[], gen_misc_settings[]; |
| 3131 |
|
| 3132 |
setup_menu_t* gen_settings[] = |
| 3133 |
{ |
| 3134 |
gen_video_settings, |
| 3135 |
gen_audio_settings, |
| 3136 |
gen_mouse_settings, |
| 3137 |
gen_controller_settings, |
| 3138 |
gen_misc_settings, |
| 3139 |
NULL |
| 3140 |
}; |
| 3141 |
|
| 3142 |
#define G_X 210 |
| 3143 |
#define G2_X 220 |
| 3144 |
|
| 3145 |
static const char *videomodes[] = { |
| 3146 |
"Software", |
| 3147 |
"OpenGL", |
| 3148 |
NULL}; |
| 3149 |
|
| 3150 |
static const char *gen_skillstrings[] = { |
| 3151 |
// Dummy first option because defaultskill is 1-based |
| 3152 |
"", "ITYTD", "HNTR", "HMP", "UV", "NM", NULL |
| 3153 |
}; |
| 3154 |
|
| 3155 |
static const char *gen_compstrings[] = |
| 3156 |
{ |
| 3157 |
"Default", |
| 3158 |
"Doom v1.2", |
| 3159 |
"Doom v1.666", |
| 3160 |
"Doom/2 v1.9", |
| 3161 |
"Ultimate Doom", |
| 3162 |
"Final Doom", |
| 3163 |
"DosDoom", |
| 3164 |
"TASDoom", |
| 3165 |
"Boom's vanilla", |
| 3166 |
"Boom v2.01", |
| 3167 |
"Boom", |
| 3168 |
"LxDoom", |
| 3169 |
"MBF", |
| 3170 |
"PrBoom 2.03b", |
| 3171 |
"PrBoom 2.1.x", |
| 3172 |
"PrBoom 2.2.x", |
| 3173 |
"PrBoom 2.3.x", |
| 3174 |
"PrBoom 2.4.0", |
| 3175 |
"Latest PrBoom+", |
| 3176 |
"~", |
| 3177 |
"~", |
| 3178 |
"~", |
| 3179 |
"MBF21", |
| 3180 |
NULL |
| 3181 |
}; |
| 3182 |
|
| 3183 |
static const char *death_use_strings[] = { "default", "nothing", "reload", NULL }; |
| 3184 |
|
| 3185 |
static const char *render_aspects_list[] = { "auto", "16:9", "16:10", "4:3", "5:4", NULL }; |
| 3186 |
|
| 3187 |
static const char* render_stretch_list[] = { |
| 3188 |
"Not Adjusted", "Doom Format", "Fit to Width", NULL |
| 3189 |
}; |
| 3190 |
|
| 3191 |
static const char* fake_contrast_list[] = |
| 3192 |
{ |
| 3193 |
[FAKE_CONTRAST_MODE_OFF] = "Off", |
| 3194 |
[FAKE_CONTRAST_MODE_ON] = "Normal", |
| 3195 |
[FAKE_CONTRAST_MODE_SMOOTH] = "Smooth", |
| 3196 |
NULL |
| 3197 |
}; |
| 3198 |
|
| 3199 |
static const char *gl_fade_mode_list[] = { "Normal", "Smooth", NULL }; |
| 3200 |
|
| 3201 |
setup_menu_t gen_video_settings[] = { |
| 3202 |
{ "Video mode", S_CHOICE | S_STR, m_conf, G_X, dsda_config_videomode, 0, videomodes }, |
| 3203 |
{ "Screen Resolution", S_CHOICE | S_STR, m_conf, G_X, dsda_config_screen_resolution, 0, screen_resolutions_list }, |
| 3204 |
{ "Aspect Ratio", S_CHOICE, m_conf, G_X, dsda_config_render_aspect, 0, render_aspects_list }, |
| 3205 |
{ "Fullscreen Video mode", S_YESNO, m_conf, G_X, dsda_config_use_fullscreen }, |
| 3206 |
{ "Exclusive Fullscreen", S_YESNO, m_conf, G_X, dsda_config_exclusive_fullscreen }, |
| 3207 |
EMPTY_LINE, |
| 3208 |
TITLE("FPS", G_X), |
| 3209 |
{ "Vertical Sync", S_YESNO, m_conf, G_X, dsda_config_render_vsync }, |
| 3210 |
{ "Uncapped FPS", S_YESNO, m_conf, G_X, dsda_config_uncapped_framerate }, |
| 3211 |
{ "FPS Limit", S_NUM, m_conf, G_X, dsda_config_fps_limit }, |
| 3212 |
{ "Background FPS Limit", S_NUM, m_conf, G_X, dsda_config_background_fps_limit }, |
| 3213 |
{ "Show FPS", S_YESNO, m_conf, G_X, dsda_config_show_fps }, |
| 3214 |
EMPTY_LINE, |
| 3215 |
{ "Fake Contrast", S_CHOICE, m_conf, G_X, dsda_config_fake_contrast_mode, 0, fake_contrast_list }, |
| 3216 |
{ "OpenGL Light Fade", S_CHOICE, m_conf, G_X, dsda_config_gl_fade_mode, 0, gl_fade_mode_list }, |
| 3217 |
|
| 3218 |
NEXT_PAGE(gen_audio_settings), |
| 3219 |
FINAL_ENTRY |
| 3220 |
}; |
| 3221 |
|
| 3222 |
setup_menu_t gen_audio_settings[] = { |
| 3223 |
{ "SFX Volume", S_THERMO, m_conf, G_X, dsda_config_sfx_volume}, |
| 3224 |
{ "Music Volume", S_THERMO, m_conf, G_X, dsda_config_music_volume}, |
| 3225 |
EMPTY_LINE, |
| 3226 |
{ "Enable v1.1 Pitch Effects", S_YESNO, m_conf, G_X, dsda_config_pitched_sounds }, |
| 3227 |
{ "Disable Sound Cutoffs", S_YESNO, m_conf, G_X, dsda_config_full_sounds }, |
| 3228 |
{ "SFX For Movement Toggles", S_YESNO, m_conf, G_X, dsda_config_movement_toggle_sfx }, |
| 3229 |
{ "Mute When Out of Focus", S_YESNO, m_conf, G_X, dsda_config_mute_unfocused_window }, |
| 3230 |
EMPTY_LINE, |
| 3231 |
TITLE("Limits", G_X), |
| 3232 |
{ "Number of Sound Channels", S_NUM, m_conf, G_X, dsda_config_snd_channels }, |
| 3233 |
{ "Parallel Same-Sound Limit", S_NUM, m_conf, G_X, dsda_config_parallel_sfx_limit }, |
| 3234 |
{ "Parallel Same-Sound Window", S_NUM, m_conf, G_X, dsda_config_parallel_sfx_window }, |
| 3235 |
EMPTY_LINE, |
| 3236 |
{ "Preferred MIDI player", S_CHOICE | S_STR, m_conf, G_X, dsda_config_snd_midiplayer, 0, midiplayers }, |
| 3237 |
|
| 3238 |
PREV_PAGE(gen_video_settings), |
| 3239 |
NEXT_PAGE(gen_mouse_settings), |
| 3240 |
FINAL_ENTRY |
| 3241 |
}; |
| 3242 |
|
| 3243 |
setup_menu_t gen_mouse_settings[] = { |
| 3244 |
{ "Enable Mouse", S_YESNO, m_conf, G2_X, dsda_config_use_mouse }, |
| 3245 |
EMPTY_LINE, |
| 3246 |
{ "Horizontal Sensitivity", S_NUM, m_conf, G2_X, dsda_config_mouse_sensitivity_horiz }, |
| 3247 |
{ "Vertical Sensitivity", S_NUM, m_conf, G2_X, dsda_config_mouse_sensitivity_vert }, |
| 3248 |
{ "Free Look Sensitivity", S_NUM, m_conf, G2_X, dsda_config_mouse_sensitivity_mlook }, |
| 3249 |
{ "Acceleration", S_NUM, m_conf, G2_X, dsda_config_mouse_acceleration }, |
| 3250 |
EMPTY_LINE, |
| 3251 |
{ "Enable Free Look", S_YESNO, m_conf, G2_X, dsda_config_freelook }, |
| 3252 |
{ "Invert Free Look", S_YESNO, m_conf, G2_X, dsda_config_movement_mouseinvert }, |
| 3253 |
EMPTY_LINE, |
| 3254 |
{ "Mouse Strafe Divisor", S_NUM, m_conf, G2_X, dsda_config_movement_mousestrafedivisor }, |
| 3255 |
{ "Dbl-Click As Use", S_YESNO, m_conf, G2_X, dsda_config_mouse_doubleclick_as_use }, |
| 3256 |
{ "Vertical Mouse Movement", S_YESNO, m_conf, G2_X, dsda_config_vertmouse }, |
| 3257 |
{ "Carry Fractional Tics", S_YESNO, m_conf, G2_X, dsda_config_mouse_carrytics }, |
| 3258 |
{ "Mouse Stutter Correction", S_YESNO, m_conf, G2_X, dsda_config_mouse_stutter_correction }, |
| 3259 |
|
| 3260 |
PREV_PAGE(gen_audio_settings), |
| 3261 |
NEXT_PAGE(gen_controller_settings), |
| 3262 |
FINAL_ENTRY |
| 3263 |
}; |
| 3264 |
|
| 3265 |
setup_menu_t gen_controller_settings[] = { |
| 3266 |
{ "Enable Controller", S_YESNO, m_conf, G2_X, dsda_config_use_game_controller }, |
| 3267 |
EMPTY_LINE, |
| 3268 |
{ "Left Horizontal Sensitivity", S_NUM, m_conf, G2_X, dsda_config_left_analog_sensitivity_x }, |
| 3269 |
{ "Left Vertical Sensitivity", S_NUM, m_conf, G2_X, dsda_config_left_analog_sensitivity_y }, |
| 3270 |
{ "Right Horizontal Sensitivity", S_NUM, m_conf, G2_X, dsda_config_right_analog_sensitivity_x }, |
| 3271 |
{ "Right Vertical Sensitivity", S_NUM, m_conf, G2_X, dsda_config_right_analog_sensitivity_y }, |
| 3272 |
{ "Acceleration", S_NUM, m_conf, G2_X, dsda_config_analog_look_acceleration }, |
| 3273 |
EMPTY_LINE, |
| 3274 |
{ "Enable Free Look", S_YESNO, m_conf, G2_X, dsda_config_freelook }, |
| 3275 |
{ "Invert Free Look", S_YESNO, m_conf, G2_X, dsda_config_invert_analog_look }, |
| 3276 |
{ "Swap Analogs", S_YESNO, m_conf, G2_X, dsda_config_swap_analogs }, |
| 3277 |
EMPTY_LINE, |
| 3278 |
{ "Left Analog Deadzone", S_NUM, m_conf, G2_X, dsda_config_left_analog_deadzone }, |
| 3279 |
{ "Right Analog Deadzone", S_NUM, m_conf, G2_X, dsda_config_right_analog_deadzone }, |
| 3280 |
{ "Left Trigger Deadzone", S_NUM, m_conf, G2_X, dsda_config_left_trigger_deadzone }, |
| 3281 |
{ "Right Trigger Deadzone", S_NUM, m_conf, G2_X, dsda_config_right_trigger_deadzone }, |
| 3282 |
|
| 3283 |
PREV_PAGE(gen_mouse_settings), |
| 3284 |
NEXT_PAGE(gen_misc_settings), |
| 3285 |
FINAL_ENTRY |
| 3286 |
}; |
| 3287 |
|
| 3288 |
setup_menu_t gen_misc_settings[] = { |
| 3289 |
{ "Death Use Action", S_CHOICE, m_conf, G2_X, dsda_config_death_use_action, 0, death_use_strings }, |
| 3290 |
{ "Boom Weapon Auto Switch", S_YESNO, m_conf, G2_X, dsda_config_switch_when_ammo_runs_out }, |
| 3291 |
{ "Auto Switch Weapon on Pickup", S_YESNO, m_conf, G2_X, dsda_config_switch_weapon_on_pickup }, |
| 3292 |
{ "Enable Cheat Code Entry", S_YESNO, m_conf, G2_X, dsda_config_cheat_codes }, |
| 3293 |
{ "Skip Quit Prompt", S_YESNO, m_conf, G2_X, dsda_config_skip_quit_prompt }, |
| 3294 |
EMPTY_LINE, |
| 3295 |
TITLE("Rewind", G2_X), |
| 3296 |
{ "Rewind Interval (s)", S_NUM, m_conf, G2_X, dsda_config_auto_key_frame_interval }, |
| 3297 |
{ "Rewind Depth", S_NUM, m_conf, G2_X, dsda_config_auto_key_frame_depth }, |
| 3298 |
{ "Rewind Timeout (ms)", S_NUM, m_conf, G2_X, dsda_config_auto_key_frame_timeout }, |
| 3299 |
EMPTY_LINE, |
| 3300 |
{ "Autosave On Level Start", S_YESNO, m_conf, G2_X, dsda_config_auto_save }, |
| 3301 |
{ "Organize My Save Files", S_YESNO, m_conf, G2_X, dsda_config_organized_saves }, |
| 3302 |
|
| 3303 |
PREV_PAGE(gen_controller_settings), |
| 3304 |
FINAL_ENTRY |
| 3305 |
}; |
| 3306 |
|
| 3307 |
// To (un)set fullscreen video after menu changes |
| 3308 |
void M_ChangeFullScreen(void) |
| 3309 |
{ |
| 3310 |
I_UpdateVideoMode(); |
| 3311 |
|
| 3312 |
if (V_IsOpenGLMode()) |
| 3313 |
{ |
| 3314 |
gld_PreprocessLevel(); |
| 3315 |
} |
| 3316 |
} |
| 3317 |
|
| 3318 |
void M_ChangeVideoMode(void) |
| 3319 |
{ |
| 3320 |
V_ChangeScreenResolution(); |
| 3321 |
} |
| 3322 |
|
| 3323 |
void M_ChangeUseGLSurface(void) |
| 3324 |
{ |
| 3325 |
V_ChangeScreenResolution(); |
| 3326 |
} |
| 3327 |
|
| 3328 |
void M_ChangeDemoSmoothTurns(void) |
| 3329 |
{ |
| 3330 |
R_SmoothPlaying_Reset(NULL); |
| 3331 |
} |
| 3332 |
|
| 3333 |
// Setting up for the General screen. Turn on flags, set pointers, |
| 3334 |
// locate the first item on the screen where the cursor is allowed to |
| 3335 |
// land. |
| 3336 |
|
| 3337 |
static void M_General(int choice) |
| 3338 |
{ |
| 3339 |
M_EnterSetup(&GeneralDef, &set_general_active, gen_settings[0]); |
| 3340 |
} |
| 3341 |
|
| 3342 |
// The drawing part of the General Setup initialization. Draw the |
| 3343 |
// background, title, instruction line, and items. |
| 3344 |
|
| 3345 |
static void M_DrawGeneral(void) |
| 3346 |
{ |
| 3347 |
M_ChangeMenu(NULL, mnact_full); |
| 3348 |
|
| 3349 |
M_DrawBackground(g_menu_flat, 0); // Draw background |
| 3350 |
|
| 3351 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 3352 |
M_DrawTitle(2, "GENERAL", cr_title); // M_GENERL |
| 3353 |
M_DrawInstructions(); |
| 3354 |
M_DrawTabs(gen_pages, sizeof(gen_pages), TABS_Y); |
| 3355 |
M_DrawScreenItems(current_setup_menu, DEFAULT_LIST_Y); |
| 3356 |
} |
| 3357 |
|
| 3358 |
static const char *display_pages[] = |
| 3359 |
{ |
| 3360 |
"Options", |
| 3361 |
"Status Bar", |
| 3362 |
"HUD", |
| 3363 |
"Crosshair", |
| 3364 |
NULL |
| 3365 |
}; |
| 3366 |
|
| 3367 |
setup_menu_t display_options_settings[], display_statbar_settings[]; |
| 3368 |
setup_menu_t display_hud_settings[], display_crosshair_settings[]; |
| 3369 |
|
| 3370 |
setup_menu_t* display_settings[] = |
| 3371 |
{ |
| 3372 |
display_options_settings, |
| 3373 |
display_statbar_settings, |
| 3374 |
display_hud_settings, |
| 3375 |
display_crosshair_settings, |
| 3376 |
NULL |
| 3377 |
}; |
| 3378 |
|
| 3379 |
#define D_X 226 |
| 3380 |
|
| 3381 |
static const char* menu_background_list[] = { "Off", "Dark", "Texture", NULL }; |
| 3382 |
static const char* translucent_list[] = { "Off", "Default", "w/ Vanilla", NULL }; |
| 3383 |
static const char* viewbob_list[] = { "Off", "25%", "50%", "75%", "100%", NULL }; |
| 3384 |
static const char* weaponbob_list[] = { "Off", "25%", "50%", "75%", "100%", NULL }; |
| 3385 |
|
| 3386 |
setup_menu_t display_options_settings[] = { |
| 3387 |
{ "Hide Weapon", S_YESNO, m_conf, G_X, dsda_config_hide_weapon }, |
| 3388 |
{ "Wipe Screen Effect", S_YESNO, m_conf, G_X, dsda_config_render_wipescreen }, |
| 3389 |
{ "View Bobbing", S_CHOICE, m_conf, G_X, dsda_config_viewbob, 0, viewbob_list }, |
| 3390 |
{ "Weapon Bobbing", S_CHOICE, m_conf, G_X, dsda_config_weaponbob, 0, weaponbob_list }, |
| 3391 |
{ "Weapon Attack Alignment", S_CHOICE, m_conf, G_X, dsda_config_weapon_attack_alignment, 0, weapon_attack_alignment_strings }, |
| 3392 |
{ "Linear Sky Scrolling", S_YESNO, m_conf, G_X, dsda_config_render_linearsky }, |
| 3393 |
{ "Quake Intensity", S_NUM, m_conf, G_X, dsda_config_quake_intensity }, |
| 3394 |
{ "OpenGL Show Health Bars", S_YESNO, m_conf, G_X, dsda_config_gl_health_bar }, |
| 3395 |
{ "Translucent Sprites", S_CHOICE, m_conf, G_X, dsda_config_translucent_sprites, 0, translucent_list }, |
| 3396 |
{ "Translucent Ghosts", S_YESNO, m_conf, G_X, dsda_config_translucent_ghosts }, |
| 3397 |
EMPTY_LINE, |
| 3398 |
{ "Change Palette On Pain", S_YESNO, m_conf, G_X, dsda_config_palette_ondamage }, |
| 3399 |
{ "Change Palette On Bonus", S_YESNO, m_conf, G_X, dsda_config_palette_onbonus }, |
| 3400 |
{ "Change Palette On Powers", S_YESNO, m_conf, G_X, dsda_config_palette_onpowers }, |
| 3401 |
EMPTY_LINE, |
| 3402 |
{ "Menu Background", S_CHOICE, m_conf, G_X, dsda_config_menu_background, 0, menu_background_list }, |
| 3403 |
|
| 3404 |
NEXT_PAGE(display_statbar_settings), |
| 3405 |
FINAL_ENTRY |
| 3406 |
}; |
| 3407 |
|
| 3408 |
setup_menu_t display_statbar_settings[] = // Demos Settings screen |
| 3409 |
{ |
| 3410 |
{ "Hide Status Bar Horns", S_YESNO, m_conf, DM_X, dsda_config_hide_horns }, |
| 3411 |
{ "Single Key Display", S_YESNO, m_conf, DM_X, dsda_config_sts_traditional_keys }, |
| 3412 |
{ "Solid Color Background", S_YESNO, m_conf, DM_X, dsda_config_sts_solid_bg_color }, |
| 3413 |
EMPTY_LINE, |
| 3414 |
TITLE("Coloring", DM_X), |
| 3415 |
{ "Gray %",S_YESNO, m_conf, DM_X, dsda_config_sts_pct_always_gray }, |
| 3416 |
{ "Colored Numbers", S_YESNO, m_conf, DM_X, dsda_config_sts_colored_numbers }, |
| 3417 |
{ "Health Low/Ok", S_NUM, m_conf, DM_X, dsda_config_hud_health_red }, |
| 3418 |
{ "Health Ok/Good", S_NUM, m_conf, DM_X, dsda_config_hud_health_yellow }, |
| 3419 |
{ "Health Good/Extra", S_NUM, m_conf, DM_X, dsda_config_hud_health_green }, |
| 3420 |
{ "Ammo Low/Ok", S_NUM, m_conf, DM_X, dsda_config_hud_ammo_red }, |
| 3421 |
{ "Ammo Ok/Good", S_NUM, m_conf, DM_X, dsda_config_hud_ammo_yellow }, |
| 3422 |
EMPTY_LINE, |
| 3423 |
{ "Appearance", S_CHOICE, m_conf, DM_X, dsda_config_render_stretch_hud, 0, render_stretch_list }, |
| 3424 |
|
| 3425 |
PREV_PAGE(display_options_settings), |
| 3426 |
NEXT_PAGE(display_hud_settings), |
| 3427 |
FINAL_ENTRY |
| 3428 |
}; |
| 3429 |
|
| 3430 |
setup_menu_t display_hud_settings[] = // Demos Settings screen |
| 3431 |
{ |
| 3432 |
{ "Use Extended Hud", S_YESNO, m_conf, D_X, dsda_config_exhud }, |
| 3433 |
{ "Ex Hud Scale %", S_NUM, m_conf, D_X, dsda_config_ex_text_scale_x }, |
| 3434 |
{ "Ex Hud Ratio %", S_NUM, m_conf, D_X, dsda_config_ex_text_ratio_y }, |
| 3435 |
EMPTY_LINE, |
| 3436 |
TITLE("Messages", D_X), |
| 3437 |
{ "Show Messages", S_YESNO, m_conf, D_X, dsda_config_show_messages }, |
| 3438 |
{ "Report Revealed Secrets", S_YESNO, m_conf, D_X, dsda_config_hudadd_secretarea }, |
| 3439 |
{ "Announce Map On Entry", S_YESNO, m_conf, D_X, dsda_config_announce_map }, |
| 3440 |
|
| 3441 |
PREV_PAGE(display_statbar_settings), |
| 3442 |
NEXT_PAGE(display_crosshair_settings), |
| 3443 |
FINAL_ENTRY |
| 3444 |
}; |
| 3445 |
|
| 3446 |
static const char *crosshair_str[] = |
| 3447 |
{ "none", "cross", "angle", "dot", "small", "slim", "tiny", "big", NULL }; |
| 3448 |
|
| 3449 |
#define HUD_X 245 |
| 3450 |
|
| 3451 |
setup_menu_t display_crosshair_settings[] = |
| 3452 |
{ |
| 3453 |
{ "Enable Crosshair", S_CHOICE, m_conf, HUD_X, dsda_config_hudadd_crosshair, 0, crosshair_str }, |
| 3454 |
EMPTY_LINE, |
| 3455 |
{ "Scale Crosshair", S_YESNO, m_conf, HUD_X, dsda_config_hudadd_crosshair_scale }, |
| 3456 |
{ "Change Color By Player Health", S_YESNO, m_conf, HUD_X, dsda_config_hudadd_crosshair_health }, |
| 3457 |
{ "Change Color On Target", S_YESNO, m_conf, HUD_X, dsda_config_hudadd_crosshair_target }, |
| 3458 |
{ "Default Color", S_CRITEM, m_conf, HUD_X, dsda_config_hudadd_crosshair_color }, |
| 3459 |
{ "Target Color", S_CRITEM, m_conf, HUD_X, dsda_config_hudadd_crosshair_target_color }, |
| 3460 |
{ "Lock Crosshair On Target", S_YESNO, m_conf, HUD_X, dsda_config_hudadd_crosshair_lock_target }, |
| 3461 |
|
| 3462 |
PREV_PAGE(display_hud_settings), |
| 3463 |
FINAL_ENTRY |
| 3464 |
}; |
| 3465 |
|
| 3466 |
static void M_Display(int choice) |
| 3467 |
{ |
| 3468 |
M_EnterSetup(&DisplayDef, &set_display_active, display_settings[0]); |
| 3469 |
} |
| 3470 |
|
| 3471 |
static void M_DrawDisplay(void) |
| 3472 |
{ |
| 3473 |
M_ChangeMenu(NULL, mnact_full); |
| 3474 |
|
| 3475 |
M_DrawBackground(g_menu_flat, 0); |
| 3476 |
|
| 3477 |
M_DrawTitle(2, "DISPLAY", cr_title); // M_DSPLAY |
| 3478 |
M_DrawInstructions(); |
| 3479 |
M_DrawTabs(display_pages, sizeof(display_pages), TABS_Y); |
| 3480 |
M_DrawScreenItems(current_setup_menu, DEFAULT_LIST_Y); |
| 3481 |
} |
| 3482 |
|
| 3483 |
static const char *comp_pages[] = |
| 3484 |
{ |
| 3485 |
"Options", |
| 3486 |
"Emulation", |
| 3487 |
NULL |
| 3488 |
}; |
| 3489 |
|
| 3490 |
setup_menu_t comp_options_settings[], comp_emulation_settings[]; |
| 3491 |
|
| 3492 |
setup_menu_t* comp_settings[] = |
| 3493 |
{ |
| 3494 |
comp_options_settings, |
| 3495 |
comp_emulation_settings, |
| 3496 |
NULL |
| 3497 |
}; |
| 3498 |
|
| 3499 |
setup_menu_t comp_options_settings[] = { |
| 3500 |
{ "Default skill level", S_CHOICE, m_conf, G2_X, dsda_config_default_skill, 0, gen_skillstrings }, |
| 3501 |
{ "Default compatibility level", S_CHOICE, m_conf, G2_X, dsda_config_default_complevel, 0, &gen_compstrings[1] }, |
| 3502 |
EMPTY_LINE, |
| 3503 |
{ "Casual Play", S_SKIP | S_TITLE, m_conf, G2_X}, |
| 3504 |
{ "Pistol Start", S_YESNO, m_conf, G2_X, dsda_config_pistol_start }, |
| 3505 |
{ "Respawn Monsters", S_YESNO, m_conf, G2_X, dsda_config_respawn_monsters }, |
| 3506 |
{ "Fast Monsters", S_YESNO, m_conf, G2_X, dsda_config_fast_monsters }, |
| 3507 |
{ "No Monsters", S_YESNO, m_conf, G2_X, dsda_config_no_monsters }, |
| 3508 |
{ "Coop Spawns", S_YESNO, m_conf, G2_X, dsda_config_coop_spawns }, |
| 3509 |
EMPTY_LINE, |
| 3510 |
{ "Always Pistol Start", S_YESNO, m_conf, G2_X, dsda_config_always_pistol_start }, |
| 3511 |
{ "Allow Jumping", S_YESNO, m_conf, G2_X, dsda_config_allow_jumping }, |
| 3512 |
|
| 3513 |
NEXT_PAGE(comp_emulation_settings), |
| 3514 |
FINAL_ENTRY |
| 3515 |
}; |
| 3516 |
|
| 3517 |
setup_menu_t comp_emulation_settings[] = { |
| 3518 |
{ "WARN ON SPECHITS OVERFLOW", S_YESNO, m_conf, AU_X, dsda_config_overrun_spechit_warn }, |
| 3519 |
{ "TRY TO EMULATE IT", S_YESNO, m_conf, AU_X, dsda_config_overrun_spechit_emulate }, |
| 3520 |
{ "WARN ON REJECT OVERFLOW", S_YESNO, m_conf, AU_X, dsda_config_overrun_reject_warn }, |
| 3521 |
{ "TRY TO EMULATE IT", S_YESNO, m_conf, AU_X, dsda_config_overrun_reject_emulate }, |
| 3522 |
{ "WARN ON INTERCEPTS OVERFLOW", S_YESNO, m_conf, AU_X, dsda_config_overrun_intercept_warn }, |
| 3523 |
{ "TRY TO EMULATE IT", S_YESNO, m_conf, AU_X, dsda_config_overrun_intercept_emulate }, |
| 3524 |
{ "WARN ON PLAYERINGAME OVERFLOW", S_YESNO, m_conf, AU_X, dsda_config_overrun_playeringame_warn }, |
| 3525 |
{ "TRY TO EMULATE IT", S_YESNO, m_conf, AU_X, dsda_config_overrun_playeringame_emulate }, |
| 3526 |
EMPTY_LINE, |
| 3527 |
{ "MAPPING ERROR FIXES", S_SKIP | S_TITLE, m_conf, AU_X}, |
| 3528 |
{ "USE PASSES THRU ALL SPECIAL LINES", S_YESNO, m_conf, AU_X, dsda_config_comperr_passuse }, |
| 3529 |
{ "WALK UNDER SOLID HANGING BODIES", S_YESNO, m_conf, AU_X, dsda_config_comperr_hangsolid }, |
| 3530 |
{ "FIX CLIPPING IN LARGE LEVELS", S_YESNO, m_conf, AU_X, dsda_config_comperr_blockmap }, |
| 3531 |
|
| 3532 |
PREV_PAGE(comp_options_settings), |
| 3533 |
FINAL_ENTRY |
| 3534 |
}; |
| 3535 |
|
| 3536 |
static void M_Compatibility(int choice) |
| 3537 |
{ |
| 3538 |
M_EnterSetup(&CompatibilityDef, &set_compatibility_active, comp_settings[0]); |
| 3539 |
} |
| 3540 |
|
| 3541 |
static void M_DrawCompatibility(void) |
| 3542 |
{ |
| 3543 |
M_ChangeMenu(NULL, mnact_full); |
| 3544 |
|
| 3545 |
M_DrawBackground(g_menu_flat, 0); |
| 3546 |
|
| 3547 |
M_DrawTitle(2, "COMPATIBILITY", cr_title); // M_COMP |
| 3548 |
M_DrawInstructions(); |
| 3549 |
M_DrawTabs(comp_pages, sizeof(comp_pages), TABS_Y); |
| 3550 |
M_DrawScreenItems(current_setup_menu, DEFAULT_LIST_Y); |
| 3551 |
} |
| 3552 |
|
| 3553 |
///////////////////////////// |
| 3554 |
// |
| 3555 |
// The level table. |
| 3556 |
// |
| 3557 |
|
| 3558 |
static const char *level_table_pages[] = |
| 3559 |
{ |
| 3560 |
"Stats", |
| 3561 |
"Time", |
| 3562 |
"Summary", |
| 3563 |
NULL |
| 3564 |
}; |
| 3565 |
|
| 3566 |
#define LEVEL_TABLE_PAGES 3 |
| 3567 |
|
| 3568 |
static setup_menu_t *level_table_page[LEVEL_TABLE_PAGES]; |
| 3569 |
static setup_menu_t next_page_template = NEXT_PAGE(NULL); |
| 3570 |
static setup_menu_t prev_page_template = PREV_PAGE(NULL); |
| 3571 |
static setup_menu_t final_entry_template = FINAL_ENTRY; |
| 3572 |
static setup_menu_t new_column_template = NEW_COLUMN; |
| 3573 |
static setup_menu_t empty_line_template = EMPTY_LINE; |
| 3574 |
|
| 3575 |
#define LOOP_LEVEL_TABLE_COLUMN { \ |
| 3576 |
for (i = 0; i < wad_stats.map_count; ++i) { \ |
| 3577 |
map = &wad_stats.maps[i]; \ |
| 3578 |
if (map->episode == -1) \ |
| 3579 |
continue; \ |
| 3580 |
entry = &level_table_page[page][base_i + i]; \ |
| 3581 |
|
| 3582 |
#define END_LOOP_LEVEL_TABLE_COLUMN } \ |
| 3583 |
base_i += i; \ |
| 3584 |
} |
| 3585 |
|
| 3586 |
#define INSERT_LEVEL_TABLE_COLUMN(heading, x) { \ |
| 3587 |
level_table_page[page][base_i] = new_column_template; \ |
| 3588 |
++base_i; \ |
| 3589 |
level_table_page[page][base_i] = empty_line_template; \ |
| 3590 |
level_table_page[page][base_i].m_flags |= S_TITLE; \ |
| 3591 |
level_table_page[page][base_i].m_text = Z_Strdup(heading); \ |
| 3592 |
level_table_page[page][base_i].m_x = x; \ |
| 3593 |
++base_i; \ |
| 3594 |
} |
| 3595 |
|
| 3596 |
#define INSERT_FINAL_LEVEL_TABLE_ENTRY { \ |
| 3597 |
level_table_page[page][base_i] = final_entry_template; \ |
| 3598 |
level_table_page[page][base_i].m_x = level_table_cursor_position[page]; \ |
| 3599 |
} |
| 3600 |
|
| 3601 |
#define INSERT_LEVEL_TABLE_EMPTY_LINE { \ |
| 3602 |
level_table_page[page][base_i] = empty_line_template; \ |
| 3603 |
++base_i; \ |
| 3604 |
} |
| 3605 |
|
| 3606 |
#define INSERT_LEVEL_TABLE_NEXT_PAGE { \ |
| 3607 |
level_table_page[page][base_i] = next_page_template; \ |
| 3608 |
level_table_page[page][base_i].menu = level_table_page[page + 1]; \ |
| 3609 |
++base_i; \ |
| 3610 |
} |
| 3611 |
|
| 3612 |
#define INSERT_LEVEL_TABLE_PREV_PAGE { \ |
| 3613 |
level_table_page[page][base_i] = prev_page_template; \ |
| 3614 |
level_table_page[page][base_i].menu = level_table_page[page - 1]; \ |
| 3615 |
++base_i; \ |
| 3616 |
} |
| 3617 |
|
| 3618 |
#define START_LEVEL_TABLE_PAGE(page_number) { \ |
| 3619 |
page = page_number; \ |
| 3620 |
base_i = 0; \ |
| 3621 |
column_x = 16; \ |
| 3622 |
INSERT_LEVEL_TABLE_EMPTY_LINE \ |
| 3623 |
} |
| 3624 |
|
| 3625 |
static void M_FreeMText(const char *m_text) |
| 3626 |
{ |
| 3627 |
union { const char *c; char *s; } str; |
| 3628 |
|
| 3629 |
str.c = m_text; |
| 3630 |
Z_Free(str.s); |
| 3631 |
} |
| 3632 |
|
| 3633 |
typedef struct { |
| 3634 |
int completed_count; |
| 3635 |
int timed_count; |
| 3636 |
int max_timed_count; |
| 3637 |
int nm_timed_count; |
| 3638 |
int best_skill; |
| 3639 |
int best_kills; |
| 3640 |
int best_items; |
| 3641 |
int best_secrets; |
| 3642 |
int max_kills; |
| 3643 |
int max_items; |
| 3644 |
int max_secrets; |
| 3645 |
int best_time; |
| 3646 |
int best_max_time; |
| 3647 |
int best_nm_time; |
| 3648 |
} wad_stats_summary_t; |
| 3649 |
|
| 3650 |
static wad_stats_summary_t wad_stats_summary; |
| 3651 |
|
| 3652 |
static void M_CalculateWadStatsSummary(void) |
| 3653 |
{ |
| 3654 |
int i; |
| 3655 |
map_stats_t *map; |
| 3656 |
|
| 3657 |
memset(&wad_stats_summary, 0, sizeof(wad_stats_summary)); |
| 3658 |
|
| 3659 |
wad_stats_summary.best_skill = 6; |
| 3660 |
|
| 3661 |
for (i = 0; i < wad_stats.map_count; ++i) |
| 3662 |
{ |
| 3663 |
map = &wad_stats.maps[i]; |
| 3664 |
if (map->episode == -1 || !map->best_skill) |
| 3665 |
continue; |
| 3666 |
|
| 3667 |
if (map->best_skill < wad_stats_summary.best_skill) |
| 3668 |
wad_stats_summary.best_skill = map->best_skill; |
| 3669 |
|
| 3670 |
++wad_stats_summary.completed_count; |
| 3671 |
wad_stats_summary.best_kills += map->best_kills; |
| 3672 |
wad_stats_summary.best_items += map->best_items; |
| 3673 |
wad_stats_summary.best_secrets += map->best_secrets; |
| 3674 |
wad_stats_summary.max_kills += map->max_kills; |
| 3675 |
wad_stats_summary.max_items += map->max_items; |
| 3676 |
wad_stats_summary.max_secrets += map->max_secrets; |
| 3677 |
|
| 3678 |
if (map->best_time >= 0) |
| 3679 |
{ |
| 3680 |
++wad_stats_summary.timed_count; |
| 3681 |
wad_stats_summary.best_time += map->best_time; |
| 3682 |
} |
| 3683 |
|
| 3684 |
if (map->best_max_time >= 0) |
| 3685 |
{ |
| 3686 |
++wad_stats_summary.max_timed_count; |
| 3687 |
wad_stats_summary.best_max_time += map->best_max_time; |
| 3688 |
} |
| 3689 |
|
| 3690 |
if (map->best_nm_time >= 0) |
| 3691 |
{ |
| 3692 |
++wad_stats_summary.nm_timed_count; |
| 3693 |
wad_stats_summary.best_nm_time += map->best_nm_time; |
| 3694 |
} |
| 3695 |
} |
| 3696 |
} |
| 3697 |
|
| 3698 |
static int level_table_cursor_position[LEVEL_TABLE_PAGES]; |
| 3699 |
|
| 3700 |
static void M_ResetLevelTable(void) |
| 3701 |
{ |
| 3702 |
int i, page; |
| 3703 |
const int page_count[LEVEL_TABLE_PAGES] = { |
| 3704 |
wad_stats.map_count * 5 + 16, |
| 3705 |
wad_stats.map_count * 4 + 16, |
| 3706 |
38, |
| 3707 |
}; |
| 3708 |
|
| 3709 |
for (page = 0; page < LEVEL_TABLE_PAGES; ++page) |
| 3710 |
{ |
| 3711 |
if (!level_table_page[page]) |
| 3712 |
level_table_page[page] = Z_Calloc(page_count[page], sizeof(*level_table_page[page])); |
| 3713 |
else |
| 3714 |
{ |
| 3715 |
for (i = 0; !(level_table_page[page][i].m_flags & S_END); ++i) |
| 3716 |
{ |
| 3717 |
if (level_table_page[page][i].m_text && |
| 3718 |
!(level_table_page[page][i].m_flags & (S_NEXT | S_PREV))) |
| 3719 |
M_FreeMText(level_table_page[page][i].m_text); |
| 3720 |
} |
| 3721 |
|
| 3722 |
level_table_cursor_position[page] = level_table_page[page][i].m_x; |
| 3723 |
|
| 3724 |
memset(level_table_page[page], 0, page_count[page] * sizeof(*level_table_page[page])); |
| 3725 |
} |
| 3726 |
} |
| 3727 |
} |
| 3728 |
|
| 3729 |
static void M_PrintTime(dsda_string_t* m_text, int tics) |
| 3730 |
{ |
| 3731 |
dsda_StringPrintF(m_text, "%d:%05.2f", |
| 3732 |
tics / 35 / 60, |
| 3733 |
(float) (tics % (60 * 35)) / 35); |
| 3734 |
} |
| 3735 |
|
| 3736 |
static int wad_stats_summary_page; |
| 3737 |
|
| 3738 |
static void M_BuildLevelTable(void) |
| 3739 |
{ |
| 3740 |
int i; |
| 3741 |
int page; |
| 3742 |
int base_i; |
| 3743 |
int column_x; |
| 3744 |
setup_menu_t *entry; |
| 3745 |
map_stats_t *map; |
| 3746 |
dsda_string_t m_text; |
| 3747 |
|
| 3748 |
M_ResetLevelTable(); |
| 3749 |
|
| 3750 |
START_LEVEL_TABLE_PAGE(0) |
| 3751 |
|
| 3752 |
LOOP_LEVEL_TABLE_COLUMN |
| 3753 |
dsda_StringPrintF(&m_text, "%s", map->lump); |
| 3754 |
entry->m_text = m_text.string; |
| 3755 |
entry->m_flags = S_TITLE | S_LEFTJUST; |
| 3756 |
entry->m_x = column_x; |
| 3757 |
END_LOOP_LEVEL_TABLE_COLUMN |
| 3758 |
|
| 3759 |
column_x += 112; |
| 3760 |
INSERT_LEVEL_TABLE_COLUMN("SKILL", column_x) |
| 3761 |
|
| 3762 |
LOOP_LEVEL_TABLE_COLUMN |
| 3763 |
entry->m_flags = S_LABEL | S_SKIP; |
| 3764 |
entry->m_x = column_x; |
| 3765 |
|
| 3766 |
if (map->best_skill) { |
| 3767 |
dsda_StringPrintF(&m_text, "%d", map->best_skill); |
| 3768 |
entry->m_text = m_text.string; |
| 3769 |
if (map->best_skill == num_skills) |
| 3770 |
entry->m_flags |= S_TC_SEL; |
| 3771 |
} |
| 3772 |
else { |
| 3773 |
entry->m_text = Z_Strdup("-"); |
| 3774 |
} |
| 3775 |
END_LOOP_LEVEL_TABLE_COLUMN |
| 3776 |
|
| 3777 |
column_x += 64; |
| 3778 |
INSERT_LEVEL_TABLE_COLUMN("K", column_x); |
| 3779 |
|
| 3780 |
LOOP_LEVEL_TABLE_COLUMN |
| 3781 |
entry->m_flags = S_LABEL | S_SKIP; |
| 3782 |
entry->m_x = column_x; |
| 3783 |
|
| 3784 |
if (map->best_skill) { |
| 3785 |
dsda_StringPrintF(&m_text, "%d/%d", map->best_kills, map->max_kills); |
| 3786 |
entry->m_text = m_text.string; |
| 3787 |
if (map->best_kills >= map->max_kills) |
| 3788 |
entry->m_flags |= S_TC_SEL; |
| 3789 |
} |
| 3790 |
else { |
| 3791 |
entry->m_text = Z_Strdup("-"); |
| 3792 |
} |
| 3793 |
END_LOOP_LEVEL_TABLE_COLUMN |
| 3794 |
|
| 3795 |
column_x += 48; |
| 3796 |
INSERT_LEVEL_TABLE_COLUMN("I", column_x); |
| 3797 |
|
| 3798 |
LOOP_LEVEL_TABLE_COLUMN |
| 3799 |
entry->m_flags = S_LABEL | S_SKIP; |
| 3800 |
entry->m_x = column_x; |
| 3801 |
|
| 3802 |
if (map->best_skill) { |
| 3803 |
dsda_StringPrintF(&m_text, "%d/%d", map->best_items, map->max_items); |
| 3804 |
entry->m_text = m_text.string; |
| 3805 |
if (map->best_items >= map->max_items) |
| 3806 |
entry->m_flags |= S_TC_SEL; |
| 3807 |
} |
| 3808 |
else { |
| 3809 |
entry->m_text = Z_Strdup("-"); |
| 3810 |
} |
| 3811 |
END_LOOP_LEVEL_TABLE_COLUMN |
| 3812 |
|
| 3813 |
column_x += 48; |
| 3814 |
INSERT_LEVEL_TABLE_COLUMN("S", column_x); |
| 3815 |
|
| 3816 |
LOOP_LEVEL_TABLE_COLUMN |
| 3817 |
entry->m_flags = S_LABEL | S_SKIP; |
| 3818 |
entry->m_x = column_x; |
| 3819 |
|
| 3820 |
if (map->best_skill) { |
| 3821 |
dsda_StringPrintF(&m_text, "%d/%d", map->best_secrets, map->max_secrets); |
| 3822 |
entry->m_text = m_text.string; |
| 3823 |
if (map->best_secrets >= map->max_secrets) |
| 3824 |
entry->m_flags |= S_TC_SEL; |
| 3825 |
} |
| 3826 |
else { |
| 3827 |
entry->m_text = Z_Strdup("-"); |
| 3828 |
} |
| 3829 |
END_LOOP_LEVEL_TABLE_COLUMN |
| 3830 |
|
| 3831 |
INSERT_LEVEL_TABLE_NEXT_PAGE |
| 3832 |
INSERT_FINAL_LEVEL_TABLE_ENTRY |
| 3833 |
|
| 3834 |
// -------- // |
| 3835 |
|
| 3836 |
START_LEVEL_TABLE_PAGE(1) |
| 3837 |
|
| 3838 |
LOOP_LEVEL_TABLE_COLUMN |
| 3839 |
dsda_StringPrintF(&m_text, "%s", map->lump); |
| 3840 |
entry->m_text = m_text.string; |
| 3841 |
entry->m_flags = S_TITLE | S_LEFTJUST; |
| 3842 |
entry->m_x = column_x; |
| 3843 |
END_LOOP_LEVEL_TABLE_COLUMN |
| 3844 |
|
| 3845 |
column_x += 120; |
| 3846 |
INSERT_LEVEL_TABLE_COLUMN("TIME", column_x) |
| 3847 |
|
| 3848 |
LOOP_LEVEL_TABLE_COLUMN |
| 3849 |
entry->m_flags = S_LABEL | S_SKIP; |
| 3850 |
entry->m_x = column_x; |
| 3851 |
|
| 3852 |
if (map->best_time >= 0) { |
| 3853 |
M_PrintTime(&m_text, map->best_time); |
| 3854 |
entry->m_text = m_text.string; |
| 3855 |
entry->m_flags |= S_TC_SEL; |
| 3856 |
} |
| 3857 |
else { |
| 3858 |
entry->m_text = Z_Strdup("- : --"); |
| 3859 |
} |
| 3860 |
END_LOOP_LEVEL_TABLE_COLUMN |
| 3861 |
|
| 3862 |
column_x += 80; |
| 3863 |
INSERT_LEVEL_TABLE_COLUMN("MAX TIME", column_x) |
| 3864 |
|
| 3865 |
LOOP_LEVEL_TABLE_COLUMN |
| 3866 |
entry->m_flags = S_LABEL | S_SKIP; |
| 3867 |
entry->m_x = column_x; |
| 3868 |
|
| 3869 |
if (map->best_max_time >= 0) { |
| 3870 |
M_PrintTime(&m_text, map->best_max_time); |
| 3871 |
entry->m_text = m_text.string; |
| 3872 |
entry->m_flags |= S_TC_SEL; |
| 3873 |
} |
| 3874 |
else { |
| 3875 |
entry->m_text = Z_Strdup("- : --"); |
| 3876 |
} |
| 3877 |
END_LOOP_LEVEL_TABLE_COLUMN |
| 3878 |
|
| 3879 |
column_x += 80; |
| 3880 |
INSERT_LEVEL_TABLE_COLUMN("NM TIME", column_x) |
| 3881 |
|
| 3882 |
LOOP_LEVEL_TABLE_COLUMN |
| 3883 |
entry->m_flags = S_LABEL | S_SKIP; |
| 3884 |
entry->m_x = column_x; |
| 3885 |
|
| 3886 |
if (map->best_nm_time >= 0) { |
| 3887 |
M_PrintTime(&m_text, map->best_nm_time); |
| 3888 |
entry->m_text = m_text.string; |
| 3889 |
entry->m_flags |= S_TC_SEL; |
| 3890 |
} |
| 3891 |
else { |
| 3892 |
entry->m_text = Z_Strdup("- : --"); |
| 3893 |
} |
| 3894 |
END_LOOP_LEVEL_TABLE_COLUMN |
| 3895 |
|
| 3896 |
INSERT_LEVEL_TABLE_PREV_PAGE |
| 3897 |
INSERT_LEVEL_TABLE_NEXT_PAGE |
| 3898 |
INSERT_FINAL_LEVEL_TABLE_ENTRY |
| 3899 |
|
| 3900 |
// -------- // |
| 3901 |
|
| 3902 |
M_CalculateWadStatsSummary(); |
| 3903 |
|
| 3904 |
++page; |
| 3905 |
base_i = 2; |
| 3906 |
wad_stats_summary_page = page; |
| 3907 |
|
| 3908 |
dsda_StringPrintF(&m_text, "Maps"); |
| 3909 |
level_table_page[page][base_i].m_text = m_text.string; |
| 3910 |
level_table_page[page][base_i].m_flags = S_TITLE | S_SKIP; |
| 3911 |
level_table_page[page][base_i].m_x = 162; |
| 3912 |
++base_i; |
| 3913 |
|
| 3914 |
dsda_StringPrintF(&m_text, "Skill"); |
| 3915 |
level_table_page[page][base_i].m_text = m_text.string; |
| 3916 |
level_table_page[page][base_i].m_flags = S_TITLE | S_SKIP; |
| 3917 |
level_table_page[page][base_i].m_x = 162; |
| 3918 |
++base_i; |
| 3919 |
|
| 3920 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 3921 |
|
| 3922 |
dsda_StringPrintF(&m_text, "Kill Completion"); |
| 3923 |
level_table_page[page][base_i].m_text = m_text.string; |
| 3924 |
level_table_page[page][base_i].m_flags = S_TITLE | S_SKIP; |
| 3925 |
level_table_page[page][base_i].m_x = 162; |
| 3926 |
++base_i; |
| 3927 |
|
| 3928 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 3929 |
|
| 3930 |
dsda_StringPrintF(&m_text, "Item Completion"); |
| 3931 |
level_table_page[page][base_i].m_text = m_text.string; |
| 3932 |
level_table_page[page][base_i].m_flags = S_TITLE | S_SKIP; |
| 3933 |
level_table_page[page][base_i].m_x = 162; |
| 3934 |
++base_i; |
| 3935 |
|
| 3936 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 3937 |
|
| 3938 |
dsda_StringPrintF(&m_text, "Secret Completion"); |
| 3939 |
level_table_page[page][base_i].m_text = m_text.string; |
| 3940 |
level_table_page[page][base_i].m_flags = S_TITLE | S_SKIP; |
| 3941 |
level_table_page[page][base_i].m_x = 162; |
| 3942 |
++base_i; |
| 3943 |
|
| 3944 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 3945 |
|
| 3946 |
dsda_StringPrintF(&m_text, "Time"); |
| 3947 |
level_table_page[page][base_i].m_text = m_text.string; |
| 3948 |
level_table_page[page][base_i].m_flags = S_TITLE | S_SKIP; |
| 3949 |
level_table_page[page][base_i].m_x = 162; |
| 3950 |
++base_i; |
| 3951 |
|
| 3952 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 3953 |
|
| 3954 |
dsda_StringPrintF(&m_text, "Max Time"); |
| 3955 |
level_table_page[page][base_i].m_text = m_text.string; |
| 3956 |
level_table_page[page][base_i].m_flags = S_TITLE | S_SKIP; |
| 3957 |
level_table_page[page][base_i].m_x = 162; |
| 3958 |
++base_i; |
| 3959 |
|
| 3960 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 3961 |
|
| 3962 |
dsda_StringPrintF(&m_text, "Nightmare Time"); |
| 3963 |
level_table_page[page][base_i].m_text = m_text.string; |
| 3964 |
level_table_page[page][base_i].m_flags = S_TITLE | S_SKIP; |
| 3965 |
level_table_page[page][base_i].m_x = 162; |
| 3966 |
++base_i; |
| 3967 |
|
| 3968 |
level_table_page[page][base_i] = new_column_template; |
| 3969 |
++base_i; |
| 3970 |
|
| 3971 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 3972 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 3973 |
|
| 3974 |
dsda_StringPrintF(&m_text, "%d / %d", |
| 3975 |
wad_stats_summary.completed_count, wad_stats.map_count); |
| 3976 |
level_table_page[page][base_i].m_text = m_text.string; |
| 3977 |
level_table_page[page][base_i].m_flags = S_LABEL | S_SKIP | S_LEFTJUST; |
| 3978 |
level_table_page[page][base_i].m_x = 162; |
| 3979 |
++base_i; |
| 3980 |
|
| 3981 |
if (wad_stats_summary.completed_count) |
| 3982 |
dsda_StringPrintF(&m_text, "%d", wad_stats_summary.best_skill); |
| 3983 |
else |
| 3984 |
dsda_StringPrintF(&m_text, "-"); |
| 3985 |
level_table_page[page][base_i].m_text = m_text.string; |
| 3986 |
level_table_page[page][base_i].m_flags = S_LABEL | S_SKIP | S_LEFTJUST; |
| 3987 |
level_table_page[page][base_i].m_x = 162; |
| 3988 |
++base_i; |
| 3989 |
|
| 3990 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 3991 |
|
| 3992 |
dsda_StringPrintF(&m_text, "%d / ", wad_stats_summary.best_kills); |
| 3993 |
if (wad_stats_summary.completed_count) |
| 3994 |
dsda_StringCatF(&m_text, "%d", wad_stats_summary.max_kills); |
| 3995 |
else |
| 3996 |
dsda_StringCat(&m_text, "-"); |
| 3997 |
level_table_page[page][base_i].m_text = m_text.string; |
| 3998 |
level_table_page[page][base_i].m_flags = S_LABEL | S_SKIP | S_LEFTJUST; |
| 3999 |
level_table_page[page][base_i].m_x = 162; |
| 4000 |
++base_i; |
| 4001 |
|
| 4002 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 4003 |
|
| 4004 |
dsda_StringPrintF(&m_text, "%d / ", wad_stats_summary.best_items); |
| 4005 |
if (wad_stats_summary.completed_count) |
| 4006 |
dsda_StringCatF(&m_text, "%d", wad_stats_summary.max_items); |
| 4007 |
else |
| 4008 |
dsda_StringCat(&m_text, "-"); |
| 4009 |
level_table_page[page][base_i].m_text = m_text.string; |
| 4010 |
level_table_page[page][base_i].m_flags = S_LABEL | S_SKIP | S_LEFTJUST; |
| 4011 |
level_table_page[page][base_i].m_x = 162; |
| 4012 |
++base_i; |
| 4013 |
|
| 4014 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 4015 |
|
| 4016 |
dsda_StringPrintF(&m_text, "%d / ", wad_stats_summary.best_secrets); |
| 4017 |
if (wad_stats_summary.completed_count) |
| 4018 |
dsda_StringCatF(&m_text, "%d", wad_stats_summary.max_secrets); |
| 4019 |
else |
| 4020 |
dsda_StringCat(&m_text, "-"); |
| 4021 |
level_table_page[page][base_i].m_text = m_text.string; |
| 4022 |
level_table_page[page][base_i].m_flags = S_LABEL | S_SKIP | S_LEFTJUST; |
| 4023 |
level_table_page[page][base_i].m_x = 162; |
| 4024 |
++base_i; |
| 4025 |
|
| 4026 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 4027 |
|
| 4028 |
if (wad_stats_summary.timed_count) |
| 4029 |
M_PrintTime(&m_text, wad_stats_summary.best_time); |
| 4030 |
else |
| 4031 |
dsda_StringPrintF(&m_text, "- : --"); |
| 4032 |
level_table_page[page][base_i].m_text = m_text.string; |
| 4033 |
level_table_page[page][base_i].m_flags = S_LABEL | S_SKIP | S_LEFTJUST; |
| 4034 |
level_table_page[page][base_i].m_x = 162; |
| 4035 |
++base_i; |
| 4036 |
|
| 4037 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 4038 |
|
| 4039 |
if (wad_stats_summary.max_timed_count) |
| 4040 |
M_PrintTime(&m_text, wad_stats_summary.best_max_time); |
| 4041 |
else |
| 4042 |
dsda_StringPrintF(&m_text, "- : --"); |
| 4043 |
level_table_page[page][base_i].m_text = m_text.string; |
| 4044 |
level_table_page[page][base_i].m_flags = S_LABEL | S_SKIP | S_LEFTJUST; |
| 4045 |
level_table_page[page][base_i].m_x = 162; |
| 4046 |
++base_i; |
| 4047 |
|
| 4048 |
INSERT_LEVEL_TABLE_EMPTY_LINE |
| 4049 |
|
| 4050 |
if (wad_stats_summary.nm_timed_count) |
| 4051 |
M_PrintTime(&m_text, wad_stats_summary.best_nm_time); |
| 4052 |
else |
| 4053 |
dsda_StringPrintF(&m_text, "- : --"); |
| 4054 |
level_table_page[page][base_i].m_text = m_text.string; |
| 4055 |
level_table_page[page][base_i].m_flags = S_LABEL | S_SKIP | S_LEFTJUST; |
| 4056 |
level_table_page[page][base_i].m_x = 162; |
| 4057 |
++base_i; |
| 4058 |
|
| 4059 |
level_table_page[page][base_i] = new_column_template; |
| 4060 |
++base_i; |
| 4061 |
|
| 4062 |
INSERT_LEVEL_TABLE_PREV_PAGE |
| 4063 |
INSERT_FINAL_LEVEL_TABLE_ENTRY |
| 4064 |
} |
| 4065 |
|
| 4066 |
static void M_LevelTable(int choice) |
| 4067 |
{ |
| 4068 |
M_BuildLevelTable(); |
| 4069 |
M_EnterSetup(&LevelTableDef, &level_table_active, level_table_page[0]); |
| 4070 |
} |
| 4071 |
|
| 4072 |
static void M_DrawLevelTable(void) |
| 4073 |
{ |
| 4074 |
M_ChangeMenu(NULL, mnact_full); |
| 4075 |
|
| 4076 |
M_DrawBackground(g_menu_flat, 0); |
| 4077 |
|
| 4078 |
M_DrawTitle(2, "LEVEL TABLE", cr_title); // M_LVLTBL |
| 4079 |
if (current_setup_menu != level_table_page[wad_stats_summary_page]) |
| 4080 |
M_DrawInstructionString(cr_info_edit, "Press ENTER key to warp"); |
| 4081 |
|
| 4082 |
M_DrawTabs(level_table_pages, sizeof(level_table_pages), TABS_Y); |
| 4083 |
M_DrawScreenItems(current_setup_menu, DEFAULT_LIST_Y); |
| 4084 |
} |
| 4085 |
|
| 4086 |
///////////////////////////// |
| 4087 |
// |
| 4088 |
// General routines used by the Setup screens. |
| 4089 |
// |
| 4090 |
|
| 4091 |
static dboolean shiftdown = false; // phares 4/10/98: SHIFT key down or not |
| 4092 |
|
| 4093 |
// phares 4/17/98: |
| 4094 |
// M_SelectDone() gets called when you have finished entering your |
| 4095 |
// Setup Menu item change. |
| 4096 |
|
| 4097 |
static void M_SelectDone(setup_menu_t* ptr) |
| 4098 |
{ |
| 4099 |
ptr->m_flags &= ~S_SELECT; |
| 4100 |
ptr->m_flags |= S_HILITE; |
| 4101 |
S_StartVoidSound(g_sfx_itemup); |
| 4102 |
setup_select = false; |
| 4103 |
colorbox_active = false; |
| 4104 |
} |
| 4105 |
|
| 4106 |
// |
| 4107 |
// End of Setup Screens. |
| 4108 |
// |
| 4109 |
///////////////////////////////////////////////////////////////////////////// |
| 4110 |
|
| 4111 |
///////////////////////////////////////////////////////////////////////////// |
| 4112 |
// |
| 4113 |
// Start of Extended HELP screens // phares 3/30/98 |
| 4114 |
// |
| 4115 |
// The wad designer can define a set of extended HELP screens for their own |
| 4116 |
// information display. These screens should be 320x200 graphic lumps |
| 4117 |
// defined in a separate wad. They should be named "HELP01" through "HELP99". |
| 4118 |
// "HELP01" is shown after the regular BOOM Dynamic HELP screen, and ENTER |
| 4119 |
// and BACKSPACE keys move the player through the HELP set. |
| 4120 |
// |
| 4121 |
// Rather than define a set of menu definitions for each of the possible |
| 4122 |
// HELP screens, one definition is used, and is altered on the fly |
| 4123 |
// depending on what HELPnn lumps the game finds. |
| 4124 |
|
| 4125 |
// phares 3/30/98: |
| 4126 |
// Extended Help Screen variables |
| 4127 |
|
| 4128 |
int extended_help_count; // number of user-defined help screens found |
| 4129 |
int extended_help_index; // index of current extended help screen |
| 4130 |
|
| 4131 |
menuitem_t ExtHelpMenu[] = |
| 4132 |
{ |
| 4133 |
{1,"",M_ExtHelpNextScreen,0} |
| 4134 |
}; |
| 4135 |
|
| 4136 |
menu_t ExtHelpDef = |
| 4137 |
{ |
| 4138 |
1, // # of menu items |
| 4139 |
&ReadDef1, // previous menu |
| 4140 |
ExtHelpMenu, // menuitem_t -> |
| 4141 |
M_DrawExtHelp, // drawing routine -> |
| 4142 |
330,181, // x,y |
| 4143 |
0 // lastOn |
| 4144 |
}; |
| 4145 |
|
| 4146 |
// M_ExtHelpNextScreen establishes the number of the next HELP screen in |
| 4147 |
// the series. |
| 4148 |
|
| 4149 |
static void M_ExtHelpNextScreen(int choice) |
| 4150 |
{ |
| 4151 |
choice = 0; |
| 4152 |
if (++extended_help_index > extended_help_count) |
| 4153 |
{ |
| 4154 |
|
| 4155 |
// when finished with extended help screens, return to Main Menu |
| 4156 |
|
| 4157 |
extended_help_index = 1; |
| 4158 |
M_SetupNextMenu(&MainDef); |
| 4159 |
} |
| 4160 |
} |
| 4161 |
|
| 4162 |
// phares 3/30/98: |
| 4163 |
// Routine to look for HELPnn screens and create a menu |
| 4164 |
// definition structure that defines extended help screens. |
| 4165 |
|
| 4166 |
static void M_InitExtendedHelp(void) |
| 4167 |
|
| 4168 |
{ |
| 4169 |
int index; |
| 4170 |
char namebfr[] = { "HELPnn"} ; |
| 4171 |
|
| 4172 |
extended_help_count = 0; |
| 4173 |
for (index = 1 ; index < 100 ; index++) { |
| 4174 |
namebfr[4] = index/10 + '0'; |
| 4175 |
namebfr[5] = index%10 + '0'; |
| 4176 |
if (!W_LumpNameExists(namebfr)) { |
| 4177 |
if (extended_help_count) { |
| 4178 |
/* The Extended Help menu is accessed using the |
| 4179 |
* Help hotkey (F1) or the "Read This!" menu item. |
| 4180 |
* |
| 4181 |
* If Extended Help screens are present, use the |
| 4182 |
* Extended Help routine when either the F1 Help Menu |
| 4183 |
* or the "Read This!" menu items are accessed. |
| 4184 |
* |
| 4185 |
* See also: https://www.doomworld.com/forum/topic/111465-boom-extended-help-screens-an-undocumented-feature/ |
| 4186 |
*/ |
| 4187 |
HelpMenu[0].routine = M_ExtHelp; |
| 4188 |
if (raven) { |
| 4189 |
ExtHelpDef.prevMenu = &InfoDef4; /* previous menu */ |
| 4190 |
InfoMenu4[0].routine = M_ExtHelp; |
| 4191 |
} else if (gamemode == shareware || pwad_help2_check) { |
| 4192 |
ExtHelpDef.prevMenu = &ReadDef2; /* previous menu */ |
| 4193 |
ReadMenu2[0].routine = M_ExtHelp; |
| 4194 |
} else { |
| 4195 |
ExtHelpDef.prevMenu = &ReadDef1; /* previous menu */ |
| 4196 |
ReadMenu1[0].routine = M_ExtHelp; |
| 4197 |
} |
| 4198 |
} |
| 4199 |
return; |
| 4200 |
} |
| 4201 |
extended_help_count++; |
| 4202 |
} |
| 4203 |
} |
| 4204 |
|
| 4205 |
// Initialization for the extended HELP screens. |
| 4206 |
|
| 4207 |
static void M_ExtHelp(int choice) |
| 4208 |
{ |
| 4209 |
choice = 0; |
| 4210 |
extended_help_index = 1; // Start with first extended help screen |
| 4211 |
M_SetupNextMenu(&ExtHelpDef); |
| 4212 |
} |
| 4213 |
|
| 4214 |
// Initialize the drawing part of the extended HELP screens. |
| 4215 |
|
| 4216 |
static void M_DrawExtHelp(void) |
| 4217 |
{ |
| 4218 |
char namebfr[10] = { "HELPnn" }; // CPhipps - make it local & writable |
| 4219 |
|
| 4220 |
inhelpscreens = true; // killough 5/1/98 |
| 4221 |
namebfr[4] = extended_help_index/10 + '0'; |
| 4222 |
namebfr[5] = extended_help_index%10 + '0'; |
| 4223 |
// CPhipps - patch drawing updated |
| 4224 |
V_ClearBorder(); // Redraw background for every ext HELP screen. Fixes widescreen overdraw. |
| 4225 |
V_DrawNamePatchFS(0, 0, 0, namebfr, CR_DEFAULT, VPT_STRETCH); |
| 4226 |
} |
| 4227 |
|
| 4228 |
// |
| 4229 |
// End of Extended HELP screens // phares 3/30/98 |
| 4230 |
// |
| 4231 |
//////////////////////////////////////////////////////////////////////////// |
| 4232 |
|
| 4233 |
static int M_GetKeyString(int c,int offset) |
| 4234 |
{ |
| 4235 |
const char* s; |
| 4236 |
|
| 4237 |
if (c >= 33 && c <= 126) { |
| 4238 |
|
| 4239 |
// The '=', ',', and '.' keys originally meant the shifted |
| 4240 |
// versions of those keys, but w/o having to shift them in |
| 4241 |
// the game. Any actions that are mapped to these keys will |
| 4242 |
// still mean their shifted versions. Could be changed later |
| 4243 |
// if someone can come up with a better way to deal with them. |
| 4244 |
|
| 4245 |
if (c == '=') // probably means the '+' key? |
| 4246 |
c = '+'; |
| 4247 |
else if (c == ',') // probably means the '<' key? |
| 4248 |
c = '<'; |
| 4249 |
else if (c == '.') // probably means the '>' key? |
| 4250 |
c = '>'; |
| 4251 |
menu_buffer[offset++] = c; // Just insert the ascii key |
| 4252 |
menu_buffer[offset] = 0; |
| 4253 |
|
| 4254 |
} else { |
| 4255 |
|
| 4256 |
// Retrieve 4-letter (max) string representing the key |
| 4257 |
|
| 4258 |
// cph - Keypad keys, general code reorganisation to |
| 4259 |
// make this smaller and neater. |
| 4260 |
if ((0x100 <= c) && (c < 0x200)) { |
| 4261 |
if (c == KEYD_KEYPADENTER) |
| 4262 |
s = "PADE"; |
| 4263 |
else { |
| 4264 |
strcpy(&menu_buffer[offset], "PAD"); |
| 4265 |
offset+=4; |
| 4266 |
menu_buffer[offset-1] = c & 0xff; |
| 4267 |
menu_buffer[offset] = 0; |
| 4268 |
} |
| 4269 |
} else if ((KEYD_F1 <= c) && (c < KEYD_F10)) { |
| 4270 |
menu_buffer[offset++] = 'F'; |
| 4271 |
menu_buffer[offset++] = '1' + c - KEYD_F1; |
| 4272 |
menu_buffer[offset] = 0; |
| 4273 |
} else { |
| 4274 |
switch(c) { |
| 4275 |
case KEYD_TAB: s = "TAB"; break; |
| 4276 |
case KEYD_ENTER: s = "ENTR"; break; |
| 4277 |
case KEYD_ESCAPE: s = "ESC"; break; |
| 4278 |
case KEYD_SPACEBAR: s = "SPAC"; break; |
| 4279 |
case KEYD_BACKSPACE: s = "BACK"; break; |
| 4280 |
case KEYD_RCTRL: s = "CTRL"; break; |
| 4281 |
case KEYD_LEFTARROW: s = "LARR"; break; |
| 4282 |
case KEYD_UPARROW: s = "UARR"; break; |
| 4283 |
case KEYD_RIGHTARROW: s = "RARR"; break; |
| 4284 |
case KEYD_DOWNARROW: s = "DARR"; break; |
| 4285 |
case KEYD_RSHIFT: s = "SHFT"; break; |
| 4286 |
case KEYD_RALT: s = "ALT"; break; |
| 4287 |
case KEYD_CAPSLOCK: s = "CAPS"; break; |
| 4288 |
case KEYD_SCROLLLOCK: s = "SCRL"; break; |
| 4289 |
case KEYD_HOME: s = "HOME"; break; |
| 4290 |
case KEYD_PAGEUP: s = "PGUP"; break; |
| 4291 |
case KEYD_END: s = "END"; break; |
| 4292 |
case KEYD_PAGEDOWN: s = "PGDN"; break; |
| 4293 |
case KEYD_INSERT: s = "INST"; break; |
| 4294 |
case KEYD_DEL: s = "DEL"; break; |
| 4295 |
case KEYD_F10: s = "F10"; break; |
| 4296 |
case KEYD_F11: s = "F11"; break; |
| 4297 |
case KEYD_F12: s = "F12"; break; |
| 4298 |
case KEYD_PAUSE: s = "PAUS"; break; |
| 4299 |
case KEYD_MWHEELDOWN: s = "MWDN"; break; |
| 4300 |
case KEYD_MWHEELUP: s = "MWUP"; break; |
| 4301 |
case KEYD_MWHEELLEFT: s = "MWLT"; break; |
| 4302 |
case KEYD_MWHEELRIGHT: s = "MWRT"; break; |
| 4303 |
case KEYD_PRINTSC: s = "PRSC"; break; |
| 4304 |
case 0: s = "NONE"; break; |
| 4305 |
default: s = "JUNK"; break; |
| 4306 |
} |
| 4307 |
|
| 4308 |
if (s) { // cph - Slight code change |
| 4309 |
strcpy(&menu_buffer[offset],s); // string to display |
| 4310 |
offset += strlen(s); |
| 4311 |
} |
| 4312 |
} |
| 4313 |
} |
| 4314 |
return offset; |
| 4315 |
} |
| 4316 |
|
| 4317 |
/* cph 2006/08/06 |
| 4318 |
* M_DrawString() is the old M_DrawMenuString, except that it is not tied to |
| 4319 |
* menu_buffer - no reason to force all the callers to write into one array! */ |
| 4320 |
|
| 4321 |
static void M_DrawString(int cx, int cy, int color, const char* ch) |
| 4322 |
{ |
| 4323 |
int w; |
| 4324 |
int c; |
| 4325 |
|
| 4326 |
while (*ch) { |
| 4327 |
c = *ch++; // get next char |
| 4328 |
c = toupper(c) - HU_FONTSTART; |
| 4329 |
if (c < 0 || c> HU_FONTSIZE) |
| 4330 |
{ |
| 4331 |
cx += menu_font->space_width; |
| 4332 |
continue; |
| 4333 |
} |
| 4334 |
w = menu_font->font[c].width; |
| 4335 |
if (cx + w > 320) |
| 4336 |
break; |
| 4337 |
|
| 4338 |
// V_DrawpatchTranslated() will draw the string in the |
| 4339 |
// desired color, colrngs[color] |
| 4340 |
|
| 4341 |
// CPhipps - patch drawing updated |
| 4342 |
V_DrawNumPatch(cx, cy, 0, menu_font->font[c].lumpnum, color, VPT_STRETCH | VPT_TRANS); |
| 4343 |
// The screen is cramped, so trim one unit from each |
| 4344 |
// character so they butt up against each other. |
| 4345 |
cx += w + g_menu_font_spacing; |
| 4346 |
} |
| 4347 |
} |
| 4348 |
|
| 4349 |
// M_DrawMenuString() draws the string in menu_buffer[] |
| 4350 |
|
| 4351 |
static void M_DrawMenuString(int cx, int cy, int color) |
| 4352 |
{ |
| 4353 |
M_DrawString(cx, cy, color, menu_buffer); |
| 4354 |
} |
| 4355 |
|
| 4356 |
// M_GetPixelWidth() returns the number of pixels in the width of |
| 4357 |
// the string, NOT the number of chars in the string. |
| 4358 |
|
| 4359 |
static int M_GetPixelWidth(const char* ch) |
| 4360 |
{ |
| 4361 |
int len = 0; |
| 4362 |
int c; |
| 4363 |
|
| 4364 |
while (*ch) { |
| 4365 |
c = *ch++; // pick up next char |
| 4366 |
c = toupper(c) - HU_FONTSTART; |
| 4367 |
if (c < 0 || c > HU_FONTSIZE) |
| 4368 |
{ |
| 4369 |
len += menu_font->space_width; |
| 4370 |
continue; |
| 4371 |
} |
| 4372 |
len += menu_font->font[c].width; |
| 4373 |
len += g_menu_font_spacing; |
| 4374 |
} |
| 4375 |
len -= g_menu_font_spacing; // replace what you took away on the last char only |
| 4376 |
return len; |
| 4377 |
} |
| 4378 |
|
| 4379 |
static void M_DrawStringCentered(int cx, int cy, int color, const char* ch) |
| 4380 |
{ |
| 4381 |
M_DrawString(cx - M_GetPixelWidth(ch)/2, cy, color, ch); |
| 4382 |
} |
| 4383 |
|
| 4384 |
// |
| 4385 |
// M_DrawHelp |
| 4386 |
// |
| 4387 |
// This displays the help screen |
| 4388 |
|
| 4389 |
static void M_DrawHelp (void) |
| 4390 |
{ |
| 4391 |
const char* helplump = (gamemode == commercial) ? "HELP" : "HELP1"; |
| 4392 |
|
| 4393 |
M_ChangeMenu(NULL, mnact_full); |
| 4394 |
|
| 4395 |
V_ClearBorder(); |
| 4396 |
V_DrawNamePatchFS(0, 0, 0, helplump, CR_DEFAULT, VPT_STRETCH); |
| 4397 |
} |
| 4398 |
|
| 4399 |
// |
| 4400 |
// M_DrawAd |
| 4401 |
// |
| 4402 |
// This displays the help2 screen |
| 4403 |
|
| 4404 |
static void M_DrawAd (void) |
| 4405 |
{ |
| 4406 |
const char* help2 = "HELP2"; |
| 4407 |
|
| 4408 |
M_ChangeMenu(NULL, mnact_full); |
| 4409 |
|
| 4410 |
V_ClearBorder(); |
| 4411 |
if (pwad_help2_check || gamemode == shareware) |
| 4412 |
V_DrawNamePatchFS(0, 0, 0, help2, CR_DEFAULT, VPT_STRETCH); |
| 4413 |
else |
| 4414 |
M_DrawCredits(); |
| 4415 |
} |
| 4416 |
|
| 4417 |
#define CR_X 20 |
| 4418 |
#define CR_X2 50 |
| 4419 |
|
| 4420 |
setup_menu_t cred_settings[]={ |
| 4421 |
{"Programmers",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X}, |
| 4422 |
{"Florian 'Proff' Schulze",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4423 |
{"Colin Phipps",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4424 |
{"Neil Stevens",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4425 |
{"Andrey Budko",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4426 |
EMPTY_LINE, |
| 4427 |
{"Additional Credit To",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X}, |
| 4428 |
{"id Software for DOOM",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4429 |
{"TeamTNT for BOOM",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4430 |
{"Lee Killough for MBF",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4431 |
{"The DOSDoom-Team for DOSDOOM",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4432 |
{"Marisa Heit for ZDOOM",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4433 |
{"Michael 'Kodak' Ryssen for DOOMGL",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4434 |
{"Jess Haas for lSDLDoom",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4435 |
{"all others who helped (see AUTHORS file)",S_SKIP|S_CREDIT|S_LEFTJUST,m_null, CR_X2}, |
| 4436 |
|
| 4437 |
FINAL_ENTRY |
| 4438 |
}; |
| 4439 |
|
| 4440 |
void M_DrawCredits(void) // killough 10/98: credit screen |
| 4441 |
{ |
| 4442 |
inhelpscreens = true; |
| 4443 |
|
| 4444 |
V_ClearBorder(); |
| 4445 |
V_DrawNamePatchFS(0, 0, 0, "CREDIT", CR_DEFAULT, VPT_STRETCH); |
| 4446 |
} |
| 4447 |
|
| 4448 |
void M_DrawCreditsDynamic(void) // Dynamic Credits |
| 4449 |
{ |
| 4450 |
inhelpscreens = true; |
| 4451 |
|
| 4452 |
// Use V_DrawBackground here deliberately to force drawing a background |
| 4453 |
V_DrawBackground(gamemode==shareware ? "CEIL5_1" : "MFLR8_4", 0); |
| 4454 |
M_DrawTitle(9, PROJECT_NAME " v" PROJECT_VERSION, cr_title); // PRBOOM |
| 4455 |
M_DrawScreenItems(cred_settings, 32); |
| 4456 |
} |
| 4457 |
|
| 4458 |
static int M_IndexInChoices(const char *str, const char **choices) { |
| 4459 |
int i = 0; |
| 4460 |
|
| 4461 |
while (*choices != NULL) { |
| 4462 |
if (!strcmp(str, *choices)) |
| 4463 |
return i; |
| 4464 |
i++; |
| 4465 |
choices++; |
| 4466 |
} |
| 4467 |
return 0; |
| 4468 |
} |
| 4469 |
|
| 4470 |
// [FG] support more joystick and mouse buttons |
| 4471 |
|
| 4472 |
static inline int GetButtons(const unsigned int max, int data) |
| 4473 |
{ |
| 4474 |
int i; |
| 4475 |
|
| 4476 |
for (i = 0; i < max; ++i) |
| 4477 |
{ |
| 4478 |
if (data & (1 << i)) |
| 4479 |
{ |
| 4480 |
return i; |
| 4481 |
} |
| 4482 |
} |
| 4483 |
|
| 4484 |
return -1; |
| 4485 |
} |
| 4486 |
|
| 4487 |
typedef struct { |
| 4488 |
int input; |
| 4489 |
dsda_config_identifier_t config_id; |
| 4490 |
int allowed_in_strict_mode; |
| 4491 |
dboolean persist; |
| 4492 |
const char* message; |
| 4493 |
dboolean invert_message; |
| 4494 |
dboolean play_sound; |
| 4495 |
} toggle_input_t; |
| 4496 |
|
| 4497 |
static toggle_input_t toggle_inputs[] = { |
| 4498 |
{ dsda_input_strict_mode, dsda_config_strict_mode, true, false, "Strict Mode" }, |
| 4499 |
{ dsda_input_novert, dsda_config_vertmouse, true, false, "Vertical Mouse Movement", .play_sound = true }, |
| 4500 |
{ dsda_input_mlook, dsda_config_freelook, true, true, "Free Look", .play_sound = true }, |
| 4501 |
{ dsda_input_autorun, dsda_config_autorun, true, true, "Auto Run", .play_sound = true }, |
| 4502 |
{ dsda_input_messages, dsda_config_show_messages, true, true, "Messages" }, |
| 4503 |
{ dsda_input_command_display, dsda_config_command_display, false, true, "Command Display" }, |
| 4504 |
{ dsda_input_coordinate_display, dsda_config_coordinate_display, false, true, "Coordinate Display" }, |
| 4505 |
{ dsda_input_fps, dsda_config_show_fps, true, true, "FPS" }, |
| 4506 |
{ dsda_input_exhud, dsda_config_exhud, true, true, "Extended HUD" }, |
| 4507 |
{ dsda_input_mute_sfx, dsda_config_mute_sfx, true, true, "SFX", true }, |
| 4508 |
{ dsda_input_mute_music, dsda_config_mute_music, true, true, "Music", true }, |
| 4509 |
{ dsda_input_cheat_codes, dsda_config_cheat_codes, false, true, "Cheat Codes" }, |
| 4510 |
{ -1 } |
| 4511 |
}; |
| 4512 |
|
| 4513 |
static void M_HandleToggles(void) |
| 4514 |
{ |
| 4515 |
toggle_input_t* toggle; |
| 4516 |
|
| 4517 |
for (toggle = toggle_inputs; toggle->input != -1; toggle++) { |
| 4518 |
if ( |
| 4519 |
dsda_InputActivated(toggle->input) && |
| 4520 |
(toggle->allowed_in_strict_mode || !dsda_StrictMode()) |
| 4521 |
) |
| 4522 |
{ |
| 4523 |
int value; |
| 4524 |
|
| 4525 |
value = dsda_ToggleConfig(toggle->config_id, toggle->persist); |
| 4526 |
doom_printf("%s %s", toggle->message, value ? toggle->invert_message ? "off" : "on" |
| 4527 |
: toggle->invert_message ? "on" : "off"); |
| 4528 |
|
| 4529 |
if (toggle->play_sound && dsda_IntConfig(dsda_config_movement_toggle_sfx)) |
| 4530 |
{ |
| 4531 |
if (toggle->invert_message ? !value : value) |
| 4532 |
{ |
| 4533 |
S_StartVoidSound(g_sfx_console); |
| 4534 |
} |
| 4535 |
else |
| 4536 |
{ |
| 4537 |
S_StartVoidSound(g_sfx_oof); |
| 4538 |
} |
| 4539 |
} |
| 4540 |
} |
| 4541 |
} |
| 4542 |
} |
| 4543 |
|
| 4544 |
dboolean M_ConsoleOpen(void) |
| 4545 |
{ |
| 4546 |
return menuactive && currentMenu == &dsda_ConsoleDef; |
| 4547 |
} |
| 4548 |
|
| 4549 |
void M_LeaveSetupMenu(void) |
| 4550 |
{ |
| 4551 |
M_SetSetupMenuItemOn(set_menu_itemon); |
| 4552 |
setup_active = false; |
| 4553 |
set_general_active = false; |
| 4554 |
set_keybnd_active = false; |
| 4555 |
set_display_active = false; |
| 4556 |
set_demos_active = false; |
| 4557 |
set_weapon_active = false; |
| 4558 |
set_auto_active = false; |
| 4559 |
colorbox_active = false; |
| 4560 |
level_table_active = false; |
| 4561 |
} |
| 4562 |
|
| 4563 |
///////////////////////////////////////////////////////////////////////////// |
| 4564 |
// |
| 4565 |
// M_Responder |
| 4566 |
// |
| 4567 |
// Examines incoming keystrokes and button pushes and determines some |
| 4568 |
// action based on the state of the system. |
| 4569 |
// |
| 4570 |
|
| 4571 |
static dboolean M_KeyBndResponder(int ch, int action, event_t* ev) |
| 4572 |
{ |
| 4573 |
// changing an entry |
| 4574 |
if (setup_select) |
| 4575 |
{ |
| 4576 |
int i; |
| 4577 |
setup_menu_t *ptr1 = current_setup_menu + set_menu_itemon; |
| 4578 |
setup_menu_t *ptr2 = NULL; |
| 4579 |
|
| 4580 |
int s_input = (ptr1->m_flags & S_INPUT) ? ptr1->input : 0; |
| 4581 |
|
| 4582 |
if (ev->type == ev_joystick) |
| 4583 |
{ |
| 4584 |
setup_group group; |
| 4585 |
dboolean search = true; |
| 4586 |
|
| 4587 |
if (!s_input) |
| 4588 |
return true; // not a legal action here (yet) |
| 4589 |
|
| 4590 |
// see if the button is already bound elsewhere. if so, you |
| 4591 |
// have to swap bindings so the action where it's currently |
| 4592 |
// bound doesn't go dead. Since there is more than one |
| 4593 |
// keybinding screen, you have to search all of them for |
| 4594 |
// any duplicates. You're only interested in the items |
| 4595 |
// that belong to the same group as the one you're changing. |
| 4596 |
|
| 4597 |
group = ptr1->m_group; |
| 4598 |
if ((ch = GetButtons(MAX_JOY_BUTTONS, ev->data1.i)) == -1) |
| 4599 |
return true; |
| 4600 |
|
| 4601 |
for (i = 0; keys_settings[i] && search; i++) |
| 4602 |
for (ptr2 = keys_settings[i]; !(ptr2->m_flags & S_END); ptr2++) |
| 4603 |
if (ptr2->m_group == group && ptr1 != ptr2) |
| 4604 |
{ |
| 4605 |
if (ptr2->m_flags & S_INPUT) |
| 4606 |
if (dsda_InputMatchJoyB(ptr2->input, ch)) |
| 4607 |
{ |
| 4608 |
dsda_InputRemoveJoyB(ptr2->input, ch); |
| 4609 |
search = false; |
| 4610 |
break; |
| 4611 |
} |
| 4612 |
} |
| 4613 |
|
| 4614 |
dsda_InputAddJoyB(s_input, ch); |
| 4615 |
} |
| 4616 |
else if (ev->type == ev_mouse) |
| 4617 |
{ |
| 4618 |
int i; |
| 4619 |
setup_group group; |
| 4620 |
dboolean search = true; |
| 4621 |
|
| 4622 |
if (!s_input) |
| 4623 |
return true; // not a legal action here (yet) |
| 4624 |
|
| 4625 |
// see if the button is already bound elsewhere. if so, you |
| 4626 |
// have to swap bindings so the action where it's currently |
| 4627 |
// bound doesn't go dead. Since there is more than one |
| 4628 |
// keybinding screen, you have to search all of them for |
| 4629 |
// any duplicates. You're only interested in the items |
| 4630 |
// that belong to the same group as the one you're changing. |
| 4631 |
|
| 4632 |
group = ptr1->m_group; |
| 4633 |
if ((ch = GetButtons(MAX_MOUSE_BUTTONS, ev->data1.i)) == -1) |
| 4634 |
return true; |
| 4635 |
|
| 4636 |
for (i = 0 ; keys_settings[i] && search ; i++) |
| 4637 |
for (ptr2 = keys_settings[i]; !(ptr2->m_flags & S_END); ptr2++) |
| 4638 |
if (ptr2->m_group == group && ptr1 != ptr2) |
| 4639 |
{ |
| 4640 |
if (ptr2->m_flags & S_INPUT) |
| 4641 |
if (dsda_InputMatchMouseB(ptr2->input, ch)) |
| 4642 |
{ |
| 4643 |
dsda_InputRemoveMouseB(ptr2->input, ch); |
| 4644 |
search = false; |
| 4645 |
break; |
| 4646 |
} |
| 4647 |
} |
| 4648 |
|
| 4649 |
dsda_InputAddMouseB(s_input, ch); |
| 4650 |
} |
| 4651 |
else // keyboard key |
| 4652 |
{ |
| 4653 |
int i; |
| 4654 |
setup_group group; |
| 4655 |
dboolean search = true; |
| 4656 |
|
| 4657 |
// see if 'ch' is already bound elsewhere. if so, you have |
| 4658 |
// to swap bindings so the action where it's currently |
| 4659 |
// bound doesn't go dead. Since there is more than one |
| 4660 |
// keybinding screen, you have to search all of them for |
| 4661 |
// any duplicates. You're only interested in the items |
| 4662 |
// that belong to the same group as the one you're changing. |
| 4663 |
|
| 4664 |
// if you find that you're trying to swap with an action |
| 4665 |
// that has S_KEEP set, you can't bind ch; it's already |
| 4666 |
// bound to that S_KEEP action, and that action has to |
| 4667 |
// keep that key. |
| 4668 |
|
| 4669 |
group = ptr1->m_group; |
| 4670 |
for (i = 0; keys_settings[i] && search; i++) |
| 4671 |
for (ptr2 = keys_settings[i]; !(ptr2->m_flags & S_END); ptr2++) |
| 4672 |
if (ptr2->m_group == group && ptr1 != ptr2) |
| 4673 |
{ |
| 4674 |
if (ptr2->m_flags & (S_INPUT | S_KEEP)) |
| 4675 |
if (dsda_InputMatchKey(ptr2->input, ch)) |
| 4676 |
{ |
| 4677 |
if (ptr2->m_flags & S_KEEP) |
| 4678 |
return true; // can't have it! |
| 4679 |
|
| 4680 |
dsda_InputRemoveKey(ptr2->input, ch); |
| 4681 |
search = false; |
| 4682 |
break; |
| 4683 |
} |
| 4684 |
} |
| 4685 |
|
| 4686 |
dsda_InputAddKey(s_input, ch); |
| 4687 |
} |
| 4688 |
|
| 4689 |
M_SelectDone(ptr1); // phares 4/17/98 |
| 4690 |
return true; |
| 4691 |
} |
| 4692 |
|
| 4693 |
return false; |
| 4694 |
} |
| 4695 |
|
| 4696 |
static dboolean M_WeaponResponder(int ch, int action, event_t* ev) |
| 4697 |
{ |
| 4698 |
// changing an entry |
| 4699 |
if (setup_select) |
| 4700 |
{ |
| 4701 |
setup_menu_t *ptr1 = current_setup_menu + set_menu_itemon; |
| 4702 |
setup_menu_t *ptr2 = NULL; |
| 4703 |
|
| 4704 |
if (action != MENU_ENTER) |
| 4705 |
{ |
| 4706 |
int old_value; |
| 4707 |
|
| 4708 |
ch -= '0'; // out of ascii |
| 4709 |
if (ch < 1 || ch > 9) |
| 4710 |
return true; // ignore |
| 4711 |
|
| 4712 |
// see if 'ch' is already assigned elsewhere. if so, |
| 4713 |
// you have to swap assignments. |
| 4714 |
ptr2 = weap_priority_settings; |
| 4715 |
old_value = dsda_IntConfig(ptr1->config_id); |
| 4716 |
for (; !(ptr2->m_flags & S_END); ptr2++) |
| 4717 |
if (ptr2->m_flags & S_WEAP && ptr1 != ptr2 && |
| 4718 |
dsda_IntConfig(ptr2->config_id) == ch) |
| 4719 |
{ |
| 4720 |
dsda_UpdateIntConfig(ptr2->config_id, old_value, true); |
| 4721 |
break; |
| 4722 |
} |
| 4723 |
|
| 4724 |
dsda_UpdateIntConfig(ptr1->config_id, ch, true); |
| 4725 |
} |
| 4726 |
|
| 4727 |
M_SelectDone(ptr1); // phares 4/17/98 |
| 4728 |
return true; |
| 4729 |
} |
| 4730 |
|
| 4731 |
return false; |
| 4732 |
} |
| 4733 |
|
| 4734 |
static dboolean M_AutoResponder(int ch, int action, event_t* ev) |
| 4735 |
{ |
| 4736 |
// changing an entry |
| 4737 |
if (setup_select) |
| 4738 |
{ |
| 4739 |
if (action == MENU_DOWN) |
| 4740 |
{ |
| 4741 |
if (++color_palette_y == 16) |
| 4742 |
color_palette_y = 0; |
| 4743 |
S_StartVoidSound(g_sfx_itemup); |
| 4744 |
return true; |
| 4745 |
} |
| 4746 |
|
| 4747 |
if (action == MENU_UP) |
| 4748 |
{ |
| 4749 |
if (--color_palette_y < 0) |
| 4750 |
color_palette_y = 15; |
| 4751 |
S_StartVoidSound(g_sfx_itemup); |
| 4752 |
return true; |
| 4753 |
} |
| 4754 |
|
| 4755 |
if (action == MENU_LEFT) |
| 4756 |
{ |
| 4757 |
if (--color_palette_x < 0) |
| 4758 |
color_palette_x = 15; |
| 4759 |
S_StartVoidSound(g_sfx_itemup); |
| 4760 |
return true; |
| 4761 |
} |
| 4762 |
|
| 4763 |
if (action == MENU_RIGHT) |
| 4764 |
{ |
| 4765 |
if (++color_palette_x == 16) |
| 4766 |
color_palette_x = 0; |
| 4767 |
S_StartVoidSound(g_sfx_itemup); |
| 4768 |
return true; |
| 4769 |
} |
| 4770 |
|
| 4771 |
if (action == MENU_ENTER) |
| 4772 |
{ |
| 4773 |
setup_menu_t *ptr1 = current_setup_menu + set_menu_itemon; |
| 4774 |
|
| 4775 |
dsda_UpdateIntConfig(ptr1->config_id, color_palette_x + 16 * color_palette_y, true); |
| 4776 |
M_SelectDone(ptr1); // phares 4/17/98 |
| 4777 |
colorbox_active = false; |
| 4778 |
return true; |
| 4779 |
} |
| 4780 |
} |
| 4781 |
|
| 4782 |
return false; |
| 4783 |
} |
| 4784 |
|
| 4785 |
static dboolean M_StringResponder(int ch, int action, event_t* ev) |
| 4786 |
{ |
| 4787 |
// changing an entry |
| 4788 |
if (setup_select) |
| 4789 |
{ |
| 4790 |
setup_menu_t *ptr1 = current_setup_menu + set_menu_itemon; |
| 4791 |
|
| 4792 |
if (ptr1->m_flags & S_STRING) // creating/editing a string? |
| 4793 |
{ |
| 4794 |
if (action == MENU_BACKSPACE) // backspace and DEL |
| 4795 |
{ |
| 4796 |
if (entry_string_index[entry_index] == 0) |
| 4797 |
{ |
| 4798 |
if (entry_index > 0) |
| 4799 |
entry_string_index[--entry_index] = 0; |
| 4800 |
} |
| 4801 |
// shift the remainder of the text one char left |
| 4802 |
else |
| 4803 |
{ |
| 4804 |
int i; |
| 4805 |
|
| 4806 |
for (i = entry_index; entry_string_index[i + 1]; ++i) |
| 4807 |
entry_string_index[i] = entry_string_index[i + 1]; |
| 4808 |
entry_string_index[i] = '\0'; |
| 4809 |
} |
| 4810 |
} |
| 4811 |
else if (action == MENU_LEFT) // move cursor left |
| 4812 |
{ |
| 4813 |
if (entry_index > 0) |
| 4814 |
entry_index--; |
| 4815 |
} |
| 4816 |
else if (action == MENU_RIGHT) // move cursor right |
| 4817 |
{ |
| 4818 |
if (entry_string_index[entry_index] != 0) |
| 4819 |
entry_index++; |
| 4820 |
} |
| 4821 |
else if ((action == MENU_ENTER) || (action == MENU_ESCAPE)) |
| 4822 |
{ |
| 4823 |
dsda_UpdateStringConfig(ptr1->config_id, entry_string_index, true); |
| 4824 |
M_SelectDone(ptr1); // phares 4/17/98 |
| 4825 |
} |
| 4826 |
|
| 4827 |
// Adding a char to the text. Has to be a printable |
| 4828 |
// char, and you can't overrun the buffer. If the |
| 4829 |
// string gets larger than what the screen can hold, |
| 4830 |
// it is dealt with when the string is drawn (above). |
| 4831 |
|
| 4832 |
else if ((ch >= 32) && (ch <= 126)) |
| 4833 |
if ((entry_index + 1) < ENTRY_STRING_BFR_SIZE) |
| 4834 |
{ |
| 4835 |
if (shiftdown) |
| 4836 |
ch = shiftxform[ch]; |
| 4837 |
if (entry_string_index[entry_index] == 0) |
| 4838 |
{ |
| 4839 |
entry_string_index[entry_index++] = ch; |
| 4840 |
entry_string_index[entry_index] = 0; |
| 4841 |
} |
| 4842 |
else |
| 4843 |
entry_string_index[entry_index++] = ch; |
| 4844 |
} |
| 4845 |
|
| 4846 |
return true; |
| 4847 |
} |
| 4848 |
|
| 4849 |
M_SelectDone(ptr1); // phares 4/17/98 |
| 4850 |
return true; |
| 4851 |
} |
| 4852 |
|
| 4853 |
return false; |
| 4854 |
} |
| 4855 |
|
| 4856 |
static dboolean M_LevelTableResponder(int ch, int action, event_t* ev) |
| 4857 |
{ |
| 4858 |
if (action == MENU_ENTER) |
| 4859 |
{ |
| 4860 |
int skill; |
| 4861 |
int map_index; |
| 4862 |
map_stats_t *map; |
| 4863 |
|
| 4864 |
if (current_setup_menu == level_table_page[wad_stats_summary_page]) |
| 4865 |
return true; |
| 4866 |
|
| 4867 |
map_index = set_menu_itemon - 1; |
| 4868 |
map = &wad_stats.maps[map_index]; |
| 4869 |
|
| 4870 |
skill = in_game ? gameskill : startskill; |
| 4871 |
|
| 4872 |
G_DeferedInitNew(skill, map->episode, map->map); |
| 4873 |
|
| 4874 |
M_LeaveSetupMenu(); |
| 4875 |
M_ClearMenus(); |
| 4876 |
S_StartVoidSound(g_sfx_swtchx); |
| 4877 |
|
| 4878 |
return true; |
| 4879 |
} |
| 4880 |
|
| 4881 |
return false; |
| 4882 |
} |
| 4883 |
|
| 4884 |
static dboolean M_SetupCommonSelectResponder(int ch, int action, event_t* ev) |
| 4885 |
{ |
| 4886 |
// changing an entry |
| 4887 |
if (setup_select) |
| 4888 |
{ |
| 4889 |
setup_menu_t* ptr1 = current_setup_menu + set_menu_itemon; |
| 4890 |
|
| 4891 |
if (action == MENU_ESCAPE) // Exit key = no change |
| 4892 |
{ |
| 4893 |
M_SelectDone(ptr1); // phares 4/17/98 |
| 4894 |
setup_gather = false; // finished gathering keys, if any |
| 4895 |
return true; |
| 4896 |
} |
| 4897 |
|
| 4898 |
if (ptr1->m_flags & S_YESNO) // yes or no setting? |
| 4899 |
{ |
| 4900 |
if (action == MENU_ENTER) { |
| 4901 |
dsda_ToggleConfig(ptr1->config_id, true); |
| 4902 |
} |
| 4903 |
M_SelectDone(ptr1); // phares 4/17/98 |
| 4904 |
return true; |
| 4905 |
} |
| 4906 |
|
| 4907 |
if (ptr1->m_flags & (S_NUM | S_CRITEM)) // number? |
| 4908 |
{ |
| 4909 |
if (setup_gather) { // gathering keys for a value? |
| 4910 |
/* killough 10/98: Allow negatives, and use a more |
| 4911 |
* friendly input method (e.g. don't clear value early, |
| 4912 |
* allow backspace, and return to original value if bad |
| 4913 |
* value is entered). |
| 4914 |
*/ |
| 4915 |
if (action == MENU_ENTER) { |
| 4916 |
if (gather_count) { // Any input? |
| 4917 |
int value; |
| 4918 |
|
| 4919 |
gather_buffer[gather_count] = 0; |
| 4920 |
value = atoi(gather_buffer); // Integer value |
| 4921 |
|
| 4922 |
dsda_UpdateIntConfig(ptr1->config_id, value, true); |
| 4923 |
} |
| 4924 |
M_SelectDone(ptr1); // phares 4/17/98 |
| 4925 |
setup_gather = false; // finished gathering keys |
| 4926 |
return true; |
| 4927 |
} |
| 4928 |
|
| 4929 |
if (action == MENU_BACKSPACE && gather_count) { |
| 4930 |
gather_count--; |
| 4931 |
return true; |
| 4932 |
} |
| 4933 |
|
| 4934 |
if (gather_count >= MAXGATHER) |
| 4935 |
return true; |
| 4936 |
|
| 4937 |
if (!isdigit((unsigned char) ch) && ch != '-') |
| 4938 |
return true; // ignore |
| 4939 |
|
| 4940 |
/* killough 10/98: character-based numerical input */ |
| 4941 |
gather_buffer[gather_count++] = ch; |
| 4942 |
} |
| 4943 |
return true; |
| 4944 |
} |
| 4945 |
|
| 4946 |
if (ptr1->m_flags & S_CHOICE) // selection of choices? |
| 4947 |
{ |
| 4948 |
if (action == MENU_LEFT) { |
| 4949 |
if (ptr1->m_flags & S_STR) |
| 4950 |
{ |
| 4951 |
int old_value, value; |
| 4952 |
|
| 4953 |
old_value = M_IndexInChoices(entry_string_index, ptr1->selectstrings); |
| 4954 |
value = old_value - 1; |
| 4955 |
if (value < 0) |
| 4956 |
value = 0; |
| 4957 |
if (old_value != value) |
| 4958 |
{ |
| 4959 |
S_StartVoidSound(g_sfx_menu); |
| 4960 |
strncpy(entry_string_index, ptr1->selectstrings[value], ENTRY_STRING_BFR_SIZE - 1); |
| 4961 |
} |
| 4962 |
} |
| 4963 |
else |
| 4964 |
{ |
| 4965 |
int value = choice_value; |
| 4966 |
|
| 4967 |
do { |
| 4968 |
--value; |
| 4969 |
} while (value > 0 && ptr1->selectstrings && ptr1->selectstrings[value][0] == '~'); |
| 4970 |
|
| 4971 |
if (value >= 0 && choice_value != value) { |
| 4972 |
S_StartVoidSound(g_sfx_menu); |
| 4973 |
choice_value = value; |
| 4974 |
} |
| 4975 |
} |
| 4976 |
} |
| 4977 |
else if (action == MENU_RIGHT) { |
| 4978 |
if (ptr1->m_flags & S_STR) |
| 4979 |
{ |
| 4980 |
int old_value, value; |
| 4981 |
|
| 4982 |
old_value = M_IndexInChoices(entry_string_index, ptr1->selectstrings); |
| 4983 |
value = old_value + 1; |
| 4984 |
if (ptr1->selectstrings[value] == NULL) |
| 4985 |
value = old_value; |
| 4986 |
if (old_value != value) |
| 4987 |
{ |
| 4988 |
S_StartVoidSound(g_sfx_menu); |
| 4989 |
strncpy(entry_string_index, ptr1->selectstrings[value], ENTRY_STRING_BFR_SIZE - 1); |
| 4990 |
} |
| 4991 |
} |
| 4992 |
else |
| 4993 |
{ |
| 4994 |
int value = choice_value; |
| 4995 |
|
| 4996 |
do { |
| 4997 |
++value; |
| 4998 |
} while (ptr1->selectstrings && ptr1->selectstrings[value] && ptr1->selectstrings[value][0] == '~'); |
| 4999 |
|
| 5000 |
if (ptr1->selectstrings[value] && choice_value != value) { |
| 5001 |
S_StartVoidSound(g_sfx_menu); |
| 5002 |
choice_value = value; |
| 5003 |
} |
| 5004 |
} |
| 5005 |
} |
| 5006 |
else if (action == MENU_ENTER) { |
| 5007 |
if (ptr1->m_flags & S_STR) |
| 5008 |
{ |
| 5009 |
dsda_UpdateStringConfig(ptr1->config_id, entry_string_index, true); |
| 5010 |
} |
| 5011 |
else |
| 5012 |
{ |
| 5013 |
dsda_UpdateIntConfig(ptr1->config_id, choice_value, true); |
| 5014 |
} |
| 5015 |
M_SelectDone(ptr1); // phares 4/17/98 |
| 5016 |
} |
| 5017 |
return true; |
| 5018 |
} |
| 5019 |
|
| 5020 |
if (ptr1->m_flags & S_THERMO) |
| 5021 |
{ |
| 5022 |
if (action == MENU_LEFT) { |
| 5023 |
if (dsda_IntConfig(ptr1->config_id) > 0) { |
| 5024 |
dsda_DecrementIntConfig(ptr1->config_id, true); |
| 5025 |
S_StartVoidSound(g_sfx_menu); |
| 5026 |
} |
| 5027 |
} |
| 5028 |
else if (action == MENU_RIGHT) { |
| 5029 |
if (dsda_IntConfig(ptr1->config_id) < 15) { |
| 5030 |
dsda_IncrementIntConfig(ptr1->config_id, true); |
| 5031 |
S_StartVoidSound(g_sfx_menu); |
| 5032 |
} |
| 5033 |
} |
| 5034 |
else if (action == MENU_ENTER) { |
| 5035 |
M_SelectDone(ptr1); |
| 5036 |
} |
| 5037 |
return true; |
| 5038 |
} |
| 5039 |
} |
| 5040 |
|
| 5041 |
return false; |
| 5042 |
} |
| 5043 |
|
| 5044 |
static dboolean M_SetupNavigationResponder(int ch, int action, event_t* ev) |
| 5045 |
{ |
| 5046 |
setup_menu_t* ptr1 = current_setup_menu + set_menu_itemon; |
| 5047 |
setup_menu_t* ptr2 = NULL; |
| 5048 |
|
| 5049 |
if (action == MENU_DOWN) |
| 5050 |
{ |
| 5051 |
if (ptr1->m_flags & S_NOSELECT) |
| 5052 |
return true; |
| 5053 |
|
| 5054 |
ptr1->m_flags &= ~S_HILITE; // phares 4/17/98 |
| 5055 |
do |
| 5056 |
if (ptr1->m_flags & S_END) |
| 5057 |
{ |
| 5058 |
set_menu_itemon = 0; |
| 5059 |
ptr1 = current_setup_menu; |
| 5060 |
} |
| 5061 |
else |
| 5062 |
{ |
| 5063 |
set_menu_itemon++; |
| 5064 |
ptr1++; |
| 5065 |
} |
| 5066 |
while (ptr1->m_flags & S_SKIP); |
| 5067 |
M_SelectDone(ptr1); // phares 4/17/98 |
| 5068 |
return true; |
| 5069 |
} |
| 5070 |
|
| 5071 |
if (action == MENU_UP) |
| 5072 |
{ |
| 5073 |
if (ptr1->m_flags & S_NOSELECT) |
| 5074 |
return true; |
| 5075 |
|
| 5076 |
ptr1->m_flags &= ~S_HILITE; // phares 4/17/98 |
| 5077 |
do |
| 5078 |
{ |
| 5079 |
if (set_menu_itemon == 0) |
| 5080 |
do |
| 5081 |
set_menu_itemon++; |
| 5082 |
while(!((current_setup_menu + set_menu_itemon)->m_flags & S_END)); |
| 5083 |
set_menu_itemon--; |
| 5084 |
} |
| 5085 |
while((current_setup_menu + set_menu_itemon)->m_flags & S_SKIP); |
| 5086 |
M_SelectDone(current_setup_menu + set_menu_itemon); // phares 4/17/98 |
| 5087 |
return true; |
| 5088 |
} |
| 5089 |
|
| 5090 |
if (action == MENU_CLEAR) |
| 5091 |
{ |
| 5092 |
if (ptr1->m_flags & S_INPUT) |
| 5093 |
{ |
| 5094 |
if (ptr1->m_flags & S_NOCLEAR) |
| 5095 |
{ |
| 5096 |
S_StartVoidSound(g_sfx_oof); |
| 5097 |
} |
| 5098 |
else |
| 5099 |
{ |
| 5100 |
dsda_InputReset(ptr1->input); |
| 5101 |
} |
| 5102 |
} |
| 5103 |
|
| 5104 |
return true; |
| 5105 |
} |
| 5106 |
|
| 5107 |
if (action == MENU_ENTER) |
| 5108 |
{ |
| 5109 |
int flags = ptr1->m_flags; |
| 5110 |
|
| 5111 |
if (dsda_StrictMode() && dsda_IsStrictConfig(ptr1->config_id)) |
| 5112 |
return true; |
| 5113 |
|
| 5114 |
// You've selected an item to change. Highlight it, post a new |
| 5115 |
// message about what to do, and get ready to process the |
| 5116 |
// change. |
| 5117 |
// |
| 5118 |
// killough 10/98: use friendlier char-based input buffer |
| 5119 |
|
| 5120 |
if (flags & (S_NUM | S_CRITEM)) |
| 5121 |
{ |
| 5122 |
setup_gather = true; |
| 5123 |
gather_count = 0; |
| 5124 |
} |
| 5125 |
else if (flags & S_COLOR) |
| 5126 |
{ |
| 5127 |
int color = dsda_IntConfig(ptr1->config_id); |
| 5128 |
|
| 5129 |
if (color < 0 || color > 255) // range check the value |
| 5130 |
color = 0; // 'no show' if invalid |
| 5131 |
|
| 5132 |
color_palette_x = color & 15; |
| 5133 |
color_palette_y = color >> 4; |
| 5134 |
colorbox_active = true; |
| 5135 |
} |
| 5136 |
else if (flags & S_STRING) |
| 5137 |
{ |
| 5138 |
strncpy(entry_string_index, dsda_StringConfig(ptr1->config_id), |
| 5139 |
ENTRY_STRING_BFR_SIZE - 1); |
| 5140 |
|
| 5141 |
entry_index = 0; // current cursor position in entry_string_index |
| 5142 |
} |
| 5143 |
else if (flags & S_CHOICE) |
| 5144 |
{ |
| 5145 |
if (flags & S_STR) |
| 5146 |
{ |
| 5147 |
strncpy(entry_string_index, dsda_StringConfig(ptr1->config_id), |
| 5148 |
ENTRY_STRING_BFR_SIZE - 1); |
| 5149 |
} |
| 5150 |
else |
| 5151 |
{ |
| 5152 |
choice_value = dsda_IntConfig(ptr1->config_id); |
| 5153 |
} |
| 5154 |
} |
| 5155 |
|
| 5156 |
ptr1->m_flags |= S_SELECT; |
| 5157 |
setup_select = true; |
| 5158 |
S_StartVoidSound(g_sfx_itemup); |
| 5159 |
return true; |
| 5160 |
} |
| 5161 |
|
| 5162 |
if ((action == MENU_ESCAPE) || (action == MENU_BACKSPACE)) |
| 5163 |
{ |
| 5164 |
M_LeaveSetupMenu(); |
| 5165 |
if (action == MENU_ESCAPE) // Clear all menus |
| 5166 |
M_ClearMenus(); |
| 5167 |
else // MENU_BACKSPACE = return to Setup Menu |
| 5168 |
if (currentMenu->prevMenu) |
| 5169 |
{ |
| 5170 |
M_ChangeMenu(currentMenu->prevMenu, mnact_nochange); |
| 5171 |
itemOn = currentMenu->lastOn; |
| 5172 |
S_StartVoidSound(g_sfx_swtchn); |
| 5173 |
} |
| 5174 |
ptr1->m_flags &= ~(S_HILITE|S_SELECT);// phares 4/19/98 |
| 5175 |
S_StartVoidSound(g_sfx_swtchx); |
| 5176 |
return true; |
| 5177 |
} |
| 5178 |
|
| 5179 |
// Some setup screens may have multiple screens. |
| 5180 |
// When there are multiple screens, m_prev and m_next items need to |
| 5181 |
// be placed on the appropriate screen tables so the user can |
| 5182 |
// move among the screens using the left and right arrow keys. |
| 5183 |
// The m_var1 field contains a pointer to the appropriate screen |
| 5184 |
// to move to. |
| 5185 |
|
| 5186 |
if (action == MENU_LEFT) |
| 5187 |
{ |
| 5188 |
ptr2 = ptr1; |
| 5189 |
do |
| 5190 |
{ |
| 5191 |
ptr2++; |
| 5192 |
if (ptr2->m_flags & S_PREV) |
| 5193 |
{ |
| 5194 |
ptr1->m_flags &= ~S_HILITE; |
| 5195 |
M_SetSetupMenuItemOn(set_menu_itemon); |
| 5196 |
M_UpdateSetupMenu(ptr2->menu); |
| 5197 |
S_StartVoidSound(g_sfx_menu); // killough 10/98 |
| 5198 |
previous_page = current_page; |
| 5199 |
current_page--; |
| 5200 |
return true; |
| 5201 |
} |
| 5202 |
} |
| 5203 |
while (!(ptr2->m_flags & S_END)); |
| 5204 |
} |
| 5205 |
|
| 5206 |
if (action == MENU_RIGHT) |
| 5207 |
{ |
| 5208 |
ptr2 = ptr1; |
| 5209 |
do |
| 5210 |
{ |
| 5211 |
ptr2++; |
| 5212 |
if (ptr2->m_flags & S_NEXT) |
| 5213 |
{ |
| 5214 |
ptr1->m_flags &= ~S_HILITE; |
| 5215 |
M_SetSetupMenuItemOn(set_menu_itemon); |
| 5216 |
M_UpdateSetupMenu(ptr2->menu); |
| 5217 |
S_StartVoidSound(g_sfx_menu); // killough 10/98 |
| 5218 |
previous_page = current_page; |
| 5219 |
current_page++; |
| 5220 |
return true; |
| 5221 |
} |
| 5222 |
} |
| 5223 |
while (!(ptr2->m_flags & S_END)); |
| 5224 |
} |
| 5225 |
|
| 5226 |
return false; |
| 5227 |
} |
| 5228 |
|
| 5229 |
static dboolean M_SetupResponder(int ch, int action, event_t* ev) |
| 5230 |
{ |
| 5231 |
if (M_SetupCommonSelectResponder(ch, action, ev)) |
| 5232 |
return true; |
| 5233 |
|
| 5234 |
if (set_keybnd_active) // on a key binding setup screen |
| 5235 |
if (M_KeyBndResponder(ch, action, ev)) |
| 5236 |
return true; |
| 5237 |
|
| 5238 |
if (set_weapon_active) // on the weapons setup screen |
| 5239 |
if (M_WeaponResponder(ch, action, ev)) |
| 5240 |
return true; |
| 5241 |
|
| 5242 |
if (set_auto_active) // on the automap setup screen |
| 5243 |
if (M_AutoResponder(ch, action, ev)) |
| 5244 |
return true; |
| 5245 |
|
| 5246 |
// killough 10/98: consolidate handling into one place: |
| 5247 |
if (set_general_active || set_demos_active || set_display_active) |
| 5248 |
if (M_StringResponder(ch, action, ev)) |
| 5249 |
return true; |
| 5250 |
|
| 5251 |
if (level_table_active) |
| 5252 |
if (M_LevelTableResponder(ch, action, ev)) |
| 5253 |
return true; |
| 5254 |
|
| 5255 |
// Not changing any items on the Setup screens. See if we're |
| 5256 |
// navigating the Setup menus or selecting an item to change. |
| 5257 |
if (M_SetupNavigationResponder(ch, action, ev)) |
| 5258 |
return true; |
| 5259 |
|
| 5260 |
return false; |
| 5261 |
} |
| 5262 |
|
| 5263 |
static dboolean M_InactiveMenuResponder(int ch, int action, event_t* ev) |
| 5264 |
{ |
| 5265 |
if (dsda_InputActivated(dsda_input_help)) // phares |
| 5266 |
{ |
| 5267 |
menu_t* F1_menu = raven ? &InfoDef1 : &ReadDef1; |
| 5268 |
M_StartControlPanel (); |
| 5269 |
M_ChangeMenu(F1_menu, mnact_nochange); |
| 5270 |
|
| 5271 |
itemOn = 0; |
| 5272 |
S_StartVoidSound(g_sfx_swtchn); |
| 5273 |
return true; |
| 5274 |
} |
| 5275 |
|
| 5276 |
if (dsda_InputActivated(dsda_input_savegame)) |
| 5277 |
{ |
| 5278 |
M_StartControlPanel(); |
| 5279 |
S_StartVoidSound(g_sfx_swtchn); |
| 5280 |
M_SaveGame(0); |
| 5281 |
return true; |
| 5282 |
} |
| 5283 |
|
| 5284 |
if (dsda_InputActivated(dsda_input_loadgame)) |
| 5285 |
{ |
| 5286 |
M_StartControlPanel(); |
| 5287 |
S_StartVoidSound(g_sfx_swtchn); |
| 5288 |
M_LoadGame(0); |
| 5289 |
return true; |
| 5290 |
} |
| 5291 |
|
| 5292 |
if (dsda_InputActivated(dsda_input_level_table)) |
| 5293 |
{ |
| 5294 |
M_StartControlPanel(); |
| 5295 |
S_StartVoidSound(g_sfx_swtchn); |
| 5296 |
M_LevelTable(0); |
| 5297 |
return true; |
| 5298 |
} |
| 5299 |
|
| 5300 |
if (dsda_InputActivated(dsda_input_soundvolume)) |
| 5301 |
{ |
| 5302 |
M_StartControlPanel (); |
| 5303 |
M_ChangeMenu(&SoundDef, mnact_nochange); |
| 5304 |
itemOn = sfx_vol; |
| 5305 |
S_StartVoidSound(g_sfx_swtchn); |
| 5306 |
return true; |
| 5307 |
} |
| 5308 |
|
| 5309 |
if (dsda_InputActivated(dsda_input_quicksave)) |
| 5310 |
{ |
| 5311 |
S_StartVoidSound(g_sfx_swtchn); |
| 5312 |
M_QuickSave(); |
| 5313 |
return true; |
| 5314 |
} |
| 5315 |
|
| 5316 |
if (dsda_InputActivated(dsda_input_endgame)) |
| 5317 |
{ |
| 5318 |
S_StartVoidSound(g_sfx_swtchn); |
| 5319 |
M_EndGame(0); |
| 5320 |
return true; |
| 5321 |
} |
| 5322 |
|
| 5323 |
if (dsda_InputActivated(dsda_input_quickload)) |
| 5324 |
{ |
| 5325 |
S_StartVoidSound(g_sfx_swtchn); |
| 5326 |
M_QuickLoad(); |
| 5327 |
return true; |
| 5328 |
} |
| 5329 |
|
| 5330 |
if (dsda_InputActivated(dsda_input_quit)) |
| 5331 |
{ |
| 5332 |
if (!dsda_SkipQuitPrompt()) |
| 5333 |
S_StartVoidSound(g_sfx_swtchn); |
| 5334 |
M_QuitDOOM(0); |
| 5335 |
return true; |
| 5336 |
} |
| 5337 |
|
| 5338 |
// Toggle gamma |
| 5339 |
if (dsda_InputActivated(dsda_input_gamma)) |
| 5340 |
{ |
| 5341 |
//e6y |
| 5342 |
dsda_CycleConfig(dsda_config_usegamma, true); |
| 5343 |
dsda_AddMessage(usegamma == 0 ? s_GAMMALVL0 : |
| 5344 |
usegamma == 1 ? s_GAMMALVL1 : |
| 5345 |
usegamma == 2 ? s_GAMMALVL2 : |
| 5346 |
usegamma == 3 ? s_GAMMALVL3 : |
| 5347 |
s_GAMMALVL4); |
| 5348 |
return true; |
| 5349 |
} |
| 5350 |
|
| 5351 |
if (dsda_InputActivated(dsda_input_cycle_profile)) |
| 5352 |
{ |
| 5353 |
int value = dsda_CycleConfig(dsda_config_input_profile, true); |
| 5354 |
doom_printf("Input Profile %d", value); |
| 5355 |
S_StartVoidSound(g_sfx_swtchn); |
| 5356 |
return true; |
| 5357 |
} |
| 5358 |
|
| 5359 |
if (dsda_InputActivated(dsda_input_cycle_palette)) |
| 5360 |
{ |
| 5361 |
dsda_CyclePlayPal(); |
| 5362 |
doom_printf("Palette %s", dsda_PlayPalData()->lump_name); |
| 5363 |
S_StartVoidSound(g_sfx_swtchn); |
| 5364 |
return true; |
| 5365 |
} |
| 5366 |
|
| 5367 |
//e6y |
| 5368 |
if (dsda_InputActivated(dsda_input_speed_default) && !dsda_StrictMode()) |
| 5369 |
{ |
| 5370 |
int value = StepwiseSum(dsda_GameSpeed(), 0, 3, 10000, 100); |
| 5371 |
dsda_UpdateGameSpeed(value); |
| 5372 |
doom_printf("Game Speed %d", value); |
| 5373 |
// Don't eat the keypress in this case. |
| 5374 |
// return true; |
| 5375 |
} |
| 5376 |
|
| 5377 |
if (dsda_InputActivated(dsda_input_speed_up) && !dsda_StrictMode()) |
| 5378 |
{ |
| 5379 |
int value = StepwiseSum(dsda_GameSpeed(), 1, 3, 10000, 100); |
| 5380 |
dsda_UpdateGameSpeed(value); |
| 5381 |
doom_printf("Game Speed %d", value); |
| 5382 |
// Don't eat the keypress in this case. |
| 5383 |
// return true; |
| 5384 |
} |
| 5385 |
|
| 5386 |
if (dsda_InputActivated(dsda_input_speed_down) && !dsda_StrictMode()) |
| 5387 |
{ |
| 5388 |
int value = StepwiseSum(dsda_GameSpeed(), -1, 3, 10000, 100); |
| 5389 |
dsda_UpdateGameSpeed(value); |
| 5390 |
doom_printf("Game Speed %d", value); |
| 5391 |
// Don't eat the keypress in this case. |
| 5392 |
// return true; |
| 5393 |
} |
| 5394 |
|
| 5395 |
// Pop-up Main menu? |
| 5396 |
if (ch == KEYD_ESCAPE || action == MENU_ESCAPE || |
| 5397 |
(!in_game && (ch == KEYD_ENTER || ch == KEYD_SPACEBAR || ch == KEYD_KEYPADENTER || |
| 5398 |
dsda_InputActivated(dsda_input_fire) || dsda_InputActivated(dsda_input_use) || dsda_InputActivated(dsda_input_menu_enter)))) // phares |
| 5399 |
{ |
| 5400 |
M_StartControlPanel(); |
| 5401 |
S_StartVoidSound(g_sfx_swtchn); |
| 5402 |
return true; |
| 5403 |
} |
| 5404 |
|
| 5405 |
if (dsda_InputActivated(dsda_input_console)) |
| 5406 |
{ |
| 5407 |
if (dsda_OpenConsole()) |
| 5408 |
S_StartVoidSound(g_sfx_swtchn); |
| 5409 |
return true; |
| 5410 |
} |
| 5411 |
|
| 5412 |
{ |
| 5413 |
int i; |
| 5414 |
|
| 5415 |
for (i = 0; i < CONSOLE_SCRIPT_COUNT; ++i) |
| 5416 |
if (dsda_InputActivated(dsda_input_script_0 + i)) { |
| 5417 |
dsda_ExecuteConsoleScript(i); |
| 5418 |
|
| 5419 |
return true; |
| 5420 |
} |
| 5421 |
} |
| 5422 |
|
| 5423 |
if (dsda_InputActivated(dsda_input_zoomout)) |
| 5424 |
{ |
| 5425 |
if (automap_active) |
| 5426 |
return false; |
| 5427 |
M_SizeDisplay(0); |
| 5428 |
S_StartVoidSound(g_sfx_stnmov); |
| 5429 |
return true; |
| 5430 |
} |
| 5431 |
|
| 5432 |
if (dsda_InputActivated(dsda_input_zoomin)) |
| 5433 |
{ // jff 2/23/98 |
| 5434 |
if (automap_active) // allow |
| 5435 |
return false; // key_hud==key_zoomin |
| 5436 |
M_SizeDisplay(1); // ^ |
| 5437 |
S_StartVoidSound(g_sfx_stnmov); // | |
| 5438 |
return true; // phares |
| 5439 |
} |
| 5440 |
|
| 5441 |
if (dsda_InputActivated(dsda_input_nextlevel)) |
| 5442 |
{ |
| 5443 |
if (userplayback && !dsda_SkipMode()) |
| 5444 |
{ |
| 5445 |
dsda_SkipToNextMap(); |
| 5446 |
return true; |
| 5447 |
} |
| 5448 |
else |
| 5449 |
{ |
| 5450 |
if (G_GotoNextLevel()) |
| 5451 |
return true; |
| 5452 |
} |
| 5453 |
} |
| 5454 |
|
| 5455 |
if (dsda_InputActivated(dsda_input_prevlevel)) |
| 5456 |
{ |
| 5457 |
if (G_GotoPrevLevel()) |
| 5458 |
return true; |
| 5459 |
} |
| 5460 |
|
| 5461 |
if (dsda_InputActivated(dsda_input_restart)) |
| 5462 |
{ |
| 5463 |
if (G_ReloadLevel()) |
| 5464 |
return true; |
| 5465 |
} |
| 5466 |
|
| 5467 |
if (dsda_InputActivated(dsda_input_demo_endlevel)) |
| 5468 |
{ |
| 5469 |
if (userplayback && !dsda_SkipMode()) |
| 5470 |
{ |
| 5471 |
dsda_SkipToEndOfMap(); |
| 5472 |
return true; |
| 5473 |
} |
| 5474 |
} |
| 5475 |
|
| 5476 |
if (dsda_InputActivated(dsda_input_demo_skip)) |
| 5477 |
{ |
| 5478 |
if (userplayback) |
| 5479 |
{ |
| 5480 |
dsda_ToggleSkipMode(); |
| 5481 |
return true; |
| 5482 |
} |
| 5483 |
} |
| 5484 |
|
| 5485 |
if (dsda_InputActivated(dsda_input_store_quick_key_frame)) |
| 5486 |
{ |
| 5487 |
if ( |
| 5488 |
gamestate == GS_LEVEL && |
| 5489 |
gameaction == ga_nothing && |
| 5490 |
!dsda_StrictMode() |
| 5491 |
) dsda_StoreQuickKeyFrame(); |
| 5492 |
return true; |
| 5493 |
} |
| 5494 |
|
| 5495 |
if (dsda_InputActivated(dsda_input_restore_quick_key_frame)) |
| 5496 |
{ |
| 5497 |
if (!dsda_StrictMode()) dsda_RestoreQuickKeyFrame(); |
| 5498 |
return true; |
| 5499 |
} |
| 5500 |
|
| 5501 |
if (dsda_InputActivated(dsda_input_rewind)) |
| 5502 |
{ |
| 5503 |
if (!dsda_StrictMode()) dsda_RewindAutoKeyFrame(); |
| 5504 |
return true; |
| 5505 |
} |
| 5506 |
|
| 5507 |
if (dsda_InputActivated(dsda_input_walkcamera)) |
| 5508 |
{ |
| 5509 |
if (demoplayback && gamestate == GS_LEVEL) |
| 5510 |
{ |
| 5511 |
walkcamera.type = (walkcamera.type+1)%3; |
| 5512 |
P_SyncWalkcam (true, (walkcamera.type!=2)); |
| 5513 |
R_ResetViewInterpolation (); |
| 5514 |
if (walkcamera.type==0) |
| 5515 |
R_SmoothPlaying_Reset(NULL); |
| 5516 |
// Don't eat the keypress in this case. |
| 5517 |
// return true; |
| 5518 |
} |
| 5519 |
} |
| 5520 |
|
| 5521 |
if (dsda_InputActivated(dsda_input_showalive) && !dsda_StrictMode()) |
| 5522 |
{ |
| 5523 |
if (V_IsOpenGLMode()) |
| 5524 |
{ |
| 5525 |
const char* const show_alive_message[3] = { "off", "(mode 1) on", "(mode 2) on" }; |
| 5526 |
int show_alive = dsda_CycleConfig(dsda_config_show_alive_monsters, false); |
| 5527 |
|
| 5528 |
if (show_alive >= 0 && show_alive < 3) |
| 5529 |
doom_printf("Show Alive Monsters %s", show_alive_message[show_alive]); |
| 5530 |
} |
| 5531 |
else |
| 5532 |
{ |
| 5533 |
dsda_UpdateIntConfig(dsda_config_show_alive_monsters,0,false); |
| 5534 |
doom_printf("Action Only Supported in OpenGL"); |
| 5535 |
} |
| 5536 |
} |
| 5537 |
|
| 5538 |
M_HandleToggles(); |
| 5539 |
|
| 5540 |
if (dsda_InputActivated(dsda_input_hud)) // heads-up mode |
| 5541 |
{ |
| 5542 |
if (automap_active) // jff 2/22/98 |
| 5543 |
return false; // HUD mode control |
| 5544 |
M_SizeDisplay(2); |
| 5545 |
return true; |
| 5546 |
} |
| 5547 |
|
| 5548 |
return false; |
| 5549 |
} |
| 5550 |
|
| 5551 |
typedef enum { |
| 5552 |
confirmation_null = -1, |
| 5553 |
confirmation_no = 0, |
| 5554 |
confirmation_yes = 1, |
| 5555 |
} confirmation_t; |
| 5556 |
|
| 5557 |
static confirmation_t M_EventToConfirmation(int ch, int action, event_t* ev) |
| 5558 |
{ |
| 5559 |
if (ch == 'y' || action == MENU_ENTER) |
| 5560 |
return confirmation_yes; |
| 5561 |
else if (ch == ' ' || ch == KEYD_ESCAPE || ch == 'n' || action == MENU_BACKSPACE) |
| 5562 |
return confirmation_no; |
| 5563 |
else |
| 5564 |
return confirmation_null; |
| 5565 |
} |
| 5566 |
|
| 5567 |
static dboolean M_MainNavigationResponder(int ch, int action, event_t* ev) |
| 5568 |
{ |
| 5569 |
if (action == MENU_DOWN) // phares 3/7/98 |
| 5570 |
{ |
| 5571 |
do |
| 5572 |
{ |
| 5573 |
if (itemOn + 1 > currentMenu->numitems - 1) |
| 5574 |
itemOn = 0; |
| 5575 |
else |
| 5576 |
itemOn++; |
| 5577 |
S_StartVoidSound(g_sfx_menu); |
| 5578 |
} |
| 5579 |
while(currentMenu->menuitems[itemOn].status == -1); |
| 5580 |
return true; |
| 5581 |
} |
| 5582 |
|
| 5583 |
if (action == MENU_UP) // phares 3/7/98 |
| 5584 |
{ |
| 5585 |
do |
| 5586 |
{ |
| 5587 |
if (!itemOn) |
| 5588 |
itemOn = currentMenu->numitems - 1; |
| 5589 |
else |
| 5590 |
itemOn--; |
| 5591 |
S_StartVoidSound(g_sfx_menu); |
| 5592 |
} |
| 5593 |
while(currentMenu->menuitems[itemOn].status == -1); |
| 5594 |
return true; |
| 5595 |
} |
| 5596 |
|
| 5597 |
if (action == MENU_LEFT) // phares 3/7/98 |
| 5598 |
{ |
| 5599 |
if (currentMenu->menuitems[itemOn].routine && |
| 5600 |
currentMenu->menuitems[itemOn].status == 2) |
| 5601 |
{ |
| 5602 |
S_StartVoidSound(g_sfx_stnmov); |
| 5603 |
currentMenu->menuitems[itemOn].routine(0); |
| 5604 |
} |
| 5605 |
return true; |
| 5606 |
} |
| 5607 |
|
| 5608 |
if (action == MENU_RIGHT) // phares 3/7/98 |
| 5609 |
{ |
| 5610 |
if (currentMenu->menuitems[itemOn].routine && |
| 5611 |
currentMenu->menuitems[itemOn].status == 2) |
| 5612 |
{ |
| 5613 |
S_StartVoidSound(g_sfx_stnmov); |
| 5614 |
currentMenu->menuitems[itemOn].routine(1); |
| 5615 |
} |
| 5616 |
return true; |
| 5617 |
} |
| 5618 |
|
| 5619 |
if (action == MENU_ENTER) // phares 3/7/98 |
| 5620 |
{ |
| 5621 |
if (currentMenu->menuitems[itemOn].routine && |
| 5622 |
currentMenu->menuitems[itemOn].status) |
| 5623 |
{ |
| 5624 |
currentMenu->lastOn = itemOn; |
| 5625 |
if (currentMenu->menuitems[itemOn].status == 2) |
| 5626 |
{ |
| 5627 |
currentMenu->menuitems[itemOn].routine(1); // right arrow |
| 5628 |
S_StartVoidSound(g_sfx_stnmov); |
| 5629 |
} |
| 5630 |
else |
| 5631 |
{ |
| 5632 |
currentMenu->menuitems[itemOn].routine(itemOn); |
| 5633 |
S_StartVoidSound(g_sfx_pistol); |
| 5634 |
} |
| 5635 |
} |
| 5636 |
//jff 3/24/98 remember last skill selected |
| 5637 |
// killough 10/98 moved to skill-specific functions |
| 5638 |
return true; |
| 5639 |
} |
| 5640 |
|
| 5641 |
if (action == MENU_ESCAPE) // phares 3/7/98 |
| 5642 |
{ |
| 5643 |
currentMenu->lastOn = itemOn; |
| 5644 |
M_ClearMenus (); |
| 5645 |
S_StartVoidSound(g_sfx_swtchx); |
| 5646 |
return true; |
| 5647 |
} |
| 5648 |
|
| 5649 |
if (action == MENU_BACKSPACE) // phares 3/7/98 |
| 5650 |
{ |
| 5651 |
currentMenu->lastOn = itemOn; |
| 5652 |
|
| 5653 |
// phares 3/30/98: |
| 5654 |
// add checks to see if you're in the extended help screens |
| 5655 |
// if so, stay with the same menu definition, but bump the |
| 5656 |
// index back one. if the index bumps back far enough ( == 0) |
| 5657 |
// then you can return to the Read_Thisn menu definitions |
| 5658 |
|
| 5659 |
if (currentMenu->prevMenu) |
| 5660 |
{ |
| 5661 |
if (currentMenu == &ExtHelpDef) |
| 5662 |
{ |
| 5663 |
if (--extended_help_index == 0) |
| 5664 |
{ |
| 5665 |
M_ChangeMenu(currentMenu->prevMenu, mnact_nochange); |
| 5666 |
extended_help_index = 1; // reset |
| 5667 |
} |
| 5668 |
} |
| 5669 |
else |
| 5670 |
M_ChangeMenu(currentMenu->prevMenu, mnact_nochange); |
| 5671 |
itemOn = currentMenu->lastOn; |
| 5672 |
S_StartVoidSound(g_sfx_swtchn); |
| 5673 |
} |
| 5674 |
else |
| 5675 |
{ |
| 5676 |
M_ClearMenus(); |
| 5677 |
S_StartVoidSound(g_sfx_swtchx); |
| 5678 |
} |
| 5679 |
return true; |
| 5680 |
} |
| 5681 |
else |
| 5682 |
{ |
| 5683 |
int i; |
| 5684 |
|
| 5685 |
for (i = itemOn + 1; i < currentMenu->numitems; i++) |
| 5686 |
if (ch && currentMenu->menuitems[i].alphaKey == ch) |
| 5687 |
{ |
| 5688 |
itemOn = i; |
| 5689 |
S_StartVoidSound(g_sfx_menu); |
| 5690 |
return true; |
| 5691 |
} |
| 5692 |
|
| 5693 |
for (i = 0; i <= itemOn; i++) |
| 5694 |
if (ch && currentMenu->menuitems[i].alphaKey == ch) |
| 5695 |
{ |
| 5696 |
itemOn = i; |
| 5697 |
S_StartVoidSound(g_sfx_menu); |
| 5698 |
return true; |
| 5699 |
} |
| 5700 |
} |
| 5701 |
|
| 5702 |
return false; |
| 5703 |
} |
| 5704 |
|
| 5705 |
static dboolean M_ConsoleResponder(int ch, int action, event_t* ev) |
| 5706 |
{ |
| 5707 |
if (ev->type == ev_text) |
| 5708 |
{ |
| 5709 |
dsda_UpdateConsoleText(ev->text); |
| 5710 |
return true; |
| 5711 |
} |
| 5712 |
else if (action != MENU_NULL) |
| 5713 |
{ |
| 5714 |
dsda_UpdateConsole(action); |
| 5715 |
return true; |
| 5716 |
} |
| 5717 |
else if (ch != MENU_NULL) |
| 5718 |
return true; |
| 5719 |
|
| 5720 |
return false; |
| 5721 |
} |
| 5722 |
|
| 5723 |
static dboolean M_SaveResponder(int ch, int action, event_t* ev) |
| 5724 |
{ |
| 5725 |
if (delete_verify) // [FG] delete a savegame |
| 5726 |
{ |
| 5727 |
switch (M_EventToConfirmation(ch, action, ev)) |
| 5728 |
{ |
| 5729 |
case confirmation_yes: |
| 5730 |
M_DeleteSaveGame(itemOn + current_page * g_menu_save_page_size); |
| 5731 |
S_StartVoidSound(g_sfx_itemup); |
| 5732 |
delete_verify = false; |
| 5733 |
break; |
| 5734 |
case confirmation_no: |
| 5735 |
S_StartVoidSound(g_sfx_itemup); |
| 5736 |
delete_verify = false; |
| 5737 |
break; |
| 5738 |
case confirmation_null: |
| 5739 |
break; |
| 5740 |
} |
| 5741 |
|
| 5742 |
return true; |
| 5743 |
} |
| 5744 |
|
| 5745 |
if (saveStringEnter && (ch != MENU_NULL || action != MENU_NULL)) |
| 5746 |
{ |
| 5747 |
if (action == MENU_BACKSPACE) // phares 3/7/98 |
| 5748 |
{ |
| 5749 |
if (saveCharIndex > 0) |
| 5750 |
{ |
| 5751 |
if (!strcmp(savegamestrings[saveSlot], dsda_MapLumpName(gameepisode, gamemap))) |
| 5752 |
{ |
| 5753 |
saveCharIndex = 0; |
| 5754 |
} |
| 5755 |
else |
| 5756 |
{ |
| 5757 |
saveCharIndex--; |
| 5758 |
} |
| 5759 |
savegamestrings[saveSlot][saveCharIndex] = 0; |
| 5760 |
} |
| 5761 |
} |
| 5762 |
else if (action == MENU_ESCAPE) // phares 3/7/98 |
| 5763 |
{ |
| 5764 |
saveStringEnter = 0; |
| 5765 |
strcpy(&savegamestrings[saveSlot][0],saveOldString); |
| 5766 |
} |
| 5767 |
else if (action == MENU_ENTER) // phares 3/7/98 |
| 5768 |
{ |
| 5769 |
saveStringEnter = 0; |
| 5770 |
if (savegamestrings[saveSlot][0]) |
| 5771 |
M_DoSave(saveSlot); |
| 5772 |
} |
| 5773 |
else if (ch > 0) |
| 5774 |
{ |
| 5775 |
if (ch >= 32 && ch <= 127 && |
| 5776 |
saveCharIndex < SAVESTRINGSIZE-1 && |
| 5777 |
M_StringWidth(savegamestrings[saveSlot]) < (SAVESTRINGSIZE-2)*8) |
| 5778 |
{ |
| 5779 |
if (!raven && shiftdown) |
| 5780 |
ch = shiftxform[ch]; |
| 5781 |
else |
| 5782 |
ch = toupper(ch); |
| 5783 |
|
| 5784 |
savegamestrings[saveSlot][saveCharIndex++] = ch; |
| 5785 |
savegamestrings[saveSlot][saveCharIndex] = 0; |
| 5786 |
} |
| 5787 |
} |
| 5788 |
|
| 5789 |
return true; |
| 5790 |
} |
| 5791 |
else if (!saveStringEnter) |
| 5792 |
{ |
| 5793 |
int diff = 0; |
| 5794 |
|
| 5795 |
if (action == MENU_LEFT) |
| 5796 |
diff = -1; |
| 5797 |
else if (action == MENU_RIGHT) |
| 5798 |
diff = 1; |
| 5799 |
|
| 5800 |
if (diff) |
| 5801 |
{ |
| 5802 |
S_StartVoidSound(g_sfx_menu); |
| 5803 |
|
| 5804 |
current_page += diff; |
| 5805 |
if (current_page < 0) |
| 5806 |
current_page = save_page_limit - 1; |
| 5807 |
else if (current_page >= save_page_limit) |
| 5808 |
current_page = 0; |
| 5809 |
|
| 5810 |
M_ReadSaveStrings(); |
| 5811 |
} |
| 5812 |
} |
| 5813 |
|
| 5814 |
if (action == MENU_CLEAR) // [FG] delete a savegame |
| 5815 |
{ |
| 5816 |
if (LoadMenue[itemOn].status) |
| 5817 |
{ |
| 5818 |
S_StartVoidSound(g_sfx_itemup); |
| 5819 |
currentMenu->lastOn = itemOn; |
| 5820 |
delete_verify = true; |
| 5821 |
return true; |
| 5822 |
} |
| 5823 |
else |
| 5824 |
{ |
| 5825 |
S_StartVoidSound(g_sfx_oof); |
| 5826 |
} |
| 5827 |
} |
| 5828 |
|
| 5829 |
return false; |
| 5830 |
} |
| 5831 |
|
| 5832 |
static dboolean M_MessageResponder(int ch, int action, event_t* ev) |
| 5833 |
{ |
| 5834 |
dboolean confirmation = false; |
| 5835 |
|
| 5836 |
if (messageNeedsInput) |
| 5837 |
{ // phares |
| 5838 |
confirmation = M_EventToConfirmation(ch, action, ev); |
| 5839 |
if (confirmation == confirmation_null) |
| 5840 |
return true; |
| 5841 |
} |
| 5842 |
|
| 5843 |
M_ChangeMenu(NULL, messageLastMenuActive); |
| 5844 |
messageToPrint = 0; |
| 5845 |
if (messageRoutine) |
| 5846 |
messageRoutine(confirmation); |
| 5847 |
|
| 5848 |
M_ChangeMenu(NULL, mnact_inactive); |
| 5849 |
S_StartVoidSound(g_sfx_swtchx); |
| 5850 |
return true; |
| 5851 |
} |
| 5852 |
|
| 5853 |
static int M_EventToCharacter(event_t* ev) |
| 5854 |
{ |
| 5855 |
if (ev->type == ev_joystick) |
| 5856 |
{ |
| 5857 |
if (ev->data1.i) |
| 5858 |
{ |
| 5859 |
static int wait; |
| 5860 |
|
| 5861 |
if (wait < dsda_GetTick()) |
| 5862 |
{ |
| 5863 |
wait = dsda_GetTick() + 5; |
| 5864 |
|
| 5865 |
return 0; // lets the input reach the binding responder |
| 5866 |
} |
| 5867 |
} |
| 5868 |
} |
| 5869 |
else if (ev->type == ev_mouse) |
| 5870 |
{ |
| 5871 |
if (ev->data1.i) |
| 5872 |
{ |
| 5873 |
static int wait; |
| 5874 |
|
| 5875 |
if (wait < dsda_GetTick()) |
| 5876 |
{ |
| 5877 |
wait = dsda_GetTick() + 5; |
| 5878 |
|
| 5879 |
return 0; // lets the input reach the binding responder |
| 5880 |
} |
| 5881 |
} |
| 5882 |
} |
| 5883 |
else if (ev->type == ev_keydown) |
| 5884 |
{ |
| 5885 |
if (ev->data1.i == KEYD_RSHIFT) // phares 4/11/98 |
| 5886 |
shiftdown = true; |
| 5887 |
|
| 5888 |
return ev->data1.i; |
| 5889 |
} |
| 5890 |
else if (ev->type == ev_keyup) |
| 5891 |
{ |
| 5892 |
if (ev->data1.i == KEYD_RSHIFT) // phares 4/11/98 |
| 5893 |
shiftdown = false; |
| 5894 |
} |
| 5895 |
|
| 5896 |
return MENU_NULL; |
| 5897 |
} |
| 5898 |
|
| 5899 |
static int M_CurrentAction(void) |
| 5900 |
{ |
| 5901 |
if (dsda_InputActivated(dsda_input_menu_left)) |
| 5902 |
{ |
| 5903 |
return MENU_LEFT; |
| 5904 |
} |
| 5905 |
else if (dsda_InputActivated(dsda_input_menu_right)) |
| 5906 |
{ |
| 5907 |
return MENU_RIGHT; |
| 5908 |
} |
| 5909 |
else if (dsda_InputActivated(dsda_input_menu_up)) |
| 5910 |
{ |
| 5911 |
return MENU_UP; |
| 5912 |
} |
| 5913 |
else if (dsda_InputActivated(dsda_input_menu_down)) |
| 5914 |
{ |
| 5915 |
return MENU_DOWN; |
| 5916 |
} |
| 5917 |
else if (dsda_InputActivated(dsda_input_menu_backspace)) |
| 5918 |
{ |
| 5919 |
return MENU_BACKSPACE; |
| 5920 |
} |
| 5921 |
else if (dsda_InputActivated(dsda_input_menu_enter)) |
| 5922 |
{ |
| 5923 |
return MENU_ENTER; |
| 5924 |
} |
| 5925 |
else if (dsda_InputActivated(dsda_input_menu_escape)) |
| 5926 |
{ |
| 5927 |
return MENU_ESCAPE; |
| 5928 |
} |
| 5929 |
else if (dsda_InputActivated(dsda_input_menu_clear)) |
| 5930 |
{ |
| 5931 |
return MENU_CLEAR; |
| 5932 |
} |
| 5933 |
|
| 5934 |
return MENU_NULL; |
| 5935 |
} |
| 5936 |
|
| 5937 |
dboolean M_Responder(event_t* ev) { |
| 5938 |
int ch, action; |
| 5939 |
|
| 5940 |
ch = M_EventToCharacter(ev); |
| 5941 |
action = M_CurrentAction(); |
| 5942 |
|
| 5943 |
if (M_ConsoleOpen() && action != MENU_ESCAPE) |
| 5944 |
if (M_ConsoleResponder(ch, action, ev)) |
| 5945 |
return true; |
| 5946 |
|
| 5947 |
if (currentMenu == &LoadDef || currentMenu == &SaveDef) |
| 5948 |
if (M_SaveResponder(ch, action, ev)) |
| 5949 |
return true; |
| 5950 |
|
| 5951 |
if (messageToPrint && ch != MENU_NULL) |
| 5952 |
if (M_MessageResponder(ch, action, ev)) |
| 5953 |
return true; |
| 5954 |
|
| 5955 |
// killough 2/22/98: add support for screenshot key: |
| 5956 |
// Don't eat the keypress in this case. See sf bug #1843280. |
| 5957 |
if (dsda_InputActivated(dsda_input_screenshot)) |
| 5958 |
I_QueueScreenshot(); |
| 5959 |
|
| 5960 |
if (!menuactive) |
| 5961 |
{ |
| 5962 |
if (M_InactiveMenuResponder(ch, action, ev)) |
| 5963 |
return true; |
| 5964 |
|
| 5965 |
return false; |
| 5966 |
} |
| 5967 |
|
| 5968 |
if (ch == MENU_NULL && action == MENU_NULL) |
| 5969 |
return false; // we can't use the event here |
| 5970 |
|
| 5971 |
if (setup_active) |
| 5972 |
if (M_SetupResponder(ch, action, ev)) |
| 5973 |
return true; |
| 5974 |
|
| 5975 |
// From here on, these navigation keys are used on the BIG FONT menus |
| 5976 |
// like the Main Menu. |
| 5977 |
if (M_MainNavigationResponder(ch, action, ev)) |
| 5978 |
return true; |
| 5979 |
|
| 5980 |
return false; |
| 5981 |
} |
| 5982 |
|
| 5983 |
// |
| 5984 |
// End of M_Responder |
| 5985 |
// |
| 5986 |
///////////////////////////////////////////////////////////////////////////// |
| 5987 |
|
| 5988 |
///////////////////////////////////////////////////////////////////////////// |
| 5989 |
// |
| 5990 |
// General Routines |
| 5991 |
// |
| 5992 |
// This displays the Main menu and gets the menu screens rolling. |
| 5993 |
// Plus a variety of routines that control the Big Font menu display. |
| 5994 |
// Plus some initialization for game-dependant situations. |
| 5995 |
|
| 5996 |
static void M_InitializeSkillMenu(void) |
| 5997 |
{ |
| 5998 |
extern skill_info_t *skill_infos; |
| 5999 |
int i; |
| 6000 |
|
| 6001 |
SkillDef.lastOn = dsda_IntConfig(dsda_config_default_skill) - 1; |
| 6002 |
|
| 6003 |
SkillDef.numitems = num_skills; |
| 6004 |
SkillDef.menuitems = Z_Calloc(num_skills, sizeof(*SkillDef.menuitems)); |
| 6005 |
|
| 6006 |
for (i = 0; i < num_skills; ++i) |
| 6007 |
{ |
| 6008 |
SkillDef.menuitems[i].status = 1; |
| 6009 |
|
| 6010 |
if (skill_infos[i].pic_name) |
| 6011 |
strncpy(SkillDef.menuitems[i].name, skill_infos[i].pic_name, 8); |
| 6012 |
|
| 6013 |
SkillDef.menuitems[i].alttext = skill_infos[i].name; |
| 6014 |
SkillDef.menuitems[i].color = skill_infos[i].text_color; |
| 6015 |
|
| 6016 |
SkillDef.menuitems[i].routine = M_ChooseSkill; |
| 6017 |
SkillDef.menuitems[i].alphaKey = skill_infos[i].key; |
| 6018 |
|
| 6019 |
if (skill_infos[i].flags & SI_DEFAULT_SKILL) |
| 6020 |
SkillDef.lastOn = i; |
| 6021 |
} |
| 6022 |
|
| 6023 |
if (SkillDef.lastOn >= num_skills) |
| 6024 |
SkillDef.lastOn = num_skills - 1; |
| 6025 |
} |
| 6026 |
|
| 6027 |
static void M_InitializeEpisodeMenu(void) |
| 6028 |
{ |
| 6029 |
int i; |
| 6030 |
|
| 6031 |
EpiDef.numitems = num_episodes; |
| 6032 |
EpiDef.menuitems = Z_Calloc(num_episodes, sizeof(*EpiDef.menuitems)); |
| 6033 |
|
| 6034 |
for (i = 0; i < num_episodes; ++i) |
| 6035 |
{ |
| 6036 |
EpiDef.menuitems[i].status = 1; |
| 6037 |
|
| 6038 |
if (episodes[i].pic_name) |
| 6039 |
strncpy(EpiDef.menuitems[i].name, episodes[i].pic_name, 8); |
| 6040 |
|
| 6041 |
EpiDef.menuitems[i].alttext = episodes[i].name; |
| 6042 |
|
| 6043 |
EpiDef.menuitems[i].routine = M_Episode; |
| 6044 |
EpiDef.menuitems[i].alphaKey = episodes[i].key; |
| 6045 |
} |
| 6046 |
|
| 6047 |
if (!raven) |
| 6048 |
{ |
| 6049 |
if (EpiDef.numitems <= 4) |
| 6050 |
{ |
| 6051 |
EpiDef.y = 63; |
| 6052 |
} |
| 6053 |
else |
| 6054 |
{ |
| 6055 |
EpiDef.y = 63 - (EpiDef.numitems - 4) * (LINEHEIGHT / 2); |
| 6056 |
} |
| 6057 |
} |
| 6058 |
|
| 6059 |
if (num_episodes > 1) |
| 6060 |
SkillDef.prevMenu = &EpiDef; |
| 6061 |
else |
| 6062 |
SkillDef.prevMenu = &MainDef; |
| 6063 |
} |
| 6064 |
|
| 6065 |
void M_StartControlPanel (void) |
| 6066 |
{ |
| 6067 |
// intro might call this repeatedly |
| 6068 |
|
| 6069 |
if (menuactive) |
| 6070 |
return; |
| 6071 |
|
| 6072 |
DO_ONCE |
| 6073 |
M_InitializeSkillMenu(); |
| 6074 |
M_InitializeEpisodeMenu(); |
| 6075 |
END_ONCE |
| 6076 |
|
| 6077 |
M_ChangeMenu(&MainDef, mnact_float); |
| 6078 |
itemOn = currentMenu->lastOn; // JDC |
| 6079 |
} |
| 6080 |
|
| 6081 |
|
| 6082 |
///////////////////////////////////////////////////////////////////////////// |
| 6083 |
// |
| 6084 |
// Menu Shaded Overlay Stuff |
| 6085 |
// |
| 6086 |
// This displays a dark overlay under certain screens of the menus |
| 6087 |
|
| 6088 |
dboolean fadeBG(void) |
| 6089 |
{ |
| 6090 |
return dsda_IntConfig(dsda_config_menu_background) == 1; |
| 6091 |
} |
| 6092 |
|
| 6093 |
dboolean M_MenuIsShaded(void) |
| 6094 |
{ |
| 6095 |
int Options = (setup_active || currentMenu == &OptionsDef); |
| 6096 |
return fadeBG() && Options; |
| 6097 |
} |
| 6098 |
|
| 6099 |
void M_ShadedScreen(int scrn) |
| 6100 |
{ |
| 6101 |
V_DrawShaded(scrn, 0, 0, SCREENWIDTH, SCREENHEIGHT, FULLSHADE); |
| 6102 |
} |
| 6103 |
|
| 6104 |
// |
| 6105 |
// M_Drawer |
| 6106 |
// Called after the view has been rendered, |
| 6107 |
// but before it has been blitted. |
| 6108 |
// |
| 6109 |
// killough 9/29/98: Significantly reformatted source |
| 6110 |
// |
| 6111 |
|
| 6112 |
void M_Drawer (void) |
| 6113 |
{ |
| 6114 |
V_BeginUIDraw(); |
| 6115 |
|
| 6116 |
inhelpscreens = false; |
| 6117 |
|
| 6118 |
// Horiz. & Vertically center string and print it. |
| 6119 |
// killough 9/29/98: simplified code, removed 40-character width limit |
| 6120 |
if (messageToPrint) |
| 6121 |
{ |
| 6122 |
char* ms; |
| 6123 |
char* p; |
| 6124 |
int y; |
| 6125 |
|
| 6126 |
if (raven) |
| 6127 |
{ |
| 6128 |
MN_DrawMessage(messageString); |
| 6129 |
V_EndUIDraw(); |
| 6130 |
return; |
| 6131 |
} |
| 6132 |
|
| 6133 |
/* cph - Z_Strdup string to writable memory */ |
| 6134 |
ms = Z_Strdup(messageString); |
| 6135 |
p = ms; |
| 6136 |
|
| 6137 |
y = 100 - M_StringHeight(messageString)/2; |
| 6138 |
while (*p) |
| 6139 |
{ |
| 6140 |
char *string = p, c; |
| 6141 |
while ((c = *p) && *p != '\n') |
| 6142 |
p++; |
| 6143 |
*p = 0; |
| 6144 |
M_WriteText(160 - M_StringWidth(string)/2, y, string, CR_DEFAULT); |
| 6145 |
y += menu_font->line_height; |
| 6146 |
if ((*p = c)) |
| 6147 |
p++; |
| 6148 |
} |
| 6149 |
Z_Free(ms); |
| 6150 |
} |
| 6151 |
else if (menuactive) |
| 6152 |
{ |
| 6153 |
int x, y, max, i; |
| 6154 |
int lumps_missing; |
| 6155 |
|
| 6156 |
M_ChangeMenu(NULL, mnact_float); |
| 6157 |
|
| 6158 |
if (currentMenu->routine) |
| 6159 |
currentMenu->routine(); // call Draw routine |
| 6160 |
|
| 6161 |
if (raven) |
| 6162 |
{ |
| 6163 |
MN_Drawer(); |
| 6164 |
V_EndUIDraw(); |
| 6165 |
return; |
| 6166 |
} |
| 6167 |
|
| 6168 |
// DRAW MENU |
| 6169 |
|
| 6170 |
x = currentMenu->x; |
| 6171 |
y = currentMenu->y; |
| 6172 |
max = currentMenu->numitems; |
| 6173 |
lumps_missing = 0; |
| 6174 |
|
| 6175 |
for (i = 0; i < max; i++) |
| 6176 |
if ( |
| 6177 |
currentMenu->menuitems[i].status != -1 && ( |
| 6178 |
!currentMenu->menuitems[i].name[0] || !W_LumpNameExists(currentMenu->menuitems[i].name) |
| 6179 |
) |
| 6180 |
) |
| 6181 |
++lumps_missing; |
| 6182 |
|
| 6183 |
if (!lumps_missing) |
| 6184 |
for (i = 0; i < max; i++) |
| 6185 |
{ |
| 6186 |
if (currentMenu->menuitems[i].name[0]) |
| 6187 |
V_DrawNamePatch(x, y, 0, currentMenu->menuitems[i].name, |
| 6188 |
currentMenu->menuitems[i].color, VPT_STRETCH); |
| 6189 |
|
| 6190 |
y += LINEHEIGHT; |
| 6191 |
} |
| 6192 |
else |
| 6193 |
for (i = 0; i < max; i++) |
| 6194 |
{ |
| 6195 |
const char *alttext = currentMenu->menuitems[i].alttext; |
| 6196 |
|
| 6197 |
if (alttext) |
| 6198 |
M_WriteText(x, y + 8 - (M_StringHeight(alttext) / 2), |
| 6199 |
alttext, currentMenu->menuitems[i].color); |
| 6200 |
|
| 6201 |
y += LINEHEIGHT; |
| 6202 |
} |
| 6203 |
|
| 6204 |
// DRAW SKULL |
| 6205 |
if (max > 0) |
| 6206 |
// CPhipps - patch drawing updated |
| 6207 |
V_DrawNamePatch(x + SKULLXOFF, currentMenu->y - 5 + itemOn*LINEHEIGHT,0, |
| 6208 |
skullName[whichSkull], CR_DEFAULT, VPT_STRETCH); |
| 6209 |
} |
| 6210 |
|
| 6211 |
V_EndUIDraw(); |
| 6212 |
} |
| 6213 |
|
| 6214 |
void M_ChangeMenu(menu_t *menudef, menuactive_t mnact) |
| 6215 |
{ |
| 6216 |
if (menudef) |
| 6217 |
currentMenu = menudef; |
| 6218 |
|
| 6219 |
if (mnact != mnact_nochange) |
| 6220 |
menuactive = mnact; |
| 6221 |
|
| 6222 |
if (mnact > mnact_inactive && gamestate == GS_LEVEL) |
| 6223 |
dsda_TrackFeature(uf_menu); |
| 6224 |
|
| 6225 |
if (SDL_IsTextInputActive()) { |
| 6226 |
if (!(currentMenu && currentMenu->flags & MENUF_TEXTINPUT)) |
| 6227 |
SDL_StopTextInput(); |
| 6228 |
} |
| 6229 |
else if (currentMenu && currentMenu->flags & MENUF_TEXTINPUT) |
| 6230 |
SDL_StartTextInput(); |
| 6231 |
} |
| 6232 |
|
| 6233 |
// |
| 6234 |
// M_ClearMenus |
| 6235 |
// |
| 6236 |
// Called when leaving the menu screens for the real world |
| 6237 |
|
| 6238 |
void M_ClearMenus (void) |
| 6239 |
{ |
| 6240 |
M_ChangeMenu(&MainDef, mnact_inactive); |
| 6241 |
|
| 6242 |
BorderNeedRefresh = true; |
| 6243 |
} |
| 6244 |
|
| 6245 |
// |
| 6246 |
// M_SetupNextMenu |
| 6247 |
// |
| 6248 |
void M_SetupNextMenu(menu_t *menudef) |
| 6249 |
{ |
| 6250 |
M_ChangeMenu(menudef, mnact_nochange); |
| 6251 |
itemOn = currentMenu->lastOn; |
| 6252 |
|
| 6253 |
BorderNeedRefresh = true; |
| 6254 |
|
| 6255 |
current_page = 0; |
| 6256 |
previous_page = 0; |
| 6257 |
} |
| 6258 |
|
| 6259 |
///////////////////////////// |
| 6260 |
// |
| 6261 |
// M_Ticker |
| 6262 |
// |
| 6263 |
void M_Ticker (void) |
| 6264 |
{ |
| 6265 |
// The skull counter is also used for non-skull pointers |
| 6266 |
if (--skullAnimCounter <= 0) |
| 6267 |
{ |
| 6268 |
whichSkull ^= 1; |
| 6269 |
skullAnimCounter = 8; |
| 6270 |
} |
| 6271 |
|
| 6272 |
if (raven) return MN_Ticker(); |
| 6273 |
} |
| 6274 |
|
| 6275 |
///////////////////////////// |
| 6276 |
// |
| 6277 |
// Message Routines |
| 6278 |
// |
| 6279 |
|
| 6280 |
static void M_StartMessage (const char* string,void* routine,dboolean input) |
| 6281 |
{ |
| 6282 |
messageLastMenuActive = menuactive; |
| 6283 |
messageToPrint = 1; |
| 6284 |
messageString = string; |
| 6285 |
messageRoutine = routine; |
| 6286 |
messageNeedsInput = input; |
| 6287 |
M_ChangeMenu(NULL, mnact_float); |
| 6288 |
return; |
| 6289 |
} |
| 6290 |
|
| 6291 |
static void M_StopMessage(void) |
| 6292 |
{ |
| 6293 |
M_ChangeMenu(NULL, messageLastMenuActive); |
| 6294 |
messageToPrint = 0; |
| 6295 |
} |
| 6296 |
|
| 6297 |
///////////////////////////// |
| 6298 |
// |
| 6299 |
// Thermometer Routines |
| 6300 |
// |
| 6301 |
|
| 6302 |
// |
| 6303 |
// M_DrawThermo draws the thermometer graphic for Mouse Sensitivity, |
| 6304 |
// Sound Volume, etc. |
| 6305 |
// |
| 6306 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 6307 |
// CPhipps - patch drawing updated |
| 6308 |
// |
| 6309 |
static void M_DrawThermo(int x, int y, int thermWidth, int thermRange, int thermDot ) |
| 6310 |
{ |
| 6311 |
int xx; |
| 6312 |
int i; |
| 6313 |
int dot_offset; |
| 6314 |
|
| 6315 |
if (raven) return MN_DrawSlider(x, y, thermWidth, thermRange, thermDot); |
| 6316 |
|
| 6317 |
xx = x; |
| 6318 |
V_DrawNamePatch(xx, y, 0, "M_THERML", CR_DEFAULT, VPT_STRETCH); |
| 6319 |
xx += 8; |
| 6320 |
for (i=0;i<thermWidth;i++) |
| 6321 |
{ |
| 6322 |
V_DrawNamePatch(xx, y, 0, "M_THERMM", CR_DEFAULT, VPT_STRETCH); |
| 6323 |
xx += 8; |
| 6324 |
} |
| 6325 |
V_DrawNamePatch(xx, y, 0, "M_THERMR", CR_DEFAULT, VPT_STRETCH); |
| 6326 |
|
| 6327 |
if (thermDot >= thermRange) |
| 6328 |
{ |
| 6329 |
thermDot = thermRange - 1; |
| 6330 |
} |
| 6331 |
|
| 6332 |
dot_offset = 8 * thermDot * thermWidth / thermRange; |
| 6333 |
dot_offset -= thermRange / thermWidth; |
| 6334 |
V_DrawNamePatch(x + 8 + dot_offset, y, 0, "M_THERMO", CR_DEFAULT, VPT_STRETCH); |
| 6335 |
} |
| 6336 |
|
| 6337 |
// |
| 6338 |
// Draw an empty cell in the thermometer |
| 6339 |
// |
| 6340 |
|
| 6341 |
static void M_DrawEmptyCell (menu_t* menu,int item) |
| 6342 |
{ |
| 6343 |
// CPhipps - patch drawing updated |
| 6344 |
V_DrawNamePatch(menu->x - 10, menu->y+item*LINEHEIGHT - 1, 0, |
| 6345 |
"M_CELL1", CR_DEFAULT, VPT_STRETCH); |
| 6346 |
} |
| 6347 |
|
| 6348 |
// |
| 6349 |
// Draw a full cell in the thermometer |
| 6350 |
// |
| 6351 |
|
| 6352 |
static void M_DrawSelCell (menu_t* menu,int item) |
| 6353 |
{ |
| 6354 |
// CPhipps - patch drawing updated |
| 6355 |
V_DrawNamePatch(menu->x - 10, menu->y+item*LINEHEIGHT - 1, 0, |
| 6356 |
"M_CELL2", CR_DEFAULT, VPT_STRETCH); |
| 6357 |
} |
| 6358 |
|
| 6359 |
///////////////////////////// |
| 6360 |
// |
| 6361 |
// String-drawing Routines |
| 6362 |
// |
| 6363 |
|
| 6364 |
// |
| 6365 |
// Find string width from menu_font chars |
| 6366 |
// |
| 6367 |
|
| 6368 |
static int M_StringWidth(const char* string) |
| 6369 |
{ |
| 6370 |
int i, c, w = 0; |
| 6371 |
for (i = 0;(size_t)i < strlen(string);i++) |
| 6372 |
w += (c = toupper(string[i]) - HU_FONTSTART) < 0 || c >= HU_FONTSIZE ? |
| 6373 |
menu_font->space_width : menu_font->font[c].width; |
| 6374 |
return w; |
| 6375 |
} |
| 6376 |
|
| 6377 |
// |
| 6378 |
// Find string height from menu_font chars |
| 6379 |
// |
| 6380 |
|
| 6381 |
static int M_StringHeight(const char* string) |
| 6382 |
{ |
| 6383 |
int i, h = menu_font->height; |
| 6384 |
for (i = 0;string[i];i++) // killough 1/31/98 |
| 6385 |
if (string[i] == '\n') |
| 6386 |
h += menu_font->line_height; |
| 6387 |
return h; |
| 6388 |
} |
| 6389 |
|
| 6390 |
// |
| 6391 |
// Write a string using the menu_font |
| 6392 |
// |
| 6393 |
static void M_WriteText (int x,int y, const char* string, int cm) |
| 6394 |
{ |
| 6395 |
int w; |
| 6396 |
const char* ch; |
| 6397 |
int c; |
| 6398 |
int cx; |
| 6399 |
int cy; |
| 6400 |
int flags; |
| 6401 |
|
| 6402 |
ch = string; |
| 6403 |
cx = x; |
| 6404 |
cy = y; |
| 6405 |
|
| 6406 |
flags = VPT_STRETCH; |
| 6407 |
if (cm != CR_DEFAULT) |
| 6408 |
flags |= VPT_TRANS; |
| 6409 |
|
| 6410 |
while(1) { |
| 6411 |
c = *ch++; |
| 6412 |
if (!c) |
| 6413 |
break; |
| 6414 |
if (c == '\n') { |
| 6415 |
cx = x; |
| 6416 |
cy += 12; |
| 6417 |
continue; |
| 6418 |
} |
| 6419 |
|
| 6420 |
c = toupper(c) - HU_FONTSTART; |
| 6421 |
if (c < 0 || c>= HU_FONTSIZE) { |
| 6422 |
cx += 4; |
| 6423 |
continue; |
| 6424 |
} |
| 6425 |
|
| 6426 |
w = menu_font->font[c].width; |
| 6427 |
if (cx+w > BASE_WIDTH) |
| 6428 |
break; |
| 6429 |
// proff/nicolas 09/20/98 -- changed for hi-res |
| 6430 |
// CPhipps - patch drawing updated |
| 6431 |
V_DrawNumPatch(cx, cy, 0, menu_font->font[c].lumpnum, cm, flags); |
| 6432 |
cx+=w; |
| 6433 |
} |
| 6434 |
} |
| 6435 |
|
| 6436 |
static void M_DrawTitle(int y, const char *text, int cm) |
| 6437 |
{ |
| 6438 |
if (raven) return MN_DrawTitle(y, text, cm); |
| 6439 |
|
| 6440 |
M_WriteText(160 - (M_StringWidth(text) / 2), |
| 6441 |
y + 8 - (M_StringHeight(text) / 2), // assumes patch height 16 |
| 6442 |
text, cm); |
| 6443 |
} |
| 6444 |
|
| 6445 |
///////////////////////////// |
| 6446 |
// |
| 6447 |
// Initialization Routines to take care of one-time setup |
| 6448 |
// |
| 6449 |
|
| 6450 |
// |
| 6451 |
// M_Init |
| 6452 |
// |
| 6453 |
void M_Init(void) |
| 6454 |
{ |
| 6455 |
if (raven) MN_Init(); |
| 6456 |
|
| 6457 |
M_LoadTextColors(); |
| 6458 |
M_LoadMenuFont(); |
| 6459 |
|
| 6460 |
M_ChangeMenu(&MainDef, mnact_inactive); |
| 6461 |
itemOn = currentMenu->lastOn; |
| 6462 |
whichSkull = 0; |
| 6463 |
skullAnimCounter = 10; |
| 6464 |
messageToPrint = 0; |
| 6465 |
messageString = NULL; |
| 6466 |
messageLastMenuActive = menuactive; |
| 6467 |
|
| 6468 |
M_InitExtendedHelp(); // init extended help screens // phares 3/30/98 |
| 6469 |
|
| 6470 |
// Here we could catch other version dependencies, |
| 6471 |
// like HELP1/2, and four episodes. |
| 6472 |
|
| 6473 |
// |
| 6474 |
// Raven code moved to MN_Init() for |
| 6475 |
// Heretic / Hexen 3-4 screen support. |
| 6476 |
if (!raven) { |
| 6477 |
if (gamemode == commercial) { |
| 6478 |
// This is used because DOOM 2 had only one HELP |
| 6479 |
// page. I use CREDIT as second page now, but |
| 6480 |
// kept this hack for educational purposes. |
| 6481 |
|
| 6482 |
// "Help" and "ReadMe!" now use the same |
| 6483 |
// routine to match Vanilla routines. |
| 6484 |
MainDef.y += 8; |
| 6485 |
ReadDef1.routine = M_DrawReadThis2; |
| 6486 |
ReadDef1.x = 330; |
| 6487 |
ReadDef1.y = 165; |
| 6488 |
|
| 6489 |
// Allowed "Read Me!" in commerical gamemodes |
| 6490 |
// by default if Extended Help screens are found. |
| 6491 |
// |
| 6492 |
// Otherwise remove "Read Me!" menu option |
| 6493 |
if (!extended_help_count) |
| 6494 |
{ |
| 6495 |
MainMenu[readthis] = MainMenu[quitdoom]; |
| 6496 |
MainDef.numitems = quitdoom; |
| 6497 |
ReadMenu1[0].routine = M_FinishReadThis; |
| 6498 |
} |
| 6499 |
} |
| 6500 |
else |
| 6501 |
{ |
| 6502 |
// Episode 2 and 3 are handled, |
| 6503 |
// branching to an ad screen. |
| 6504 |
|
| 6505 |
// killough 2/21/98: Fix registered Doom help screen |
| 6506 |
// killough 10/98: moved to second screen, moved up to the top |
| 6507 |
|
| 6508 |
// If shareware or PWAD HELP2, use ad screen (w/ offset) |
| 6509 |
// with HELP1 screen, else cut to only HELP1 screen |
| 6510 |
if (pwad_help2_check || gamemode == shareware) |
| 6511 |
ReadDef1.y = 15; |
| 6512 |
else |
| 6513 |
{ |
| 6514 |
ReadDef1.routine = M_DrawReadThis2; |
| 6515 |
if (!extended_help_count) |
| 6516 |
ReadMenu1[0].routine = M_FinishReadThis; |
| 6517 |
} |
| 6518 |
} |
| 6519 |
} |
| 6520 |
|
| 6521 |
//e6y |
| 6522 |
M_ChangeSpeed(); |
| 6523 |
M_ChangeSkyMode(); |
| 6524 |
M_ChangeFOV(); |
| 6525 |
|
| 6526 |
M_ChangeDemoSmoothTurns(); |
| 6527 |
|
| 6528 |
M_ChangeMapTextured(); |
| 6529 |
M_ChangeMapMultisamling(); |
| 6530 |
|
| 6531 |
M_ChangeStretch(); |
| 6532 |
|
| 6533 |
M_ChangeMIDIPlayer(); |
| 6534 |
} |
| 6535 |
|
| 6536 |
// |
| 6537 |
// End of General Routines |
| 6538 |
// |
| 6539 |
///////////////////////////////////////////////////////////////////////////// |