2007-01-28 03:53:06 +01:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
// $Log:$
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
2007-06-22 12:29:55 +02:00
|
|
|
// DOOM selection menu, options, episode etc.
|
|
|
|
// Sliders and icons. Kinda widget stuff.
|
2007-01-28 03:53:06 +01:00
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static const char
|
|
|
|
rcsid[] = "$Id: m_menu.c,v 1.7 1997/02/03 22:45:10 b1 Exp $";
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#include "m_swap.h"
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "dstrings.h"
|
|
|
|
|
|
|
|
#include "d_main.h"
|
|
|
|
|
|
|
|
#include "i_system.h"
|
|
|
|
#include "i_video.h"
|
|
|
|
#include "z_zone.h"
|
|
|
|
#include "v_video.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
|
|
|
|
#include "r_local.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "hu_stuff.h"
|
|
|
|
|
|
|
|
#include "g_game.h"
|
|
|
|
|
|
|
|
#include "m_argv.h"
|
|
|
|
|
|
|
|
#include "s_sound.h"
|
|
|
|
|
|
|
|
#include "doomstat.h"
|
|
|
|
|
|
|
|
// Data.
|
|
|
|
#include "sounds.h"
|
|
|
|
|
|
|
|
#include "m_menu.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-06-22 12:29:55 +02:00
|
|
|
extern patch_t* hu_font[HU_FONTSIZE];
|
|
|
|
extern boolean message_dontfuckwithme;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
2007-06-22 12:29:55 +02:00
|
|
|
extern boolean chat_on; // in heads-up code
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// defaulted values
|
|
|
|
//
|
2007-06-22 12:29:55 +02:00
|
|
|
int mouseSensitivity; // has default
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// Show messages has default, 0 = off, 1 = on
|
2007-06-22 12:29:55 +02:00
|
|
|
int showMessages;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// Blocky mode, has default, 0 = high, 1 = normal
|
2007-06-22 12:29:55 +02:00
|
|
|
int detailLevel;
|
|
|
|
int screenblocks; // has default
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// temp for screenblocks (0-9)
|
2007-06-22 12:29:55 +02:00
|
|
|
int screenSize;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// -1 = no quicksave slot picked!
|
2007-06-22 12:29:55 +02:00
|
|
|
int quickSaveSlot;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// 1 = message to be printed
|
2007-06-22 12:29:55 +02:00
|
|
|
int messageToPrint;
|
2007-01-28 03:53:06 +01:00
|
|
|
// ...and here is the message string!
|
2007-06-22 12:29:55 +02:00
|
|
|
char* messageString;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// message x & y
|
2007-06-22 12:29:55 +02:00
|
|
|
int messx;
|
|
|
|
int messy;
|
|
|
|
int messageLastMenuActive;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// timed message = no input from user
|
2007-06-22 12:29:55 +02:00
|
|
|
boolean messageNeedsInput;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
void (*messageRoutine)(int response);
|
|
|
|
|
2007-06-22 12:29:55 +02:00
|
|
|
#define SAVESTRINGSIZE 24
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
char gammamsg[5][26] =
|
|
|
|
{
|
|
|
|
GAMMALVL0,
|
|
|
|
GAMMALVL1,
|
|
|
|
GAMMALVL2,
|
|
|
|
GAMMALVL3,
|
|
|
|
GAMMALVL4
|
|
|
|
};
|
|
|
|
|
|
|
|
// we are going to be entering a savegame string
|
2007-06-22 12:29:55 +02:00
|
|
|
int saveStringEnter;
|
|
|
|
int saveSlot; // which slot to save in
|
|
|
|
int saveCharIndex; // which char we're editing
|
2007-01-28 03:53:06 +01:00
|
|
|
// old save description before edit
|
2007-06-22 12:29:55 +02:00
|
|
|
char saveOldString[SAVESTRINGSIZE];
|
2007-01-28 03:53:06 +01:00
|
|
|
|
2007-06-22 12:29:55 +02:00
|
|
|
boolean inhelpscreens;
|
|
|
|
boolean menuactive;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
2007-06-22 12:29:55 +02:00
|
|
|
#define SKULLXOFF -32
|
|
|
|
#define LINEHEIGHT 16
|
2007-01-28 03:53:06 +01:00
|
|
|
|
2007-06-22 12:29:55 +02:00
|
|
|
extern boolean sendpause;
|
|
|
|
char savegamestrings[10][SAVESTRINGSIZE];
|
2007-01-28 03:53:06 +01:00
|
|
|
|
2007-06-22 12:29:55 +02:00
|
|
|
char endstring[160];
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// MENU TYPEDEFS
|
|
|
|
//
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
// 0 = no cursor here, 1 = ok, 2 = arrows ok
|
2007-06-22 12:29:55 +02:00
|
|
|
short status;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
2007-06-22 12:29:55 +02:00
|
|
|
char name[10];
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// choice = menu item #.
|
|
|
|
// if status = 2,
|
|
|
|
// choice=0:leftarrow,1:rightarrow
|
2007-06-22 12:29:55 +02:00
|
|
|
void (*routine)(int choice);
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// hotkey in menu
|
2007-06-22 12:29:55 +02:00
|
|
|
char alphaKey;
|
2007-01-28 03:53:06 +01:00
|
|
|
} menuitem_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct menu_s
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
short numitems; // # of menu items
|
|
|
|
struct menu_s* prevMenu; // previous menu
|
|
|
|
menuitem_t* menuitems; // menu items
|
|
|
|
void (*routine)(); // draw routine
|
|
|
|
short x;
|
|
|
|
short y; // x,y of menu
|
|
|
|
short lastOn; // last item user was on in menu
|
2007-01-28 03:53:06 +01:00
|
|
|
} menu_t;
|
|
|
|
|
2007-06-22 12:29:55 +02:00
|
|
|
short itemOn; // menu item skull is on
|
|
|
|
short skullAnimCounter; // skull animation counter
|
|
|
|
short whichSkull; // which skull to draw
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// graphic name of skulls
|
|
|
|
// warning: initializer-string for array of chars is too long
|
|
|
|
char skullName[2][/*8*/9] = {"M_SKULL1","M_SKULL2"};
|
|
|
|
|
|
|
|
// current menudef
|
2007-06-22 12:29:55 +02:00
|
|
|
menu_t* currentMenu;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// PROTOTYPES
|
|
|
|
//
|
|
|
|
void M_NewGame(int choice);
|
|
|
|
void M_Episode(int choice);
|
|
|
|
void M_ChooseSkill(int choice);
|
|
|
|
void M_LoadGame(int choice);
|
|
|
|
void M_SaveGame(int choice);
|
|
|
|
void M_Options(int choice);
|
|
|
|
void M_EndGame(int choice);
|
|
|
|
void M_ReadThis(int choice);
|
|
|
|
void M_ReadThis2(int choice);
|
|
|
|
void M_QuitDOOM(int choice);
|
|
|
|
|
|
|
|
void M_ChangeMessages(int choice);
|
|
|
|
void M_ChangeSensitivity(int choice);
|
|
|
|
void M_SfxVol(int choice);
|
|
|
|
void M_MusicVol(int choice);
|
|
|
|
void M_ChangeDetail(int choice);
|
|
|
|
void M_SizeDisplay(int choice);
|
|
|
|
void M_StartGame(int choice);
|
|
|
|
void M_Sound(int choice);
|
|
|
|
|
|
|
|
void M_FinishReadThis(int choice);
|
|
|
|
void M_LoadSelect(int choice);
|
|
|
|
void M_SaveSelect(int choice);
|
|
|
|
void M_ReadSaveStrings(void);
|
|
|
|
void M_QuickSave(void);
|
|
|
|
void M_QuickLoad(void);
|
|
|
|
|
|
|
|
void M_DrawMainMenu(void);
|
|
|
|
void M_DrawReadThis1(void);
|
|
|
|
void M_DrawReadThis2(void);
|
|
|
|
void M_DrawNewGame(void);
|
|
|
|
void M_DrawEpisode(void);
|
|
|
|
void M_DrawOptions(void);
|
|
|
|
void M_DrawSound(void);
|
|
|
|
void M_DrawLoad(void);
|
|
|
|
void M_DrawSave(void);
|
|
|
|
|
|
|
|
void M_DrawSaveLoadBorder(int x,int y);
|
|
|
|
void M_SetupNextMenu(menu_t *menudef);
|
|
|
|
void M_DrawThermo(int x,int y,int thermWidth,int thermDot);
|
|
|
|
void M_DrawEmptyCell(menu_t *menu,int item);
|
|
|
|
void M_DrawSelCell(menu_t *menu,int item);
|
|
|
|
void M_WriteText(int x, int y, char *string);
|
|
|
|
int M_StringWidth(char *string);
|
|
|
|
int M_StringHeight(char *string);
|
|
|
|
void M_StartControlPanel(void);
|
|
|
|
void M_StartMessage(char *string,void *routine,boolean input);
|
|
|
|
void M_StopMessage(void);
|
|
|
|
void M_ClearMenus (void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// DOOM MENU
|
|
|
|
//
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
newgame = 0,
|
|
|
|
options,
|
|
|
|
loadgame,
|
|
|
|
savegame,
|
|
|
|
readthis,
|
|
|
|
quitdoom,
|
|
|
|
main_end
|
|
|
|
} main_e;
|
|
|
|
|
|
|
|
menuitem_t MainMenu[]=
|
|
|
|
{
|
|
|
|
{1,"M_NGAME",M_NewGame,'n'},
|
|
|
|
{1,"M_OPTION",M_Options,'o'},
|
|
|
|
{1,"M_LOADG",M_LoadGame,'l'},
|
|
|
|
{1,"M_SAVEG",M_SaveGame,'s'},
|
|
|
|
// Another hickup with Special edition.
|
|
|
|
{1,"M_RDTHIS",M_ReadThis,'r'},
|
|
|
|
{1,"M_QUITG",M_QuitDOOM,'q'}
|
|
|
|
};
|
|
|
|
|
|
|
|
menu_t MainDef =
|
|
|
|
{
|
|
|
|
main_end,
|
|
|
|
NULL,
|
|
|
|
MainMenu,
|
|
|
|
M_DrawMainMenu,
|
|
|
|
97,64,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// EPISODE SELECT
|
|
|
|
//
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ep1,
|
|
|
|
ep2,
|
|
|
|
ep3,
|
|
|
|
ep4,
|
|
|
|
ep_end
|
|
|
|
} episodes_e;
|
|
|
|
|
|
|
|
menuitem_t EpisodeMenu[]=
|
|
|
|
{
|
|
|
|
{1,"M_EPI1", M_Episode,'k'},
|
|
|
|
{1,"M_EPI2", M_Episode,'t'},
|
|
|
|
{1,"M_EPI3", M_Episode,'i'},
|
|
|
|
{1,"M_EPI4", M_Episode,'t'}
|
|
|
|
};
|
|
|
|
|
|
|
|
menu_t EpiDef =
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
ep_end, // # of menu items
|
|
|
|
&MainDef, // previous menu
|
|
|
|
EpisodeMenu, // menuitem_t ->
|
|
|
|
M_DrawEpisode, // drawing routine ->
|
2007-01-28 03:53:06 +01:00
|
|
|
48,63, // x,y
|
2007-06-22 12:29:55 +02:00
|
|
|
ep1 // lastOn
|
2007-01-28 03:53:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// NEW GAME
|
|
|
|
//
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
killthings,
|
|
|
|
toorough,
|
|
|
|
hurtme,
|
|
|
|
violence,
|
|
|
|
nightmare,
|
|
|
|
newg_end
|
|
|
|
} newgame_e;
|
|
|
|
|
|
|
|
menuitem_t NewGameMenu[]=
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
{1,"M_JKILL", M_ChooseSkill, 'i'},
|
|
|
|
{1,"M_ROUGH", M_ChooseSkill, 'h'},
|
|
|
|
{1,"M_HURT", M_ChooseSkill, 'h'},
|
|
|
|
{1,"M_ULTRA", M_ChooseSkill, 'u'},
|
|
|
|
{1,"M_NMARE", M_ChooseSkill, 'n'}
|
2007-01-28 03:53:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
menu_t NewDef =
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
newg_end, // # of menu items
|
|
|
|
&EpiDef, // previous menu
|
|
|
|
NewGameMenu, // menuitem_t ->
|
|
|
|
M_DrawNewGame, // drawing routine ->
|
2007-01-28 03:53:06 +01:00
|
|
|
48,63, // x,y
|
2007-06-22 12:29:55 +02:00
|
|
|
hurtme // lastOn
|
2007-01-28 03:53:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// OPTIONS MENU
|
|
|
|
//
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
endgame,
|
|
|
|
messages,
|
|
|
|
detail,
|
|
|
|
scrnsize,
|
|
|
|
option_empty1,
|
|
|
|
mousesens,
|
|
|
|
option_empty2,
|
|
|
|
soundvol,
|
|
|
|
opt_end
|
|
|
|
} options_e;
|
|
|
|
|
|
|
|
menuitem_t OptionsMenu[]=
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
{1,"M_ENDGAM", M_EndGame,'e'},
|
|
|
|
{1,"M_MESSG", M_ChangeMessages,'m'},
|
|
|
|
{1,"M_DETAIL", M_ChangeDetail,'g'},
|
|
|
|
{2,"M_SCRNSZ", M_SizeDisplay,'s'},
|
2007-01-28 03:53:06 +01:00
|
|
|
{-1,"",0},
|
2007-06-22 12:29:55 +02:00
|
|
|
{2,"M_MSENS", M_ChangeSensitivity,'m'},
|
2007-01-28 03:53:06 +01:00
|
|
|
{-1,"",0},
|
2007-06-22 12:29:55 +02:00
|
|
|
{1,"M_SVOL", M_Sound,'s'}
|
2007-01-28 03:53:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
menu_t OptionsDef =
|
|
|
|
{
|
|
|
|
opt_end,
|
|
|
|
&MainDef,
|
|
|
|
OptionsMenu,
|
|
|
|
M_DrawOptions,
|
|
|
|
60,37,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// Read This! MENU 1 & 2
|
|
|
|
//
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
rdthsempty1,
|
|
|
|
read1_end
|
|
|
|
} read_e;
|
|
|
|
|
|
|
|
menuitem_t ReadMenu1[] =
|
|
|
|
{
|
|
|
|
{1,"",M_ReadThis2,0}
|
|
|
|
};
|
|
|
|
|
|
|
|
menu_t ReadDef1 =
|
|
|
|
{
|
|
|
|
read1_end,
|
|
|
|
&MainDef,
|
|
|
|
ReadMenu1,
|
|
|
|
M_DrawReadThis1,
|
|
|
|
280,185,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
rdthsempty2,
|
|
|
|
read2_end
|
|
|
|
} read_e2;
|
|
|
|
|
|
|
|
menuitem_t ReadMenu2[]=
|
|
|
|
{
|
|
|
|
{1,"",M_FinishReadThis,0}
|
|
|
|
};
|
|
|
|
|
|
|
|
menu_t ReadDef2 =
|
|
|
|
{
|
|
|
|
read2_end,
|
|
|
|
&ReadDef1,
|
|
|
|
ReadMenu2,
|
|
|
|
M_DrawReadThis2,
|
|
|
|
330,175,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// SOUND VOLUME MENU
|
|
|
|
//
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
sfx_vol,
|
|
|
|
sfx_empty1,
|
|
|
|
music_vol,
|
|
|
|
sfx_empty2,
|
|
|
|
sound_end
|
|
|
|
} sound_e;
|
|
|
|
|
|
|
|
menuitem_t SoundMenu[]=
|
|
|
|
{
|
|
|
|
{2,"M_SFXVOL",M_SfxVol,'s'},
|
|
|
|
{-1,"",0},
|
|
|
|
{2,"M_MUSVOL",M_MusicVol,'m'},
|
|
|
|
{-1,"",0}
|
|
|
|
};
|
|
|
|
|
|
|
|
menu_t SoundDef =
|
|
|
|
{
|
|
|
|
sound_end,
|
|
|
|
&OptionsDef,
|
|
|
|
SoundMenu,
|
|
|
|
M_DrawSound,
|
|
|
|
80,64,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// LOAD GAME MENU
|
|
|
|
//
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
load1,
|
|
|
|
load2,
|
|
|
|
load3,
|
|
|
|
load4,
|
|
|
|
load5,
|
|
|
|
load6,
|
|
|
|
load_end
|
|
|
|
} load_e;
|
|
|
|
|
|
|
|
menuitem_t LoadMenu[]=
|
|
|
|
{
|
|
|
|
{1,"", M_LoadSelect,'1'},
|
|
|
|
{1,"", M_LoadSelect,'2'},
|
|
|
|
{1,"", M_LoadSelect,'3'},
|
|
|
|
{1,"", M_LoadSelect,'4'},
|
|
|
|
{1,"", M_LoadSelect,'5'},
|
|
|
|
{1,"", M_LoadSelect,'6'}
|
|
|
|
};
|
|
|
|
|
|
|
|
menu_t LoadDef =
|
|
|
|
{
|
|
|
|
load_end,
|
|
|
|
&MainDef,
|
|
|
|
LoadMenu,
|
|
|
|
M_DrawLoad,
|
|
|
|
80,54,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// SAVE GAME MENU
|
|
|
|
//
|
|
|
|
menuitem_t SaveMenu[]=
|
|
|
|
{
|
|
|
|
{1,"", M_SaveSelect,'1'},
|
|
|
|
{1,"", M_SaveSelect,'2'},
|
|
|
|
{1,"", M_SaveSelect,'3'},
|
|
|
|
{1,"", M_SaveSelect,'4'},
|
|
|
|
{1,"", M_SaveSelect,'5'},
|
|
|
|
{1,"", M_SaveSelect,'6'}
|
|
|
|
};
|
|
|
|
|
|
|
|
menu_t SaveDef =
|
|
|
|
{
|
|
|
|
load_end,
|
|
|
|
&MainDef,
|
|
|
|
SaveMenu,
|
|
|
|
M_DrawSave,
|
|
|
|
80,54,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_ReadSaveStrings
|
|
|
|
// read the strings from the savegame files
|
|
|
|
//
|
|
|
|
void M_ReadSaveStrings(void)
|
|
|
|
{
|
|
|
|
FILE *handle;
|
|
|
|
int count;
|
|
|
|
int i;
|
|
|
|
char name[256];
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
for (i = 0;i < load_end;i++)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
sprintf(name,"doomsav%d.dsg",i);
|
|
|
|
|
|
|
|
handle = fopen (name, "r");
|
|
|
|
if (handle == NULL)
|
|
|
|
{
|
|
|
|
strcpy(&savegamestrings[i][0],EMPTYSTRING);
|
|
|
|
LoadMenu[i].status = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
count = fread (&savegamestrings[i], 1, SAVESTRINGSIZE, handle);
|
|
|
|
fclose (handle);
|
|
|
|
LoadMenu[i].status = 1;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_LoadGame & Cie.
|
|
|
|
//
|
|
|
|
void M_DrawLoad(void)
|
|
|
|
{
|
|
|
|
int i;
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
V_DrawPatchDirect (72,28,0,W_CacheLumpName("M_LOADG",PU_CACHE));
|
|
|
|
for (i = 0;i < load_end; i++)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i);
|
|
|
|
M_WriteText(LoadDef.x,LoadDef.y+LINEHEIGHT*i,savegamestrings[i]);
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Draw border for the savegame description
|
|
|
|
//
|
|
|
|
void M_DrawSaveLoadBorder(int x,int y)
|
|
|
|
{
|
|
|
|
int i;
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
V_DrawPatchDirect (x-8,y+7,0,W_CacheLumpName("M_LSLEFT",PU_CACHE));
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
for (i = 0;i < 24;i++)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
V_DrawPatchDirect (x,y+7,0,W_CacheLumpName("M_LSCNTR",PU_CACHE));
|
|
|
|
x += 8;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
V_DrawPatchDirect (x,y+7,0,W_CacheLumpName("M_LSRGHT",PU_CACHE));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// User wants to load this game
|
|
|
|
//
|
|
|
|
void M_LoadSelect(int choice)
|
|
|
|
{
|
|
|
|
char name[256];
|
2007-06-22 12:29:55 +02:00
|
|
|
|
|
|
|
// if (M_CheckParm("-cdrom"))
|
|
|
|
// sprintf(name,"c:\\doomdata\\doomsav%d.dsg",choice);
|
|
|
|
// else
|
|
|
|
sprintf(name,"doomsav%d.dsg",choice);
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
G_LoadGame (name);
|
|
|
|
M_ClearMenus ();
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Selected from DOOM menu
|
|
|
|
//
|
|
|
|
void M_LoadGame (int choice)
|
|
|
|
{
|
|
|
|
if (netgame)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_StartMessage(LOADNET,NULL,false);
|
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
M_SetupNextMenu(&LoadDef);
|
|
|
|
M_ReadSaveStrings();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_SaveGame & Cie.
|
|
|
|
//
|
|
|
|
void M_DrawSave(void)
|
|
|
|
{
|
|
|
|
int i;
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
V_DrawPatchDirect (72,28,0,W_CacheLumpName("M_SAVEG",PU_CACHE));
|
|
|
|
for (i = 0;i < load_end; i++)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i);
|
|
|
|
M_WriteText(LoadDef.x,LoadDef.y+LINEHEIGHT*i,savegamestrings[i]);
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
if (saveStringEnter)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
i = M_StringWidth(savegamestrings[saveSlot]);
|
|
|
|
M_WriteText(LoadDef.x + i,LoadDef.y+LINEHEIGHT*saveSlot,"_");
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_Responder calls this when user is finished
|
|
|
|
//
|
|
|
|
void M_DoSave(int slot)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
G_SaveGame (slot,savegamestrings[slot]);
|
|
|
|
M_ClearMenus ();
|
|
|
|
|
|
|
|
// PICK QUICKSAVE SLOT YET?
|
|
|
|
if (quickSaveSlot == -2)
|
2007-06-22 12:29:55 +02:00
|
|
|
quickSaveSlot = slot;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// User wants to save. Start string input for M_Responder
|
|
|
|
//
|
|
|
|
void M_SaveSelect(int choice)
|
|
|
|
{
|
|
|
|
// we are going to be intercepting all chars
|
|
|
|
saveStringEnter = 1;
|
|
|
|
|
|
|
|
saveSlot = choice;
|
|
|
|
strcpy(saveOldString,savegamestrings[choice]);
|
|
|
|
if (!strcmp(savegamestrings[choice],EMPTYSTRING))
|
2007-06-22 12:29:55 +02:00
|
|
|
savegamestrings[choice][0] = 0;
|
2007-01-28 03:53:06 +01:00
|
|
|
saveCharIndex = strlen(savegamestrings[choice]);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Selected from DOOM menu
|
|
|
|
//
|
|
|
|
void M_SaveGame (int choice)
|
|
|
|
{
|
|
|
|
if (!usergame)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_StartMessage(SAVEDEAD,NULL,false);
|
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
if (gamestate != GS_LEVEL)
|
2007-06-22 12:29:55 +02:00
|
|
|
return;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
M_SetupNextMenu(&SaveDef);
|
|
|
|
M_ReadSaveStrings();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_QuickSave
|
|
|
|
//
|
|
|
|
char tempstring[80];
|
|
|
|
|
|
|
|
void M_QuickSaveResponse(int ch)
|
|
|
|
{
|
|
|
|
if (ch == 'y')
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_DoSave(quickSaveSlot);
|
|
|
|
S_StartSound(NULL,sfx_swtchx);
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_QuickSave(void)
|
|
|
|
{
|
|
|
|
if (!usergame)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
S_StartSound(NULL,sfx_oof);
|
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (gamestate != GS_LEVEL)
|
2007-06-22 12:29:55 +02:00
|
|
|
return;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
if (quickSaveSlot < 0)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_StartControlPanel();
|
|
|
|
M_ReadSaveStrings();
|
|
|
|
M_SetupNextMenu(&SaveDef);
|
|
|
|
quickSaveSlot = -2; // means to pick a slot now
|
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
sprintf(tempstring,QSPROMPT,savegamestrings[quickSaveSlot]);
|
|
|
|
M_StartMessage(tempstring,M_QuickSaveResponse,true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_QuickLoad
|
|
|
|
//
|
|
|
|
void M_QuickLoadResponse(int ch)
|
|
|
|
{
|
|
|
|
if (ch == 'y')
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_LoadSelect(quickSaveSlot);
|
|
|
|
S_StartSound(NULL,sfx_swtchx);
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void M_QuickLoad(void)
|
|
|
|
{
|
|
|
|
if (netgame)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_StartMessage(QLOADNET,NULL,false);
|
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
if (quickSaveSlot < 0)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_StartMessage(QSAVESPOT,NULL,false);
|
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
sprintf(tempstring,QLPROMPT,savegamestrings[quickSaveSlot]);
|
|
|
|
M_StartMessage(tempstring,M_QuickLoadResponse,true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Read This Menus
|
|
|
|
// Had a "quick hack to fix romero bug"
|
|
|
|
//
|
|
|
|
void M_DrawReadThis1(void)
|
|
|
|
{
|
|
|
|
inhelpscreens = true;
|
|
|
|
switch ( gamemode )
|
|
|
|
{
|
|
|
|
case commercial:
|
2007-06-22 12:29:55 +02:00
|
|
|
V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP",PU_CACHE));
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
case shareware:
|
|
|
|
case registered:
|
|
|
|
case retail:
|
2007-06-22 12:29:55 +02:00
|
|
|
V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP1",PU_CACHE));
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
default:
|
2007-06-22 12:29:55 +02:00
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Read This Menus - optional second page.
|
|
|
|
//
|
|
|
|
void M_DrawReadThis2(void)
|
|
|
|
{
|
|
|
|
inhelpscreens = true;
|
|
|
|
switch ( gamemode )
|
|
|
|
{
|
|
|
|
case retail:
|
|
|
|
case commercial:
|
2007-06-22 12:29:55 +02:00
|
|
|
// This hack keeps us from having to change menus.
|
|
|
|
V_DrawPatchDirect (0,0,0,W_CacheLumpName("CREDIT",PU_CACHE));
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
case shareware:
|
|
|
|
case registered:
|
2007-06-22 12:29:55 +02:00
|
|
|
V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP2",PU_CACHE));
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
default:
|
2007-06-22 12:29:55 +02:00
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Change Sfx & Music volumes
|
|
|
|
//
|
|
|
|
void M_DrawSound(void)
|
|
|
|
{
|
|
|
|
V_DrawPatchDirect (60,38,0,W_CacheLumpName("M_SVOL",PU_CACHE));
|
|
|
|
|
|
|
|
M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(sfx_vol+1),
|
2007-06-22 12:29:55 +02:00
|
|
|
16,snd_SfxVolume);
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(music_vol+1),
|
2007-06-22 12:29:55 +02:00
|
|
|
16,snd_MusicVolume);
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void M_Sound(int choice)
|
|
|
|
{
|
|
|
|
M_SetupNextMenu(&SoundDef);
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_SfxVol(int choice)
|
|
|
|
{
|
|
|
|
switch(choice)
|
|
|
|
{
|
|
|
|
case 0:
|
2007-06-22 12:29:55 +02:00
|
|
|
if (snd_SfxVolume)
|
|
|
|
snd_SfxVolume--;
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
case 1:
|
2007-06-22 12:29:55 +02:00
|
|
|
if (snd_SfxVolume < 15)
|
|
|
|
snd_SfxVolume++;
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
S_SetSfxVolume(snd_SfxVolume /* *8 */);
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_MusicVol(int choice)
|
|
|
|
{
|
|
|
|
switch(choice)
|
|
|
|
{
|
|
|
|
case 0:
|
2007-06-22 12:29:55 +02:00
|
|
|
if (snd_MusicVolume)
|
|
|
|
snd_MusicVolume--;
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
case 1:
|
2007-06-22 12:29:55 +02:00
|
|
|
if (snd_MusicVolume < 15)
|
|
|
|
snd_MusicVolume++;
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
S_SetMusicVolume(snd_MusicVolume /* *8 */);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_DrawMainMenu
|
|
|
|
//
|
|
|
|
void M_DrawMainMenu(void)
|
|
|
|
{
|
|
|
|
V_DrawPatchDirect (94,2,0,W_CacheLumpName("M_DOOM",PU_CACHE));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_NewGame
|
|
|
|
//
|
|
|
|
void M_DrawNewGame(void)
|
|
|
|
{
|
|
|
|
V_DrawPatchDirect (96,14,0,W_CacheLumpName("M_NEWG",PU_CACHE));
|
|
|
|
V_DrawPatchDirect (54,38,0,W_CacheLumpName("M_SKILL",PU_CACHE));
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_NewGame(int choice)
|
|
|
|
{
|
|
|
|
if (netgame && !demoplayback)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_StartMessage(NEWGAME,NULL,false);
|
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
if ( gamemode == commercial )
|
2007-06-22 12:29:55 +02:00
|
|
|
M_SetupNextMenu(&NewDef);
|
2007-01-28 03:53:06 +01:00
|
|
|
else
|
2007-06-22 12:29:55 +02:00
|
|
|
M_SetupNextMenu(&EpiDef);
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_Episode
|
|
|
|
//
|
|
|
|
int epi;
|
|
|
|
|
|
|
|
void M_DrawEpisode(void)
|
|
|
|
{
|
|
|
|
V_DrawPatchDirect (54,38,0,W_CacheLumpName("M_EPISOD",PU_CACHE));
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_VerifyNightmare(int ch)
|
|
|
|
{
|
|
|
|
if (ch != 'y')
|
2007-06-22 12:29:55 +02:00
|
|
|
return;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
G_DeferedInitNew(nightmare,epi+1,1);
|
|
|
|
M_ClearMenus ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_ChooseSkill(int choice)
|
|
|
|
{
|
|
|
|
if (choice == nightmare)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_StartMessage(NIGHTMARE,M_VerifyNightmare,true);
|
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
G_DeferedInitNew(choice,epi+1,1);
|
|
|
|
M_ClearMenus ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_Episode(int choice)
|
|
|
|
{
|
|
|
|
if ( (gamemode == shareware)
|
2007-06-22 12:29:55 +02:00
|
|
|
&& choice)
|
2007-01-28 03:53:06 +01:00
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_StartMessage(SWSTRING,NULL,false);
|
|
|
|
M_SetupNextMenu(&ReadDef1);
|
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Yet another hack...
|
|
|
|
if ( (gamemode == registered)
|
2007-06-22 12:29:55 +02:00
|
|
|
&& (choice > 2))
|
2007-01-28 03:53:06 +01:00
|
|
|
{
|
|
|
|
// __libclog_printf("M_Episode: 4th episode requires UltimateDOOM\n");
|
|
|
|
choice = 0;
|
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
epi = choice;
|
|
|
|
M_SetupNextMenu(&NewDef);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_Options
|
|
|
|
//
|
2007-06-22 12:29:55 +02:00
|
|
|
char detailNames[2][9] = {"M_GDHIGH","M_GDLOW"};
|
|
|
|
char msgNames[2][9] = {"M_MSGOFF","M_MSGON"};
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
void M_DrawOptions(void)
|
|
|
|
{
|
|
|
|
V_DrawPatchDirect (108,15,0,W_CacheLumpName("M_OPTTTL",PU_CACHE));
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
V_DrawPatchDirect (OptionsDef.x + 175,OptionsDef.y+LINEHEIGHT*detail,0,
|
2007-06-22 12:29:55 +02:00
|
|
|
W_CacheLumpName(detailNames[detailLevel],PU_CACHE));
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
V_DrawPatchDirect (OptionsDef.x + 120,OptionsDef.y+LINEHEIGHT*messages,0,
|
2007-06-22 12:29:55 +02:00
|
|
|
W_CacheLumpName(msgNames[showMessages],PU_CACHE));
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(mousesens+1),
|
2007-06-22 12:29:55 +02:00
|
|
|
10,mouseSensitivity);
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(scrnsize+1),
|
2007-06-22 12:29:55 +02:00
|
|
|
9,screenSize);
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void M_Options(int choice)
|
|
|
|
{
|
|
|
|
M_SetupNextMenu(&OptionsDef);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Toggle messages on/off
|
|
|
|
//
|
|
|
|
void M_ChangeMessages(int choice)
|
|
|
|
{
|
|
|
|
// warning: unused parameter `int choice'
|
|
|
|
choice = 0;
|
|
|
|
showMessages = 1 - showMessages;
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
if (!showMessages)
|
2007-06-22 12:29:55 +02:00
|
|
|
players[consoleplayer].message = MSGOFF;
|
2007-01-28 03:53:06 +01:00
|
|
|
else
|
2007-06-22 12:29:55 +02:00
|
|
|
players[consoleplayer].message = MSGON ;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
message_dontfuckwithme = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_EndGame
|
|
|
|
//
|
|
|
|
void M_EndGameResponse(int ch)
|
|
|
|
{
|
|
|
|
if (ch != 'y')
|
2007-06-22 12:29:55 +02:00
|
|
|
return;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
currentMenu->lastOn = itemOn;
|
|
|
|
M_ClearMenus ();
|
|
|
|
D_StartTitle ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_EndGame(int choice)
|
|
|
|
{
|
|
|
|
choice = 0;
|
|
|
|
if (!usergame)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
S_StartSound(NULL,sfx_oof);
|
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
if (netgame)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
M_StartMessage(NETEND,NULL,false);
|
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
M_StartMessage(ENDGAME,M_EndGameResponse,true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_ReadThis
|
|
|
|
//
|
|
|
|
void M_ReadThis(int choice)
|
|
|
|
{
|
|
|
|
choice = 0;
|
|
|
|
M_SetupNextMenu(&ReadDef1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_ReadThis2(int choice)
|
|
|
|
{
|
|
|
|
choice = 0;
|
|
|
|
M_SetupNextMenu(&ReadDef2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void M_FinishReadThis(int choice)
|
|
|
|
{
|
|
|
|
choice = 0;
|
|
|
|
M_SetupNextMenu(&MainDef);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_QuitDOOM
|
|
|
|
//
|
|
|
|
int quitsounds[8] =
|
|
|
|
{
|
|
|
|
sfx_pldeth,
|
|
|
|
sfx_dmpain,
|
|
|
|
sfx_popain,
|
|
|
|
sfx_slop,
|
|
|
|
sfx_telept,
|
|
|
|
sfx_posit1,
|
|
|
|
sfx_posit3,
|
|
|
|
sfx_sgtatk
|
|
|
|
};
|
|
|
|
|
|
|
|
int quitsounds2[8] =
|
|
|
|
{
|
|
|
|
sfx_vilact,
|
|
|
|
sfx_getpow,
|
|
|
|
sfx_boscub,
|
|
|
|
sfx_slop,
|
|
|
|
sfx_skeswg,
|
|
|
|
sfx_kntdth,
|
|
|
|
sfx_bspact,
|
|
|
|
sfx_sgtatk
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void M_QuitResponse(int ch)
|
|
|
|
{
|
|
|
|
if (ch != 'y')
|
2007-06-22 12:29:55 +02:00
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
if (!netgame)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
if (gamemode == commercial)
|
|
|
|
S_StartSound(NULL,quitsounds2[(gametic>>2)&7]);
|
|
|
|
else
|
|
|
|
S_StartSound(NULL,quitsounds[(gametic>>2)&7]);
|
|
|
|
I_WaitVBL(105);
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
I_Quit ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void M_QuitDOOM(int choice)
|
|
|
|
{
|
|
|
|
// We pick index 0 which is language sensitive,
|
|
|
|
// or one at random, between 1 and maximum number.
|
|
|
|
if (language != english )
|
|
|
|
sprintf(endstring,"%s\n\n"DOSY, endmsg[0] );
|
|
|
|
else
|
|
|
|
sprintf(endstring,"%s\n\n"DOSY, endmsg[ (gametic%(NUM_QUITMESSAGES-2))+1 ]);
|
|
|
|
|
|
|
|
M_StartMessage(endstring,M_QuitResponse,true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void M_ChangeSensitivity(int choice)
|
|
|
|
{
|
|
|
|
switch(choice)
|
|
|
|
{
|
|
|
|
case 0:
|
2007-06-22 12:29:55 +02:00
|
|
|
if (mouseSensitivity)
|
|
|
|
mouseSensitivity--;
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
case 1:
|
2007-06-22 12:29:55 +02:00
|
|
|
if (mouseSensitivity < 9)
|
|
|
|
mouseSensitivity++;
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void M_ChangeDetail(int choice)
|
|
|
|
{
|
|
|
|
choice = 0;
|
|
|
|
detailLevel = 1 - detailLevel;
|
|
|
|
|
|
|
|
// FIXME - does not work. Remove anyway?
|
|
|
|
// __libclog_printf("M_ChangeDetail: low detail mode n.a.\n");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*R_SetViewSize (screenblocks, detailLevel);
|
|
|
|
|
|
|
|
if (!detailLevel)
|
2007-06-22 12:29:55 +02:00
|
|
|
players[consoleplayer].message = DETAILHI;
|
2007-01-28 03:53:06 +01:00
|
|
|
else
|
2007-06-22 12:29:55 +02:00
|
|
|
players[consoleplayer].message = DETAILLO;*/
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void M_SizeDisplay(int choice)
|
|
|
|
{
|
|
|
|
switch(choice)
|
|
|
|
{
|
|
|
|
case 0:
|
2007-06-22 12:29:55 +02:00
|
|
|
if (screenSize > 0)
|
|
|
|
{
|
|
|
|
screenblocks--;
|
|
|
|
screenSize--;
|
|
|
|
}
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
case 1:
|
2007-06-22 12:29:55 +02:00
|
|
|
if (screenSize < 8)
|
|
|
|
{
|
|
|
|
screenblocks++;
|
|
|
|
screenSize++;
|
|
|
|
}
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
R_SetViewSize (screenblocks, detailLevel);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Menu Functions
|
|
|
|
//
|
|
|
|
void
|
|
|
|
M_DrawThermo
|
2007-06-22 12:29:55 +02:00
|
|
|
( int x,
|
|
|
|
int y,
|
|
|
|
int thermWidth,
|
|
|
|
int thermDot )
|
2007-01-28 03:53:06 +01:00
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
int xx;
|
|
|
|
int i;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
xx = x;
|
|
|
|
V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERML",PU_CACHE));
|
|
|
|
xx += 8;
|
|
|
|
for (i=0;i<thermWidth;i++)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERMM",PU_CACHE));
|
|
|
|
xx += 8;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERMR",PU_CACHE));
|
|
|
|
|
|
|
|
V_DrawPatchDirect ((x+8) + thermDot*8,y,
|
2007-06-22 12:29:55 +02:00
|
|
|
0,W_CacheLumpName("M_THERMO",PU_CACHE));
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
M_DrawEmptyCell
|
2007-06-22 12:29:55 +02:00
|
|
|
( menu_t* menu,
|
|
|
|
int item )
|
2007-01-28 03:53:06 +01:00
|
|
|
{
|
|
|
|
V_DrawPatchDirect (menu->x - 10, menu->y+item*LINEHEIGHT - 1, 0,
|
2007-06-22 12:29:55 +02:00
|
|
|
W_CacheLumpName("M_CELL1",PU_CACHE));
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
M_DrawSelCell
|
2007-06-22 12:29:55 +02:00
|
|
|
( menu_t* menu,
|
|
|
|
int item )
|
2007-01-28 03:53:06 +01:00
|
|
|
{
|
|
|
|
V_DrawPatchDirect (menu->x - 10, menu->y+item*LINEHEIGHT - 1, 0,
|
2007-06-22 12:29:55 +02:00
|
|
|
W_CacheLumpName("M_CELL2",PU_CACHE));
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
M_StartMessage
|
2007-06-22 12:29:55 +02:00
|
|
|
( char* string,
|
|
|
|
void* routine,
|
|
|
|
boolean input )
|
2007-01-28 03:53:06 +01:00
|
|
|
{
|
|
|
|
messageLastMenuActive = menuactive;
|
|
|
|
messageToPrint = 1;
|
|
|
|
messageString = string;
|
|
|
|
messageRoutine = routine;
|
|
|
|
messageNeedsInput = input;
|
|
|
|
menuactive = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void M_StopMessage(void)
|
|
|
|
{
|
|
|
|
menuactive = messageLastMenuActive;
|
|
|
|
messageToPrint = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Find string width from hu_font chars
|
|
|
|
//
|
|
|
|
int M_StringWidth(char* string)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int w = 0;
|
|
|
|
int c;
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
for (i = 0;i < strlen(string);i++)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
c = toupper(string[i]) - HU_FONTSTART;
|
|
|
|
if (c < 0 || c >= HU_FONTSIZE)
|
|
|
|
w += 4;
|
|
|
|
else
|
|
|
|
w += SHORT (hu_font[c]->width);
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Find string height from hu_font chars
|
|
|
|
//
|
|
|
|
int M_StringHeight(char* string)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int h;
|
|
|
|
int height = SHORT(hu_font[0]->height);
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
h = height;
|
|
|
|
for (i = 0;i < strlen(string);i++)
|
2007-06-22 12:29:55 +02:00
|
|
|
if (string[i] == '\n')
|
|
|
|
h += height;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
return h;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Write a string using the hu_font
|
|
|
|
//
|
|
|
|
void
|
|
|
|
M_WriteText
|
2007-06-22 12:29:55 +02:00
|
|
|
( int x,
|
|
|
|
int y,
|
|
|
|
char* string)
|
2007-01-28 03:53:06 +01:00
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
int w;
|
|
|
|
char* ch;
|
|
|
|
int c;
|
|
|
|
int cx;
|
|
|
|
int cy;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
ch = string;
|
|
|
|
cx = x;
|
|
|
|
cy = y;
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
while(1)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
c = *ch++;
|
|
|
|
if (!c)
|
|
|
|
break;
|
|
|
|
if (c == '\n')
|
|
|
|
{
|
|
|
|
cx = x;
|
|
|
|
cy += 12;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
c = toupper(c) - HU_FONTSTART;
|
|
|
|
if (c < 0 || c>= HU_FONTSIZE)
|
|
|
|
{
|
|
|
|
cx += 4;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
w = SHORT (hu_font[c]->width);
|
|
|
|
if (cx+w > SCREENWIDTH)
|
|
|
|
break;
|
|
|
|
V_DrawPatchDirect(cx, cy, 0, hu_font[c]);
|
|
|
|
cx+=w;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// CONTROL PANEL
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_Responder
|
|
|
|
//
|
|
|
|
boolean M_Responder (event_t* ev)
|
|
|
|
{
|
|
|
|
int ch;
|
|
|
|
int i;
|
|
|
|
static int joywait = 0;
|
|
|
|
static int mousewait = 0;
|
|
|
|
static int mousey = 0;
|
|
|
|
static int lasty = 0;
|
|
|
|
static int mousex = 0;
|
|
|
|
static int lastx = 0;
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
ch = -1;
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
if (ev->type == ev_joystick && joywait < I_GetTime())
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
if (ev->data3 == -1)
|
|
|
|
{
|
|
|
|
ch = KEY_UPARROW;
|
|
|
|
joywait = I_GetTime() + 5;
|
|
|
|
}
|
|
|
|
else if (ev->data3 == 1)
|
|
|
|
{
|
|
|
|
ch = KEY_DOWNARROW;
|
|
|
|
joywait = I_GetTime() + 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ev->data2 == -1)
|
|
|
|
{
|
|
|
|
ch = KEY_LEFTARROW;
|
|
|
|
joywait = I_GetTime() + 2;
|
|
|
|
}
|
|
|
|
else if (ev->data2 == 1)
|
|
|
|
{
|
|
|
|
ch = KEY_RIGHTARROW;
|
|
|
|
joywait = I_GetTime() + 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ev->data1&1)
|
|
|
|
{
|
|
|
|
ch = KEY_ENTER;
|
|
|
|
joywait = I_GetTime() + 5;
|
|
|
|
}
|
|
|
|
if (ev->data1&2)
|
|
|
|
{
|
|
|
|
ch = KEY_BACKSPACE;
|
|
|
|
joywait = I_GetTime() + 5;
|
|
|
|
}
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
if (ev->type == ev_mouse && mousewait < I_GetTime())
|
|
|
|
{
|
|
|
|
mousey += ev->data3;
|
|
|
|
if (mousey < lasty-30)
|
|
|
|
{
|
|
|
|
ch = KEY_DOWNARROW;
|
|
|
|
mousewait = I_GetTime() + 5;
|
|
|
|
mousey = lasty -= 30;
|
|
|
|
}
|
|
|
|
else if (mousey > lasty+30)
|
|
|
|
{
|
|
|
|
ch = KEY_UPARROW;
|
|
|
|
mousewait = I_GetTime() + 5;
|
|
|
|
mousey = lasty += 30;
|
|
|
|
}
|
|
|
|
|
|
|
|
mousex += ev->data2;
|
|
|
|
if (mousex < lastx-30)
|
|
|
|
{
|
|
|
|
ch = KEY_LEFTARROW;
|
|
|
|
mousewait = I_GetTime() + 5;
|
|
|
|
mousex = lastx -= 30;
|
|
|
|
}
|
|
|
|
else if (mousex > lastx+30)
|
|
|
|
{
|
|
|
|
ch = KEY_RIGHTARROW;
|
|
|
|
mousewait = I_GetTime() + 5;
|
|
|
|
mousex = lastx += 30;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ev->data1&1)
|
|
|
|
{
|
|
|
|
ch = KEY_ENTER;
|
|
|
|
mousewait = I_GetTime() + 15;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ev->data1&2)
|
|
|
|
{
|
|
|
|
ch = KEY_BACKSPACE;
|
|
|
|
mousewait = I_GetTime() + 15;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (ev->type == ev_keydown)
|
|
|
|
{
|
|
|
|
ch = ev->data1;
|
|
|
|
}
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ch == -1)
|
2007-06-22 12:29:55 +02:00
|
|
|
return false;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
// Save Game string input
|
|
|
|
if (saveStringEnter)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
switch(ch)
|
|
|
|
{
|
|
|
|
case KEY_BACKSPACE:
|
|
|
|
if (saveCharIndex > 0)
|
|
|
|
{
|
|
|
|
saveCharIndex--;
|
|
|
|
savegamestrings[saveSlot][saveCharIndex] = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_ESCAPE:
|
|
|
|
saveStringEnter = 0;
|
|
|
|
strcpy(&savegamestrings[saveSlot][0],saveOldString);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_ENTER:
|
|
|
|
saveStringEnter = 0;
|
|
|
|
if (savegamestrings[saveSlot][0])
|
|
|
|
M_DoSave(saveSlot);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ch = toupper(ch);
|
|
|
|
if (ch != 32)
|
|
|
|
if (ch-HU_FONTSTART < 0 || ch-HU_FONTSTART >= HU_FONTSIZE)
|
|
|
|
break;
|
|
|
|
if (ch >= 32 && ch <= 127 &&
|
|
|
|
saveCharIndex < SAVESTRINGSIZE-1 &&
|
|
|
|
M_StringWidth(savegamestrings[saveSlot]) <
|
|
|
|
(SAVESTRINGSIZE-2)*8)
|
|
|
|
{
|
|
|
|
savegamestrings[saveSlot][saveCharIndex++] = ch;
|
|
|
|
savegamestrings[saveSlot][saveCharIndex] = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return true;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Take care of any messages that need input
|
|
|
|
if (messageToPrint)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
if (messageNeedsInput == true &&
|
|
|
|
!(ch == ' ' || ch == 'n' || ch == 'y' || ch == KEY_ESCAPE))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
menuactive = messageLastMenuActive;
|
|
|
|
messageToPrint = 0;
|
|
|
|
if (messageRoutine)
|
|
|
|
messageRoutine(ch);
|
|
|
|
|
|
|
|
menuactive = false;
|
|
|
|
S_StartSound(NULL,sfx_swtchx);
|
|
|
|
return true;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
if (devparm && ch == KEY_F1)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
G_ScreenShot ();
|
|
|
|
return true;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
2007-06-22 12:29:55 +02:00
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// F-Keys
|
|
|
|
if (!menuactive)
|
2007-06-22 12:29:55 +02:00
|
|
|
switch(ch)
|
|
|
|
{
|
|
|
|
case KEY_MINUS: // Screen size down
|
|
|
|
if (automapactive || chat_on)
|
|
|
|
return false;
|
|
|
|
M_SizeDisplay(0);
|
|
|
|
S_StartSound(NULL,sfx_stnmov);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_EQUALS: // Screen size up
|
|
|
|
if (automapactive || chat_on)
|
|
|
|
return false;
|
|
|
|
M_SizeDisplay(1);
|
|
|
|
S_StartSound(NULL,sfx_stnmov);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_F1: // Help key
|
|
|
|
M_StartControlPanel ();
|
|
|
|
|
|
|
|
if ( gamemode == retail )
|
|
|
|
currentMenu = &ReadDef2;
|
|
|
|
else
|
|
|
|
currentMenu = &ReadDef1;
|
|
|
|
|
|
|
|
itemOn = 0;
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_F2: // Save
|
|
|
|
M_StartControlPanel();
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
M_SaveGame(0);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_F3: // Load
|
|
|
|
M_StartControlPanel();
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
M_LoadGame(0);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_F4: // Sound Volume
|
|
|
|
M_StartControlPanel ();
|
|
|
|
currentMenu = &SoundDef;
|
|
|
|
itemOn = sfx_vol;
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_F5: // Detail toggle
|
|
|
|
M_ChangeDetail(0);
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_F6: // Quicksave
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
M_QuickSave();
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_F7: // End game
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
M_EndGame(0);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_F8: // Toggle messages
|
|
|
|
M_ChangeMessages(0);
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_F9: // Quickload
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
M_QuickLoad();
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_F10: // Quit DOOM
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
M_QuitDOOM(0);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case KEY_F11: // gamma toggle
|
|
|
|
usegamma++;
|
|
|
|
if (usegamma > 4)
|
|
|
|
usegamma = 0;
|
|
|
|
players[consoleplayer].message = gammamsg[usegamma];
|
|
|
|
I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE));
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
// Pop-up menu?
|
|
|
|
if (!menuactive)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
if (ch == KEY_ESCAPE)
|
|
|
|
{
|
|
|
|
M_StartControlPanel ();
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Keys usable within menu
|
|
|
|
switch (ch)
|
|
|
|
{
|
|
|
|
case KEY_DOWNARROW:
|
2007-06-22 12:29:55 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (itemOn+1 > currentMenu->numitems-1)
|
|
|
|
itemOn = 0;
|
|
|
|
else itemOn++;
|
|
|
|
S_StartSound(NULL,sfx_pstop);
|
|
|
|
} while(currentMenu->menuitems[itemOn].status==-1);
|
|
|
|
return true;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
case KEY_UPARROW:
|
2007-06-22 12:29:55 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!itemOn)
|
|
|
|
itemOn = currentMenu->numitems-1;
|
|
|
|
else itemOn--;
|
|
|
|
S_StartSound(NULL,sfx_pstop);
|
|
|
|
} while(currentMenu->menuitems[itemOn].status==-1);
|
|
|
|
return true;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
case KEY_LEFTARROW:
|
2007-06-22 12:29:55 +02:00
|
|
|
if (currentMenu->menuitems[itemOn].routine &&
|
|
|
|
currentMenu->menuitems[itemOn].status == 2)
|
|
|
|
{
|
|
|
|
S_StartSound(NULL,sfx_stnmov);
|
|
|
|
currentMenu->menuitems[itemOn].routine(0);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
case KEY_RIGHTARROW:
|
2007-06-22 12:29:55 +02:00
|
|
|
if (currentMenu->menuitems[itemOn].routine &&
|
|
|
|
currentMenu->menuitems[itemOn].status == 2)
|
|
|
|
{
|
|
|
|
S_StartSound(NULL,sfx_stnmov);
|
|
|
|
currentMenu->menuitems[itemOn].routine(1);
|
|
|
|
}
|
|
|
|
return true;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
case KEY_ENTER:
|
2007-06-22 12:29:55 +02:00
|
|
|
if (currentMenu->menuitems[itemOn].routine &&
|
|
|
|
currentMenu->menuitems[itemOn].status)
|
|
|
|
{
|
|
|
|
currentMenu->lastOn = itemOn;
|
|
|
|
if (currentMenu->menuitems[itemOn].status == 2)
|
|
|
|
{
|
|
|
|
currentMenu->menuitems[itemOn].routine(1); // right arrow
|
|
|
|
S_StartSound(NULL,sfx_stnmov);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
currentMenu->menuitems[itemOn].routine(itemOn);
|
|
|
|
S_StartSound(NULL,sfx_pistol);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
case KEY_ESCAPE:
|
2007-06-22 12:29:55 +02:00
|
|
|
currentMenu->lastOn = itemOn;
|
|
|
|
M_ClearMenus ();
|
|
|
|
S_StartSound(NULL,sfx_swtchx);
|
|
|
|
return true;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
case KEY_BACKSPACE:
|
2007-06-22 12:29:55 +02:00
|
|
|
currentMenu->lastOn = itemOn;
|
|
|
|
if (currentMenu->prevMenu)
|
|
|
|
{
|
|
|
|
currentMenu = currentMenu->prevMenu;
|
|
|
|
itemOn = currentMenu->lastOn;
|
|
|
|
S_StartSound(NULL,sfx_swtchn);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
default:
|
2007-06-22 12:29:55 +02:00
|
|
|
for (i = itemOn+1;i < currentMenu->numitems;i++)
|
|
|
|
if (currentMenu->menuitems[i].alphaKey == ch)
|
|
|
|
{
|
|
|
|
itemOn = i;
|
|
|
|
S_StartSound(NULL,sfx_pstop);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
for (i = 0;i <= itemOn;i++)
|
|
|
|
if (currentMenu->menuitems[i].alphaKey == ch)
|
|
|
|
{
|
|
|
|
itemOn = i;
|
|
|
|
S_StartSound(NULL,sfx_pstop);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_StartControlPanel
|
|
|
|
//
|
|
|
|
void M_StartControlPanel (void)
|
|
|
|
{
|
|
|
|
// intro might call this repeatedly
|
|
|
|
if (menuactive)
|
2007-06-22 12:29:55 +02:00
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
menuactive = 1;
|
|
|
|
currentMenu = &MainDef; // JDC
|
|
|
|
itemOn = currentMenu->lastOn; // JDC
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_Drawer
|
|
|
|
// Called after the view has been rendered,
|
|
|
|
// but before it has been blitted.
|
|
|
|
//
|
|
|
|
void M_Drawer (void)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
static short x;
|
|
|
|
static short y;
|
|
|
|
short i;
|
|
|
|
short max;
|
2007-01-29 21:02:19 +01:00
|
|
|
char *p;
|
|
|
|
int len;
|
2007-06-22 12:29:55 +02:00
|
|
|
char string[40];
|
|
|
|
int start;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
inhelpscreens = false;
|
|
|
|
|
|
|
|
// Horiz. & Vertically center string and print it.
|
|
|
|
if (messageToPrint)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
y = 100 - M_StringHeight(messageString)/2;
|
|
|
|
p = messageString;
|
|
|
|
len = strlen(p);
|
|
|
|
while(*p)
|
|
|
|
{
|
2007-01-29 21:02:19 +01:00
|
|
|
for (i = 0;len;i++,len--)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
if (*(p+i) == '\n')
|
|
|
|
{ memset(string,0,40);
|
|
|
|
strncpy(string,p,i);
|
|
|
|
p+= i+1;
|
|
|
|
len-= 1;
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2007-01-29 21:02:19 +01:00
|
|
|
if (len == 0)
|
|
|
|
{ strncpy(string,p,i);
|
|
|
|
p+=i;
|
|
|
|
};
|
|
|
|
x = 160 - M_StringWidth(string)/2;
|
|
|
|
M_WriteText(x,y,string);
|
|
|
|
y += SHORT(hu_font[0]->height);
|
2007-06-22 12:29:55 +02:00
|
|
|
};
|
|
|
|
return;
|
2007-01-29 21:02:19 +01:00
|
|
|
};
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
if (!menuactive)
|
2007-06-22 12:29:55 +02:00
|
|
|
return;
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
if (currentMenu->routine)
|
2007-06-22 12:29:55 +02:00
|
|
|
currentMenu->routine(); // call Draw routine
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
// DRAW MENU
|
|
|
|
x = currentMenu->x;
|
|
|
|
y = currentMenu->y;
|
|
|
|
max = currentMenu->numitems;
|
|
|
|
|
|
|
|
for (i=0;i<max;i++)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
if (currentMenu->menuitems[i].name[0])
|
|
|
|
V_DrawPatchDirect (x,y,0,
|
|
|
|
W_CacheLumpName(currentMenu->menuitems[i].name ,PU_CACHE));
|
|
|
|
y += LINEHEIGHT;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// DRAW SKULL
|
|
|
|
V_DrawPatchDirect(x + SKULLXOFF,currentMenu->y - 5 + itemOn*LINEHEIGHT, 0,
|
2007-06-22 12:29:55 +02:00
|
|
|
W_CacheLumpName(skullName[whichSkull],PU_CACHE));
|
2007-01-28 03:53:06 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_ClearMenus
|
|
|
|
//
|
|
|
|
void M_ClearMenus (void)
|
|
|
|
{
|
|
|
|
menuactive = 0;
|
|
|
|
// if (!netgame && usergame && paused)
|
|
|
|
// sendpause = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_SetupNextMenu
|
|
|
|
//
|
|
|
|
void M_SetupNextMenu(menu_t *menudef)
|
|
|
|
{
|
|
|
|
currentMenu = menudef;
|
|
|
|
itemOn = currentMenu->lastOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_Ticker
|
|
|
|
//
|
|
|
|
void M_Ticker (void)
|
|
|
|
{
|
|
|
|
if (--skullAnimCounter <= 0)
|
|
|
|
{
|
2007-06-22 12:29:55 +02:00
|
|
|
whichSkull ^= 1;
|
|
|
|
skullAnimCounter = 8;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// M_Init
|
|
|
|
//
|
|
|
|
void M_Init (void)
|
|
|
|
{
|
|
|
|
currentMenu = &MainDef;
|
|
|
|
menuactive = 0;
|
|
|
|
itemOn = currentMenu->lastOn;
|
|
|
|
whichSkull = 0;
|
|
|
|
skullAnimCounter = 10;
|
|
|
|
screenSize = screenblocks - 3;
|
|
|
|
messageToPrint = 0;
|
|
|
|
messageString = NULL;
|
|
|
|
messageLastMenuActive = menuactive;
|
|
|
|
quickSaveSlot = -1;
|
|
|
|
|
|
|
|
// Here we could catch other version dependencies,
|
|
|
|
// like HELP1/2, and four episodes.
|
|
|
|
|
|
|
|
|
|
|
|
switch ( gamemode )
|
|
|
|
{
|
|
|
|
case commercial:
|
2007-06-22 12:29:55 +02:00
|
|
|
// This is used because DOOM 2 had only one HELP
|
2007-01-28 03:53:06 +01:00
|
|
|
// page. I use CREDIT as second page now, but
|
2007-06-22 12:29:55 +02:00
|
|
|
// kept this hack for educational purposes.
|
|
|
|
MainMenu[readthis] = MainMenu[quitdoom];
|
|
|
|
MainDef.numitems--;
|
|
|
|
MainDef.y += 8;
|
|
|
|
NewDef.prevMenu = &MainDef;
|
|
|
|
ReadDef1.routine = M_DrawReadThis1;
|
|
|
|
ReadDef1.x = 330;
|
|
|
|
ReadDef1.y = 165;
|
|
|
|
ReadMenu1[0].routine = M_FinishReadThis;
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
case shareware:
|
2007-06-22 12:29:55 +02:00
|
|
|
// Episode 2 and 3 are handled,
|
|
|
|
// branching to an ad screen.
|
2007-01-28 03:53:06 +01:00
|
|
|
case registered:
|
2007-06-22 12:29:55 +02:00
|
|
|
// We need to remove the fourth episode.
|
|
|
|
EpiDef.numitems--;
|
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
case retail:
|
2007-06-22 12:29:55 +02:00
|
|
|
// We are fine.
|
2007-01-28 03:53:06 +01:00
|
|
|
default:
|
2007-06-22 12:29:55 +02:00
|
|
|
break;
|
2007-01-28 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|