gzdoom-gles/src/m_menu.h

234 lines
4.9 KiB
C
Raw Normal View History

// 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.
//
// DESCRIPTION:
// Menu widget stuff, episode selection and such.
//
//-----------------------------------------------------------------------------
#ifndef __M_MENU_H__
#define __M_MENU_H__
#include "d_event.h"
#include "c_cvars.h"
//
// MENUS
//
// Called by main loop,
// saves config file and calls I_Quit when user exits.
// Even when the menu is not displayed,
// this can resize the view and change game parameters.
// Does all the real work of the menu interaction.
bool M_Responder (event_t *ev);
// Called by main loop,
// only used for menu (skull cursor) animation.
void M_Ticker (void);
// Called by main loop,
// draws the menus directly into the screen buffer.
void M_Drawer (void);
// Called by D_DoomMain, loads the config file.
void M_Init (void);
void M_Deinit ();
// Called by intro code to force menu up upon a keypress,
// does nothing if menu is already up.
void M_StartControlPanel (bool makeSound);
// Turns off the menu
void M_ClearMenus ();
// [RH] Setup options menu
bool M_StartOptionsMenu (void);
// [RH] Handle keys for options menu
void M_OptResponder (event_t *ev);
// [RH] Draw options menu
void M_OptDrawer (void);
// [RH] Initialize options menu
void M_OptInit (void);
Note: I have not tried compiling these recent changes under Linux. I wouldn't be surprised if it doesn't work. - Reorganized the network startup loops so now they are event driven. There is a single function that gets called to drive it, and it uses callbacks to perform the different stages of the synchronization. This lets me have a nice, responsive abort button instead of the previous unannounced hit-escape-to- abort behavior, and I think the rearranged code is slightly easier to understand too. - Increased the number of bytes for version info during D_ArbitrateNetStart(), in preparation for the day when NETGAMEVERSION requires more than one byte. - I noticed an issue with Vista RC1 and the new fatal error setup. Even after releasing a DirectDraw or Direct3D interface, the DWM can still use the last image drawn using them when it composites the window. It doesn't always do it but it does often enough that it is a real problem. At this point, I don't know if it's a problem with the release version of Vista or not. After messing around, I discovered the problem was caused by ~Win32Video() hiding the window and then having it immediately shown soon after. The DWM kept an image of the window to do the transition effect with, and then when it didn't get a chance to do the transition, it didn't properly forget about its saved image and kept plastering it on top of everything else underneath. - Added a network synchronization panel to the window during netgame startup. - Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL. Otherwise, classic DECORATE definitions generate a big, fat crash. - Resurrected the R_Init progress bar, now as a standard Windows control. - Removed the sound failure dialog. The FMOD setup already defaulted to no sound if initialization failed, so this only applies when snd_output is set to "alternate" which now also falls back to no sound. In addition, it wasn't working right, and I didn't feel like fixing it for the probably 0% of users it affected. - Fixed: The edit control used for logging output added text in reverse order on Win9x. - Went back to the roots and made graphics initialization one of the last things to happen during setup. Now the startup text is visible again. More importantly, the main window is no longer created invisible, which seems to cause trouble with it not always appearing in the taskbar. The fatal error dialog is now also embedded in the main window instead of being a separate modal dialog, so you can play with the log window to see any problems that might be reported there. Rather than completely restoring the original startup order, I tried to keep things as close to the way they were with early graphics startup. In particular, V_Init() now creates a dummy screen so that things that need screen dimensions can get them. It gets replaced by the real screen later in I_InitGraphics(). Will need to check this under Linux to make sure it didn't cause any problems there. - Removed the following stubs that just called functions in Video: - I_StartModeIterator() - I_NextMode() - I_DisplayType() I_FullscreenChanged() was also removed, and a new fullscreen parameter was added to IVideo::StartModeIterator(), since that's all it controlled. - Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's initialized post-1.22. SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
// [RH] Initialize the video modes menu
void M_InitVideoModesMenu (void);
struct menu_s;
void M_SwitchMenu (struct menu_s *menu);
void M_PopMenuStack (void);
// [RH] Called whenever the display mode changes
void M_RefreshModesList ();
void M_ActivateMenuInput ();
void M_DeactivateMenuInput ();
void M_NotifyNewSave (const char *file, const char *title, bool okForQuicksave);
//
// MENU TYPEDEFS
//
typedef enum {
whitetext,
redtext,
more,
rightmore,
safemore,
rsafemore,
slider,
absslider,
inverter,
discrete,
cdiscrete,
discrete_guid,
control,
screenres,
bitflag,
bitmask,
listelement,
nochoice,
numberedmore,
colorpicker,
intslider,
palettegrid,
} itemtype;
struct GUIDName;
typedef struct menuitem_s {
itemtype type;
const char *label;
union {
FBaseCVar *cvar;
FIntCVar *intcvar;
FGUIDCVar *guidcvar;
FColorCVar *colorcvar;
int selmode;
float fval;
} a;
union {
float min; /* aka numvalues aka invflag */
float numvalues;
float invflag;
int key1;
char *res1;
int position;
} b;
union {
float max;
int key2;
char *res2;
void *extra;
} c;
union {
float step;
char *res3;
} d;
union {
struct value_s *values;
GUIDName *guidvalues;
char *command;
void (*cfunc)(FBaseCVar *cvar, float newval);
void (*mfunc)(void);
void (*lfunc)(int);
int highlight;
int flagmask;
} e;
} menuitem_t;
typedef struct menu_s {
const char *texttitle;
int lastOn;
int numitems;
int indent;
menuitem_t *items;
int scrolltop;
int scrollpos;
int y;
void (*PreDraw)(void);
bool DontDim;
void (*EscapeHandler)(void);
} menu_t;
typedef struct value_s {
float value;
const char *name;
} value_t;
typedef struct
{
// -1 = no cursor here, 1 = ok, 2 = arrows ok
SBYTE status;
BYTE fulltext; // [RH] Menu name is text, not a graphic
// hotkey in menu
char alphaKey;
const char *name;
// choice = menu item #.
// if status = 2,
// choice=0:leftarrow,1:rightarrow
void (*routine)(int choice);
} oldmenuitem_t;
typedef struct oldmenu_s
{
short numitems; // # of menu items
oldmenuitem_t *menuitems; // menu items
void (*routine)(void); // draw routine
short x;
short y; // x,y of menu
short lastOn; // last item user was on in menu
} oldmenu_t;
typedef struct
{
union {
menu_t *newmenu;
oldmenu_t *old;
} menu;
bool isNewStyle;
bool drawSkull;
} menustack_t;
extern value_t YesNo[2];
extern value_t NoYes[2];
extern value_t OnOff[2];
extern menustack_t MenuStack[16];
extern int MenuStackDepth;
extern bool OptionsActive;
extern menu_t *CurrentMenu;
extern int CurrentItem;
#define MAX_EPISODES 8
extern oldmenuitem_t EpisodeMenu[MAX_EPISODES];
extern bool EpisodeNoSkill[MAX_EPISODES];
extern char EpisodeMaps[MAX_EPISODES][8];
extern oldmenu_t EpiDef;
#endif