DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
menu.h File Reference
#include "qtypes.h"
+ Include dependency graph for menu.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  video_resolution_t
 

Enumerations

enum  m_state_e {
  m_none , m_main , m_demo , m_singleplayer ,
  m_transfusion_episode , m_transfusion_skill , m_load , m_save ,
  m_multiplayer , m_setup , m_options , m_video ,
  m_keys , m_help , m_credits , m_quit ,
  m_lanconfig , m_gameoptions , m_slist , m_options_effects ,
  m_options_graphics , m_options_colorcontrol , m_reset , m_modlist
}
 

Functions

qbool MP_ConsoleCommand (const char *text, size_t textlen)
 
void MR_Init (void)
 
void MR_Init_Commands (void)
 
void MR_Restart (void)
 

Variables

enum m_state_e m_state
 
jmp_buf mp_abort
 
void(* MR_Draw )(void)
 
int(* MR_GetServerListEntryCategory )(const struct serverlist_entry_s *entry)
 
void(* MR_KeyEvent )(int key, int ascii, qbool downevent)
 
void(* MR_NewMap )(void)
 
void(* MR_Shutdown )(void)
 
void(* MR_ToggleMenu )(int mode)
 
video_resolution_tvideo_resolutions
 
int video_resolutions_count
 
video_resolution_t video_resolutions_hardcoded []
 
int video_resolutions_hardcoded_count
 

Enumeration Type Documentation

◆ m_state_e

enum m_state_e
Enumerator
m_none 
m_main 
m_demo 
m_singleplayer 
m_transfusion_episode 
m_transfusion_skill 
m_load 
m_save 
m_multiplayer 
m_setup 
m_options 
m_video 
m_keys 
m_help 
m_credits 
m_quit 
m_lanconfig 
m_gameoptions 
m_slist 
m_options_effects 
m_options_graphics 
m_options_colorcontrol 
m_reset 
m_modlist 

Definition at line 27 of file menu.h.

27 {
28 m_none,
29 m_main,
30 m_demo,
34 m_load,
35 m_save,
37 m_setup,
39 m_video,
40 m_keys,
41 m_help,
43 m_quit,
46 m_slist,
50 m_reset,
52};
@ m_credits
Definition menu.h:42
@ m_transfusion_skill
Definition menu.h:33
@ m_transfusion_episode
Definition menu.h:32
@ m_lanconfig
Definition menu.h:44
@ m_save
Definition menu.h:35
@ m_gameoptions
Definition menu.h:45
@ m_options_effects
Definition menu.h:47
@ m_multiplayer
Definition menu.h:36
@ m_quit
Definition menu.h:43
@ m_keys
Definition menu.h:40
@ m_slist
Definition menu.h:46
@ m_video
Definition menu.h:39
@ m_singleplayer
Definition menu.h:31
@ m_demo
Definition menu.h:30
@ m_options_graphics
Definition menu.h:48
@ m_modlist
Definition menu.h:51
@ m_setup
Definition menu.h:37
@ m_options_colorcontrol
Definition menu.h:49
@ m_reset
Definition menu.h:50
@ m_help
Definition menu.h:41
@ m_none
Definition menu.h:28
@ m_main
Definition menu.h:29
@ m_load
Definition menu.h:34
@ m_options
Definition menu.h:38

Function Documentation

◆ MP_ConsoleCommand()

qbool MP_ConsoleCommand ( const char * text,
size_t textlen )

Definition at line 56 of file mvm_cmds.c.

57{
58 prvm_prog_t *prog = MVM_prog;
59 if (setjmp(mp_abort))
60 return false;
61 return PRVM_ConsoleCommand(prog, text, textlen, &prog->funcoffsets.GameCommand, false, -1, 0, "QC function GameCommand is missing");
62}
jmp_buf mp_abort
Definition menu.c:5227
qbool PRVM_ConsoleCommand(prvm_prog_t *prog, const char *text, size_t textlen, int *func, qbool preserve_self, int curself, double ptime, const char *error_message)
Definition prvm_cmds.c:68
prvm_prog_funcoffsets_t funcoffsets
Definition progsvm.h:693

References prvm_prog_t::funcoffsets, mp_abort, and PRVM_ConsoleCommand().

◆ MR_Init()

void MR_Init ( void )

Definition at line 5543 of file menu.c.

5544{
5545 vid_mode_t res[1024];
5546 size_t res_count, i;
5547
5548 res_count = VID_ListModes(res, sizeof(res) / sizeof(*res));
5549 res_count = VID_SortModes(res, res_count, false, false, true);
5550 if(res_count)
5551 {
5552 video_resolutions_count = (int)res_count;
5555 for(i = 0; i < res_count; ++i)
5556 {
5557 int n, d, t;
5558 video_resolutions[i].type = "Detected mode"; // FIXME make this more dynamic
5561 video_resolutions[i].pixelheight = res[i].pixelheight_num / (double) res[i].pixelheight_denom;
5564 while(d)
5565 {
5566 t = n;
5567 n = d;
5568 d = t % d;
5569 }
5570 d = (res[i].pixelheight_num * video_resolutions[i].height) / n;
5572 switch(n * 0x10000 | d)
5573 {
5574 case 0x00040003:
5577 video_resolutions[i].type = "Standard 4x3";
5578 break;
5579 case 0x00050004:
5582 if(res[i].pixelheight_denom == res[i].pixelheight_num)
5583 video_resolutions[i].type = "Square Pixel (LCD) 5x4";
5584 else
5585 video_resolutions[i].type = "Short Pixel (CRT) 5x4";
5586 break;
5587 case 0x00080005:
5590 if(res[i].pixelheight_denom == res[i].pixelheight_num)
5591 video_resolutions[i].type = "Widescreen 8x5";
5592 else
5593 video_resolutions[i].type = "Tall Pixel (CRT) 8x5";
5594
5595 break;
5596 case 0x00050003:
5599 video_resolutions[i].type = "Widescreen 5x3";
5600 break;
5601 case 0x000D0009:
5604 video_resolutions[i].type = "Widescreen 14x9";
5605 break;
5606 case 0x00100009:
5609 video_resolutions[i].type = "Widescreen 16x9";
5610 break;
5611 case 0x00030002:
5614 video_resolutions[i].type = "NTSC 3x2";
5615 break;
5616 case 0x000D000B:
5619 video_resolutions[i].type = "PAL 14x11";
5620 break;
5621 case 0x00080007:
5622 if(video_resolutions[i].width >= 512)
5623 {
5626 video_resolutions[i].type = "SNES 8x7";
5627 }
5628 else
5629 {
5632 video_resolutions[i].type = "NES 8x7";
5633 }
5634 break;
5635 default:
5637 video_resolutions[i].conheight = 640 * d / n;
5638 video_resolutions[i].type = "Detected mode";
5639 break;
5640 }
5642 {
5643 int f1, f2;
5646 if(f1 > f2)
5647 {
5650 }
5651 else
5652 {
5655 }
5656 }
5657 }
5658 }
5659 else
5660 {
5663 }
5664
5667
5668 // use -forceqmenu to use always the normal quake menu (it sets forceqmenu to 1)
5669// COMMANDLINEOPTION: Client: -forceqmenu disables menu.dat (same as +forceqmenu 1)
5670 if(Sys_CheckParm("-forceqmenu"))
5672 // use -useqmenu for debugging proposes, cause it starts
5673 // the normal quake menu only the first time
5674// COMMANDLINEOPTION: Client: -useqmenu causes the first time you open the menu to use the quake menu, then reverts to menu.dat (if forceqmenu is 0)
5675 if(Sys_CheckParm("-useqmenu"))
5676 MR_SetRouting (true);
5677 else
5678 MR_SetRouting (false);
5679}
client_static_t cls
Definition cl_main.c:116
cvar_t vid_pixelheight
Definition cl_screen.c:58
void Cvar_SetValueQuick(cvar_t *var, float value)
Definition cvar.c:473
#define n(x, y)
static int(ZEXPORT *qz_inflate)(z_stream *strm
GLenum GLsizei width
Definition glquake.h:622
GLenum GLsizei GLsizei height
Definition glquake.h:622
video_resolution_t * video_resolutions
Definition menu.c:2851
video_resolution_t video_resolutions_hardcoded[]
Definition menu.c:2782
static void M_Menu_Video_FindResolution(int w, int h, float a)
Definition menu.c:2858
static qbool menu_video_resolutions_forfullscreen
Definition menu.c:2856
int video_resolutions_count
Definition menu.c:2852
static cvar_t forceqmenu
Definition menu.c:31
void MR_SetRouting(qbool forceold)
Definition menu.c:5485
int i
mempool_t * permanentmempool
Definition client.h:572
float value
Definition cvar.h:74
int integer
Definition cvar.h:73
int pixelheight_denom
Definition vid.h:244
int pixelheight_num
Definition vid.h:244
int width
Definition vid.h:243
int height
Definition vid.h:243
int width
Definition vid.h:60
int height
Definition vid.h:61
viddef_mode_t mode
currently active video mode
Definition vid.h:73
double pixelheight
pixel aspect
Definition menu.h:98
const char * type
Definition menu.h:95
int Sys_CheckParm(const char *parm)
Definition sys_shared.c:327
size_t VID_ListModes(vid_mode_t *modes, size_t maxcount)
Definition vid_null.c:62
viddef_t vid
global video state
Definition vid_shared.c:64
size_t VID_SortModes(vid_mode_t *modes, size_t count, qbool usebpp, qbool userefreshrate, qbool useaspect)
cvar_t vid_fullscreen
Definition vid_shared.c:134
#define Mem_Alloc(pool, size)
Definition zone.h:92

References cls, video_resolution_t::conheight, video_resolution_t::conwidth, Cvar_SetValueQuick(), forceqmenu, height, vid_mode_t::height, viddef_mode_t::height, video_resolution_t::height, i, int(), cvar_t::integer, M_Menu_Video_FindResolution(), Mem_Alloc, menu_video_resolutions_forfullscreen, viddef_t::mode, MR_SetRouting(), n, client_static_t::permanentmempool, video_resolution_t::pixelheight, vid_mode_t::pixelheight_denom, vid_mode_t::pixelheight_num, Sys_CheckParm(), video_resolution_t::type, cvar_t::value, vid, vid_fullscreen, VID_ListModes(), vid_pixelheight, VID_SortModes(), video_resolutions, video_resolutions_count, video_resolutions_hardcoded, vid_mode_t::width, viddef_mode_t::width, video_resolution_t::width, and width.

Referenced by Host_Init(), Host_LoadConfig_f(), and MR_Restart().

◆ MR_Init_Commands()

void MR_Init_Commands ( void )

Definition at line 5533 of file menu.c.

5534{
5535 // set router console commands
5539 Cmd_AddCommand(CF_CLIENT, "menu_restart", MR_Restart_f, "restart menu system (reloads menu.dat)");
5540 Cmd_AddCommand(CF_CLIENT, "togglemenu", Call_MR_ToggleMenu_f, "opens or closes menu");
5541}
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
Definition cmd.c:1661
#define CF_CLIENT
cvar/command that only the client can change/execute
Definition cmd.h:48
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
Definition cvar.c:599
static cvar_t menu_options_colorcontrol_correctionvalue
Definition menu.c:2110
static void Call_MR_ToggleMenu_f(cmd_state_t *cmd)
Definition menu.c:5524
static cvar_t menu_progs
Definition menu.c:32
static void MR_Restart_f(cmd_state_t *cmd)
Definition menu.c:5519

References Call_MR_ToggleMenu_f(), CF_CLIENT, Cmd_AddCommand(), Cvar_RegisterVariable(), forceqmenu, menu_options_colorcontrol_correctionvalue, menu_progs, and MR_Restart_f().

Referenced by CL_Init().

◆ MR_Restart()

void MR_Restart ( void )

Definition at line 5512 of file menu.c.

5513{
5514 if(MR_Shutdown)
5515 MR_Shutdown ();
5516 MR_Init();
5517}
void(* MR_Shutdown)(void)
Definition menu.c:5481
void MR_Init(void)
Definition menu.c:5543

References MR_Init(), and MR_Shutdown.

Referenced by MR_Restart_f().

Variable Documentation

◆ m_state

◆ mp_abort

◆ MR_Draw

void(* MR_Draw) (void) ( void )
extern

Definition at line 5479 of file menu.c.

Referenced by MR_SetRouting(), and SCR_DrawScreen().

◆ MR_GetServerListEntryCategory

int(* MR_GetServerListEntryCategory) (const struct serverlist_entry_s *entry) ( const struct serverlist_entry_s * entry)
extern

◆ MR_KeyEvent

void(* MR_KeyEvent) (int key, int ascii, qbool downevent) ( int key,
int ascii,
qbool downevent )
extern

Definition at line 5478 of file menu.c.

Referenced by Key_Event(), and MR_SetRouting().

◆ MR_NewMap

void(* MR_NewMap) (void) ( void )
extern

Definition at line 5482 of file menu.c.

Referenced by CL_SetupWorldModel(), and MR_SetRouting().

◆ MR_Shutdown

void(* MR_Shutdown) (void) ( void )
extern

Definition at line 5481 of file menu.c.

Referenced by CL_Shutdown(), Host_LoadConfig_f(), MR_Restart(), and MR_SetRouting().

◆ MR_ToggleMenu

void(* MR_ToggleMenu) (int mode) ( int mode)
extern

◆ video_resolutions

video_resolution_t* video_resolutions
extern

Definition at line 2851 of file menu.c.

Referenced by M_Menu_Video_FindResolution(), MR_Init(), and VM_M_getresolution().

◆ video_resolutions_count

int video_resolutions_count
extern

Definition at line 2852 of file menu.c.

Referenced by M_Menu_Video_FindResolution(), MR_Init(), and VM_M_getresolution().

◆ video_resolutions_hardcoded

video_resolution_t video_resolutions_hardcoded[]
extern

Definition at line 2782 of file menu.c.

2783{
2784{"Standard 4x3" , 320, 240, 320, 240, 1 },
2785{"Standard 4x3" , 400, 300, 400, 300, 1 },
2786{"Standard 4x3" , 512, 384, 512, 384, 1 },
2787{"Standard 4x3" , 640, 480, 640, 480, 1 },
2788{"Standard 4x3" , 800, 600, 640, 480, 1 },
2789{"Standard 4x3" , 1024, 768, 640, 480, 1 },
2790{"Standard 4x3" , 1152, 864, 640, 480, 1 },
2791{"Standard 4x3" , 1280, 960, 640, 480, 1 },
2792{"Standard 4x3" , 1400,1050, 640, 480, 1 },
2793{"Standard 4x3" , 1600,1200, 640, 480, 1 },
2794{"Standard 4x3" , 1792,1344, 640, 480, 1 },
2795{"Standard 4x3" , 1856,1392, 640, 480, 1 },
2796{"Standard 4x3" , 1920,1440, 640, 480, 1 },
2797{"Standard 4x3" , 2048,1536, 640, 480, 1 },
2798{"Short Pixel (CRT) 5x4" , 320, 256, 320, 256, 0.9375},
2799{"Short Pixel (CRT) 5x4" , 640, 512, 640, 512, 0.9375},
2800{"Short Pixel (CRT) 5x4" , 1280,1024, 640, 512, 0.9375},
2801{"Tall Pixel (CRT) 8x5" , 320, 200, 320, 200, 1.2 },
2802{"Tall Pixel (CRT) 8x5" , 640, 400, 640, 400, 1.2 },
2803{"Tall Pixel (CRT) 8x5" , 840, 525, 640, 400, 1.2 },
2804{"Tall Pixel (CRT) 8x5" , 960, 600, 640, 400, 1.2 },
2805{"Tall Pixel (CRT) 8x5" , 1680,1050, 640, 400, 1.2 },
2806{"Tall Pixel (CRT) 8x5" , 1920,1200, 640, 400, 1.2 },
2807{"Square Pixel (LCD) 5x4" , 320, 256, 320, 256, 1 },
2808{"Square Pixel (LCD) 5x4" , 640, 512, 640, 512, 1 },
2809{"Square Pixel (LCD) 5x4" , 1280,1024, 640, 512, 1 },
2810{"WideScreen 5x3" , 640, 384, 640, 384, 1 },
2811{"WideScreen 5x3" , 1280, 768, 640, 384, 1 },
2812{"WideScreen 8x5" , 320, 200, 320, 200, 1 },
2813{"WideScreen 8x5" , 640, 400, 640, 400, 1 },
2814{"WideScreen 8x5" , 720, 450, 720, 450, 1 },
2815{"WideScreen 8x5" , 840, 525, 640, 400, 1 },
2816{"WideScreen 8x5" , 960, 600, 640, 400, 1 },
2817{"WideScreen 8x5" , 1280, 800, 640, 400, 1 },
2818{"WideScreen 8x5" , 1440, 900, 720, 450, 1 },
2819{"WideScreen 8x5" , 1680,1050, 640, 400, 1 },
2820{"WideScreen 8x5" , 1920,1200, 640, 400, 1 },
2821{"WideScreen 8x5" , 2560,1600, 640, 400, 1 },
2822{"WideScreen 8x5" , 3840,2400, 640, 400, 1 },
2823{"WideScreen 14x9" , 840, 540, 640, 400, 1 },
2824{"WideScreen 14x9" , 1680,1080, 640, 400, 1 },
2825{"WideScreen 16x9" , 640, 360, 640, 360, 1 },
2826{"WideScreen 16x9" , 683, 384, 683, 384, 1 },
2827{"WideScreen 16x9" , 960, 540, 640, 360, 1 },
2828{"WideScreen 16x9" , 1280, 720, 640, 360, 1 },
2829{"WideScreen 16x9" , 1360, 768, 680, 384, 1 },
2830{"WideScreen 16x9" , 1366, 768, 683, 384, 1 },
2831{"WideScreen 16x9" , 1600, 900, 640, 360, 1 },
2832{"WideScreen 16x9" , 1920,1080, 640, 360, 1 },
2833{"WideScreen 16x9" , 2560,1440, 640, 360, 1 },
2834{"WideScreen 16x9" , 3840,2160, 640, 360, 1 },
2835{"NTSC 3x2" , 360, 240, 360, 240, 1.125 },
2836{"NTSC 3x2" , 720, 480, 720, 480, 1.125 },
2837{"PAL 14x11" , 360, 283, 360, 283, 0.9545},
2838{"PAL 14x11" , 720, 566, 720, 566, 0.9545},
2839{"NES 8x7" , 256, 224, 256, 224, 1.1667},
2840{"SNES 8x7" , 512, 448, 512, 448, 1.1667},
2841{NULL, 0, 0, 0, 0, 0}
2842};
#define NULL
Definition qtypes.h:12

Referenced by M_Menu_Video_FindResolution(), MR_Init(), and VM_M_getresolution().

◆ video_resolutions_hardcoded_count

int video_resolutions_hardcoded_count
extern

Definition at line 2844 of file menu.c.

Referenced by M_Menu_Video_FindResolution(), and VM_M_getresolution().