2004-08-23 00:15:46 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-07-22 15:05:40 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2005-02-28 07:16:19 +00:00
|
|
|
//There are still menu states, which say which menu gets absolute control.
|
|
|
|
//Some of the destinations are healthier than others. :)
|
|
|
|
|
|
|
|
//m_none - menu is disabled
|
|
|
|
//m_complex - hirachy of item types
|
|
|
|
//m_help - old q1 style help menu (fixme: make m_complex)
|
|
|
|
//m_plugin - A QVM based or DLL based plugin.
|
|
|
|
|
|
|
|
|
|
|
|
//the m_complex menu state is the most advanced, and drives the bulk of FTE's menus in an event driven way.
|
|
|
|
//It consists of menus and items. Fairly basic really.
|
|
|
|
//Each item type has a structure (or shares a structure).
|
|
|
|
//Each of these structures contain a menucommon_t.
|
|
|
|
//The backend of this system lives in m_items.c.
|
|
|
|
//If you're creating your own quake menu, there should be little need to go in there.
|
|
|
|
//These are the item types:
|
|
|
|
|
2011-07-22 15:05:40 +00:00
|
|
|
//mt_childwindow -
|
2005-02-28 07:16:19 +00:00
|
|
|
//mt_button - Executes a console command or callback on enter. Uses conchars.
|
2008-01-28 13:27:30 +00:00
|
|
|
//mt_buttonbigfont - Used by hexen2's menus. Uses gfx/menu/bigfont.lmp as it's characters.
|
2005-02-28 07:16:19 +00:00
|
|
|
//mt_box - A 2d box. The same one as the quit dialog from q1, but resized.
|
|
|
|
//mt_colouredbox - Not used.
|
|
|
|
//mt_line - Not used.
|
|
|
|
//mt_edit - A one row edit box, either attached to a cvar, or an apply button.
|
|
|
|
//mt_text - unselectable. Otherwise like mt_button
|
|
|
|
//mt_slider - a horizontal slider, like quake's gamma option, attached to a cvar.
|
|
|
|
//mt_combo - multiple specific options. Created with specifically structured info.
|
|
|
|
//mt_bind - a key binding option.
|
|
|
|
//mt_checkbox - a yes/no toggle, attached to a cvar.
|
|
|
|
//mt_picture - Just draws a lmp from it's x/y.
|
|
|
|
//mt_menudot - The 24*24 rotating quake menudot. Should be specified as the cursoritem, and should be placed to match the selecteditem's y position.
|
|
|
|
//mt_custom - Just an option with callbacks. This is the basis of the top/bottom color seletion, and could be used for all sorts of things.
|
|
|
|
|
|
|
|
|
2012-10-10 22:58:51 +00:00
|
|
|
//Sample menu creation, entirly within / * and * /
|
2005-02-28 07:16:19 +00:00
|
|
|
//Note that most of FTE's menus are more complicated, as FTE runs on Q1/Q2/H2 data, and it's choice of menu images reflects this.
|
|
|
|
//Most of the normal menus also have more items too, of course.
|
|
|
|
|
|
|
|
//FTE's menu console commands are registered from M_Init_Internal instead of M_Init as implied here. Why?
|
|
|
|
//FTE's menu.dat support unregisters the menu console commands so the menu.dat can use those commands instead.
|
|
|
|
//This results in more user friendliness for mods but makes the code a little more confusing.
|
|
|
|
//If you make the menu name unique enough, then there's no need to follow the standard menu code.
|
|
|
|
/*
|
|
|
|
//M_SomeMenuConsoleCommand_f
|
|
|
|
//Spawns a sample menu.
|
|
|
|
void M_SomeMenuConsoleCommand_f (void)
|
|
|
|
{
|
|
|
|
menu_t *m = M_CreateMenu(0);
|
|
|
|
int y = 32;
|
|
|
|
|
|
|
|
//add the title
|
2009-11-04 21:16:50 +00:00
|
|
|
MC_AddCenterPicture(m, 4, 24, "gfx/p_option.lmp");
|
2005-02-28 07:16:19 +00:00
|
|
|
|
|
|
|
//add the blinking > thingie
|
|
|
|
//(note NULL instead of a valid string, this should really be a variant of mt_menudot instead)
|
|
|
|
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 200, y, NULL, false);
|
|
|
|
|
|
|
|
//Set up so the first item is selected. :)
|
|
|
|
m->selecteditem = (menuoption_t*)
|
|
|
|
|
|
|
|
//Add the items.
|
|
|
|
MC_AddConsoleCommand(menu, 16, y, " Customize controls", "menu_keys\n"); y+=8;
|
|
|
|
MC_AddSlider(menu, 16, y, " Mouse Speed", &sensitivity, 1, 10); y+=8;
|
|
|
|
MC_AddCheckBox(menu, 16, y, " Lookstrafe", &lookstrafe,0); y+=8;
|
|
|
|
}
|
|
|
|
|
|
|
|
//eg: M_Init
|
|
|
|
void M_SomeInitialisationFunctionCalledAtStartup(void)
|
|
|
|
{
|
|
|
|
Cmd_AddCommand("menu_somemenu", M_SomeMenuConsoleCommand_f);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2017-04-18 11:12:17 +00:00
|
|
|
#ifdef PLUGINS
|
|
|
|
extern struct plugin_s *menuplug;
|
|
|
|
#endif
|
|
|
|
#ifndef NOBUILTINMENUS
|
|
|
|
extern struct menu_s *topmenu;
|
|
|
|
#endif
|
2014-09-02 02:44:43 +00:00
|
|
|
void M_DrawTextBox (int x, int y, int width, int lines);
|
|
|
|
|
2014-09-08 23:47:19 +00:00
|
|
|
#ifndef NOBUILTINMENUS
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// menus
|
|
|
|
//
|
|
|
|
void M_Init (void);
|
2010-07-13 09:49:38 +00:00
|
|
|
void M_Reinit(void);
|
2014-03-30 08:55:06 +00:00
|
|
|
void M_Shutdown(qboolean total);
|
2009-07-25 11:05:06 +00:00
|
|
|
void M_Keydown (int key, int unicode);
|
|
|
|
void M_Keyup (int key, int unicode);
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_Draw (int uimenu);
|
2014-08-27 08:41:31 +00:00
|
|
|
void M_Menu_Mods_f (void); //used at startup if the current gamedirs look dodgy.
|
2015-04-14 23:12:17 +00:00
|
|
|
void M_Menu_Installer (void); //given an embedded manifest, this displays an install menu for said game.
|
2004-12-24 08:45:56 +00:00
|
|
|
mpic_t *M_CachePic (char *path);
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_Menu_Quit_f (void);
|
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
|
|
|
void M_Menu_Prompt (void (*callback)(void *, int), void *ctx, const char *messages, char *optionyes, char *optionno, char *optioncancel);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
struct menu_s;
|
|
|
|
|
|
|
|
|
2006-05-11 00:41:47 +00:00
|
|
|
typedef enum {
|
2019-01-13 16:51:50 +00:00
|
|
|
mt_framestart,
|
|
|
|
mt_frameend,
|
2011-07-22 15:05:40 +00:00
|
|
|
mt_button,
|
2006-05-11 00:41:47 +00:00
|
|
|
mt_qbuttonbigfont,
|
|
|
|
mt_hexen2buttonbigfont,
|
|
|
|
mt_box,
|
|
|
|
mt_colouredbox,
|
|
|
|
mt_line,
|
|
|
|
mt_edit,
|
2011-07-22 15:05:40 +00:00
|
|
|
mt_text,
|
2006-05-11 00:41:47 +00:00
|
|
|
mt_slider,
|
2011-07-22 15:05:40 +00:00
|
|
|
mt_combo,
|
|
|
|
mt_bind,
|
2006-05-11 00:41:47 +00:00
|
|
|
mt_checkbox,
|
2011-07-22 15:05:40 +00:00
|
|
|
mt_picture,
|
|
|
|
mt_picturesel,
|
2011-06-07 23:54:58 +00:00
|
|
|
mt_menudot,
|
2014-08-17 03:18:43 +00:00
|
|
|
mt_menucursor,
|
2006-05-11 00:41:47 +00:00
|
|
|
mt_custom
|
|
|
|
} menutype_t;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
typedef struct { //must be first of each structure type.
|
|
|
|
menutype_t type;
|
|
|
|
int posx;
|
|
|
|
int posy;
|
2013-10-29 17:38:22 +00:00
|
|
|
int width; //total width
|
|
|
|
int height; //total height
|
2011-06-16 21:41:05 +00:00
|
|
|
int extracollide; // dirty hack to stretch collide box left (the real fix is to have separate collide/render rects)
|
2016-02-10 23:23:43 +00:00
|
|
|
const char *tooltip;
|
2006-03-04 20:43:48 +00:00
|
|
|
qboolean noselectionsound:1;
|
|
|
|
qboolean iszone:1;
|
2006-03-06 01:41:09 +00:00
|
|
|
qboolean ishidden:1;
|
2004-08-23 00:15:46 +00:00
|
|
|
union menuoption_s *next;
|
|
|
|
} menucommon_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
menucommon_t common;
|
|
|
|
const char *text;
|
|
|
|
const char *command;
|
2015-01-21 18:18:37 +00:00
|
|
|
qboolean rightalign;
|
2004-08-23 00:15:46 +00:00
|
|
|
qboolean (*key) (union menuoption_s *option, struct menu_s *, int key);
|
|
|
|
} menubutton_t;
|
|
|
|
|
|
|
|
#define MAX_EDIT_LENGTH 256
|
|
|
|
typedef struct {
|
|
|
|
menucommon_t common;
|
2013-10-29 17:38:22 +00:00
|
|
|
int captionwidth;
|
2004-08-23 00:15:46 +00:00
|
|
|
const char *caption;
|
|
|
|
cvar_t *cvar;
|
|
|
|
char text[MAX_EDIT_LENGTH];
|
|
|
|
int cursorpos;
|
2005-02-12 18:56:04 +00:00
|
|
|
qboolean modified;
|
2011-06-07 23:54:58 +00:00
|
|
|
qboolean slim;
|
2004-08-23 00:15:46 +00:00
|
|
|
} menuedit_t;
|
|
|
|
typedef struct {
|
|
|
|
menucommon_t common;
|
|
|
|
float min;
|
|
|
|
float max;
|
|
|
|
float current;
|
|
|
|
float smallchange;
|
|
|
|
float largechange;
|
2013-07-26 17:19:06 +00:00
|
|
|
float vx;
|
2004-08-23 00:15:46 +00:00
|
|
|
cvar_t *var;
|
2013-10-29 17:38:22 +00:00
|
|
|
int textwidth;
|
2004-08-23 00:15:46 +00:00
|
|
|
const char *text;
|
|
|
|
} menuslider_t;
|
|
|
|
|
|
|
|
typedef enum {CHK_CHECKED, CHK_TOGGLE} chk_set_t;
|
2006-02-28 00:46:04 +00:00
|
|
|
typedef struct menucheck_s {
|
2004-08-23 00:15:46 +00:00
|
|
|
menucommon_t common;
|
|
|
|
const char *text;
|
2013-10-29 17:38:22 +00:00
|
|
|
int textwidth;
|
2004-08-23 00:15:46 +00:00
|
|
|
cvar_t *var;
|
2004-09-13 03:10:10 +00:00
|
|
|
int bits;
|
2004-08-23 00:15:46 +00:00
|
|
|
float value;
|
2006-02-28 00:46:04 +00:00
|
|
|
qboolean (*func) (struct menucheck_s *option, struct menu_s *menu, chk_set_t set);
|
2004-08-23 00:15:46 +00:00
|
|
|
} menucheck_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
menucommon_t common;
|
|
|
|
const char *text;
|
2018-10-27 04:32:18 +00:00
|
|
|
int rightalign;
|
2004-08-23 00:15:46 +00:00
|
|
|
qboolean isred;
|
|
|
|
} menutext_t;
|
|
|
|
|
|
|
|
typedef struct menucustom_s {
|
|
|
|
menucommon_t common;
|
2013-03-12 22:47:42 +00:00
|
|
|
void *dptr;
|
|
|
|
int dint;
|
2004-08-23 00:15:46 +00:00
|
|
|
void (*draw) (int x, int y, struct menucustom_s *, struct menu_s *);
|
2015-06-16 23:53:58 +00:00
|
|
|
qboolean (*key) (struct menucustom_s *, struct menu_s *, int key, unsigned int unicode);
|
2004-08-23 00:15:46 +00:00
|
|
|
} menucustom_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
menucommon_t common;
|
|
|
|
char *picturename;
|
|
|
|
} menupicture_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
menucommon_t common;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
} menubox_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
menucommon_t common;
|
|
|
|
|
2013-10-29 17:38:22 +00:00
|
|
|
int captionwidth;
|
2004-08-23 00:15:46 +00:00
|
|
|
const char *caption;
|
|
|
|
const char **options;
|
|
|
|
const char **values;
|
|
|
|
cvar_t *cvar;
|
|
|
|
int numoptions;
|
|
|
|
int selectedoption;
|
|
|
|
} menucombo_t;
|
|
|
|
|
2004-09-07 18:19:22 +00:00
|
|
|
typedef struct {
|
2004-08-23 00:15:46 +00:00
|
|
|
menucommon_t common;
|
2013-10-29 17:38:22 +00:00
|
|
|
int captionwidth;
|
2004-09-07 18:19:22 +00:00
|
|
|
char *caption;
|
|
|
|
char *command;
|
|
|
|
} menubind_t;
|
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
typedef struct {
|
|
|
|
menucommon_t common;
|
|
|
|
qboolean mousedown;
|
|
|
|
float frac;
|
|
|
|
union menuoption_s *suboptions;
|
|
|
|
} menuframe_t;
|
|
|
|
|
2004-09-07 18:19:22 +00:00
|
|
|
typedef union menuoption_s {
|
|
|
|
menucommon_t common;
|
|
|
|
menubutton_t button;
|
|
|
|
menuedit_t edit;
|
|
|
|
menucombo_t combo;
|
|
|
|
menuslider_t slider;
|
|
|
|
menutext_t text;
|
|
|
|
menucustom_t custom;
|
|
|
|
menupicture_t picture;
|
|
|
|
menubox_t box;
|
|
|
|
menucheck_t check;
|
|
|
|
menubind_t bind;
|
2019-01-13 16:51:50 +00:00
|
|
|
menuframe_t frame;
|
2004-08-23 00:15:46 +00:00
|
|
|
} menuoption_t;
|
|
|
|
|
2009-04-19 10:50:31 +00:00
|
|
|
typedef struct menutooltip_s {
|
2016-08-25 00:12:14 +00:00
|
|
|
conchar_t *end;
|
|
|
|
conchar_t text[1];
|
2009-04-19 10:50:31 +00:00
|
|
|
} menutooltip_t;
|
|
|
|
|
2014-08-17 03:18:43 +00:00
|
|
|
typedef struct menuresel_s //THIS STRUCT MUST BE STATICALLY ALLOCATED.
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
} menuresel_t;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
typedef struct menu_s {
|
|
|
|
int xpos;
|
|
|
|
int ypos;
|
|
|
|
int width;
|
|
|
|
int height;
|
2006-02-28 00:46:04 +00:00
|
|
|
qboolean dontexpand;
|
2004-08-23 00:15:46 +00:00
|
|
|
int numoptions;
|
2014-08-17 03:18:43 +00:00
|
|
|
menuresel_t *reselection; //stores some info to restore selection properly.
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
qboolean iszone;
|
|
|
|
qboolean exclusive;
|
2017-01-24 10:27:39 +00:00
|
|
|
qboolean persist; //persists despite menuqc/engine changes etc
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
void *data; //typecast
|
|
|
|
|
2016-07-12 00:40:13 +00:00
|
|
|
void (*reset) (struct menu_s *); //called after a video mode switch / shader reload.
|
2015-06-18 22:11:30 +00:00
|
|
|
void (*remove) (struct menu_s *);
|
2004-08-23 00:15:46 +00:00
|
|
|
qboolean (*key) (int key, struct menu_s *); //true if key was handled
|
2015-06-18 22:11:30 +00:00
|
|
|
void (*predraw) (struct menu_s *);
|
|
|
|
void (*postdraw) (struct menu_s *);
|
2004-08-23 00:15:46 +00:00
|
|
|
menuoption_t *options;
|
|
|
|
|
|
|
|
menuoption_t *selecteditem;
|
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
|
|
|
menuoption_t *mouseitem;
|
2009-04-19 10:50:31 +00:00
|
|
|
|
|
|
|
menutooltip_t *tooltip;
|
|
|
|
double tooltiptime;
|
2011-07-22 15:05:40 +00:00
|
|
|
|
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
|
|
|
struct menu_s *prev;
|
|
|
|
struct menu_s *next;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
int cursorpos;
|
|
|
|
menuoption_t *cursoritem;
|
|
|
|
} menu_t;
|
|
|
|
|
2018-10-27 04:32:18 +00:00
|
|
|
menutext_t *MC_AddBufferedText(menu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign, qboolean red);
|
|
|
|
menutext_t *MC_AddRedText(menu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign);
|
|
|
|
menutext_t *MC_AddWhiteText(menu_t *menu, int lhs, int rhs, int y, const char *text, int rightalign);
|
2014-05-10 17:26:41 +00:00
|
|
|
menubind_t *MC_AddBind(menu_t *menu, int cx, int bx, int y, const char *caption, char *command, char *tooltip);
|
2004-08-23 00:15:46 +00:00
|
|
|
menubox_t *MC_AddBox(menu_t *menu, int x, int y, int width, int height);
|
2009-11-04 21:16:50 +00:00
|
|
|
menupicture_t *MC_AddPicture(menu_t *menu, int x, int y, int width, int height, char *picname);
|
2019-01-13 16:51:50 +00:00
|
|
|
menupicture_t *MC_AddSelectablePicture(menu_t *menu, int x, int y, int height, char *picname);
|
2009-11-04 21:16:50 +00:00
|
|
|
menupicture_t *MC_AddCenterPicture(menu_t *menu, int y, int height, char *picname);
|
2014-08-17 03:18:43 +00:00
|
|
|
menupicture_t *MC_AddCursor(menu_t *menu, menuresel_t *resel, int x, int y);
|
|
|
|
menuoption_t *MC_AddCursorSmall(menu_t *menu, menuresel_t *reselection, int x, int y);
|
2013-10-29 17:38:22 +00:00
|
|
|
menuslider_t *MC_AddSlider(menu_t *menu, int tx, int sx, int y, const char *text, cvar_t *var, float min, float max, float delta);
|
|
|
|
menucheck_t *MC_AddCheckBox(menu_t *menu, int tx, int cx, int y, const char *text, cvar_t *var, int cvarbitmask);
|
|
|
|
menucheck_t *MC_AddCheckBoxFunc(menu_t *menu, int tx, int cx, int y, const char *text, qboolean (*func) (menucheck_t *option, menu_t *menu, chk_set_t set), int bits);
|
2014-03-30 08:55:06 +00:00
|
|
|
menubutton_t *MC_AddConsoleCommand(menu_t *menu, int lhs, int rhs, int y, const char *text, const char *command);
|
2006-03-06 01:41:09 +00:00
|
|
|
menubutton_t *MC_AddConsoleCommandQBigFont(menu_t *menu, int x, int y, const char *text, const char *command);
|
|
|
|
mpic_t *QBigFontWorks(void);
|
2007-08-06 21:13:15 +00:00
|
|
|
menubutton_t *MC_AddConsoleCommandHexen2BigFont(menu_t *menu, int x, int y, const char *text, const char *command);
|
2018-10-27 04:32:18 +00:00
|
|
|
menubutton_t *VARGS MC_AddConsoleCommandf(menu_t *menu, int lhs, int rhs, int y, int rightalign, const char *text, char *command, ...);
|
2014-03-30 08:55:06 +00:00
|
|
|
menubutton_t *MC_AddCommand(menu_t *menu, int lhs, int rhs, int y, char *text, qboolean (*command) (union menuoption_s *,struct menu_s *,int));
|
2013-10-29 17:38:22 +00:00
|
|
|
menucombo_t *MC_AddCombo(menu_t *menu, int tx, int cx, int y, const char *caption, const char **ops, int initialvalue);
|
|
|
|
menucombo_t *MC_AddCvarCombo(menu_t *menu, int tx, int cx, int y, const char *caption, cvar_t *cvar, const char **ops, const char **values);
|
|
|
|
menuedit_t *MC_AddEdit(menu_t *menu, int cx, int ex, int y, char *text, char *def);
|
|
|
|
menuedit_t *MC_AddEditCvar(menu_t *menu, int cx, int ex, int y, char *text, char *name, qboolean slim);
|
2019-01-15 14:12:49 +00:00
|
|
|
menucustom_t *MC_AddCustom(menu_t *menu, int x, int y, void *dptr, int dint, const char *tooltip);
|
2019-01-13 16:51:50 +00:00
|
|
|
menuframe_t *MC_AddFrameStart(menu_t *menu, int y); //call before items are added
|
|
|
|
menuframe_t *MC_AddFrameEnd(menu_t *menu, int y); //and call AFTER that stuff with the same y.
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2011-06-07 23:54:58 +00:00
|
|
|
typedef struct menubulk_s {
|
|
|
|
menutype_t type;
|
|
|
|
int variant;
|
|
|
|
char *text;
|
2016-02-10 23:23:43 +00:00
|
|
|
const char *tooltip;
|
2011-06-07 23:54:58 +00:00
|
|
|
char *consolecmd; // console command
|
|
|
|
cvar_t *cvar; // check box, slider
|
|
|
|
int flags; // check box
|
|
|
|
qboolean (*func) (struct menucheck_s *option, struct menu_s *menu, chk_set_t set); // check box
|
|
|
|
float min; // slider
|
|
|
|
float max; // slider
|
|
|
|
float delta; // slider
|
|
|
|
qboolean rightalign; // text
|
|
|
|
qboolean (*command) (union menuoption_s *, struct menu_s *, int); // command
|
|
|
|
char *cvarname; // edit cvar
|
|
|
|
const char **options; // combo
|
|
|
|
const char **values; // cvar combo
|
|
|
|
int selectedoption; // other combo
|
|
|
|
union menuoption_s **ret; // other combo
|
|
|
|
int spacing; // spacing
|
|
|
|
} menubulk_t;
|
|
|
|
|
2011-07-22 15:05:40 +00:00
|
|
|
#define MB_CONSOLECMD(text, cmd, tip) {mt_button, 0, text, tip, cmd}
|
|
|
|
#define MB_CHECKBOXCVAR(text, cvar, flags) {mt_checkbox, 0, text, NULL, NULL, &cvar, flags}
|
|
|
|
#define MB_CHECKBOXCVARTIP(text, cvar, flags, tip) {mt_checkbox, 0, text, tip, NULL, &cvar, flags}
|
|
|
|
#define MB_CHECKBOXCVARRETURN(text, cvar, flags, ret) {mt_checkbox, 0, text, NULL, NULL, &cvar, flags, NULL, 0, 0, 0, false, NULL, NULL, NULL, NULL, 0, (union menuoption_s **)&ret}
|
|
|
|
#define MB_CHECKBOXFUNC(text, func, flags, tip) {mt_checkbox, 0, text, tip, NULL, NULL, flags, func}
|
|
|
|
#define MB_SLIDER(text, cvar, min, max, delta, tip) {mt_slider, 0, text, tip, NULL, &cvar, 0, NULL, min, max, delta}
|
|
|
|
#define MB_TEXT(text, align) {mt_text, 0, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, align}
|
|
|
|
#define MB_REDTEXT(text, align) {mt_text, 1, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, align}
|
|
|
|
#define MB_CMD(text, cmdfunc, tip) {mt_button, 1, text, tip, NULL, NULL, 0, NULL, 0, 0, 0, false, cmdfunc}
|
|
|
|
#define MB_EDITCVARTIP(text, cvarname, tip) {mt_edit, 0, text, tip, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname}
|
2011-07-22 15:38:50 +00:00
|
|
|
#define MB_EDITCVAR(text, cvarname) {mt_edit, 0, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname}
|
2011-07-22 15:05:40 +00:00
|
|
|
#define MB_EDITCVARSLIM(text, cvarname, tip) {mt_edit, 1, text, tip, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname}
|
|
|
|
#define MB_EDITCVARSLIMRETURN(text, cvarname, ret) {mt_edit, 1, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname, NULL, NULL, 0, (union menuoption_s **)&ret}
|
|
|
|
#define MB_COMBOCVAR(text, cvar, options, values, tip) {mt_combo, 0, text, tip, NULL, &cvar, 0, NULL, 0, 0, 0, false, NULL, NULL, options, values}
|
|
|
|
#define MB_COMBORETURN(text, options, selected, ret, tip) {mt_combo, 1, text, tip, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, NULL, options, NULL, selected, (union menuoption_s **)&ret}
|
|
|
|
#define MB_COMBOCVARRETURN(text, cvar, options, values, ret, tip) {mt_combo, 0, text, tip, NULL, &cvar, 0, NULL, 0, 0, 0, false, NULL, NULL, options, values, 0, (union menuoption_s **)&ret}
|
|
|
|
#define MB_SPACING(space) {mt_text, 2, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, NULL, NULL, NULL, 0, NULL, space}
|
|
|
|
#define MB_END() {mt_text, -1}
|
2011-06-07 23:54:58 +00:00
|
|
|
|
2014-08-17 03:18:43 +00:00
|
|
|
int MC_AddBulk(struct menu_s *menu, menuresel_t *resel, menubulk_t *bulk, int xstart, int xtextend, int y);
|
2011-06-07 23:54:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-11 02:22:39 +00:00
|
|
|
menu_t *M_Options_Title(int *y, int infosize); /*Create a menu with the default options titlebar*/
|
2004-08-23 00:15:46 +00:00
|
|
|
menu_t *M_CreateMenu (int extrasize);
|
2012-04-24 07:59:11 +00:00
|
|
|
menu_t *M_CreateMenuInfront (int extrasize);
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_AddMenu (menu_t *menu);
|
|
|
|
void M_HideMenu (menu_t *menu);
|
|
|
|
void M_RemoveMenu (menu_t *menu);
|
2015-07-14 14:47:00 +00:00
|
|
|
void M_RemoveAllMenus (qboolean leaveprompts);
|
2016-07-12 00:40:13 +00:00
|
|
|
void M_ReloadMenus(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
void M_Complex_Key(int key, int unicode);
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_Complex_Draw(void);
|
|
|
|
void M_Script_Init(void);
|
|
|
|
void M_Serverlist_Init(void);
|
|
|
|
|
2016-01-18 05:22:07 +00:00
|
|
|
const char *M_ChooseAutoSave(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_Menu_Main_f (void);
|
|
|
|
void M_Menu_SinglePlayer_f (void);
|
|
|
|
void M_Menu_Load_f (void);
|
|
|
|
void M_Menu_Save_f (void);
|
|
|
|
void M_Menu_MultiPlayer_f (void);
|
|
|
|
void M_Menu_Setup_f (void);
|
|
|
|
void M_Menu_Net_f (void);
|
|
|
|
void M_Menu_Options_f (void);
|
|
|
|
void M_Menu_Keys_f (void);
|
|
|
|
void M_Menu_Video_f (void);
|
|
|
|
void M_Menu_Help_f (void);
|
|
|
|
void M_Menu_Quit_f (void);
|
2012-04-24 07:59:11 +00:00
|
|
|
void M_Menu_Preset_f (void);
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_Menu_LanConfig_f (void);
|
|
|
|
void M_Menu_GameOptions_f (void);
|
|
|
|
void M_Menu_Search_f (void);
|
|
|
|
void M_Menu_ServerList_f (void);
|
|
|
|
|
2014-09-02 02:44:43 +00:00
|
|
|
/*
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_Main_Draw (void);
|
|
|
|
void M_SinglePlayer_Draw (void);
|
|
|
|
void M_Load_Draw (void);
|
|
|
|
void M_Save_Draw (void);
|
|
|
|
void M_MultiPlayer_Draw (void);
|
|
|
|
void M_Setup_Draw (void);
|
|
|
|
void M_Net_Draw (void);
|
|
|
|
void M_Options_Draw (void);
|
|
|
|
void M_Video_Draw (void);
|
|
|
|
void M_Help_Draw (void);
|
|
|
|
void M_Quit_Draw (void);
|
|
|
|
void M_LanConfig_Draw (void);
|
|
|
|
void M_GameOptions_Draw (void);
|
|
|
|
void M_Search_Draw (void);
|
|
|
|
void M_ServerList_Draw (void);
|
|
|
|
|
|
|
|
void M_Main_Key (int key);
|
|
|
|
void M_SinglePlayer_Key (int key);
|
|
|
|
void M_Load_Key (int key);
|
|
|
|
void M_Save_Key (int key);
|
|
|
|
void M_MultiPlayer_Key (int key);
|
|
|
|
void M_Setup_Key (int key);
|
|
|
|
void M_Net_Key (int key);
|
|
|
|
void M_Options_Key (int key);
|
|
|
|
void M_Video_Key (int key);
|
|
|
|
void M_Help_Key (int key);
|
|
|
|
void M_Quit_Key (int key);
|
|
|
|
void M_LanConfig_Key (int key);
|
|
|
|
void M_GameOptions_Key (int key);
|
|
|
|
void M_Search_Key (int key);
|
|
|
|
void M_ServerList_Key (int key);
|
2014-09-02 02:44:43 +00:00
|
|
|
*/
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
//drawing funcs
|
2014-10-11 19:39:45 +00:00
|
|
|
void M_BuildTranslationTable(unsigned int pc, unsigned int top, unsigned int bottom, unsigned int *translationTable);
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_DrawCharacter (int cx, int line, unsigned int num);
|
|
|
|
void M_Print (int cx, int cy, qbyte *str);
|
|
|
|
void M_PrintWhite (int cx, int cy, qbyte *str);
|
2009-11-04 21:16:50 +00:00
|
|
|
void M_DrawScalePic (int x, int y, int w, int h, mpic_t *pic);
|
2004-09-13 03:10:10 +00:00
|
|
|
|
|
|
|
|
2014-03-30 08:55:06 +00:00
|
|
|
void M_UnbindCommand (const char *command);
|
2004-11-23 01:10:10 +00:00
|
|
|
|
2014-09-02 02:44:43 +00:00
|
|
|
#else
|
|
|
|
//no builtin menu code.
|
|
|
|
//stubs
|
2017-03-26 01:46:08 +00:00
|
|
|
#define M_Menu_Prompt(cb,ctx,messages,optionyes,optionno,optioncancel) (cb)(ctx,-1)
|
2014-09-02 02:44:43 +00:00
|
|
|
//#define M_Shutdown(t) MP_Shutdown()
|
|
|
|
|
|
|
|
void M_Init (void);
|
|
|
|
void M_Reinit(void);
|
|
|
|
void M_Shutdown(qboolean total);
|
|
|
|
void M_Keydown (int key, int unicode);
|
|
|
|
void M_Keyup (int key, int unicode);
|
|
|
|
void M_Draw (int uimenu);
|
|
|
|
#endif
|
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
|
|
|
int M_FindKeysForCommand (int bindmap, int pnum, const char *command, int *keylist, int *keymods, int keycount);
|
|
|
|
int M_FindKeysForBind (int bindmap, const char *command, int *keylist, int *keymods, int keycount);
|
2018-05-21 13:47:53 +00:00
|
|
|
void M_ToggleMenu_f (void);
|
2014-09-02 02:44:43 +00:00
|
|
|
|
2015-07-14 14:47:00 +00:00
|
|
|
#ifdef MENU_DAT
|
2011-05-20 04:10:46 +00:00
|
|
|
void MP_CvarChanged(cvar_t *var);
|
2010-07-12 22:46:37 +00:00
|
|
|
qboolean MP_Init (void);
|
2010-07-13 09:49:38 +00:00
|
|
|
void MP_Shutdown (void);
|
2015-07-27 08:21:34 +00:00
|
|
|
qboolean MP_Toggle(int mode);
|
2004-11-23 01:10:10 +00:00
|
|
|
void MP_Draw(void);
|
2017-01-24 10:27:39 +00:00
|
|
|
qboolean MP_UsingGamecodeLoadingScreen(void);
|
2006-02-11 14:51:36 +00:00
|
|
|
void MP_RegisterCvarsAndCmds(void);
|
2016-11-02 08:01:21 +00:00
|
|
|
qboolean MP_Keydown(int key, int unicode, unsigned int devid);
|
|
|
|
void MP_Keyup(int key, int unicode, unsigned int devid);
|
|
|
|
qboolean MP_MouseMove(float x, float y, unsigned int devid);
|
|
|
|
qboolean MP_MousePosition(float x, float y, unsigned int devid);
|
|
|
|
qboolean MP_JoystickAxis(int axis, float value, unsigned int devid);
|
2017-08-14 16:38:44 +00:00
|
|
|
int MP_BuiltinValid(const char *name, int num);
|
|
|
|
qboolean MP_ConsoleCommand(const char *cmdtext);
|
2018-09-29 17:31:58 +00:00
|
|
|
int MP_GetServerCategory(int index);
|
2015-07-14 14:47:00 +00:00
|
|
|
#endif
|
2005-03-15 22:51:01 +00:00
|
|
|
|
2018-05-21 13:47:53 +00:00
|
|
|
#ifdef MENU_NATIVECODE
|
2018-11-27 16:48:19 +00:00
|
|
|
#ifdef HAVE_CLIENT
|
2018-06-02 08:55:57 +00:00
|
|
|
#include "api_menu.h"
|
2018-05-21 13:47:53 +00:00
|
|
|
extern menu_export_t *mn_entry;
|
|
|
|
void MN_Shutdown(void);
|
|
|
|
qboolean MN_Init(void);
|
|
|
|
#endif
|
2018-11-27 16:48:19 +00:00
|
|
|
#endif
|
2018-05-21 13:47:53 +00:00
|
|
|
|
2009-04-06 00:34:32 +00:00
|
|
|
#define MGT_BAD ~0
|
2005-03-15 22:51:01 +00:00
|
|
|
#define MGT_QUAKE1 0
|
|
|
|
#define MGT_HEXEN2 1
|
|
|
|
#define MGT_QUAKE2 2
|
2005-03-20 02:57:11 +00:00
|
|
|
int M_GameType(void);
|