2010-08-02 08:13:51 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2016-03-14 00:07:28 +00:00
|
|
|
Copyright (C) 2016 EDuke32 developers and contributors
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
This file is part of EDuke32.
|
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
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
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2010-08-02 08:13:51 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef menus_h_
|
|
|
|
#define menus_h_
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2014-05-31 12:26:41 +00:00
|
|
|
#include "compat.h"
|
2012-10-14 22:16:07 +00:00
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-12-27 18:36:14 +00:00
|
|
|
#if defined EDUKE32_TOUCH_DEVICES
|
2017-01-18 22:21:40 +00:00
|
|
|
# define EDUKE32_SIMPLE_MENU
|
|
|
|
# define EDUKE32_ANDROID_MENU
|
2014-09-30 04:07:29 +00:00
|
|
|
#endif
|
|
|
|
|
2017-01-18 22:21:40 +00:00
|
|
|
// #define EDUKE32_SIMPLE_MENU
|
2014-09-30 04:07:29 +00:00
|
|
|
|
2012-10-14 22:16:07 +00:00
|
|
|
enum MenuIndex_t {
|
2014-05-31 12:26:41 +00:00
|
|
|
MENU_NULL = INT32_MIN, // sentinel for "do nothing"
|
|
|
|
MENU_CLOSE = -2, // sentinel for "close the menu"/"no menu"
|
|
|
|
MENU_PREVIOUS = -1, // sentinel for "go to previous menu"
|
2012-10-14 22:16:07 +00:00
|
|
|
MENU_MAIN = 0,
|
|
|
|
MENU_MAIN_INGAME = 50,
|
|
|
|
MENU_EPISODE = 100,
|
|
|
|
MENU_USERMAP = 101,
|
|
|
|
MENU_SKILL = 110,
|
2014-05-31 12:26:41 +00:00
|
|
|
MENU_GAMESETUP = 200,
|
2012-10-14 22:16:07 +00:00
|
|
|
MENU_OPTIONS = 202,
|
|
|
|
MENU_VIDEOSETUP = 203,
|
|
|
|
MENU_KEYBOARDSETUP = 204,
|
2014-03-26 09:14:01 +00:00
|
|
|
MENU_MOUSESETUP = 205,
|
|
|
|
MENU_JOYSTICKSETUP = 206,
|
|
|
|
MENU_JOYSTICKBTNS = 207,
|
|
|
|
MENU_JOYSTICKAXES = 208,
|
2014-05-31 12:26:41 +00:00
|
|
|
MENU_KEYBOARDKEYS = 209,
|
|
|
|
MENU_MOUSEBTNS = 210,
|
2014-03-26 09:14:01 +00:00
|
|
|
MENU_MOUSEADVANCED = 212,
|
2014-05-31 12:26:41 +00:00
|
|
|
MENU_JOYSTICKAXIS = 213,
|
2015-02-11 05:22:32 +00:00
|
|
|
MENU_TOUCHSETUP = 214,
|
2016-03-14 00:06:54 +00:00
|
|
|
MENU_TOUCHSENS = 215,
|
|
|
|
MENU_TOUCHBUTTONS = 216,
|
2014-09-30 04:07:29 +00:00
|
|
|
MENU_CONTROLS = 220,
|
2015-10-24 00:30:35 +00:00
|
|
|
MENU_POLYMOST = 230,
|
2014-03-26 09:14:01 +00:00
|
|
|
MENU_COLCORR = 231,
|
|
|
|
MENU_COLCORR_INGAME = 232,
|
2014-09-30 04:07:29 +00:00
|
|
|
MENU_SCREENSETUP = 233,
|
|
|
|
MENU_DISPLAYSETUP = 234,
|
2015-10-24 00:30:35 +00:00
|
|
|
MENU_POLYMER = 240,
|
2012-10-14 22:16:07 +00:00
|
|
|
MENU_LOAD = 300,
|
2014-03-26 09:14:01 +00:00
|
|
|
MENU_SAVE = 350,
|
2012-10-14 22:16:07 +00:00
|
|
|
MENU_STORY = 400,
|
|
|
|
MENU_F1HELP = 401,
|
|
|
|
MENU_QUIT = 500,
|
|
|
|
MENU_QUITTOTITLE = 501,
|
2014-05-31 12:26:41 +00:00
|
|
|
MENU_QUIT_INGAME = 502,
|
2014-03-26 09:14:01 +00:00
|
|
|
MENU_NETSETUP = 600,
|
|
|
|
MENU_NETWAITMASTER = 601,
|
|
|
|
MENU_NETWAITVOTES = 603,
|
2012-10-14 22:16:07 +00:00
|
|
|
MENU_SOUND = 700,
|
|
|
|
MENU_SOUND_INGAME = 701,
|
2014-09-30 04:07:29 +00:00
|
|
|
MENU_ADVSOUND = 702,
|
2015-03-24 10:49:03 +00:00
|
|
|
MENU_CHEATS = 800,
|
|
|
|
MENU_CHEATENTRY = 801,
|
|
|
|
MENU_CHEAT_WARP = 802,
|
|
|
|
MENU_CHEAT_SKILL = 803,
|
2012-10-14 22:16:07 +00:00
|
|
|
MENU_CREDITS = 990,
|
|
|
|
MENU_CREDITS2 = 991,
|
|
|
|
MENU_CREDITS3 = 992,
|
|
|
|
MENU_CREDITS4 = 993,
|
|
|
|
MENU_CREDITS5 = 994,
|
2014-03-26 09:14:01 +00:00
|
|
|
MENU_LOADVERIFY = 1000,
|
|
|
|
MENU_NEWVERIFY = 1500,
|
|
|
|
MENU_SAVEVERIFY = 2000,
|
2012-10-14 22:16:07 +00:00
|
|
|
MENU_ADULTPASSWORD = 10001,
|
2014-03-26 09:14:01 +00:00
|
|
|
MENU_RESETPLAYER = 15000,
|
2012-10-14 22:16:07 +00:00
|
|
|
MENU_BUYDUKE = 20000,
|
2014-03-26 09:14:01 +00:00
|
|
|
MENU_NETWORK = 20001,
|
|
|
|
MENU_PLAYER = 20002,
|
|
|
|
MENU_MACROS = 20004,
|
|
|
|
MENU_NETHOST = 20010,
|
|
|
|
MENU_NETOPTIONS = 20011,
|
2014-05-31 12:26:41 +00:00
|
|
|
MENU_NETUSERMAP = 20012,
|
2014-03-26 09:14:01 +00:00
|
|
|
MENU_NETJOIN = 20020,
|
2012-10-14 22:16:07 +00:00
|
|
|
};
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef int32_t MenuID_t;
|
|
|
|
|
|
|
|
|
2014-10-27 10:14:50 +00:00
|
|
|
typedef enum MenuAnimationType_t
|
|
|
|
{ // Note: This enum is for logical categories, not visual types.
|
|
|
|
MA_None,
|
|
|
|
MA_Return,
|
|
|
|
MA_Advance,
|
|
|
|
} MenuAnimationType_t;
|
|
|
|
|
2014-05-31 12:26:41 +00:00
|
|
|
// a subset of screentext parameters, restricted because menus require accessibility
|
2014-11-30 02:04:36 +00:00
|
|
|
typedef struct MenuFont_t
|
2014-05-31 12:26:41 +00:00
|
|
|
{
|
2018-01-29 02:14:16 +00:00
|
|
|
// int32_t xspace, yline;
|
2017-06-19 23:06:25 +00:00
|
|
|
vec2_t emptychar, between;
|
2017-06-19 23:06:29 +00:00
|
|
|
int32_t zoom;
|
2017-06-19 23:06:57 +00:00
|
|
|
int32_t cursorLeftPosition, cursorCenterPosition, cursorScale;
|
2014-05-31 12:26:41 +00:00
|
|
|
int32_t textflags;
|
2017-06-19 23:06:25 +00:00
|
|
|
int16_t tilenum;
|
2018-01-29 02:14:16 +00:00
|
|
|
// selected shade glows, deselected shade is used by Blood, disabled shade is used by SW
|
|
|
|
int8_t shade_deselected, shade_disabled;
|
|
|
|
uint8_t pal;
|
|
|
|
uint8_t pal_selected, pal_deselected, pal_disabled;
|
|
|
|
uint8_t pal_selected_right, pal_deselected_right, pal_disabled_right;
|
2017-06-19 23:06:29 +00:00
|
|
|
|
2017-06-24 09:20:37 +00:00
|
|
|
int32_t get_yline() const { return mulscale16(emptychar.y, zoom); }
|
2014-11-30 02:04:36 +00:00
|
|
|
} MenuFont_t;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum MenuEntryType_t
|
|
|
|
{
|
|
|
|
Dummy,
|
|
|
|
Link,
|
|
|
|
Option,
|
|
|
|
Custom2Col,
|
|
|
|
RangeInt32,
|
|
|
|
RangeFloat,
|
2017-07-29 20:39:57 +00:00
|
|
|
#ifdef MENU_ENABLE_RANGEDOUBLE
|
2014-05-31 12:26:41 +00:00
|
|
|
RangeDouble,
|
2017-07-29 20:39:57 +00:00
|
|
|
#endif
|
2014-05-31 12:26:41 +00:00
|
|
|
String,
|
2014-11-30 02:04:36 +00:00
|
|
|
Spacer,
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuEntryType_t;
|
|
|
|
|
2014-11-30 02:04:36 +00:00
|
|
|
typedef struct MenuEntryFormat_t
|
|
|
|
{
|
|
|
|
int32_t marginBottom;
|
|
|
|
int32_t indent;
|
|
|
|
int32_t width; // 0: center, >0: width of the label column (left-aligned options), <0: -width of everything (right-aligned)
|
|
|
|
} MenuEntryFormat_t;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
|
2014-11-30 02:04:36 +00:00
|
|
|
typedef struct MenuMenuFormat_t
|
2014-05-31 12:26:41 +00:00
|
|
|
{
|
|
|
|
vec2_t pos;
|
2014-10-25 10:16:49 +00:00
|
|
|
int32_t bottomcutoff; // >0: the bottom edge of the menu before automatic scrolling kicks in, <0: -total height for vertical justification
|
2014-11-30 02:04:36 +00:00
|
|
|
} MenuMenuFormat_t;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
typedef struct MenuLink_t
|
|
|
|
{
|
|
|
|
// traits
|
|
|
|
MenuID_t linkID;
|
2014-10-27 10:14:50 +00:00
|
|
|
MenuAnimationType_t animation;
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuLink_t;
|
|
|
|
typedef struct MenuOptionSet_t
|
|
|
|
{
|
|
|
|
// traits
|
2016-01-11 05:06:10 +00:00
|
|
|
char const **optionNames;
|
2014-05-31 12:26:41 +00:00
|
|
|
int32_t *optionValues; // If NULL, the identity of currentOption is assumed.
|
2014-11-30 02:04:36 +00:00
|
|
|
|
|
|
|
// pop-up list appearance
|
|
|
|
MenuMenuFormat_t *menuFormat;
|
|
|
|
MenuEntryFormat_t *entryFormat;
|
|
|
|
MenuFont_t *font;
|
|
|
|
|
|
|
|
// traits
|
2014-05-31 12:26:41 +00:00
|
|
|
int32_t numOptions;
|
|
|
|
|
2014-11-30 02:04:36 +00:00
|
|
|
// pop-up list state
|
2014-05-31 12:26:41 +00:00
|
|
|
int32_t currentEntry;
|
|
|
|
int32_t scrollPos;
|
2014-11-30 02:04:36 +00:00
|
|
|
|
|
|
|
// appearance
|
|
|
|
uint8_t features; // bit 1 = disable left/right arrows, bit 2 = disable list
|
2017-06-19 23:06:33 +00:00
|
|
|
|
2017-06-24 09:20:37 +00:00
|
|
|
int32_t getMarginBottom() const { return mulscale16(entryFormat->marginBottom, font->zoom); }
|
|
|
|
int32_t getIndent() const { return mulscale16(entryFormat->indent, font->zoom); }
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuOptionSet_t;
|
|
|
|
typedef struct MenuOption_t
|
|
|
|
{
|
|
|
|
// appearance
|
2014-11-30 02:04:36 +00:00
|
|
|
MenuFont_t *font;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
// traits
|
|
|
|
MenuOptionSet_t *options; // so that common sets such as Yes/No, On/Off can be reused
|
|
|
|
|
|
|
|
// effect
|
|
|
|
int32_t *data;
|
|
|
|
|
|
|
|
// state
|
|
|
|
int32_t currentOption;
|
|
|
|
} MenuOption_t;
|
|
|
|
typedef struct MenuCustom2Col_t
|
|
|
|
{
|
2014-11-30 02:04:36 +00:00
|
|
|
// effect
|
|
|
|
uint8_t *column[2];
|
2016-01-11 05:06:10 +00:00
|
|
|
char const **key;
|
2014-11-30 02:04:36 +00:00
|
|
|
|
2014-05-31 12:26:41 +00:00
|
|
|
// appearance
|
2014-11-30 02:04:36 +00:00
|
|
|
MenuFont_t *font;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
2014-11-30 02:04:36 +00:00
|
|
|
// effect
|
2014-05-31 12:26:41 +00:00
|
|
|
size_t numvalid;
|
|
|
|
|
2014-11-30 02:04:36 +00:00
|
|
|
// appearance
|
|
|
|
int32_t columnWidth;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
// state
|
|
|
|
int8_t screenOpen;
|
|
|
|
} MenuCustom2Col_t;
|
2014-12-28 21:35:20 +00:00
|
|
|
|
|
|
|
enum MenuRangeFlags_t
|
|
|
|
{
|
|
|
|
DisplayTypeInteger = 1,
|
|
|
|
DisplayTypePercent = 2,
|
|
|
|
DisplayTypeNormalizedDecimal = 3,
|
|
|
|
DisplayTypeMask = (1<<0)|(1<<1),
|
|
|
|
|
|
|
|
EnforceIntervals = 1<<7,
|
|
|
|
};
|
2014-05-31 12:26:41 +00:00
|
|
|
typedef struct MenuRangeInt32_t
|
|
|
|
{
|
2014-11-30 02:04:36 +00:00
|
|
|
// effect
|
|
|
|
int32_t *variable;
|
|
|
|
|
2014-05-31 12:26:41 +00:00
|
|
|
// appearance
|
2014-11-30 02:04:36 +00:00
|
|
|
MenuFont_t *font;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
// traits
|
|
|
|
int32_t min;
|
|
|
|
int32_t max;
|
|
|
|
int32_t onehundredpercent; // 0 implies max
|
2014-11-30 02:04:36 +00:00
|
|
|
int32_t steps;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
2014-12-28 21:35:20 +00:00
|
|
|
uint8_t flags;
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuRangeInt32_t;
|
|
|
|
typedef struct MenuRangeFloat_t
|
|
|
|
{
|
2014-11-30 02:04:36 +00:00
|
|
|
// effect
|
|
|
|
float *variable;
|
|
|
|
|
2014-05-31 12:26:41 +00:00
|
|
|
// appearance
|
2014-11-30 02:04:36 +00:00
|
|
|
MenuFont_t *font;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
// traits
|
|
|
|
float min;
|
|
|
|
float max;
|
|
|
|
float onehundredpercent; // 0 implies 1.0
|
2014-11-30 02:04:36 +00:00
|
|
|
int32_t steps;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
2014-12-28 21:35:20 +00:00
|
|
|
uint8_t flags;
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuRangeFloat_t;
|
2017-07-29 20:39:57 +00:00
|
|
|
#ifdef MENU_ENABLE_RANGEDOUBLE
|
2014-05-31 12:26:41 +00:00
|
|
|
typedef struct MenuRangeDouble_t
|
|
|
|
{
|
2014-11-30 02:04:36 +00:00
|
|
|
// effect
|
|
|
|
double *variable;
|
|
|
|
|
2014-05-31 12:26:41 +00:00
|
|
|
// appearance
|
2014-11-30 02:04:36 +00:00
|
|
|
MenuFont_t *font;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
// traits
|
|
|
|
double min;
|
|
|
|
double max;
|
|
|
|
double onehundredpercent; // 0 implies 1.0
|
2014-11-30 02:04:36 +00:00
|
|
|
int32_t steps;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
2014-12-28 21:35:20 +00:00
|
|
|
uint8_t flags;
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuRangeDouble_t;
|
2017-07-29 20:39:57 +00:00
|
|
|
#endif
|
2014-05-31 12:26:41 +00:00
|
|
|
typedef struct MenuString_t
|
|
|
|
{
|
2014-11-30 02:04:36 +00:00
|
|
|
// state
|
|
|
|
char* editfield;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
// effect
|
|
|
|
char* variable;
|
|
|
|
|
2014-11-30 02:04:36 +00:00
|
|
|
// appearance
|
|
|
|
MenuFont_t *font;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
2014-11-30 02:04:36 +00:00
|
|
|
// effect
|
2017-12-01 06:19:12 +00:00
|
|
|
int32_t bufsize;
|
2014-11-30 02:04:36 +00:00
|
|
|
int32_t flags;
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuString_t;
|
2014-11-30 02:04:36 +00:00
|
|
|
typedef struct MenuSpacer_t
|
|
|
|
{
|
|
|
|
int32_t height;
|
|
|
|
} MenuSpacer_t;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
2014-12-27 18:37:12 +00:00
|
|
|
// For internal use only.
|
|
|
|
enum MenuEntryFlags_t
|
|
|
|
{
|
2017-06-19 23:07:01 +00:00
|
|
|
MEF_Disabled = 1<<0,
|
2017-06-19 23:07:05 +00:00
|
|
|
MEF_LookDisabled = 1<<1,
|
2018-02-20 11:55:07 +00:00
|
|
|
MEF_Hidden = 1<<2,
|
2014-12-27 18:37:12 +00:00
|
|
|
};
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
typedef struct MenuEntry_t
|
|
|
|
{
|
|
|
|
// traits
|
|
|
|
const char *name;
|
|
|
|
|
2014-11-30 02:04:36 +00:00
|
|
|
// appearance
|
|
|
|
MenuFont_t *font;
|
|
|
|
MenuEntryFormat_t *format;
|
|
|
|
|
2014-05-31 12:26:41 +00:00
|
|
|
void *entry;
|
2014-11-30 02:04:36 +00:00
|
|
|
MenuEntryType_t type;
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
// state
|
2014-12-27 18:37:12 +00:00
|
|
|
int32_t flags;
|
2014-05-31 12:26:41 +00:00
|
|
|
int32_t ytop, ybottom;
|
2017-06-19 23:06:33 +00:00
|
|
|
|
2017-06-24 09:20:37 +00:00
|
|
|
int32_t getMarginBottom() const { return mulscale16(format->marginBottom, font->zoom); }
|
|
|
|
int32_t getIndent() const { return mulscale16(format->indent, font->zoom); }
|
2017-06-19 23:06:45 +00:00
|
|
|
int32_t getHeight() const
|
2017-06-19 23:06:41 +00:00
|
|
|
{
|
2017-06-24 09:20:37 +00:00
|
|
|
return type == Spacer ? mulscale16(((MenuSpacer_t *)entry)->height, font->zoom) : font->get_yline();
|
2017-06-19 23:06:41 +00:00
|
|
|
}
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuEntry_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum MenuType_t
|
|
|
|
{
|
|
|
|
Menu,
|
|
|
|
Panel,
|
|
|
|
Verify,
|
|
|
|
Message,
|
2015-03-24 10:48:34 +00:00
|
|
|
TextForm,
|
2014-05-31 12:26:41 +00:00
|
|
|
FileSelect,
|
|
|
|
} MenuType_t;
|
|
|
|
|
|
|
|
typedef struct MenuMenu_t
|
|
|
|
{
|
|
|
|
const char *title;
|
|
|
|
|
2014-11-30 02:04:36 +00:00
|
|
|
MenuMenuFormat_t *format;
|
|
|
|
|
|
|
|
MenuEntry_t **entrylist;
|
|
|
|
int32_t numEntries;
|
|
|
|
|
2014-05-31 12:26:41 +00:00
|
|
|
// state
|
2014-11-30 02:04:36 +00:00
|
|
|
int32_t currentEntry, currentColumn;
|
2016-04-06 03:07:47 +00:00
|
|
|
int32_t scrollPos;
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuMenu_t;
|
|
|
|
typedef struct MenuPanel_t
|
|
|
|
{
|
|
|
|
const char *title;
|
|
|
|
|
|
|
|
MenuID_t previousID;
|
2014-10-27 10:14:50 +00:00
|
|
|
MenuAnimationType_t previousAnimation;
|
2014-05-31 12:26:41 +00:00
|
|
|
MenuID_t nextID;
|
2014-10-27 10:14:50 +00:00
|
|
|
MenuAnimationType_t nextAnimation;
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuPanel_t;
|
|
|
|
typedef struct MenuVerify_t
|
|
|
|
{
|
|
|
|
vec2_t cursorpos;
|
|
|
|
|
|
|
|
MenuID_t linkID;
|
2014-10-27 10:14:50 +00:00
|
|
|
MenuAnimationType_t animation;
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuVerify_t;
|
|
|
|
typedef struct MenuMessage_t
|
|
|
|
{
|
|
|
|
vec2_t cursorpos;
|
|
|
|
|
|
|
|
MenuID_t linkID;
|
2014-10-27 10:14:50 +00:00
|
|
|
MenuAnimationType_t animation;
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuMessage_t;
|
2015-03-24 10:48:34 +00:00
|
|
|
enum MenuTextFormFlags_t
|
|
|
|
{
|
|
|
|
MTF_Password = 1<<0,
|
|
|
|
};
|
|
|
|
typedef struct MenuTextForm_t
|
2014-05-31 12:26:41 +00:00
|
|
|
{
|
|
|
|
// state
|
|
|
|
char *input;
|
2014-11-30 02:04:36 +00:00
|
|
|
|
|
|
|
// traits
|
2015-03-24 10:48:34 +00:00
|
|
|
const char *instructions;
|
2017-12-01 06:19:12 +00:00
|
|
|
int32_t bufsize;
|
2015-03-24 10:48:34 +00:00
|
|
|
uint8_t flags;
|
|
|
|
} MenuTextForm_t;
|
2014-05-31 12:26:41 +00:00
|
|
|
typedef struct MenuFileSelect_t
|
|
|
|
{
|
|
|
|
const char *title;
|
|
|
|
|
|
|
|
// appearance
|
2014-12-27 18:35:48 +00:00
|
|
|
MenuMenuFormat_t *format[2];
|
2014-11-30 02:04:36 +00:00
|
|
|
MenuFont_t *font[2];
|
2014-05-31 12:26:41 +00:00
|
|
|
|
|
|
|
// traits
|
|
|
|
const char *pattern;
|
|
|
|
char *destination;
|
|
|
|
|
|
|
|
// state
|
2014-06-13 09:04:31 +00:00
|
|
|
CACHE1D_FIND_REC *findhigh[2];
|
2014-11-30 02:04:36 +00:00
|
|
|
int32_t scrollPos[2];
|
2014-12-27 18:35:48 +00:00
|
|
|
|
|
|
|
// appearance
|
|
|
|
int32_t marginBottom[2];
|
|
|
|
|
|
|
|
// state
|
2014-11-30 02:04:36 +00:00
|
|
|
fnlist_t fnlist;
|
|
|
|
int32_t currentList;
|
2017-06-19 23:06:33 +00:00
|
|
|
|
2017-06-24 09:20:37 +00:00
|
|
|
int32_t getMarginBottom(size_t index) const { return mulscale16(marginBottom[index], font[index]->zoom); }
|
2014-05-31 12:26:41 +00:00
|
|
|
} MenuFileSelect_t;
|
|
|
|
|
|
|
|
typedef struct Menu_t
|
|
|
|
{
|
2014-11-30 02:04:36 +00:00
|
|
|
void *object;
|
2014-05-31 12:26:41 +00:00
|
|
|
MenuID_t menuID;
|
|
|
|
MenuID_t parentID;
|
2014-10-27 10:14:50 +00:00
|
|
|
MenuAnimationType_t parentAnimation;
|
2014-05-31 12:26:41 +00:00
|
|
|
MenuType_t type;
|
|
|
|
} Menu_t;
|
|
|
|
|
2016-03-14 00:07:40 +00:00
|
|
|
typedef struct MenuAnimation_t
|
|
|
|
{
|
|
|
|
int32_t(*out)(struct MenuAnimation_t *);
|
|
|
|
int32_t(*in)(struct MenuAnimation_t *);
|
|
|
|
|
|
|
|
Menu_t *previous;
|
|
|
|
Menu_t *current;
|
|
|
|
|
|
|
|
int32_t start;
|
|
|
|
int32_t length;
|
|
|
|
} MenuAnimation_t;
|
|
|
|
|
|
|
|
extern MenuAnimation_t m_animation;
|
2014-10-27 10:14:50 +00:00
|
|
|
|
2014-05-31 12:26:41 +00:00
|
|
|
extern MenuID_t g_currentMenu;
|
|
|
|
extern Menu_t *m_currentMenu;
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
extern int32_t g_quitDeadline;
|
|
|
|
extern int32_t voting;
|
2016-11-01 01:35:32 +00:00
|
|
|
int Menu_Change(int32_t cm);
|
|
|
|
void Menu_AnimateChange(int32_t cm, MenuAnimationType_t animtype);
|
|
|
|
int32_t Menu_IsTextInput(Menu_t *cm);
|
2010-08-02 08:13:51 +00:00
|
|
|
void G_CheckPlayerColor(int32_t *color,int32_t prev_color);
|
2016-11-01 01:35:32 +00:00
|
|
|
void Menu_Init(void);
|
|
|
|
void Menu_Open(size_t playerID);
|
|
|
|
void Menu_Close(size_t playerID);
|
2010-08-02 08:13:51 +00:00
|
|
|
void M_DisplayMenus(void);
|
2011-12-25 15:34:06 +00:00
|
|
|
|
2018-01-29 02:14:16 +00:00
|
|
|
extern MenuFont_t MF_Redfont, MF_Bluefont, MF_Minifont;
|
2017-06-19 23:07:23 +00:00
|
|
|
|
2015-01-15 06:45:14 +00:00
|
|
|
#define M_MOUSETIMEOUT 210
|
2014-12-27 18:36:58 +00:00
|
|
|
extern int32_t m_mouselastactivity;
|
|
|
|
|
|
|
|
#if defined EDUKE32_TOUCH_DEVICES
|
2015-04-28 21:30:42 +00:00
|
|
|
# define MOUSEALPHA 0
|
2014-12-27 18:36:58 +00:00
|
|
|
# define MOUSEACTIVECONDITIONAL(condition) (condition)
|
2014-12-27 18:37:27 +00:00
|
|
|
# define MOUSEWATCHPOINTCONDITIONAL(condition) (condition)
|
2014-12-27 18:36:58 +00:00
|
|
|
#else
|
2014-12-27 18:37:27 +00:00
|
|
|
extern int32_t m_mousewake_watchpoint, m_menuchange_watchpoint;
|
2015-04-09 07:51:48 +00:00
|
|
|
// alpha increments of 3 --> 255 / 3 = 85 --> round up to power of 2 --> 128 --> divide by 2 --> 64 alphatabs required
|
2016-10-20 06:26:04 +00:00
|
|
|
// use 16 anyway :P
|
|
|
|
# define MOUSEALPHA ((getrendermode() == REND_CLASSIC && numalphatabs < 15) ? 0 : clamp((totalclock - m_mouselastactivity - 90)*3, 0, 255))
|
2014-12-27 18:36:58 +00:00
|
|
|
# define MOUSEACTIVECONDITION (totalclock - m_mouselastactivity < M_MOUSETIMEOUT)
|
|
|
|
# define MOUSEACTIVECONDITIONAL(condition) (MOUSEACTIVECONDITION && (condition))
|
|
|
|
# define MOUSEINACTIVECONDITIONAL(condition) (!MOUSEACTIVECONDITION && (condition))
|
2014-12-27 18:37:27 +00:00
|
|
|
# define MOUSEWATCHPOINTCONDITIONAL(condition) ((condition) || m_mousewake_watchpoint || m_menuchange_watchpoint == 3)
|
2014-12-27 18:36:58 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#endif
|