2006-04-13 20:47:06 +00:00
//-------------------------------------------------------------------------
/*
2016-02-07 02:38:03 +00:00
Copyright ( C ) 2016 EDuke32 developers and contributors
2006-04-13 20:47:06 +00:00
2010-05-25 10:56:00 +00:00
This file is part of EDuke32 .
2006-04-13 20:47:06 +00:00
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 .
2006-04-13 20:47:06 +00:00
*/
//-------------------------------------------------------------------------
2019-09-21 18:59:54 +00:00
# include "ns.h" // Must come before everything else!
2018-11-18 18:09:48 +00:00
# include "cheats.h"
2017-02-25 08:15:36 +00:00
# include "compat.h"
2018-11-18 18:09:48 +00:00
# include "demo.h"
2006-04-13 20:47:06 +00:00
# include "duke3d.h"
2018-11-18 18:09:48 +00:00
# include "input.h"
# include "menus.h"
2008-07-27 21:33:28 +00:00
# include "osdcmds.h"
2010-08-02 08:13:51 +00:00
# include "savegame.h"
2019-11-02 21:52:13 +00:00
# include "superfasthash.h"
2019-10-21 21:29:48 +00:00
# include "gamecvars.h"
2019-10-25 22:32:49 +00:00
# include "gamecontrol.h"
2019-11-03 19:58:10 +00:00
# include "c_bind.h"
2019-10-04 19:13:04 +00:00
# include "../../glbackend/glbackend.h"
2010-09-14 18:19:38 +00:00
2019-11-09 18:15:03 +00:00
bool ShowOptionMenu ( ) ;
namespace ImGui
{
void ShowDemoWindow ( bool * ) ;
}
2019-09-21 20:53:00 +00:00
BEGIN_DUKE_NS
2014-10-27 07:09:41 +00:00
// common positions
# define MENU_MARGIN_REGULAR 40
# define MENU_MARGIN_WIDE 32
# define MENU_MARGIN_CENTER 160
# define MENU_HEIGHT_CENTER 100
2008-07-30 02:51:32 +00:00
# define USERMAPENTRYLENGTH 25
2018-02-16 08:33:32 +00:00
static FORCE_INLINE void Menu_StartTextInput ( )
2015-08-09 09:58:46 +00:00
{
2019-11-03 23:53:55 +00:00
inputState . keyFlushChars ( ) ;
inputState . ClearKeysDown ( ) ;
2015-08-09 09:58:46 +00:00
}
2018-02-16 08:33:32 +00:00
static FORCE_INLINE void Menu_StopTextInput ( )
2015-08-09 09:58:46 +00:00
{
}
2019-09-22 21:15:46 +00:00
static FORCE_INLINE void rotatesprite_ybounds ( int32_t sx , int32_t sy , int32_t z , int16_t a , int16_t picnum , int8_t dashade , uint8_t dapalnum , int32_t dastat , int32_t ydim_upper , int32_t ydim_lower )
2017-10-09 07:36:45 +00:00
{
rotatesprite_ ( sx , sy , z , a , picnum , dashade , dapalnum , dastat , 0 , 0 , 0 , ydim_upper , xdim - 1 , ydim_lower ) ;
}
2017-06-20 09:28:54 +00:00
static void mgametext ( int32_t x , int32_t y , char const * t )
{
G_ScreenText ( MF_Bluefont . tilenum , x , y , MF_Bluefont . zoom , 0 , 0 , t , 0 , MF_Bluefont . pal , 2 | 8 | 16 | ROTATESPRITE_FULL16 , 0 , MF_Bluefont . emptychar . x , MF_Bluefont . emptychar . y , MF_Bluefont . between . x , MF_Bluefont . between . y , MF_Bluefont . textflags , 0 , 0 , xdim - 1 , ydim - 1 ) ;
}
2018-01-29 02:14:16 +00:00
2019-08-07 22:36:16 +00:00
static vec2_t mgametextcenterat ( int32_t x , int32_t y , char const * t , int32_t f = 0 )
{
return G_ScreenText ( MF_Bluefont . tilenum , x , y , MF_Bluefont . zoom , 0 , 0 , t , 0 , MF_Bluefont . pal , 2 | 8 | 16 | ROTATESPRITE_FULL16 , 0 , MF_Bluefont . emptychar . x , MF_Bluefont . emptychar . y , MF_Bluefont . between . x , MF_Bluefont . between . y , MF_Bluefont . textflags | f | TEXT_XCENTER , 0 , 0 , xdim - 1 , ydim - 1 ) ;
}
2017-06-20 09:28:54 +00:00
static vec2_t mgametextcenter ( int32_t x , int32_t y , char const * t , int32_t f = 0 )
{
2019-08-07 22:36:16 +00:00
return mgametextcenterat ( ( MENU_MARGIN_CENTER < < 16 ) + x , y , t , f ) ;
2017-06-20 09:28:54 +00:00
}
2015-11-25 12:08:31 +00:00
2014-10-27 07:09:41 +00:00
# define mminitext(x,y,t,p) minitext_(x, y, t, 0, p, 2|8|16|ROTATESPRITE_FULL16)
2017-06-19 23:07:18 +00:00
# define mmenutext menutext
2008-08-28 05:57:46 +00:00
2017-06-17 11:42:20 +00:00
# ifndef EDUKE32_STANDALONE
2014-10-27 07:09:41 +00:00
static void shadowminitext ( int32_t x , int32_t y , const char * t , int32_t p )
{
int32_t f = 0 ;
2014-05-31 12:26:41 +00:00
2014-10-27 07:09:41 +00:00
if ( ! minitext_lowercase )
f | = TEXT_UPPERCASE ;
2014-05-31 12:26:41 +00:00
2014-10-27 07:09:41 +00:00
G_ScreenTextShadow ( 1 , 1 , MINIFONT , x , y , 65536 , 0 , 0 , t , 0 , p , 2 | 8 | 16 | ROTATESPRITE_FULL16 , 0 , 4 < < 16 , 8 < < 16 , 1 < < 16 , 0 , f , 0 , 0 , xdim - 1 , ydim - 1 ) ;
}
2017-06-17 11:42:20 +00:00
# endif
2014-10-27 07:09:41 +00:00
static void creditsminitext ( int32_t x , int32_t y , const char * t , int32_t p )
{
int32_t f = TEXT_XCENTER ;
if ( ! minitext_lowercase )
f | = TEXT_UPPERCASE ;
G_ScreenTextShadow ( 1 , 1 , MINIFONT , x , y , 65536 , 0 , 0 , t , 0 , p , 2 | 8 | 16 | ROTATESPRITE_FULL16 , 0 , 4 < < 16 , 8 < < 16 , 1 < < 16 , 0 , f , 0 , 0 , xdim - 1 , ydim - 1 ) ;
}
2014-05-31 12:26:41 +00:00
# pragma pack(push,1)
static savehead_t savehead ;
# pragma pack(pop)
2012-10-14 22:16:07 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_DrawBackground ( const vec2_t origin )
2014-05-31 12:26:41 +00:00
{
2014-10-27 07:09:41 +00:00
rotatesprite_fs ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) , origin . y + ( 100 < < 16 ) , 65536L , 0 , MENUSCREEN , 16 , 0 , 10 + 64 ) ;
2014-05-31 12:26:41 +00:00
}
2012-10-29 04:29:45 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_DrawTopBar ( const vec2_t origin )
2014-05-31 12:26:41 +00:00
{
2017-12-12 05:13:49 +00:00
if ( ( G_GetLogoFlags ( ) & LOGO_NOTITLEBAR ) = = 0 )
rotatesprite_fs ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) , origin . y + ( 19 < < 16 ) , MF_Redfont . cursorScale , 0 , MENUBAR , 16 , 0 , 10 ) ;
2014-07-22 11:19:58 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_DrawTopBarCaption ( const char * caption , const vec2_t origin )
2014-07-22 11:19:58 +00:00
{
2018-01-29 02:14:16 +00:00
static char t [ 64 ] ;
size_t const srclen = strlen ( caption ) ;
size_t const dstlen = min ( srclen , ARRAY_SIZE ( t ) - 1 ) ;
memcpy ( t , caption , dstlen ) ;
t [ dstlen ] = ' \0 ' ;
char * p = & t [ dstlen - 1 ] ;
if ( * p = = ' : ' )
* p = ' \0 ' ;
2019-01-30 09:36:47 +00:00
captionmenutext ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) , origin . y + ( 24 < < 16 ) + ( ( 15 > > 1 ) < < 16 ) , t ) ;
2006-04-13 20:47:06 +00:00
}
2017-10-09 07:36:45 +00:00
static FORCE_INLINE int32_t Menu_CursorShade ( void )
{
2019-08-27 13:39:54 +00:00
return VM_OnEventWithReturn ( EVENT_MENUCURSORSHADE , - 1 , myconnectindex , 4 - ( sintable [ ( ( int32_t ) totalclock < < 4 ) & 2047 ] > > 11 ) ) ;
2017-10-09 07:36:45 +00:00
}
static void Menu_DrawCursorCommon ( int32_t x , int32_t y , int32_t z , int32_t picnum , int32_t ydim_upper = 0 , int32_t ydim_lower = ydim - 1 )
{
rotatesprite_ ( x , y , z , 0 , picnum , Menu_CursorShade ( ) , 0 , 2 | 8 , 0 , 0 , 0 , ydim_upper , xdim - 1 , ydim_lower ) ;
}
static void Menu_DrawCursorLeft ( int32_t x , int32_t y , int32_t z )
{
2019-07-19 01:49:29 +00:00
if ( FURY ) return ;
2019-08-27 13:39:54 +00:00
Menu_DrawCursorCommon ( x , y , z , VM_OnEventWithReturn ( EVENT_MENUCURSORLEFT , - 1 , myconnectindex , SPINNINGNUKEICON + ( ( ( int32_t ) totalclock > > 3 ) % 7 ) ) ) ;
2017-10-09 07:36:45 +00:00
}
static void Menu_DrawCursorRight ( int32_t x , int32_t y , int32_t z )
{
2019-07-19 01:49:29 +00:00
if ( FURY ) return ;
2019-08-27 13:39:54 +00:00
Menu_DrawCursorCommon ( x , y , z , VM_OnEventWithReturn ( EVENT_MENUCURSORRIGHT , - 1 , myconnectindex , SPINNINGNUKEICON + 6 - ( ( 6 + ( ( int32_t ) totalclock > > 3 ) ) % 7 ) ) ) ;
2017-10-09 07:36:45 +00:00
}
2019-06-25 11:28:09 +00:00
static void Menu_DrawCursorTextTile ( int32_t x , int32_t y , int32_t h , int32_t picnum , vec2_16_t const & siz , int32_t ydim_upper = 0 , int32_t ydim_lower = ydim - 1 )
2017-10-09 07:36:48 +00:00
{
2019-01-30 09:36:47 +00:00
vec2_t const adjsiz = { ( siz . x > > 1 ) < < 16 , siz . y < < 16 } ;
2017-10-09 07:36:48 +00:00
Menu_DrawCursorCommon ( x + scale ( adjsiz . x , h , adjsiz . y ) , y , divscale16 ( h , adjsiz . y ) , picnum , ydim_upper , ydim_lower ) ;
}
2017-10-09 07:36:45 +00:00
static void Menu_DrawCursorText ( int32_t x , int32_t y , int32_t h , int32_t ydim_upper = 0 , int32_t ydim_lower = ydim - 1 )
{
2019-06-25 11:28:09 +00:00
vec2_16_t const & siz = tilesiz [ SPINNINGNUKEICON ] ;
2017-10-09 07:36:48 +00:00
2019-07-19 01:49:29 +00:00
if ( FURY | | siz . x = = 0 )
2017-10-09 07:36:48 +00:00
{
Menu_DrawCursorTextTile ( x , y , h , SMALLFNTCURSOR , tilesiz [ SMALLFNTCURSOR ] , ydim_upper , ydim_lower ) ;
return ;
}
2019-08-27 13:39:54 +00:00
Menu_DrawCursorTextTile ( x , y , h , SPINNINGNUKEICON + ( ( ( int32_t ) totalclock > > 3 ) % 7 ) , siz , ydim_upper , ydim_lower ) ;
2017-10-09 07:36:45 +00:00
}
2012-02-04 14:30:54 +00:00
2018-10-25 23:31:54 +00:00
static uint16_t g_oldSaveCnt ;
2012-02-04 14:30:54 +00:00
2014-05-31 12:26:41 +00:00
/*
All MAKE_ * macros are generally for the purpose of keeping state initialization
separate from actual data . Alternatively , they can serve to factor out repetitive
stuff and keep the important bits from getting lost to our eyes .
2014-06-13 09:03:52 +00:00
2019-08-09 08:21:19 +00:00
They serve as a stand - in for C + + default value constructors , since this was written
when the codebase still used C89 .
2014-11-30 02:04:36 +00:00
Note that I prefer to include a space on the inside of the macro parentheses , since
they effectively stand in for curly braces as struct initializers .
2014-05-31 12:26:41 +00:00
*/
2012-02-04 14:30:54 +00:00
2019-08-09 08:21:19 +00:00
MenuGameplayStemEntry g_MenuGameplayEntries [ MAXMENUGAMEPLAYENTRIES ] ;
2014-05-31 12:26:41 +00:00
// common font types
// tilenums are set after namesdyn runs
2018-01-29 02:14:16 +00:00
// emptychar x,y between x,y zoom cursorLeft cursorCenter cursorScale textflags
// tilenum shade_deselected shade_disabled pal pal_selected pal_deselected pal_disabled
MenuFont_t MF_Redfont = { { 5 < < 16 , 15 < < 16 } , { 0 , 0 } , 65536 , 20 < < 16 , 110 < < 16 , 65536 , TEXT_BIGALPHANUM | TEXT_UPPERCASE ,
- 1 , 10 , 0 , 0 , 0 , 0 , 1 ,
0 , 0 , 1 } ;
MenuFont_t MF_Bluefont = { { 5 < < 16 , 7 < < 16 } , { 0 , 0 } , 65536 , 10 < < 16 , 110 < < 16 , 32768 , 0 ,
- 1 , 10 , 0 , 0 , 10 , 10 , 16 ,
0 , 0 , 16 } ;
MenuFont_t MF_Minifont = { { 4 < < 16 , 5 < < 16 } , { 1 < < 16 , 1 < < 16 } , 65536 , 10 < < 16 , 110 < < 16 , 32768 , 0 ,
- 1 , 10 , 0 , 0 , 2 , 2 , 0 ,
0 , 0 , 16 } ;
2014-11-30 02:04:36 +00:00
2015-12-23 04:05:35 +00:00
static MenuMenuFormat_t MMF_Top_Main = { { MENU_MARGIN_CENTER < < 16 , 55 < < 16 , } , - ( 170 < < 16 ) } ;
static MenuMenuFormat_t MMF_Top_Episode = { { MENU_MARGIN_CENTER < < 16 , 48 < < 16 , } , - ( 190 < < 16 ) } ;
2019-08-09 08:21:19 +00:00
static MenuMenuFormat_t MMF_Top_NewGameCustom = { { MENU_MARGIN_CENTER < < 16 , 48 < < 16 , } , - ( 190 < < 16 ) } ;
static MenuMenuFormat_t MMF_Top_NewGameCustomSub = { { MENU_MARGIN_CENTER < < 16 , 48 < < 16 , } , - ( 190 < < 16 ) } ;
2015-12-23 04:05:35 +00:00
static MenuMenuFormat_t MMF_Top_Skill = { { MENU_MARGIN_CENTER < < 16 , 58 < < 16 , } , - ( 190 < < 16 ) } ;
static MenuMenuFormat_t MMF_Top_Options = { { MENU_MARGIN_CENTER < < 16 , 38 < < 16 , } , - ( 190 < < 16 ) } ;
static MenuMenuFormat_t MMF_Top_Joystick_Network = { { MENU_MARGIN_CENTER < < 16 , 70 < < 16 , } , - ( 190 < < 16 ) } ;
static MenuMenuFormat_t MMF_BigOptions = { { MENU_MARGIN_WIDE < < 16 , 38 < < 16 , } , - ( 190 < < 16 ) } ;
static MenuMenuFormat_t MMF_SmallOptions = { { MENU_MARGIN_WIDE < < 16 , 37 < < 16 , } , 170 < < 16 } ;
static MenuMenuFormat_t MMF_Macros = { { 26 < < 16 , 40 < < 16 , } , 160 < < 16 } ;
static MenuMenuFormat_t MMF_SmallOptionsNarrow = { { MENU_MARGIN_REGULAR < < 16 , 38 < < 16 , } , - ( 190 < < 16 ) } ;
2018-02-20 11:55:24 +00:00
static MenuMenuFormat_t MMF_KeyboardSetupFuncs = { { 50 < < 16 , 34 < < 16 , } , 151 < < 16 } ;
2015-12-23 04:05:35 +00:00
static MenuMenuFormat_t MMF_MouseJoySetupBtns = { { 76 < < 16 , 34 < < 16 , } , 143 < < 16 } ;
static MenuMenuFormat_t MMF_FuncList = { { 100 < < 16 , 51 < < 16 , } , 152 < < 16 } ;
static MenuMenuFormat_t MMF_ColorCorrect = { { MENU_MARGIN_REGULAR < < 16 , 86 < < 16 , } , 190 < < 16 } ;
static MenuMenuFormat_t MMF_BigSliders = { { MENU_MARGIN_WIDE < < 16 , 37 < < 16 , } , 190 < < 16 } ;
2017-12-18 11:24:53 +00:00
static MenuMenuFormat_t MMF_LoadSave = { { 200 < < 16 , 49 < < 16 , } , 145 < < 16 } ;
2015-12-23 04:05:35 +00:00
static MenuMenuFormat_t MMF_NetSetup = { { 36 < < 16 , 38 < < 16 , } , 190 < < 16 } ;
static MenuMenuFormat_t MMF_FileSelectLeft = { { 40 < < 16 , 45 < < 16 , } , 162 < < 16 } ;
static MenuMenuFormat_t MMF_FileSelectRight = { { 164 < < 16 , 45 < < 16 , } , 162 < < 16 } ;
2014-11-30 02:04:36 +00:00
2017-06-19 23:06:57 +00:00
static MenuEntryFormat_t MEF_Null = { 0 , 0 , 0 } ;
static MenuEntryFormat_t MEF_MainMenu = { 4 < < 16 , 0 , 0 } ;
2017-06-27 01:50:55 +00:00
static MenuEntryFormat_t MEF_OptionsMenu = { 7 < < 16 , 0 , 0 } ;
2019-08-15 06:51:56 +00:00
static MenuEntryFormat_t MEF_LeftMenu = { 7 < < 16 , 0 , 120 < < 16 } ;
2017-06-19 23:06:57 +00:00
static MenuEntryFormat_t MEF_CenterMenu = { 7 < < 16 , 0 , 0 } ;
2018-02-13 00:13:06 +00:00
static MenuEntryFormat_t MEF_BigOptions_Apply = { 4 < < 16 , 16 < < 16 , - ( 260 < < 16 ) } ;
2017-06-19 23:06:57 +00:00
static MenuEntryFormat_t MEF_BigOptionsRt = { 4 < < 16 , 0 , - ( 260 < < 16 ) } ;
2019-08-13 09:15:49 +00:00
static MenuEntryFormat_t MEF_BigOptionsRtSections = { 3 < < 16 , 0 , - ( 260 < < 16 ) } ;
2017-01-18 22:21:40 +00:00
# if defined USE_OPENGL || !defined EDUKE32_ANDROID_MENU
2018-02-20 11:55:24 +00:00
static MenuEntryFormat_t MEF_SmallOptions = { 1 < < 16 , 0 , - ( 260 < < 16 ) } ;
2014-10-19 00:44:23 +00:00
# endif
2017-06-19 23:06:57 +00:00
static MenuEntryFormat_t MEF_BigCheats = { 3 < < 16 , 0 , - ( 260 < < 16 ) } ;
static MenuEntryFormat_t MEF_Cheats = { 2 < < 16 , 0 , - ( 260 < < 16 ) } ;
static MenuEntryFormat_t MEF_PlayerNarrow = { 1 < < 16 , 0 , 90 < < 16 } ;
static MenuEntryFormat_t MEF_Macros = { 2 < < 16 , - 1 , 268 < < 16 } ;
static MenuEntryFormat_t MEF_VideoSetup = { 4 < < 16 , 0 , 168 < < 16 } ;
2017-06-19 23:07:12 +00:00
static MenuEntryFormat_t MEF_VideoSetup_Apply = { 4 < < 16 , 16 < < 16 , 168 < < 16 } ;
2018-02-20 11:55:24 +00:00
static MenuEntryFormat_t MEF_KBFuncList = { 3 < < 16 , 0 , - ( 225 < < 16 ) } ;
static MenuEntryFormat_t MEF_FuncList = { 3 < < 16 , 0 , - ( 170 < < 16 ) } ;
2017-06-19 23:06:57 +00:00
static MenuEntryFormat_t MEF_ColorCorrect = { 2 < < 16 , 0 , - ( 240 < < 16 ) } ;
2018-02-20 11:55:24 +00:00
static MenuEntryFormat_t MEF_BigSliders = { 2 < < 16 , 0 , - ( 260 < < 16 ) } ;
2017-12-18 11:24:53 +00:00
static MenuEntryFormat_t MEF_LoadSave = { 2 < < 16 , - 1 , 78 < < 16 } ;
2017-06-19 23:06:57 +00:00
static MenuEntryFormat_t MEF_NetSetup = { 4 < < 16 , 0 , 112 < < 16 } ;
2017-06-19 23:07:12 +00:00
static MenuEntryFormat_t MEF_NetSetup_Confirm = { 4 < < 16 , 16 < < 16 , 112 < < 16 } ;
2014-05-31 12:26:41 +00:00
// common menu option sets
2014-11-30 02:04:36 +00:00
# define MAKE_MENUOPTIONSET(optionNames, optionValues, features) { optionNames, optionValues, &MMF_FuncList, &MEF_FuncList, &MF_Minifont, ARRAY_SIZE(optionNames), -1, 0, features }
# define MAKE_MENUOPTIONSETDYN(optionNames, optionValues, numOptions, features) { optionNames, optionValues, &MMF_FuncList, &MEF_FuncList, &MF_Minifont, numOptions, -1, 0, features }
2015-02-22 22:15:35 +00:00
# define MAKE_MENUOPTIONSETNULL { NULL, NULL, &MMF_FuncList, &MEF_FuncList, &MF_Minifont, 0, -1, 0, 0 }
2014-05-31 12:26:41 +00:00
2016-01-11 05:06:10 +00:00
static char const * MEOSN_OffOn [ ] = { " Off " , " On " , } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_OffOn = MAKE_MENUOPTIONSET ( MEOSN_OffOn , NULL , 0x3 ) ;
2016-01-11 05:06:10 +00:00
static char const * MEOSN_OnOff [ ] = { " On " , " Off " , } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_OnOff = MAKE_MENUOPTIONSET ( MEOSN_OnOff , NULL , 0x3 ) ;
2016-01-11 05:06:10 +00:00
static char const * MEOSN_NoYes [ ] = { " No " , " Yes " , } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_NoYes = MAKE_MENUOPTIONSET ( MEOSN_NoYes , NULL , 0x3 ) ;
2016-01-11 05:06:10 +00:00
static char const * MEOSN_YesNo [ ] = { " Yes " , " No " , } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_YesNo = MAKE_MENUOPTIONSET ( MEOSN_YesNo , NULL , 0x3 ) ;
2014-05-31 12:26:41 +00:00
2019-10-25 22:32:49 +00:00
static FString MenuGameFuncs [ NUMGAMEFUNCTIONS ] ;
2016-01-11 05:06:10 +00:00
static char const * MenuGameFuncNone = " -None- " ;
static char const * MEOSN_Gamefuncs [ NUMGAMEFUNCTIONS + 1 ] ;
2017-06-17 11:41:59 +00:00
static int32_t MEOSV_Gamefuncs [ NUMGAMEFUNCTIONS + 1 ] ;
static MenuOptionSet_t MEOS_Gamefuncs = MAKE_MENUOPTIONSET ( MEOSN_Gamefuncs , MEOSV_Gamefuncs , 0x1 ) ;
2012-02-04 14:30:54 +00:00
2014-05-31 12:26:41 +00:00
/*
2014-11-30 02:04:36 +00:00
MenuEntry_t is passed in arrays of pointers so that the callback function
2014-05-31 12:26:41 +00:00
that is called when an entry is modified or activated can test equality of the current
2014-11-30 02:04:36 +00:00
entry pointer directly against the known ones , instead of relying on an ID number .
2006-04-13 20:47:06 +00:00
2014-11-30 02:04:36 +00:00
That way , individual menu entries can be ifdef ' d out painlessly .
2014-05-31 12:26:41 +00:00
*/
2012-02-04 14:30:54 +00:00
2014-10-27 10:14:50 +00:00
static MenuLink_t MEO_NULL = { MENU_NULL , MA_None , } ;
2014-05-31 12:26:41 +00:00
static const char * MenuCustom = " Custom " ;
2014-11-30 02:04:36 +00:00
# define MAKE_MENUSTRING(...) { NULL, __VA_ARGS__, }
2014-05-31 12:26:41 +00:00
# define MAKE_MENUOPTION(...) { __VA_ARGS__, -1, }
# define MAKE_MENURANGE(...) { __VA_ARGS__, }
# define MAKE_MENUENTRY(...) { __VA_ARGS__, 0, 0, 0, }
2014-11-30 02:04:36 +00:00
# define MAKE_SPACER( EntryName, Height ) \
2017-06-19 23:06:37 +00:00
static MenuSpacer_t MEO_ # # EntryName = { Height } ;
2014-11-30 02:04:36 +00:00
MAKE_SPACER ( Space2 , 2 < < 16 ) ; // bigoptions
MAKE_SPACER ( Space4 , 4 < < 16 ) ; // usermap, smalloptions, anything else non-top
MAKE_SPACER ( Space6 , 6 < < 16 ) ; // videosetup
MAKE_SPACER ( Space8 , 8 < < 16 ) ; // colcorr, redslide
2017-06-19 23:06:37 +00:00
static MenuEntry_t ME_Space2_Redfont = MAKE_MENUENTRY ( NULL , & MF_Redfont , & MEF_Null , & MEO_Space2 , Spacer ) ;
static MenuEntry_t ME_Space4_Bluefont = MAKE_MENUENTRY ( NULL , & MF_Bluefont , & MEF_Null , & MEO_Space4 , Spacer ) ;
2017-08-04 23:06:37 +00:00
static MenuEntry_t ME_Space4_Redfont = MAKE_MENUENTRY ( NULL , & MF_Redfont , & MEF_Null , & MEO_Space4 , Spacer ) ;
2019-09-21 11:02:17 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2017-06-19 23:06:37 +00:00
static MenuEntry_t ME_Space8_Bluefont = MAKE_MENUENTRY ( NULL , & MF_Bluefont , & MEF_Null , & MEO_Space8 , Spacer ) ;
# endif
2017-08-04 23:06:37 +00:00
static MenuEntry_t ME_Space6_Redfont = MAKE_MENUENTRY ( NULL , & MF_Redfont , & MEF_Null , & MEO_Space6 , Spacer ) ;
2017-06-19 23:06:37 +00:00
static MenuEntry_t ME_Space8_Redfont = MAKE_MENUENTRY ( NULL , & MF_Redfont , & MEF_Null , & MEO_Space8 , Spacer ) ;
2014-11-30 02:04:36 +00:00
# define MAKE_MENU_TOP_ENTRYLINK( Title, Format, EntryName, LinkID ) \
2014-10-27 10:14:50 +00:00
static MenuLink_t MEO_ # # EntryName = { LinkID , MA_Advance , } ; \
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_ # # EntryName = MAKE_MENUENTRY ( Title , & MF_Redfont , & Format , & MEO_ # # EntryName , Link )
2014-05-31 12:26:41 +00:00
2017-07-06 14:43:07 +00:00
static char const s_NewGame [ ] = " New Game " ;
static char const s_SaveGame [ ] = " Save Game " ;
static char const s_LoadGame [ ] = " Load Game " ;
static char const s_Continue [ ] = " Continue " ;
static char const s_Options [ ] = " Options " ;
static char const s_Credits [ ] = " Credits " ;
2014-05-31 12:26:41 +00:00
2017-07-06 14:43:07 +00:00
MAKE_MENU_TOP_ENTRYLINK ( s_NewGame , MEF_MainMenu , MAIN_NEWGAME , MENU_EPISODE ) ;
2017-01-18 22:21:40 +00:00
# ifdef EDUKE32_SIMPLE_MENU
2015-02-11 05:22:59 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Resume Game " , MEF_MainMenu , MAIN_RESUMEGAME , MENU_CLOSE ) ;
# endif
2017-07-06 14:43:07 +00:00
MAKE_MENU_TOP_ENTRYLINK ( s_NewGame , MEF_MainMenu , MAIN_NEWGAME_INGAME , MENU_NEWVERIFY ) ;
2014-10-27 10:14:50 +00:00
static MenuLink_t MEO_MAIN_NEWGAME_NETWORK = { MENU_NETWORK , MA_Advance , } ;
2017-07-06 14:43:07 +00:00
MAKE_MENU_TOP_ENTRYLINK ( s_SaveGame , MEF_MainMenu , MAIN_SAVEGAME , MENU_SAVE ) ;
MAKE_MENU_TOP_ENTRYLINK ( s_LoadGame , MEF_MainMenu , MAIN_LOADGAME , MENU_LOAD ) ;
MAKE_MENU_TOP_ENTRYLINK ( s_Options , MEF_MainMenu , MAIN_OPTIONS , MENU_OPTIONS ) ;
2018-03-08 05:15:11 +00:00
# ifdef EDUKE32_STANDALONE
MAKE_MENU_TOP_ENTRYLINK ( " Read me! " , MEF_MainMenu , MAIN_HELP , MENU_STORY ) ;
# else
MAKE_MENU_TOP_ENTRYLINK ( " Help " , MEF_MainMenu , MAIN_HELP , MENU_STORY ) ;
# endif
2017-10-09 07:36:55 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2017-07-06 14:43:07 +00:00
MAKE_MENU_TOP_ENTRYLINK ( s_Credits , MEF_MainMenu , MAIN_CREDITS , MENU_CREDITS ) ;
2016-03-28 05:15:27 +00:00
# endif
2016-03-14 00:07:40 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " End Game " , MEF_MainMenu , MAIN_QUITTOTITLE , MENU_QUITTOTITLE ) ;
2014-11-30 02:04:36 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Quit " , MEF_MainMenu , MAIN_QUIT , MENU_QUIT ) ;
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-11-30 02:04:36 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Quit Game " , MEF_MainMenu , MAIN_QUITGAME , MENU_QUIT ) ;
2015-12-04 11:52:47 +00:00
# endif
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_MAIN [ ] = {
& ME_MAIN_NEWGAME ,
& ME_MAIN_LOADGAME ,
2015-03-24 00:40:08 +00:00
& ME_MAIN_OPTIONS ,
2014-05-31 12:26:41 +00:00
& ME_MAIN_HELP ,
2017-10-09 07:36:55 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-05-31 12:26:41 +00:00
& ME_MAIN_CREDITS ,
2016-03-14 00:07:40 +00:00
# endif
2014-05-31 12:26:41 +00:00
& ME_MAIN_QUIT ,
} ;
2014-09-30 04:07:29 +00:00
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_MAIN_INGAME [ ] = {
2017-01-18 22:21:40 +00:00
# ifdef EDUKE32_SIMPLE_MENU
2015-02-11 05:22:59 +00:00
& ME_MAIN_RESUMEGAME ,
# else
2014-05-31 12:26:41 +00:00
& ME_MAIN_NEWGAME_INGAME ,
2015-02-11 05:22:59 +00:00
# endif
2014-05-31 12:26:41 +00:00
& ME_MAIN_SAVEGAME ,
& ME_MAIN_LOADGAME ,
& ME_MAIN_OPTIONS ,
& ME_MAIN_HELP ,
& ME_MAIN_QUITTOTITLE ,
2017-10-09 07:36:55 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-05-31 12:26:41 +00:00
& ME_MAIN_QUITGAME ,
2015-02-11 05:22:59 +00:00
# endif
2014-05-31 12:26:41 +00:00
} ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
// Episode and Skill will be dynamically generated after CONs are parsed
2014-10-27 10:14:50 +00:00
static MenuLink_t MEO_EPISODE = { MENU_SKILL , MA_Advance , } ;
static MenuLink_t MEO_EPISODE_SHAREWARE = { MENU_BUYDUKE , MA_Advance , } ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_EPISODE_TEMPLATE = MAKE_MENUENTRY ( NULL , & MF_Redfont , & MEF_CenterMenu , & MEO_EPISODE , Link ) ;
2014-05-31 12:26:41 +00:00
static MenuEntry_t ME_EPISODE [ MAXVOLUMES ] ;
2014-10-27 10:14:50 +00:00
static MenuLink_t MEO_EPISODE_USERMAP = { MENU_USERMAP , MA_Advance , } ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_EPISODE_USERMAP = MAKE_MENUENTRY ( " User Map " , & MF_Redfont , & MEF_CenterMenu , & MEO_EPISODE_USERMAP , Link ) ;
static MenuEntry_t * MEL_EPISODE [ MAXVOLUMES + 2 ] ; // +2 for spacer and User Map
2006-04-13 20:47:06 +00:00
2019-08-09 08:21:19 +00:00
static MenuLink_t MEO_NEWGAMECUSTOM_TEMPLATE = { MENU_NEWGAMECUSTOMSUB , MA_Advance , } ;
static MenuLink_t MEO_NEWGAMECUSTOM [ MAXMENUGAMEPLAYENTRIES ] ;
static MenuLink_t MEO_NEWGAMECUSTOMSUB_TEMPLATE = { MENU_SKILL , MA_Advance , } ;
static MenuLink_t MEO_NEWGAMECUSTOMSUB [ MAXMENUGAMEPLAYENTRIES ] [ MAXMENUGAMEPLAYENTRIES ] ;
MenuEntry_t ME_NEWGAMECUSTOMENTRIES [ MAXMENUGAMEPLAYENTRIES ] ;
MenuEntry_t ME_NEWGAMECUSTOMSUBENTRIES [ MAXMENUGAMEPLAYENTRIES ] [ MAXMENUGAMEPLAYENTRIES ] ;
static MenuEntry_t * MEL_NEWGAMECUSTOM [ MAXMENUGAMEPLAYENTRIES ] ;
static MenuEntry_t * MEL_NEWGAMECUSTOMSUB [ MAXMENUGAMEPLAYENTRIES ] ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_SKILL_TEMPLATE = MAKE_MENUENTRY ( NULL , & MF_Redfont , & MEF_CenterMenu , & MEO_NULL , Link ) ;
2014-05-31 12:26:41 +00:00
static MenuEntry_t ME_SKILL [ MAXSKILLS ] ;
static MenuEntry_t * MEL_SKILL [ MAXSKILLS ] ;
2017-07-31 01:34:54 +00:00
static char const * MEOSN_GAMESETUP_AIM_AUTO [ ] = { " Never " , " Always " , " Hitscan only " ,
2014-09-30 04:07:29 +00:00
} ;
static int32_t MEOSV_GAMESETUP_AIM_AUTO [ ] = { 0 , 1 , 2 ,
} ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_GAMESETUP_AIM_AUTO = MAKE_MENUOPTIONSET ( MEOSN_GAMESETUP_AIM_AUTO , MEOSV_GAMESETUP_AIM_AUTO , 0x2 ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_GAMESETUP_AIM_AUTO = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_GAMESETUP_AIM_AUTO , & cl_autoaim ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_GAMESETUP_AIM_AUTO = MAKE_MENUENTRY ( " Auto aim: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_GAMESETUP_AIM_AUTO , Option ) ;
2014-09-30 04:07:29 +00:00
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_GAMESETUP_ALWAYS_RUN = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_NoYes , & cl_autorun ) ;
2019-08-15 16:57:30 +00:00
static MenuEntry_t ME_GAMESETUP_ALWAYS_RUN = MAKE_MENUENTRY ( " Always run: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_GAMESETUP_ALWAYS_RUN , Option ) ;
2019-08-17 22:33:36 +00:00
static char const * MEOSN_GAMESETUP_WEAPSWITCH_PICKUP [ ] = { " Never " , " If new " , /*"If favored",*/ } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_GAMESETUP_WEAPSWITCH_PICKUP = MAKE_MENUOPTIONSET ( MEOSN_GAMESETUP_WEAPSWITCH_PICKUP , NULL , 0x2 ) ;
static MenuOption_t MEO_GAMESETUP_WEAPSWITCH_PICKUP = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_GAMESETUP_WEAPSWITCH_PICKUP , NULL ) ;
static MenuEntry_t ME_GAMESETUP_WEAPSWITCH_PICKUP = MAKE_MENUENTRY ( " Equip pickups: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_GAMESETUP_WEAPSWITCH_PICKUP , Option ) ;
2014-09-30 04:07:29 +00:00
2016-01-11 05:06:10 +00:00
static char const * MEOSN_DemoRec [ ] = { " Off " , " Running " , } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_DemoRec = MAKE_MENUOPTIONSET ( MEOSN_DemoRec , NULL , 0x3 ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_GAMESETUP_DEMOREC = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & m_recstat ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_GAMESETUP_DEMOREC = MAKE_MENUENTRY ( " Record demo: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_GAMESETUP_DEMOREC , Option ) ;
2014-09-30 04:07:29 +00:00
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_ADULTMODE = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & adult_lockout ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_ADULTMODE = MAKE_MENUENTRY ( " Parental lock: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_ADULTMODE , Option ) ;
2014-09-30 04:07:29 +00:00
2017-07-31 03:14:51 +00:00
# if defined(EDUKE32_ANDROID_MENU) || !defined(EDUKE32_SIMPLE_MENU)
2016-01-08 01:32:47 +00:00
static MenuLink_t MEO_GAMESETUP_CHEATS = { MENU_CHEATS , MA_Advance , } ;
static MenuEntry_t ME_GAMESETUP_CHEATS = MAKE_MENUENTRY ( " Cheats " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_GAMESETUP_CHEATS , Link ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t * MEL_GAMESETUP [ ] = {
2014-12-27 18:35:34 +00:00
& ME_ADULTMODE ,
2017-01-18 22:21:40 +00:00
# if defined STARTUP_SETUP_WINDOW && !defined EDUKE32_SIMPLE_MENU
2014-05-31 12:26:41 +00:00
& ME_GAMESETUP_STARTWIN ,
2014-09-30 04:07:29 +00:00
# endif
2019-08-16 00:20:45 +00:00
# ifndef EDUKE32_ANDROID_MENU
2014-05-31 12:26:41 +00:00
& ME_GAMESETUP_DEMOREC ,
# endif
2016-01-08 01:32:47 +00:00
& ME_GAMESETUP_CHEATS ,
2014-09-30 04:07:29 +00:00
} ;
2017-07-31 03:14:51 +00:00
# endif
2012-06-03 16:11:22 +00:00
2017-07-31 01:34:54 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2017-06-27 01:50:55 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Game Setup " , MEF_OptionsMenu , OPTIONS_GAMESETUP , MENU_GAMESETUP ) ;
2017-07-31 01:34:54 +00:00
# endif
2017-06-27 01:50:55 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Sound Setup " , MEF_OptionsMenu , OPTIONS_SOUNDSETUP , MENU_SOUND ) ;
MAKE_MENU_TOP_ENTRYLINK ( " Display Setup " , MEF_OptionsMenu , OPTIONS_DISPLAYSETUP , MENU_DISPLAYSETUP ) ;
MAKE_MENU_TOP_ENTRYLINK ( " Player Setup " , MEF_OptionsMenu , OPTIONS_PLAYERSETUP , MENU_PLAYER ) ;
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_ANDROID_MENU
2017-06-27 01:50:55 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Control Setup " , MEF_OptionsMenu , OPTIONS_CONTROLS , MENU_CONTROLS ) ;
2019-11-09 21:22:51 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Configure Controls " , MEF_BigOptionsRtSections , OPTIONS_KEYBOARDSETUP , MENU_KEYBOARDSETUP ) ;
2019-08-13 09:15:49 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Mouse Setup " , MEF_BigOptionsRtSections , OPTIONS_MOUSESETUP , MENU_MOUSESETUP ) ;
2015-12-04 11:52:47 +00:00
# endif
2019-08-13 10:25:35 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Gamepad Setup " , MEF_BigOptionsRtSections , OPTIONS_JOYSTICKSETUP , MENU_JOYSTICKSETUP ) ;
2017-01-18 22:21:40 +00:00
# ifdef EDUKE32_ANDROID_MENU
2019-08-13 09:15:49 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Touch Setup " , MEF_BigOptionsRtSections , OPTIONS_TOUCHSETUP , MENU_TOUCHSETUP ) ;
2015-02-11 05:22:32 +00:00
# endif
2017-07-31 03:14:51 +00:00
# ifdef EDUKE32_SIMPLE_MENU
MAKE_MENU_TOP_ENTRYLINK ( " Cheats " , MEF_OptionsMenu , OPTIONS_CHEATS , MENU_CHEATS ) ;
# endif
2012-06-03 16:11:22 +00:00
2019-11-09 18:15:03 +00:00
// Zhe menu code lacks flexibility, it can either be hardwired to ints or to CVARs.
// Since CVARs are more important it means that these need to be implemented as CVARs even though they are just temporaries.
// By giving them no name we ensure that they remain outside the CVAR system.
CVAR_UNAMED ( Int , newresolution )
CVAR_UNAMED ( Int , newrendermode )
CVAR_UNAMED ( Int , newfullscreen )
CVAR_UNAMED ( Int , newvsync )
CVAR_UNAMED ( Int , newborderless )
2012-06-03 16:11:22 +00:00
2014-05-31 12:26:41 +00:00
enum resflags_t {
RES_FS = 0x1 ,
RES_WIN = 0x2 ,
} ;
2012-06-03 16:11:22 +00:00
2018-02-26 02:48:09 +00:00
# define MAXRESOLUTIONSTRINGLENGTH 19
2012-06-03 16:11:22 +00:00
2014-05-31 12:26:41 +00:00
typedef struct resolution_t {
int32_t xdim , ydim ;
int32_t flags ;
int32_t bppmax ;
char name [ MAXRESOLUTIONSTRINGLENGTH ] ;
} resolution_t ;
2012-06-03 16:11:22 +00:00
2014-05-31 12:26:41 +00:00
resolution_t resolution [ MAXVALIDMODES ] ;
2012-06-03 16:11:22 +00:00
2016-01-11 05:06:10 +00:00
static char const * MEOSN_VIDEOSETUP_RESOLUTION [ MAXVALIDMODES ] ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_VIDEOSETUP_RESOLUTION = MAKE_MENUOPTIONSETDYN ( MEOSN_VIDEOSETUP_RESOLUTION , NULL , 0 , 0x0 ) ;
static MenuOption_t MEO_VIDEOSETUP_RESOLUTION = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_VIDEOSETUP_RESOLUTION , & newresolution ) ;
static MenuEntry_t ME_VIDEOSETUP_RESOLUTION = MAKE_MENUENTRY ( " Resolution: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_VIDEOSETUP_RESOLUTION , Option ) ;
2006-12-10 06:49:01 +00:00
2014-05-31 12:26:41 +00:00
# ifdef USE_OPENGL
2016-01-11 05:06:10 +00:00
static char const * MEOSN_VIDEOSETUP_RENDERER [ ] = { " Classic " , " OpenGL " , } ;
2014-05-31 12:26:41 +00:00
static int32_t MEOSV_VIDEOSETUP_RENDERER [ ] = { REND_CLASSIC , REND_POLYMOST , } ;
2006-04-13 20:47:06 +00:00
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_VIDEOSETUP_RENDERER = MAKE_MENUOPTIONSET ( MEOSN_VIDEOSETUP_RENDERER , MEOSV_VIDEOSETUP_RENDERER , 0x2 ) ;
2014-05-31 12:26:41 +00:00
2014-11-30 02:04:36 +00:00
static MenuOption_t MEO_VIDEOSETUP_RENDERER = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_VIDEOSETUP_RENDERER , & newrendermode ) ;
static MenuEntry_t ME_VIDEOSETUP_RENDERER = MAKE_MENUENTRY ( " Renderer: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_VIDEOSETUP_RENDERER , Option ) ;
2014-12-18 18:14:45 +00:00
# endif
2019-09-08 01:01:30 +00:00
static MenuOption_t MEO_VIDEOSETUP_FULLSCREEN = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_YesNo , & newfullscreen ) ;
static MenuEntry_t ME_VIDEOSETUP_FULLSCREEN = MAKE_MENUENTRY ( " Windowed: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_VIDEOSETUP_FULLSCREEN , Option ) ;
2015-12-23 04:05:21 +00:00
2019-09-08 01:01:30 +00:00
static char const * MEOSN_VIDEOSETUP_BORDERLESS [ ] = { " No " , " Yes " , " Auto " , } ;
static int32_t MEOSV_VIDEOSETUP_BORDERLESS [ ] = { 0 , 1 , 2 , } ;
static MenuOptionSet_t MEOS_VIDEOSETUP_BORDERLESS = MAKE_MENUOPTIONSET ( MEOSN_VIDEOSETUP_BORDERLESS , MEOSV_VIDEOSETUP_BORDERLESS , 0x2 ) ;
static MenuOption_t MEO_VIDEOSETUP_BORDERLESS = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_VIDEOSETUP_BORDERLESS , & newborderless ) ;
static MenuEntry_t ME_VIDEOSETUP_BORDERLESS = MAKE_MENUENTRY ( " Borderless: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_VIDEOSETUP_BORDERLESS , Option ) ;
2015-12-23 04:05:21 +00:00
2017-02-05 20:58:33 +00:00
static char const * MEOSN_VIDEOSETUP_VSYNC [ ] = { " Adaptive " , " Off " , " On " , } ;
static int32_t MEOSV_VIDEOSETUP_VSYNC [ ] = { - 1 , 0 , 1 , } ;
2015-12-23 04:05:21 +00:00
static MenuOptionSet_t MEOS_VIDEOSETUP_VSYNC = MAKE_MENUOPTIONSET ( MEOSN_VIDEOSETUP_VSYNC , MEOSV_VIDEOSETUP_VSYNC , 0x2 ) ;
static MenuOption_t MEO_VIDEOSETUP_VSYNC = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_VIDEOSETUP_VSYNC , & newvsync ) ;
static MenuEntry_t ME_VIDEOSETUP_VSYNC = MAKE_MENUENTRY ( " VSync: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_VIDEOSETUP_VSYNC , Option ) ;
2019-09-08 01:01:30 +00:00
2019-10-23 15:07:29 +00:00
//static char const *MEOSN_VIDEOSETUP_FRAMELIMIT [] = { "None", "30 fps", "60 fps", "75 fps", "100 fps", "120 fps", "144 fps", "165 fps", "240 fps" };
2016-11-01 01:35:24 +00:00
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_VIDEOSETUP_APPLY = MAKE_MENUENTRY ( " Apply Changes " , & MF_Redfont , & MEF_BigOptions_Apply , & MEO_NULL , Link ) ;
2014-09-30 04:07:29 +00:00
2014-12-18 18:14:45 +00:00
static MenuLink_t MEO_DISPLAYSETUP_COLORCORR = { MENU_COLCORR , MA_Advance , } ;
2014-12-27 18:37:27 +00:00
static MenuEntry_t ME_DISPLAYSETUP_COLORCORR = MAKE_MENUENTRY ( " Color Correction " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_DISPLAYSETUP_COLORCORR , Link ) ;
2016-10-09 00:15:14 +00:00
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_ANDROID_MENU
2014-09-30 04:07:29 +00:00
static MenuOption_t MEO_DISPLAYSETUP_ASPECTRATIO = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & r_usenewaspect ) ;
2014-12-18 18:14:45 +00:00
static MenuEntry_t ME_DISPLAYSETUP_ASPECTRATIO = MAKE_MENUENTRY ( " Widescreen: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_DISPLAYSETUP_ASPECTRATIO , Option ) ;
2016-03-14 00:06:54 +00:00
# endif
2014-09-30 04:07:29 +00:00
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_DISPLAYSETUP_VOXELS = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & r_voxels ) ;
2019-08-13 02:53:38 +00:00
static MenuEntry_t ME_DISPLAYSETUP_VOXELS = MAKE_MENUENTRY ( " Voxels: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_DISPLAYSETUP_VOXELS , Option ) ;
2019-11-09 18:15:03 +00:00
static MenuRangeInt32_t MEO_DISPLAYSETUP_FOV = MAKE_MENURANGE ( & r_fov , & MF_Redfont , 70 , 120 , 0 , 11 , 1 ) ;
2019-02-18 22:02:33 +00:00
static MenuEntry_t ME_DISPLAYSETUP_FOV = MAKE_MENUENTRY ( " FOV: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_DISPLAYSETUP_FOV , RangeInt32 ) ;
2014-09-30 04:07:29 +00:00
# ifdef USE_OPENGL
2016-01-11 05:06:10 +00:00
static char const * MEOSN_DISPLAYSETUP_TEXFILTER [ ] = { " Classic " , " Filtered " } ;
2016-10-03 02:43:51 +00:00
static int32_t MEOSV_DISPLAYSETUP_TEXFILTER [ ] = { TEXFILTER_OFF , TEXFILTER_ON } ;
static MenuOptionSet_t MEOS_DISPLAYSETUP_TEXFILTER = MAKE_MENUOPTIONSET ( MEOSN_DISPLAYSETUP_TEXFILTER , MEOSV_DISPLAYSETUP_TEXFILTER , 0x2 ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_DISPLAYSETUP_TEXFILTER = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_DISPLAYSETUP_TEXFILTER , & hw_texfilter ) ;
2014-12-18 18:14:45 +00:00
static MenuEntry_t ME_DISPLAYSETUP_TEXFILTER = MAKE_MENUENTRY ( " Texture Mode: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_DISPLAYSETUP_TEXFILTER , Option ) ;
2014-09-30 04:07:29 +00:00
2017-06-19 23:06:21 +00:00
static char const * MEOSN_DISPLAYSETUP_ANISOTROPY [ ] = { " Max " , " None " , " 2x " , " 4x " , " 8x " , " 16x " , } ;
static int32_t MEOSV_DISPLAYSETUP_ANISOTROPY [ ] = { 0 , 1 , 2 , 4 , 8 , 16 , } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_DISPLAYSETUP_ANISOTROPY = MAKE_MENUOPTIONSET ( MEOSN_DISPLAYSETUP_ANISOTROPY , MEOSV_DISPLAYSETUP_ANISOTROPY , 0x0 ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_DISPLAYSETUP_ANISOTROPY = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_DISPLAYSETUP_ANISOTROPY , & hw_anisotropy ) ;
2014-12-18 18:14:45 +00:00
static MenuEntry_t ME_DISPLAYSETUP_ANISOTROPY = MAKE_MENUENTRY ( " Anisotropy: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_DISPLAYSETUP_ANISOTROPY , Option ) ;
2015-02-11 05:22:32 +00:00
2014-09-30 04:07:29 +00:00
# endif
2017-11-29 07:29:57 +00:00
static char const s_Scale [ ] = " Scale: " ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_SCREENSETUP_CROSSHAIR = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & cl_crosshair ) ;
2017-06-27 01:50:55 +00:00
static MenuEntry_t ME_SCREENSETUP_CROSSHAIR = MAKE_MENUENTRY ( " Crosshair: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SCREENSETUP_CROSSHAIR , Option ) ;
2019-11-09 18:15:03 +00:00
static MenuRangeInt32_t MEO_SCREENSETUP_CROSSHAIRSIZE = MAKE_MENURANGE ( & cl_crosshairscale , & MF_Redfont , 25 , 100 , 0 , 16 , 2 ) ;
2017-11-29 07:29:57 +00:00
static MenuEntry_t ME_SCREENSETUP_CROSSHAIRSIZE = MAKE_MENUENTRY ( s_Scale , & MF_Redfont , & MEF_BigOptions_Apply , & MEO_SCREENSETUP_CROSSHAIRSIZE , RangeInt32 ) ;
2014-09-30 04:07:29 +00:00
2019-11-09 18:15:03 +00:00
static MenuRangeInt32_t MEO_SCREENSETUP_SCREENSIZE = MAKE_MENURANGE ( & hud_size , & MF_Redfont , 0 , 11 , 0 , 1 , EnforceIntervals ) ;
static MenuOption_t MEO_SCREENSETUP_SCREENSIZE_TWO = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & hud_size ) ;
2018-02-13 00:13:06 +00:00
static MenuEntry_t ME_SCREENSETUP_SCREENSIZE = MAKE_MENUENTRY ( " Status bar: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SCREENSETUP_SCREENSIZE , RangeInt32 ) ;
2019-11-09 18:15:03 +00:00
static MenuRangeInt32_t MEO_SCREENSETUP_TEXTSIZE = MAKE_MENURANGE ( & hud_textscale , & MF_Redfont , 100 , 400 , 0 , 16 , 2 ) ;
2017-11-29 07:29:57 +00:00
static MenuEntry_t ME_SCREENSETUP_TEXTSIZE = MAKE_MENUENTRY ( s_Scale , & MF_Redfont , & MEF_BigOptions_Apply , & MEO_SCREENSETUP_TEXTSIZE , RangeInt32 ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_SCREENSETUP_LEVELSTATS = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & hud_stats ) ;
2017-06-27 01:50:55 +00:00
static MenuEntry_t ME_SCREENSETUP_LEVELSTATS = MAKE_MENUENTRY ( " Level stats: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SCREENSETUP_LEVELSTATS , Option ) ;
2014-09-30 04:07:29 +00:00
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_SCREENSETUP_SHOWPICKUPMESSAGES = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & hud_messages ) ;
2017-06-27 01:50:55 +00:00
static MenuEntry_t ME_SCREENSETUP_SHOWPICKUPMESSAGES = MAKE_MENUENTRY ( " Game messages: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SCREENSETUP_SHOWPICKUPMESSAGES , Option ) ;
2014-09-30 04:07:29 +00:00
2019-11-09 18:15:03 +00:00
static MenuRangeInt32_t MEO_SCREENSETUP_SBARSIZE = MAKE_MENURANGE ( & hud_scale , & MF_Redfont , 50 , 100 , 0 , 10 , 2 ) ;
2017-11-29 07:29:57 +00:00
static MenuEntry_t ME_SCREENSETUP_SBARSIZE = MAKE_MENUENTRY ( s_Scale , & MF_Redfont , & MEF_BigOptions_Apply , & MEO_SCREENSETUP_SBARSIZE , RangeInt32 ) ;
2014-09-30 04:07:29 +00:00
2014-10-27 10:14:50 +00:00
static MenuLink_t MEO_DISPLAYSETUP_SCREENSETUP = { MENU_SCREENSETUP , MA_Advance , } ;
2017-06-27 01:50:55 +00:00
static MenuEntry_t ME_DISPLAYSETUP_SCREENSETUP = MAKE_MENUENTRY ( " HUD setup " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_DISPLAYSETUP_SCREENSETUP , Link ) ;
2014-09-30 04:07:29 +00:00
2014-12-18 18:14:45 +00:00
# ifdef USE_OPENGL
2015-10-24 00:30:35 +00:00
static MenuLink_t MEO_DISPLAYSETUP_ADVANCED_GL_POLYMOST = { MENU_POLYMOST , MA_Advance , } ;
static MenuEntry_t ME_DISPLAYSETUP_ADVANCED_GL_POLYMOST = MAKE_MENUENTRY ( " Polymost setup " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_DISPLAYSETUP_ADVANCED_GL_POLYMOST , Link ) ;
2017-01-18 22:21:40 +00:00
# endif
2014-09-30 04:07:29 +00:00
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_ANDROID_MENU
2014-10-27 10:14:50 +00:00
static MenuLink_t MEO_DISPLAYSETUP_VIDEOSETUP = { MENU_VIDEOSETUP , MA_Advance , } ;
2014-12-27 18:37:27 +00:00
static MenuEntry_t ME_DISPLAYSETUP_VIDEOSETUP = MAKE_MENUENTRY ( " Video mode " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_DISPLAYSETUP_VIDEOSETUP , Link ) ;
2014-10-25 10:16:49 +00:00
# endif
2014-05-31 12:26:41 +00:00
2015-03-24 10:49:03 +00:00
static MenuLink_t MEO_ENTERCHEAT = { MENU_CHEATENTRY , MA_None , } ;
static MenuEntry_t ME_ENTERCHEAT = MAKE_MENUENTRY ( " Enter Cheat Code " , & MF_Redfont , & MEF_BigCheats , & MEO_ENTERCHEAT , Link ) ;
static MenuLink_t MEO_CHEAT_WARP = { MENU_CHEAT_WARP , MA_None , } ;
static MenuLink_t MEO_CHEAT_SKILL = { MENU_CHEAT_SKILL , MA_None , } ;
2019-08-07 19:12:11 +00:00
// KEEPINSYNC cheats.h: enum CheatCodeFunctions
// KEEPINSYNC cheats.cpp: uint8_t CheatFunctionIDs[]
2015-03-24 10:49:03 +00:00
# define MAKE_MENUCHEAT( Name ) MAKE_MENUENTRY( Name, &MF_Bluefont, &MEF_Cheats, &MEO_NULL, Link )
static MenuEntry_t ME_CheatCodes [ ] = {
2019-08-07 19:12:11 +00:00
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_CASHMAN ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_CORNHOLIO ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_STUFF ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_WEAPONS ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_ITEMS ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_INVENTORY ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_KEYS ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_HYPER ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_VIEW ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_SHOWMAP ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_UNLOCK ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_CLIP ] ) ,
MAKE_MENUENTRY ( CheatDescriptions [ CHEAT_SCOTTY ] , & MF_Bluefont , & MEF_Cheats , & MEO_CHEAT_WARP , Link ) ,
MAKE_MENUENTRY ( CheatDescriptions [ CHEAT_SKILL ] , & MF_Bluefont , & MEF_Cheats , & MEO_CHEAT_SKILL , Link ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_MONSTERS ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_RATE ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_BETA ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_TODD ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_ALLEN ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_COORDS ] ) ,
MAKE_MENUCHEAT ( CheatDescriptions [ CHEAT_DEBUG ] ) ,
2015-03-24 10:49:03 +00:00
} ;
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_OPTIONS [ ] = {
2017-07-31 01:34:54 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-05-31 12:26:41 +00:00
& ME_OPTIONS_GAMESETUP ,
2017-07-31 01:34:54 +00:00
# endif
2014-09-30 04:07:29 +00:00
& ME_OPTIONS_DISPLAYSETUP ,
2017-07-31 03:14:51 +00:00
& ME_OPTIONS_SOUNDSETUP ,
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_ANDROID_MENU
# ifndef EDUKE32_SIMPLE_MENU
2014-05-31 12:26:41 +00:00
& ME_OPTIONS_PLAYERSETUP ,
2017-01-18 22:21:40 +00:00
# endif
2014-09-30 04:07:29 +00:00
& ME_OPTIONS_CONTROLS ,
2015-02-11 05:22:32 +00:00
# else
2015-03-24 10:49:03 +00:00
& ME_OPTIONS_TOUCHSETUP ,
2015-02-11 05:22:32 +00:00
# endif
2017-07-31 01:34:54 +00:00
# ifdef EDUKE32_SIMPLE_MENU
2018-03-08 03:55:12 +00:00
& ME_GAMESETUP_SAVESETUP ,
2017-07-31 03:14:51 +00:00
& ME_OPTIONS_CHEATS
2017-07-31 01:34:54 +00:00
# endif
2014-09-30 04:07:29 +00:00
} ;
static MenuEntry_t * MEL_CONTROLS [ ] = {
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_ANDROID_MENU
2014-12-27 18:35:34 +00:00
& ME_OPTIONS_KEYBOARDSETUP ,
& ME_OPTIONS_MOUSESETUP ,
& ME_OPTIONS_JOYSTICKSETUP ,
2015-02-11 05:22:32 +00:00
# else
2019-08-13 09:15:49 +00:00
& ME_OPTIONS_TOUCHSETUP ,
2015-02-11 05:22:32 +00:00
# endif
2019-08-13 09:15:49 +00:00
& ME_Space6_Redfont ,
2019-08-12 15:36:36 +00:00
& ME_GAMESETUP_AIM_AUTO ,
2019-08-15 16:57:30 +00:00
& ME_GAMESETUP_ALWAYS_RUN ,
2019-08-16 00:20:45 +00:00
& ME_GAMESETUP_WEAPSWITCH_PICKUP ,
# ifdef EDUKE32_ANDROID_MENU
& ME_GAMESETUP_QUICKSWITCH ,
& ME_GAMESETUP_CROUCHLOCK ,
# endif
2014-05-31 12:26:41 +00:00
} ;
2012-06-03 16:11:22 +00:00
2015-03-24 10:49:03 +00:00
static MenuEntry_t * MEL_CHEATS [ ARRAY_SIZE ( ME_CheatCodes ) + 1 ] = {
& ME_ENTERCHEAT ,
} ;
2014-09-30 04:07:29 +00:00
2014-11-30 02:04:36 +00:00
static MenuEntry_t * MEL_VIDEOSETUP [ ] = {
2014-05-31 12:26:41 +00:00
& ME_VIDEOSETUP_RESOLUTION ,
2014-12-18 18:14:45 +00:00
# ifdef USE_OPENGL
2014-05-31 12:26:41 +00:00
& ME_VIDEOSETUP_RENDERER ,
2014-12-18 18:14:45 +00:00
# endif
2014-05-31 12:26:41 +00:00
& ME_VIDEOSETUP_FULLSCREEN ,
2019-09-08 01:01:30 +00:00
& ME_VIDEOSETUP_BORDERLESS ,
2015-12-23 04:05:21 +00:00
& ME_VIDEOSETUP_VSYNC ,
2019-09-21 11:02:17 +00:00
& ME_Space4_Redfont ,
2014-05-31 12:26:41 +00:00
& ME_VIDEOSETUP_APPLY ,
} ;
2014-09-30 04:07:29 +00:00
static MenuEntry_t * MEL_DISPLAYSETUP [ ] = {
& ME_DISPLAYSETUP_SCREENSETUP ,
& ME_DISPLAYSETUP_COLORCORR ,
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_ANDROID_MENU
2014-12-27 18:35:34 +00:00
& ME_DISPLAYSETUP_VIDEOSETUP ,
& ME_DISPLAYSETUP_ASPECTRATIO ,
2019-08-13 02:53:38 +00:00
& ME_DISPLAYSETUP_VOXELS ,
2019-02-18 22:02:33 +00:00
& ME_DISPLAYSETUP_FOV ,
2016-03-14 00:06:54 +00:00
# endif
2014-05-31 12:26:41 +00:00
} ;
2014-09-30 04:07:29 +00:00
2014-05-31 12:26:41 +00:00
# ifdef USE_OPENGL
2014-09-30 04:07:29 +00:00
static MenuEntry_t * MEL_DISPLAYSETUP_GL [ ] = {
2014-12-27 18:35:34 +00:00
& ME_DISPLAYSETUP_SCREENSETUP ,
2014-09-30 04:07:29 +00:00
& ME_DISPLAYSETUP_COLORCORR ,
2014-12-27 18:35:34 +00:00
& ME_DISPLAYSETUP_VIDEOSETUP ,
& ME_DISPLAYSETUP_ASPECTRATIO ,
2019-08-13 02:53:38 +00:00
& ME_DISPLAYSETUP_VOXELS ,
2019-02-18 22:02:33 +00:00
& ME_DISPLAYSETUP_FOV ,
2014-12-27 18:35:34 +00:00
& ME_DISPLAYSETUP_TEXFILTER ,
& ME_DISPLAYSETUP_ANISOTROPY ,
2015-10-24 00:30:35 +00:00
& ME_DISPLAYSETUP_ADVANCED_GL_POLYMOST ,
2017-11-22 05:23:43 +00:00
# endif
2014-05-31 12:26:41 +00:00
} ;
2014-09-30 04:07:29 +00:00
2012-06-03 16:11:22 +00:00
2019-11-26 08:24:38 +00:00
static char const MenuKeyNone [ ] = " - " ;
2016-01-11 05:06:10 +00:00
static char const * MEOSN_Keys [ NUMKEYS ] ;
2012-06-03 16:11:22 +00:00
2019-11-03 19:58:10 +00:00
static MenuCustom2Col_t MEO_KEYBOARDSETUPFUNCS_TEMPLATE = { 0 , & MF_Minifont , NUMKEYS , 54 < < 16 , 0 } ;
2014-05-31 12:26:41 +00:00
static MenuCustom2Col_t MEO_KEYBOARDSETUPFUNCS [ NUMGAMEFUNCTIONS ] ;
2018-02-20 11:55:24 +00:00
static MenuEntry_t ME_KEYBOARDSETUPFUNCS_TEMPLATE = MAKE_MENUENTRY ( NULL , & MF_Minifont , & MEF_KBFuncList , & MEO_KEYBOARDSETUPFUNCS_TEMPLATE , Custom2Col ) ;
2014-05-31 12:26:41 +00:00
static MenuEntry_t ME_KEYBOARDSETUPFUNCS [ NUMGAMEFUNCTIONS ] ;
static MenuEntry_t * MEL_KEYBOARDSETUPFUNCS [ NUMGAMEFUNCTIONS ] ;
2012-06-03 16:11:22 +00:00
2014-12-18 18:14:45 +00:00
static MenuLink_t MEO_KEYBOARDSETUP_KEYS = { MENU_KEYBOARDKEYS , MA_Advance , } ;
2019-11-09 21:22:51 +00:00
static MenuEntry_t ME_KEYBOARDSETUP_KEYS = MAKE_MENUENTRY ( " Edit Configuration " , & MF_Redfont , & MEF_CenterMenu , & MEO_KEYBOARDSETUP_KEYS , Link ) ;
2019-08-13 09:16:02 +00:00
static MenuLink_t MEO_KEYBOARDSETUP_RESET = { MENU_KEYSRESETVERIFY , MA_None , } ;
static MenuEntry_t ME_KEYBOARDSETUP_RESET = MAKE_MENUENTRY ( " Reset To Defaults " , & MF_Redfont , & MEF_CenterMenu , & MEO_KEYBOARDSETUP_RESET , Link ) ;
static MenuLink_t MEO_KEYBOARDSETUP_RESETCLASSIC = { MENU_KEYSCLASSICVERIFY , MA_None , } ;
static MenuEntry_t ME_KEYBOARDSETUP_RESETCLASSIC = MAKE_MENUENTRY ( " Reset To Classic " , & MF_Redfont , & MEF_CenterMenu , & MEO_KEYBOARDSETUP_RESETCLASSIC , Link ) ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_KEYBOARDSETUP [ ] = {
& ME_KEYBOARDSETUP_KEYS ,
& ME_KEYBOARDSETUP_RESET ,
& ME_KEYBOARDSETUP_RESETCLASSIC ,
} ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
// There is no better way to do this than manually.
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
# define MENUMOUSEFUNCTIONS 12
2012-02-18 17:56:39 +00:00
2016-01-11 05:06:10 +00:00
static char const * MenuMouseNames [ MENUMOUSEFUNCTIONS ] = {
2014-05-31 12:26:41 +00:00
" Button 1 " ,
" Double Button 1 " ,
" Button 2 " ,
" Double Button 2 " ,
" Button 3 " ,
" Double Button 3 " ,
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
" Wheel Up " ,
" Wheel Down " ,
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
" Button 4 " ,
" Double Button 4 " ,
" Button 5 " ,
" Double Button 5 " ,
} ;
static int32_t MenuMouseDataIndex [ MENUMOUSEFUNCTIONS ] [ 2 ] = {
{ 0 , 0 , } ,
{ 0 , 1 , } ,
{ 1 , 0 , } ,
{ 1 , 1 , } ,
{ 2 , 0 , } ,
{ 2 , 1 , } ,
// note the mouse wheel
{ 4 , 0 , } ,
{ 5 , 0 , } ,
{ 3 , 0 , } ,
{ 3 , 1 , } ,
{ 6 , 0 , } ,
{ 6 , 1 , } ,
} ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
static MenuOption_t MEO_MOUSEJOYSETUPBTNS_TEMPLATE = MAKE_MENUOPTION ( & MF_Minifont , & MEOS_Gamefuncs , NULL ) ;
static MenuOption_t MEO_MOUSESETUPBTNS [ MENUMOUSEFUNCTIONS ] ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_MOUSEJOYSETUPBTNS_TEMPLATE = MAKE_MENUENTRY ( NULL , & MF_Minifont , & MEF_FuncList , NULL , Option ) ;
2014-05-31 12:26:41 +00:00
2019-11-09 18:15:03 +00:00
static MenuRangeFloat_t MEO_MOUSESETUP_SENSITIVITY = MAKE_MENURANGE ( & in_mousesensitivity , & MF_Redfont , .5f , 16.f , 0.f , 32 , 1 ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_MOUSESETUP_SENSITIVITY = MAKE_MENUENTRY ( " Sensitivity: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_MOUSESETUP_SENSITIVITY , RangeFloat ) ;
2017-01-18 22:23:36 +00:00
2017-07-31 01:34:54 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2017-02-05 20:58:33 +00:00
static char const * MEOSN_MOUSESETUP_AIM_TYPE [ ] = { " Toggle " , " Hold " } ;
2017-01-18 22:23:36 +00:00
static MenuOptionSet_t MEOS_MOUSESETUP_AIM_TYPE = MAKE_MENUOPTIONSET ( MEOSN_MOUSESETUP_AIM_TYPE , NULL , 0x2 ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_MOUSESETUP_MOUSEAIMINGTYPE = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_MOUSESETUP_AIM_TYPE , & in_aimmode ) ;
2017-01-18 22:23:36 +00:00
static MenuEntry_t ME_MOUSESETUP_MOUSEAIMINGTYPE = MAKE_MENUENTRY ( " Aiming type: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_MOUSESETUP_MOUSEAIMINGTYPE , Option ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_MOUSESETUP_MOUSEAIMING = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_NoYes , & in_mousemode ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_MOUSESETUP_MOUSEAIMING = MAKE_MENUENTRY ( " Vertical aiming: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_MOUSESETUP_MOUSEAIMING , Option ) ;
2017-07-31 01:34:54 +00:00
# endif
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_MOUSESETUP_INVERT = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_YesNo , & in_mouseflip ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_MOUSESETUP_INVERT = MAKE_MENUENTRY ( " Invert aiming: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_MOUSESETUP_INVERT , Option ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_MOUSESETUP_SMOOTH = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_NoYes , & in_mousesmoothing ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_MOUSESETUP_SMOOTH = MAKE_MENUENTRY ( " Filter input: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_MOUSESETUP_SMOOTH , Option ) ;
2017-07-31 01:34:54 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-12-18 18:14:45 +00:00
static MenuLink_t MEO_MOUSESETUP_ADVANCED = { MENU_MOUSEADVANCED , MA_Advance , } ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_MOUSESETUP_ADVANCED = MAKE_MENUENTRY ( " Advanced setup " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_MOUSESETUP_ADVANCED , Link ) ;
2017-07-31 01:34:54 +00:00
# endif
2019-11-09 18:15:03 +00:00
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEX = MAKE_MENURANGE ( & in_mousescalex , & MF_Redfont , - 262144 , 262144 , 65536 , 161 , 3 ) ;
2018-02-20 11:55:24 +00:00
static MenuEntry_t ME_MOUSEADVANCED_SCALEX = MAKE_MENUENTRY ( " X-Scale: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_MOUSEADVANCED_SCALEX , RangeInt32 ) ;
2019-11-09 18:15:03 +00:00
static MenuRangeInt32_t MEO_MOUSEADVANCED_SCALEY = MAKE_MENURANGE ( & in_mousescaley , & MF_Redfont , - 262144 , 262144 , 65536 , 161 , 3 ) ;
2018-02-20 11:55:24 +00:00
static MenuEntry_t ME_MOUSEADVANCED_SCALEY = MAKE_MENUENTRY ( " Y-Scale: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_MOUSEADVANCED_SCALEY , RangeInt32 ) ;
2014-05-31 12:26:41 +00:00
2014-11-30 02:04:36 +00:00
static MenuEntry_t * MEL_MOUSESETUP [ ] = {
2017-07-31 01:34:54 +00:00
& ME_MOUSESETUP_SENSITIVITY ,
# ifdef EDUKE32_SIMPLE_MENU
& ME_MOUSEADVANCED_SCALEX ,
& ME_MOUSEADVANCED_SCALEY ,
# endif
2017-06-19 23:06:37 +00:00
& ME_Space2_Redfont ,
2014-12-27 18:35:34 +00:00
& ME_MOUSESETUP_INVERT ,
& ME_MOUSESETUP_SMOOTH ,
2017-07-31 01:34:54 +00:00
# ifndef EDUKE32_SIMPLE_MENU
& ME_MOUSESETUP_MOUSEAIMINGTYPE ,
& ME_MOUSESETUP_MOUSEAIMING ,
2014-12-27 18:35:34 +00:00
& ME_MOUSESETUP_ADVANCED ,
2017-07-31 01:34:54 +00:00
# endif
2014-05-31 12:26:41 +00:00
} ;
2006-04-13 20:47:06 +00:00
2017-01-18 22:21:40 +00:00
# ifdef EDUKE32_ANDROID_MENU
2015-02-21 23:15:27 +00:00
static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_MOVE = MAKE_MENURANGE ( & droidinput . forward_sens , & MF_Redfont , 1.f , 9.f , 0.f , 17 , 1 + EnforceIntervals ) ;
2016-03-14 00:06:54 +00:00
static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_MOVE = MAKE_MENUENTRY ( " Running: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_TOUCHSETUP_SENSITIVITY_MOVE , RangeFloat ) ;
2015-02-11 05:22:32 +00:00
2015-02-21 23:15:27 +00:00
static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_STRAFE = MAKE_MENURANGE ( & droidinput . strafe_sens , & MF_Redfont , 1.f , 9.f , 0.f , 17 , 1 + EnforceIntervals ) ;
2016-03-14 00:06:54 +00:00
static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_STRAFE = MAKE_MENUENTRY ( " Strafing: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_TOUCHSETUP_SENSITIVITY_STRAFE , RangeFloat ) ;
2015-02-11 05:22:32 +00:00
2015-02-21 23:15:27 +00:00
static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_LOOK = MAKE_MENURANGE ( & droidinput . pitch_sens , & MF_Redfont , 1.f , 9.f , 0.f , 17 , 1 + EnforceIntervals ) ;
2016-03-14 00:06:54 +00:00
static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_LOOK = MAKE_MENUENTRY ( " Looking: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_TOUCHSETUP_SENSITIVITY_LOOK , RangeFloat ) ;
2015-02-11 05:22:32 +00:00
2015-02-21 23:15:27 +00:00
static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_TURN = MAKE_MENURANGE ( & droidinput . yaw_sens , & MF_Redfont , 1.f , 9.f , 0.f , 17 , 1 + EnforceIntervals ) ;
2016-03-14 00:06:54 +00:00
static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_TURN = MAKE_MENUENTRY ( " Turning: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_TOUCHSETUP_SENSITIVITY_TURN , RangeFloat ) ;
2015-02-11 05:22:32 +00:00
static MenuOption_t MEO_TOUCHSETUP_INVERT = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_NoYes , & droidinput . invertLook ) ;
static MenuEntry_t ME_TOUCHSETUP_INVERT = MAKE_MENUENTRY ( " Invert look: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_TOUCHSETUP_INVERT , Option ) ;
2016-03-14 00:06:54 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Sensitivity " , MEF_CenterMenu , TOUCHSENS , MENU_TOUCHSENS ) ;
MAKE_MENU_TOP_ENTRYLINK ( " Button Setup " , MEF_CenterMenu , TOUCHBUTTONS , MENU_TOUCHBUTTONS ) ;
2017-02-05 20:58:33 +00:00
static MenuEntry_t * MEL_TOUCHSETUP [ ] = {
2016-03-14 00:06:54 +00:00
& ME_TOUCHSENS ,
& ME_TOUCHBUTTONS ,
} ;
2017-02-05 20:58:33 +00:00
static MenuEntry_t * MEL_TOUCHSENS [ ] = {
2015-02-11 05:22:32 +00:00
& ME_TOUCHSETUP_SENSITIVITY_MOVE ,
& ME_TOUCHSETUP_SENSITIVITY_STRAFE ,
& ME_TOUCHSETUP_SENSITIVITY_LOOK ,
& ME_TOUCHSETUP_SENSITIVITY_TURN ,
2017-06-19 23:06:37 +00:00
& ME_Space2_Redfont ,
2015-02-11 05:22:32 +00:00
& ME_TOUCHSETUP_INVERT ,
} ;
# endif
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_JOYSTICK_ENABLE = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & in_joystick ) ;
2019-08-14 03:03:41 +00:00
static MenuEntry_t ME_JOYSTICK_ENABLE = MAKE_MENUENTRY ( " Enable Gamepad: " , & MF_Redfont , & MEF_BigOptionsRtSections , & MEO_JOYSTICK_ENABLE , Option ) ;
2019-08-13 09:15:49 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Edit Buttons " , MEF_BigOptionsRtSections , JOYSTICK_EDITBUTTONS , MENU_JOYSTICKBTNS ) ;
MAKE_MENU_TOP_ENTRYLINK ( " Edit Axes " , MEF_BigOptionsRtSections , JOYSTICK_EDITAXES , MENU_JOYSTICKAXES ) ;
2019-08-13 09:16:02 +00:00
static MenuLink_t MEO_JOYSTICK_DEFAULTS_STANDARD = { MENU_JOYSTANDARDVERIFY , MA_None , } ;
static MenuEntry_t ME_JOYSTICK_DEFAULTS_STANDARD = MAKE_MENUENTRY ( " Use Standard Layout " , & MF_Redfont , & MEF_BigOptionsRtSections , & MEO_JOYSTICK_DEFAULTS_STANDARD , Link ) ;
static MenuLink_t MEO_JOYSTICK_DEFAULTS_PRO = { MENU_JOYPROVERIFY , MA_None , } ;
static MenuEntry_t ME_JOYSTICK_DEFAULTS_PRO = MAKE_MENUENTRY ( " Use Pro Layout " , & MF_Redfont , & MEF_BigOptionsRtSections , & MEO_JOYSTICK_DEFAULTS_PRO , Link ) ;
static MenuLink_t MEO_JOYSTICK_DEFAULTS_CLEAR = { MENU_JOYCLEARVERIFY , MA_None , } ;
static MenuEntry_t ME_JOYSTICK_DEFAULTS_CLEAR = MAKE_MENUENTRY ( " Clear All Settings " , & MF_Redfont , & MEF_BigOptionsRtSections , & MEO_JOYSTICK_DEFAULTS_CLEAR , Link ) ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_JOYSTICKSETUP [ ] = {
2019-08-14 03:03:41 +00:00
& ME_JOYSTICK_ENABLE ,
& ME_Space6_Redfont ,
2014-05-31 12:26:41 +00:00
& ME_JOYSTICK_EDITBUTTONS ,
& ME_JOYSTICK_EDITAXES ,
2019-08-13 09:15:49 +00:00
& ME_Space6_Redfont ,
& ME_JOYSTICK_DEFAULTS_STANDARD ,
& ME_JOYSTICK_DEFAULTS_PRO ,
& ME_JOYSTICK_DEFAULTS_CLEAR ,
2014-05-31 12:26:41 +00:00
} ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
# define MAXJOYBUTTONSTRINGLENGTH 32
2006-04-13 20:47:06 +00:00
2014-12-18 18:15:51 +00:00
static char MenuJoystickNames [ MAXJOYBUTTONSANDHATS * 2 ] [ MAXJOYBUTTONSTRINGLENGTH ] ;
2006-04-13 20:47:06 +00:00
2014-12-18 18:15:51 +00:00
static MenuOption_t MEO_JOYSTICKBTNS [ MAXJOYBUTTONSANDHATS * 2 ] ;
static MenuEntry_t ME_JOYSTICKBTNS [ MAXJOYBUTTONSANDHATS * 2 ] ;
static MenuEntry_t * MEL_JOYSTICKBTNS [ MAXJOYBUTTONSANDHATS * 2 ] ;
2006-04-13 20:47:06 +00:00
2014-10-27 10:14:50 +00:00
static MenuLink_t MEO_JOYSTICKAXES = { MENU_JOYSTICKAXIS , MA_Advance , } ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_JOYSTICKAXES_TEMPLATE = MAKE_MENUENTRY ( NULL , & MF_Redfont , & MEF_BigSliders , & MEO_JOYSTICKAXES , Link ) ;
2014-05-31 12:26:41 +00:00
static MenuEntry_t ME_JOYSTICKAXES [ MAXJOYAXES ] ;
static char MenuJoystickAxes [ MAXJOYAXES ] [ MAXJOYBUTTONSTRINGLENGTH ] ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_JOYSTICKAXES [ MAXJOYAXES ] ;
2006-04-13 20:47:06 +00:00
2014-11-30 02:04:36 +00:00
static MenuEntry_t * MEL_MOUSEADVANCED [ ] = {
& ME_MOUSEADVANCED_SCALEX ,
& ME_MOUSEADVANCED_SCALEY ,
2014-05-31 12:26:41 +00:00
} ;
2006-04-21 05:11:57 +00:00
2014-05-31 12:26:41 +00:00
static const char * MenuJoystickHatDirections [ ] = { " Up " , " Right " , " Down " , " Left " , } ;
2016-01-11 05:06:10 +00:00
static char const * MEOSN_JOYSTICKAXIS_ANALOG [ ] = { " -None- " , " Turning " , " Strafing " , " Looking " , " Moving " , } ;
2014-05-31 12:26:41 +00:00
static int32_t MEOSV_JOYSTICKAXIS_ANALOG [ ] = { - 1 , analog_turning , analog_strafing , analog_lookingupanddown , analog_moving , } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_JOYSTICKAXIS_ANALOG = MAKE_MENUOPTIONSET ( MEOSN_JOYSTICKAXIS_ANALOG , MEOSV_JOYSTICKAXIS_ANALOG , 0x0 ) ;
2014-05-31 12:26:41 +00:00
static MenuOption_t MEO_JOYSTICKAXIS_ANALOG = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_JOYSTICKAXIS_ANALOG , NULL ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_JOYSTICKAXIS_ANALOG = MAKE_MENUENTRY ( " Analog " , & MF_Redfont , & MEF_BigSliders , & MEO_JOYSTICKAXIS_ANALOG , Option ) ;
2019-08-10 23:29:27 +00:00
static MenuRangeInt32_t MEO_JOYSTICKAXIS_SCALE = MAKE_MENURANGE ( NULL , & MF_Bluefont , - 262144 , 262144 , 65536 , 161 , 3 ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_JOYSTICKAXIS_SCALE = MAKE_MENUENTRY ( " Scale " , & MF_Redfont , & MEF_BigSliders , & MEO_JOYSTICKAXIS_SCALE , RangeInt32 ) ;
2019-08-14 03:03:57 +00:00
static MenuOption_t MEO_JOYSTICKAXIS_INVERT = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , NULL ) ;
static MenuEntry_t ME_JOYSTICKAXIS_INVERT = MAKE_MENUENTRY ( " Invert " , & MF_Redfont , & MEF_BigSliders , & MEO_JOYSTICKAXIS_INVERT , Option ) ;
2019-08-10 23:29:27 +00:00
static MenuRangeInt32_t MEO_JOYSTICKAXIS_DEAD = MAKE_MENURANGE ( NULL , & MF_Bluefont , 0 , 10000 , 0 , 101 , 2 ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_JOYSTICKAXIS_DEAD = MAKE_MENUENTRY ( " Dead Zone " , & MF_Redfont , & MEF_BigSliders , & MEO_JOYSTICKAXIS_DEAD , RangeInt32 ) ;
2019-08-10 23:29:27 +00:00
static MenuRangeInt32_t MEO_JOYSTICKAXIS_SATU = MAKE_MENURANGE ( NULL , & MF_Bluefont , 0 , 10000 , 0 , 101 , 2 ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_JOYSTICKAXIS_SATU = MAKE_MENUENTRY ( " Saturation " , & MF_Redfont , & MEF_BigSliders , & MEO_JOYSTICKAXIS_SATU , RangeInt32 ) ;
2014-05-31 12:26:41 +00:00
static MenuOption_t MEO_JOYSTICKAXIS_DIGITALNEGATIVE = MAKE_MENUOPTION ( & MF_Minifont , & MEOS_Gamefuncs , NULL ) ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_JOYSTICKAXIS_DIGITALNEGATIVE = MAKE_MENUENTRY ( " Digital - " , & MF_Bluefont , & MEF_BigSliders , & MEO_JOYSTICKAXIS_DIGITALNEGATIVE , Option ) ;
2014-05-31 12:26:41 +00:00
static MenuOption_t MEO_JOYSTICKAXIS_DIGITALPOSITIVE = MAKE_MENUOPTION ( & MF_Minifont , & MEOS_Gamefuncs , NULL ) ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_JOYSTICKAXIS_DIGITALPOSITIVE = MAKE_MENUENTRY ( " Digital + " , & MF_Bluefont , & MEF_BigSliders , & MEO_JOYSTICKAXIS_DIGITALPOSITIVE , Option ) ;
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_JOYSTICKAXIS [ ] = {
& ME_JOYSTICKAXIS_ANALOG ,
& ME_JOYSTICKAXIS_SCALE ,
2019-08-14 03:03:57 +00:00
& ME_JOYSTICKAXIS_INVERT ,
2014-05-31 12:26:41 +00:00
& ME_JOYSTICKAXIS_DEAD ,
& ME_JOYSTICKAXIS_SATU ,
2017-06-19 23:06:37 +00:00
& ME_Space8_Redfont ,
2014-11-30 02:04:36 +00:00
& ME_JOYSTICKAXIS_DIGITALNEGATIVE ,
& ME_JOYSTICKAXIS_DIGITALPOSITIVE ,
2014-05-31 12:26:41 +00:00
} ;
2006-04-13 20:47:06 +00:00
2014-11-30 02:04:36 +00:00
static MenuEntry_t * MEL_INTERNAL_JOYSTICKAXIS_DIGITAL [ ] = {
2014-05-31 12:26:41 +00:00
& ME_JOYSTICKAXIS_DIGITALNEGATIVE ,
& ME_JOYSTICKAXIS_DIGITALPOSITIVE ,
} ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
# ifdef USE_OPENGL
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_RENDERERSETUP_HIGHTILE = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_NoYes , & hw_hightile ) ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_RENDERERSETUP_HIGHTILE = MAKE_MENUENTRY ( " True color textures: " , & MF_Bluefont , & MEF_SmallOptions , & MEO_RENDERERSETUP_HIGHTILE , Option ) ;
2015-10-24 00:30:35 +00:00
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_RENDERERSETUP_PRECACHE = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_OffOn , & r_precache ) ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_RENDERERSETUP_PRECACHE = MAKE_MENUENTRY ( " Pre-load map textures: " , & MF_Bluefont , & MEF_SmallOptions , & MEO_RENDERERSETUP_PRECACHE , Option ) ;
2016-01-08 01:33:20 +00:00
# ifndef EDUKE32_GLES
2016-01-11 05:06:10 +00:00
static char const * MEOSN_RENDERERSETUP_TEXCACHE [ ] = { " Off " , " On " , " Compr. " , } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_RENDERERSETUP_TEXCACHE = MAKE_MENUOPTIONSET ( MEOSN_RENDERERSETUP_TEXCACHE , NULL , 0x2 ) ;
2016-01-08 01:33:20 +00:00
# endif
# ifdef USE_GLEXT
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_RENDERERSETUP_DETAILTEX = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_NoYes , & hw_detailmapping ) ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_RENDERERSETUP_DETAILTEX = MAKE_MENUENTRY ( " Detail textures: " , & MF_Bluefont , & MEF_SmallOptions , & MEO_RENDERERSETUP_DETAILTEX , Option ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_RENDERERSETUP_GLOWTEX = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_NoYes , & hw_glowmapping ) ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_RENDERERSETUP_GLOWTEX = MAKE_MENUENTRY ( " Glow textures: " , & MF_Bluefont , & MEF_SmallOptions , & MEO_RENDERERSETUP_GLOWTEX , Option ) ;
2016-01-08 01:33:20 +00:00
# endif
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_RENDERERSETUP_MODELS = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_NoYes , & hw_models ) ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_RENDERERSETUP_MODELS = MAKE_MENUENTRY ( " 3D models: " , & MF_Bluefont , & MEF_SmallOptions , & MEO_RENDERERSETUP_MODELS , Option ) ;
2014-05-31 12:26:41 +00:00
# endif
2015-10-24 00:30:35 +00:00
2010-08-02 08:13:51 +00:00
2014-05-31 12:26:41 +00:00
# ifdef USE_OPENGL
2015-10-24 00:30:35 +00:00
static MenuEntry_t * MEL_RENDERERSETUP_POLYMOST [ ] = {
2014-05-31 12:26:41 +00:00
& ME_RENDERERSETUP_HIGHTILE ,
& ME_RENDERERSETUP_PRECACHE ,
2016-01-08 01:33:20 +00:00
# ifdef USE_GLEXT
2014-05-31 12:26:41 +00:00
& ME_RENDERERSETUP_DETAILTEX ,
2015-10-24 00:30:35 +00:00
& ME_RENDERERSETUP_GLOWTEX ,
2016-01-08 01:33:20 +00:00
# endif
2017-06-19 23:06:37 +00:00
& ME_Space4_Bluefont ,
2014-05-31 12:26:41 +00:00
& ME_RENDERERSETUP_MODELS ,
2015-10-24 00:30:35 +00:00
} ;
# endif
2006-04-13 20:47:06 +00:00
2019-11-09 18:15:03 +00:00
static MenuRangeFloat_t MEO_COLCORR_GAMMA = MAKE_MENURANGE ( & vid_gamma , & MF_Bluefont , 0.3f , 4.f , 0.f , 75 , 1 ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_COLCORR_GAMMA = MAKE_MENUENTRY ( " Gamma: " , & MF_Redfont , & MEF_ColorCorrect , & MEO_COLCORR_GAMMA , RangeFloat ) ;
2019-11-09 18:15:03 +00:00
static MenuRangeFloat_t MEO_COLCORR_CONTRAST = MAKE_MENURANGE ( & vid_contrast , & MF_Bluefont , 0.1f , 2.7f , 0.f , 53 , 1 ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_COLCORR_CONTRAST = MAKE_MENUENTRY ( " Contrast: " , & MF_Redfont , & MEF_ColorCorrect , & MEO_COLCORR_CONTRAST , RangeFloat ) ;
2019-11-09 18:15:03 +00:00
static MenuRangeFloat_t MEO_COLCORR_BRIGHTNESS = MAKE_MENURANGE ( & vid_brightness , & MF_Bluefont , - 0.8f , 0.8f , 0.f , 33 , 1 ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_COLCORR_BRIGHTNESS = MAKE_MENUENTRY ( " Brightness: " , & MF_Redfont , & MEF_ColorCorrect , & MEO_COLCORR_BRIGHTNESS , RangeFloat ) ;
2019-08-13 09:16:02 +00:00
static MenuLink_t MEO_COLCORR_RESET = { MENU_COLCORRRESETVERIFY , MA_None , } ;
static MenuEntry_t ME_COLCORR_RESET = MAKE_MENUENTRY ( " Reset To Defaults " , & MF_Redfont , & MEF_ColorCorrect , & MEO_COLCORR_RESET , Link ) ;
2017-01-18 22:21:40 +00:00
# ifdef EDUKE32_ANDROID_MENU
2015-02-11 05:22:32 +00:00
# define MINVIS 1.f
# else
# define MINVIS 0.125f
# endif
2017-07-07 22:50:42 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2019-11-09 18:15:03 +00:00
static MenuRangeFloat_t MEO_COLCORR_AMBIENT = MAKE_MENURANGE ( & r_ambientlight , & MF_Bluefont , MINVIS , 4.f , 0.f , 32 , 1 ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_COLCORR_AMBIENT = MAKE_MENUENTRY ( " Visibility: " , & MF_Redfont , & MEF_ColorCorrect , & MEO_COLCORR_AMBIENT , RangeFloat ) ;
2017-07-07 22:50:42 +00:00
# endif
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_COLCORR [ ] = {
& ME_COLCORR_GAMMA ,
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_ANDROID_MENU
2014-05-31 12:26:41 +00:00
& ME_COLCORR_CONTRAST ,
& ME_COLCORR_BRIGHTNESS ,
2014-09-30 04:07:29 +00:00
# endif
2017-07-07 22:50:42 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-12-27 18:35:34 +00:00
& ME_COLCORR_AMBIENT ,
2017-07-07 22:50:42 +00:00
# endif
2017-06-19 23:06:37 +00:00
& ME_Space8_Redfont ,
2014-05-31 12:26:41 +00:00
& ME_COLCORR_RESET ,
} ;
2012-10-14 22:16:07 +00:00
2014-11-30 02:04:36 +00:00
static MenuEntry_t * MEL_SCREENSETUP [ ] = {
2018-01-26 04:34:57 +00:00
# ifdef EDUKE32_ANDROID_MENU
& ME_SCREENSETUP_STATUSBARONTOP ,
# endif
2018-02-13 00:13:06 +00:00
& ME_SCREENSETUP_SCREENSIZE ,
2014-12-27 18:35:34 +00:00
& ME_SCREENSETUP_SBARSIZE ,
2014-09-30 04:07:29 +00:00
2014-12-27 18:35:34 +00:00
& ME_SCREENSETUP_CROSSHAIR ,
& ME_SCREENSETUP_CROSSHAIRSIZE ,
2014-09-30 04:07:29 +00:00
2014-12-27 18:35:34 +00:00
& ME_SCREENSETUP_LEVELSTATS ,
& ME_SCREENSETUP_TEXTSIZE ,
2014-09-30 04:07:29 +00:00
2014-12-27 18:35:34 +00:00
& ME_SCREENSETUP_SHOWPICKUPMESSAGES ,
2014-09-30 04:07:29 +00:00
} ;
2014-05-31 12:26:41 +00:00
// Save and load will be filled in before every viewing of the save/load screen.
2017-07-06 14:43:07 +00:00
static MenuLink_t MEO_LOAD = { MENU_LOADVERIFY , MA_None , } ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_LOAD_TEMPLATE = MAKE_MENUENTRY ( NULL , & MF_Minifont , & MEF_LoadSave , & MEO_LOAD , Link ) ;
static MenuEntry_t ME_LOAD_EMPTY = MAKE_MENUENTRY ( NULL , & MF_Minifont , & MEF_LoadSave , nullptr , Dummy ) ;
2017-12-18 11:24:53 +00:00
static MenuEntry_t * ME_LOAD ;
static MenuEntry_t * * MEL_LOAD ;
2014-05-31 12:26:41 +00:00
2017-12-18 11:24:53 +00:00
static char const s_NewSaveGame [ ] = " (New Save Game) " ;
2018-01-29 02:14:16 +00:00
static MenuString_t MEO_SAVE_TEMPLATE = MAKE_MENUSTRING ( NULL , & MF_Minifont , MAXSAVEGAMENAME , 0 ) ;
static MenuString_t MEO_SAVE_NEW = MAKE_MENUSTRING ( NULL , & MF_Minifont , MAXSAVEGAMENAME , 0 ) ;
2017-12-18 11:24:53 +00:00
static MenuString_t * MEO_SAVE ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_SAVE_TEMPLATE = MAKE_MENUENTRY ( NULL , & MF_Minifont , & MEF_LoadSave , & MEO_SAVE_TEMPLATE , String ) ;
static MenuEntry_t ME_SAVE_NEW = MAKE_MENUENTRY ( s_NewSaveGame , & MF_Minifont , & MEF_LoadSave , & MEO_SAVE_NEW , String ) ;
2017-12-18 11:24:53 +00:00
static MenuEntry_t * ME_SAVE ;
static MenuEntry_t * * MEL_SAVE ;
2014-05-31 12:26:41 +00:00
2019-11-09 18:15:03 +00:00
CVAR_UNAMED ( Int , soundrate )
CVAR_UNAMED ( Int , soundvoices )
CVAR_UNAMED ( Int , musicdevice )
static MenuOption_t MEO_SOUND = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & snd_enabled ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_SOUND = MAKE_MENUENTRY ( " Sound: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SOUND , Option ) ;
2014-09-30 04:07:29 +00:00
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_SOUND_MUSIC = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & mus_enabled ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_SOUND_MUSIC = MAKE_MENUENTRY ( " Music: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SOUND_MUSIC , Option ) ;
2014-09-30 04:07:29 +00:00
2019-08-15 04:39:35 +00:00
static char const s_Volume [ ] = " Volume: " ;
2019-11-09 18:15:03 +00:00
static MenuRangeInt32_t MEO_SOUND_VOLUME_FX = MAKE_MENURANGE ( & snd_fxvolume , & MF_Redfont , 0 , 255 , 0 , 33 , 2 ) ;
2019-08-15 04:39:35 +00:00
static MenuEntry_t ME_SOUND_VOLUME_FX = MAKE_MENUENTRY ( s_Volume , & MF_Redfont , & MEF_BigOptions_Apply , & MEO_SOUND_VOLUME_FX , RangeInt32 ) ;
2014-09-30 04:07:29 +00:00
2019-11-09 18:15:03 +00:00
static MenuRangeInt32_t MEO_SOUND_VOLUME_MUSIC = MAKE_MENURANGE ( & mus_volume , & MF_Redfont , 0 , 255 , 0 , 33 , 2 ) ;
2019-08-15 04:39:35 +00:00
static MenuEntry_t ME_SOUND_VOLUME_MUSIC = MAKE_MENUENTRY ( s_Volume , & MF_Redfont , & MEF_BigOptions_Apply , & MEO_SOUND_VOLUME_MUSIC , RangeInt32 ) ;
2014-09-30 04:07:29 +00:00
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_STANDALONE
2019-03-19 17:08:00 +00:00
static MenuOption_t MEO_SOUND_DUKETALK = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_NoYes , NULL ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_SOUND_DUKETALK = MAKE_MENUENTRY ( " Duke talk: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SOUND_DUKETALK , Option ) ;
2017-01-18 22:21:40 +00:00
# else
2019-03-19 17:08:00 +00:00
static MenuOption_t MEO_SOUND_DUKETALK = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_YesNo , NULL ) ;
static MenuEntry_t ME_SOUND_DUKETALK = MAKE_MENUENTRY ( " Silent protagonist: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SOUND_DUKETALK , Option ) ;
2017-01-18 22:21:40 +00:00
# endif
2014-09-30 04:07:29 +00:00
2016-01-11 05:06:10 +00:00
static char const * MEOSN_SOUND_SAMPLINGRATE [ ] = { " 22050Hz " , " 44100Hz " , " 48000Hz " , } ;
2014-09-30 04:07:29 +00:00
static int32_t MEOSV_SOUND_SAMPLINGRATE [ ] = { 22050 , 44100 , 48000 , } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_SOUND_SAMPLINGRATE = MAKE_MENUOPTIONSET ( MEOSN_SOUND_SAMPLINGRATE , MEOSV_SOUND_SAMPLINGRATE , 0x3 ) ;
static MenuOption_t MEO_SOUND_SAMPLINGRATE = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_SOUND_SAMPLINGRATE , & soundrate ) ;
static MenuEntry_t ME_SOUND_SAMPLINGRATE = MAKE_MENUENTRY ( " Sample rate: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SOUND_SAMPLINGRATE , Option ) ;
2014-09-30 04:07:29 +00:00
2017-07-27 20:05:48 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2019-10-20 03:13:19 +00:00
static MenuRangeInt32_t MEO_SOUND_NUMVOICES = MAKE_MENURANGE ( & soundvoices , & MF_Redfont , 16 , 128 , 0 , 8 , 1 ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_SOUND_NUMVOICES = MAKE_MENUENTRY ( " Voices: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SOUND_NUMVOICES , RangeInt32 ) ;
2017-07-27 09:13:09 +00:00
# endif
2014-09-30 04:07:29 +00:00
2019-10-24 05:47:11 +00:00
static char const * MEOSN_SOUND_MIDIDRIVER [ ] = {
2019-10-19 23:48:20 +00:00
" OPL3 " ,
2019-10-19 23:48:08 +00:00
# ifdef _WIN32
" Windows " ,
# endif
} ;
2019-10-24 05:47:11 +00:00
static int32_t MEOSV_SOUND_MIDIDRIVER [ ] = {
2019-10-19 23:48:20 +00:00
ASS_OPL3 ,
2019-10-19 23:48:08 +00:00
# ifdef _WIN32
ASS_WinMM ,
# endif
} ;
2019-10-24 05:47:11 +00:00
static MenuOptionSet_t MEOS_SOUND_MIDIDRIVER = MAKE_MENUOPTIONSET ( MEOSN_SOUND_MIDIDRIVER , MEOSV_SOUND_MIDIDRIVER , 0x2 ) ;
static MenuOption_t MEO_SOUND_MIDIDRIVER = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_SOUND_MIDIDRIVER , & musicdevice ) ;
static MenuEntry_t ME_SOUND_MIDIDRIVER = MAKE_MENUENTRY ( " MIDI driver: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SOUND_MIDIDRIVER , Option ) ;
2019-10-19 23:48:08 +00:00
2017-07-27 09:13:09 +00:00
static MenuEntry_t ME_SOUND_RESTART = MAKE_MENUENTRY ( " Apply Changes " , & MF_Redfont , & MEF_BigOptions_Apply , & MEO_NULL , Link ) ;
2014-09-30 04:07:29 +00:00
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-10-27 10:14:50 +00:00
static MenuLink_t MEO_ADVSOUND = { MENU_ADVSOUND , MA_Advance , } ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_SOUND_ADVSOUND = MAKE_MENUENTRY ( " Advanced " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_ADVSOUND , Link ) ;
2014-10-16 22:21:00 +00:00
# endif
2014-05-31 12:26:41 +00:00
2014-11-30 02:04:36 +00:00
static MenuEntry_t * MEL_SOUND [ ] = {
2014-05-31 12:26:41 +00:00
& ME_SOUND ,
2018-10-25 23:32:50 +00:00
& ME_SOUND_VOLUME_FX ,
2019-08-15 04:39:35 +00:00
& ME_SOUND_MUSIC ,
2014-12-27 18:35:34 +00:00
& ME_SOUND_VOLUME_MUSIC ,
2014-05-31 12:26:41 +00:00
& ME_SOUND_DUKETALK ,
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-12-27 18:35:34 +00:00
& ME_SOUND_ADVSOUND ,
2014-09-30 04:07:29 +00:00
# endif
2014-05-31 12:26:41 +00:00
} ;
2012-10-14 22:16:07 +00:00
2014-11-30 02:04:36 +00:00
static MenuEntry_t * MEL_ADVSOUND [ ] = {
2014-12-27 18:35:34 +00:00
& ME_SOUND_SAMPLINGRATE ,
2017-06-19 23:06:37 +00:00
& ME_Space2_Redfont ,
2017-07-27 20:05:48 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-12-27 18:35:34 +00:00
& ME_SOUND_NUMVOICES ,
2017-06-19 23:06:37 +00:00
& ME_Space2_Redfont ,
2017-07-27 09:13:09 +00:00
# endif
2019-10-24 05:47:11 +00:00
& ME_SOUND_MIDIDRIVER ,
2014-12-27 18:35:34 +00:00
& ME_SOUND_RESTART ,
2014-05-31 12:26:41 +00:00
} ;
2006-04-13 20:47:06 +00:00
2018-03-08 03:55:12 +00:00
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_SAVESETUP_AUTOSAVE = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_OffOn , & cl_autosave ) ;
2019-07-13 21:26:02 +00:00
static MenuEntry_t ME_SAVESETUP_AUTOSAVE = MAKE_MENUENTRY ( " Checkpoints: " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_SAVESETUP_AUTOSAVE , Option ) ;
2018-03-08 03:55:12 +00:00
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_SAVESETUP_AUTOSAVEDELETION = MAKE_MENUOPTION ( & MF_Redfont , & MEOS_NoYes , & cl_autosavedeletion ) ;
2018-03-08 03:55:36 +00:00
static MenuEntry_t ME_SAVESETUP_AUTOSAVEDELETION = MAKE_MENUENTRY ( " Auto-Delete: " , & MF_Redfont , & MEF_BigOptions_Apply , & MEO_SAVESETUP_AUTOSAVEDELETION , Option ) ;
2019-11-09 18:15:03 +00:00
static MenuRangeInt32_t MEO_SAVESETUP_MAXAUTOSAVES = MAKE_MENURANGE ( & cl_maxautosaves , & MF_Redfont , 1 , 10 , 0 , 10 , 1 ) ;
2018-03-08 03:55:36 +00:00
static MenuEntry_t ME_SAVESETUP_MAXAUTOSAVES = MAKE_MENUENTRY ( " Limit: " , & MF_Redfont , & MEF_BigOptions_Apply , & MEO_SAVESETUP_MAXAUTOSAVES , RangeInt32 ) ;
2018-03-08 03:55:41 +00:00
static MenuEntry_t ME_SAVESETUP_CLEANUP = MAKE_MENUENTRY ( " Clean Up Saves " , & MF_Redfont , & MEF_BigOptionsRt , & MEO_NULL , Link ) ;
2018-03-08 03:55:12 +00:00
static MenuEntry_t * MEL_SAVESETUP [ ] = {
& ME_SAVESETUP_AUTOSAVE ,
2018-03-08 03:55:36 +00:00
& ME_SAVESETUP_AUTOSAVEDELETION ,
& ME_SAVESETUP_MAXAUTOSAVES ,
2018-03-08 03:55:41 +00:00
& ME_SAVESETUP_CLEANUP ,
2018-03-08 03:55:12 +00:00
} ;
2014-11-30 02:04:36 +00:00
MAKE_MENU_TOP_ENTRYLINK ( " Player Setup " , MEF_CenterMenu , NETWORK_PLAYERSETUP , MENU_PLAYER ) ;
MAKE_MENU_TOP_ENTRYLINK ( " Join Game " , MEF_CenterMenu , NETWORK_JOINGAME , MENU_NETJOIN ) ;
MAKE_MENU_TOP_ENTRYLINK ( " Host Game " , MEF_CenterMenu , NETWORK_HOSTGAME , MENU_NETHOST ) ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_NETWORK [ ] = {
& ME_NETWORK_PLAYERSETUP ,
& ME_NETWORK_JOINGAME ,
& ME_NETWORK_HOSTGAME ,
} ;
2006-04-13 20:47:06 +00:00
2019-10-27 13:09:56 +00:00
//static MenuString_t MEO_PLAYER_NAME = MAKE_MENUSTRING( playername, &MF_Bluefont, MAXPLAYERNAME, 0 );
//static MenuEntry_t ME_PLAYER_NAME = MAKE_MENUENTRY( "Name", &MF_Bluefont, &MEF_PlayerNarrow, &MEO_PLAYER_NAME, String );
2016-01-11 05:06:10 +00:00
static char const * MEOSN_PLAYER_COLOR [ ] = { " Auto " , " Blue " , " Red " , " Green " , " Gray " , " Dark gray " , " Dark green " , " Brown " , " Dark blue " , " Bright red " , " Yellow " , } ;
2014-12-18 18:14:27 +00:00
static int32_t MEOSV_PLAYER_COLOR [ ] = { 0 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 21 , 23 , } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_PLAYER_COLOR = MAKE_MENUOPTIONSET ( MEOSN_PLAYER_COLOR , MEOSV_PLAYER_COLOR , 0x2 ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_PLAYER_COLOR = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_PLAYER_COLOR , & playercolor ) ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_PLAYER_COLOR = MAKE_MENUENTRY ( " Color " , & MF_Bluefont , & MEF_PlayerNarrow , & MEO_PLAYER_COLOR , Option ) ;
2016-01-11 05:06:10 +00:00
static char const * MEOSN_PLAYER_TEAM [ ] = { " Blue " , " Red " , " Green " , " Gray " , } ;
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_PLAYER_TEAM = MAKE_MENUOPTIONSET ( MEOSN_PLAYER_TEAM , NULL , 0x2 ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_PLAYER_TEAM = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_PLAYER_TEAM , & playerteam ) ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_PLAYER_TEAM = MAKE_MENUENTRY ( " Team " , & MF_Bluefont , & MEF_PlayerNarrow , & MEO_PLAYER_TEAM , Option ) ;
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-10-27 10:14:50 +00:00
static MenuLink_t MEO_PLAYER_MACROS = { MENU_MACROS , MA_Advance , } ;
2018-01-29 02:14:16 +00:00
static MenuEntry_t ME_PLAYER_MACROS = MAKE_MENUENTRY ( " Multiplayer macros " , & MF_Bluefont , & MEF_SmallOptions , & MEO_PLAYER_MACROS , Link ) ;
2014-10-25 10:16:49 +00:00
# endif
2014-05-31 12:26:41 +00:00
2014-11-30 02:04:36 +00:00
static MenuEntry_t * MEL_PLAYER [ ] = {
2019-10-27 13:09:56 +00:00
//&ME_PLAYER_NAME,
2017-06-19 23:06:37 +00:00
& ME_Space4_Bluefont ,
2014-05-31 12:26:41 +00:00
& ME_PLAYER_COLOR ,
2017-06-19 23:06:37 +00:00
& ME_Space4_Bluefont ,
2014-05-31 12:26:41 +00:00
& ME_PLAYER_TEAM ,
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2017-06-19 23:06:37 +00:00
& ME_Space8_Bluefont ,
2014-05-31 12:26:41 +00:00
& ME_PLAYER_MACROS ,
2014-10-25 10:16:49 +00:00
# endif
2014-11-30 02:04:36 +00:00
} ;
2006-04-13 20:47:06 +00:00
2019-10-27 07:14:58 +00:00
# define MAXRIDECULE 10
# define MAXRIDECULELENGTH 40
2014-11-30 02:04:36 +00:00
static MenuString_t MEO_MACROS_TEMPLATE = MAKE_MENUSTRING ( NULL , & MF_Bluefont , MAXRIDECULELENGTH , 0 ) ;
2017-12-18 11:24:53 +00:00
static MenuString_t MEO_MACROS [ 10 ] ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_MACROS_TEMPLATE = MAKE_MENUENTRY ( NULL , & MF_Bluefont , & MEF_Macros , & MEO_MACROS_TEMPLATE , String ) ;
2019-10-27 07:14:58 +00:00
static char sink [ 50 ] ;
2014-05-31 12:26:41 +00:00
static MenuEntry_t ME_MACROS [ MAXRIDECULE ] ;
static MenuEntry_t * MEL_MACROS [ MAXRIDECULE ] ;
2006-04-13 20:47:06 +00:00
2017-08-04 23:06:37 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2016-01-11 05:06:10 +00:00
static char const * MenuUserMap = " User Map " ;
2017-08-04 23:06:37 +00:00
# endif
2016-01-11 05:06:10 +00:00
static char const * MenuSkillNone = " None " ;
2006-04-18 19:23:53 +00:00
2016-01-11 05:06:10 +00:00
static char const * MEOSN_NetGametypes [ MAXGAMETYPES ] ;
static char const * MEOSN_NetEpisodes [ MAXVOLUMES + 1 ] ;
2015-02-22 22:15:20 +00:00
static int32_t MEOSV_NetEpisodes [ MAXVOLUMES + 1 ] ;
2016-01-11 05:06:10 +00:00
static char const * MEOSN_NetLevels [ MAXVOLUMES ] [ MAXLEVELS ] ;
static char const * MEOSN_NetSkills [ MAXSKILLS + 1 ] ;
2006-04-18 19:23:53 +00:00
2014-12-18 18:14:45 +00:00
static MenuLink_t MEO_NETHOST_OPTIONS = { MENU_NETOPTIONS , MA_Advance , } ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_NETHOST_OPTIONS = MAKE_MENUENTRY ( " Game Options " , & MF_Redfont , & MEF_VideoSetup , & MEO_NETHOST_OPTIONS , Link ) ;
static MenuEntry_t ME_NETHOST_LAUNCH = MAKE_MENUENTRY ( " Launch Game " , & MF_Redfont , & MEF_VideoSetup , & MEO_NULL , Link ) ;
2011-12-21 18:41:38 +00:00
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_NETHOST [ ] = {
& ME_NETHOST_OPTIONS ,
& ME_NETHOST_LAUNCH ,
} ;
2011-12-21 18:41:38 +00:00
2014-11-30 02:04:36 +00:00
static MenuOptionSet_t MEOS_NETOPTIONS_GAMETYPE = MAKE_MENUOPTIONSET ( MEOSN_NetGametypes , NULL , 0x0 ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_NETOPTIONS_GAMETYPE = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_NETOPTIONS_GAMETYPE , & m_coop ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_NETOPTIONS_GAMETYPE = MAKE_MENUENTRY ( " Game Type " , & MF_Redfont , & MEF_NetSetup , & MEO_NETOPTIONS_GAMETYPE , Option ) ;
2015-02-22 22:15:20 +00:00
static MenuOptionSet_t MEOS_NETOPTIONS_EPISODE = MAKE_MENUOPTIONSET ( MEOSN_NetEpisodes , MEOSV_NetEpisodes , 0x0 ) ;
2019-11-09 18:15:03 +00:00
CVAR_UNAMED ( Int , NetEpisode ) ;
2015-02-22 22:15:20 +00:00
static MenuOption_t MEO_NETOPTIONS_EPISODE = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_NETOPTIONS_EPISODE , & NetEpisode ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_NETOPTIONS_EPISODE = MAKE_MENUENTRY ( " Episode " , & MF_Redfont , & MEF_NetSetup , & MEO_NETOPTIONS_EPISODE , Option ) ;
2015-02-22 22:15:35 +00:00
static MenuOptionSet_t MEOS_NETOPTIONS_LEVEL_TEMPLATE = MAKE_MENUOPTIONSETNULL ;
2014-05-31 12:26:41 +00:00
static MenuOptionSet_t MEOS_NETOPTIONS_LEVEL [ MAXVOLUMES ] ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_NETOPTIONS_LEVEL = MAKE_MENUOPTION ( & MF_Bluefont , NULL , & m_level_number ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_NETOPTIONS_LEVEL = MAKE_MENUENTRY ( " Level " , & MF_Redfont , & MEF_NetSetup , & MEO_NETOPTIONS_LEVEL , Option ) ;
2014-12-18 18:14:45 +00:00
static MenuLink_t MEO_NETOPTIONS_USERMAP = { MENU_NETUSERMAP , MA_Advance , } ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_NETOPTIONS_USERMAP = MAKE_MENUENTRY ( " User Map " , & MF_Redfont , & MEF_NetSetup , & MEO_NETOPTIONS_USERMAP , Link ) ;
static MenuOptionSet_t MEOS_NETOPTIONS_MONSTERS = MAKE_MENUOPTIONSET ( MEOSN_NetSkills , NULL , 0x0 ) ;
2014-05-31 12:26:41 +00:00
static MenuOption_t MEO_NETOPTIONS_MONSTERS = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_NETOPTIONS_MONSTERS , NULL ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_NETOPTIONS_MONSTERS = MAKE_MENUENTRY ( " Monsters " , & MF_Redfont , & MEF_NetSetup , & MEO_NETOPTIONS_MONSTERS , Option ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_NETOPTIONS_MARKERS = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_OffOn , & m_marker ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_NETOPTIONS_MARKERS = MAKE_MENUENTRY ( " Markers " , & MF_Redfont , & MEF_NetSetup , & MEO_NETOPTIONS_MARKERS , Option ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_NETOPTIONS_MAPEXITS = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_OnOff , & m_noexits ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_NETOPTIONS_MAPEXITS = MAKE_MENUENTRY ( " Map Exits " , & MF_Redfont , & MEF_NetSetup , & MEO_NETOPTIONS_MAPEXITS , Option ) ;
2019-11-09 18:15:03 +00:00
static MenuOption_t MEO_NETOPTIONS_FRFIRE = MAKE_MENUOPTION ( & MF_Bluefont , & MEOS_OffOn , & m_ffire ) ;
2014-11-30 02:04:36 +00:00
static MenuEntry_t ME_NETOPTIONS_FRFIRE = MAKE_MENUENTRY ( " Fr. Fire " , & MF_Redfont , & MEF_NetSetup , & MEO_NETOPTIONS_FRFIRE , Option ) ;
2018-12-08 00:40:39 +00:00
static MenuEntry_t ME_NETOPTIONS_ACCEPT = MAKE_MENUENTRY ( " Accept " , & MF_Redfont , & MEF_NetSetup_Confirm , & MEO_NETWORK_HOSTGAME , Link ) ;
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_NETOPTIONS [ ] = {
& ME_NETOPTIONS_GAMETYPE ,
& ME_NETOPTIONS_EPISODE ,
& ME_NETOPTIONS_LEVEL ,
& ME_NETOPTIONS_MONSTERS ,
& ME_NETOPTIONS_MARKERS ,
& ME_NETOPTIONS_MAPEXITS ,
& ME_NETOPTIONS_ACCEPT ,
} ;
2011-12-21 18:41:38 +00:00
2014-05-31 12:26:41 +00:00
static char MenuServer [ BMAX_PATH ] = " localhost " ;
2014-11-30 02:04:36 +00:00
static MenuString_t MEO_NETJOIN_SERVER = MAKE_MENUSTRING ( MenuServer , & MF_Bluefont , BMAX_PATH , 0 ) ;
static MenuEntry_t ME_NETJOIN_SERVER = MAKE_MENUENTRY ( " Server " , & MF_Redfont , & MEF_VideoSetup , & MEO_NETJOIN_SERVER , String ) ;
2014-05-31 12:26:41 +00:00
# define MAXPORTSTRINGLENGTH 6 // unsigned 16-bit integer
static char MenuPort [ MAXPORTSTRINGLENGTH ] = " 19014 " ;
2014-11-30 02:04:36 +00:00
static MenuString_t MEO_NETJOIN_PORT = MAKE_MENUSTRING ( MenuPort , & MF_Bluefont , MAXPORTSTRINGLENGTH , INPUT_NUMERIC ) ;
static MenuEntry_t ME_NETJOIN_PORT = MAKE_MENUENTRY ( " Port " , & MF_Redfont , & MEF_VideoSetup , & MEO_NETJOIN_PORT , String ) ;
2017-06-19 23:07:12 +00:00
static MenuEntry_t ME_NETJOIN_CONNECT = MAKE_MENUENTRY ( " Connect " , & MF_Redfont , & MEF_VideoSetup_Apply , & MEO_NULL , Link ) ;
2014-05-31 12:26:41 +00:00
static MenuEntry_t * MEL_NETJOIN [ ] = {
& ME_NETJOIN_SERVER ,
& ME_NETJOIN_PORT ,
& ME_NETJOIN_CONNECT ,
} ;
2012-10-14 22:16:07 +00:00
2014-05-31 12:26:41 +00:00
# define NoTitle NULL
2016-04-06 03:07:47 +00:00
# define MAKE_MENUMENU(Title, Format, Entries) { Title, Format, Entries, ARRAY_SIZE(Entries), 0, 0, 0 }
2017-12-18 11:24:53 +00:00
# define MAKE_MENUMENU_CUSTOMSIZE(Title, Format, Entries) { Title, Format, Entries, 0, 0, 0, 0 }
2014-11-30 02:04:36 +00:00
static MenuMenu_t M_MAIN = MAKE_MENUMENU ( NoTitle , & MMF_Top_Main , MEL_MAIN ) ;
static MenuMenu_t M_MAIN_INGAME = MAKE_MENUMENU ( NoTitle , & MMF_Top_Main , MEL_MAIN_INGAME ) ;
static MenuMenu_t M_EPISODE = MAKE_MENUMENU ( " Select An Episode " , & MMF_Top_Episode , MEL_EPISODE ) ;
static MenuMenu_t M_SKILL = MAKE_MENUMENU ( " Select Skill " , & MMF_Top_Skill , MEL_SKILL ) ;
2019-08-09 08:21:19 +00:00
static MenuMenu_t M_NEWGAMECUSTOM = MAKE_MENUMENU ( s_NewGame , & MMF_Top_NewGameCustom , MEL_NEWGAMECUSTOM ) ;
static MenuMenu_t M_NEWGAMECUSTOMSUB = MAKE_MENUMENU ( s_NewGame , & MMF_Top_NewGameCustomSub , MEL_NEWGAMECUSTOMSUB ) ;
2017-07-31 03:14:51 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-11-30 02:04:36 +00:00
static MenuMenu_t M_GAMESETUP = MAKE_MENUMENU ( " Game Setup " , & MMF_BigOptions , MEL_GAMESETUP ) ;
2017-07-31 03:14:51 +00:00
# endif
2017-07-06 14:43:07 +00:00
static MenuMenu_t M_OPTIONS = MAKE_MENUMENU ( s_Options , & MMF_Top_Options , MEL_OPTIONS ) ;
2014-11-30 02:04:36 +00:00
static MenuMenu_t M_VIDEOSETUP = MAKE_MENUMENU ( " Video Mode " , & MMF_BigOptions , MEL_VIDEOSETUP ) ;
2019-11-09 21:22:51 +00:00
static MenuMenu_t M_KEYBOARDSETUP = MAKE_MENUMENU ( " Configure Controls " , & MMF_Top_Options , MEL_KEYBOARDSETUP ) ;
2019-08-12 15:36:36 +00:00
static MenuMenu_t M_CONTROLS = MAKE_MENUMENU ( " Control Setup " , & MMF_BigOptions , MEL_CONTROLS ) ;
2015-03-24 10:49:03 +00:00
static MenuMenu_t M_CHEATS = MAKE_MENUMENU ( " Cheats " , & MMF_SmallOptions , MEL_CHEATS ) ;
2014-11-30 02:04:36 +00:00
static MenuMenu_t M_MOUSESETUP = MAKE_MENUMENU ( " Mouse Setup " , & MMF_BigOptions , MEL_MOUSESETUP ) ;
2017-01-18 22:21:40 +00:00
# ifdef EDUKE32_ANDROID_MENU
2016-03-14 00:06:54 +00:00
static MenuMenu_t M_TOUCHSETUP = MAKE_MENUMENU ( " Touch Setup " , & MMF_Top_Options , MEL_TOUCHSETUP ) ;
static MenuMenu_t M_TOUCHSENS = MAKE_MENUMENU ( " Sensitivity " , & MMF_BigOptions , MEL_TOUCHSENS ) ;
2017-02-05 20:58:33 +00:00
static MenuPanel_t M_TOUCHBUTTONS = { " Button Setup " , MENU_TOUCHSETUP , MA_Return , MENU_TOUCHSETUP , MA_Advance , } ;
2015-02-11 05:22:32 +00:00
# endif
2019-08-13 10:25:35 +00:00
static MenuMenu_t M_JOYSTICKSETUP = MAKE_MENUMENU ( " Gamepad Setup " , & MMF_BigOptions , MEL_JOYSTICKSETUP ) ;
static MenuMenu_t M_JOYSTICKAXES = MAKE_MENUMENU ( " Gamepad Axes " , & MMF_BigSliders , MEL_JOYSTICKAXES ) ;
2017-07-05 05:42:29 +00:00
static MenuMenu_t M_KEYBOARDKEYS = MAKE_MENUMENU ( " Key Configuration " , & MMF_KeyboardSetupFuncs , MEL_KEYBOARDSETUPFUNCS ) ;
2014-11-30 02:04:36 +00:00
static MenuMenu_t M_MOUSEADVANCED = MAKE_MENUMENU ( " Advanced Mouse " , & MMF_BigSliders , MEL_MOUSEADVANCED ) ;
static MenuMenu_t M_JOYSTICKAXIS = MAKE_MENUMENU ( NULL , & MMF_BigSliders , MEL_JOYSTICKAXIS ) ;
2014-09-30 04:07:29 +00:00
# ifdef USE_OPENGL
2015-10-24 00:30:35 +00:00
static MenuMenu_t M_RENDERERSETUP_POLYMOST = MAKE_MENUMENU ( " Polymost Setup " , & MMF_SmallOptions , MEL_RENDERERSETUP_POLYMOST ) ;
2015-11-14 19:54:27 +00:00
# ifdef POLYMER
2015-10-24 00:30:35 +00:00
static MenuMenu_t M_RENDERERSETUP_POLYMER = MAKE_MENUMENU ( " Polymer Setup " , & MMF_SmallOptions , MEL_RENDERERSETUP_POLYMER ) ;
2015-11-14 19:54:27 +00:00
# endif
2014-09-30 04:07:29 +00:00
# endif
2014-11-30 02:04:36 +00:00
static MenuMenu_t M_COLCORR = MAKE_MENUMENU ( " Color Correction " , & MMF_ColorCorrect , MEL_COLCORR ) ;
2017-06-27 01:50:55 +00:00
static MenuMenu_t M_SCREENSETUP = MAKE_MENUMENU ( " HUD Setup " , & MMF_BigOptions , MEL_SCREENSETUP ) ;
2014-11-30 02:04:36 +00:00
static MenuMenu_t M_DISPLAYSETUP = MAKE_MENUMENU ( " Display Setup " , & MMF_BigOptions , MEL_DISPLAYSETUP ) ;
2017-12-18 11:24:53 +00:00
static MenuMenu_t M_LOAD = MAKE_MENUMENU_CUSTOMSIZE ( s_LoadGame , & MMF_LoadSave , MEL_LOAD ) ;
static MenuMenu_t M_SAVE = MAKE_MENUMENU_CUSTOMSIZE ( s_SaveGame , & MMF_LoadSave , MEL_SAVE ) ;
2014-11-30 02:04:36 +00:00
static MenuMenu_t M_SOUND = MAKE_MENUMENU ( " Sound Setup " , & MMF_BigOptions , MEL_SOUND ) ;
2014-12-18 18:14:45 +00:00
static MenuMenu_t M_ADVSOUND = MAKE_MENUMENU ( " Advanced Sound " , & MMF_BigOptions , MEL_ADVSOUND ) ;
2018-03-08 03:55:12 +00:00
static MenuMenu_t M_SAVESETUP = MAKE_MENUMENU ( " Save Setup " , & MMF_BigOptions , MEL_SAVESETUP ) ;
2014-11-30 02:04:36 +00:00
static MenuMenu_t M_NETWORK = MAKE_MENUMENU ( " Network Game " , & MMF_Top_Joystick_Network , MEL_NETWORK ) ;
static MenuMenu_t M_PLAYER = MAKE_MENUMENU ( " Player Setup " , & MMF_SmallOptions , MEL_PLAYER ) ;
static MenuMenu_t M_MACROS = MAKE_MENUMENU ( " Multiplayer Macros " , & MMF_Macros , MEL_MACROS ) ;
static MenuMenu_t M_NETHOST = MAKE_MENUMENU ( " Host Network Game " , & MMF_SmallOptionsNarrow , MEL_NETHOST ) ;
static MenuMenu_t M_NETOPTIONS = MAKE_MENUMENU ( " Net Game Options " , & MMF_NetSetup , MEL_NETOPTIONS ) ;
static MenuMenu_t M_NETJOIN = MAKE_MENUMENU ( " Join Network Game " , & MMF_SmallOptionsNarrow , MEL_NETJOIN ) ;
2014-05-31 12:26:41 +00:00
2017-01-18 22:21:40 +00:00
# ifdef EDUKE32_SIMPLE_MENU
2014-10-27 10:14:50 +00:00
static MenuPanel_t M_STORY = { NoTitle , MENU_STORY , MA_Return , MENU_STORY , MA_Advance , } ;
2014-09-30 04:07:29 +00:00
# else
2014-10-27 10:14:50 +00:00
static MenuPanel_t M_STORY = { NoTitle , MENU_F1HELP , MA_Return , MENU_F1HELP , MA_Advance , } ;
2014-09-30 04:07:29 +00:00
# endif
2014-10-27 10:14:50 +00:00
static MenuPanel_t M_F1HELP = { NoTitle , MENU_STORY , MA_Return , MENU_STORY , MA_Advance , } ;
static MenuPanel_t M_CREDITS = { NoTitle , MENU_CREDITS5 , MA_Return , MENU_CREDITS2 , MA_Advance , } ;
static MenuPanel_t M_CREDITS2 = { NoTitle , MENU_CREDITS , MA_Return , MENU_CREDITS3 , MA_Advance , } ;
static MenuPanel_t M_CREDITS3 = { NoTitle , MENU_CREDITS2 , MA_Return , MENU_CREDITS4 , MA_Advance , } ;
2017-01-18 22:21:40 +00:00
static MenuPanel_t M_CREDITS4 = { " About " APPNAME , MENU_CREDITS3 , MA_Return , MENU_CREDITS5 , MA_Advance , } ;
static MenuPanel_t M_CREDITS5 = { " About " APPNAME , MENU_CREDITS4 , MA_Return , MENU_CREDITS , MA_Advance , } ;
2014-05-31 12:26:41 +00:00
2014-10-27 07:09:41 +00:00
# define CURSOR_CENTER_2LINE { MENU_MARGIN_CENTER<<16, 120<<16, }
# define CURSOR_CENTER_3LINE { MENU_MARGIN_CENTER<<16, 129<<16, }
2014-05-31 12:26:41 +00:00
# define CURSOR_BOTTOMRIGHT { 304<<16, 186<<16, }
2018-03-09 02:51:28 +00:00
static MenuVerify_t M_SAVECLEANVERIFY = { CURSOR_CENTER_3LINE , MENU_SAVESETUP , MA_None , } ;
2014-10-27 10:14:50 +00:00
static MenuVerify_t M_QUIT = { CURSOR_CENTER_2LINE , MENU_CLOSE , MA_None , } ;
static MenuVerify_t M_QUITTOTITLE = { CURSOR_CENTER_2LINE , MENU_CLOSE , MA_None , } ;
static MenuVerify_t M_LOADVERIFY = { CURSOR_CENTER_3LINE , MENU_CLOSE , MA_None , } ;
2018-03-09 02:51:28 +00:00
static MenuVerify_t M_LOADDELVERIFY = { CURSOR_CENTER_3LINE , MENU_LOAD , MA_None , } ;
2014-10-27 10:14:50 +00:00
static MenuVerify_t M_NEWVERIFY = { CURSOR_CENTER_2LINE , MENU_EPISODE , MA_Advance , } ;
static MenuVerify_t M_SAVEVERIFY = { CURSOR_CENTER_2LINE , MENU_SAVE , MA_None , } ;
2018-03-08 03:55:45 +00:00
static MenuVerify_t M_SAVEDELVERIFY = { CURSOR_CENTER_3LINE , MENU_SAVE , MA_None , } ;
2014-10-27 10:14:50 +00:00
static MenuVerify_t M_RESETPLAYER = { CURSOR_CENTER_3LINE , MENU_CLOSE , MA_None , } ;
2014-05-31 12:26:41 +00:00
2019-08-13 09:16:02 +00:00
static MenuVerify_t M_COLCORRRESETVERIFY = { CURSOR_CENTER_2LINE , MENU_COLCORR , MA_None , } ;
static MenuVerify_t M_KEYSRESETVERIFY = { CURSOR_CENTER_2LINE , MENU_KEYBOARDSETUP , MA_None , } ;
static MenuVerify_t M_KEYSCLASSICVERIFY = { CURSOR_CENTER_2LINE , MENU_KEYBOARDSETUP , MA_None , } ;
static MenuVerify_t M_JOYSTANDARDVERIFY = { CURSOR_CENTER_2LINE , MENU_JOYSTICKSETUP , MA_None , } ;
static MenuVerify_t M_JOYPROVERIFY = { CURSOR_CENTER_2LINE , MENU_JOYSTICKSETUP , MA_None , } ;
static MenuVerify_t M_JOYCLEARVERIFY = { CURSOR_CENTER_2LINE , MENU_JOYSTICKSETUP , MA_None , } ;
2014-10-27 10:14:50 +00:00
static MenuMessage_t M_NETWAITMASTER = { CURSOR_BOTTOMRIGHT , MENU_NULL , MA_None , } ;
static MenuMessage_t M_NETWAITVOTES = { CURSOR_BOTTOMRIGHT , MENU_NULL , MA_None , } ;
static MenuMessage_t M_BUYDUKE = { CURSOR_BOTTOMRIGHT , MENU_EPISODE , MA_Return , } ;
2014-05-31 12:26:41 +00:00
2015-03-24 10:48:34 +00:00
static MenuTextForm_t M_ADULTPASSWORD = { NULL , " Enter Password: " , MAXPWLOCKOUT , MTF_Password } ;
2015-03-24 10:49:03 +00:00
static MenuTextForm_t M_CHEATENTRY = { NULL , " Enter Cheat Code: " , MAXCHEATLEN , 0 } ;
static MenuTextForm_t M_CHEAT_WARP = { NULL , " Enter Warp #: " , 3 , 0 } ;
static MenuTextForm_t M_CHEAT_SKILL = { NULL , " Enter Skill #: " , 1 , 0 } ;
2014-05-31 12:26:41 +00:00
2019-11-02 00:30:21 +00:00
//#define MAKE_MENUFILESELECT(a, dir, b, c) { a, { &MMF_FileSelectLeft, &MMF_FileSelectRight }, { &MF_Minifont, &MF_Minifont }, dir, b, c, { NULL, NULL }, { 0, 0 }, { 3<<16, 3<<16 }, FNLIST_INITIALIZER, 0 }
2014-05-31 12:26:41 +00:00
2019-11-02 00:30:21 +00:00
//static MenuFileSelect_t M_USERMAP = MAKE_MENUFILESELECT( "Select A User Map", "./usermaps/", "*.map", boardfilename );
2014-05-31 12:26:41 +00:00
// MUST be in ascending order of MenuID enum values due to binary search
static Menu_t Menus [ ] = {
2014-11-30 02:04:36 +00:00
{ & M_MAIN , MENU_MAIN , MENU_CLOSE , MA_None , Menu } ,
{ & M_MAIN_INGAME , MENU_MAIN_INGAME , MENU_CLOSE , MA_None , Menu } ,
{ & M_EPISODE , MENU_EPISODE , MENU_MAIN , MA_Return , Menu } ,
2019-11-02 00:30:21 +00:00
//{ &M_USERMAP, MENU_USERMAP, MENU_PREVIOUS, MA_Return, FileSelect },
2019-08-09 08:21:19 +00:00
{ & M_NEWGAMECUSTOM , MENU_NEWGAMECUSTOM , MENU_MAIN , MA_Return , Menu } ,
{ & M_NEWGAMECUSTOMSUB , MENU_NEWGAMECUSTOMSUB , MENU_NEWGAMECUSTOM , MA_Return , Menu } ,
{ & M_SKILL , MENU_SKILL , MENU_PREVIOUS , MA_Return , Menu } ,
2017-07-31 03:14:51 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-11-30 02:04:36 +00:00
{ & M_GAMESETUP , MENU_GAMESETUP , MENU_OPTIONS , MA_Return , Menu } ,
2017-07-31 03:14:51 +00:00
# endif
2014-11-30 02:04:36 +00:00
{ & M_OPTIONS , MENU_OPTIONS , MENU_MAIN , MA_Return , Menu } ,
{ & M_VIDEOSETUP , MENU_VIDEOSETUP , MENU_DISPLAYSETUP , MA_Return , Menu } ,
{ & M_KEYBOARDSETUP , MENU_KEYBOARDSETUP , MENU_CONTROLS , MA_Return , Menu } ,
{ & M_MOUSESETUP , MENU_MOUSESETUP , MENU_CONTROLS , MA_Return , Menu } ,
{ & M_JOYSTICKSETUP , MENU_JOYSTICKSETUP , MENU_CONTROLS , MA_Return , Menu } ,
{ & M_JOYSTICKAXES , MENU_JOYSTICKAXES , MENU_JOYSTICKSETUP , MA_Return , Menu } ,
{ & M_KEYBOARDKEYS , MENU_KEYBOARDKEYS , MENU_KEYBOARDSETUP , MA_Return , Menu } ,
{ & M_MOUSEADVANCED , MENU_MOUSEADVANCED , MENU_MOUSESETUP , MA_Return , Menu } ,
{ & M_JOYSTICKAXIS , MENU_JOYSTICKAXIS , MENU_JOYSTICKAXES , MA_Return , Menu } ,
{ & M_CONTROLS , MENU_CONTROLS , MENU_OPTIONS , MA_Return , Menu } ,
2014-09-30 04:07:29 +00:00
# ifdef USE_OPENGL
2015-10-24 00:30:35 +00:00
{ & M_RENDERERSETUP_POLYMOST , MENU_POLYMOST , MENU_DISPLAYSETUP , MA_Return , Menu } ,
2014-09-30 04:07:29 +00:00
# endif
2014-11-30 02:04:36 +00:00
{ & M_COLCORR , MENU_COLCORR , MENU_DISPLAYSETUP , MA_Return , Menu } ,
{ & M_COLCORR , MENU_COLCORR_INGAME , MENU_CLOSE , MA_Return , Menu } ,
{ & M_SCREENSETUP , MENU_SCREENSETUP , MENU_DISPLAYSETUP , MA_Return , Menu } ,
{ & M_DISPLAYSETUP , MENU_DISPLAYSETUP , MENU_OPTIONS , MA_Return , Menu } ,
2015-10-24 00:30:35 +00:00
# ifdef POLYMER
2015-11-14 19:54:27 +00:00
{ & M_RENDERERSETUP_POLYMER , MENU_POLYMER , MENU_DISPLAYSETUP , MA_Return , Menu } ,
2015-10-24 00:30:35 +00:00
# endif
2014-11-30 02:04:36 +00:00
{ & M_LOAD , MENU_LOAD , MENU_MAIN , MA_Return , Menu } ,
{ & M_SAVE , MENU_SAVE , MENU_MAIN , MA_Return , Menu } ,
{ & M_STORY , MENU_STORY , MENU_MAIN , MA_Return , Panel } ,
{ & M_F1HELP , MENU_F1HELP , MENU_MAIN , MA_Return , Panel } ,
{ & M_QUIT , MENU_QUIT , MENU_PREVIOUS , MA_Return , Verify } ,
{ & M_QUITTOTITLE , MENU_QUITTOTITLE , MENU_PREVIOUS , MA_Return , Verify } ,
{ & M_QUIT , MENU_QUIT_INGAME , MENU_CLOSE , MA_None , Verify } ,
{ & M_NETHOST , MENU_NETSETUP , MENU_MAIN , MA_Return , Menu } ,
{ & M_NETWAITMASTER , MENU_NETWAITMASTER , MENU_MAIN , MA_Return , Message } ,
{ & M_NETWAITVOTES , MENU_NETWAITVOTES , MENU_MAIN , MA_Return , Message } ,
{ & M_SOUND , MENU_SOUND , MENU_OPTIONS , MA_Return , Menu } ,
{ & M_SOUND , MENU_SOUND_INGAME , MENU_CLOSE , MA_Return , Menu } ,
{ & M_ADVSOUND , MENU_ADVSOUND , MENU_SOUND , MA_Return , Menu } ,
2018-03-08 03:55:12 +00:00
{ & M_SAVESETUP , MENU_SAVESETUP , MENU_OPTIONS , MA_Return , Menu } ,
2018-03-08 03:55:45 +00:00
{ & M_SAVECLEANVERIFY , MENU_SAVECLEANVERIFY , MENU_SAVESETUP , MA_None , Verify } ,
2017-07-31 01:34:54 +00:00
# ifdef EDUKE32_SIMPLE_MENU
{ & M_CHEATS , MENU_CHEATS , MENU_OPTIONS , MA_Return , Menu } ,
# else
2016-01-08 01:32:47 +00:00
{ & M_CHEATS , MENU_CHEATS , MENU_GAMESETUP , MA_Return , Menu } ,
2017-07-31 01:34:54 +00:00
# endif
2015-03-24 10:49:03 +00:00
{ & M_CHEATENTRY , MENU_CHEATENTRY , MENU_CHEATS , MA_None , TextForm } ,
{ & M_CHEAT_WARP , MENU_CHEAT_WARP , MENU_CHEATS , MA_None , TextForm } ,
{ & M_CHEAT_SKILL , MENU_CHEAT_SKILL , MENU_CHEATS , MA_None , TextForm } ,
2014-11-30 02:04:36 +00:00
{ & M_CREDITS , MENU_CREDITS , MENU_MAIN , MA_Return , Panel } ,
{ & M_CREDITS2 , MENU_CREDITS2 , MENU_MAIN , MA_Return , Panel } ,
{ & M_CREDITS3 , MENU_CREDITS3 , MENU_MAIN , MA_Return , Panel } ,
{ & M_CREDITS4 , MENU_CREDITS4 , MENU_MAIN , MA_Return , Panel } ,
{ & M_CREDITS5 , MENU_CREDITS5 , MENU_MAIN , MA_Return , Panel } ,
{ & M_LOADVERIFY , MENU_LOADVERIFY , MENU_LOAD , MA_None , Verify } ,
2018-03-08 03:55:45 +00:00
{ & M_LOADDELVERIFY , MENU_LOADDELVERIFY , MENU_LOAD , MA_None , Verify } ,
{ & M_NEWVERIFY , MENU_NEWVERIFY , MENU_PREVIOUS , MA_Return , Verify } ,
2014-11-30 02:04:36 +00:00
{ & M_SAVEVERIFY , MENU_SAVEVERIFY , MENU_SAVE , MA_None , Verify } ,
2018-03-08 03:55:45 +00:00
{ & M_SAVEDELVERIFY , MENU_SAVEDELVERIFY , MENU_SAVE , MA_None , Verify } ,
2019-08-13 09:16:02 +00:00
{ & M_COLCORRRESETVERIFY , MENU_COLCORRRESETVERIFY , MENU_COLCORR , MA_None , Verify } ,
{ & M_KEYSRESETVERIFY , MENU_KEYSRESETVERIFY , MENU_KEYBOARDSETUP , MA_None , Verify } ,
{ & M_KEYSCLASSICVERIFY , MENU_KEYSCLASSICVERIFY , MENU_KEYBOARDSETUP , MA_None , Verify } ,
{ & M_JOYSTANDARDVERIFY , MENU_JOYSTANDARDVERIFY , MENU_JOYSTICKSETUP , MA_None , Verify } ,
{ & M_JOYPROVERIFY , MENU_JOYPROVERIFY , MENU_JOYSTICKSETUP , MA_None , Verify } ,
{ & M_JOYCLEARVERIFY , MENU_JOYCLEARVERIFY , MENU_JOYSTICKSETUP , MA_None , Verify } ,
2015-03-24 10:48:34 +00:00
{ & M_ADULTPASSWORD , MENU_ADULTPASSWORD , MENU_GAMESETUP , MA_None , TextForm } ,
2014-11-30 02:04:36 +00:00
{ & M_RESETPLAYER , MENU_RESETPLAYER , MENU_CLOSE , MA_None , Verify } ,
{ & M_BUYDUKE , MENU_BUYDUKE , MENU_EPISODE , MA_Return , Message } ,
{ & M_NETWORK , MENU_NETWORK , MENU_MAIN , MA_Return , Menu } ,
{ & M_PLAYER , MENU_PLAYER , MENU_OPTIONS , MA_Return , Menu } ,
{ & M_MACROS , MENU_MACROS , MENU_PLAYER , MA_Return , Menu } ,
{ & M_NETHOST , MENU_NETHOST , MENU_NETWORK , MA_Return , Menu } ,
{ & M_NETOPTIONS , MENU_NETOPTIONS , MENU_NETWORK , MA_Return , Menu } ,
2019-11-02 00:30:21 +00:00
// { &M_USERMAP, MENU_NETUSERMAP, MENU_NETOPTIONS, MA_Return, FileSelect },
2014-11-30 02:04:36 +00:00
{ & M_NETJOIN , MENU_NETJOIN , MENU_NETWORK , MA_Return , Menu } ,
2014-05-31 12:26:41 +00:00
} ;
2018-10-25 23:31:54 +00:00
static CONSTEXPR const uint16_t numMenus = ARRAY_SIZE ( Menus ) ;
2014-05-31 12:26:41 +00:00
Menu_t * m_currentMenu = & Menus [ 0 ] ;
static Menu_t * m_previousMenu = & Menus [ 0 ] ;
2017-06-27 01:50:55 +00:00
static Menu_t * m_parentMenu ;
2014-05-31 12:26:41 +00:00
MenuID_t g_currentMenu ;
static MenuID_t g_previousMenu ;
2014-11-30 02:04:36 +00:00
# define MenuMenu_ChangeEntryList(m, el)\
2014-05-31 12:26:41 +00:00
do { \
2014-11-30 02:04:36 +00:00
m . entrylist = el ; \
m . numEntries = ARRAY_SIZE ( el ) ; \
2014-05-31 12:26:41 +00:00
} while ( 0 )
2014-12-27 18:37:12 +00:00
static void MenuEntry_DisableOnCondition ( MenuEntry_t * const entry , const int32_t condition )
{
if ( condition )
2017-06-19 23:07:01 +00:00
entry - > flags | = MEF_Disabled ;
2014-12-27 18:37:12 +00:00
else
2017-06-19 23:07:01 +00:00
entry - > flags & = ~ MEF_Disabled ;
2014-12-27 18:37:12 +00:00
}
2017-07-06 14:43:07 +00:00
static void MenuEntry_LookDisabledOnCondition ( MenuEntry_t * const entry , const int32_t condition )
{
if ( condition )
entry - > flags | = MEF_LookDisabled ;
else
entry - > flags & = ~ MEF_LookDisabled ;
}
2018-02-20 11:55:07 +00:00
static void MenuEntry_HideOnCondition ( MenuEntry_t * const entry , const int32_t condition )
{
if ( condition )
entry - > flags | = MEF_Hidden ;
else
entry - > flags & = ~ MEF_Hidden ;
}
2014-05-31 12:26:41 +00:00
2018-10-16 06:08:50 +00:00
static int32_t M_RunMenu_Menu ( Menu_t * cm , MenuMenu_t * menu , MenuEntry_t * currentry , int32_t state , vec2_t origin , bool actually_draw = true ) ;
2017-12-18 11:24:53 +00:00
static void Menu_EntryFocus ( /*MenuEntry_t *entry*/ ) ;
static MenuEntry_t * Menu_AdjustForCurrentEntryAssignment ( MenuMenu_t * menu )
{
MenuEntry_t * currentry = menu - > entrylist [ menu - > currentEntry ] ;
Menu_EntryFocus ( /*currentry*/ ) ;
if ( currentry - > ybottom - menu - > scrollPos > klabs ( menu - > format - > bottomcutoff ) )
menu - > scrollPos = currentry - > ybottom - klabs ( menu - > format - > bottomcutoff ) ;
else if ( currentry - > ytop - menu - > scrollPos < menu - > format - > pos . y )
menu - > scrollPos = currentry - > ytop - menu - > format - > pos . y ;
return currentry ;
}
static MenuEntry_t * Menu_AdjustForCurrentEntryAssignmentBlind ( MenuMenu_t * menu )
{
M_RunMenu_Menu ( nullptr , menu , nullptr , 0 , { 0 , 0 } , false ) ;
return Menu_AdjustForCurrentEntryAssignment ( menu ) ;
}
2018-03-08 03:55:48 +00:00
static int32_t SELECTDIR_z = 65536 ;
2019-08-09 08:21:19 +00:00
void Menu_PopulateNewGameCustom ( void )
{
M_NEWGAMECUSTOM . title = s_NewGame ;
int e = 0 ;
for ( MenuGameplayStemEntry const & stem : g_MenuGameplayEntries )
{
MenuGameplayEntry const & entry = stem . entry ;
if ( ! entry . isValid ( ) )
break ;
MEL_NEWGAMECUSTOM [ e ] = & ME_NEWGAMECUSTOMENTRIES [ e ] ;
+ + e ;
}
M_NEWGAMECUSTOM . numEntries = e ;
MMF_Top_NewGameCustom . pos . y = ( 58 + ( 3 - e ) * 6 ) < < 16 ;
}
void Menu_PopulateNewGameCustomSub ( int e )
{
if ( ( unsigned ) e > = MAXMENUGAMEPLAYENTRIES )
return ;
MenuGameplayStemEntry const & stem = g_MenuGameplayEntries [ e ] ;
MenuGameplayEntry const & entry = stem . entry ;
if ( ! entry . isValid ( ) )
return ;
M_NEWGAMECUSTOMSUB . title = entry . name ;
int s = 0 ;
for ( MenuGameplayEntry const & subentry : stem . subentries )
{
if ( ! subentry . isValid ( ) )
break ;
MEL_NEWGAMECUSTOMSUB [ s ] = & ME_NEWGAMECUSTOMSUBENTRIES [ e ] [ s ] ;
+ + s ;
}
M_NEWGAMECUSTOMSUB . numEntries = s ;
MMF_Top_NewGameCustomSub . pos . y = ( 58 + ( 3 - s ) * 6 ) < < 16 ;
}
2014-05-31 12:26:41 +00:00
/*
This function prepares data after ART and CON have been processed .
It also initializes some data in loops rather than statically at compile time .
*/
2016-11-01 01:35:32 +00:00
void Menu_Init ( void )
2014-05-31 12:26:41 +00:00
{
int32_t i , j , k ;
2012-10-14 22:16:07 +00:00
2019-08-15 06:51:56 +00:00
if ( FURY )
{
MMF_Top_Skill . pos . x = ( 320 < < 15 ) ;
ME_SKILL_TEMPLATE . format = & MEF_LeftMenu ;
}
2014-05-31 12:26:41 +00:00
// prepare menu fonts
2018-01-29 02:14:16 +00:00
// check if tilenum is -1 in case it was set in EVENT_SETDEFAULTS
if ( ( unsigned ) MF_Redfont . tilenum > = MAXTILES ) MF_Redfont . tilenum = BIGALPHANUM ;
if ( ( unsigned ) MF_Bluefont . tilenum > = MAXTILES ) MF_Bluefont . tilenum = STARTALPHANUM ;
if ( ( unsigned ) MF_Minifont . tilenum > = MAXTILES ) MF_Minifont . tilenum = MINIFONT ;
MF_Redfont . emptychar . y = tilesiz [ MF_Redfont . tilenum ] . y < < 16 ;
MF_Bluefont . emptychar . y = tilesiz [ MF_Bluefont . tilenum ] . y < < 16 ;
MF_Minifont . emptychar . y = tilesiz [ MF_Minifont . tilenum ] . y < < 16 ;
2014-05-31 12:26:41 +00:00
if ( ! minitext_lowercase )
MF_Minifont . textflags | = TEXT_UPPERCASE ;
2012-10-14 22:16:07 +00:00
2014-05-31 12:26:41 +00:00
// prepare gamefuncs and keys
2017-06-17 11:41:59 +00:00
MEOSN_Gamefuncs [ 0 ] = MenuGameFuncNone ;
MEOSV_Gamefuncs [ 0 ] = - 1 ;
k = 1 ;
2014-05-31 12:26:41 +00:00
for ( i = 0 ; i < NUMGAMEFUNCTIONS ; + + i )
2012-10-14 22:16:07 +00:00
{
2019-11-09 18:39:35 +00:00
MenuGameFuncs [ i ] = buttonMap . GetButtonAlias ( i ) ;
2019-10-25 22:32:49 +00:00
MenuGameFuncs [ i ] . Substitute ( ' _ ' , ' ' ) ;
2014-05-31 12:26:41 +00:00
2019-10-25 22:32:49 +00:00
if ( MenuGameFuncs [ i ] [ 0 ] ! = ' \0 ' )
{
MEOSN_Gamefuncs [ k ] = MenuGameFuncs [ i ] ;
2017-06-17 11:41:59 +00:00
MEOSV_Gamefuncs [ k ] = i ;
+ + k ;
}
2012-10-14 22:16:07 +00:00
}
2017-06-17 11:41:59 +00:00
MEOS_Gamefuncs . numOptions = k ;
2019-11-26 08:24:38 +00:00
for ( i = 1 ; i < NUMKEYS - 1 ; + + i )
2019-11-03 21:20:19 +00:00
MEOSN_Keys [ i ] = KB_ScanCodeToString ( i ) ;
2019-11-26 08:24:38 +00:00
MEOSN_Keys [ 0 ] = MenuKeyNone ;
2014-05-31 12:26:41 +00:00
MEOSN_Keys [ NUMKEYS - 1 ] = MenuKeyNone ;
2012-10-14 22:16:07 +00:00
2014-05-31 12:26:41 +00:00
// prepare episodes
2015-02-22 22:15:20 +00:00
k = 0 ;
2016-08-27 01:42:01 +00:00
for ( i = 0 ; i < g_volumeCnt ; + + i )
2012-10-14 22:16:07 +00:00
{
2016-08-27 01:42:01 +00:00
if ( g_volumeNames [ i ] [ 0 ] )
2012-10-14 22:16:07 +00:00
{
2016-08-27 01:42:01 +00:00
if ( ! ( g_volumeFlags [ i ] & EF_HIDEFROMSP ) )
2015-02-22 22:15:20 +00:00
{
MEL_EPISODE [ i ] = & ME_EPISODE [ i ] ;
ME_EPISODE [ i ] = ME_EPISODE_TEMPLATE ;
2016-08-27 01:42:01 +00:00
ME_EPISODE [ i ] . name = g_volumeNames [ i ] ;
2015-02-22 22:15:20 +00:00
}
2014-05-31 12:26:41 +00:00
2015-03-08 07:56:45 +00:00
// if (!(EpisodeFlags[i] & EF_HIDEFROMMP))
2015-02-22 22:15:20 +00:00
{
2016-08-27 01:42:01 +00:00
MEOSN_NetEpisodes [ k ] = g_volumeNames [ i ] ;
2015-02-22 22:15:20 +00:00
MEOSV_NetEpisodes [ k ] = i ;
2014-05-31 12:26:41 +00:00
2015-02-22 22:15:20 +00:00
k + + ;
}
2012-10-14 22:16:07 +00:00
}
2014-05-31 12:26:41 +00:00
// prepare levels
2015-02-22 22:15:35 +00:00
MEOS_NETOPTIONS_LEVEL [ i ] = MEOS_NETOPTIONS_LEVEL_TEMPLATE ;
2014-05-31 12:26:41 +00:00
for ( j = 0 ; j < MAXLEVELS ; + + j )
{
2016-08-27 01:42:01 +00:00
MEOSN_NetLevels [ i ] [ j ] = g_mapInfo [ MAXLEVELS * i + j ] . name ;
if ( g_mapInfo [ i * MAXLEVELS + j ] . filename ! = NULL )
2014-05-31 12:26:41 +00:00
MEOS_NETOPTIONS_LEVEL [ i ] . numOptions = j + 1 ;
}
MEOS_NETOPTIONS_LEVEL [ i ] . optionNames = MEOSN_NetLevels [ i ] ;
2014-03-26 09:14:01 +00:00
}
2016-08-27 01:42:01 +00:00
M_EPISODE . numEntries = g_volumeCnt + 2 ;
2017-08-04 23:06:37 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2017-06-19 23:06:37 +00:00
MEL_EPISODE [ g_volumeCnt ] = & ME_Space4_Redfont ;
2016-08-27 01:42:01 +00:00
MEL_EPISODE [ g_volumeCnt + 1 ] = & ME_EPISODE_USERMAP ;
2015-02-22 22:15:20 +00:00
MEOSN_NetEpisodes [ k ] = MenuUserMap ;
MEOSV_NetEpisodes [ k ] = MAXVOLUMES ;
2017-08-04 23:06:37 +00:00
# else
M_EPISODE . numEntries = g_volumeCnt ;
k - - ;
# endif
MEOS_NETOPTIONS_EPISODE . numOptions = k + 1 ;
2015-02-22 22:15:20 +00:00
NetEpisode = MEOSV_NetEpisodes [ 0 ] ;
2017-06-19 23:06:17 +00:00
MMF_Top_Episode . pos . y = ( 58 + ( 3 - k ) * 6 ) < < 16 ;
2016-08-27 01:42:01 +00:00
if ( g_skillCnt = = 0 )
2015-02-09 05:50:33 +00:00
MEO_EPISODE . linkID = MENU_NULL ;
2018-01-26 04:35:33 +00:00
M_EPISODE . currentEntry = ud . default_volume ;
2014-05-31 12:26:41 +00:00
2019-08-09 08:21:19 +00:00
// prepare new game custom :O
if ( g_MenuGameplayEntries [ 0 ] . entry . isValid ( ) )
{
MEO_MAIN_NEWGAME . linkID = M_NEWVERIFY . linkID = MENU_NEWGAMECUSTOM ;
int e = 0 ;
for ( MenuGameplayStemEntry const & stem : g_MenuGameplayEntries )
{
MenuGameplayEntry const & entry = stem . entry ;
if ( ! entry . isValid ( ) )
break ;
MenuEntry_t & e_me = ME_NEWGAMECUSTOMENTRIES [ e ] ;
e_me = ME_EPISODE_TEMPLATE ;
MenuLink_t & e_meo = MEO_NEWGAMECUSTOM [ e ] ;
e_meo = MEO_NEWGAMECUSTOM_TEMPLATE ;
e_me . entry = & e_meo ;
e_me . name = entry . name ;
if ( entry . flags & MGE_Locked )
e_me . flags | = MEF_Disabled ;
if ( entry . flags & MGE_Hidden )
e_me . flags | = MEF_Hidden ;
int s = 0 ;
for ( MenuGameplayEntry const & subentry : stem . subentries )
{
if ( ! subentry . isValid ( ) )
break ;
MenuEntry_t & s_me = ME_NEWGAMECUSTOMSUBENTRIES [ e ] [ s ] ;
s_me = ME_EPISODE_TEMPLATE ;
MenuLink_t & s_meo = MEO_NEWGAMECUSTOMSUB [ e ] [ s ] ;
s_meo = MEO_NEWGAMECUSTOMSUB_TEMPLATE ;
s_me . entry = & s_meo ;
s_me . name = subentry . name ;
if ( subentry . flags & MGE_Locked )
s_me . flags | = MEF_Disabled ;
if ( subentry . flags & MGE_Hidden )
s_me . flags | = MEF_Hidden ;
+ + s ;
}
2019-08-14 09:02:07 +00:00
if ( entry . flags & MGE_UserContent )
e_meo . linkID = MENU_USERMAP ;
else if ( s = = 0 )
2019-08-09 08:21:19 +00:00
e_meo . linkID = MENU_SKILL ;
+ + e ;
}
Menu_PopulateNewGameCustom ( ) ;
}
2014-05-31 12:26:41 +00:00
// prepare skills
k = - 1 ;
2016-08-27 01:42:01 +00:00
for ( i = 0 ; i < g_skillCnt & & g_skillNames [ i ] [ 0 ] ; + + i )
2014-05-31 12:26:41 +00:00
{
MEL_SKILL [ i ] = & ME_SKILL [ i ] ;
ME_SKILL [ i ] = ME_SKILL_TEMPLATE ;
2016-08-27 01:42:01 +00:00
ME_SKILL [ i ] . name = g_skillNames [ i ] ;
2014-03-26 09:14:01 +00:00
2016-08-27 01:42:01 +00:00
MEOSN_NetSkills [ i ] = g_skillNames [ i ] ;
2014-03-26 09:14:01 +00:00
2014-05-31 12:26:41 +00:00
k = i ;
}
+ + k ;
2016-08-27 01:42:01 +00:00
M_SKILL . numEntries = g_skillCnt ; // k;
MEOS_NETOPTIONS_MONSTERS . numOptions = g_skillCnt + 1 ; // k+1;
MEOSN_NetSkills [ g_skillCnt ] = MenuSkillNone ;
MMF_Top_Skill . pos . y = ( 58 + ( 4 - g_skillCnt ) * 6 ) < < 16 ;
2018-01-26 04:35:33 +00:00
M_SKILL . currentEntry = ud . default_skill ;
2017-12-18 11:24:53 +00:00
Menu_AdjustForCurrentEntryAssignmentBlind ( & M_SKILL ) ;
2014-05-31 12:26:41 +00:00
// prepare multiplayer gametypes
k = - 1 ;
for ( i = 0 ; i < MAXGAMETYPES ; + + i )
2016-08-27 01:42:01 +00:00
if ( g_gametypeNames [ i ] [ 0 ] )
2014-05-31 12:26:41 +00:00
{
2016-08-27 01:42:01 +00:00
MEOSN_NetGametypes [ i ] = g_gametypeNames [ i ] ;
2014-05-31 12:26:41 +00:00
k = i ;
}
+ + k ;
MEOS_NETOPTIONS_GAMETYPE . numOptions = k ;
2015-11-25 12:08:31 +00:00
if ( NAM_WW2GI )
ME_NETOPTIONS_MONSTERS . name = " Enemies " ;
2014-05-31 12:26:41 +00:00
2018-02-20 11:55:07 +00:00
// prepare cheats
for ( i = 0 ; i < NUMCHEATFUNCS ; + + i )
MEL_CHEATS [ i + 1 ] = & ME_CheatCodes [ i ] ;
2014-05-31 12:26:41 +00:00
// prepare text chat macros
for ( i = 0 ; i < MAXRIDECULE ; + + i )
{
MEL_MACROS [ i ] = & ME_MACROS [ i ] ;
ME_MACROS [ i ] = ME_MACROS_TEMPLATE ;
ME_MACROS [ i ] . entry = & MEO_MACROS [ i ] ;
MEO_MACROS [ i ] = MEO_MACROS_TEMPLATE ;
2006-04-13 20:47:06 +00:00
2019-10-27 07:14:58 +00:00
MEO_MACROS [ i ] . variable = sink ; // ud.ridecule[i]; temporarily disabled
2014-05-31 12:26:41 +00:00
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
// prepare input
for ( i = 0 ; i < NUMGAMEFUNCTIONS ; + + i )
{
2017-06-17 11:41:59 +00:00
if ( MenuGameFuncs [ i ] [ 0 ] = = ' \0 ' )
2017-07-10 13:43:54 +00:00
{
MEL_KEYBOARDSETUPFUNCS [ i ] = NULL ;
2017-06-17 11:41:59 +00:00
continue ;
2017-07-10 13:43:54 +00:00
}
2017-06-17 11:41:59 +00:00
2017-07-10 13:43:54 +00:00
MEL_KEYBOARDSETUPFUNCS [ i ] = & ME_KEYBOARDSETUPFUNCS [ i ] ;
ME_KEYBOARDSETUPFUNCS [ i ] = ME_KEYBOARDSETUPFUNCS_TEMPLATE ;
ME_KEYBOARDSETUPFUNCS [ i ] . name = MenuGameFuncs [ i ] ;
ME_KEYBOARDSETUPFUNCS [ i ] . entry = & MEO_KEYBOARDSETUPFUNCS [ i ] ;
MEO_KEYBOARDSETUPFUNCS [ i ] = MEO_KEYBOARDSETUPFUNCS_TEMPLATE ;
2014-05-31 12:26:41 +00:00
}
2017-07-10 13:43:54 +00:00
M_KEYBOARDKEYS . numEntries = NUMGAMEFUNCTIONS ;
2018-04-12 21:02:31 +00:00
for ( i = 0 ; i < 2 * joystick . numButtons + 8 * joystick . numHats ; + + i )
2006-04-13 20:47:06 +00:00
{
2018-04-12 21:02:31 +00:00
if ( i < 2 * joystick . numButtons )
2006-04-13 20:47:06 +00:00
{
2014-05-31 12:26:41 +00:00
if ( i & 1 )
2018-04-12 21:02:31 +00:00
Bsnprintf ( MenuJoystickNames [ i ] , MAXJOYBUTTONSTRINGLENGTH , " Double %s " , joyGetName ( 1 , i > > 1 ) ) ;
2014-05-31 12:26:41 +00:00
else
2018-04-12 21:02:31 +00:00
Bstrncpy ( MenuJoystickNames [ i ] , joyGetName ( 1 , i > > 1 ) , MAXJOYBUTTONSTRINGLENGTH ) ;
2006-04-13 20:47:06 +00:00
}
else
2014-05-31 12:26:41 +00:00
{
2018-04-12 21:02:31 +00:00
Bsnprintf ( MenuJoystickNames [ i ] , MAXJOYBUTTONSTRINGLENGTH , ( i & 1 ) ? " Double Hat %d %s " : " Hat %d %s " , ( ( i - 2 * joystick . numButtons ) > > 3 ) , MenuJoystickHatDirections [ ( ( i - 2 * joystick . numButtons ) > > 1 ) % 4 ] ) ;
2014-05-31 12:26:41 +00:00
}
}
2018-04-12 21:02:31 +00:00
for ( i = 0 ; i < joystick . numAxes ; + + i )
2006-04-13 20:47:06 +00:00
{
2014-05-31 12:26:41 +00:00
ME_JOYSTICKAXES [ i ] = ME_JOYSTICKAXES_TEMPLATE ;
2018-04-12 21:02:31 +00:00
Bstrncpy ( MenuJoystickAxes [ i ] , joyGetName ( 0 , i ) , MAXJOYBUTTONSTRINGLENGTH ) ;
2014-05-31 12:26:41 +00:00
ME_JOYSTICKAXES [ i ] . name = MenuJoystickAxes [ i ] ;
MEL_JOYSTICKAXES [ i ] = & ME_JOYSTICKAXES [ i ] ;
2006-04-13 20:47:06 +00:00
}
2018-04-12 21:02:31 +00:00
M_JOYSTICKAXES . numEntries = joystick . numAxes ;
2006-04-13 20:47:06 +00:00
2015-11-25 12:08:31 +00:00
// prepare sound setup
2017-06-27 01:50:55 +00:00
# ifndef EDUKE32_STANDALONE
2015-11-25 12:08:31 +00:00
if ( WW2GI )
ME_SOUND_DUKETALK . name = " GI talk: " ;
else if ( NAM )
ME_SOUND_DUKETALK . name = " Grunt talk: " ;
2017-06-27 01:50:55 +00:00
# endif
2019-07-19 01:49:29 +00:00
if ( FURY )
2017-06-27 01:50:55 +00:00
{
MF_Redfont . between . x = 2 < < 16 ;
2017-07-22 04:00:26 +00:00
MF_Redfont . cursorScale = 32768 ;
MF_Redfont . zoom = 16384 ;
2018-01-29 02:14:16 +00:00
MF_Bluefont . zoom = 16384 ;
2017-07-06 14:43:07 +00:00
// hack; should swap out pointers
MF_Minifont = MF_Bluefont ;
2017-06-27 01:50:55 +00:00
MMF_Top_Main . pos . x = 40 < < 16 ;
MMF_Top_Main . pos . y = 130 < < 16 ;
MMF_Top_Main . bottomcutoff = 190 < < 16 ;
M_OPTIONS . format = & MMF_Top_Main ;
MEF_MainMenu . width = MEF_OptionsMenu . width = - ( 160 < < 16 ) ;
2017-07-07 22:50:42 +00:00
MEF_MainMenu . marginBottom = 7 < < 16 ;
2017-06-27 01:50:55 +00:00
M_OPTIONS . title = NoTitle ;
2018-03-08 03:55:48 +00:00
SELECTDIR_z = 16384 ;
2017-06-27 01:50:55 +00:00
}
2015-11-25 12:08:31 +00:00
2014-05-31 12:26:41 +00:00
// prepare shareware
if ( VOLUMEONE )
{
// blue out episodes beyond the first
2016-08-27 01:42:01 +00:00
for ( i = 1 ; i < g_volumeCnt ; + + i )
2014-05-31 12:26:41 +00:00
{
if ( MEL_EPISODE [ i ] )
{
ME_EPISODE [ i ] . entry = & MEO_EPISODE_SHAREWARE ;
2017-06-19 23:07:09 +00:00
ME_EPISODE [ i ] . flags | = MEF_LookDisabled ;
2014-05-31 12:26:41 +00:00
}
}
2016-08-27 01:42:01 +00:00
M_EPISODE . numEntries = g_volumeCnt ; // remove User Map (and spacer)
2014-05-31 12:26:41 +00:00
MEOS_NETOPTIONS_EPISODE . numOptions = 1 ;
2014-12-27 18:37:12 +00:00
MenuEntry_DisableOnCondition ( & ME_NETOPTIONS_EPISODE , 1 ) ;
2006-04-20 09:03:44 +00:00
}
2007-01-26 00:28:44 +00:00
2014-05-31 12:26:41 +00:00
// prepare pre-Atomic
if ( ! VOLUMEALL | | ! PLUTOPAK )
2006-04-13 20:47:06 +00:00
{
2014-05-31 12:26:41 +00:00
// prepare credits
2017-07-06 14:43:07 +00:00
M_CREDITS . title = M_CREDITS2 . title = M_CREDITS3 . title = s_Credits ;
2014-05-31 12:26:41 +00:00
}
2018-01-29 02:14:09 +00:00
2018-02-20 11:55:07 +00:00
MenuEntry_HideOnCondition ( & ME_MAIN_HELP , G_GetLogoFlags ( ) & LOGO_NOHELP ) ;
2018-01-29 02:14:09 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2018-02-20 11:55:07 +00:00
MenuEntry_HideOnCondition ( & ME_MAIN_CREDITS , G_GetLogoFlags ( ) & LOGO_NOCREDITS ) ;
2018-01-29 02:14:09 +00:00
# endif
2014-05-31 12:26:41 +00:00
}
2012-03-26 05:07:12 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_Run ( Menu_t * cm , vec2_t origin ) ;
2006-11-16 03:02:42 +00:00
2017-12-18 11:24:53 +00:00
static void Menu_BlackRectangle ( int32_t x , int32_t y , int32_t width , int32_t height , int32_t orientation ) ;
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
/*
2016-11-01 01:35:32 +00:00
At present , no true difference is planned between Menu_Pre ( ) and Menu_PreDraw ( ) .
2014-05-31 12:26:41 +00:00
They are separate for purposes of organization .
*/
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_Pre ( MenuID_t cm )
2014-05-31 12:26:41 +00:00
{
int32_t i ;
2019-07-08 00:41:25 +00:00
auto ps = g_player [ myconnectindex ] . ps ;
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
switch ( cm )
{
case MENU_MAIN_INGAME :
2014-12-27 18:37:12 +00:00
MenuEntry_DisableOnCondition ( & ME_MAIN_SAVEGAME , ud . recstat = = 2 ) ;
MenuEntry_DisableOnCondition ( & ME_MAIN_QUITTOTITLE , g_netServer | | numplayers > 1 ) ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-05-31 12:26:41 +00:00
case MENU_MAIN :
if ( ( g_netServer | | ud . multimode > 1 ) & & ud . recstat ! = 2 )
{
ME_MAIN_NEWGAME . entry = & MEO_MAIN_NEWGAME_NETWORK ;
ME_MAIN_NEWGAME_INGAME . entry = & MEO_MAIN_NEWGAME_NETWORK ;
}
else
{
ME_MAIN_NEWGAME . entry = & MEO_MAIN_NEWGAME ;
ME_MAIN_NEWGAME_INGAME . entry = & MEO_MAIN_NEWGAME_INGAME ;
}
2006-11-16 03:02:42 +00:00
break ;
2014-05-31 12:26:41 +00:00
case MENU_GAMESETUP :
MEO_GAMESETUP_DEMOREC . options = ( ps - > gm & MODE_GAME ) ? & MEOS_DemoRec : & MEOS_OffOn ;
2019-11-09 18:15:03 +00:00
MenuEntry_DisableOnCondition ( & ME_GAMESETUP_DEMOREC , ( ps - > gm & MODE_GAME ) & & m_recstat ! = 1 ) ;
2014-05-31 12:26:41 +00:00
break ;
2007-01-26 00:28:44 +00:00
2014-12-27 18:35:34 +00:00
case MENU_DISPLAYSETUP :
2019-08-13 02:53:38 +00:00
MenuEntry_HideOnCondition ( & ME_DISPLAYSETUP_VOXELS , ! g_haveVoxels ) ;
# ifdef USE_OPENGL
2018-04-12 21:03:12 +00:00
if ( videoGetRenderMode ( ) = = REND_CLASSIC )
2014-11-30 02:04:36 +00:00
MenuMenu_ChangeEntryList ( M_DISPLAYSETUP , MEL_DISPLAYSETUP ) ;
2014-05-31 12:26:41 +00:00
else
2014-11-30 02:04:36 +00:00
MenuMenu_ChangeEntryList ( M_DISPLAYSETUP , MEL_DISPLAYSETUP_GL ) ;
2007-01-26 00:28:44 +00:00
2018-01-26 04:34:51 +00:00
MEO_SCREENSETUP_SCREENSIZE . steps = ! ( ud . statusbarflags & STATUSBAR_NONONE ) +
! ( ud . statusbarflags & STATUSBAR_NOMODERN ) +
2019-10-22 21:31:46 +00:00
! ( ud . statusbarflags & STATUSBAR_NOMINI ) +
2018-01-26 04:34:51 +00:00
! ( ud . statusbarflags & STATUSBAR_NOOVERLAY ) +
! ( ud . statusbarflags & STATUSBAR_NOFULL ) +
! ( ud . statusbarflags & STATUSBAR_NOSHRINK ) * 14 ;
2018-02-13 00:13:06 +00:00
MEO_SCREENSETUP_SCREENSIZE . max = MEO_SCREENSETUP_SCREENSIZE . steps - 1 ;
2019-08-14 03:03:47 +00:00
if ( MEO_SCREENSETUP_SCREENSIZE . steps < = 2 & & ! ( ud . statusbarflags & STATUSBAR_NONONE ) )
{
ME_SCREENSETUP_SCREENSIZE . entry = & MEO_SCREENSETUP_SCREENSIZE_TWO ;
ME_SCREENSETUP_SCREENSIZE . type = Option ;
}
else
{
ME_SCREENSETUP_SCREENSIZE . entry = & MEO_SCREENSETUP_SCREENSIZE ;
ME_SCREENSETUP_SCREENSIZE . type = RangeInt32 ;
}
MenuEntry_HideOnCondition ( & ME_SCREENSETUP_SCREENSIZE , ( MEO_SCREENSETUP_SCREENSIZE . steps < 2 ) ) ;
2018-01-26 04:34:51 +00:00
2014-12-27 18:35:34 +00:00
break ;
2006-04-13 20:47:06 +00:00
2015-10-24 00:30:35 +00:00
case MENU_POLYMER :
case MENU_POLYMOST :
2019-10-23 19:11:37 +00:00
MenuEntry_DisableOnCondition ( & ME_RENDERERSETUP_PRECACHE , ! hw_hightile ) ;
MenuEntry_DisableOnCondition ( & ME_RENDERERSETUP_DETAILTEX , ! hw_hightile ) ;
MenuEntry_DisableOnCondition ( & ME_RENDERERSETUP_GLOWTEX , ! hw_hightile ) ;
2014-05-31 12:26:41 +00:00
# endif
2019-08-13 02:53:38 +00:00
break ;
2007-02-05 01:33:08 +00:00
2014-05-31 12:26:41 +00:00
case MENU_VIDEOSETUP :
2014-12-26 17:29:53 +00:00
{
2019-08-29 20:06:31 +00:00
Bmemset ( resolution , 0 , sizeof ( resolution ) ) ;
MEOS_VIDEOSETUP_RESOLUTION . numOptions = 0 ;
// prepare video setup
for ( int i = 0 ; i < validmodecnt ; + + i )
{
int j ;
for ( j = 0 ; j < MEOS_VIDEOSETUP_RESOLUTION . numOptions ; + + j )
{
if ( validmode [ i ] . xdim = = resolution [ j ] . xdim & & validmode [ i ] . ydim = = resolution [ j ] . ydim )
{
resolution [ j ] . flags | = validmode [ i ] . fs ? RES_FS : RES_WIN ;
Bsnprintf ( resolution [ j ] . name , MAXRESOLUTIONSTRINGLENGTH , " %d x %d%s " , resolution [ j ] . xdim , resolution [ j ] . ydim , ( resolution [ j ] . flags & RES_FS ) ? " " : " Win " ) ;
MEOSN_VIDEOSETUP_RESOLUTION [ j ] = resolution [ j ] . name ;
if ( validmode [ i ] . bpp > resolution [ j ] . bppmax )
resolution [ j ] . bppmax = validmode [ i ] . bpp ;
break ;
}
}
if ( j = = MEOS_VIDEOSETUP_RESOLUTION . numOptions ) // no match found
{
resolution [ j ] . xdim = validmode [ i ] . xdim ;
resolution [ j ] . ydim = validmode [ i ] . ydim ;
resolution [ j ] . bppmax = validmode [ i ] . bpp ;
resolution [ j ] . flags = validmode [ i ] . fs ? RES_FS : RES_WIN ;
Bsnprintf ( resolution [ j ] . name , MAXRESOLUTIONSTRINGLENGTH , " %d x %d%s " , resolution [ j ] . xdim , resolution [ j ] . ydim , ( resolution [ j ] . flags & RES_FS ) ? " " : " Win " ) ;
MEOSN_VIDEOSETUP_RESOLUTION [ j ] = resolution [ j ] . name ;
+ + MEOS_VIDEOSETUP_RESOLUTION . numOptions ;
}
}
2014-12-26 17:29:53 +00:00
const int32_t nr = newresolution ;
2018-02-26 02:48:09 +00:00
// don't allow setting fullscreen mode if it's not supported by the resolution
MenuEntry_DisableOnCondition ( & ME_VIDEOSETUP_FULLSCREEN , ! ( resolution [ nr ] . flags & RES_FS ) ) ;
2014-12-27 18:37:12 +00:00
MenuEntry_DisableOnCondition ( & ME_VIDEOSETUP_APPLY ,
2018-07-14 21:36:44 +00:00
( xres = = resolution [ nr ] . xdim & & yres = = resolution [ nr ] . ydim & &
2018-04-12 21:03:12 +00:00
videoGetRenderMode ( ) = = newrendermode & & fullscreen = = newfullscreen
2019-10-23 19:11:37 +00:00
& & vid_vsync = = newvsync & & r_borderless = = newborderless
2016-01-08 01:32:41 +00:00
)
2014-12-26 17:29:53 +00:00
| | ( newrendermode ! = REND_CLASSIC & & resolution [ nr ] . bppmax < = 8 ) ) ;
2019-09-08 01:01:30 +00:00
MenuEntry_DisableOnCondition ( & ME_VIDEOSETUP_BORDERLESS , newfullscreen ) ;
2014-05-31 12:26:41 +00:00
break ;
2014-12-26 17:29:53 +00:00
}
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
case MENU_SOUND :
2014-10-25 03:34:38 +00:00
case MENU_SOUND_INGAME :
2014-12-27 18:35:34 +00:00
case MENU_ADVSOUND :
2019-10-22 00:01:05 +00:00
MenuEntry_DisableOnCondition ( & ME_SOUND_VOLUME_FX , ! snd_enabled ) ;
MenuEntry_DisableOnCondition ( & ME_SOUND_VOLUME_MUSIC , ! mus_enabled ) ;
MenuEntry_DisableOnCondition ( & ME_SOUND_DUKETALK , ! snd_enabled ) ;
MenuEntry_DisableOnCondition ( & ME_SOUND_SAMPLINGRATE , ! snd_enabled & & ! mus_enabled ) ;
2017-07-27 09:13:09 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2019-10-22 00:01:05 +00:00
MenuEntry_DisableOnCondition ( & ME_SOUND_NUMVOICES , ! snd_enabled ) ;
2017-07-27 09:13:09 +00:00
# endif
2019-10-22 00:01:05 +00:00
MenuEntry_DisableOnCondition ( & ME_SOUND_RESTART , soundrate = = snd_mixrate & &
soundvoices = = snd_numvoices ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-04-18 16:30:15 +00:00
2018-03-08 03:55:36 +00:00
case MENU_SAVESETUP :
2019-10-21 22:58:51 +00:00
MenuEntry_DisableOnCondition ( & ME_SAVESETUP_MAXAUTOSAVES , ! cl_autosavedeletion ) ;
2018-03-08 03:55:36 +00:00
break ;
2019-08-13 09:15:49 +00:00
case MENU_JOYSTICKSETUP :
2019-08-15 04:39:31 +00:00
MenuEntry_DisableOnCondition ( & ME_JOYSTICK_EDITBUTTONS , ! CONTROL_JoyPresent | | ( joystick . numButtons = = 0 & & joystick . numHats = = 0 ) ) ;
MenuEntry_DisableOnCondition ( & ME_JOYSTICK_EDITAXES , ! CONTROL_JoyPresent | | joystick . numAxes = = 0 ) ;
2019-08-13 09:15:49 +00:00
MenuEntry_DisableOnCondition ( & ME_JOYSTICK_DEFAULTS_STANDARD , ! joystick . isGameController ) ;
MenuEntry_DisableOnCondition ( & ME_JOYSTICK_DEFAULTS_PRO , ! joystick . isGameController ) ;
break ;
2017-07-31 01:34:54 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-05-31 12:26:41 +00:00
case MENU_MOUSESETUP :
2019-10-22 22:51:49 +00:00
MenuEntry_DisableOnCondition ( & ME_MOUSESETUP_MOUSEAIMING , in_aimmode ) ;
2014-05-31 12:26:41 +00:00
break ;
2017-07-31 01:34:54 +00:00
# endif
2014-05-31 12:26:41 +00:00
case MENU_NETOPTIONS :
2015-02-22 22:15:20 +00:00
if ( MEOSV_NetEpisodes [ MEO_NETOPTIONS_EPISODE . currentOption ] = = MAXVOLUMES )
2014-05-31 12:26:41 +00:00
MEL_NETOPTIONS [ 2 ] = & ME_NETOPTIONS_USERMAP ;
else
{
MEL_NETOPTIONS [ 2 ] = & ME_NETOPTIONS_LEVEL ;
2015-02-22 22:15:20 +00:00
MEO_NETOPTIONS_LEVEL . options = & MEOS_NETOPTIONS_LEVEL [ MEOSV_NetEpisodes [ MEO_NETOPTIONS_EPISODE . currentOption ] ] ;
2014-05-31 12:26:41 +00:00
}
2019-11-09 18:15:03 +00:00
if ( ! ( g_gametypeFlags [ m_coop ] & GAMETYPE_MARKEROPTION ) )
2017-06-19 23:07:09 +00:00
{
ME_NETOPTIONS_MARKERS . type = Dummy ;
ME_NETOPTIONS_MARKERS . flags | = MEF_Disabled ;
}
else
{
ME_NETOPTIONS_MARKERS . type = Option ;
ME_NETOPTIONS_MARKERS . flags & = ~ MEF_Disabled ;
}
2019-11-09 18:15:03 +00:00
MEL_NETOPTIONS [ 5 ] = ( g_gametypeFlags [ m_coop ] & ( GAMETYPE_PLAYERSFRIENDLY | GAMETYPE_TDM ) ) ? & ME_NETOPTIONS_FRFIRE : & ME_NETOPTIONS_MAPEXITS ;
2014-05-31 12:26:41 +00:00
break ;
2006-05-05 07:10:36 +00:00
2014-05-31 12:26:41 +00:00
case MENU_OPTIONS :
2014-12-27 18:37:12 +00:00
MenuEntry_DisableOnCondition ( & ME_OPTIONS_PLAYERSETUP , ud . recstat = = 1 ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-04-13 20:47:06 +00:00
2016-10-09 00:15:14 +00:00
case MENU_COLCORR :
case MENU_COLCORR_INGAME :
break ;
2015-03-24 10:49:03 +00:00
case MENU_CHEATS :
case MENU_CHEATENTRY :
case MENU_CHEAT_WARP :
case MENU_CHEAT_SKILL :
{
const int32_t menucheatsdisabled = numplayers ! = 1 | | ! ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) ;
2018-02-20 11:55:16 +00:00
// refresh display names of quote cheats
if ( ! DUKEBETA )
{
ME_CheatCodes [ CHEATFUNC_QUOTEBETA ] . name = apStrings [ QUOTE_CHEAT_BETA ] ;
2019-08-07 19:12:11 +00:00
if ( ! NAM )
ME_CheatCodes [ CHEATFUNC_QUOTETODD ] . name = apStrings [ QUOTE_CHEAT_TODD ] ;
2018-02-20 11:55:16 +00:00
ME_CheatCodes [ CHEATFUNC_QUOTEALLEN ] . name = apStrings [ QUOTE_CHEAT_ALLEN ] ;
}
2015-03-24 10:49:03 +00:00
for ( i = 0 ; i < NUMCHEATFUNCS ; i + + )
{
2015-11-25 12:08:28 +00:00
uint32_t cheatmask = cl_cheatmask & ( 1 < < i ) ;
// KEEPINSYNC: NAM_WW2GI_CHEATS
if ( NAM_WW2GI )
{
switch ( i )
{
case CHEATFUNC_CASHMAN :
case CHEATFUNC_GIVEALLITEMS :
case CHEATFUNC_QUOTEBETA :
case CHEATFUNC_MONSTERS :
case CHEATFUNC_QUOTEALLEN :
case CHEATFUNC_GIVEKEYS :
cheatmask = 0 ;
break ;
}
}
if ( WW2GI )
{
switch ( i )
{
case CHEATFUNC_HYPER :
cheatmask = 0 ;
break ;
}
}
2018-02-20 11:55:07 +00:00
MenuEntry_t & entry = ME_CheatCodes [ i ] ;
2018-02-20 11:55:16 +00:00
// only show cheats that have been typed in before and are not undefined
MenuEntry_HideOnCondition ( & entry , ! cheatmask | | CheatStrings [ CheatFunctionIDs [ i ] ] [ 0 ] = = ' \0 ' ) ;
2015-03-24 10:49:03 +00:00
// disable outside of a single-player game
2018-02-20 11:55:07 +00:00
MenuEntry_DisableOnCondition ( & entry , menucheatsdisabled ) ;
2015-03-24 10:49:03 +00:00
}
2016-03-14 00:07:48 +00:00
MenuEntry_DisableOnCondition ( & ME_ENTERCHEAT , ( cl_cheatmask = = UINT32_MAX ) ) ;
2015-03-24 10:49:03 +00:00
break ;
}
2019-07-18 03:06:47 +00:00
case MENU_EPISODE :
ud . m_volume_number = M_EPISODE . currentEntry < g_volumeCnt ? M_EPISODE . currentEntry : - 1 ;
break ;
case MENU_SKILL :
ud . m_player_skill = M_SKILL . currentEntry + 1 ;
break ;
2014-05-31 12:26:41 +00:00
default :
break ;
}
}
2006-04-19 08:00:09 +00:00
2014-07-22 11:19:58 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_PreDrawBackground ( MenuID_t cm , const vec2_t origin )
2014-07-22 11:19:58 +00:00
{
switch ( cm )
{
case MENU_CREDITS :
case MENU_CREDITS2 :
case MENU_CREDITS3 :
if ( ! VOLUMEALL | | ! PLUTOPAK )
2016-11-01 01:35:32 +00:00
Menu_DrawBackground ( origin ) ;
2014-07-22 11:19:58 +00:00
else
2014-10-27 10:14:50 +00:00
rotatesprite_fs ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) , origin . y + ( 100 < < 16 ) , 65536L , 0 , 2504 + cm - MENU_CREDITS , 0 , 0 , 10 + 64 ) ;
2014-07-22 11:19:58 +00:00
break ;
case MENU_LOAD :
case MENU_SAVE :
2019-07-19 01:49:29 +00:00
if ( FURY )
2018-03-08 03:55:48 +00:00
break ;
fallthrough__ ;
2014-07-22 11:19:58 +00:00
case MENU_CREDITS4 :
case MENU_CREDITS5 :
2016-11-01 01:35:32 +00:00
Menu_DrawBackground ( origin ) ;
2014-07-22 11:19:58 +00:00
break ;
case MENU_STORY :
2014-10-27 07:09:41 +00:00
rotatesprite_fs ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) , origin . y + ( 100 < < 16 ) , 65536L , 0 , TEXTSTORY , 0 , 0 , 10 + 64 ) ;
2014-07-22 11:19:58 +00:00
break ;
case MENU_F1HELP :
2014-10-27 07:09:41 +00:00
rotatesprite_fs ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) , origin . y + ( 100 < < 16 ) , 65536L , 0 , F1HELP , 0 , 0 , 10 + 64 ) ;
2014-07-22 11:19:58 +00:00
break ;
}
}
2019-08-15 04:39:38 +00:00
static void Menu_DrawVerifyPrompt ( int32_t x , int32_t y , const char * text , int numlines = 1 )
2019-08-14 05:25:31 +00:00
{
mgametextcenter ( x , y + ( 90 < < 16 ) , text ) ;
# ifndef EDUKE32_ANDROID_MENU
char const * inputs = CONTROL_LastSeenInput = = LastSeenInput : : Joystick
? " Press (A) to accept, (B) to return. "
: " (Y/N) " ;
2019-08-15 04:39:38 +00:00
mgametextcenter ( x , y + ( 90 < < 16 ) + MF_Bluefont . get_yline ( ) * numlines , inputs ) ;
2019-08-14 05:25:31 +00:00
# endif
}
2016-11-01 01:35:32 +00:00
static void Menu_PreDraw ( MenuID_t cm , MenuEntry_t * entry , const vec2_t origin )
2014-05-31 12:26:41 +00:00
{
2018-02-20 11:55:24 +00:00
int32_t i , j , l = 0 ;
2007-02-05 01:33:08 +00:00
2014-05-31 12:26:41 +00:00
switch ( cm )
{
case MENU_MAIN_INGAME :
l + = 4 ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-05-31 12:26:41 +00:00
case MENU_MAIN :
2017-12-12 05:13:49 +00:00
if ( ( G_GetLogoFlags ( ) & LOGO_NOGAMETITLE ) = = 0 )
{
rotatesprite_fs ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) , origin . y + ( ( 28 + l ) < < 16 ) , 65536L , 0 , INGAMEDUKETHREEDEE , 0 , 0 , 10 ) ;
if ( PLUTOPAK ) // JBF 20030804
2019-08-27 13:39:54 +00:00
rotatesprite_fs ( origin . x + ( ( MENU_MARGIN_CENTER + 100 ) < < 16 ) , origin . y + ( 36 < < 16 ) , 65536L , 0 , PLUTOPAKSPRITE + 2 , ( sintable [ ( ( int32_t ) totalclock < < 4 ) & 2047 ] > > 11 ) , 0 , 2 + 8 ) ;
2017-12-12 05:13:49 +00:00
}
2014-05-31 12:26:41 +00:00
break ;
2008-11-11 13:24:05 +00:00
2014-05-31 12:26:41 +00:00
case MENU_PLAYER :
2019-11-09 18:15:03 +00:00
rotatesprite_fs ( origin . x + ( 260 < < 16 ) , origin . y + ( ( 24 + ( tilesiz [ APLAYER ] . y > > 1 ) ) < < 16 ) , 49152L , 0 , 1441 - ( ( ( ( 4 - ( ( int32_t ) totalclock > > 4 ) ) ) & 3 ) * 5 ) , 0 , entry = = & ME_PLAYER_TEAM ? G_GetTeamPalette ( playerteam ) : playercolor , 10 ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-04-22 06:10:28 +00:00
2014-03-26 09:14:01 +00:00
case MENU_MACROS :
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( 144 < < 16 ) , " Activate in-game with Shift-F# " ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-04-22 06:10:28 +00:00
2014-05-31 12:26:41 +00:00
case MENU_COLCORR :
case MENU_COLCORR_INGAME :
2014-10-27 07:09:41 +00:00
// center panel
rotatesprite_fs ( origin . x + ( 120 < < 16 ) , origin . y + ( 32 < < 16 ) , 16384 , 0 , 3290 , 0 , 0 , 2 | 8 | 16 ) ;
rotatesprite_fs ( origin . x + ( 160 < < 16 ) - ( tilesiz [ BOTTOMSTATUSBAR ] . x < < 13 ) , origin . y + ( 82 < < 16 ) - ( tilesiz [ BOTTOMSTATUSBAR ] . y < < 14 ) , 16384 , 0 , BOTTOMSTATUSBAR , 0 , 0 , 2 | 8 | 16 ) ;
// left panel
rotatesprite_fs ( origin . x + ( 40 < < 16 ) , origin . y + ( 32 < < 16 ) , 16384 , 0 , BONUSSCREEN , 0 , 0 , 2 | 8 | 16 ) ;
// right panel
rotatesprite_fs ( origin . x + ( 200 < < 16 ) , origin . y + ( 32 < < 16 ) , 16384 , 0 , LOADSCREEN , 0 , 0 , 2 | 8 | 16 ) ;
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case MENU_NETSETUP :
2014-03-26 09:14:01 +00:00
case MENU_NETHOST :
2018-01-29 02:14:16 +00:00
mminitext ( origin . x + ( 90 < < 16 ) , origin . y + ( 90 < < 16 ) , " Game Type " , MF_Minifont . pal_deselected ) ;
mminitext ( origin . x + ( 90 < < 16 ) , origin . y + ( ( 90 + 8 ) < < 16 ) , " Episode " , MF_Minifont . pal_deselected ) ;
mminitext ( origin . x + ( 90 < < 16 ) , origin . y + ( ( 90 + 8 + 8 ) < < 16 ) , " Level " , MF_Minifont . pal_deselected ) ;
mminitext ( origin . x + ( 90 < < 16 ) , origin . y + ( ( 90 + 8 + 8 + 8 ) < < 16 ) , ME_NETOPTIONS_MONSTERS . name , MF_Minifont . pal_deselected ) ;
2019-11-09 18:15:03 +00:00
if ( m_coop = = 0 )
2018-01-29 02:14:16 +00:00
mminitext ( origin . x + ( 90 < < 16 ) , origin . y + ( ( 90 + 8 + 8 + 8 + 8 ) < < 16 ) , " Markers " , MF_Minifont . pal_deselected ) ;
2019-11-09 18:15:03 +00:00
else if ( m_coop = = 1 )
2018-01-29 02:14:16 +00:00
mminitext ( origin . x + ( 90 < < 16 ) , origin . y + ( ( 90 + 8 + 8 + 8 + 8 ) < < 16 ) , " Friendly Fire " , MF_Minifont . pal_deselected ) ;
mminitext ( origin . x + ( 90 < < 16 ) , origin . y + ( ( 90 + 8 + 8 + 8 + 8 + 8 ) < < 16 ) , " User Map " , MF_Minifont . pal_deselected ) ;
2006-11-16 03:02:42 +00:00
2019-11-09 18:15:03 +00:00
mminitext ( origin . x + ( ( 90 + 60 ) < < 16 ) , origin . y + ( 90 < < 16 ) , g_gametypeNames [ m_coop ] , MF_Minifont . pal_deselected_right ) ;
2006-11-16 03:02:42 +00:00
2018-01-29 02:14:16 +00:00
mminitext ( origin . x + ( ( 90 + 60 ) < < 16 ) , origin . y + ( ( 90 + 8 ) < < 16 ) , g_volumeNames [ ud . m_volume_number ] , MF_Minifont . pal_deselected_right ) ;
2019-11-09 18:15:03 +00:00
mminitext ( origin . x + ( ( 90 + 60 ) < < 16 ) , origin . y + ( ( 90 + 8 + 8 ) < < 16 ) , g_mapInfo [ MAXLEVELS * ud . m_volume_number + m_level_number ] . name , MF_Minifont . pal_deselected_right ) ;
2006-11-16 03:02:42 +00:00
if ( ud . m_monsters_off = = 0 | | ud . m_player_skill > 0 )
2018-01-29 02:14:16 +00:00
mminitext ( origin . x + ( ( 90 + 60 ) < < 16 ) , origin . y + ( ( 90 + 8 + 8 + 8 ) < < 16 ) , g_skillNames [ ud . m_player_skill ] , MF_Minifont . pal_deselected_right ) ;
else mminitext ( origin . x + ( ( 90 + 60 ) < < 16 ) , origin . y + ( ( 90 + 8 + 8 + 8 ) < < 16 ) , " None " , MF_Minifont . pal_deselected_right ) ;
2019-11-09 18:15:03 +00:00
if ( m_coop = = 0 )
2006-11-16 03:02:42 +00:00
{
2019-11-09 18:15:03 +00:00
if ( m_marker ) mminitext ( origin . x + ( ( 90 + 60 ) < < 16 ) , origin . y + ( ( 90 + 8 + 8 + 8 + 8 ) < < 16 ) , " On " , MF_Minifont . pal_deselected_right ) ;
2018-01-29 02:14:16 +00:00
else mminitext ( origin . x + ( ( 90 + 60 ) < < 16 ) , origin . y + ( ( 90 + 8 + 8 + 8 + 8 ) < < 16 ) , " Off " , MF_Minifont . pal_deselected_right ) ;
2006-11-16 03:02:42 +00:00
}
2019-11-09 18:15:03 +00:00
else if ( m_coop = = 1 )
2006-11-16 03:02:42 +00:00
{
2019-11-09 18:15:03 +00:00
if ( m_ffire ) mminitext ( origin . x + ( ( 90 + 60 ) < < 16 ) , origin . y + ( ( 90 + 8 + 8 + 8 + 8 ) < < 16 ) , " On " , MF_Minifont . pal_deselected_right ) ;
2018-01-29 02:14:16 +00:00
else mminitext ( origin . x + ( ( 90 + 60 ) < < 16 ) , origin . y + ( ( 90 + 8 + 8 + 8 + 8 ) < < 16 ) , " Off " , MF_Minifont . pal_deselected_right ) ;
2006-11-16 03:02:42 +00:00
}
break ;
2014-05-31 12:26:41 +00:00
case MENU_RESETPLAYER :
2018-04-12 21:03:12 +00:00
videoFadeToBlack ( 1 ) ;
2019-08-14 05:25:31 +00:00
Bsprintf ( tempbuf , " Load last game: \n \" %s \" " , g_quickload - > name ) ;
2019-08-15 04:39:38 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , tempbuf , 2 ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case MENU_LOAD :
2017-12-18 11:24:53 +00:00
{
#if 0
2014-05-31 12:26:41 +00:00
for ( i = 0 ; i < = 108 ; i + = 12 )
2014-10-27 07:09:41 +00:00
rotatesprite_fs ( origin . x + ( ( 160 + 64 + 91 - 64 ) < < 16 ) , origin . y + ( ( i + 56 ) < < 16 ) , 65536L , 0 , TEXTBOX , 24 , 0 , 10 ) ;
2017-12-18 11:24:53 +00:00
# endif
Menu_BlackRectangle ( origin . x + ( 198 < < 16 ) , origin . y + ( 47 < < 16 ) , 102 < < 16 , 100 < < 16 , 1 | 32 ) ;
2006-11-16 03:02:42 +00:00
2014-10-27 07:09:41 +00:00
rotatesprite_fs ( origin . x + ( 22 < < 16 ) , origin . y + ( 97 < < 16 ) , 65536L , 0 , WINDOWBORDER2 , 24 , 0 , 10 ) ;
rotatesprite_fs ( origin . x + ( 180 < < 16 ) , origin . y + ( 97 < < 16 ) , 65536L , 1024 , WINDOWBORDER2 , 24 , 0 , 10 ) ;
rotatesprite_fs ( origin . x + ( 99 < < 16 ) , origin . y + ( 50 < < 16 ) , 65536L , 512 , WINDOWBORDER1 , 24 , 0 , 10 ) ;
rotatesprite_fs ( origin . x + ( 103 < < 16 ) , origin . y + ( 144 < < 16 ) , 65536L , 1024 + 512 , WINDOWBORDER1 , 24 , 0 , 10 ) ;
2006-11-16 03:02:42 +00:00
2017-12-18 11:24:53 +00:00
if ( M_LOAD . currentEntry > = ( int32_t ) g_nummenusaves )
{
2018-02-26 14:46:44 +00:00
menutext_centeralign ( origin . x + ( 101 < < 16 ) , origin . y + ( 97 < < 16 ) , " Empty " ) ;
2017-12-18 11:24:53 +00:00
break ;
}
menusave_t & msv = g_menusaves [ M_LOAD . currentEntry ] ;
if ( msv . brief . isValid ( ) )
2006-11-16 03:02:42 +00:00
{
2019-10-11 21:31:59 +00:00
if ( tilePtr ( TILE_LOADSHOT ) )
2019-08-07 22:36:16 +00:00
rotatesprite_fs ( origin . x + ( 101 < < 16 ) , origin . y + ( 97 < < 16 ) , 65536 > > 1 , 512 , TILE_LOADSHOT , msv . isOldVer ? 16 : - 32 , 0 , 4 + 10 + 64 ) ;
2014-05-31 12:26:41 +00:00
2017-12-18 11:24:53 +00:00
if ( msv . isOldVer )
2014-05-31 12:26:41 +00:00
{
2019-08-07 22:36:16 +00:00
mgametextcenterat ( origin . x + ( 101 < < 16 ) , origin . y + ( 50 < < 16 ) ,
msv . brief . isExt ? " Previous Version, \n Sequence Point Available " : " Previous Version, \n Unable to Load " ) ;
2014-05-31 12:26:41 +00:00
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2018-10-25 23:31:20 +00:00
Bsprintf ( tempbuf , " Saved: %d.%d.%d.%u %d-bit " , savehead . majorver , savehead . minorver ,
2018-03-08 03:55:07 +00:00
savehead . bytever , savehead . userbytever , 8 * savehead . getPtrSize ( ) ) ;
2019-08-07 22:36:16 +00:00
mgametext ( origin . x + ( 25 < < 16 ) , origin . y + ( 124 < < 16 ) , tempbuf ) ;
2018-10-25 23:31:20 +00:00
Bsprintf ( tempbuf , " Our: %d.%d.%d.%u %d-bit " , SV_MAJOR_VER , SV_MINOR_VER , BYTEVERSION ,
2018-03-08 03:55:07 +00:00
ud . userbytever , ( int32_t ) ( 8 * sizeof ( intptr_t ) ) ) ;
2019-08-07 22:36:16 +00:00
mgametext ( origin . x + ( ( 25 + 16 ) < < 16 ) , origin . y + ( 134 < < 16 ) , tempbuf ) ;
2014-09-30 04:07:29 +00:00
# endif
2018-02-26 14:46:40 +00:00
2019-08-07 22:36:16 +00:00
if ( msv . isUnreadable )
break ;
2014-05-31 12:26:41 +00:00
}
2014-12-27 18:35:34 +00:00
if ( savehead . numplayers > 1 )
{
Bsprintf ( tempbuf , " Players: %-2d " , savehead . numplayers ) ;
mgametextcenter ( origin . x , origin . y + ( 156 < < 16 ) , tempbuf ) ;
}
2014-09-30 04:07:29 +00:00
2014-11-01 18:01:28 +00:00
{
2016-08-27 01:42:01 +00:00
const char * name = g_mapInfo [ ( savehead . volnum * MAXLEVELS ) + savehead . levnum ] . name ;
Bsprintf ( tempbuf , " %s / %s " , name ? name : " ^10unnamed^0 " , g_skillNames [ savehead . skill - 1 ] ) ;
2014-11-01 18:01:28 +00:00
}
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( 168 < < 16 ) , tempbuf ) ;
2014-05-31 12:26:41 +00:00
if ( savehead . volnum = = 0 & & savehead . levnum = = 7 )
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( 180 < < 16 ) , savehead . boardfn ) ;
2006-11-16 03:02:42 +00:00
}
break ;
2017-12-18 11:24:53 +00:00
}
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
case MENU_SAVE :
2017-12-18 11:24:53 +00:00
{
#if 0
2014-05-31 12:26:41 +00:00
for ( i = 0 ; i < = 108 ; i + = 12 )
2014-10-27 07:09:41 +00:00
rotatesprite_fs ( origin . x + ( ( 160 + 64 + 91 - 64 ) < < 16 ) , origin . y + ( ( i + 56 ) < < 16 ) , 65536L , 0 , TEXTBOX , 24 , 0 , 10 ) ;
2017-12-18 11:24:53 +00:00
# endif
Menu_BlackRectangle ( origin . x + ( 198 < < 16 ) , origin . y + ( 47 < < 16 ) , 102 < < 16 , 100 < < 16 , 1 | 32 ) ;
2006-04-13 20:47:06 +00:00
2014-10-27 07:09:41 +00:00
rotatesprite_fs ( origin . x + ( 22 < < 16 ) , origin . y + ( 97 < < 16 ) , 65536L , 0 , WINDOWBORDER2 , 24 , 0 , 10 ) ;
rotatesprite_fs ( origin . x + ( 180 < < 16 ) , origin . y + ( 97 < < 16 ) , 65536L , 1024 , WINDOWBORDER2 , 24 , 0 , 10 ) ;
rotatesprite_fs ( origin . x + ( 99 < < 16 ) , origin . y + ( 50 < < 16 ) , 65536L , 512 , WINDOWBORDER1 , 24 , 0 , 10 ) ;
rotatesprite_fs ( origin . x + ( 103 < < 16 ) , origin . y + ( 144 < < 16 ) , 65536L , 1024 + 512 , WINDOWBORDER1 , 24 , 0 , 10 ) ;
2014-05-31 12:26:41 +00:00
2014-11-30 04:23:22 +00:00
j = 0 ;
2018-10-25 23:31:54 +00:00
for ( int k = 0 ; k < g_nummenusaves + 1 ; + + k )
2017-12-18 11:24:53 +00:00
if ( ( ( MenuString_t * ) M_SAVE . entrylist [ k ] - > entry ) - > editfield )
2014-11-30 04:23:22 +00:00
j | = 1 ;
if ( j )
rotatesprite_fs ( origin . x + ( 101 < < 16 ) , origin . y + ( 97 < < 16 ) , 65536L > > 1 , 512 , TILE_SAVESHOT , - 32 , 0 , 4 + 10 + 64 ) ;
2017-12-18 11:24:53 +00:00
else if ( 0 < M_SAVE . currentEntry & & M_SAVE . currentEntry < = ( int32_t ) g_nummenusaves )
2014-11-30 04:23:22 +00:00
{
2019-08-07 22:36:16 +00:00
menusave_t & msv = g_menusaves [ M_SAVE . currentEntry - 1 ] ;
if ( msv . brief . isValid ( ) )
2017-12-18 11:24:53 +00:00
{
2019-10-11 21:31:59 +00:00
if ( tilePtr ( TILE_LOADSHOT ) )
2019-08-07 22:36:16 +00:00
rotatesprite_fs ( origin . x + ( 101 < < 16 ) , origin . y + ( 97 < < 16 ) , 65536 > > 1 , 512 , TILE_LOADSHOT , msv . isOldVer ? 16 : - 32 , 0 , 4 + 10 + 64 ) ;
2017-12-18 11:24:53 +00:00
2019-08-07 22:36:16 +00:00
if ( msv . isOldVer )
2017-12-18 11:24:53 +00:00
{
2019-08-07 22:36:16 +00:00
mgametextcenterat ( origin . x + ( 101 < < 16 ) , origin . y + ( 50 < < 16 ) ,
msv . brief . isExt ? " Previous Version, \n Sequence Point Available " : " Previous Version, \n Unable to Load " ) ;
2006-04-13 20:47:06 +00:00
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2018-10-25 23:31:20 +00:00
Bsprintf ( tempbuf , " Saved: %d.%d.%d.%u %d-bit " , savehead . majorver , savehead . minorver ,
2018-03-08 03:55:07 +00:00
savehead . bytever , savehead . userbytever , 8 * savehead . getPtrSize ( ) ) ;
2019-08-07 22:36:16 +00:00
mgametext ( origin . x + ( 25 < < 16 ) , origin . y + ( 124 < < 16 ) , tempbuf ) ;
2018-10-25 23:31:20 +00:00
Bsprintf ( tempbuf , " Our: %d.%d.%d.%u %d-bit " , SV_MAJOR_VER , SV_MINOR_VER , BYTEVERSION ,
2018-03-08 03:55:07 +00:00
ud . userbytever , ( int32_t ) ( 8 * sizeof ( intptr_t ) ) ) ;
2019-08-07 22:36:16 +00:00
mgametext ( origin . x + ( ( 25 + 16 ) < < 16 ) , origin . y + ( 134 < < 16 ) , tempbuf ) ;
2014-09-30 04:07:29 +00:00
# endif
2017-12-18 11:24:53 +00:00
}
}
2006-11-16 03:02:42 +00:00
}
2017-12-18 11:24:53 +00:00
else
2018-02-26 14:46:44 +00:00
menutext_centeralign ( origin . x + ( 101 < < 16 ) , origin . y + ( 97 < < 16 ) , " New " ) ;
2006-04-13 20:47:06 +00:00
2014-12-27 18:35:34 +00:00
if ( ud . multimode > 1 )
{
Bsprintf ( tempbuf , " Players: %-2d " , ud . multimode ) ;
mgametextcenter ( origin . x , origin . y + ( 156 < < 16 ) , tempbuf ) ;
}
2014-09-30 04:07:29 +00:00
2016-08-27 01:42:01 +00:00
Bsprintf ( tempbuf , " %s / %s " , g_mapInfo [ ( ud . volume_number * MAXLEVELS ) + ud . level_number ] . name , g_skillNames [ ud . player_skill - 1 ] ) ;
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( 168 < < 16 ) , tempbuf ) ;
2014-05-31 12:26:41 +00:00
if ( ud . volume_number = = 0 & & ud . level_number = = 7 )
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( 180 < < 16 ) , currentboardfilename ) ;
2014-05-31 12:26:41 +00:00
break ;
2017-12-18 11:24:53 +00:00
}
2006-04-13 20:47:06 +00:00
2017-01-18 22:21:40 +00:00
# ifdef EDUKE32_ANDROID_MENU
2014-09-30 04:07:29 +00:00
case MENU_SKILL :
{
2014-11-30 02:04:36 +00:00
static const char * s [ ] = { " EASY - Few enemies, and lots of stuff. " , " MEDIUM - Normal difficulty. " , " HARD - For experienced players. " , " EXPERTS - Lots of enemies, plus they respawn! " } ;
2018-10-25 23:31:54 +00:00
if ( M_SKILL . currentEntry < ARRAY_SSIZE ( s ) )
2014-11-30 02:04:36 +00:00
mgametextcenter ( origin . x , origin . y + ( 168 < < 16 ) , s [ M_SKILL . currentEntry ] ) ;
2014-09-30 04:07:29 +00:00
}
break ;
# endif
2018-03-08 03:55:45 +00:00
case MENU_SAVECLEANVERIFY :
2018-04-12 21:03:12 +00:00
videoFadeToBlack ( 1 ) ;
2018-03-08 05:15:11 +00:00
if ( g_oldSaveCnt )
{
2019-08-14 05:25:31 +00:00
Bsprintf ( tempbuf , " Delete %d obsolete saves? \n This action cannot be undone. " , g_oldSaveCnt ) ;
2019-08-15 04:39:38 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , tempbuf , 2 ) ;
2018-03-08 05:15:11 +00:00
}
else
2019-08-14 05:25:31 +00:00
mgametextcenter ( origin . x , origin . y + ( 90 < < 16 ) , " No obsolete saves found! " ) ;
2018-03-08 05:15:11 +00:00
2018-03-08 03:55:45 +00:00
break ;
2014-05-31 12:26:41 +00:00
case MENU_LOADVERIFY :
2017-12-18 11:24:53 +00:00
{
2018-04-12 21:03:12 +00:00
videoFadeToBlack ( 1 ) ;
2017-12-18 11:24:53 +00:00
menusave_t & msv = g_menusaves [ M_LOAD . currentEntry ] ;
2019-07-31 03:39:30 +00:00
if ( msv . isOldVer & & msv . brief . isExt )
2014-12-27 18:35:34 +00:00
{
2019-08-14 05:25:31 +00:00
Bsprintf ( tempbuf , " Resume game from sequence point: \n \" %s \" " , msv . brief . name ) ;
2019-08-15 04:39:38 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , tempbuf , 2 ) ;
2019-07-31 03:39:30 +00:00
}
else if ( msv . isOldVer )
{
# if 1
mgametextcenter ( origin . x , origin . y + ( 90 < < 16 ) , " You're not supposed to be here. " ) ;
# else
2017-07-06 14:43:11 +00:00
Bsprintf ( tempbuf , " Start new game: \n %s / %s "
, g_mapInfo [ ( ud . volume_number * MAXLEVELS ) + ud . level_number ] . name , g_skillNames [ ud . player_skill - 1 ] ) ;
2019-08-15 04:39:38 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , tempbuf , 2 ) ;
2019-07-31 03:39:30 +00:00
# endif
2014-12-27 18:35:34 +00:00
}
else
{
2019-08-14 05:25:31 +00:00
Bsprintf ( tempbuf , " Load game: \n \" %s \" " , msv . brief . name ) ;
2019-08-15 04:39:38 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , tempbuf , 2 ) ;
2017-07-06 14:43:11 +00:00
}
2014-05-31 12:26:41 +00:00
break ;
2017-12-18 11:24:53 +00:00
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case MENU_SAVEVERIFY :
2018-04-12 21:03:12 +00:00
videoFadeToBlack ( 1 ) ;
2019-08-14 05:25:31 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , " Overwrite previous saved game? " ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-04-13 20:47:06 +00:00
2018-03-08 03:55:45 +00:00
case MENU_LOADDELVERIFY :
case MENU_SAVEDELVERIFY :
{
2018-04-12 21:03:12 +00:00
videoFadeToBlack ( 1 ) ;
2018-03-08 03:55:45 +00:00
menusave_t & msv = cm = = MENU_LOADDELVERIFY ? g_menusaves [ M_LOAD . currentEntry ] : g_menusaves [ M_SAVE . currentEntry - 1 ] ;
2019-08-14 05:25:31 +00:00
Bsprintf ( tempbuf , " Delete saved game: \n \" %s \" ? " , msv . brief . name ) ;
2019-08-15 04:39:38 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , tempbuf , 2 ) ;
2018-03-08 03:55:45 +00:00
break ;
}
2014-05-31 12:26:41 +00:00
case MENU_NEWVERIFY :
2018-04-12 21:03:12 +00:00
videoFadeToBlack ( 1 ) ;
2019-08-14 05:25:31 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , " Abort this game? " ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-04-13 20:47:06 +00:00
2019-08-13 09:16:02 +00:00
case MENU_COLCORRRESETVERIFY :
videoFadeToBlack ( 1 ) ;
2019-08-14 05:25:31 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , " Reset color correction to defaults? " ) ;
2019-08-13 09:16:02 +00:00
break ;
case MENU_KEYSRESETVERIFY :
videoFadeToBlack ( 1 ) ;
2019-08-14 05:25:31 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , " Reset keys to defaults? " ) ;
2019-08-13 09:16:02 +00:00
break ;
case MENU_KEYSCLASSICVERIFY :
videoFadeToBlack ( 1 ) ;
2019-08-14 05:25:31 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , " Reset keys to classic defaults? " ) ;
2019-08-13 09:16:02 +00:00
break ;
case MENU_JOYSTANDARDVERIFY :
videoFadeToBlack ( 1 ) ;
2019-08-14 05:25:31 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , " Reset gamepad to standard layout? " ) ;
2019-08-13 09:16:02 +00:00
break ;
case MENU_JOYPROVERIFY :
videoFadeToBlack ( 1 ) ;
2019-08-14 05:25:31 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , " Reset gamepad to pro layout? " ) ;
2019-08-13 09:16:02 +00:00
break ;
case MENU_JOYCLEARVERIFY :
videoFadeToBlack ( 1 ) ;
2019-08-14 05:25:31 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , " Clear all gamepad settings? " ) ;
2019-08-13 09:16:02 +00:00
break ;
2014-05-31 12:26:41 +00:00
case MENU_QUIT :
case MENU_QUIT_INGAME :
2018-04-12 21:03:12 +00:00
videoFadeToBlack ( 1 ) ;
2019-08-14 05:25:31 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , " Are you sure you want to quit? " ) ;
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case MENU_QUITTOTITLE :
2018-04-12 21:03:12 +00:00
videoFadeToBlack ( 1 ) ;
2019-08-14 05:25:31 +00:00
Menu_DrawVerifyPrompt ( origin . x , origin . y , " End game and return to title screen? " ) ;
2014-05-31 12:26:41 +00:00
break ;
2014-03-26 09:14:01 +00:00
2014-05-31 12:26:41 +00:00
case MENU_NETWAITMASTER :
G_DrawFrags ( ) ;
2015-01-13 12:56:19 +00:00
mgametextcenter ( origin . x , origin . y + ( 50 < < 16 ) , " Waiting for master \n "
" to select level " ) ;
2014-05-31 12:26:41 +00:00
break ;
2012-06-03 16:11:22 +00:00
2014-05-31 12:26:41 +00:00
case MENU_NETWAITVOTES :
G_DrawFrags ( ) ;
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( 90 < < 16 ) , " Waiting for votes " ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-04-13 20:47:06 +00:00
2017-01-18 22:21:40 +00:00
# ifndef EDUKE32_STANDALONE
2014-05-31 12:26:41 +00:00
case MENU_BUYDUKE :
2015-01-13 12:56:19 +00:00
mgametextcenter ( origin . x , origin . y + ( 33 < < 16 ) , " You are playing the shareware \n "
" version of Duke Nukem 3D. While \n "
" this version is really cool, you \n "
" are missing over 75% of the total \n "
" game, along with other great extras \n "
" which you'll get when you order \n "
" the complete version and get \n "
" the final three episodes. " ) ;
2014-09-30 04:07:29 +00:00
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( ( 148 + 16 ) < < 16 ) , " Press any key or button... " ) ;
2006-11-16 03:02:42 +00:00
break ;
2017-01-18 22:21:40 +00:00
# endif
2014-05-31 12:26:41 +00:00
case MENU_CREDITS :
case MENU_CREDITS2 :
case MENU_CREDITS3 :
2017-01-18 22:21:08 +00:00
# ifndef EDUKE32_STANDALONE
2014-05-31 12:26:41 +00:00
if ( ! VOLUMEALL | | ! PLUTOPAK )
{
2018-02-20 11:55:24 +00:00
int32_t m ;
2014-07-22 11:19:58 +00:00
switch ( cm )
2014-05-31 12:26:41 +00:00
{
case MENU_CREDITS :
2014-10-27 07:09:41 +00:00
m = origin . x + ( 20 < < 16 ) ;
l = origin . y + ( 33 < < 16 ) ;
shadowminitext ( m , l , " Original Concept " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Todd Replogle and Allen H. Blum III " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Produced & Directed By " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Greg Malone " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Executive Producer " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " George Broussard " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " BUILD Engine " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Ken Silverman " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Game Programming " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Todd Replogle " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " 3D Engine/Tools/Net " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Ken Silverman " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Network Layer/Setup Program " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Mark Dochtermann " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Map Design " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Allen H. Blum III " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Richard Gray " , 12 ) ; l + = 7 < < 16 ;
m = origin . x + ( 180 < < 16 ) ;
l = origin . y + ( 33 < < 16 ) ;
shadowminitext ( m , l , " 3D Modeling " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Chuck Jones " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Sapphire Corporation " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Artwork " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Dirk Jones, Stephen Hornback " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " James Storey, David Demaret " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Douglas R. Wood " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Sound Engine " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Jim Dose " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Sound & Music Development " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Robert Prince " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Lee Jackson " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Voice Talent " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Lani Minella - Voice Producer " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Jon St. John as \" Duke Nukem \" " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Graphic Design " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Packaging, Manual, Ads " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Robert M. Atkins " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Michael Hadwin " , 12 ) ; l + = 7 < < 16 ;
2014-05-31 12:26:41 +00:00
break ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case MENU_CREDITS2 :
2014-10-27 07:09:41 +00:00
m = origin . x + ( 20 < < 16 ) ;
l = origin . y + ( 33 < < 16 ) ;
shadowminitext ( m , l , " Special Thanks To " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Steven Blackburn, Tom Hall " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Scott Miller, Joe Siegler " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Terry Nagy, Colleen Compton " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " HASH, Inc., FormGen, Inc. " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " The 3D Realms Beta Testers " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Nathan Anderson, Wayne Benner " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Glenn Brensinger, Rob Brown " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Erik Harris, Ken Heckbert " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Terry Herrin, Greg Hively " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Hank Leukart, Eric Baker " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Jeff Rausch, Kelly Rogers " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Mike Duncan, Doug Howell " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " Bill Blair " , 12 ) ; l + = 7 < < 16 ;
m = origin . x + ( 160 < < 16 ) ;
l = origin . y + ( 33 < < 16 ) ;
shadowminitext ( m , l , " Company Product Support " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " The following companies were cool " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " enough to give us lots of stuff " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " during the making of Duke Nukem 3D. " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Altec Lansing Multimedia " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " for tons of speakers and the " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " THX-licensed sound system. " , 12 ) ; l + = 7 < < 16 ;
shadowminitext ( m , l , " For info call 1-800-548-0620 " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Creative Labs, Inc. " , 12 ) ; l + = 7 < < 16 ;
l + = 3 < < 16 ;
shadowminitext ( m , l , " Thanks for the hardware, guys. " , 12 ) ; l + = 7 < < 16 ;
2014-05-31 12:26:41 +00:00
break ;
2006-11-15 01:16:55 +00:00
2014-05-31 12:26:41 +00:00
case MENU_CREDITS3 :
2017-07-06 14:43:11 +00:00
mgametextcenter ( origin . x , origin . y + ( 50 < < 16 ) , " Duke Nukem 3D is a trademark of \n "
" 3D Realms Entertainment "
" \n "
" Duke Nukem 3D \n "
2017-09-23 03:17:26 +00:00
" (C) 1996 3D Realms Entertainment " ) ;
2014-05-17 12:34:14 +00:00
2017-01-18 22:21:40 +00:00
# if !defined(EDUKE32_ANDROID_MENU) && !defined(EDUKE32_STANDALONE)
2014-05-31 12:26:41 +00:00
if ( VOLUMEONE )
2006-11-16 03:02:42 +00:00
{
2015-01-13 12:56:19 +00:00
mgametextcenter ( origin . x , origin . y + ( 106 < < 16 ) , " Please read LICENSE.DOC for shareware \n "
" distribution grants and restrictions. " ) ;
2006-11-15 01:16:55 +00:00
}
2014-09-30 04:07:29 +00:00
# endif
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( ( VOLUMEONE ? 134 : 115 ) < < 16 ) , " Made in Dallas, Texas USA " ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
}
break ;
2017-01-18 22:21:08 +00:00
# endif
2014-05-31 12:26:41 +00:00
case MENU_CREDITS4 : // JBF 20031220
2019-03-04 23:48:59 +00:00
{
# define MENU_YOFFSET 40
# define MENU_INCREMENT(x) (oy += ((x) << 16)) // maybe this should have been MENU_EXCREMENT instead
2006-04-13 20:47:06 +00:00
2019-03-04 23:48:59 +00:00
int32_t oy = origin . y ;
2006-04-13 20:47:06 +00:00
2019-03-04 23:48:59 +00:00
mgametextcenter ( origin . x , MENU_INCREMENT ( MENU_YOFFSET ) , " Developers " ) ;
creditsminitext ( origin . x + ( 160 < < 16 ) , MENU_INCREMENT ( 11 ) , " Richard \" TerminX \" Gobeille " , 8 ) ;
creditsminitext ( origin . x + ( 160 < < 16 ) , MENU_INCREMENT ( 7 ) , " Evan \" Hendricks266 \" Ramos " , 8 ) ;
creditsminitext ( origin . x + ( 160 < < 16 ) , MENU_INCREMENT ( 7 ) , " Alex \" pogokeen \" Dawson " , 8 ) ;
2006-04-13 20:47:06 +00:00
2019-03-04 23:48:59 +00:00
mgametextcenter ( origin . x , MENU_INCREMENT ( 11 ) , " Retired developers " ) ;
creditsminitext ( origin . x + ( 160 < < 16 ) , MENU_INCREMENT ( 11 ) , " Pierre-Loup \" Plagman \" Griffais " , 8 ) ;
creditsminitext ( origin . x + ( 160 < < 16 ) , MENU_INCREMENT ( 7 ) , " Philipp \" Helixhorned \" Kutin " , 8 ) ;
2012-06-03 16:11:22 +00:00
2019-03-04 23:48:59 +00:00
mgametextcenter ( origin . x , MENU_INCREMENT ( 11 ) , " Special thanks to " ) ;
creditsminitext ( origin . x + ( 160 < < 16 ) , MENU_INCREMENT ( 11 ) , " Jonathon \" JonoF \" Fowler " , 8 ) ;
2012-06-03 16:11:22 +00:00
2019-03-04 23:48:59 +00:00
mgametextcenter ( origin . x , MENU_INCREMENT ( 11 ) , " Uses BUILD Engine technology by " ) ;
creditsminitext ( origin . x + ( 160 < < 16 ) , MENU_INCREMENT ( 11 ) , " Ken \" Awesoken \" Silverman " , 8 ) ;
2006-04-13 20:47:06 +00:00
2019-03-04 23:48:59 +00:00
# undef MENU_INCREMENT
# undef MENU_YOFFSET
}
2014-05-31 12:26:41 +00:00
break ;
2006-11-15 01:16:55 +00:00
2014-05-31 12:26:41 +00:00
case MENU_CREDITS5 :
l = 7 ;
2006-12-12 05:59:47 +00:00
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( ( 38 - l ) < < 16 ) , " License and Other Contributors " ) ;
2006-11-16 03:02:42 +00:00
{
2018-02-17 22:30:26 +00:00
static const char * header [ ] =
2006-11-16 03:02:42 +00:00
{
2014-05-31 12:26:41 +00:00
" This program is distributed under the terms of the " ,
" GNU General Public License version 2 as published by the " ,
2014-07-20 08:55:56 +00:00
" Free Software Foundation. See gpl-2.0.txt for details. " ,
2018-02-17 22:30:26 +00:00
" BUILD engine technology available under license. See buildlic.txt. " ,
nullptr ,
2014-09-30 04:07:29 +00:00
" The EDuke32 team thanks the following people for their contributions: " ,
2018-02-17 22:30:26 +00:00
nullptr ,
2014-05-31 12:26:41 +00:00
} ;
2018-02-17 22:30:26 +00:00
static const char * body [ ] =
2014-05-31 12:26:41 +00:00
{
2019-08-13 14:44:05 +00:00
" Alexey Skrybykin " , // Nuke.YKT - Polymost fixes
2014-05-31 12:26:41 +00:00
" Bioman " , // GTK work, APT repository and package upkeep
" Brandon Bergren " , // "Bdragon" - tiles.cfg
" Charlie Honig " , // "CONAN" - showview command
" Dan Gaskill " , // "DeeperThought" - testing
" David Koenig " , // "Bargle" - Merged a couple of things from duke3d_w32
" Ed Coolidge " , // Mapster32 improvements
2015-02-21 23:15:27 +00:00
" Emile Belanger " , // original Android work
2018-02-17 22:30:26 +00:00
" Fox " , // various patches
2014-05-31 12:26:41 +00:00
" Hunter_rus " , // tons of stuff
" James Bentler " , // Mapster32 improvements
" Jasper Foreman " , // netcode contributions
" Javier Martinez " , // "Malone3D" - EDuke 2.1.1 components
" Jeff Hart " , // website graphics
2017-09-23 03:17:26 +00:00
" Jonathan Strander " , // "Mblackwell" - testing and feature speccing
2018-02-17 22:30:26 +00:00
" Jordon Moss " , // "Striker" - various patches, OldMP work
2014-05-31 12:26:41 +00:00
" Jose del Castillo " , // "Renegado" - EDuke 2.1.1 components
" Lachlan McDonald " , // official EDuke32 icon
" LSDNinja " , // OS X help and testing
" Marcus Herbert " , // "rhoenie" - OS X compatibility work
" Matthew Palmer " , // "Usurper" - testing and eduke32.com domain
2014-09-30 04:07:29 +00:00
" Matt Saettler " , // original DOS EDuke/WW2GI enhancements
2018-02-17 22:30:26 +00:00
" NY00123 " , // Linux / SDL usability patches
2014-05-31 12:26:41 +00:00
" Ozkan Sezer " , // SDL/GTK version checking improvements
" Peter Green " , // "Plugwash" - dynamic remapping, custom gametypes
" Peter Veenstra " , // "Qbix" - port to 64-bit
" Robin Green " , // CON array support
" Ryan Gordon " , // "icculus" - icculus.org Duke3D port sound code
" Stephen Anthony " , // early 64-bit porting work
" tueidj " , // Wii port
} ;
2018-02-17 22:30:26 +00:00
EDUKE32_STATIC_ASSERT ( ARRAY_SIZE ( body ) % 3 = = 0 ) ;
static const char * footer [ ] =
2006-12-18 08:37:12 +00:00
{
2018-02-17 22:30:26 +00:00
nullptr ,
" Visit eduke32.com for news and updates " ,
2014-05-31 12:26:41 +00:00
} ;
2018-10-25 23:31:54 +00:00
static constexpr int header_numlines = ARRAY_SIZE ( header ) ;
static constexpr int body_numlines = ARRAY_SIZE ( body ) ;
static constexpr int footer_numlines = ARRAY_SIZE ( footer ) ;
2018-02-17 22:30:26 +00:00
2018-10-25 23:31:54 +00:00
static constexpr int CCOLUMNS = 3 ;
static constexpr int CCOLXBUF = 20 ;
2014-05-31 12:26:41 +00:00
2018-10-25 23:31:54 +00:00
int c ;
2014-05-31 12:26:41 +00:00
i = 0 ;
2018-10-25 23:31:54 +00:00
for ( c = 0 ; c < header_numlines ; c + + )
2018-02-17 22:30:26 +00:00
if ( header [ c ] )
creditsminitext ( origin . x + ( 160 < < 16 ) , origin . y + ( ( 17 + 10 + 10 + 8 + 4 + ( c * 7 ) - l ) < < 16 ) , header [ c ] , 8 ) ;
i + = c ;
2018-10-25 23:31:54 +00:00
for ( c = 0 ; c < body_numlines ; c + + )
2018-02-17 22:30:26 +00:00
if ( body [ c ] )
creditsminitext ( origin . x + ( ( CCOLXBUF + ( ( 320 - CCOLXBUF * 2 ) / ( CCOLUMNS * 2 ) ) + ( ( 320 - CCOLXBUF * 2 ) / CCOLUMNS ) * ( c / ( body_numlines / CCOLUMNS ) ) ) < < 16 ) , origin . y + ( ( 17 + 10 + 10 + 8 + 4 + ( ( c % ( body_numlines / CCOLUMNS ) ) * 7 ) + ( i * 7 ) - l ) < < 16 ) , body [ c ] , 8 ) ;
i + = c / CCOLUMNS ;
2018-10-25 23:31:54 +00:00
for ( c = 0 ; c < footer_numlines ; c + + )
2018-02-17 22:30:26 +00:00
if ( footer [ c ] )
creditsminitext ( origin . x + ( 160 < < 16 ) , origin . y + ( ( 17 + 10 + 10 + 8 + 4 + ( c * 7 ) + ( i * 7 ) - l ) < < 16 ) , footer [ c ] , 8 ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
default :
break ;
}
}
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
2018-03-08 03:55:25 +00:00
static void Menu_ReadSaveGameHeaders ( ) ;
static void Menu_LoadReadHeaders ( )
{
Menu_ReadSaveGameHeaders ( ) ;
2018-10-25 23:31:54 +00:00
for ( int i = 0 ; i < g_nummenusaves ; + + i )
2019-07-31 03:39:30 +00:00
{
menusave_t const & msv = g_menusaves [ i ] ;
// MenuEntry_LookDisabledOnCondition(&ME_LOAD[i], msv.isOldVer && msv.brief.isExt);
MenuEntry_DisableOnCondition ( & ME_LOAD [ i ] , msv . isOldVer & & ! msv . brief . isExt ) ;
}
2018-03-08 03:55:25 +00:00
}
static void Menu_SaveReadHeaders ( )
{
Menu_ReadSaveGameHeaders ( ) ;
2018-10-25 23:31:54 +00:00
for ( int i = 0 ; i < g_nummenusaves ; + + i )
2019-07-31 03:39:30 +00:00
{
menusave_t const & msv = g_menusaves [ i ] ;
MenuEntry_LookDisabledOnCondition ( & ME_SAVE [ i ] , msv . isOldVer & & ! msv . brief . isExt ) ;
}
2018-03-08 03:55:25 +00:00
}
2014-05-31 12:26:41 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_PreInput ( MenuEntry_t * entry )
2014-05-31 12:26:41 +00:00
{
switch ( g_currentMenu )
{
case MENU_KEYBOARDKEYS :
2019-11-03 23:53:55 +00:00
if ( inputState . GetKeyStatus ( sc_Delete ) )
2006-11-16 03:02:42 +00:00
{
2019-11-04 22:01:50 +00:00
Bindings . UnbindACommand ( buttonMap . GetButtonName ( M_KEYBOARDKEYS . currentEntry ) ) ;
2014-11-30 02:04:36 +00:00
S_PlaySound ( KICK_HIT ) ;
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_Delete ) ;
2006-11-16 03:02:42 +00:00
}
break ;
2006-04-13 20:47:06 +00:00
2018-03-08 03:55:25 +00:00
case MENU_LOAD :
2019-11-03 23:53:55 +00:00
if ( inputState . GetKeyStatus ( sc_Delete ) )
2018-03-08 03:55:25 +00:00
{
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_Delete ) ;
2018-10-25 23:31:54 +00:00
if ( M_LOAD . currentEntry < g_nummenusaves )
2018-03-08 03:55:45 +00:00
Menu_Change ( MENU_LOADDELVERIFY ) ;
2018-03-08 03:55:25 +00:00
}
break ;
case MENU_SAVE :
2019-11-03 23:53:55 +00:00
if ( inputState . GetKeyStatus ( sc_Delete ) )
2018-03-08 03:55:25 +00:00
{
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_Delete ) ;
2018-03-08 03:55:25 +00:00
if ( 0 < M_SAVE . currentEntry & & M_SAVE . currentEntry < = ( int32_t ) g_nummenusaves )
2018-03-08 03:55:45 +00:00
Menu_Change ( MENU_SAVEDELVERIFY ) ;
2018-03-08 03:55:25 +00:00
}
break ;
2014-05-31 12:26:41 +00:00
default :
break ;
}
}
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_PreOptionListDraw ( MenuEntry_t * entry , const vec2_t origin )
2014-05-31 12:26:41 +00:00
{
switch ( g_currentMenu )
{
case MENU_MOUSEBTNS :
case MENU_MOUSEADVANCED :
case MENU_JOYSTICKBTNS :
case MENU_JOYSTICKAXIS :
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( 31 < < 16 ) , " Select a function to assign " ) ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
Bsprintf ( tempbuf , " to %s " , entry - > name ) ;
2006-04-13 20:47:06 +00:00
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( ( 31 + 9 ) < < 16 ) , tempbuf ) ;
2006-11-15 01:16:55 +00:00
2014-10-27 07:09:41 +00:00
mgametextcenter ( origin . x , origin . y + ( 161 < < 16 ) , " Press \" Escape \" To Cancel " ) ;
2014-05-31 12:26:41 +00:00
break ;
}
}
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
static int32_t Menu_PreCustom2ColScreen ( MenuEntry_t * entry )
2014-05-31 12:26:41 +00:00
{
if ( g_currentMenu = = MENU_KEYBOARDKEYS )
{
2018-12-15 01:39:51 +00:00
auto column = ( MenuCustom2Col_t * ) entry - > entry ;
2006-04-13 20:47:06 +00:00
2019-11-03 23:53:55 +00:00
int32_t sc = inputState . GetLastScanCode ( ) ;
2014-05-31 12:26:41 +00:00
if ( sc ! = sc_None )
{
S_PlaySound ( PISTOL_BODYHIT ) ;
2019-11-04 22:01:50 +00:00
Bindings . SetBind ( sc , buttonMap . GetButtonName ( M_KEYBOARDKEYS . currentEntry ) ) ;
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc ) ;
2006-11-15 01:16:55 +00:00
2014-06-13 09:04:17 +00:00
return - 1 ;
2006-11-16 03:02:42 +00:00
}
2014-05-31 12:26:41 +00:00
}
2006-11-15 01:16:55 +00:00
2014-05-31 12:26:41 +00:00
return 0 ;
}
2016-11-01 01:35:32 +00:00
static void Menu_PreCustom2ColScreenDraw ( MenuEntry_t * entry , const vec2_t origin )
2014-05-31 12:26:41 +00:00
{
if ( g_currentMenu = = MENU_KEYBOARDKEYS )
{
2017-07-06 14:43:11 +00:00
Bsprintf ( tempbuf , " Press the key to assign as \n "
" %s for \" %s \" \n "
" \n "
" Press \" Escape \" To Cancel "
, M_KEYBOARDKEYS . currentColumn ? " secondary " : " primary " , entry - > name ) ;
mgametextcenter ( origin . x , origin . y + ( 90 < < 16 ) , tempbuf ) ;
2014-05-31 12:26:41 +00:00
}
}
2016-11-01 01:35:32 +00:00
static void Menu_EntryFocus ( /*MenuEntry_t *entry*/ )
2014-05-31 12:26:41 +00:00
{
switch ( g_currentMenu )
{
case MENU_LOAD :
2017-12-18 11:24:53 +00:00
if ( M_LOAD . currentEntry < ( int32_t ) g_nummenusaves )
{
savebrief_t & sv = g_menusaves [ M_LOAD . currentEntry ] . brief ;
if ( sv . isValid ( ) )
G_LoadSaveHeaderNew ( sv . path , & savehead ) ;
}
2014-11-30 02:04:36 +00:00
break ;
2017-12-18 11:24:53 +00:00
2014-05-31 12:26:41 +00:00
case MENU_SAVE :
2017-12-18 11:24:53 +00:00
if ( 0 < M_SAVE . currentEntry & & M_SAVE . currentEntry < = ( int32_t ) g_nummenusaves )
{
savebrief_t & sv = g_menusaves [ M_SAVE . currentEntry - 1 ] . brief ;
if ( sv . isValid ( ) )
G_LoadSaveHeaderNew ( sv . path , & savehead ) ;
}
2006-11-16 03:02:42 +00:00
break ;
2014-05-31 12:26:41 +00:00
default :
break ;
}
}
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_StartGameWithoutSkill ( void )
2015-02-09 05:50:33 +00:00
{
ud . m_player_skill = M_SKILL . currentEntry + 1 ;
2018-11-18 18:07:51 +00:00
ud . skill_voice = S_PlaySound ( PISTOL_BODYHIT ) ;
2015-02-09 05:50:33 +00:00
ud . m_respawn_monsters = 0 ;
ud . m_monsters_off = ud . monsters_off = 0 ;
ud . m_respawn_items = 0 ;
ud . m_respawn_inventory = 0 ;
ud . multimode = 1 ;
G_NewGame_EnterLevel ( ) ;
}
2016-11-01 01:35:32 +00:00
static void Menu_DoCheat ( int32_t cheatID )
2015-03-24 10:49:03 +00:00
{
if ( numplayers ! = 1 | | ! ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) )
return ;
osdcmd_cheatsinfo_stat . cheatnum = cheatID ;
}
2016-11-01 01:35:32 +00:00
static int32_t Menu_Cheat_Warp ( char const * const numbers )
2015-03-24 10:49:03 +00:00
{
if ( numplayers ! = 1 | | ! ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) )
return 0 ;
if ( numbers = = NULL | | ! numbers [ 0 ] | | ! numbers [ 1 ] | | ( VOLUMEALL & & ! numbers [ 2 ] ) )
return 1 ;
if ( VOLUMEALL )
{
osdcmd_cheatsinfo_stat . volume = numbers [ 0 ] - ' 0 ' ;
osdcmd_cheatsinfo_stat . level = ( numbers [ 1 ] - ' 0 ' ) * 10 + ( numbers [ 2 ] - ' 0 ' ) ;
}
else
{
osdcmd_cheatsinfo_stat . volume = numbers [ 0 ] - ' 0 ' ;
osdcmd_cheatsinfo_stat . level = numbers [ 1 ] - ' 0 ' ;
}
osdcmd_cheatsinfo_stat . volume - - ;
osdcmd_cheatsinfo_stat . level - - ;
2016-08-27 01:42:01 +00:00
if ( ( VOLUMEONE & & osdcmd_cheatsinfo_stat . volume > 0 ) | | osdcmd_cheatsinfo_stat . volume > g_volumeCnt - 1 | |
osdcmd_cheatsinfo_stat . level > = MAXLEVELS | | g_mapInfo [ osdcmd_cheatsinfo_stat . volume * MAXLEVELS + osdcmd_cheatsinfo_stat . level ] . filename = = NULL )
2015-03-24 10:49:03 +00:00
return 1 ;
osdcmd_cheatsinfo_stat . cheatnum = CHEAT_SCOTTY ;
return 0 ;
}
2016-11-01 01:35:32 +00:00
static int32_t Menu_Cheat_Skill ( char const * const number )
2015-03-24 10:49:03 +00:00
{
if ( numplayers ! = 1 | | ! ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) )
return 0 ;
if ( number = = NULL | | ! number [ 0 ] )
return 1 ;
osdcmd_cheatsinfo_stat . volume = number [ 0 ] - ' 1 ' ;
osdcmd_cheatsinfo_stat . cheatnum = CHEAT_SKILL ;
return 0 ;
}
2014-05-31 12:26:41 +00:00
/*
Functions where a " newValue " or similar is passed are run * before * the linked variable is actually changed .
That way you can compare the new and old values and potentially block the change .
*/
2016-11-01 01:35:32 +00:00
static void Menu_EntryLinkActivate ( MenuEntry_t * entry )
2014-05-31 12:26:41 +00:00
{
switch ( g_currentMenu )
{
case MENU_EPISODE :
2014-11-30 02:04:36 +00:00
if ( entry ! = & ME_EPISODE_USERMAP )
2006-11-16 03:02:42 +00:00
{
2014-11-30 02:04:36 +00:00
ud . m_volume_number = M_EPISODE . currentEntry ;
2019-11-09 18:15:03 +00:00
m_level_number = 0 ;
2015-02-09 05:50:33 +00:00
2016-08-27 01:42:01 +00:00
if ( g_skillCnt = = 0 )
2016-11-01 01:35:32 +00:00
Menu_StartGameWithoutSkill ( ) ;
2006-11-16 03:02:42 +00:00
}
2014-05-31 12:26:41 +00:00
break ;
2006-04-13 20:47:06 +00:00
2019-08-09 08:21:19 +00:00
case MENU_NEWGAMECUSTOM :
ud . returnvar [ 0 ] = - 1 ;
VM_OnEventWithReturn ( EVENT_NEWGAMECUSTOM , - 1 , myconnectindex , M_NEWGAMECUSTOM . currentEntry ) ;
break ;
case MENU_NEWGAMECUSTOMSUB :
ud . returnvar [ 0 ] = M_NEWGAMECUSTOMSUB . currentEntry ;
ud . returnvar [ 1 ] = - 1 ;
VM_OnEventWithReturn ( EVENT_NEWGAMECUSTOM , - 1 , myconnectindex , M_NEWGAMECUSTOM . currentEntry ) ;
break ;
2014-05-31 12:26:41 +00:00
case MENU_SKILL :
{
2015-02-09 05:50:33 +00:00
int32_t skillsound = PISTOL_BODYHIT ;
2007-02-05 01:33:08 +00:00
2014-11-30 02:04:36 +00:00
switch ( M_SKILL . currentEntry )
2007-02-05 01:33:08 +00:00
{
2014-05-31 12:26:41 +00:00
case 0 :
skillsound = JIBBED_ACTOR6 ;
2007-02-05 01:33:08 +00:00
break ;
2014-05-31 12:26:41 +00:00
case 1 :
skillsound = BONUS_SPEECH1 ;
break ;
case 2 :
skillsound = DUKE_GETWEAPON2 ;
break ;
case 3 :
skillsound = JIBBED_ACTOR5 ;
break ;
}
2006-04-13 20:47:06 +00:00
2015-02-09 05:50:33 +00:00
ud . m_player_skill = M_SKILL . currentEntry + 1 ;
2018-11-18 18:07:51 +00:00
ud . skill_voice = S_PlaySound ( skillsound ) ;
2006-04-13 20:47:06 +00:00
2014-11-30 02:04:36 +00:00
if ( M_SKILL . currentEntry = = 3 ) ud . m_respawn_monsters = 1 ;
2014-05-31 12:26:41 +00:00
else ud . m_respawn_monsters = 0 ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
ud . m_monsters_off = ud . monsters_off = 0 ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
ud . m_respawn_items = 0 ;
ud . m_respawn_inventory = 0 ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
ud . multimode = 1 ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
G_NewGame_EnterLevel ( ) ;
break ;
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case MENU_JOYSTICKAXES :
2018-04-12 21:02:31 +00:00
M_JOYSTICKAXIS . title = joyGetName ( 0 , M_JOYSTICKAXES . currentEntry ) ;
2019-11-09 18:15:03 +00:00
#if 0
2019-10-26 19:50:49 +00:00
MEO_JOYSTICKAXIS_ANALOG . data = & JoystickAnalogueAxes [ M_JOYSTICKAXES . currentEntry ] ;
MEO_JOYSTICKAXIS_SCALE . variable = & JoystickAnalogueScale [ M_JOYSTICKAXES . currentEntry ] ;
MEO_JOYSTICKAXIS_INVERT . data = & JoystickAnalogueInvert [ M_JOYSTICKAXES . currentEntry ] ;
MEO_JOYSTICKAXIS_DEAD . variable = & JoystickAnalogueDead [ M_JOYSTICKAXES . currentEntry ] ;
MEO_JOYSTICKAXIS_SATU . variable = & JoystickAnalogueSaturate [ M_JOYSTICKAXES . currentEntry ] ;
2019-11-09 18:15:03 +00:00
# endif
2014-05-31 12:26:41 +00:00
break ;
2006-04-13 20:47:06 +00:00
2015-03-24 10:49:03 +00:00
case MENU_CHEATS :
{
const int32_t cheatFuncID = M_CHEATS . currentEntry - 1 ;
switch ( cheatFuncID )
{
case - 1 :
case CHEATFUNC_WARP :
case CHEATFUNC_SKILL :
break ;
default :
2016-11-01 01:35:32 +00:00
Menu_DoCheat ( CheatFunctionIDs [ cheatFuncID ] ) ;
2015-03-24 10:49:03 +00:00
break ;
}
break ;
}
2014-05-31 12:26:41 +00:00
default :
break ;
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
if ( entry = = & ME_VIDEOSETUP_APPLY )
{
2018-07-14 21:36:44 +00:00
resolution_t p = { xres , yres , fullscreen , bpp , 0 } ;
2018-04-12 21:03:12 +00:00
int32_t prend = videoGetRenderMode ( ) ;
2019-10-23 19:11:37 +00:00
int32_t pvsync = vid_vsync ;
2019-09-08 01:01:30 +00:00
int pborderless = r_borderless ;
2015-12-23 04:05:21 +00:00
2018-02-26 02:48:09 +00:00
resolution_t n = { resolution [ newresolution ] . xdim , resolution [ newresolution ] . ydim ,
( resolution [ newresolution ] . flags & RES_FS ) ? newfullscreen : 0 ,
2015-12-23 04:05:35 +00:00
( newrendermode = = REND_CLASSIC ) ? 8 : resolution [ newresolution ] . bppmax , 0 } ;
2019-09-08 01:01:30 +00:00
if ( r_borderless ! = newborderless )
videoResetMode ( ) ;
r_borderless = newborderless ;
2006-04-13 20:47:06 +00:00
2018-07-14 21:36:44 +00:00
if ( videoSetGameMode ( n . flags , n . xdim , n . ydim , n . bppmax , upscalefactor ) < 0 )
2014-05-31 12:26:41 +00:00
{
2019-09-08 01:01:30 +00:00
r_borderless = pborderless ;
2018-07-14 21:36:44 +00:00
if ( videoSetGameMode ( p . flags , p . xdim , p . ydim , p . bppmax , upscalefactor ) < 0 )
2014-05-31 12:26:41 +00:00
{
2018-04-12 21:03:47 +00:00
videoSetRenderMode ( prend ) ;
2014-05-31 12:26:41 +00:00
G_GameExit ( " Failed restoring old video mode. " ) ;
2006-04-13 20:47:06 +00:00
}
2016-06-05 04:46:28 +00:00
else
2015-12-23 04:05:35 +00:00
{
onvideomodechange ( p . bppmax > 8 ) ;
2019-10-23 19:11:37 +00:00
vid_vsync = videoSetVsync ( pvsync ) ;
2015-12-23 04:05:35 +00:00
}
2006-11-16 03:02:42 +00:00
}
2019-09-08 01:01:30 +00:00
else
{
videoSetRenderMode ( newrendermode ) ;
2019-10-23 19:11:37 +00:00
vid_vsync = videoSetVsync ( newvsync ) ;
2019-09-08 01:01:30 +00:00
onvideomodechange ( n . bppmax > 8 ) ;
}
2006-11-15 01:16:55 +00:00
2014-05-31 12:26:41 +00:00
g_restorePalette = - 1 ;
G_UpdateScreenArea ( ) ;
2019-10-27 12:40:24 +00:00
ScreenMode = fullscreen ;
ScreenWidth = xres ;
ScreenHeight = yres ;
ScreenBPP = bpp ;
2014-05-31 12:26:41 +00:00
}
else if ( entry = = & ME_SOUND_RESTART )
{
2019-10-22 00:01:05 +00:00
snd_mixrate = soundrate ;
snd_numvoices = soundvoices ;
2019-10-24 18:36:18 +00:00
mus_device = musicdevice ;
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
S_SoundShutdown ( ) ;
S_MusicShutdown ( ) ;
2014-04-07 06:17:08 +00:00
2014-05-31 12:26:41 +00:00
S_SoundStartup ( ) ;
2019-10-24 05:46:59 +00:00
S_MusicStartup ( ) ;
2012-10-14 22:16:07 +00:00
2014-05-31 12:26:41 +00:00
FX_StopAllSounds ( ) ;
S_ClearSoundLocks ( ) ;
2012-10-14 22:16:07 +00:00
2019-10-28 21:19:50 +00:00
if ( MusicEnabled ( ) )
2014-09-07 18:10:09 +00:00
S_RestartMusic ( ) ;
2014-05-31 12:26:41 +00:00
}
2018-03-08 03:55:41 +00:00
else if ( entry = = & ME_SAVESETUP_CLEANUP )
{
2018-03-08 05:15:11 +00:00
g_oldSaveCnt = G_CountOldSaves ( ) ;
2018-03-08 03:55:45 +00:00
Menu_Change ( MENU_SAVECLEANVERIFY ) ;
2018-03-08 03:55:41 +00:00
}
2014-05-31 12:26:41 +00:00
else if ( entry = = & ME_NETHOST_LAUNCH )
{
// master does whatever it wants
if ( g_netServer )
{
Net_FillNewGame ( & pendingnewgame , 1 ) ;
Net_StartNewGame ( ) ;
Net_SendNewGame ( 1 , NULL ) ;
}
else if ( voting = = - 1 )
{
Net_SendMapVoteInitiate ( ) ;
2016-11-01 01:35:32 +00:00
Menu_Change ( MENU_NETWAITVOTES ) ;
2014-05-31 12:26:41 +00:00
}
}
}
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
static int32_t Menu_EntryOptionModify ( MenuEntry_t * entry , int32_t newOption )
2014-05-31 12:26:41 +00:00
{
int32_t x ;
2019-07-08 00:41:25 +00:00
auto ps = g_player [ myconnectindex ] . ps ;
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
if ( entry = = & ME_GAMESETUP_DEMOREC )
{
if ( ( ps - > gm & MODE_GAME ) )
G_CloseDemoWrite ( ) ;
}
2014-09-30 04:07:29 +00:00
else if ( entry = = & ME_GAMESETUP_WEAPSWITCH_PICKUP )
2014-05-31 12:26:41 +00:00
{
2019-10-22 00:31:14 +00:00
ud . weaponswitch = ud . weaponswitch & ~ ( 1 | 4 ) ;
2014-05-31 12:26:41 +00:00
switch ( newOption )
2006-11-16 03:02:42 +00:00
{
case 2 :
2019-10-22 00:31:14 +00:00
ud . weaponswitch = ud . weaponswitch | 4 ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-05-31 12:26:41 +00:00
case 1 :
2019-10-22 00:31:14 +00:00
ud . weaponswitch = ud . weaponswitch | 1 ;
2006-11-16 03:02:42 +00:00
break ;
2014-05-31 12:26:41 +00:00
default :
2006-11-16 03:02:42 +00:00
break ;
}
2014-05-31 12:26:41 +00:00
}
else if ( entry = = & ME_SOUND )
{
if ( newOption = = 0 )
2006-11-16 03:02:42 +00:00
{
2014-05-31 12:26:41 +00:00
FX_StopAllSounds ( ) ;
S_ClearSoundLocks ( ) ;
2006-11-16 03:02:42 +00:00
}
2014-05-31 12:26:41 +00:00
}
else if ( entry = = & ME_SOUND_MUSIC )
{
2019-10-22 00:01:05 +00:00
mus_enabled = newOption ;
2014-05-31 12:26:41 +00:00
if ( newOption = = 0 )
2018-10-25 23:32:29 +00:00
S_PauseMusic ( true ) ;
2006-11-16 03:02:42 +00:00
else
{
2014-09-07 18:10:09 +00:00
S_RestartMusic ( ) ;
2018-10-25 23:32:29 +00:00
S_PauseMusic ( false ) ;
2014-05-31 12:26:41 +00:00
}
}
else if ( entry = = & ME_SOUND_DUKETALK )
2019-10-22 00:01:05 +00:00
snd_speech = ( snd_speech & ~ 1 ) | newOption ;
2019-08-14 03:03:41 +00:00
else if ( entry = = & ME_JOYSTICK_ENABLE )
2019-08-14 03:03:52 +00:00
{
if ( newOption )
CONTROL_ScanForControllers ( ) ;
2019-08-14 03:03:41 +00:00
CONTROL_JoystickEnabled = ( newOption & & CONTROL_JoyPresent ) ;
2019-08-14 03:03:52 +00:00
}
2014-05-31 12:26:41 +00:00
else if ( entry = = & ME_JOYSTICKAXIS_ANALOG )
2014-11-30 02:04:36 +00:00
CONTROL_MapAnalogAxis ( M_JOYSTICKAXES . currentEntry , newOption , controldevice_joystick ) ;
2019-08-14 03:03:57 +00:00
else if ( entry = = & ME_JOYSTICKAXIS_INVERT )
CONTROL_SetAnalogAxisInvert ( M_JOYSTICKAXES . currentEntry , newOption , controldevice_joystick ) ;
2014-05-31 12:26:41 +00:00
else if ( entry = = & ME_NETOPTIONS_EPISODE )
{
2016-08-27 01:42:01 +00:00
if ( newOption < g_volumeCnt )
2014-05-31 12:26:41 +00:00
ud . m_volume_number = newOption ;
}
else if ( entry = = & ME_NETOPTIONS_MONSTERS )
{
2016-08-27 01:42:01 +00:00
ud . m_monsters_off = ( newOption = = g_skillCnt ) ;
if ( newOption < g_skillCnt )
2014-05-31 12:26:41 +00:00
ud . m_player_skill = newOption ;
}
else if ( entry = = & ME_ADULTMODE )
{
if ( newOption )
2006-11-16 03:02:42 +00:00
{
2016-08-27 01:42:01 +00:00
for ( x = 0 ; x < g_animWallCnt ; x + + )
2014-05-31 12:26:41 +00:00
switch ( DYNAMICTILEMAP ( wall [ animwall [ x ] . wallnum ] . picnum ) )
2006-11-15 01:16:55 +00:00
{
2014-05-31 12:26:41 +00:00
case FEMPIC1__STATIC :
wall [ animwall [ x ] . wallnum ] . picnum = BLANKSCREEN ;
break ;
case FEMPIC2__STATIC :
case FEMPIC3__STATIC :
wall [ animwall [ x ] . wallnum ] . picnum = SCREENBREAK6 ;
break ;
2006-11-16 03:02:42 +00:00
}
2014-05-31 12:26:41 +00:00
}
else
{
2019-10-27 12:40:24 +00:00
adult_lockout = 0 ;
2006-11-16 03:02:42 +00:00
}
2014-05-31 12:26:41 +00:00
}
switch ( g_currentMenu )
{
case MENU_MOUSEBTNS :
2014-11-30 02:04:36 +00:00
break ;
2014-05-31 12:26:41 +00:00
case MENU_JOYSTICKBTNS :
2014-11-30 02:04:36 +00:00
break ;
2014-05-31 12:26:41 +00:00
case MENU_JOYSTICKAXIS :
2014-11-30 02:04:36 +00:00
{
2018-10-25 23:31:54 +00:00
for ( int i = 0 ; i < ARRAY_SSIZE ( MEL_INTERNAL_JOYSTICKAXIS_DIGITAL ) ; i + + )
2014-11-30 02:04:36 +00:00
if ( entry = = MEL_INTERNAL_JOYSTICKAXIS_DIGITAL [ i ] )
2019-08-12 15:23:11 +00:00
CONTROL_MapDigitalAxis ( M_JOYSTICKAXES . currentEntry , newOption , i & 1 , controldevice_joystick ) ;
2014-11-30 02:04:36 +00:00
}
2006-11-16 03:02:42 +00:00
break ;
2014-05-31 12:26:41 +00:00
}
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
return 0 ;
}
2012-03-28 19:42:16 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_EntryOptionDidModify ( MenuEntry_t * entry )
2014-11-30 03:37:56 +00:00
{
2015-12-04 11:52:43 +00:00
# ifdef USE_OPENGL
2015-10-23 23:00:21 +00:00
int domodechange = 0 ;
2015-12-04 11:52:43 +00:00
# endif
2015-10-23 23:00:21 +00:00
2014-11-30 03:37:56 +00:00
if ( entry = = & ME_GAMESETUP_AIM_AUTO | |
entry = = & ME_GAMESETUP_WEAPSWITCH_PICKUP | |
2019-10-27 13:09:56 +00:00
//entry == &ME_PLAYER_NAME ||
2014-11-30 03:37:56 +00:00
entry = = & ME_PLAYER_COLOR | |
entry = = & ME_PLAYER_TEAM )
G_UpdatePlayerFromMenu ( ) ;
2014-12-02 06:15:19 +00:00
# ifdef USE_OPENGL
2015-10-23 23:00:21 +00:00
if ( domodechange )
{
2018-04-12 21:02:51 +00:00
videoResetMode ( ) ;
2018-07-14 21:36:44 +00:00
if ( videoSetGameMode ( fullscreen , xres , yres , bpp , upscalefactor ) )
2014-11-30 03:37:56 +00:00
OSD_Printf ( " restartvid: Reset failed... \n " ) ;
2019-10-27 12:40:24 +00:00
onvideomodechange ( ScreenBPP > 8 ) ;
2016-04-13 04:04:13 +00:00
G_RefreshLights ( ) ;
2014-11-30 03:37:56 +00:00
}
2014-12-02 06:15:19 +00:00
# endif
2014-11-30 03:37:56 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_Custom2ColScreen ( /*MenuEntry_t *entry*/ )
2014-05-31 12:26:41 +00:00
{
2014-11-30 02:04:36 +00:00
if ( g_currentMenu = = MENU_KEYBOARDKEYS )
2014-05-31 12:26:41 +00:00
{
2019-11-03 23:53:55 +00:00
inputState . keyFlushChars ( ) ;
inputState . ClearLastScanCode ( ) ;
2014-05-31 12:26:41 +00:00
}
}
2016-11-01 01:35:32 +00:00
static int32_t Menu_EntryRangeInt32Modify ( MenuEntry_t * entry , int32_t newValue )
2014-05-31 12:26:41 +00:00
{
2019-10-22 21:31:46 +00:00
if ( entry = = & ME_SCREENSETUP_SBARSIZE )
2014-05-31 12:26:41 +00:00
G_SetStatusBarScale ( newValue ) ;
2018-10-25 23:32:50 +00:00
else if ( entry = = & ME_SOUND_VOLUME_FX )
2014-05-31 12:26:41 +00:00
FX_SetVolume ( newValue ) ;
else if ( entry = = & ME_SOUND_VOLUME_MUSIC )
2018-10-25 23:32:50 +00:00
S_MusicVolume ( newValue ) ;
2014-05-31 12:26:41 +00:00
else if ( entry = = & ME_JOYSTICKAXIS_SCALE )
2014-11-30 02:04:36 +00:00
CONTROL_SetAnalogAxisScale ( M_JOYSTICKAXES . currentEntry , newValue , controldevice_joystick ) ;
2014-05-31 12:26:41 +00:00
else if ( entry = = & ME_JOYSTICKAXIS_DEAD )
2019-11-09 18:15:03 +00:00
joySetDeadZone ( M_JOYSTICKAXES . currentEntry , newValue , * MEO_JOYSTICKAXIS_SATU . cVar ) ;
2014-05-31 12:26:41 +00:00
else if ( entry = = & ME_JOYSTICKAXIS_SATU )
2019-11-09 18:15:03 +00:00
joySetDeadZone ( M_JOYSTICKAXES . currentEntry , * MEO_JOYSTICKAXIS_DEAD . cVar , newValue ) ;
2014-05-31 12:26:41 +00:00
return 0 ;
}
2016-11-01 01:35:32 +00:00
static int32_t Menu_EntryRangeFloatModify ( MenuEntry_t * entry , float newValue )
2014-11-30 03:37:56 +00:00
{
2017-07-07 22:50:42 +00:00
# ifndef EDUKE32_SIMPLE_MENU
2014-11-30 03:37:56 +00:00
if ( entry = = & ME_COLCORR_AMBIENT )
r_ambientlightrecip = 1.f / newValue ;
2017-07-07 22:50:42 +00:00
# else
UNREFERENCED_PARAMETER ( entry ) ;
UNREFERENCED_PARAMETER ( newValue ) ;
# endif
2014-11-30 03:37:56 +00:00
return 0 ;
}
2016-11-01 01:35:32 +00:00
static int32_t Menu_EntryRangeFloatDidModify ( MenuEntry_t * entry )
2014-05-31 12:26:41 +00:00
{
return 0 ;
}
2017-07-29 20:39:57 +00:00
# ifdef MENU_ENABLE_RANGEDOUBLE
2016-11-01 01:35:32 +00:00
static int32_t Menu_EntryRangeDoubleModify ( void /*MenuEntry_t *entry, double newValue*/ )
2014-05-31 12:26:41 +00:00
{
return 0 ;
}
2017-07-29 20:39:57 +00:00
# endif
2014-05-31 12:26:41 +00:00
static uint32_t save_xxh = 0 ;
2016-11-01 01:35:32 +00:00
static void Menu_EntryStringActivate ( /*MenuEntry_t *entry*/ )
2014-05-31 12:26:41 +00:00
{
switch ( g_currentMenu )
{
case MENU_SAVE :
2017-12-18 11:24:53 +00:00
if ( M_SAVE . currentEntry > 0 )
{
savebrief_t & sv = g_menusaves [ M_SAVE . currentEntry - 1 ] . brief ;
if ( ! save_xxh )
2019-11-02 21:52:13 +00:00
save_xxh = SuperFastHash ( sv . name , MAXSAVEGAMENAME ) ;
2017-12-18 11:24:53 +00:00
if ( sv . isValid ( ) )
Menu_Change ( MENU_SAVEVERIFY ) ;
}
else
{
ME_SAVE_NEW . name = nullptr ;
save_xxh = 0 ;
}
2014-05-31 12:26:41 +00:00
break ;
default :
break ;
}
}
2017-12-18 11:24:53 +00:00
static int32_t Menu_EntryStringSubmit ( /*MenuEntry_t *entry, */ char * input )
2014-05-31 12:26:41 +00:00
{
2014-06-16 23:15:31 +00:00
int32_t returnvar = 0 ;
2014-05-31 12:26:41 +00:00
switch ( g_currentMenu )
{
case MENU_SAVE :
2017-12-18 11:24:53 +00:00
{
savebrief_t & sv = g_lastusersave = M_SAVE . currentEntry = = 0 ? savebrief_t { input } : g_menusaves [ M_SAVE . currentEntry - 1 ] . brief ;
2014-05-31 12:26:41 +00:00
// dirty hack... char 127 in last position indicates an auto-filled name
2015-02-11 05:22:32 +00:00
# ifdef __ANDROID__
if ( 1 )
# else
2017-12-18 11:24:53 +00:00
if ( input [ 0 ] = = 0 | | ( sv . name [ MAXSAVEGAMENAME ] = = 127 & &
strncmp ( sv . name , input , MAXSAVEGAMENAME ) = = 0 & &
2019-11-02 21:52:13 +00:00
save_xxh = = SuperFastHash ( sv . name , MAXSAVEGAMENAME ) ) )
2015-02-11 05:22:32 +00:00
# endif
2012-08-19 12:56:51 +00:00
{
2017-12-18 11:24:53 +00:00
strncpy ( sv . name , g_mapInfo [ ud . volume_number * MAXLEVELS + ud . level_number ] . name , MAXSAVEGAMENAME ) ;
sv . name [ MAXSAVEGAMENAME ] = 127 ;
2014-06-16 23:15:31 +00:00
returnvar = - 1 ;
2014-05-31 12:26:41 +00:00
}
2014-06-21 15:31:01 +00:00
else
2014-12-27 20:39:30 +00:00
{
2017-12-18 11:24:53 +00:00
strncpy ( sv . name , input , MAXSAVEGAMENAME ) ;
sv . name [ MAXSAVEGAMENAME ] = 0 ;
2014-12-27 20:39:30 +00:00
}
2012-08-19 12:56:51 +00:00
2017-12-18 11:24:53 +00:00
G_SavePlayerMaybeMulti ( sv ) ;
2014-05-31 12:26:41 +00:00
2017-12-18 11:24:53 +00:00
g_quickload = & sv ;
2014-05-31 12:26:41 +00:00
g_player [ myconnectindex ] . ps - > gm = MODE_GAME ;
2016-11-01 01:35:32 +00:00
Menu_Change ( MENU_CLOSE ) ;
2014-05-31 12:26:41 +00:00
save_xxh = 0 ;
break ;
2017-12-18 11:24:53 +00:00
}
2014-05-31 12:26:41 +00:00
default :
break ;
}
2014-06-13 09:04:17 +00:00
2014-06-16 23:15:31 +00:00
return returnvar ;
2014-05-31 12:26:41 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_EntryStringCancel ( /*MenuEntry_t *entry*/ )
2014-05-31 12:26:41 +00:00
{
switch ( g_currentMenu )
{
case MENU_SAVE :
save_xxh = 0 ;
2017-12-18 11:24:53 +00:00
ME_SAVE_NEW . name = s_NewSaveGame ;
2014-05-31 12:26:41 +00:00
break ;
default :
break ;
}
}
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
/*
This is polled when the menu code is populating the screen but for some reason doesn ' t have the data .
*/
2016-11-01 01:35:32 +00:00
static int32_t Menu_EntryOptionSource ( MenuEntry_t * entry , int32_t currentValue )
2014-05-31 12:26:41 +00:00
{
2014-09-30 04:07:29 +00:00
if ( entry = = & ME_GAMESETUP_WEAPSWITCH_PICKUP )
2019-10-22 00:31:14 +00:00
return ( cl_weaponswitch & 1 ) ? ( ( cl_weaponswitch & 4 ) ? 2 : 1 ) : 0 ;
2014-05-31 12:26:41 +00:00
else if ( entry = = & ME_SOUND_DUKETALK )
2019-10-22 00:01:05 +00:00
return snd_speech & 1 ;
2014-05-31 12:26:41 +00:00
else if ( entry = = & ME_NETOPTIONS_MONSTERS )
2016-08-27 01:42:01 +00:00
return ( ud . m_monsters_off ? g_skillCnt : ud . m_player_skill ) ;
2014-05-31 12:26:41 +00:00
return currentValue ;
}
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_Verify ( int32_t input )
2014-05-31 12:26:41 +00:00
{
switch ( g_currentMenu )
{
2018-03-08 03:55:45 +00:00
case MENU_SAVECLEANVERIFY :
if ( input )
{
G_DeleteOldSaves ( ) ;
}
break ;
2014-05-31 12:26:41 +00:00
case MENU_RESETPLAYER :
2018-03-11 03:47:11 +00:00
switch ( input )
2007-08-25 01:05:00 +00:00
{
2018-03-11 03:47:11 +00:00
default :
2019-11-03 23:53:55 +00:00
inputState . keyFlushChars ( ) ;
inputState . ClearKeysDown ( ) ;
2014-05-31 12:26:41 +00:00
FX_StopAllSounds ( ) ;
2006-04-13 20:47:06 +00:00
2018-03-11 03:47:11 +00:00
if ( G_LoadPlayerMaybeMulti ( * g_quickload ) = = 0 )
break ;
// error state, consider as a no instead of yes
g_quickload - > reset ( ) ;
fallthrough__ ;
case 0 :
2014-05-31 12:26:41 +00:00
if ( sprite [ g_player [ myconnectindex ] . ps - > i ] . extra < = 0 )
2006-11-15 01:16:55 +00:00
{
2014-05-31 12:26:41 +00:00
if ( G_EnterLevel ( MODE_GAME ) ) G_BackToMenu ( ) ;
return ;
2006-04-13 20:47:06 +00:00
}
2008-07-30 02:51:32 +00:00
2016-11-01 01:35:32 +00:00
Menu_Change ( MENU_CLOSE ) ;
2018-03-11 03:47:11 +00:00
break ;
2006-11-16 03:02:42 +00:00
}
2014-05-31 12:26:41 +00:00
break ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case MENU_LOADVERIFY :
if ( input )
2006-11-16 03:02:42 +00:00
{
2019-07-31 03:39:30 +00:00
menusave_t & msv = g_menusaves [ M_LOAD . currentEntry ] ;
savebrief_t & sv = msv . brief ;
2017-12-18 11:24:53 +00:00
if ( strcmp ( sv . path , g_lastusersave . path ) ! = 0 )
{
g_freshload = sv ;
g_lastusersave . reset ( ) ;
g_lastautosave . reset ( ) ;
g_quickload = & g_freshload ;
}
else
{
g_quickload = & g_lastusersave ;
}
2006-11-15 01:16:55 +00:00
2019-11-03 23:53:55 +00:00
inputState . keyFlushChars ( ) ;
inputState . ClearKeysDown ( ) ;
2014-10-27 10:14:50 +00:00
2019-07-31 03:39:30 +00:00
if ( G_LoadPlayerMaybeMulti ( sv ) )
Menu_Change ( MENU_PREVIOUS ) ;
else
Menu_Change ( MENU_CLOSE ) ;
2006-11-16 03:02:42 +00:00
}
2014-05-31 12:26:41 +00:00
break ;
2006-11-15 01:16:55 +00:00
2014-05-31 12:26:41 +00:00
case MENU_SAVEVERIFY :
if ( ! input )
2006-11-16 03:02:42 +00:00
{
2014-05-31 12:26:41 +00:00
save_xxh = 0 ;
2012-03-28 19:42:16 +00:00
2014-11-30 02:04:36 +00:00
( ( MenuString_t * ) M_SAVE . entrylist [ M_SAVE . currentEntry ] - > entry ) - > editfield = NULL ;
2006-11-16 03:02:42 +00:00
}
2014-05-31 12:26:41 +00:00
break ;
2018-03-08 03:55:45 +00:00
case MENU_LOADDELVERIFY :
if ( input )
{
G_DeleteSave ( g_menusaves [ M_LOAD . currentEntry ] . brief ) ;
Menu_LoadReadHeaders ( ) ;
M_LOAD . currentEntry = clamp ( M_LOAD . currentEntry , 0 , ( int32_t ) g_nummenusaves - 1 ) ;
}
break ;
case MENU_SAVEDELVERIFY :
if ( input )
{
G_DeleteSave ( g_menusaves [ M_SAVE . currentEntry - 1 ] . brief ) ;
Menu_SaveReadHeaders ( ) ;
M_SAVE . currentEntry = clamp ( M_SAVE . currentEntry , 0 , ( int32_t ) g_nummenusaves ) ;
}
break ;
2019-08-13 09:16:02 +00:00
case MENU_COLCORRRESETVERIFY :
if ( input )
{
2019-11-09 18:15:03 +00:00
vid_gamma = 1.f ;
vid_contrast = 1.f ;
vid_brightness = 0.f ;
2019-10-22 23:30:43 +00:00
r_ambientlight = 1.f ;
2019-10-27 12:40:24 +00:00
videoSetPalette ( 0 , g_player [ myconnectindex ] . ps - > palette , 0 ) ;
2019-08-13 09:16:02 +00:00
}
break ;
case MENU_KEYSRESETVERIFY :
if ( input )
2019-10-25 22:32:49 +00:00
CONFIG_SetDefaultKeys ( " demolition/defbinds.txt " ) ;
2019-08-13 09:16:02 +00:00
break ;
case MENU_KEYSCLASSICVERIFY :
if ( input )
2019-10-25 22:32:49 +00:00
CONFIG_SetDefaultKeys ( " demolition/origbinds.txt " ) ;
2019-08-13 09:16:02 +00:00
break ;
case MENU_JOYSTANDARDVERIFY :
if ( input )
CONFIG_SetGameControllerDefaultsStandard ( ) ;
break ;
case MENU_JOYPROVERIFY :
if ( input )
CONFIG_SetGameControllerDefaultsPro ( ) ;
break ;
case MENU_JOYCLEARVERIFY :
if ( input )
CONFIG_SetGameControllerDefaultsClear ( ) ;
break ;
2014-05-31 12:26:41 +00:00
case MENU_QUIT :
case MENU_QUIT_INGAME :
if ( input )
G_GameQuit ( ) ;
else
g_quitDeadline = 0 ;
break ;
2012-03-25 22:00:27 +00:00
2014-05-31 12:26:41 +00:00
case MENU_QUITTOTITLE :
if ( input )
2006-11-16 03:02:42 +00:00
{
2014-05-31 12:26:41 +00:00
g_player [ myconnectindex ] . ps - > gm = MODE_DEMO ;
if ( ud . recstat = = 1 )
G_CloseDemoWrite ( ) ;
2018-04-12 21:03:30 +00:00
artClearMapArt ( ) ;
2014-05-31 12:26:41 +00:00
}
break ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case MENU_NETWAITVOTES :
if ( ! input )
2014-12-27 18:35:34 +00:00
Net_SendMapVoteCancel ( 0 ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-11-15 01:16:55 +00:00
2014-05-31 12:26:41 +00:00
default :
break ;
}
}
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
static int Menu_CheatStringMatch ( char const * input , char const * cheat )
2015-11-25 12:08:28 +00:00
{
while ( * cheat | | * input )
{
if ( * cheat ! = * input )
{
if ( ! ( * cheat = = ' # ' & & Bisdigit ( * input ) ) )
return 0 ;
}
+ + cheat ;
+ + input ;
}
return 1 ;
}
2016-11-01 01:35:32 +00:00
static void Menu_TextFormSubmit ( char * input )
2014-05-31 12:26:41 +00:00
{
switch ( g_currentMenu )
{
case MENU_ADULTPASSWORD :
break ;
2006-11-16 03:02:42 +00:00
2015-03-24 10:49:03 +00:00
case MENU_CHEATENTRY :
{
const size_t inputlength = Bstrlen ( input ) ;
Bstrcpy ( tempbuf , input ) ;
for ( size_t i = 0 ; i < inputlength ; i + + )
tempbuf [ i ] = Btolower ( tempbuf [ i ] ) ;
int8_t cheatID = - 1 ;
2018-04-12 21:02:31 +00:00
if ( inputlength > 2 & & tempbuf [ 0 ] = = g_keyAsciiTable [ CheatKeys [ 0 ] ] & & tempbuf [ 1 ] = = g_keyAsciiTable [ CheatKeys [ 1 ] ] )
2015-03-24 10:49:03 +00:00
{
2018-10-25 23:31:54 +00:00
for ( int i = 0 ; i < NUMCHEATS ; i + + )
2016-11-01 01:35:32 +00:00
if ( Menu_CheatStringMatch ( tempbuf + 2 , CheatStrings [ i ] ) )
2015-03-24 10:49:03 +00:00
{
cheatID = i ;
break ;
}
}
switch ( cheatID )
{
case - 1 :
S_PlaySound ( KICK_HIT ) ;
break ;
case CHEAT_SCOTTY :
2015-11-25 12:08:28 +00:00
{
char const * const numberpos = Bstrchr ( CheatStrings [ CHEAT_SCOTTY ] , ' # ' ) ;
if ( numberpos = = NULL )
{
S_PlaySound ( KICK_HIT ) ;
break ;
}
2016-11-01 01:35:32 +00:00
Menu_Cheat_Warp ( input + ( numberpos - CheatStrings [ CHEAT_SCOTTY ] ) + 2 ) ;
2015-03-24 10:49:03 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_MENU )
S_PlaySound ( DUKE_GET ) ;
break ;
2015-11-25 12:08:28 +00:00
}
2015-03-24 10:49:03 +00:00
case CHEAT_SKILL :
2015-11-25 12:08:28 +00:00
{
char const * const numberpos = Bstrchr ( CheatStrings [ CHEAT_SKILL ] , ' # ' ) ;
if ( numberpos = = NULL )
{
S_PlaySound ( KICK_HIT ) ;
break ;
}
2016-11-01 01:35:32 +00:00
Menu_Cheat_Skill ( input + ( numberpos - CheatStrings [ CHEAT_SKILL ] ) + 2 ) ;
2015-03-24 10:49:03 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_MENU )
S_PlaySound ( DUKE_GET ) ;
break ;
2015-11-25 12:08:28 +00:00
}
2015-03-24 10:49:03 +00:00
default :
2016-11-01 01:35:32 +00:00
Menu_DoCheat ( cheatID ) ;
2015-03-24 10:49:03 +00:00
S_PlaySound ( DUKE_GET ) ;
break ;
}
if ( cheatID > = 0 )
2019-10-22 15:47:24 +00:00
cl_cheatmask = cl_cheatmask | CheatFunctionFlags [ cheatID ] ;
2015-03-24 10:49:03 +00:00
2015-11-25 12:08:28 +00:00
if ( ( NAM_WW2GI & & ( cl_cheatmask & ( 1 < < CHEATFUNC_QUOTETODD ) ) ) | |
( ( cl_cheatmask & ( 1 < < CHEATFUNC_QUOTEBETA ) ) & & ( cl_cheatmask & ( 1 < < CHEATFUNC_QUOTETODD ) ) & & ( cl_cheatmask & ( 1 < < CHEATFUNC_QUOTEALLEN ) ) ) )
2016-03-14 00:07:48 +00:00
{
S_PlaySound ( DUKE_GETWEAPON6 ) ;
2015-03-24 10:49:03 +00:00
cl_cheatmask = ~ 0 ;
2016-03-14 00:07:48 +00:00
}
2015-03-24 10:49:03 +00:00
2016-11-01 01:35:32 +00:00
Menu_Change ( MENU_CHEATS ) ;
2015-03-24 10:49:03 +00:00
break ;
}
case MENU_CHEAT_WARP :
2016-11-01 01:35:32 +00:00
if ( Menu_Cheat_Warp ( input ) )
2015-03-24 10:49:03 +00:00
S_PlaySound ( KICK_HIT ) ;
2016-11-01 01:35:32 +00:00
Menu_Change ( MENU_CHEATS ) ;
2015-03-24 10:49:03 +00:00
break ;
case MENU_CHEAT_SKILL :
2016-11-01 01:35:32 +00:00
if ( Menu_Cheat_Skill ( input ) )
2015-03-24 10:49:03 +00:00
S_PlaySound ( KICK_HIT ) ;
2016-11-01 01:35:32 +00:00
Menu_Change ( MENU_CHEATS ) ;
2015-03-24 10:49:03 +00:00
break ;
2014-05-31 12:26:41 +00:00
default :
2006-11-16 03:02:42 +00:00
break ;
2012-03-25 22:00:27 +00:00
}
2014-05-31 12:26:41 +00:00
}
2012-03-25 22:00:27 +00:00
2014-06-13 09:04:31 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_FileSelectInit ( MenuFileSelect_t * object )
2014-05-31 12:26:41 +00:00
{
2019-11-02 00:30:21 +00:00
// Same crap as everywhere - it expects the user to dump all the shit in the game directory so that it gets in the way of everything.
// Needs to be redone - or removed.
if ( usermapfolder )
{
}
else
{
}
#if 0
2014-10-27 10:14:50 +00:00
fnlist_clearnames ( & object - > fnlist ) ;
2014-06-13 09:04:31 +00:00
if ( object - > destination [ 0 ] = = 0 )
2019-08-14 09:02:12 +00:00
{
BDIR * usermaps = Bopendir ( object - > startdir ) ;
if ( usermaps )
{
Bclosedir ( usermaps ) ;
Bstrcpy ( object - > destination , object - > startdir ) ;
}
else
Bstrcpy ( object - > destination , " ./ " ) ;
}
2014-05-31 12:26:41 +00:00
Bcorrectfilename ( object - > destination , 1 ) ;
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
fnlist_getnames ( & object - > fnlist , object - > destination , object - > pattern , 0 , 0 ) ;
2014-06-13 09:04:31 +00:00
object - > findhigh [ 0 ] = object - > fnlist . finddirs ;
object - > findhigh [ 1 ] = object - > fnlist . findfiles ;
2018-10-25 23:31:54 +00:00
for ( int i = 0 ; i < 2 ; + + i )
2014-06-13 09:04:31 +00:00
{
object - > scrollPos [ i ] = 0 ;
klistbookends ( object - > findhigh [ i ] ) ;
}
2014-06-13 09:03:52 +00:00
object - > currentList = 0 ;
2014-06-13 09:04:31 +00:00
if ( object - > findhigh [ 1 ] )
2014-06-13 09:03:52 +00:00
object - > currentList = 1 ;
2006-11-16 03:02:42 +00:00
2019-11-02 00:30:21 +00:00
# endif
2019-11-03 23:53:55 +00:00
inputState . keyFlushChars ( ) ;
2014-05-31 12:26:41 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_FileSelect ( int32_t input )
2014-05-31 12:26:41 +00:00
{
switch ( g_currentMenu )
{
case MENU_NETUSERMAP :
if ( ( g_netServer | | ud . multimode > 1 ) )
Net_SendUserMapName ( ) ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-05-31 12:26:41 +00:00
case MENU_USERMAP :
if ( input )
2006-11-16 03:02:42 +00:00
{
2014-05-31 12:26:41 +00:00
ud . m_volume_number = 0 ;
2019-11-09 18:15:03 +00:00
m_level_number = 7 ;
2015-02-09 05:50:33 +00:00
2016-08-27 01:42:01 +00:00
if ( g_skillCnt > 0 )
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( MENU_SKILL , MA_Advance ) ;
2015-02-09 05:50:33 +00:00
else
2016-11-01 01:35:32 +00:00
Menu_StartGameWithoutSkill ( ) ;
2014-05-31 12:26:41 +00:00
}
break ;
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
default :
break ;
}
}
2012-02-18 17:56:39 +00:00
2006-04-15 04:06:50 +00:00
2006-11-16 03:02:42 +00:00
2012-02-18 17:56:39 +00:00
2018-10-25 23:31:54 +00:00
static Menu_t * Menu_BinarySearch ( MenuID_t query , uint16_t searchstart , uint16_t searchend )
2014-05-31 12:26:41 +00:00
{
2018-10-25 23:31:54 +00:00
const uint16_t thissearch = ( searchstart + searchend ) / 2 ;
2014-05-31 12:26:41 +00:00
const MenuID_t difference = query - Menus [ thissearch ] . menuID ;
if ( difference = = 0 )
return & Menus [ thissearch ] ;
else if ( searchstart = = searchend )
return NULL ;
else if ( difference > 0 )
{
if ( thissearch = = searchend )
return NULL ;
searchstart = thissearch + 1 ;
}
else if ( difference < 0 )
{
if ( thissearch = = searchstart )
return NULL ;
searchend = thissearch - 1 ;
}
2012-02-18 17:56:39 +00:00
2016-11-01 01:35:32 +00:00
return Menu_BinarySearch ( query , searchstart , searchend ) ;
2014-05-31 12:26:41 +00:00
}
2012-02-18 17:56:39 +00:00
2016-11-01 01:35:32 +00:00
static Menu_t * Menu_Find ( MenuID_t query )
2014-05-31 12:26:41 +00:00
{
if ( ( unsigned ) query > ( unsigned ) Menus [ numMenus - 1 ] . menuID )
return NULL ;
2012-02-18 17:56:39 +00:00
2016-11-01 01:35:32 +00:00
return Menu_BinarySearch ( query , 0 , numMenus - 1 ) ;
2014-05-31 12:26:41 +00:00
}
2012-02-18 17:56:39 +00:00
2017-07-05 05:37:46 +00:00
static Menu_t * Menu_FindFiltered ( MenuID_t query )
{
if ( ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) & & query = = MENU_MAIN )
query = MENU_MAIN_INGAME ;
return Menu_Find ( query ) ;
}
2016-03-14 00:07:40 +00:00
MenuAnimation_t m_animation ;
2014-10-27 10:14:50 +00:00
2016-11-01 01:35:32 +00:00
int32_t Menu_Anim_SinOutRight ( MenuAnimation_t * animdata )
2015-01-25 12:16:34 +00:00
{
2019-08-27 13:39:54 +00:00
return sintable [ divscale10 ( ( int32_t ) totalclock - animdata - > start , animdata - > length ) + 512 ] - 16384 ;
2015-01-25 12:16:34 +00:00
}
2016-11-01 01:35:32 +00:00
int32_t Menu_Anim_SinInRight ( MenuAnimation_t * animdata )
2015-01-25 12:16:34 +00:00
{
2019-08-27 13:39:54 +00:00
return sintable [ divscale10 ( ( int32_t ) totalclock - animdata - > start , animdata - > length ) + 512 ] + 16384 ;
2015-01-25 12:16:34 +00:00
}
2016-11-01 01:35:32 +00:00
int32_t Menu_Anim_SinOutLeft ( MenuAnimation_t * animdata )
2014-10-27 10:14:50 +00:00
{
2019-08-27 13:39:54 +00:00
return - sintable [ divscale10 ( ( int32_t ) totalclock - animdata - > start , animdata - > length ) + 512 ] + 16384 ;
2014-10-27 10:14:50 +00:00
}
2016-11-01 01:35:32 +00:00
int32_t Menu_Anim_SinInLeft ( MenuAnimation_t * animdata )
2014-10-27 10:14:50 +00:00
{
2019-08-27 13:39:54 +00:00
return - sintable [ divscale10 ( ( int32_t ) totalclock - animdata - > start , animdata - > length ) + 512 ] - 16384 ;
2014-10-27 10:14:50 +00:00
}
2016-11-01 01:35:32 +00:00
void Menu_AnimateChange ( int32_t cm , MenuAnimationType_t animtype )
2014-10-27 10:14:50 +00:00
{
2019-11-09 21:22:51 +00:00
if ( cm = = MENU_KEYBOARDKEYS )
2019-11-07 19:31:16 +00:00
{
2019-11-09 21:22:51 +00:00
GUICapture | = 2 ;
return ;
2019-11-07 19:31:16 +00:00
}
2019-07-19 01:49:29 +00:00
if ( FURY )
2017-06-27 01:50:55 +00:00
{
m_animation . start = 0 ;
m_animation . length = 0 ;
Menu_Change ( cm ) ;
return ;
}
2014-10-27 10:14:50 +00:00
switch ( animtype )
{
case MA_Advance :
2015-12-20 05:19:02 +00:00
{
Menu_t * const previousMenu = m_currentMenu ;
2016-11-01 01:35:32 +00:00
if ( ! Menu_Change ( cm ) )
2015-12-20 05:19:02 +00:00
{
2016-11-01 01:35:32 +00:00
m_animation . out = Menu_Anim_SinOutRight ;
m_animation . in = Menu_Anim_SinInRight ;
2019-08-27 13:39:54 +00:00
m_animation . start = ( int32_t ) totalclock ;
2015-12-20 05:19:02 +00:00
m_animation . length = 30 ;
m_animation . previous = previousMenu ;
2016-11-01 01:35:32 +00:00
m_animation . current = m_currentMenu ;
2015-12-20 05:19:02 +00:00
}
2014-10-27 10:14:50 +00:00
break ;
2015-12-20 05:19:02 +00:00
}
2014-10-27 10:14:50 +00:00
case MA_Return :
2015-12-20 05:19:02 +00:00
{
Menu_t * const previousMenu = m_currentMenu ;
2016-11-01 01:35:32 +00:00
if ( ! Menu_Change ( cm ) )
2015-12-20 05:19:02 +00:00
{
2016-11-01 01:35:32 +00:00
m_animation . out = Menu_Anim_SinOutLeft ;
m_animation . in = Menu_Anim_SinInLeft ;
2019-08-27 13:39:54 +00:00
m_animation . start = ( int32_t ) totalclock ;
2015-12-20 05:19:02 +00:00
m_animation . length = 30 ;
m_animation . previous = previousMenu ;
2016-11-01 01:35:32 +00:00
m_animation . current = m_currentMenu ;
2015-12-20 05:19:02 +00:00
}
2014-10-27 10:14:50 +00:00
break ;
2015-12-20 05:19:02 +00:00
}
2014-10-27 10:14:50 +00:00
default :
2016-11-01 01:35:32 +00:00
m_animation . start = 0 ;
2014-10-27 10:14:50 +00:00
m_animation . length = 0 ;
2016-11-01 01:35:32 +00:00
Menu_Change ( cm ) ;
2014-10-27 10:14:50 +00:00
break ;
}
}
2017-10-09 07:36:55 +00:00
static void Menu_MaybeSetSelectionToChild ( Menu_t * m , MenuID_t id )
{
if ( m - > type = = Menu )
{
2018-12-15 01:39:51 +00:00
auto menu = ( MenuMenu_t * ) m - > object ;
2017-10-09 07:36:55 +00:00
2018-01-26 04:34:33 +00:00
if ( menu - > currentEntry < menu - > numEntries )
{
MenuEntry_t const * currentEntry = menu - > entrylist [ menu - > currentEntry ] ;
if ( currentEntry ! = NULL & & currentEntry - > type = = Link )
{
2018-10-25 23:33:47 +00:00
auto const * link = ( MenuLink_t const * ) currentEntry - > entry ;
2018-01-26 04:34:33 +00:00
if ( link - > linkID = = id )
return ; // already good to go
}
}
2018-10-25 23:31:54 +00:00
for ( int i = 0 , i_end = menu - > numEntries ; i < i_end ; + + i )
2017-10-09 07:36:55 +00:00
{
MenuEntry_t const * entry = menu - > entrylist [ i ] ;
2018-02-20 11:55:07 +00:00
if ( entry ! = NULL & & entry - > type = = Link & & ! ( entry - > flags & MEF_Hidden ) )
2017-10-09 07:36:55 +00:00
{
2018-10-25 23:33:47 +00:00
auto const * link = ( MenuLink_t const * ) entry - > entry ;
2017-10-09 07:36:55 +00:00
if ( link - > linkID = = id )
{
menu - > currentEntry = i ;
2017-12-18 11:24:53 +00:00
Menu_AdjustForCurrentEntryAssignmentBlind ( menu ) ;
2017-10-09 07:36:55 +00:00
break ;
}
}
}
}
}
2017-12-18 11:24:53 +00:00
static void Menu_ReadSaveGameHeaders ( )
{
ReadSaveGameHeaders ( ) ;
2018-10-25 23:31:54 +00:00
int const numloaditems = max < int > ( g_nummenusaves , 1 ) , numsaveitems = g_nummenusaves + 1 ;
2018-03-08 03:55:21 +00:00
ME_LOAD = ( MenuEntry_t * ) Xrealloc ( ME_LOAD , g_nummenusaves * sizeof ( MenuEntry_t ) ) ;
MEL_LOAD = ( MenuEntry_t * * ) Xrealloc ( MEL_LOAD , numloaditems * sizeof ( MenuEntry_t * ) ) ;
MEO_SAVE = ( MenuString_t * ) Xrealloc ( MEO_SAVE , g_nummenusaves * sizeof ( MenuString_t ) ) ;
ME_SAVE = ( MenuEntry_t * ) Xrealloc ( ME_SAVE , g_nummenusaves * sizeof ( MenuEntry_t ) ) ;
MEL_SAVE = ( MenuEntry_t * * ) Xrealloc ( MEL_SAVE , numsaveitems * sizeof ( MenuEntry_t * ) ) ;
2017-12-18 11:24:53 +00:00
MEL_SAVE [ 0 ] = & ME_SAVE_NEW ;
ME_SAVE_NEW . name = s_NewSaveGame ;
2018-10-25 23:31:54 +00:00
for ( int i = 0 ; i < g_nummenusaves ; + + i )
2017-12-18 11:24:53 +00:00
{
MEL_LOAD [ i ] = & ME_LOAD [ i ] ;
MEL_SAVE [ i + 1 ] = & ME_SAVE [ i ] ;
ME_LOAD [ i ] = ME_LOAD_TEMPLATE ;
ME_SAVE [ i ] = ME_SAVE_TEMPLATE ;
ME_SAVE [ i ] . entry = & MEO_SAVE [ i ] ;
MEO_SAVE [ i ] = MEO_SAVE_TEMPLATE ;
ME_LOAD [ i ] . name = g_menusaves [ i ] . brief . name ;
MEO_SAVE [ i ] . variable = g_menusaves [ i ] . brief . name ;
}
if ( g_nummenusaves = = 0 )
MEL_LOAD [ 0 ] = & ME_LOAD_EMPTY ;
M_LOAD . entrylist = MEL_LOAD ;
M_LOAD . numEntries = numloaditems ;
M_SAVE . entrylist = MEL_SAVE ;
M_SAVE . numEntries = numsaveitems ;
// lexicographical sorting?
}
2017-10-09 07:36:52 +00:00
static void Menu_AboutToStartDisplaying ( Menu_t * m )
2014-05-31 12:26:41 +00:00
{
2017-10-09 07:36:52 +00:00
switch ( m - > menuID )
2014-05-31 12:26:41 +00:00
{
2017-07-06 14:43:07 +00:00
case MENU_MAIN :
2019-07-19 01:49:29 +00:00
if ( FURY )
2017-07-06 14:43:07 +00:00
ME_MAIN_LOADGAME . name = s_Continue ;
break ;
case MENU_MAIN_INGAME :
2019-07-19 01:49:29 +00:00
if ( FURY )
2017-07-06 14:43:07 +00:00
ME_MAIN_LOADGAME . name = s_LoadGame ;
break ;
2019-08-09 08:21:19 +00:00
case MENU_NEWGAMECUSTOMSUB :
Menu_PopulateNewGameCustomSub ( M_NEWGAMECUSTOM . currentEntry ) ;
break ;
2014-11-30 04:59:34 +00:00
case MENU_LOAD :
2019-07-19 01:49:29 +00:00
if ( FURY )
2017-07-06 14:43:07 +00:00
M_LOAD . title = ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) ? s_LoadGame : s_Continue ;
2017-12-18 11:24:53 +00:00
2018-03-08 03:55:25 +00:00
Menu_LoadReadHeaders ( ) ;
2017-12-18 11:24:53 +00:00
if ( g_quickload & & g_quickload - > isValid ( ) )
2017-07-06 14:43:07 +00:00
{
2018-10-25 23:31:54 +00:00
for ( int i = 0 ; i < g_nummenusaves ; + + i )
2017-12-18 11:24:53 +00:00
{
if ( strcmp ( g_menusaves [ i ] . brief . path , g_quickload - > path ) = = 0 )
{
M_LOAD . currentEntry = i ;
Menu_AdjustForCurrentEntryAssignmentBlind ( & M_LOAD ) ;
break ;
}
}
2017-07-06 14:43:07 +00:00
}
2014-11-30 04:59:34 +00:00
break ;
2014-05-31 12:26:41 +00:00
case MENU_SAVE :
2018-03-08 03:55:45 +00:00
if ( g_previousMenu = = MENU_SAVEVERIFY | | g_previousMenu = = MENU_SAVEDELVERIFY )
2017-12-18 11:24:53 +00:00
break ;
2018-03-08 03:55:25 +00:00
Menu_SaveReadHeaders ( ) ;
2017-12-18 11:24:53 +00:00
if ( g_lastusersave . isValid ( ) )
{
2018-10-25 23:31:54 +00:00
for ( int i = 0 ; i < g_nummenusaves ; + + i )
2017-12-18 11:24:53 +00:00
{
if ( strcmp ( g_menusaves [ i ] . brief . path , g_lastusersave . path ) = = 0 )
{
M_SAVE . currentEntry = i + 1 ;
Menu_AdjustForCurrentEntryAssignmentBlind ( & M_SAVE ) ;
break ;
}
}
}
2017-07-06 14:43:07 +00:00
2014-05-31 12:26:41 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME )
{
g_screenCapture = 1 ;
G_DrawRooms ( myconnectindex , 65536 ) ;
g_screenCapture = 0 ;
2006-11-16 03:02:42 +00:00
}
break ;
2008-07-20 11:03:57 +00:00
2014-05-31 12:26:41 +00:00
case MENU_VIDEOSETUP :
newresolution = 0 ;
2018-10-25 23:31:54 +00:00
for ( int i = 0 ; i < MAXVALIDMODES ; + + i )
2008-07-20 11:03:57 +00:00
{
2018-07-14 21:36:44 +00:00
if ( resolution [ i ] . xdim = = xres & & resolution [ i ] . ydim = = yres )
2008-07-25 23:39:41 +00:00
{
2014-05-31 12:26:41 +00:00
newresolution = i ;
break ;
2008-07-25 23:39:41 +00:00
}
2008-07-20 11:03:57 +00:00
}
2018-04-12 21:03:12 +00:00
newrendermode = videoGetRenderMode ( ) ;
2014-05-31 12:26:41 +00:00
newfullscreen = fullscreen ;
2019-10-23 19:11:37 +00:00
newvsync = vid_vsync ;
2019-09-19 14:55:08 +00:00
newborderless = r_borderless ;
2014-05-31 12:26:41 +00:00
break ;
2008-07-20 11:03:57 +00:00
2014-12-27 18:35:34 +00:00
case MENU_ADVSOUND :
2019-10-22 00:01:05 +00:00
soundrate = snd_mixrate ;
soundvoices = snd_numvoices ;
2019-10-24 18:28:46 +00:00
musicdevice = MusicDevice ;
2014-05-31 12:26:41 +00:00
break ;
2008-07-20 11:18:42 +00:00
2014-05-31 12:26:41 +00:00
default :
break ;
}
2008-07-24 04:54:40 +00:00
2017-10-09 07:36:52 +00:00
switch ( m - > type )
2014-05-31 12:26:41 +00:00
{
2017-10-09 07:36:52 +00:00
case TextForm :
2014-05-31 12:26:41 +00:00
typebuf [ 0 ] = 0 ;
2017-10-09 07:36:52 +00:00
( ( MenuTextForm_t * ) m - > object ) - > input = typebuf ;
break ;
case FileSelect :
Menu_FileSelectInit ( ( MenuFileSelect_t * ) m - > object ) ;
break ;
case Menu :
2014-05-31 12:26:41 +00:00
{
2018-12-15 01:39:51 +00:00
auto menu = ( MenuMenu_t * ) m - > object ;
2014-11-30 02:04:36 +00:00
// MenuEntry_t* currentry = menu->entrylist[menu->currentEntry];
2008-07-20 11:18:42 +00:00
2015-02-09 05:50:33 +00:00
// need this for MENU_SKILL
if ( menu - > currentEntry > = menu - > numEntries )
menu - > currentEntry = 0 ;
2017-10-09 07:36:52 +00:00
int32_t i = menu - > currentEntry ;
2018-02-20 11:55:07 +00:00
while ( ! menu - > entrylist [ menu - > currentEntry ] | |
( ( ( MenuEntry_t * ) menu - > entrylist [ menu - > currentEntry ] ) - > flags & MEF_Hidden ) | |
( ( MenuEntry_t * ) menu - > entrylist [ menu - > currentEntry ] ) - > type = = Spacer )
2015-02-09 05:50:33 +00:00
{
menu - > currentEntry + + ;
if ( menu - > currentEntry > = menu - > numEntries )
menu - > currentEntry = 0 ;
if ( menu - > currentEntry = = i )
2017-10-09 07:36:52 +00:00
G_GameExit ( " Menu_Change: Attempted to show a menu with no entries. " ) ;
2015-02-09 05:50:33 +00:00
}
2016-11-01 01:35:32 +00:00
Menu_EntryFocus ( /*currentry*/ ) ;
2017-10-09 07:36:52 +00:00
break ;
}
default :
break ;
}
}
static void Menu_ChangingTo ( Menu_t * m )
{
# ifdef __ANDROID__
2018-09-28 04:27:53 +00:00
if ( m - > menuID = = MENU_TOUCHBUTTONS )
2017-10-09 07:36:52 +00:00
AndroidToggleButtonEditor ( ) ;
# endif
switch ( m - > type )
{
case TextForm :
2018-02-16 08:33:32 +00:00
Menu_StartTextInput ( ) ;
2017-10-09 07:36:52 +00:00
break ;
default :
break ;
}
}
int Menu_Change ( MenuID_t cm )
{
2017-10-09 07:36:55 +00:00
Menu_t * beginMenu = m_currentMenu ;
2017-10-09 07:36:52 +00:00
2017-12-02 09:24:55 +00:00
cm = VM_OnEventWithReturn ( EVENT_CHANGEMENU , g_player [ screenpeek ] . ps - > i , screenpeek , cm ) ;
2017-10-09 07:36:52 +00:00
if ( cm = = MENU_PREVIOUS )
{
m_currentMenu = m_previousMenu ;
g_currentMenu = g_previousMenu ;
}
else if ( cm = = MENU_CLOSE )
Menu_Close ( myconnectindex ) ;
else if ( cm > = 0 )
{
2017-10-09 07:36:55 +00:00
Menu_t * search = Menu_FindFiltered ( cm ) ;
2017-10-09 07:36:52 +00:00
if ( search = = NULL )
return 0 ; // intentional, so that users don't use any random value as "don't change"
2018-03-08 03:55:45 +00:00
// security
if ( search - > type = = Verify & &
search - > parentID ! = MENU_PREVIOUS & &
search - > parentID ! = MENU_CLOSE & &
search - > parentID ! = g_currentMenu )
return 1 ;
2017-10-09 07:36:52 +00:00
m_previousMenu = m_currentMenu ;
g_previousMenu = g_currentMenu ;
m_currentMenu = search ;
g_currentMenu = search - > menuID ;
2014-05-31 12:26:41 +00:00
}
2017-10-09 07:36:52 +00:00
else
return 1 ;
2019-07-19 01:49:29 +00:00
if ( FURY )
2017-10-09 07:36:52 +00:00
{
Menu_t * parent = m_currentMenu , * result = NULL ;
while ( parent ! = NULL & & parent - > menuID ! = MENU_OPTIONS & & parent - > menuID ! = MENU_MAIN & & parent - > menuID ! = MENU_MAIN_INGAME )
{
result = parent = Menu_FindFiltered ( parent - > parentID ) ;
}
m_parentMenu = result ;
2017-10-09 07:36:55 +00:00
if ( result )
{
Menu_MaybeSetSelectionToChild ( result , m_currentMenu - > menuID ) ;
Menu_AboutToStartDisplaying ( result ) ;
}
2017-10-09 07:36:52 +00:00
}
2017-10-09 07:36:55 +00:00
Menu_MaybeSetSelectionToChild ( m_currentMenu , beginMenu - > menuID ) ;
2017-10-09 07:36:52 +00:00
Menu_AboutToStartDisplaying ( m_currentMenu ) ;
Menu_ChangingTo ( m_currentMenu ) ;
# if !defined EDUKE32_TOUCH_DEVICES
m_menuchange_watchpoint = 1 ;
# endif
2015-12-20 05:19:02 +00:00
return 0 ;
2014-05-31 12:26:41 +00:00
}
2012-05-05 22:22:19 +00:00
2008-07-20 11:03:57 +00:00
2006-04-13 20:47:06 +00:00
2018-10-25 23:33:58 +00:00
int G_CheckPlayerColor ( int color )
2014-05-31 12:26:41 +00:00
{
2018-10-25 23:33:47 +00:00
for ( int i : MEOSV_PLAYER_COLOR )
2018-10-25 23:33:58 +00:00
if ( i = = color )
return color ;
2006-11-16 03:02:42 +00:00
2018-10-25 23:33:58 +00:00
return - 1 ;
2014-05-31 12:26:41 +00:00
}
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
int32_t Menu_DetermineSpecialState ( MenuEntry_t * entry )
2014-05-31 12:26:41 +00:00
{
if ( entry = = NULL )
return 0 ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
if ( entry - > type = = String )
{
if ( ( ( MenuString_t * ) entry - > entry ) - > editfield )
return 1 ;
}
else if ( entry - > type = = Option )
{
if ( ( ( MenuOption_t * ) entry - > entry ) - > options - > currentEntry > = 0 )
return 2 ;
}
else if ( entry - > type = = Custom2Col )
{
if ( ( ( MenuCustom2Col_t * ) entry - > entry ) - > screenOpen )
return 2 ;
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
return 0 ;
}
2013-01-17 21:59:01 +00:00
2016-11-01 01:35:32 +00:00
int32_t Menu_IsTextInput ( Menu_t * cm )
2014-05-31 12:26:41 +00:00
{
switch ( m_currentMenu - > type )
{
case Verify :
2015-03-24 10:48:34 +00:00
case TextForm :
2014-05-31 12:26:41 +00:00
case FileSelect :
case Message :
return 1 ;
break ;
case Panel :
return 0 ;
break ;
case Menu :
{
2018-12-15 01:39:51 +00:00
auto menu = ( MenuMenu_t * ) cm - > object ;
auto entry = menu - > entrylist [ menu - > currentEntry ] ;
2016-11-01 01:35:32 +00:00
return Menu_DetermineSpecialState ( entry ) ;
2014-05-31 12:26:41 +00:00
}
break ;
}
2013-01-17 21:59:01 +00:00
2014-05-31 12:26:41 +00:00
return 0 ;
}
2012-08-24 18:54:01 +00:00
2016-11-01 01:35:32 +00:00
static inline int32_t Menu_BlackTranslucentBackgroundOK ( MenuID_t cm )
2014-05-31 12:26:41 +00:00
{
switch ( cm )
{
case MENU_COLCORR :
case MENU_COLCORR_INGAME :
return 0 ;
break ;
default :
return 1 ;
break ;
}
2012-08-24 18:54:01 +00:00
2014-05-31 12:26:41 +00:00
return 1 ;
}
2012-08-24 18:54:01 +00:00
2016-11-01 01:35:32 +00:00
static inline int32_t Menu_UpdateScreenOK ( MenuID_t cm )
2014-05-31 12:26:41 +00:00
{
switch ( cm )
{
case MENU_LOAD :
case MENU_SAVE :
case MENU_LOADVERIFY :
2018-03-08 03:55:45 +00:00
case MENU_LOADDELVERIFY :
2014-05-31 12:26:41 +00:00
case MENU_SAVEVERIFY :
2018-03-08 03:55:45 +00:00
case MENU_SAVEDELVERIFY :
2014-05-31 12:26:41 +00:00
return 0 ;
break ;
default :
return 1 ;
break ;
}
2012-08-24 18:54:01 +00:00
2014-05-31 12:26:41 +00:00
return 1 ;
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
/*
Code below this point is entirely general ,
so if you want to change or add a menu ,
chances are you should scroll up .
*/
2006-11-16 03:02:42 +00:00
2014-12-27 18:36:58 +00:00
int32_t m_mouselastactivity ;
2014-12-27 18:37:27 +00:00
# if !defined EDUKE32_TOUCH_DEVICES
int32_t m_mousewake_watchpoint , m_menuchange_watchpoint ;
# endif
int32_t m_mousecaught ;
2014-12-27 18:36:43 +00:00
static vec2_t m_prevmousepos , m_mousepos , m_mousedownpos ;
2014-11-17 07:39:12 +00:00
2018-10-25 23:31:54 +00:00
void Menu_Open ( uint8_t playerID )
2014-11-17 07:39:12 +00:00
{
g_player [ playerID ] . ps - > gm | = MODE_MENU ;
2019-11-10 14:15:14 +00:00
inputState . mouseReadAbs ( & m_prevmousepos ) ;
2014-11-17 07:39:12 +00:00
m_mouselastactivity = - M_MOUSETIMEOUT ;
2014-12-27 18:37:27 +00:00
# if !defined EDUKE32_TOUCH_DEVICES
m_mousewake_watchpoint = 0 ;
# endif
2018-04-12 21:02:31 +00:00
mouseLockToWindow ( 0 ) ;
2014-11-17 07:39:12 +00:00
}
2018-10-25 23:31:54 +00:00
void Menu_Close ( uint8_t playerID )
2014-11-17 07:39:12 +00:00
{
2019-08-14 17:15:34 +00:00
auto & gm = g_player [ playerID ] . ps - > gm ;
if ( gm & MODE_GAME )
2014-11-17 07:39:12 +00:00
{
2019-08-14 17:15:34 +00:00
if ( gm & MODE_MENU )
I_ClearAllInput ( ) ;
2014-11-17 07:39:12 +00:00
// The following lines are here so that you cannot close the menu when no game is running.
2019-08-14 17:15:34 +00:00
gm & = ~ MODE_MENU ;
2018-04-12 21:02:31 +00:00
mouseLockToWindow ( 1 ) ;
2014-11-17 07:39:12 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
{
ready2send = 1 ;
totalclock = ototalclock ;
2019-08-27 13:39:54 +00:00
CAMERACLOCK = ( int32_t ) totalclock ;
2014-11-17 07:39:12 +00:00
CAMERADIST = 65536 ;
m_animation . start = 0 ;
m_animation . length = 0 ;
2014-12-21 15:51:50 +00:00
// Reset next-viewscreen-redraw counter.
// XXX: are there any other cases like that in need of handling?
if ( g_curViewscreen > = 0 )
2019-08-27 13:39:54 +00:00
actor [ g_curViewscreen ] . t_data [ 0 ] = ( int32_t ) totalclock ;
2014-11-17 07:39:12 +00:00
}
2014-12-21 15:51:50 +00:00
2014-11-17 07:39:12 +00:00
G_UpdateScreenArea ( ) ;
2019-06-25 11:30:31 +00:00
S_PauseSounds ( false ) ;
2014-11-17 07:39:12 +00:00
}
}
2015-01-13 12:57:29 +00:00
static int32_t x_widescreen_left ( void )
{
return ( 320 < < 15 ) - scale ( 240 < < 15 , xdim , ydim ) ;
}
2015-01-13 12:57:11 +00:00
static int32_t xdim_from_320_16 ( int32_t x )
{
const int32_t screenwidth = scale ( 240 < < 16 , xdim , ydim ) ;
return scale ( x + ( screenwidth > > 1 ) - ( 160 < < 16 ) , xdim , screenwidth ) ;
}
2015-01-13 12:56:54 +00:00
static int32_t ydim_from_200_16 ( int32_t y )
{
2019-01-30 00:19:56 +00:00
y = mulscale16 ( y + rotatesprite_y_offset - ( 200 < < 15 ) , rotatesprite_yxaspect ) + ( 200 < < 15 ) ;
2015-01-13 12:56:54 +00:00
return scale ( y , ydim , 200 < < 16 ) ;
}
2016-11-01 01:35:32 +00:00
static void Menu_BlackRectangle ( int32_t x , int32_t y , int32_t width , int32_t height , int32_t orientation )
2014-10-27 07:09:41 +00:00
{
2017-06-24 09:20:42 +00:00
const int32_t xscale = divscale16 ( width , tilesiz [ 0 ] . x < < 16 ) , yscale = divscale16 ( height , tilesiz [ 0 ] . y < < 16 ) ;
2014-10-27 07:09:41 +00:00
2018-01-29 11:14:17 +00:00
rotatesprite_ ( x , y , max ( xscale , yscale ) , 0 , 0 , 127 , ud . shadow_pal , ( orientation & ( 1 | 32 ) ) | 2 | 8 | 16 , 0 , 0 , xdim_from_320_16 ( x ) , ydim_from_200_16 ( y ) , xdim_from_320_16 ( x + width ) , ydim_from_200_16 ( y + height ) ) ;
2014-10-27 07:09:41 +00:00
}
2014-12-27 18:37:39 +00:00
enum MenuTextFlags_t
{
MT_Selected = 1 < < 0 ,
MT_Disabled = 1 < < 1 ,
MT_XCenter = 1 < < 2 ,
MT_XRight = 1 < < 3 ,
MT_YCenter = 1 < < 4 ,
MT_Literal = 1 < < 5 ,
2018-01-29 02:14:16 +00:00
MT_RightSide = 1 < < 6 ,
2014-12-27 18:37:39 +00:00
} ;
2018-01-29 02:14:16 +00:00
static void Menu_GetFmt ( const MenuFont_t * font , uint8_t const status , int32_t * s , int32_t * z )
2014-05-31 12:26:41 +00:00
{
2018-01-29 02:14:16 +00:00
if ( status & MT_Selected )
2019-08-27 13:39:54 +00:00
* s = VM_OnEventWithReturn ( EVENT_MENUSHADESELECTED , - 1 , myconnectindex , sintable [ ( ( int32_t ) totalclock < < 5 ) & 2047 ] > > 12 ) ;
2018-01-29 02:14:16 +00:00
else
* s = font - > shade_deselected ;
// sum shade values
if ( status & MT_Disabled )
2018-10-25 23:31:15 +00:00
* s + = font - > shade_disabled ;
2018-01-29 02:14:16 +00:00
2019-07-19 01:49:29 +00:00
if ( FURY & & status & MT_Selected )
2018-01-29 02:14:16 +00:00
* z + = ( * z > > 4 ) ;
2014-05-31 12:26:41 +00:00
}
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
static vec2_t Menu_Text ( int32_t x , int32_t y , const MenuFont_t * font , const char * t , uint8_t status , int32_t ydim_upper , int32_t ydim_lower )
2014-05-31 12:26:41 +00:00
{
2017-06-19 23:06:25 +00:00
int32_t s , p , ybetween = font - > between . y ;
2014-05-31 12:26:41 +00:00
int32_t f = font - > textflags ;
2014-12-27 18:37:39 +00:00
if ( status & MT_XCenter )
2014-05-31 12:26:41 +00:00
f | = TEXT_XCENTER ;
2014-12-27 18:37:39 +00:00
if ( status & MT_XRight )
2014-05-31 12:26:41 +00:00
f | = TEXT_XRIGHT ;
2014-12-27 18:37:39 +00:00
if ( status & MT_YCenter )
2014-05-31 12:26:41 +00:00
{
f | = TEXT_YCENTER | TEXT_YOFFSETZERO ;
2017-06-19 23:06:25 +00:00
ybetween = font - > emptychar . y ; // <^ the battle against 'Q'
2014-05-31 12:26:41 +00:00
}
2014-12-27 18:37:39 +00:00
if ( status & MT_Literal )
2014-05-31 12:26:41 +00:00
f | = TEXT_LITERALESCAPE ;
2006-11-16 03:02:42 +00:00
2017-07-07 22:50:42 +00:00
int32_t z = font - > zoom ;
2018-01-29 02:14:16 +00:00
if ( status & MT_Disabled )
p = ( status & MT_RightSide ) ? font - > pal_disabled_right : font - > pal_disabled ;
else if ( status & MT_Selected )
p = ( status & MT_RightSide ) ? font - > pal_selected_right : font - > pal_selected ;
else
p = ( status & MT_RightSide ) ? font - > pal_deselected_right : font - > pal_deselected ;
Menu_GetFmt ( font , status , & s , & z ) ;
2006-04-13 20:47:06 +00:00
2017-07-07 22:50:42 +00:00
return G_ScreenText ( font - > tilenum , x , y , z , 0 , 0 , t , s , p , 2 | 8 | 16 | ROTATESPRITE_FULL16 , 0 , font - > emptychar . x , font - > emptychar . y , font - > between . x , ybetween , f , 0 , ydim_upper , xdim - 1 , ydim_lower ) ;
2014-05-31 12:26:41 +00:00
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
#if 0
2016-11-01 01:35:32 +00:00
static vec2_t Menu_TextSize ( int32_t x , int32_t y , const MenuFont_t * font , const char * t , uint8_t status )
2014-05-31 12:26:41 +00:00
{
int32_t f = font - > textflags ;
2014-12-27 18:37:39 +00:00
if ( status & MT_Literal )
2014-05-31 12:26:41 +00:00
f | = TEXT_LITERALESCAPE ;
2006-11-16 03:02:42 +00:00
2017-06-19 23:06:29 +00:00
return G_ScreenTextSize ( font - > tilenum , x , y , font - > zoom , 0 , t , 2 | 8 | 16 | ROTATESPRITE_FULL16 , font - > emptychar . x , font - > emptychar . y , font - > between . x , font - > between . y , f , 0 , 0 , xdim - 1 , ydim - 1 ) ;
2014-05-31 12:26:41 +00:00
}
2006-12-18 08:37:12 +00:00
# endif
2006-04-13 20:47:06 +00:00
2018-10-25 23:31:54 +00:00
static int32_t Menu_FindOptionBinarySearch ( MenuOption_t * object , const int32_t query , uint16_t searchstart , uint16_t searchend )
2014-05-31 12:26:41 +00:00
{
2018-10-25 23:31:54 +00:00
const uint16_t thissearch = ( searchstart + searchend ) / 2 ;
const bool isIdentityMap = object - > options - > optionValues = = NULL ;
const int32_t destination = isIdentityMap ? ( int32_t ) thissearch : object - > options - > optionValues [ thissearch ] ;
const int32_t difference = query - destination ;
2017-06-17 11:42:04 +00:00
Bassert ( ! isIdentityMap | | query > = 0 ) ;
2014-05-31 12:26:41 +00:00
if ( difference = = 0 )
return thissearch ;
else if ( searchstart = = searchend )
return - 1 ;
else if ( difference > 0 )
{
if ( thissearch = = searchend )
return - 1 ;
searchstart = thissearch + 1 ;
}
else if ( difference < 0 )
{
if ( thissearch = = searchstart )
return - 1 ;
searchend = thissearch - 1 ;
}
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
return Menu_FindOptionBinarySearch ( object , query , searchstart , searchend ) ;
2014-05-31 12:26:41 +00:00
}
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
static int32_t Menu_MouseOutsideBounds ( vec2_t const * const pos , const int32_t x , const int32_t y , const int32_t width , const int32_t height )
2014-12-27 18:37:27 +00:00
{
return pos - > x < x | | pos - > x > = x + width | | pos - > y < y | | pos - > y > = y + height ;
}
2016-11-01 01:35:32 +00:00
static void Menu_RunScrollbar ( Menu_t * cm , MenuMenuFormat_t const * const format , const int32_t totalextent , int32_t * const scrollPos , const int32_t rightedge , const vec2_t origin )
2014-12-27 18:35:21 +00:00
{
if ( totalextent > klabs ( format - > bottomcutoff ) )
{
2018-02-22 13:34:34 +00:00
int32_t scrollTile = ( ud . menu_scrollbartilenum > = 0 ) ? ud . menu_scrollbartilenum : - 1 ;
int32_t scrollTileTop = ( ud . menu_scrollbartilenum > = 0 ) ? ud . menu_scrollbartilenum + 1 : - 1 ;
int32_t scrollTileBottom = ( ud . menu_scrollbartilenum > = 0 ) ? ud . menu_scrollbartilenum + 2 : - 1 ;
int32_t scrollTileCursor = ( ud . menu_scrollbartilenum > = 0 ) ? ud . menu_scrollbartilenum + 3 : SELECTDIR ;
const int32_t scrollwidth = ( scrollTile > = 0 ) ? tilesiz [ scrollTile ] . x * ud . menu_scrollbarz : tilesiz [ scrollTileCursor ] . x * ud . menu_scrollcursorz ;
const int32_t scrollx = origin . x + rightedge - scrollwidth , scrolly = origin . y + format - > pos . y ;
2014-12-27 18:35:21 +00:00
const int32_t scrollheight = klabs ( format - > bottomcutoff ) - format - > pos . y ;
2018-02-22 13:34:34 +00:00
int32_t scrollregionstart = scrolly ;
int32_t scrollregionend = scrolly + scrollheight ;
if ( ud . menu_scrollbartilenum > = 0 )
{
scrollregionstart + = tilesiz [ scrollTileTop ] . y * ud . menu_scrollbarz ;
2018-02-22 14:09:38 +00:00
scrollregionend - = tilesiz [ scrollTileBottom ] . y * ud . menu_scrollbarz ;
2018-02-22 13:34:34 +00:00
}
const int32_t scrollregionheight = scrollregionend - scrollregionstart - ( tilesiz [ scrollTileCursor ] . y * ud . menu_scrollcursorz ) ;
2014-12-27 18:37:27 +00:00
const int32_t scrollPosMax = totalextent - klabs ( format - > bottomcutoff ) ;
2018-02-22 13:34:34 +00:00
if ( scrollTile > = 0 )
{
2018-03-06 10:25:04 +00:00
// draw the scrollbar (minus the top tile) twice to fill the gaps between tiles
if ( tilesiz [ scrollTile ] . y > 0 )
{
for ( int32_t y = scrollregionstart + ( ( tilesiz [ scrollTileTop ] . y = = 0 ) * tilesiz [ scrollTile ] . y * ud . menu_scrollbarz ) ; y < scrollregionend ; y + = tilesiz [ scrollTile ] . y * ud . menu_scrollbarz )
rotatesprite ( scrollx , y - ( ud . menu_scrollbarz > > 1 ) , ud . menu_scrollbarz , 0 , scrollTile , 0 , 0 , 26 , 0 , 0 , xdim - 1 , mulscale16 ( scrollregionend , ydim * 200 ) - 1 ) ;
}
rotatesprite_fs ( scrollx , scrollregionend - ( ud . menu_scrollbarz > > 1 ) , ud . menu_scrollbarz , 0 , scrollTileBottom , 0 , 0 , 26 ) ;
2018-02-22 13:34:34 +00:00
if ( tilesiz [ scrollTile ] . y > 0 )
{
for ( int32_t y = scrollregionstart ; y < scrollregionend ; y + = tilesiz [ scrollTile ] . y * ud . menu_scrollbarz )
rotatesprite ( scrollx , y , ud . menu_scrollbarz , 0 , scrollTile , 0 , 0 , 26 , 0 , 0 , xdim - 1 , mulscale16 ( scrollregionend , ydim * 200 ) - 1 ) ;
}
rotatesprite_fs ( scrollx , scrolly , ud . menu_scrollbarz , 0 , scrollTileTop , 0 , 0 , 26 ) ;
rotatesprite_fs ( scrollx , scrollregionend , ud . menu_scrollbarz , 0 , scrollTileBottom , 0 , 0 , 26 ) ;
}
else
Menu_BlackRectangle ( scrollx , scrolly , scrollwidth , scrollheight , 1 | 32 ) ;
2014-12-27 18:37:27 +00:00
2019-01-30 09:36:47 +00:00
rotatesprite_fs ( scrollx + ( ( scrollwidth > > 17 ) < < 16 ) - ( ( tilesiz [ scrollTileCursor ] . x > > 1 ) * ud . menu_scrollcursorz ) , scrollregionstart + scale ( scrollregionheight , * scrollPos , scrollPosMax ) , ud . menu_scrollcursorz , 0 , scrollTileCursor , 0 , 0 , 26 ) ;
2014-12-27 18:37:27 +00:00
2019-11-04 00:01:54 +00:00
if ( cm = = m_currentMenu & & ! m_mousecaught & & MOUSEACTIVECONDITIONAL ( inputState . mouseClickState ( ) = = MOUSE_PRESSED | | inputState . mouseClickState ( ) = = MOUSE_HELD ) )
2014-12-27 18:37:27 +00:00
{
2019-01-30 09:36:47 +00:00
const int32_t scrolltilehalfheight = ( tilesiz [ scrollTileCursor ] . y > > 1 ) * ud . menu_scrollcursorz ;
2018-02-22 13:34:34 +00:00
const int32_t scrollregiony = scrollregionstart + scrolltilehalfheight ;
2014-12-27 18:37:27 +00:00
// region between the y-midline of the arrow at the extremes scrolls proportionally
2016-11-01 01:35:36 +00:00
if ( ! Menu_MouseOutsideBounds ( & m_mousepos , scrollx , scrollregiony , scrollwidth , scrollregionheight ) )
2014-12-27 18:37:27 +00:00
{
* scrollPos = scale ( m_mousepos . y - scrollregiony , scrollPosMax , scrollregionheight ) ;
m_mousecaught = 1 ;
}
// region outside the y-midlines clamps to the extremes
2016-11-01 01:35:36 +00:00
else if ( ! Menu_MouseOutsideBounds ( & m_mousepos , scrollx , scrolly , scrollwidth , scrollheight ) )
2014-12-27 18:37:27 +00:00
{
2019-01-30 09:36:47 +00:00
if ( m_mousepos . y > scrolly + ( ( scrollheight > > 17 ) < < 16 ) )
2014-12-27 18:37:27 +00:00
* scrollPos = scrollPosMax ;
else
* scrollPos = 0 ;
2014-12-27 18:35:21 +00:00
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
}
}
2014-12-27 18:35:21 +00:00
}
}
typedef enum MenuMovement_t
{
MM_Up = 1 ,
MM_End = 3 ,
MM_Down = 4 ,
MM_Home = 12 ,
MM_Left = 16 ,
MM_AllTheWayLeft = 48 ,
MM_Right = 64 ,
MM_AllTheWayRight = 192 ,
MM_Swap = 80 ,
} MenuMovement_t ;
2016-11-01 01:35:32 +00:00
static MenuEntry_t * Menu_RunInput_Menu_MovementVerify ( MenuMenu_t * menu ) ;
static MenuEntry_t * Menu_RunInput_Menu_Movement ( MenuMenu_t * menu , MenuMovement_t direction ) ;
static void Menu_RunInput_EntryLink_Activate ( MenuEntry_t * entry ) ;
static void Menu_RunInput_EntryOptionList_MovementVerify ( MenuOption_t * object ) ;
static void Menu_RunInput_EntryOptionList_Movement ( MenuOption_t * object , MenuMovement_t direction ) ;
static int32_t Menu_RunInput_EntryOption_Modify ( MenuEntry_t * entry , MenuOption_t * object , int32_t newValueIndex ) ;
static int32_t Menu_RunInput_EntryOption_Movement ( MenuEntry_t * entry , MenuOption_t * object , MenuMovement_t direction ) ;
static int32_t Menu_RunInput_EntryOption_Activate ( MenuEntry_t * entry , MenuOption_t * object ) ;
static int32_t Menu_RunInput_EntryOptionList_Activate ( MenuEntry_t * entry , MenuOption_t * object ) ;
static void Menu_RunInput_EntryCustom2Col_Activate ( MenuEntry_t * entry ) ;
static void Menu_RunInput_EntryRangeInt32_MovementVerify ( MenuEntry_t * entry , MenuRangeInt32_t * object , int32_t newValue ) ;
static void Menu_RunInput_EntryRangeInt32_MovementArbitrary ( MenuEntry_t * entry , MenuRangeInt32_t * object , int32_t newValue ) ;
static void Menu_RunInput_EntryRangeInt32_Movement ( MenuEntry_t * entry , MenuRangeInt32_t * object , MenuMovement_t direction ) ;
static void Menu_RunInput_EntryRangeFloat_MovementVerify ( MenuEntry_t * entry , MenuRangeFloat_t * object , float newValue ) ;
static void Menu_RunInput_EntryRangeFloat_MovementArbitrary ( MenuEntry_t * entry , MenuRangeFloat_t * object , float newValue ) ;
static void Menu_RunInput_EntryRangeFloat_Movement ( MenuEntry_t * entry , MenuRangeFloat_t * object , MenuMovement_t direction ) ;
2017-07-29 20:39:57 +00:00
# ifdef MENU_ENABLE_RANGEDOUBLE
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryRangeDouble_MovementVerify ( /*MenuEntry_t *entry, */ MenuRangeDouble_t * object , double newValue ) ;
static void Menu_RunInput_EntryRangeDouble_MovementArbitrary ( /*MenuEntry_t *entry, */ MenuRangeDouble_t * object , double newValue ) ;
static void Menu_RunInput_EntryRangeDouble_Movement ( /*MenuEntry_t *entry, */ MenuRangeDouble_t * object , MenuMovement_t direction ) ;
2017-07-29 20:39:57 +00:00
# endif
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryString_Activate ( MenuEntry_t * entry ) ;
2017-12-18 11:24:53 +00:00
static void Menu_RunInput_EntryString_Submit ( /*MenuEntry_t *entry, */ MenuString_t * object ) ;
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryString_Cancel ( /*MenuEntry_t *entry, */ MenuString_t * object ) ;
static void Menu_RunInput_FileSelect_MovementVerify ( MenuFileSelect_t * object ) ;
static void Menu_RunInput_FileSelect_Movement ( MenuFileSelect_t * object , MenuMovement_t direction ) ;
static void Menu_RunInput_FileSelect_Select ( MenuFileSelect_t * object ) ;
2017-12-18 11:24:53 +00:00
static int32_t M_RunMenu_Menu ( Menu_t * cm , MenuMenu_t * menu , MenuEntry_t * currentry , int32_t state , const vec2_t origin , bool actually_draw )
2014-05-31 12:26:41 +00:00
{
2016-04-06 03:07:47 +00:00
int32_t totalHeight = 0 ;
2014-11-30 02:04:36 +00:00
// RIP MenuGroup_t b. 2014-03-?? d. 2014-11-29
2014-05-31 12:26:41 +00:00
{
2014-11-30 02:04:36 +00:00
int32_t e ;
2015-01-13 12:56:54 +00:00
const int32_t y_upper = menu - > format - > pos . y ;
const int32_t y_lower = klabs ( menu - > format - > bottomcutoff ) ;
int32_t y = 0 ;
2014-09-30 04:07:29 +00:00
int32_t calculatedentryspacing = 0 ;
2006-04-13 20:47:06 +00:00
2014-11-30 02:04:36 +00:00
if ( menu - > format - > bottomcutoff < 0 )
2014-09-30 04:07:29 +00:00
{
int32_t totalheight = 0 , numvalidentries = 0 ;
2014-11-30 02:04:36 +00:00
for ( e = 0 ; e < menu - > numEntries ; + + e )
2014-09-30 04:07:29 +00:00
{
2014-11-30 02:04:36 +00:00
MenuEntry_t * entry = menu - > entrylist [ e ] ;
2014-09-30 04:07:29 +00:00
2018-02-20 11:55:07 +00:00
if ( entry = = NULL | | ( entry - > flags & MEF_Hidden ) )
2014-09-30 04:07:29 +00:00
continue ;
+ + numvalidentries ;
2017-06-19 23:06:29 +00:00
// assumes height == font->get_yline()!
2017-06-19 23:06:45 +00:00
totalheight + = entry - > getHeight ( ) ;
2014-09-30 04:07:29 +00:00
}
2014-11-30 02:04:36 +00:00
calculatedentryspacing = ( klabs ( menu - > format - > bottomcutoff ) - menu - > format - > pos . y - totalheight ) / ( numvalidentries > 1 ? numvalidentries - 1 : 1 ) ;
2014-09-30 04:07:29 +00:00
}
2016-04-06 03:07:47 +00:00
// totalHeight calculating pass
for ( e = 0 ; e < menu - > numEntries ; + + e )
{
MenuEntry_t * entry = menu - > entrylist [ e ] ;
2018-02-20 11:55:07 +00:00
if ( entry = = NULL | | ( entry - > flags & MEF_Hidden ) )
2016-04-06 03:07:47 +00:00
continue ;
2017-06-19 23:06:45 +00:00
int32_t const height = entry - > getHeight ( ) ;
2016-04-06 03:07:47 +00:00
y + = height ;
totalHeight = y ;
2017-06-19 23:06:33 +00:00
y + = ( ! calculatedentryspacing | | calculatedentryspacing > entry - > getMarginBottom ( ) ) ? entry - > getMarginBottom ( ) : calculatedentryspacing ;
2016-04-06 03:07:47 +00:00
}
y = 0 ;
int32_t ydim_upper , ydim_lower ;
if ( y_upper + totalHeight > y_lower )
{
ydim_upper = ydim_from_200_16 ( origin . y + y_upper ) ;
ydim_lower = ydim_from_200_16 ( origin . y + y_lower ) ;
}
else
{
ydim_upper = 0 ;
ydim_lower = ydim - 1 ;
}
2014-11-30 02:04:36 +00:00
for ( e = 0 ; e < menu - > numEntries ; + + e )
2006-11-16 03:02:42 +00:00
{
2014-11-30 02:04:36 +00:00
MenuEntry_t * entry = menu - > entrylist [ e ] ;
2008-07-28 06:59:08 +00:00
2018-02-20 11:55:07 +00:00
if ( entry = = NULL | | ( entry - > flags & MEF_Hidden ) )
2014-05-31 12:26:41 +00:00
continue ;
2006-04-13 20:47:06 +00:00
2018-02-13 00:13:06 +00:00
int32_t const indent = entry - > getIndent ( ) ;
int32_t x = menu - > format - > pos . x ;
2006-11-16 03:02:42 +00:00
2017-06-19 23:06:45 +00:00
uint8_t status = 0 ;
2014-12-27 18:37:39 +00:00
if ( e = = menu - > currentEntry )
status | = MT_Selected ;
2017-06-19 23:07:05 +00:00
if ( entry - > flags & ( MEF_Disabled | MEF_LookDisabled ) )
2014-12-27 18:37:39 +00:00
status | = MT_Disabled ;
if ( entry - > format - > width = = 0 )
status | = MT_XCenter ;
2006-04-13 20:47:06 +00:00
2017-12-18 11:24:53 +00:00
bool const dodraw = entry - > type ! = Spacer & & actually_draw & &
0 < = y - menu - > scrollPos + entry - > font - > get_yline ( ) & &
y - menu - > scrollPos < = klabs ( menu - > format - > bottomcutoff ) - menu - > format - > pos . y ;
2014-05-31 12:26:41 +00:00
2017-07-10 13:44:07 +00:00
int32_t const height = entry - > getHeight ( ) ; // max(textsize.y, entry->font->get_yline()); // bluefont Q ruins this
status | = MT_YCenter ;
2019-01-30 09:36:47 +00:00
int32_t const y_internal = origin . y + y_upper + y + ( ( height > > 17 ) < < 16 ) - menu - > scrollPos ;
2017-07-10 13:44:07 +00:00
2017-06-19 23:06:45 +00:00
vec2_t textsize ;
2014-05-31 12:26:41 +00:00
if ( dodraw )
2018-02-13 00:13:06 +00:00
textsize = Menu_Text ( origin . x + x + indent , y_internal , entry - > font , entry - > name , status , ydim_upper , ydim_lower ) ;
2014-05-31 12:26:41 +00:00
2014-12-27 18:37:39 +00:00
if ( entry - > format - > width < 0 )
status | = MT_XRight ;
2014-05-31 12:26:41 +00:00
2014-12-27 18:37:39 +00:00
if ( dodraw & & ( status & MT_Selected ) & & state ! = 1 )
2008-05-15 03:16:38 +00:00
{
2014-12-27 18:37:39 +00:00
if ( status & MT_XCenter )
2008-05-15 03:16:38 +00:00
{
2017-10-09 07:36:45 +00:00
Menu_DrawCursorLeft ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) + entry - > font - > cursorCenterPosition , y_internal , entry - > font - > cursorScale ) ;
Menu_DrawCursorRight ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) - entry - > font - > cursorCenterPosition , y_internal , entry - > font - > cursorScale ) ;
2008-05-15 03:16:38 +00:00
}
else
2018-02-13 00:13:06 +00:00
Menu_DrawCursorLeft ( origin . x + x + indent - entry - > font - > cursorLeftPosition , y_internal , entry - > font - > cursorScale ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2018-01-29 02:14:16 +00:00
if ( entry - > name ! = nullptr & & entry - > name [ 0 ] ! = ' \0 ' )
status | = MT_RightSide ;
2016-04-06 03:07:47 +00:00
// need this up here to avoid race conditions
entry - > ybottom = ( entry - > ytop = y_upper + y ) + height ;
2014-05-31 12:26:41 +00:00
if ( dodraw )
2017-06-19 23:06:48 +00:00
{
2019-01-30 09:36:47 +00:00
const int32_t mousex = origin . x + indent + entry - > format - > width = = 0 ? x - ( ( textsize . x > > 17 ) < < 16 ) : x ;
2017-06-19 23:06:48 +00:00
const int32_t mousey = origin . y + y_upper + y - menu - > scrollPos ;
int32_t mousewidth = entry - > format - > width = = 0 ? textsize . x : klabs ( entry - > format - > width ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
if ( entry - > name )
x + = klabs ( entry - > format - > width ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
switch ( entry - > type )
{
case Spacer :
break ;
case Dummy :
if ( MOUSEACTIVECONDITIONAL ( state ! = 1 & & cm = = m_currentMenu & & ! Menu_MouseOutsideBounds ( & m_mousepos , mousex , mousey , mousewidth , height ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
if ( MOUSEWATCHPOINTCONDITIONAL ( Menu_MouseOutsideBounds ( & m_prevmousepos , mousex , mousey , mousewidth , height ) ) )
{
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
}
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
break ;
case Link :
if ( MOUSEACTIVECONDITIONAL ( state ! = 1 & & cm = = m_currentMenu & & ! Menu_MouseOutsideBounds ( & m_mousepos , mousex , mousey , mousewidth , height ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
if ( MOUSEWATCHPOINTCONDITIONAL ( Menu_MouseOutsideBounds ( & m_prevmousepos , mousex , mousey , mousewidth , height ) ) )
{
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
}
2014-12-27 18:37:27 +00:00
2019-11-04 00:01:54 +00:00
if ( ! m_mousecaught & & inputState . mouseClickState ( ) = = MOUSE_RELEASED & & ! Menu_MouseOutsideBounds ( & m_mousedownpos , mousex , mousey , mousewidth , entry - > font - > get_yline ( ) ) )
2017-06-19 23:06:48 +00:00
{
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:07:01 +00:00
if ( entry - > flags & MEF_Disabled )
2017-06-19 23:06:48 +00:00
break ;
2014-12-28 21:34:54 +00:00
2017-06-19 23:06:48 +00:00
Menu_RunInput_EntryLink_Activate ( entry ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_MENU ) // for skill selection
S_PlaySound ( PISTOL_BODYHIT ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
m_mousecaught = 1 ;
}
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
break ;
case Option :
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuOption_t * ) entry - > entry ;
2019-11-09 18:15:03 +00:00
int32_t currentOption = Menu_FindOptionBinarySearch ( object , object - > cVar = = NULL ? Menu_EntryOptionSource ( entry , object - > currentOption ) : object - > cVar - > ToInt ( ) , 0 , object - > options - > numOptions ) ;
2006-04-13 20:47:06 +00:00
2017-06-19 23:06:48 +00:00
if ( currentOption > = 0 )
object - > currentOption = currentOption ;
2014-05-31 12:26:41 +00:00
2017-06-19 23:06:48 +00:00
int32_t optiontextx = origin . x + x ;
const int32_t optiontexty = origin . y + y_upper + y - menu - > scrollPos ;
2014-12-27 18:37:27 +00:00
2019-01-30 09:36:47 +00:00
const vec2_t optiontextsize = Menu_Text ( optiontextx , optiontexty + ( ( height > > 17 ) < < 16 ) , object - > font ,
2017-06-19 23:06:48 +00:00
currentOption < 0 ? MenuCustom : currentOption < object - > options - > numOptions ? object - > options - > optionNames [ currentOption ] : NULL ,
status , ydim_upper , ydim_lower ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
if ( entry - > format - > width > 0 )
mousewidth + = optiontextsize . x ;
else
optiontextx - = optiontextsize . x ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
if ( MOUSEACTIVECONDITIONAL ( state ! = 1 & & cm = = m_currentMenu & & ! Menu_MouseOutsideBounds ( & m_mousepos , mousex , mousey , mousewidth , height ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
if ( MOUSEWATCHPOINTCONDITIONAL ( Menu_MouseOutsideBounds ( & m_prevmousepos , mousex , mousey , mousewidth , height ) ) )
{
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
}
2014-12-27 18:37:27 +00:00
2019-11-04 00:01:54 +00:00
if ( ! m_mousecaught & & inputState . mouseClickState ( ) = = MOUSE_RELEASED & & ! Menu_MouseOutsideBounds ( & m_mousedownpos , mousex , mousey , mousewidth , entry - > font - > get_yline ( ) ) )
2017-06-19 23:06:48 +00:00
{
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:07:01 +00:00
if ( entry - > flags & MEF_Disabled )
2017-06-19 23:06:48 +00:00
break ;
2014-12-28 21:34:54 +00:00
2017-06-19 23:06:48 +00:00
Menu_RunInput_EntryOption_Activate ( entry , object ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
m_mousecaught = 1 ;
}
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
break ;
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
case Custom2Col :
2014-12-27 18:37:27 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuCustom2Col_t * ) entry - > entry ;
2017-06-19 23:06:48 +00:00
int32_t columnx [ 2 ] = { origin . x + x - ( ( status & MT_XRight ) ? object - > columnWidth : 0 ) , origin . x + x + ( ( status & MT_XRight ) ? 0 : object - > columnWidth ) } ;
const int32_t columny = origin . y + y_upper + y - menu - > scrollPos ;
2019-11-03 19:58:10 +00:00
// Beware of hack job!
2019-11-04 22:01:50 +00:00
auto keys = Bindings . GetKeysForCommand ( buttonMap . GetButtonName ( object - > buttonindex ) ) ;
2019-11-03 19:58:10 +00:00
FString text1 ;
FString text2 ;
if ( keys . Size ( ) > 0 ) text1 = C_NameKeys ( & keys [ 0 ] , 1 ) ;
if ( keys . Size ( ) > 1 ) text2 = C_NameKeys ( & keys [ 1 ] , 1 ) ;
const vec2_t column0textsize = Menu_Text ( columnx [ 0 ] , columny + ( ( height > > 17 ) < < 16 ) , object - > font , text1 , menu - > currentColumn = = 0 ? status : ( status & ~ MT_Selected ) , ydim_upper , ydim_lower ) ;
const vec2_t column1textsize = Menu_Text ( columnx [ 1 ] , columny + ( ( height > > 17 ) < < 16 ) , object - > font , text2 , menu - > currentColumn = = 1 ? status : ( status & ~ MT_Selected ) , ydim_upper , ydim_lower ) ;
2017-06-19 23:06:48 +00:00
if ( entry - > format - > width > 0 )
mousewidth + = object - > columnWidth + column1textsize . x ;
else
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
columnx [ 0 ] - = column0textsize . x ;
columnx [ 1 ] - = column0textsize . x ;
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
if ( MOUSEACTIVECONDITIONAL ( state ! = 1 & & cm = = m_currentMenu & & ! Menu_MouseOutsideBounds ( & m_mousepos , mousex , mousey , mousewidth , height ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
if ( MOUSEWATCHPOINTCONDITIONAL ( Menu_MouseOutsideBounds ( & m_prevmousepos , mousex , mousey , mousewidth , height ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
if ( ! Menu_MouseOutsideBounds ( & m_mousepos , columnx [ 1 ] , mousey , column1textsize . x , object - > font - > get_yline ( ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
if ( MOUSEWATCHPOINTCONDITIONAL ( Menu_MouseOutsideBounds ( & m_prevmousepos , columnx [ 1 ] , mousey , column1textsize . x , object - > font - > get_yline ( ) ) ) )
{
menu - > currentColumn = 1 ;
}
2014-12-27 18:37:27 +00:00
2019-11-04 00:01:54 +00:00
if ( ! m_mousecaught & & inputState . mouseClickState ( ) = = MOUSE_RELEASED & & ! Menu_MouseOutsideBounds ( & m_mousedownpos , columnx [ 1 ] , mousey , column1textsize . x , object - > font - > get_yline ( ) ) )
2017-06-19 23:06:48 +00:00
{
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
menu - > currentColumn = 1 ;
2014-12-28 21:34:54 +00:00
2017-06-19 23:07:01 +00:00
if ( entry - > flags & MEF_Disabled )
2017-06-19 23:06:48 +00:00
break ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
Menu_RunInput_EntryCustom2Col_Activate ( entry ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
m_mousecaught = 1 ;
}
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
else if ( ! Menu_MouseOutsideBounds ( & m_mousepos , columnx [ 0 ] , mousey , column0textsize . x , object - > font - > get_yline ( ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
if ( MOUSEWATCHPOINTCONDITIONAL ( Menu_MouseOutsideBounds ( & m_prevmousepos , columnx [ 0 ] , mousey , column0textsize . x , object - > font - > get_yline ( ) ) ) )
{
menu - > currentColumn = 0 ;
}
2014-12-27 18:37:27 +00:00
2019-11-04 00:01:54 +00:00
if ( ! m_mousecaught & & inputState . mouseClickState ( ) = = MOUSE_RELEASED & & ! Menu_MouseOutsideBounds ( & m_mousedownpos , columnx [ 0 ] , mousey , column0textsize . x , object - > font - > get_yline ( ) ) )
2017-06-19 23:06:48 +00:00
{
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
menu - > currentColumn = 0 ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:07:01 +00:00
if ( entry - > flags & MEF_Disabled )
2017-06-19 23:06:48 +00:00
break ;
2014-12-28 21:34:54 +00:00
2017-06-19 23:06:48 +00:00
Menu_RunInput_EntryCustom2Col_Activate ( entry ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
m_mousecaught = 1 ;
}
2014-12-27 18:37:27 +00:00
}
}
2017-06-19 23:06:48 +00:00
break ;
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
case RangeInt32 :
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuRangeInt32_t * ) entry - > entry ;
2006-04-13 20:47:06 +00:00
2017-06-19 23:06:48 +00:00
int32_t s , p ;
2017-07-07 22:50:42 +00:00
int32_t z = entry - > font - > cursorScale ;
2018-01-29 02:14:16 +00:00
Menu_GetFmt ( object - > font , status | MT_RightSide , & s , & z ) ;
if ( status & MT_Disabled )
p = ud . slidebar_paldisabled ;
else if ( status & MT_Selected )
p = ud . slidebar_palselected ;
else
p = 0 ;
2006-04-13 20:47:06 +00:00
2018-01-26 04:35:02 +00:00
const int32_t slidebarwidth = mulscale16 ( tilesiz [ SLIDEBAR ] . x * ud . menu_slidebarz , z ) ;
const int32_t slidebarheight = mulscale16 ( tilesiz [ SLIDEBAR ] . y * ud . menu_slidebarz , z ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
if ( status & MT_XRight )
x - = slidebarwidth ;
else
mousewidth + = slidebarwidth ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
const int32_t slidebarx = origin . x + x ;
2019-01-30 09:36:47 +00:00
const int32_t slidebary = origin . y + y_upper + y + ( ( ( height - slidebarheight ) > > 17 ) < < 16 ) - menu - > scrollPos ;
2006-11-16 03:02:42 +00:00
2018-01-29 02:14:16 +00:00
rotatesprite_ybounds ( slidebarx , slidebary , mulscale16 ( ud . menu_slidebarz , z ) , 0 , SLIDEBAR , s , p , 2 | 8 | 16 | ROTATESPRITE_FULL16 , ydim_upper , ydim_lower ) ;
2006-11-16 03:02:42 +00:00
2018-01-26 04:35:02 +00:00
const int32_t slideregionwidth = mulscale16 ( ( tilesiz [ SLIDEBAR ] . x * ud . menu_slidebarz ) - ( ud . menu_slidebarmargin < < 1 ) - ( tilesiz [ SLIDEBAR + 1 ] . x * ud . menu_slidecursorz ) , z ) ;
2019-11-09 18:15:03 +00:00
const int32_t slidepointx = slidebarx + mulscale16 ( ud . menu_slidebarmargin , z ) + scale ( slideregionwidth , * object - > cVar - object - > min , object - > max - object - > min ) ;
2019-01-30 09:36:47 +00:00
const int32_t slidepointy = slidebary + mulscale16 ( ( ( ( tilesiz [ SLIDEBAR ] . y > > 1 ) * ud . menu_slidebarz ) - ( ( tilesiz [ SLIDEBAR + 1 ] . y > > 1 ) * ud . menu_slidecursorz ) ) , z ) ;
2014-12-27 18:37:27 +00:00
2018-01-29 02:14:16 +00:00
rotatesprite_ybounds ( slidepointx , slidepointy , mulscale16 ( ud . menu_slidecursorz , z ) , 0 , SLIDEBAR + 1 , s , p , 2 | 8 | 16 | ROTATESPRITE_FULL16 , ydim_upper , ydim_lower ) ;
2006-11-16 03:02:42 +00:00
2017-06-19 23:06:48 +00:00
if ( object - > flags & DisplayTypeMask )
{
status | = MT_XRight ;
2006-11-16 03:02:42 +00:00
2017-07-29 20:39:53 +00:00
int32_t onehundredpercent = object - > onehundredpercent ;
if ( onehundredpercent = = 0 )
onehundredpercent = object - > max ;
2007-02-13 09:50:58 +00:00
2017-06-19 23:06:48 +00:00
switch ( object - > flags & DisplayTypeMask )
2014-05-31 12:26:41 +00:00
{
2017-07-29 20:39:53 +00:00
case DisplayTypeInteger :
2019-11-09 18:15:03 +00:00
Bsprintf ( tempbuf , " %d " , * * object - > cVar ) ;
2017-06-19 23:06:48 +00:00
break ;
2017-07-29 20:39:53 +00:00
case DisplayTypePercent :
2019-11-09 18:15:03 +00:00
Bsprintf ( tempbuf , " %d%% " , roundscale ( * object - > cVar , 100 , onehundredpercent ) ) ;
2017-06-19 23:06:48 +00:00
break ;
2017-07-29 20:39:53 +00:00
case DisplayTypeNormalizedDecimal :
2019-11-09 18:15:03 +00:00
Bsprintf ( tempbuf , " %.2f " , ( double ) * object - > cVar / ( double ) onehundredpercent ) ;
2017-06-19 23:06:48 +00:00
break ;
2014-05-31 12:26:41 +00:00
}
2014-12-27 18:37:27 +00:00
2019-01-30 09:36:47 +00:00
Menu_Text ( origin . x + x - ( 4 < < 16 ) , origin . y + y_upper + y + ( ( height > > 17 ) < < 16 ) - menu - > scrollPos , object - > font , tempbuf , status , ydim_upper , ydim_lower ) ;
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
if ( MOUSEACTIVECONDITIONAL ( state ! = 1 & & cm = = m_currentMenu & & ! Menu_MouseOutsideBounds ( & m_mousepos , mousex , mousey , mousewidth , height ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
if ( MOUSEWATCHPOINTCONDITIONAL ( Menu_MouseOutsideBounds ( & m_prevmousepos , mousex , mousey , mousewidth , height ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
2019-11-04 00:01:54 +00:00
if ( ! m_mousecaught & & ( inputState . mouseClickState ( ) = = MOUSE_PRESSED | | inputState . mouseClickState ( ) = = MOUSE_HELD ) )
2014-12-27 18:37:27 +00:00
{
2018-03-01 13:46:48 +00:00
const int32_t slidepointhalfwidth = mulscale16 ( ( ( ( tilesiz [ SLIDEBAR + 1 ] . x ) * ud . menu_slidecursorz ) > > 2 ) + ud . menu_slidebarmargin , z ) ;
2017-06-19 23:06:48 +00:00
const int32_t slideregionx = slidebarx + slidepointhalfwidth ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
2017-06-19 23:07:01 +00:00
if ( entry - > flags & MEF_Disabled )
2017-06-19 23:06:48 +00:00
break ;
// region between the x-midline of the slidepoint at the extremes slides proportionally
if ( ! Menu_MouseOutsideBounds ( & m_mousepos , slideregionx , mousey , slideregionwidth , height ) )
{
2017-07-29 20:39:53 +00:00
Menu_RunInput_EntryRangeInt32_MovementArbitrary ( entry , object , roundscale ( object - > max - object - > min , m_mousepos . x - slideregionx , slideregionwidth ) + object - > min ) ;
2017-06-19 23:06:48 +00:00
m_mousecaught = 1 ;
}
// region outside the x-midlines clamps to the extremes
else if ( ! Menu_MouseOutsideBounds ( & m_mousepos , slidebarx , mousey , slidebarwidth , height ) )
{
2019-01-30 09:36:47 +00:00
if ( m_mousepos . x > slideregionx + ( ( slideregionwidth > > 17 ) < < 16 ) )
2017-06-19 23:06:48 +00:00
Menu_RunInput_EntryRangeInt32_MovementVerify ( entry , object , object - > max ) ;
else
Menu_RunInput_EntryRangeInt32_MovementVerify ( entry , object , object - > min ) ;
m_mousecaught = 1 ;
}
2014-12-27 18:37:27 +00:00
}
}
2017-06-19 23:06:48 +00:00
break ;
}
case RangeFloat :
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuRangeFloat_t * ) entry - > entry ;
2006-04-13 20:47:06 +00:00
2017-06-19 23:06:48 +00:00
int32_t s , p ;
2017-07-07 22:50:42 +00:00
int32_t z = entry - > font - > cursorScale ;
2018-01-29 02:14:16 +00:00
Menu_GetFmt ( object - > font , status | MT_RightSide , & s , & z ) ;
if ( status & MT_Disabled )
p = ud . slidebar_paldisabled ;
else if ( status & MT_Selected )
p = ud . slidebar_palselected ;
else
p = 0 ;
2006-04-13 20:47:06 +00:00
2018-01-26 04:35:02 +00:00
const int32_t slidebarwidth = mulscale16 ( tilesiz [ SLIDEBAR ] . x * ud . menu_slidebarz , z ) ;
const int32_t slidebarheight = mulscale16 ( tilesiz [ SLIDEBAR ] . y * ud . menu_slidebarz , z ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
if ( status & MT_XRight )
x - = slidebarwidth ;
else
mousewidth + = slidebarwidth ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
const int32_t slidebarx = origin . x + x ;
2019-01-30 09:36:47 +00:00
const int32_t slidebary = origin . y + y_upper + y + ( ( ( height - slidebarheight ) > > 17 ) < < 16 ) - menu - > scrollPos ;
2006-11-15 01:16:55 +00:00
2018-01-29 02:14:16 +00:00
rotatesprite_ybounds ( slidebarx , slidebary , mulscale16 ( ud . menu_slidebarz , z ) , 0 , SLIDEBAR , s , p , 2 | 8 | 16 | ROTATESPRITE_FULL16 , ydim_upper , ydim_lower ) ;
2006-11-15 01:16:55 +00:00
2018-01-26 04:35:02 +00:00
const int32_t slideregionwidth = mulscale16 ( ( tilesiz [ SLIDEBAR ] . x * ud . menu_slidebarz ) - ( ud . menu_slidebarmargin < < 1 ) - ( tilesiz [ SLIDEBAR + 1 ] . x * ud . menu_slidecursorz ) , z ) ;
2019-11-09 18:15:03 +00:00
const int32_t slidepointx = slidebarx + mulscale16 ( ud . menu_slidebarmargin , z ) + Blrintf ( ( float ) slideregionwidth * ( * object - > cVar - object - > min ) / ( object - > max - object - > min ) ) ;
2019-01-30 09:36:47 +00:00
const int32_t slidepointy = slidebary + mulscale16 ( ( ( tilesiz [ SLIDEBAR ] . y > > 1 ) * ud . menu_slidebarz ) - ( ( tilesiz [ SLIDEBAR + 1 ] . y > > 1 ) * ud . menu_slidecursorz ) , z ) ;
2014-12-27 18:37:27 +00:00
2018-01-29 02:14:16 +00:00
rotatesprite_ybounds ( slidepointx , slidepointy , mulscale16 ( ud . menu_slidecursorz , z ) , 0 , SLIDEBAR + 1 , s , p , 2 | 8 | 16 | ROTATESPRITE_FULL16 , ydim_upper , ydim_lower ) ;
2006-11-15 01:16:55 +00:00
2017-06-19 23:06:48 +00:00
if ( object - > flags & DisplayTypeMask )
{
status | = MT_XRight ;
2014-05-31 12:26:41 +00:00
2017-07-29 20:39:53 +00:00
float onehundredpercent = object - > onehundredpercent ;
if ( onehundredpercent = = 0.f )
onehundredpercent = 1.f ;
2014-05-31 12:26:41 +00:00
2017-06-19 23:06:48 +00:00
switch ( object - > flags & DisplayTypeMask )
2014-05-31 12:26:41 +00:00
{
2017-07-29 20:39:53 +00:00
case DisplayTypeInteger :
2019-11-09 18:15:03 +00:00
Bsprintf ( tempbuf , " %.2f " , * * object - > cVar ) ;
2017-06-19 23:06:48 +00:00
break ;
2017-07-29 20:39:53 +00:00
case DisplayTypePercent :
2019-11-09 18:15:03 +00:00
Bsprintf ( tempbuf , " %ld%% " , lrintf ( * object - > cVar * 100.f / onehundredpercent ) ) ;
2017-06-19 23:06:48 +00:00
break ;
2017-07-29 20:39:53 +00:00
case DisplayTypeNormalizedDecimal :
2019-11-09 18:15:03 +00:00
Bsprintf ( tempbuf , " %.2f " , * object - > cVar / onehundredpercent ) ;
2017-06-19 23:06:48 +00:00
break ;
2014-05-31 12:26:41 +00:00
}
2014-12-27 18:37:27 +00:00
2019-01-30 09:36:47 +00:00
Menu_Text ( origin . x + x - ( 4 < < 16 ) , origin . y + y_upper + y + ( ( height > > 17 ) < < 16 ) - menu - > scrollPos , object - > font , tempbuf , status , ydim_upper , ydim_lower ) ;
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
if ( MOUSEACTIVECONDITIONAL ( state ! = 1 & & cm = = m_currentMenu & & ! Menu_MouseOutsideBounds ( & m_mousepos , mousex , mousey , mousewidth , height ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
if ( MOUSEWATCHPOINTCONDITIONAL ( Menu_MouseOutsideBounds ( & m_prevmousepos , mousex , mousey , mousewidth , height ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
2019-11-04 00:01:54 +00:00
if ( ! m_mousecaught & & ( inputState . mouseClickState ( ) = = MOUSE_PRESSED | | inputState . mouseClickState ( ) = = MOUSE_HELD ) )
2014-12-27 18:37:27 +00:00
{
2017-06-24 09:20:37 +00:00
const int32_t slidepointhalfwidth = mulscale16 ( ( 2 + tilesiz [ SLIDEBAR + 1 ] . x ) < < 15 , z ) ;
2017-06-19 23:06:48 +00:00
const int32_t slideregionx = slidebarx + slidepointhalfwidth ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
2017-06-19 23:07:01 +00:00
if ( entry - > flags & MEF_Disabled )
2017-06-19 23:06:48 +00:00
break ;
// region between the x-midline of the slidepoint at the extremes slides proportionally
if ( ! Menu_MouseOutsideBounds ( & m_mousepos , slideregionx , mousey , slideregionwidth , height ) )
{
Menu_RunInput_EntryRangeFloat_MovementArbitrary ( entry , object , ( object - > max - object - > min ) * ( m_mousepos . x - slideregionx ) / slideregionwidth + object - > min ) ;
m_mousecaught = 1 ;
}
// region outside the x-midlines clamps to the extremes
else if ( ! Menu_MouseOutsideBounds ( & m_mousepos , slidebarx , mousey , slidebarwidth , height ) )
{
2019-01-30 09:36:47 +00:00
if ( m_mousepos . x > slideregionx + ( slideregionwidth > > 17 < < 16 ) )
2017-06-19 23:06:48 +00:00
Menu_RunInput_EntryRangeFloat_MovementVerify ( entry , object , object - > max ) ;
else
Menu_RunInput_EntryRangeFloat_MovementVerify ( entry , object , object - > min ) ;
m_mousecaught = 1 ;
}
2014-12-27 18:37:27 +00:00
}
}
2017-06-19 23:06:48 +00:00
break ;
}
2017-07-29 20:39:57 +00:00
# ifdef MENU_ENABLE_RANGEDOUBLE
2017-06-19 23:06:48 +00:00
case RangeDouble :
{
MenuRangeDouble_t * object = ( MenuRangeDouble_t * ) entry - > entry ;
2006-11-15 01:16:55 +00:00
2017-06-19 23:06:48 +00:00
int32_t s , p ;
2017-07-07 22:50:42 +00:00
int32_t z = entry - > font - > cursorScale ;
2018-01-29 02:14:16 +00:00
Menu_GetFmt ( object - > font , status | MT_RightSide , & s , & z ) ;
if ( status & MT_Disabled )
p = ud . slidebar_paldisabled ;
else if ( status & MT_Selected )
p = ud . slidebar_palselected ;
else
p = 0 ;
2006-11-15 01:16:55 +00:00
2018-01-26 04:35:02 +00:00
const int32_t slidebarwidth = mulscale16 ( tilesiz [ SLIDEBAR ] . x * ud . menu_slidebarz , z ) ;
const int32_t slidebarheight = mulscale16 ( tilesiz [ SLIDEBAR ] . y * ud . menu_slidebarz , z ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
if ( status & MT_XRight )
x - = slidebarwidth ;
else
mousewidth + = slidebarwidth ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
const int32_t slidebarx = origin . x + x ;
2019-01-30 09:36:47 +00:00
const int32_t slidebary = origin . y + y_upper + y + ( ( ( height - slidebarheight ) > > 17 ) < < 16 ) - menu - > scrollPos ;
2006-04-13 20:47:06 +00:00
2018-01-29 02:14:16 +00:00
rotatesprite_ybounds ( slidebarx , slidebary , mulscale16 ( ud . menu_slidebarz , z ) , 0 , SLIDEBAR , s , p , 2 | 8 | 16 | ROTATESPRITE_FULL16 , ydim_upper , ydim_lower ) ;
2007-02-13 09:50:58 +00:00
2018-01-26 04:35:02 +00:00
const int32_t slideregionwidth = mulscale16 ( ( tilesiz [ SLIDEBAR ] . x * ud . menu_slidebarz ) - ( ud . menu_slidebarmargin < < 1 ) - ( tilesiz [ SLIDEBAR + 1 ] . x * ud . menu_slidecursorz ) , z ) ;
const int32_t slidepointx = slidebarx + mulscale16 ( ud . menu_slidebarmargin , z ) + lrint ( ( double ) slideregionwidth * ( * object - > variable - object - > min ) / ( object - > max - object - > min ) ) ;
2019-01-30 09:36:47 +00:00
const int32_t slidepointy = slidebary + mulscale16 ( ( ( tilesiz [ SLIDEBAR ] . y ) > > 1 * ud . menu_slidebarz ) - ( ( tilesiz [ SLIDEBAR + 1 ] . y ) > > 1 * ud . menu_slidecursorz ) , z ) ;
2014-12-27 18:37:27 +00:00
2018-01-29 02:14:16 +00:00
rotatesprite_ybounds ( slidepointx , slidepointy , mulscale16 ( ud . menu_slidecursorz , z ) , 0 , SLIDEBAR + 1 , s , p , 2 | 8 | 16 | ROTATESPRITE_FULL16 , ydim_upper , ydim_lower ) ;
2006-04-13 20:47:06 +00:00
2017-06-19 23:06:48 +00:00
if ( object - > flags & DisplayTypeMask )
{
status | = MT_XRight ;
2006-04-13 20:47:06 +00:00
2017-07-29 20:39:53 +00:00
double onehundredpercent = object - > onehundredpercent ;
if ( onehundredpercent = = 0. )
onehundredpercent = 1. ;
2006-04-13 20:47:06 +00:00
2017-06-19 23:06:48 +00:00
switch ( object - > flags & DisplayTypeMask )
2014-05-31 12:26:41 +00:00
{
2017-07-29 20:39:53 +00:00
case DisplayTypeInteger :
2017-06-19 23:06:48 +00:00
Bsprintf ( tempbuf , " %.2f " , * object - > variable ) ;
break ;
2017-07-29 20:39:53 +00:00
case DisplayTypePercent :
Bsprintf ( tempbuf , " %ld%% " , lrint ( * object - > variable * 100. / onehundredpercent ) ) ;
2017-06-19 23:06:48 +00:00
break ;
2017-07-29 20:39:53 +00:00
case DisplayTypeNormalizedDecimal :
Bsprintf ( tempbuf , " %.2f " , * object - > variable / onehundredpercent ) ;
2017-06-19 23:06:48 +00:00
break ;
2014-05-31 12:26:41 +00:00
}
2014-12-27 18:37:27 +00:00
2019-01-30 09:36:47 +00:00
Menu_Text ( origin . x + x - ( 4 < < 16 ) , origin . y + y_upper + y + ( ( height > > 17 ) < < 16 ) - menu - > scrollPos , object - > font , tempbuf , status , ydim_upper , ydim_lower ) ;
2014-12-27 18:37:27 +00:00
}
2017-06-19 23:06:48 +00:00
if ( MOUSEACTIVECONDITIONAL ( state ! = 1 & & cm = = m_currentMenu & & ! Menu_MouseOutsideBounds ( & m_mousepos , mousex , mousey , mousewidth , height ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
if ( MOUSEWATCHPOINTCONDITIONAL ( Menu_MouseOutsideBounds ( & m_prevmousepos , mousex , mousey , mousewidth , height ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
2014-12-27 18:37:27 +00:00
}
2019-11-04 00:01:54 +00:00
if ( ! m_mousecaught & & ( inputState . mouseClickState ( ) = = MOUSE_PRESSED | | inputState . mouseClickState ( ) = = MOUSE_HELD ) )
2017-06-19 23:06:48 +00:00
{
2017-06-24 09:20:37 +00:00
const int32_t slidepointhalfwidth = mulscale16 ( ( 2 + tilesiz [ SLIDEBAR + 1 ] . x ) < < 15 , z ) ;
2017-06-19 23:06:48 +00:00
const int32_t slideregionx = slidebarx + slidepointhalfwidth ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
2014-05-31 12:26:41 +00:00
2017-06-19 23:07:01 +00:00
if ( entry - > flags & MEF_Disabled )
2017-06-19 23:06:48 +00:00
break ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
// region between the x-midline of the slidepoint at the extremes slides proportionally
if ( ! Menu_MouseOutsideBounds ( & m_mousepos , slideregionx , mousey , slideregionwidth , height ) )
{
Menu_RunInput_EntryRangeDouble_MovementArbitrary ( /*entry, */ object , ( object - > max - object - > min ) * ( m_mousepos . x - slideregionx ) / slideregionwidth + object - > min ) ;
m_mousecaught = 1 ;
}
// region outside the x-midlines clamps to the extremes
else if ( ! Menu_MouseOutsideBounds ( & m_mousepos , slidebarx , mousey , slidebarwidth , height ) )
{
2019-01-30 09:36:47 +00:00
if ( m_mousepos . x > slideregionx + ( ( slideregionwidth > > 17 ) < < 16 ) )
2017-06-19 23:06:48 +00:00
Menu_RunInput_EntryRangeDouble_MovementVerify ( /*entry, */ object , object - > max ) ;
else
Menu_RunInput_EntryRangeDouble_MovementVerify ( /*entry, */ object , object - > min ) ;
m_mousecaught = 1 ;
}
}
}
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
break ;
2014-12-27 18:37:27 +00:00
}
2017-07-29 20:39:57 +00:00
# endif
2017-06-19 23:06:48 +00:00
case String :
2014-12-27 18:37:27 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuString_t * ) entry - > entry ;
2014-05-31 12:26:41 +00:00
2017-06-19 23:06:48 +00:00
vec2_t dim ;
int32_t stringx = x ;
2019-01-30 09:36:47 +00:00
const int32_t stringy = origin . y + y_upper + y + ( ( height > > 17 ) < < 16 ) - menu - > scrollPos ;
2017-06-19 23:06:48 +00:00
int32_t h ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
if ( entry = = currentry & & object - > editfield ! = NULL )
2014-12-27 18:37:27 +00:00
{
2017-07-06 14:43:07 +00:00
dim = Menu_Text ( origin . x + stringx , stringy , object - > font , object - > editfield , ( status & ~ MT_Disabled ) | MT_Literal , ydim_upper , ydim_lower ) ;
2017-06-19 23:06:48 +00:00
h = max ( dim . y , entry - > font - > get_yline ( ) ) ;
2014-12-27 18:37:27 +00:00
2017-10-09 07:36:45 +00:00
Menu_DrawCursorText ( origin . x + x + dim . x + ( 1 < < 16 ) , stringy , h , ydim_upper , ydim_lower ) ;
2017-06-19 23:06:48 +00:00
}
else
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:48 +00:00
dim = Menu_Text ( origin . x + stringx , stringy , object - > font , object - > variable , status , ydim_upper , ydim_lower ) ;
h = max ( dim . y , entry - > font - > get_yline ( ) ) ;
}
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
if ( entry - > format - > width > 0 )
{
if ( entry - > name )
mousewidth + = dim . x ;
}
else
stringx - = dim . x ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
if ( MOUSEACTIVECONDITIONAL ( cm = = m_currentMenu & & ! Menu_MouseOutsideBounds ( & m_mousepos , mousex , mousey , mousewidth , h ) ) )
{
if ( state ! = 1 & & Menu_MouseOutsideBounds ( & m_prevmousepos , mousex , mousey , mousewidth , h ) )
2014-12-27 18:37:27 +00:00
{
menu - > currentEntry = e ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_Menu_MovementVerify ( menu ) ;
2017-06-19 23:06:48 +00:00
}
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
# ifndef EDUKE32_TOUCH_DEVICES
2019-11-04 00:01:54 +00:00
if ( ! m_mousecaught & & inputState . mouseClickState ( ) = = MOUSE_RELEASED & & ! Menu_MouseOutsideBounds ( & m_mousepos , mousex , mousey , mousewidth , h ) & & ! Menu_MouseOutsideBounds ( & m_mousedownpos , mousex , mousey , mousewidth , h ) )
2017-06-19 23:06:48 +00:00
# endif
{
if ( entry = = currentry & & object - > editfield ! = NULL )
{
2017-12-18 11:24:53 +00:00
Menu_RunInput_EntryString_Submit ( /*entry, */ object ) ;
2014-12-28 21:34:54 +00:00
2017-06-19 23:06:48 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:48 +00:00
m_mousecaught = 1 ;
}
else if ( state ! = 1 )
{
menu - > currentEntry = e ;
Menu_RunInput_Menu_MovementVerify ( menu ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:07:01 +00:00
if ( entry - > flags & MEF_Disabled )
2017-06-19 23:06:48 +00:00
break ;
Menu_RunInput_EntryString_Activate ( entry ) ;
S_PlaySound ( PISTOL_BODYHIT ) ;
m_mousecaught = 1 ;
}
2014-12-27 18:37:27 +00:00
}
}
2017-06-19 23:06:48 +00:00
break ;
}
2014-05-31 12:26:41 +00:00
}
}
2017-06-19 23:06:48 +00:00
2014-05-31 12:26:41 +00:00
// prepare for the next line
y + = height ;
2017-06-19 23:06:33 +00:00
y + = ( ! calculatedentryspacing | | calculatedentryspacing > entry - > getMarginBottom ( ) ) ? entry - > getMarginBottom ( ) : calculatedentryspacing ;
2014-05-31 12:26:41 +00:00
}
2006-04-13 20:47:06 +00:00
2015-01-13 12:56:54 +00:00
// draw indicators if applicable
2017-12-18 11:24:53 +00:00
if ( actually_draw )
Menu_RunScrollbar ( cm , menu - > format , y_upper + totalHeight , & menu - > scrollPos , 320 < < 16 , origin ) ;
2015-01-13 12:56:54 +00:00
}
2006-04-13 20:47:06 +00:00
2016-04-06 03:07:47 +00:00
return totalHeight ;
2014-05-31 12:26:41 +00:00
}
2012-11-08 17:00:31 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_RunOptionList ( Menu_t * cm , MenuEntry_t * entry , MenuOption_t * object , const vec2_t origin )
2014-05-31 12:26:41 +00:00
{
2015-01-13 12:56:54 +00:00
int32_t e , y = 0 ;
const int32_t y_upper = object - > options - > menuFormat - > pos . y ;
const int32_t y_lower = object - > options - > menuFormat - > bottomcutoff ;
2017-06-19 23:06:33 +00:00
int32_t calculatedentryspacing = object - > options - > getMarginBottom ( ) ;
2014-09-30 04:07:29 +00:00
2017-06-19 23:06:29 +00:00
// assumes height == font->get_yline()!
2014-09-30 04:07:29 +00:00
if ( calculatedentryspacing < 0 )
2017-06-19 23:06:29 +00:00
calculatedentryspacing = ( - calculatedentryspacing - object - > options - > font - > get_yline ( ) ) / ( object - > options - > numOptions - 1 ) - object - > options - > font - > get_yline ( ) ;
2006-04-13 20:47:06 +00:00
2016-04-06 03:07:47 +00:00
int32_t totalHeight = 0 ;
for ( e = 0 ; e < object - > options - > numOptions ; + + e )
{
2017-06-19 23:06:29 +00:00
int32_t const height = object - > options - > font - > get_yline ( ) ;
2016-04-06 03:07:47 +00:00
y + = height ;
totalHeight = y ;
y + = calculatedentryspacing ;
}
y = 0 ;
int32_t ydim_upper , ydim_lower ;
if ( y_upper + totalHeight > y_lower )
{
ydim_upper = ydim_from_200_16 ( origin . y + y_upper ) ;
ydim_lower = ydim_from_200_16 ( origin . y + y_lower ) ;
}
else
{
ydim_upper = 0 ;
ydim_lower = ydim - 1 ;
}
2014-05-31 12:26:41 +00:00
for ( e = 0 ; e < object - > options - > numOptions ; + + e )
{
2017-07-10 13:44:07 +00:00
int32_t const x = object - > options - > menuFormat - > pos . x ;
2006-11-16 03:02:42 +00:00
2017-07-10 13:44:07 +00:00
uint8_t status = 0 ;
2014-12-27 18:37:39 +00:00
if ( e = = object - > options - > currentEntry )
status | = MT_Selected ;
if ( object - > options - > entryFormat - > width = = 0 )
status | = MT_XCenter ;
2008-05-15 03:16:38 +00:00
2017-12-18 11:24:53 +00:00
bool const dodraw = 0 < = y - object - > options - > scrollPos + object - > options - > font - > get_yline ( ) & &
y - object - > options - > scrollPos < = object - > options - > menuFormat - > bottomcutoff - object - > options - > menuFormat - > pos . y ;
2006-11-16 03:02:42 +00:00
2017-07-10 13:44:07 +00:00
int32_t const height = object - > options - > font - > get_yline ( ) ; // max(textsize.y, object->options->font->get_yline());
status | = MT_YCenter ;
2019-01-30 09:36:47 +00:00
int32_t const y_internal = origin . y + y_upper + y + ( ( height > > 17 ) < < 16 ) - object - > options - > scrollPos ;
2006-11-16 03:02:42 +00:00
2017-07-10 13:44:07 +00:00
vec2_t textsize ;
if ( dodraw )
textsize = Menu_Text ( origin . x + x , y_internal , object - > options - > font , object - > options - > optionNames [ e ] , status , ydim_upper , ydim_lower ) ;
2006-11-16 03:02:42 +00:00
2014-12-27 18:37:39 +00:00
if ( object - > options - > entryFormat - > width < 0 )
status | = MT_XRight ;
2006-11-16 03:02:42 +00:00
2014-12-27 18:37:39 +00:00
if ( dodraw & & ( status & MT_Selected ) )
2006-11-16 03:02:42 +00:00
{
2014-12-27 18:37:39 +00:00
if ( status & MT_XCenter )
2006-11-16 03:02:42 +00:00
{
2017-10-09 07:36:45 +00:00
Menu_DrawCursorLeft ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) + object - > options - > font - > cursorCenterPosition , y_internal , object - > options - > font - > cursorScale ) ;
Menu_DrawCursorRight ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) - object - > options - > font - > cursorCenterPosition , y_internal , object - > options - > font - > cursorScale ) ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
else
2017-10-09 07:36:45 +00:00
Menu_DrawCursorLeft ( origin . x + x - object - > options - > font - > cursorLeftPosition , y_internal , object - > options - > font - > cursorScale ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2014-12-27 18:37:27 +00:00
if ( dodraw )
{
2019-01-30 09:36:47 +00:00
const int32_t mousex = origin . x + object - > options - > entryFormat - > width = = 0 ? x - ( ( textsize . x > > 17 ) < < 16 ) : x ;
2015-01-25 12:17:10 +00:00
const int32_t mousey = origin . y + y_upper + y - object - > options - > scrollPos ;
2014-12-27 18:37:27 +00:00
const int32_t mousewidth = object - > options - > entryFormat - > width = = 0 ? textsize . x : klabs ( object - > options - > entryFormat - > width ) ;
2017-06-19 23:06:29 +00:00
if ( MOUSEACTIVECONDITIONAL ( cm = = m_currentMenu & & ! Menu_MouseOutsideBounds ( & m_mousepos , mousex , mousey , mousewidth , object - > options - > font - > get_yline ( ) ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:29 +00:00
if ( MOUSEWATCHPOINTCONDITIONAL ( Menu_MouseOutsideBounds ( & m_prevmousepos , mousex , mousey , mousewidth , object - > options - > font - > get_yline ( ) ) ) )
2014-12-27 18:37:27 +00:00
{
object - > options - > currentEntry = e ;
}
2019-11-04 00:01:54 +00:00
if ( ! m_mousecaught & & inputState . mouseClickState ( ) = = MOUSE_RELEASED & & ! Menu_MouseOutsideBounds ( & m_mousedownpos , mousex , mousey , mousewidth , object - > options - > font - > get_yline ( ) ) )
2014-12-27 18:37:27 +00:00
{
object - > options - > currentEntry = e ;
2016-11-01 01:35:32 +00:00
if ( ! Menu_RunInput_EntryOptionList_Activate ( entry , object ) )
2014-12-27 18:37:27 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
m_mousecaught = 1 ;
}
}
}
2014-05-31 12:26:41 +00:00
// prepare for the next line
y + = height ;
2014-09-30 04:07:29 +00:00
y + = calculatedentryspacing ;
2014-05-31 12:26:41 +00:00
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
// draw indicators if applicable
2016-11-01 01:35:32 +00:00
Menu_RunScrollbar ( cm , object - > options - > menuFormat , y_upper + totalHeight , & object - > options - > scrollPos , 320 < < 16 , origin ) ;
2014-12-27 18:37:27 +00:00
}
2016-11-01 01:35:32 +00:00
static int32_t Menu_RunInput_MouseAdvance ( void )
2014-12-27 18:37:27 +00:00
{
2019-11-04 00:01:54 +00:00
return MOUSEACTIVECONDITIONAL ( ! m_mousecaught & & inputState . mouseClickState ( ) = = MOUSE_RELEASED ) ;
2014-12-27 18:37:27 +00:00
}
2016-11-01 01:35:32 +00:00
static int32_t Menu_RunInput_MouseReturn_status ;
2014-12-27 18:37:27 +00:00
2016-12-26 06:02:06 +00:00
# if !defined EDUKE32_TOUCH_DEVICES
2016-11-01 01:35:32 +00:00
static void Menu_Run_MouseReturn ( Menu_t * cm , const vec2_t origin )
2014-12-27 18:37:27 +00:00
{
if ( ! MOUSEACTIVECONDITION )
2016-02-17 19:08:32 +00:00
return ;
2014-12-27 18:37:27 +00:00
if ( cm - > menuID = = MENU_MAIN )
return ;
2018-03-08 03:55:48 +00:00
uint32_t const posx = tilesiz [ SELECTDIR ] . y * SELECTDIR_z ;
rotatesprite_ ( origin . x + posx , 0 , SELECTDIR_z , 512 , SELECTDIR ,
2019-08-27 13:39:54 +00:00
Menu_RunInput_MouseReturn_status ? 4 - ( sintable [ ( ( int32_t ) totalclock < < 4 ) & 2047 ] > > 11 ) : 6 , 0 ,
2015-01-15 06:45:24 +00:00
2 | 8 | 16 | RS_ALIGN_L , MOUSEALPHA , 0 , xdim_from_320_16 ( origin . x + x_widescreen_left ( ) ) , 0 ,
2019-01-30 09:36:47 +00:00
xdim_from_320_16 ( origin . x + x_widescreen_left ( ) + ( ( posx > > 17 ) < < 16 ) ) , ydim - 1 ) ;
2014-12-27 18:37:27 +00:00
}
2016-12-26 06:02:06 +00:00
# endif
2014-12-27 18:37:27 +00:00
2016-11-01 01:35:32 +00:00
static int32_t Menu_RunInput_MouseReturn ( void )
2014-12-27 18:37:27 +00:00
{
# if !defined EDUKE32_TOUCH_DEVICES
if ( ! MOUSEACTIVECONDITION )
{
2016-11-01 01:35:32 +00:00
Menu_RunInput_MouseReturn_status = 0 ;
2014-12-27 18:37:27 +00:00
return 0 ;
}
2015-04-28 21:30:42 +00:00
# endif
2014-12-27 18:37:27 +00:00
if ( g_currentMenu = = MENU_MAIN )
return 0 ;
2015-01-13 12:57:29 +00:00
const int32_t MouseReturnRegionX = x_widescreen_left ( ) ;
2014-12-27 18:37:27 +00:00
2019-01-30 09:36:47 +00:00
vec2_t backbuttonbound = { ( ( tilesiz [ SELECTDIR ] . y * SELECTDIR_z ) > > 17 ) < < 16 , tilesiz [ SELECTDIR ] . x * SELECTDIR_z } ;
2018-03-08 03:55:48 +00:00
if ( ! Menu_MouseOutsideBounds ( & m_mousepos , MouseReturnRegionX , 0 , backbuttonbound . x , backbuttonbound . y ) )
2014-12-27 18:37:27 +00:00
{
2015-04-28 21:30:42 +00:00
# if !defined EDUKE32_TOUCH_DEVICES
2016-11-01 01:35:32 +00:00
Menu_RunInput_MouseReturn_status = 1 ;
2015-04-28 21:30:42 +00:00
# else
2019-11-04 00:01:54 +00:00
Menu_RunInput_MouseReturn_status = ( inputState . mouseClickState ( ) = = MOUSE_PRESSED | | inputState . mouseClickState ( ) = = MOUSE_HELD ) ;
2015-04-28 21:30:42 +00:00
# endif
2019-11-04 00:01:54 +00:00
return ! m_mousecaught & & inputState . mouseClickState ( ) = = MOUSE_RELEASED & & ! Menu_MouseOutsideBounds ( & m_mousedownpos , MouseReturnRegionX , 0 , backbuttonbound . x , backbuttonbound . y ) ;
2014-12-27 18:37:27 +00:00
}
2016-11-01 01:35:32 +00:00
Menu_RunInput_MouseReturn_status = 0 ;
2015-02-11 05:22:59 +00:00
2014-12-27 18:37:27 +00:00
return 0 ;
2014-05-31 12:26:41 +00:00
}
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_Run_AbbreviateNameIntoBuffer ( const char * name , int32_t entrylength )
2014-06-13 09:04:31 +00:00
{
int32_t len = Bstrlen ( name ) ;
2018-08-09 16:07:14 +00:00
Bstrncpy ( tempbuf , name , ARRAY_SIZE ( tempbuf ) ) ;
2014-06-13 09:04:31 +00:00
if ( len > entrylength )
{
len = entrylength - 3 ;
tempbuf [ len ] = 0 ;
while ( len < entrylength )
tempbuf [ len + + ] = ' . ' ;
}
tempbuf [ len ] = 0 ;
}
2016-11-01 01:35:32 +00:00
static void Menu_Recurse ( MenuID_t cm , const vec2_t origin )
2014-10-27 07:09:41 +00:00
{
switch ( cm )
{
2018-03-08 03:55:45 +00:00
case MENU_SAVECLEANVERIFY :
2014-10-27 07:09:41 +00:00
case MENU_LOADVERIFY :
2018-03-08 03:55:45 +00:00
case MENU_LOADDELVERIFY :
2014-10-27 07:09:41 +00:00
case MENU_SAVEVERIFY :
2018-03-08 03:55:45 +00:00
case MENU_SAVEDELVERIFY :
2019-08-13 09:16:02 +00:00
case MENU_COLCORRRESETVERIFY :
case MENU_KEYSRESETVERIFY :
case MENU_KEYSCLASSICVERIFY :
case MENU_JOYSTANDARDVERIFY :
case MENU_JOYPROVERIFY :
case MENU_JOYCLEARVERIFY :
2014-10-27 07:09:41 +00:00
case MENU_ADULTPASSWORD :
2015-03-24 10:49:03 +00:00
case MENU_CHEATENTRY :
case MENU_CHEAT_WARP :
case MENU_CHEAT_SKILL :
2016-11-01 01:35:32 +00:00
Menu_Run ( m_previousMenu , origin ) ;
2014-10-27 07:09:41 +00:00
break ;
default :
break ;
}
}
2016-11-01 01:35:32 +00:00
static void Menu_Run ( Menu_t * cm , const vec2_t origin )
2014-05-31 12:26:41 +00:00
{
2016-11-01 01:35:32 +00:00
Menu_Recurse ( cm - > menuID , origin ) ;
2014-10-27 07:09:41 +00:00
2014-05-31 12:26:41 +00:00
switch ( cm - > type )
{
case Verify :
2006-11-16 03:02:42 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuVerify_t * ) cm - > object ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_Pre ( cm - > menuID ) ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDrawBackground ( cm - > menuID , origin ) ;
2014-07-22 11:19:58 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDraw ( cm - > menuID , NULL , origin ) ;
2014-07-22 11:19:58 +00:00
2017-10-09 07:36:45 +00:00
Menu_DrawCursorLeft ( origin . x + object - > cursorpos . x , origin . y + object - > cursorpos . y , 65536 ) ;
2014-09-30 04:07:29 +00:00
2006-11-16 03:02:42 +00:00
break ;
}
2014-05-31 12:26:41 +00:00
case Message :
2006-11-16 03:02:42 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuMessage_t * ) cm - > object ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_Pre ( cm - > menuID ) ;
2014-07-22 11:19:58 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDrawBackground ( cm - > menuID , origin ) ;
2014-07-22 11:19:58 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDraw ( cm - > menuID , NULL , origin ) ;
2014-07-22 11:19:58 +00:00
2017-10-09 07:36:45 +00:00
Menu_DrawCursorLeft ( origin . x + object - > cursorpos . x , origin . y + object - > cursorpos . y , 65536 ) ;
2014-09-30 04:07:29 +00:00
2006-11-16 03:02:42 +00:00
break ;
}
2015-03-24 10:48:34 +00:00
case TextForm :
2006-11-16 03:02:42 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuTextForm_t * ) cm - > object ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_Pre ( cm - > menuID ) ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDrawBackground ( cm - > menuID , origin ) ;
2014-07-22 11:19:58 +00:00
2016-11-01 01:35:32 +00:00
Menu_BlackRectangle ( origin . x + ( 60 < < 16 ) , origin . y + ( 86 < < 16 ) , 200 < < 16 , 28 < < 16 , 0 ) ;
2006-04-13 20:47:06 +00:00
2017-06-20 09:28:54 +00:00
mgametextcenter ( origin . x , origin . y + ( 98 < < 16 ) , object - > instructions , TEXT_YBOTTOM ) ;
2006-04-13 20:47:06 +00:00
2015-03-24 10:48:34 +00:00
const char * displaytext = object - > input ;
if ( object - > flags & MTF_Password )
{
size_t x ;
for ( x = 0 ; x < Bstrlen ( object - > input ) ; + + x )
tempbuf [ x ] = ' * ' ;
tempbuf [ x ] = 0 ;
displaytext = tempbuf ;
}
2017-06-20 09:28:54 +00:00
const vec2_t textreturn = mgametextcenter ( origin . x , origin . y + ( 102 < < 16 ) , displaytext ) ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDraw ( cm - > menuID , NULL , origin ) ;
2006-04-13 20:47:06 +00:00
2017-10-09 07:36:45 +00:00
int32_t const h = MF_Bluefont . get_yline ( ) ;
2019-01-30 09:36:47 +00:00
Menu_DrawCursorText ( origin . x + ( MENU_MARGIN_CENTER < < 16 ) + ( ( textreturn . x > > 17 ) < < 16 ) + ( 1 < < 16 ) , origin . y + ( 102 < < 16 ) + ( ( h > > 17 ) < < 16 ) , h ) ;
2014-09-30 04:07:29 +00:00
2014-05-31 12:26:41 +00:00
break ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case FileSelect :
2006-11-16 03:02:42 +00:00
{
2019-11-02 00:30:21 +00:00
#if 0
2018-12-15 01:39:51 +00:00
auto object = ( MenuFileSelect_t * ) cm - > object ;
2014-12-27 18:35:48 +00:00
const int32_t MenuFileSelect_scrollbar_rightedge [ 2 ] = { 160 < < 16 , 284 < < 16 } ;
2014-12-27 18:37:27 +00:00
int32_t i , selected = 0 ;
2006-11-15 01:16:55 +00:00
2016-11-01 01:35:32 +00:00
Menu_Pre ( cm - > menuID ) ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDrawBackground ( cm - > menuID , origin ) ;
2014-07-22 11:19:58 +00:00
if ( object - > title ! = NoTitle )
2016-11-01 01:35:32 +00:00
Menu_DrawTopBar ( origin ) ;
2014-07-22 11:19:58 +00:00
2014-10-27 10:14:50 +00:00
2014-05-31 12:26:41 +00:00
// black translucent background underneath file lists
2016-11-01 01:35:32 +00:00
Menu_BlackRectangle ( origin . x + ( 36 < < 16 ) , origin . y + ( 42 < < 16 ) , 248 < < 16 , 123 < < 16 , 1 | 32 ) ;
2007-01-05 23:40:37 +00:00
2014-05-31 12:26:41 +00:00
// path
2014-12-27 18:35:48 +00:00
Bsnprintf ( tempbuf , sizeof ( tempbuf ) , " Path: %s " , object - > destination ) ;
2018-01-29 02:14:16 +00:00
mgametext ( origin . x + object - > format [ 0 ] - > pos . x , origin . y + ( 32 < < 16 ) , tempbuf ) ;
uint8_t column_status [ 2 ] = { 0 , MT_RightSide } ;
2006-04-13 20:47:06 +00:00
2014-06-13 09:04:31 +00:00
for ( i = 0 ; i < 2 ; + + i )
2014-05-31 12:26:41 +00:00
{
2014-06-13 09:04:31 +00:00
if ( object - > findhigh [ i ] )
2014-05-31 12:26:41 +00:00
{
2014-06-13 09:04:31 +00:00
CACHE1D_FIND_REC * dir ;
2015-01-13 12:56:54 +00:00
int32_t y = 0 ;
const int32_t y_upper = object - > format [ i ] - > pos . y ;
const int32_t y_lower = klabs ( object - > format [ i ] - > bottomcutoff ) ;
2016-04-06 03:07:47 +00:00
int32_t totalHeight = 0 ;
for ( dir = object - > findhigh [ i ] - > usera ; dir ; dir = dir - > next )
{
2017-06-19 23:06:29 +00:00
y + = object - > font [ i ] - > get_yline ( ) ;
2016-04-06 03:07:47 +00:00
totalHeight = y ;
2017-06-19 23:06:33 +00:00
y + = object - > getMarginBottom ( i ) ;
2016-04-06 03:07:47 +00:00
}
y = 0 ;
int32_t ydim_upper , ydim_lower ;
if ( y_upper + totalHeight > y_lower )
{
ydim_upper = ydim_from_200_16 ( origin . y + y_upper ) ;
ydim_lower = ydim_from_200_16 ( origin . y + y_lower ) ;
}
else
{
ydim_upper = 0 ;
ydim_lower = ydim - 1 ;
}
2014-06-13 09:04:31 +00:00
for ( dir = object - > findhigh [ i ] - > usera ; dir ; dir = dir - > next )
2014-05-31 12:26:41 +00:00
{
2018-01-29 02:14:16 +00:00
uint8_t status = column_status [ i ] ;
if ( dir = = object - > findhigh [ i ] & & object - > currentList = = i )
status | = MT_Selected ;
2014-06-13 09:04:31 +00:00
// pal = dir->source==CACHE1D_SOURCE_ZIP ? 8 : 2
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_Run_AbbreviateNameIntoBuffer ( dir - > name , USERMAPENTRYLENGTH ) ;
2006-04-13 20:47:06 +00:00
2014-12-27 18:37:27 +00:00
const int32_t thisx = object - > format [ i ] - > pos . x ;
const int32_t thisy = y - object - > scrollPos [ i ] ;
2017-07-10 13:44:07 +00:00
int32_t const height = object - > font [ i ] - > get_yline ( ) ;
if ( 0 < = thisy + height & & thisy < = klabs ( object - > format [ i ] - > bottomcutoff ) - object - > format [ i ] - > pos . y )
2014-12-27 18:37:27 +00:00
{
2017-07-10 13:44:07 +00:00
status | = MT_YCenter ;
2015-01-25 12:17:10 +00:00
const int32_t mousex = origin . x + thisx ;
2019-01-30 09:36:47 +00:00
const int32_t mousey = origin . y + y_upper + thisy + ( ( height > > 17 ) < < 16 ) ;
2015-01-13 12:56:54 +00:00
2016-11-01 01:35:32 +00:00
vec2_t textdim = Menu_Text ( mousex , mousey , object - > font [ i ] , tempbuf , status , ydim_upper , ydim_lower ) ;
2014-12-27 18:37:27 +00:00
2017-06-19 23:06:29 +00:00
if ( MOUSEACTIVECONDITIONAL ( cm = = m_currentMenu & & ! Menu_MouseOutsideBounds ( & m_mousepos , mousex , mousey , textdim . x , object - > font [ i ] - > get_yline ( ) ) ) )
2014-12-27 18:37:27 +00:00
{
2017-06-19 23:06:29 +00:00
if ( MOUSEWATCHPOINTCONDITIONAL ( Menu_MouseOutsideBounds ( & m_prevmousepos , mousex , mousey , textdim . x , object - > font [ i ] - > get_yline ( ) ) ) )
2014-12-27 18:37:27 +00:00
{
object - > findhigh [ i ] = dir ;
object - > currentList = i ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_MovementVerify ( object ) ;
2014-12-27 18:37:27 +00:00
}
2019-11-04 00:01:54 +00:00
if ( ! m_mousecaught & & inputState . mouseClickState ( ) = = MOUSE_RELEASED & & ! Menu_MouseOutsideBounds ( & m_mousedownpos , mousex , mousey , textdim . x , object - > font [ i ] - > get_yline ( ) ) )
2014-12-27 18:37:27 +00:00
{
object - > findhigh [ i ] = dir ;
object - > currentList = i ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_MovementVerify ( object ) ;
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
selected = 1 ;
}
}
}
2006-04-13 20:47:06 +00:00
2017-06-19 23:06:33 +00:00
y + = object - > font [ i ] - > get_yline ( ) + object - > getMarginBottom ( i ) ;
2014-06-13 09:04:31 +00:00
}
2014-12-27 18:35:48 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunScrollbar ( cm , object - > format [ i ] , y_upper + totalHeight , & object - > scrollPos [ i ] , MenuFileSelect_scrollbar_rightedge [ i ] , origin ) ;
2014-05-31 12:26:41 +00:00
}
}
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDraw ( cm - > menuID , NULL , origin ) ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
if ( object - > title ! = NoTitle )
2016-11-01 01:35:32 +00:00
Menu_DrawTopBarCaption ( object - > title , origin ) ;
2014-07-22 11:19:58 +00:00
2014-12-27 18:37:27 +00:00
if ( selected )
{
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_Select ( object ) ;
2014-12-27 18:37:27 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
m_mousecaught = 1 ;
}
2019-11-02 00:30:21 +00:00
# endif
2014-05-31 12:26:41 +00:00
break ;
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case Panel :
2006-11-16 03:02:42 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuPanel_t * ) cm - > object ;
2014-07-22 11:19:58 +00:00
2016-11-01 01:35:32 +00:00
Menu_Pre ( cm - > menuID ) ;
2014-07-22 11:19:58 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDrawBackground ( cm - > menuID , origin ) ;
2014-07-22 11:19:58 +00:00
if ( object - > title ! = NoTitle )
2016-11-01 01:35:32 +00:00
Menu_DrawTopBar ( origin ) ;
2014-07-22 11:19:58 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDraw ( cm - > menuID , NULL , origin ) ;
2014-07-22 11:19:58 +00:00
2014-05-31 12:26:41 +00:00
if ( object - > title ! = NoTitle )
2016-11-01 01:35:32 +00:00
Menu_DrawTopBarCaption ( object - > title , origin ) ;
2014-07-22 11:19:58 +00:00
2006-11-16 03:02:42 +00:00
break ;
}
2014-05-31 12:26:41 +00:00
case Menu :
2006-11-16 03:02:42 +00:00
{
2014-05-31 12:26:41 +00:00
int32_t state ;
2018-12-15 01:39:51 +00:00
auto menu = ( MenuMenu_t * ) cm - > object ;
2014-11-30 02:04:36 +00:00
MenuEntry_t * currentry = menu - > entrylist [ menu - > currentEntry ] ;
2014-05-31 12:26:41 +00:00
2016-11-01 01:35:32 +00:00
state = Menu_DetermineSpecialState ( currentry ) ;
2014-05-31 12:26:41 +00:00
if ( state ! = 2 )
2006-11-15 01:16:55 +00:00
{
2016-11-01 01:35:32 +00:00
Menu_Pre ( cm - > menuID ) ;
2014-07-22 11:19:58 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDrawBackground ( cm - > menuID , origin ) ;
2014-07-22 11:19:58 +00:00
if ( menu - > title ! = NoTitle )
2016-11-01 01:35:32 +00:00
Menu_DrawTopBar ( origin ) ;
2014-07-22 11:19:58 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreDraw ( cm - > menuID , currentry , origin ) ;
2014-05-31 12:26:41 +00:00
2016-11-01 01:35:32 +00:00
M_RunMenu_Menu ( cm , menu , currentry , state , origin ) ;
2006-11-16 03:02:42 +00:00
}
else
{
2016-11-01 01:35:32 +00:00
Menu_PreDrawBackground ( cm - > menuID , origin ) ;
2014-07-22 11:19:58 +00:00
if ( menu - > title ! = NoTitle )
2016-11-01 01:35:32 +00:00
Menu_DrawTopBar ( origin ) ;
2014-07-22 11:19:58 +00:00
2014-05-31 12:26:41 +00:00
if ( currentry - > type = = Option )
{
2014-09-30 04:14:35 +00:00
if ( currentry - > name )
2016-11-01 01:35:32 +00:00
Menu_DrawTopBarCaption ( currentry - > name , origin ) ;
2014-09-30 04:14:35 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreOptionListDraw ( currentry , origin ) ;
2014-05-31 12:26:41 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunOptionList ( cm , currentry , ( MenuOption_t * ) currentry - > entry , origin ) ;
2014-05-31 12:26:41 +00:00
}
else if ( currentry - > type = = Custom2Col )
{
2016-11-01 01:35:32 +00:00
Menu_PreCustom2ColScreenDraw ( currentry , origin ) ;
2014-05-31 12:26:41 +00:00
}
2006-04-13 20:47:06 +00:00
}
2014-05-31 12:26:41 +00:00
2014-09-30 04:14:35 +00:00
if ( ( currentry - > type ! = Option | | state ! = 2 ) & & menu - > title ! = NoTitle )
2016-11-01 01:35:32 +00:00
Menu_DrawTopBarCaption ( menu - > title , origin ) ;
2014-07-22 11:19:58 +00:00
2006-11-16 03:02:42 +00:00
break ;
}
2014-05-31 12:26:41 +00:00
}
2014-12-27 18:37:27 +00:00
2016-12-26 06:02:06 +00:00
# if !defined EDUKE32_TOUCH_DEVICES
2016-11-01 01:35:32 +00:00
Menu_Run_MouseReturn ( cm , origin ) ;
2016-12-26 06:02:06 +00:00
# endif
2014-05-31 12:26:41 +00:00
}
2006-04-13 20:47:06 +00:00
2014-11-30 02:04:36 +00:00
/*
Note : When menus are exposed to scripting , care will need to be taken so that
a user cannot define an empty MenuEntryList , or one containing only spacers ,
or else this function will recurse infinitely .
*/
2016-11-01 01:35:32 +00:00
static MenuEntry_t * Menu_RunInput_Menu_MovementVerify ( MenuMenu_t * menu )
2014-11-30 02:04:36 +00:00
{
2017-12-18 11:24:53 +00:00
return Menu_AdjustForCurrentEntryAssignment ( menu ) ;
2014-12-27 18:35:21 +00:00
}
2014-11-30 02:04:36 +00:00
2016-11-01 01:35:32 +00:00
static MenuEntry_t * Menu_RunInput_Menu_Movement ( MenuMenu_t * menu , MenuMovement_t direction )
2014-12-27 18:35:21 +00:00
{
2017-12-18 11:24:53 +00:00
if ( menu - > numEntries = = 1 )
return menu - > entrylist [ menu - > currentEntry ] ;
2014-11-30 02:04:36 +00:00
switch ( direction )
{
case MM_End :
menu - > currentEntry = menu - > numEntries ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-11-30 02:04:36 +00:00
case MM_Up :
do
{
- - menu - > currentEntry ;
if ( menu - > currentEntry < 0 )
2016-11-01 01:35:32 +00:00
return Menu_RunInput_Menu_Movement ( menu , MM_End ) ;
2014-11-30 02:04:36 +00:00
}
2018-02-20 11:55:07 +00:00
while ( ! menu - > entrylist [ menu - > currentEntry ] | |
( menu - > entrylist [ menu - > currentEntry ] - > flags & MEF_Hidden ) | |
menu - > entrylist [ menu - > currentEntry ] - > type = = Spacer ) ;
2014-11-30 02:04:36 +00:00
break ;
case MM_Home :
menu - > currentEntry = - 1 ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-11-30 02:04:36 +00:00
case MM_Down :
do
{
+ + menu - > currentEntry ;
if ( menu - > currentEntry > = menu - > numEntries )
2016-11-01 01:35:32 +00:00
return Menu_RunInput_Menu_Movement ( menu , MM_Home ) ;
2014-11-30 02:04:36 +00:00
}
2018-02-20 11:55:07 +00:00
while ( ! menu - > entrylist [ menu - > currentEntry ] | |
( menu - > entrylist [ menu - > currentEntry ] - > flags & MEF_Hidden ) | |
menu - > entrylist [ menu - > currentEntry ] - > type = = Spacer ) ;
2014-11-30 02:04:36 +00:00
break ;
2014-12-27 18:35:21 +00:00
case MM_Swap :
menu - > currentColumn = ! menu - > currentColumn ;
break ;
2014-11-30 02:04:36 +00:00
default :
break ;
}
2016-11-01 01:35:32 +00:00
return Menu_RunInput_Menu_MovementVerify ( menu ) ;
2014-12-27 18:35:21 +00:00
}
2014-11-30 02:04:36 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryLink_Activate ( MenuEntry_t * entry )
2014-12-27 18:35:21 +00:00
{
2018-12-15 01:39:51 +00:00
auto link = ( MenuLink_t * ) entry - > entry ;
2014-11-30 02:04:36 +00:00
2016-11-01 01:35:32 +00:00
Menu_EntryLinkActivate ( entry ) ;
2014-11-30 02:04:36 +00:00
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( link - > linkID , link - > animation ) ;
2014-11-30 02:04:36 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryOptionList_MovementVerify ( MenuOption_t * object )
2014-12-27 18:35:21 +00:00
{
const int32_t listytop = object - > options - > menuFormat - > pos . y ;
2017-06-19 23:06:29 +00:00
// assumes height == font->get_yline()!
2017-06-19 23:06:33 +00:00
const int32_t unitheight = object - > options - > getMarginBottom ( ) < 0 ? ( - object - > options - > getMarginBottom ( ) - object - > options - > font - > get_yline ( ) ) / object - > options - > numOptions : ( object - > options - > font - > get_yline ( ) + object - > options - > getMarginBottom ( ) ) ;
2014-12-27 18:35:21 +00:00
const int32_t ytop = listytop + object - > options - > currentEntry * unitheight ;
2017-06-19 23:06:29 +00:00
const int32_t ybottom = ytop + object - > options - > font - > get_yline ( ) ;
2014-12-27 18:35:21 +00:00
if ( ybottom - object - > options - > scrollPos > object - > options - > menuFormat - > bottomcutoff )
object - > options - > scrollPos = ybottom - object - > options - > menuFormat - > bottomcutoff ;
else if ( ytop - object - > options - > scrollPos < listytop )
object - > options - > scrollPos = ytop - listytop ;
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryOptionList_Movement ( MenuOption_t * object , MenuMovement_t direction )
2014-11-30 02:04:36 +00:00
{
switch ( direction )
{
case MM_Up :
- - object - > options - > currentEntry ;
if ( object - > options - > currentEntry > = 0 )
break ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-11-30 02:04:36 +00:00
case MM_End :
object - > options - > currentEntry = object - > options - > numOptions - 1 ;
break ;
case MM_Down :
+ + object - > options - > currentEntry ;
if ( object - > options - > currentEntry < object - > options - > numOptions )
break ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-11-30 02:04:36 +00:00
case MM_Home :
object - > options - > currentEntry = 0 ;
break ;
default :
break ;
}
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryOptionList_MovementVerify ( object ) ;
2014-12-27 18:35:21 +00:00
}
2016-11-01 01:35:32 +00:00
static int32_t Menu_RunInput_EntryOption_Modify ( MenuEntry_t * entry , MenuOption_t * object , int32_t newValueIndex )
2014-12-27 18:35:21 +00:00
{
int32_t newValue = ( object - > options - > optionValues = = NULL ) ? newValueIndex : object - > options - > optionValues [ newValueIndex ] ;
2016-11-01 01:35:32 +00:00
if ( ! Menu_EntryOptionModify ( entry , newValue ) )
2014-12-27 18:35:21 +00:00
{
object - > currentOption = newValueIndex ;
2019-11-09 18:15:03 +00:00
if ( object - > cVar ! = NULL ) // NULL implies the functions will handle it
{
UCVarValue v ;
v . Int = newValue ;
object - > cVar - > ForceSet ( v , CVAR_Int , false ) ;
}
2016-11-01 01:35:32 +00:00
Menu_EntryOptionDidModify ( entry ) ;
2014-12-27 18:35:21 +00:00
return 0 ;
}
return - 1 ;
}
2016-11-01 01:35:32 +00:00
static int32_t Menu_RunInput_EntryOption_Movement ( MenuEntry_t * entry , MenuOption_t * object , MenuMovement_t direction )
2014-12-27 18:35:21 +00:00
{
int32_t newValueIndex = object - > currentOption ;
switch ( direction )
{
case MM_Left :
- - newValueIndex ;
if ( newValueIndex > = 0 )
break ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-12-27 18:35:21 +00:00
case MM_AllTheWayRight :
newValueIndex = object - > options - > numOptions - 1 ;
break ;
case MM_Right :
+ + newValueIndex ;
if ( newValueIndex < object - > options - > numOptions )
break ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-12-27 18:35:21 +00:00
case MM_AllTheWayLeft :
newValueIndex = 0 ;
break ;
default :
break ;
}
2016-11-01 01:35:32 +00:00
return Menu_RunInput_EntryOption_Modify ( entry , object , newValueIndex ) ;
2014-12-27 18:35:21 +00:00
}
2016-11-01 01:35:32 +00:00
static int32_t Menu_RunInput_EntryOption_Activate ( MenuEntry_t * entry , MenuOption_t * object )
2014-12-27 18:35:21 +00:00
{
if ( object - > options - > features & 2 )
2016-11-01 01:35:32 +00:00
return Menu_RunInput_EntryOption_Movement ( entry , object , MM_Right ) ;
2014-12-27 18:35:21 +00:00
else
{
2014-12-28 21:35:32 +00:00
object - > options - > currentEntry = object - > currentOption > = 0 ? object - > currentOption : 0 ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryOptionList_MovementVerify ( object ) ;
2014-12-27 18:35:21 +00:00
return 0 ;
}
}
2016-11-01 01:35:32 +00:00
static int32_t Menu_RunInput_EntryOptionList_Activate ( MenuEntry_t * entry , MenuOption_t * object )
2014-12-27 18:35:21 +00:00
{
2016-11-01 01:35:32 +00:00
if ( ! Menu_RunInput_EntryOption_Modify ( entry , object , object - > options - > currentEntry ) )
2014-12-27 18:35:21 +00:00
{
object - > options - > currentEntry = - 1 ;
return 0 ;
}
return - 1 ;
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryCustom2Col_Activate ( MenuEntry_t * entry )
2014-12-27 18:35:21 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuCustom2Col_t * ) entry - > entry ;
2014-12-27 18:35:21 +00:00
2016-11-01 01:35:32 +00:00
Menu_Custom2ColScreen ( /*entry*/ ) ;
2014-12-27 18:35:21 +00:00
object - > screenOpen = 1 ;
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryRangeInt32_MovementVerify ( MenuEntry_t * entry , MenuRangeInt32_t * object , int32_t newValue )
2014-12-27 18:35:21 +00:00
{
2016-11-01 01:35:32 +00:00
if ( ! Menu_EntryRangeInt32Modify ( entry , newValue ) )
2019-11-09 18:15:03 +00:00
* object - > cVar = newValue ;
2014-12-27 18:35:21 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryRangeInt32_MovementArbitrary ( MenuEntry_t * entry , MenuRangeInt32_t * object , int32_t newValue )
2014-12-28 21:35:20 +00:00
{
if ( object - > flags & EnforceIntervals )
{
2017-07-29 20:39:53 +00:00
int32_t const range = object - > max - object - > min ;
int32_t const maxInterval = object - > steps - 1 ;
int32_t const newValueIndex = roundscale ( newValue - object - > min , maxInterval , range ) ;
2017-08-01 09:48:52 +00:00
newValue = newValueIndex * range / maxInterval + object - > min ;
2014-12-28 21:35:20 +00:00
}
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryRangeInt32_MovementVerify ( entry , object , newValue ) ;
2014-12-28 21:35:20 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryRangeInt32_Movement ( MenuEntry_t * entry , MenuRangeInt32_t * object , MenuMovement_t direction )
2014-12-27 18:35:21 +00:00
{
2019-11-09 18:15:03 +00:00
int32_t const oldValue = * object - > cVar ;
2017-07-29 20:39:53 +00:00
int32_t const range = object - > max - object - > min ;
int32_t const maxInterval = object - > steps - 1 ;
2018-07-23 02:56:02 +00:00
int32_t const oldValueIndex = roundscale ( oldValue - object - > min , maxInterval , range ) ;
int32_t const oldValueQuantized = oldValueIndex * range / maxInterval + object - > min ;
int32_t newValueIndex = oldValueIndex ;
2014-12-27 18:35:21 +00:00
switch ( direction )
2014-11-30 02:04:36 +00:00
{
2014-12-27 18:35:21 +00:00
case MM_Left :
2018-07-23 02:56:02 +00:00
if ( oldValueQuantized > = oldValue )
2014-12-28 21:35:07 +00:00
- - newValueIndex ;
2014-12-27 18:35:21 +00:00
if ( newValueIndex > = 0 )
break ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-12-27 18:35:21 +00:00
case MM_AllTheWayLeft :
newValueIndex = 0 ;
break ;
case MM_Right :
2018-07-23 02:56:02 +00:00
if ( oldValueQuantized < = oldValue )
2014-12-28 21:35:07 +00:00
+ + newValueIndex ;
2017-07-29 20:39:53 +00:00
if ( newValueIndex < = maxInterval )
2014-12-27 18:35:21 +00:00
break ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-12-27 18:35:21 +00:00
case MM_AllTheWayRight :
2017-07-29 20:39:53 +00:00
newValueIndex = maxInterval ;
2014-12-27 18:35:21 +00:00
break ;
default :
break ;
}
2017-08-01 09:48:52 +00:00
int32_t const newValue = newValueIndex * range / maxInterval + object - > min ;
2017-07-29 20:39:53 +00:00
Menu_RunInput_EntryRangeInt32_MovementVerify ( entry , object , newValue ) ;
2014-12-27 18:35:21 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryRangeFloat_MovementVerify ( MenuEntry_t * entry , MenuRangeFloat_t * object , float newValue )
2014-12-27 18:35:21 +00:00
{
2016-11-01 01:35:32 +00:00
if ( ! Menu_EntryRangeFloatModify ( entry , newValue ) )
2014-12-27 18:35:21 +00:00
{
2019-11-09 18:15:03 +00:00
* object - > cVar = newValue ;
2016-11-01 01:35:32 +00:00
Menu_EntryRangeFloatDidModify ( entry ) ;
2014-12-27 18:35:21 +00:00
}
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryRangeFloat_MovementArbitrary ( MenuEntry_t * entry , MenuRangeFloat_t * object , float newValue )
2014-12-28 21:35:20 +00:00
{
if ( object - > flags & EnforceIntervals )
{
2017-07-29 20:39:53 +00:00
float const range = object - > max - object - > min ;
2017-07-31 01:53:16 +00:00
float const maxInterval = ( float ) ( object - > steps - 1 ) ;
2017-07-29 20:39:53 +00:00
float const newValueIndex = rintf ( ( newValue - object - > min ) * maxInterval / range ) ;
newValue = newValueIndex * range / maxInterval + object - > min ;
2014-12-28 21:35:20 +00:00
}
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryRangeFloat_MovementVerify ( entry , object , newValue ) ;
2014-12-28 21:35:20 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryRangeFloat_Movement ( MenuEntry_t * entry , MenuRangeFloat_t * object , MenuMovement_t direction )
2014-12-27 18:35:21 +00:00
{
2019-11-09 18:15:03 +00:00
float const oldValue = * object - > cVar ;
2017-07-29 20:39:53 +00:00
float const range = object - > max - object - > min ;
2017-07-31 01:53:16 +00:00
float const maxInterval = ( float ) ( object - > steps - 1 ) ;
2018-07-23 02:56:02 +00:00
float const oldValueIndexUnrounded = ( oldValue - object - > min ) * maxInterval / range ;
float const oldValueIndex = rintf ( oldValueIndexUnrounded ) ;
float const oldValueQuantized = oldValueIndex * range / maxInterval + object - > min ;
float newValueIndex = oldValueIndex ;
2014-12-27 18:35:21 +00:00
switch ( direction )
{
case MM_Left :
2018-07-23 02:56:02 +00:00
if ( oldValueQuantized > = oldValue )
2017-07-29 20:39:53 +00:00
newValueIndex - = 1.f ;
if ( newValueIndex > = 0.f )
2014-12-27 18:35:21 +00:00
break ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-12-27 18:35:21 +00:00
case MM_AllTheWayLeft :
2017-07-29 20:39:53 +00:00
newValueIndex = 0.f ;
2014-12-27 18:35:21 +00:00
break ;
case MM_Right :
2018-07-23 02:56:02 +00:00
if ( oldValueQuantized < = oldValue )
2017-07-29 20:39:53 +00:00
newValueIndex + = 1.f ;
if ( newValueIndex < = maxInterval )
2014-12-27 18:35:21 +00:00
break ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-12-27 18:35:21 +00:00
case MM_AllTheWayRight :
2017-07-29 20:39:53 +00:00
newValueIndex = maxInterval ;
2014-12-27 18:35:21 +00:00
break ;
default :
break ;
}
2017-07-29 20:39:53 +00:00
float const newValue = newValueIndex * range / maxInterval + object - > min ;
Menu_RunInput_EntryRangeFloat_MovementVerify ( entry , object , newValue ) ;
2014-12-27 18:35:21 +00:00
}
2017-07-29 20:39:57 +00:00
# ifdef MENU_ENABLE_RANGEDOUBLE
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryRangeDouble_MovementVerify ( /*MenuEntry_t *entry, */ MenuRangeDouble_t * object , double newValue )
2014-12-27 18:35:21 +00:00
{
2016-11-01 01:35:32 +00:00
if ( ! Menu_EntryRangeDoubleModify ( /*entry, newValue*/ ) )
2014-12-27 18:35:21 +00:00
* object - > variable = newValue ;
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryRangeDouble_MovementArbitrary ( /*MenuEntry_t *entry, */ MenuRangeDouble_t * object , double newValue )
2014-12-28 21:35:20 +00:00
{
if ( object - > flags & EnforceIntervals )
{
2017-07-29 20:39:53 +00:00
double const range = object - > max - object - > min ;
double const maxInterval = object - > steps - 1 ;
double const newValueIndex = rint ( ( newValue - object - > min ) * maxInterval / range ) ;
newValue = newValueIndex * range / maxInterval + object - > min ;
2014-12-28 21:35:20 +00:00
}
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryRangeDouble_MovementVerify ( /*entry, */ object , newValue ) ;
2014-12-28 21:35:20 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryRangeDouble_Movement ( /*MenuEntry_t *entry, */ MenuRangeDouble_t * object , MenuMovement_t direction )
2014-12-27 18:35:21 +00:00
{
2017-07-29 20:39:53 +00:00
double const oldValue = * object - > variable ;
double const range = object - > max - object - > min ;
double const maxInterval = object - > steps - 1 ;
2018-07-23 02:56:02 +00:00
double const oldValueIndex = rint ( ( oldValue - object - > min ) * maxInterval / range ) ;
double const oldValueQuantized = oldValueIndex * range / maxInterval + object - > min ;
double newValueIndex = oldValueIndex ;
2014-12-27 18:35:21 +00:00
switch ( direction )
{
case MM_Left :
2018-07-23 02:56:02 +00:00
if ( oldValueQuantized > = oldValue )
2017-07-29 20:39:53 +00:00
newValueIndex - = 1. ;
if ( newValueIndex > = 0. )
2014-12-27 18:35:21 +00:00
break ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-12-27 18:35:21 +00:00
case MM_AllTheWayLeft :
2017-07-29 20:39:53 +00:00
newValueIndex = 0. ;
2014-12-27 18:35:21 +00:00
break ;
case MM_Right :
2018-07-23 02:56:02 +00:00
if ( oldValueQuantized < = oldValue )
2017-07-29 20:39:53 +00:00
newValueIndex + = 1. ;
if ( newValueIndex < = maxInterval )
2014-12-27 18:35:21 +00:00
break ;
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-12-27 18:35:21 +00:00
case MM_AllTheWayRight :
2017-07-29 20:39:53 +00:00
newValueIndex = maxInterval ;
2014-12-27 18:35:21 +00:00
break ;
default :
break ;
}
2017-07-29 20:39:53 +00:00
double const newValue = newValueIndex * range / maxInterval + object - > min ;
Menu_RunInput_EntryRangeDouble_MovementVerify ( /*entry, */ object , newValue ) ;
2014-12-27 18:35:21 +00:00
}
2017-07-29 20:39:57 +00:00
# endif
2014-12-27 18:35:21 +00:00
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryString_Activate ( MenuEntry_t * entry )
2014-12-27 18:35:21 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuString_t * ) entry - > entry ;
2014-12-27 18:35:21 +00:00
2017-12-18 11:24:53 +00:00
if ( object - > variable )
strncpy ( typebuf , object - > variable , TYPEBUFSIZE ) ;
else
typebuf [ 0 ] = ' \0 ' ;
2014-12-27 18:35:21 +00:00
object - > editfield = typebuf ;
// this limitation is an arbitrary implementation detail
2017-12-01 06:19:12 +00:00
if ( object - > bufsize > TYPEBUFSIZE )
object - > bufsize = TYPEBUFSIZE ;
2014-12-27 18:35:21 +00:00
2016-11-01 01:35:32 +00:00
Menu_EntryStringActivate ( /*entry*/ ) ;
2018-02-16 08:33:32 +00:00
Menu_StartTextInput ( ) ;
2014-12-27 18:35:21 +00:00
}
2017-12-18 11:24:53 +00:00
static void Menu_RunInput_EntryString_Submit ( /*MenuEntry_t *entry, */ MenuString_t * object )
2014-12-27 18:35:21 +00:00
{
2017-12-18 11:24:53 +00:00
if ( ! Menu_EntryStringSubmit ( /*entry, */ object - > editfield ) )
{
if ( object - > variable )
strncpy ( object - > variable , object - > editfield , object - > bufsize ) ;
}
2014-12-27 18:35:21 +00:00
object - > editfield = NULL ;
2018-02-16 08:33:32 +00:00
Menu_StopTextInput ( ) ;
2014-12-27 18:35:21 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_EntryString_Cancel ( /*MenuEntry_t *entry, */ MenuString_t * object )
2014-12-27 18:35:21 +00:00
{
2016-11-01 01:35:32 +00:00
Menu_EntryStringCancel ( /*entry*/ ) ;
2014-12-27 18:35:21 +00:00
object - > editfield = NULL ;
2018-02-16 08:33:32 +00:00
Menu_StopTextInput ( ) ;
2014-12-27 18:35:21 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_FileSelect_MovementVerify ( MenuFileSelect_t * object )
2014-12-27 18:35:21 +00:00
{
2019-11-02 00:30:21 +00:00
#if 0
2014-12-27 18:35:48 +00:00
const int32_t listytop = object - > format [ object - > currentList ] - > pos . y ;
const int32_t listybottom = klabs ( object - > format [ object - > currentList ] - > bottomcutoff ) ;
2017-06-19 23:06:33 +00:00
const int32_t ytop = listytop + object - > findhigh [ object - > currentList ] - > type * ( object - > font [ object - > currentList ] - > get_yline ( ) + object - > getMarginBottom ( object - > currentList ) ) ;
2017-06-19 23:06:29 +00:00
const int32_t ybottom = ytop + object - > font [ object - > currentList ] - > get_yline ( ) ;
2014-12-27 18:35:48 +00:00
if ( ybottom - object - > scrollPos [ object - > currentList ] > listybottom )
object - > scrollPos [ object - > currentList ] = ybottom - listybottom ;
else if ( ytop - object - > scrollPos [ object - > currentList ] < listytop )
object - > scrollPos [ object - > currentList ] = ytop - listytop ;
2019-11-02 00:30:21 +00:00
# endif
2014-12-27 18:35:21 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_FileSelect_Movement ( MenuFileSelect_t * object , MenuMovement_t direction )
2014-12-27 18:35:21 +00:00
{
2019-11-02 00:30:21 +00:00
#if 0
2014-12-27 18:35:21 +00:00
switch ( direction )
{
case MM_Up :
if ( ! object - > findhigh [ object - > currentList ] )
break ;
if ( object - > findhigh [ object - > currentList ] - > prev )
{
object - > findhigh [ object - > currentList ] = object - > findhigh [ object - > currentList ] - > prev ;
break ;
}
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-12-27 18:35:21 +00:00
case MM_End :
object - > findhigh [ object - > currentList ] = object - > findhigh [ object - > currentList ] - > userb ;
break ;
case MM_Down :
if ( ! object - > findhigh [ object - > currentList ] )
break ;
if ( object - > findhigh [ object - > currentList ] - > next )
{
object - > findhigh [ object - > currentList ] = object - > findhigh [ object - > currentList ] - > next ;
break ;
}
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2014-12-27 18:35:21 +00:00
case MM_Home :
object - > findhigh [ object - > currentList ] = object - > findhigh [ object - > currentList ] - > usera ;
break ;
case MM_Swap :
object - > currentList = ! object - > currentList ;
break ;
default :
break ;
}
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_MovementVerify ( object ) ;
2019-11-02 00:30:21 +00:00
# endif
2014-12-27 18:35:21 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput_FileSelect_Select ( MenuFileSelect_t * object )
2014-12-27 18:35:21 +00:00
{
2019-11-02 00:30:21 +00:00
#if 0
2014-12-27 18:35:21 +00:00
if ( ! object - > findhigh [ object - > currentList ] )
return ;
Bstrcat ( object - > destination , object - > findhigh [ object - > currentList ] - > name ) ;
if ( object - > currentList = = 0 )
{
Bstrcat ( object - > destination , " / " ) ;
Bcorrectfilename ( object - > destination , 1 ) ;
2016-11-01 01:35:32 +00:00
Menu_FileSelectInit ( object ) ;
2014-12-27 18:35:21 +00:00
}
else
{
2016-11-01 01:35:32 +00:00
Menu_FileSelect ( 1 ) ;
2019-11-02 00:30:21 +00:00
}
# endif
2014-11-30 02:04:36 +00:00
}
2016-11-01 01:35:32 +00:00
static void Menu_RunInput ( Menu_t * cm )
2014-05-31 12:26:41 +00:00
{
switch ( cm - > type )
{
case Panel :
2006-11-16 03:02:42 +00:00
{
2018-12-15 01:39:51 +00:00
auto panel = ( MenuPanel_t * ) cm - > object ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
if ( I_ReturnTrigger ( ) | | Menu_RunInput_MouseReturn ( ) )
2006-11-16 03:02:42 +00:00
{
2014-05-31 12:26:41 +00:00
I_ReturnTriggerClear ( ) ;
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2014-05-31 12:26:41 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( cm - > parentID , cm - > parentAnimation ) ;
2006-11-16 03:02:42 +00:00
}
2014-05-31 12:26:41 +00:00
else if ( I_PanelUp ( ) )
2006-11-16 03:02:42 +00:00
{
2014-05-31 12:26:41 +00:00
I_PanelUpClear ( ) ;
2006-11-15 01:16:55 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( panel - > previousID , panel - > previousAnimation ) ;
2014-05-31 12:26:41 +00:00
}
2016-11-01 01:35:32 +00:00
else if ( I_PanelDown ( ) | | Menu_RunInput_MouseAdvance ( ) )
2006-11-16 03:02:42 +00:00
{
2014-05-31 12:26:41 +00:00
I_PanelDownClear ( ) ;
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( panel - > nextID , panel - > nextAnimation ) ;
2006-11-16 03:02:42 +00:00
}
2014-11-17 08:14:33 +00:00
break ;
2006-11-16 03:02:42 +00:00
}
2015-03-24 10:48:34 +00:00
case TextForm :
2014-05-31 12:26:41 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuTextForm_t * ) cm - > object ;
2017-12-01 06:19:12 +00:00
int32_t hitstate = I_EnterText ( object - > input , object - > bufsize - 1 , 0 ) ;
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
if ( hitstate = = - 1 | | Menu_RunInput_MouseReturn ( ) )
2014-05-31 12:26:41 +00:00
{
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2006-04-13 20:47:06 +00:00
2014-12-27 18:37:27 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2014-05-31 12:26:41 +00:00
object - > input = NULL ;
2014-12-27 18:37:27 +00:00
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( cm - > parentID , cm - > parentAnimation ) ;
2018-02-16 08:33:32 +00:00
Menu_StopTextInput ( ) ;
2014-05-31 12:26:41 +00:00
}
2016-11-01 01:35:32 +00:00
else if ( hitstate = = 1 | | Menu_RunInput_MouseAdvance ( ) )
2014-05-31 12:26:41 +00:00
{
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_TextFormSubmit ( object - > input ) ;
2014-12-27 18:37:27 +00:00
object - > input = NULL ;
2018-02-16 08:33:32 +00:00
Menu_StopTextInput ( ) ;
2014-05-31 12:26:41 +00:00
}
2008-05-15 03:16:38 +00:00
break ;
}
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
case FileSelect :
2008-05-15 03:16:38 +00:00
{
2019-11-02 00:30:21 +00:00
#if 0
2018-12-15 01:39:51 +00:00
auto object = ( MenuFileSelect_t * ) cm - > object ;
2014-05-31 12:26:41 +00:00
2016-11-01 01:35:32 +00:00
if ( I_ReturnTrigger ( ) | | Menu_RunInput_MouseReturn ( ) )
2006-11-15 01:16:55 +00:00
{
2014-05-31 12:26:41 +00:00
I_ReturnTriggerClear ( ) ;
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
object - > destination [ 0 ] = 0 ;
2008-05-15 03:16:38 +00:00
2016-11-01 01:35:32 +00:00
Menu_FileSelect ( 0 ) ;
2012-10-14 22:16:07 +00:00
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( cm - > parentID , MA_Return ) ;
2012-10-14 22:16:07 +00:00
}
2014-05-31 12:26:41 +00:00
else if ( I_AdvanceTrigger ( ) )
{
I_AdvanceTriggerClear ( ) ;
2012-10-14 22:16:07 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_Select ( object ) ;
2008-05-15 03:16:38 +00:00
2014-12-27 18:35:21 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2014-05-31 12:26:41 +00:00
}
2019-11-03 23:53:55 +00:00
else if ( inputState . GetKeyStatus ( sc_Home ) )
2006-11-15 01:16:55 +00:00
{
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_Home ) ;
2014-06-13 09:04:31 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_Movement ( object , MM_Home ) ;
2014-12-27 18:35:21 +00:00
2014-06-13 09:04:31 +00:00
S_PlaySound ( KICK_HIT ) ;
}
2019-11-03 23:53:55 +00:00
else if ( inputState . GetKeyStatus ( sc_End ) )
2014-06-13 09:04:31 +00:00
{
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_End ) ;
2014-06-13 09:04:31 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_Movement ( object , MM_End ) ;
2014-12-27 18:35:21 +00:00
2014-06-13 09:04:31 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-11-15 01:16:55 +00:00
}
2019-11-03 23:53:55 +00:00
else if ( inputState . GetKeyStatus ( sc_PgUp ) )
2006-11-15 01:16:55 +00:00
{
2014-06-16 23:15:49 +00:00
int32_t i ;
2014-06-13 09:04:31 +00:00
CACHE1D_FIND_REC * seeker = object - > findhigh [ object - > currentList ] ;
2014-06-16 23:15:49 +00:00
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_PgUp ) ;
2014-12-27 18:35:21 +00:00
2014-06-16 23:15:49 +00:00
for ( i = 0 ; i < 6 ; + + i )
2014-05-31 12:26:41 +00:00
{
2014-06-16 23:15:49 +00:00
if ( seeker & & seeker - > prev )
seeker = seeker - > prev ;
2014-05-31 12:26:41 +00:00
}
2014-06-16 23:15:49 +00:00
2014-05-31 12:26:41 +00:00
if ( seeker )
{
2014-06-13 09:04:31 +00:00
object - > findhigh [ object - > currentList ] = seeker ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_MovementVerify ( object ) ;
2014-06-13 09:04:31 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
}
2006-04-13 20:47:06 +00:00
}
2019-11-03 23:53:55 +00:00
else if ( inputState . GetKeyStatus ( sc_PgDn ) )
2014-05-31 12:26:41 +00:00
{
2014-06-16 23:15:49 +00:00
int32_t i ;
CACHE1D_FIND_REC * seeker = object - > findhigh [ object - > currentList ] ;
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_PgDn ) ;
2014-12-27 18:35:21 +00:00
2014-06-16 23:15:49 +00:00
for ( i = 0 ; i < 6 ; + + i )
{
if ( seeker & & seeker - > next )
seeker = seeker - > next ;
}
if ( seeker )
{
object - > findhigh [ object - > currentList ] = seeker ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_MovementVerify ( object ) ;
2014-06-16 23:15:49 +00:00
S_PlaySound ( KICK_HIT ) ;
}
}
else if ( I_MenuLeft ( ) | | I_MenuRight ( ) )
{
I_MenuLeftClear ( ) ;
I_MenuRightClear ( ) ;
2014-06-13 09:04:31 +00:00
if ( ( object - > currentList ? object - > fnlist . numdirs : object - > fnlist . numfiles ) > 0 )
{
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_Movement ( object , MM_Swap ) ;
2014-06-13 09:04:31 +00:00
S_PlaySound ( KICK_HIT ) ;
}
2014-05-31 12:26:41 +00:00
}
2014-06-16 23:15:49 +00:00
else if ( I_MenuUp ( ) )
2014-05-31 12:26:41 +00:00
{
2014-06-16 23:15:49 +00:00
I_MenuUpClear ( ) ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_Movement ( object , MM_Up ) ;
2006-04-13 20:47:06 +00:00
2014-12-27 18:35:21 +00:00
S_PlaySound ( KICK_HIT ) ;
2014-05-31 12:26:41 +00:00
}
2014-06-16 23:15:49 +00:00
else if ( I_MenuDown ( ) )
2014-05-31 12:26:41 +00:00
{
2014-06-16 23:15:49 +00:00
I_MenuDownClear ( ) ;
2006-11-15 01:16:55 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_Movement ( object , MM_Down ) ;
2006-11-15 01:16:55 +00:00
2014-12-27 18:35:21 +00:00
S_PlaySound ( KICK_HIT ) ;
2014-05-31 12:26:41 +00:00
}
else
2006-11-16 03:02:42 +00:00
{
2014-06-13 09:04:31 +00:00
// JBF 20040208: seek to first name matching pressed character
2014-05-31 12:26:41 +00:00
char ch2 , ch ;
2019-11-03 23:53:55 +00:00
ch = inputState . keyGetChar ( ) ;
2014-05-31 12:26:41 +00:00
if ( ch > 0 & & ( ( ch > = ' a ' & & ch < = ' z ' ) | | ( ch > = ' A ' & & ch < = ' Z ' ) | | ( ch > = ' 0 ' & & ch < = ' 9 ' ) ) )
2006-11-15 01:16:55 +00:00
{
2014-06-13 09:04:31 +00:00
CACHE1D_FIND_REC * seeker = object - > findhigh [ object - > currentList ] - > usera ;
if ( ch > = ' a ' )
ch - = ( ' a ' - ' A ' ) ;
2014-05-31 12:26:41 +00:00
while ( seeker )
{
ch2 = seeker - > name [ 0 ] ;
2014-06-13 09:04:31 +00:00
if ( ch2 > = ' a ' & & ch2 < = ' z ' )
ch2 - = ( ' a ' - ' A ' ) ;
if ( ch2 = = ch )
break ;
2014-05-31 12:26:41 +00:00
seeker = seeker - > next ;
}
if ( seeker )
{
2014-06-13 09:04:31 +00:00
object - > findhigh [ object - > currentList ] = seeker ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_FileSelect_MovementVerify ( object ) ;
2014-12-27 18:35:21 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
}
2006-11-16 03:02:42 +00:00
}
}
2019-11-02 00:30:21 +00:00
# endif
2016-11-01 01:35:32 +00:00
Menu_PreInput ( NULL ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case Message :
2016-11-01 01:35:32 +00:00
if ( I_ReturnTrigger ( ) | | Menu_RunInput_MouseReturn ( ) )
2014-05-31 12:26:41 +00:00
{
I_ReturnTriggerClear ( ) ;
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( cm - > parentID , cm - > parentAnimation ) ;
2014-05-31 12:26:41 +00:00
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
if ( I_CheckAllInput ( ) )
{
2018-12-15 01:39:51 +00:00
auto message = ( MenuMessage_t * ) cm - > object ;
2014-10-27 10:14:50 +00:00
2014-05-31 12:26:41 +00:00
I_ClearAllInput ( ) ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2006-11-15 01:16:55 +00:00
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( message - > linkID , message - > animation ) ;
2014-05-31 12:26:41 +00:00
}
2006-11-15 01:16:55 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreInput ( NULL ) ;
2014-05-31 12:26:41 +00:00
break ;
2006-11-15 01:16:55 +00:00
2014-05-31 12:26:41 +00:00
case Verify :
2019-11-03 23:53:55 +00:00
if ( I_ReturnTrigger ( ) | | inputState . GetKeyStatus ( sc_N ) | | Menu_RunInput_MouseReturn ( ) )
2014-05-31 12:26:41 +00:00
{
I_ReturnTriggerClear ( ) ;
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_N ) ;
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
Menu_Verify ( 0 ) ;
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( cm - > parentID , cm - > parentAnimation ) ;
2014-10-27 10:14:50 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2014-05-31 12:26:41 +00:00
}
2006-11-15 01:16:55 +00:00
2019-11-03 23:53:55 +00:00
if ( I_AdvanceTrigger ( ) | | inputState . GetKeyStatus ( sc_Y ) | | Menu_RunInput_MouseAdvance ( ) )
2014-05-31 12:26:41 +00:00
{
2018-12-15 01:39:51 +00:00
auto verify = ( MenuVerify_t * ) cm - > object ;
2014-10-27 10:14:50 +00:00
2014-05-31 12:26:41 +00:00
I_AdvanceTriggerClear ( ) ;
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_Y ) ;
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2008-07-28 21:23:10 +00:00
2016-11-01 01:35:32 +00:00
Menu_Verify ( 1 ) ;
2006-11-15 01:16:55 +00:00
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( verify - > linkID , verify - > animation ) ;
2014-10-27 10:14:50 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2014-05-31 12:26:41 +00:00
}
2008-08-06 11:50:34 +00:00
2016-11-01 01:35:32 +00:00
Menu_PreInput ( NULL ) ;
2014-05-31 12:26:41 +00:00
break ;
case Menu :
2006-11-16 03:02:42 +00:00
{
2014-11-30 02:04:36 +00:00
int32_t state ;
2006-11-15 01:16:55 +00:00
2018-12-15 01:39:51 +00:00
auto menu = ( MenuMenu_t * ) cm - > object ;
2014-11-30 02:04:36 +00:00
MenuEntry_t * currentry = menu - > entrylist [ menu - > currentEntry ] ;
2008-07-28 21:23:10 +00:00
2016-11-01 01:35:32 +00:00
state = Menu_DetermineSpecialState ( currentry ) ;
2008-07-28 21:23:10 +00:00
2014-05-31 12:26:41 +00:00
if ( state = = 0 )
2006-11-15 01:16:55 +00:00
{
2014-05-31 12:26:41 +00:00
if ( currentry ! = NULL )
switch ( currentry - > type )
2006-11-16 03:02:42 +00:00
{
2014-05-31 12:26:41 +00:00
case Dummy :
2014-11-30 02:04:36 +00:00
case Spacer :
2014-05-31 12:26:41 +00:00
break ;
case Link :
2017-06-19 23:07:01 +00:00
if ( currentry - > flags & MEF_Disabled )
2014-05-31 12:26:41 +00:00
break ;
if ( I_AdvanceTrigger ( ) )
{
I_AdvanceTriggerClear ( ) ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryLink_Activate ( currentry ) ;
2006-11-15 01:16:55 +00:00
2014-12-27 18:35:21 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_MENU ) // for skill selection
2014-05-31 12:26:41 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
}
break ;
case Option :
2008-07-28 21:23:10 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuOption_t * ) currentry - > entry ;
2014-05-31 12:26:41 +00:00
2017-06-19 23:07:01 +00:00
if ( currentry - > flags & MEF_Disabled )
2014-05-31 12:26:41 +00:00
break ;
if ( I_AdvanceTrigger ( ) )
2008-07-28 21:23:10 +00:00
{
2014-05-31 12:26:41 +00:00
I_AdvanceTriggerClear ( ) ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryOption_Activate ( currentry , object ) ;
2014-05-31 12:26:41 +00:00
2014-12-27 18:35:21 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2008-07-28 21:23:10 +00:00
}
2014-06-16 23:15:49 +00:00
else if ( I_MenuRight ( ) )
2014-05-31 12:26:41 +00:00
{
2014-06-16 23:15:49 +00:00
I_MenuRightClear ( ) ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryOption_Movement ( currentry , object , MM_Right ) ;
2014-12-27 18:35:21 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
}
2014-06-16 23:15:49 +00:00
else if ( I_MenuLeft ( ) )
2014-05-31 12:26:41 +00:00
{
2014-06-16 23:15:49 +00:00
I_MenuLeftClear ( ) ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryOption_Movement ( currentry , object , MM_Left ) ;
2014-11-30 03:37:56 +00:00
2014-12-27 18:35:21 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2008-07-28 21:23:10 +00:00
}
}
2014-05-31 12:26:41 +00:00
break ;
case Custom2Col :
2014-06-16 23:15:49 +00:00
if ( I_MenuLeft ( ) | | I_MenuRight ( ) )
2013-08-06 23:53:55 +00:00
{
2014-06-16 23:15:49 +00:00
I_MenuLeftClear ( ) ;
I_MenuRightClear ( ) ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_Menu_Movement ( menu , MM_Swap ) ;
2014-12-27 18:35:21 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2013-08-06 23:53:55 +00:00
}
2017-06-19 23:07:01 +00:00
if ( currentry - > flags & MEF_Disabled )
2014-05-31 12:26:41 +00:00
break ;
2013-08-06 23:53:55 +00:00
2014-05-31 12:26:41 +00:00
if ( I_AdvanceTrigger ( ) )
{
I_AdvanceTriggerClear ( ) ;
2006-11-15 01:16:55 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryCustom2Col_Activate ( currentry ) ;
2014-05-31 12:26:41 +00:00
2014-12-27 18:35:21 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2014-05-31 12:26:41 +00:00
}
break ;
case RangeInt32 :
2008-07-28 21:23:10 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuRangeInt32_t * ) currentry - > entry ;
2014-05-31 12:26:41 +00:00
2017-06-19 23:07:01 +00:00
if ( currentry - > flags & MEF_Disabled )
2014-05-31 12:26:41 +00:00
break ;
if ( I_SliderLeft ( ) )
2008-07-28 21:23:10 +00:00
{
2014-05-31 12:26:41 +00:00
I_SliderLeftClear ( ) ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryRangeInt32_Movement ( currentry , object , MM_Left ) ;
2014-12-27 18:35:21 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2008-07-28 21:23:10 +00:00
}
2014-05-31 12:26:41 +00:00
else if ( I_SliderRight ( ) )
{
I_SliderRightClear ( ) ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryRangeInt32_Movement ( currentry , object , MM_Right ) ;
2014-05-31 12:26:41 +00:00
2014-12-27 18:35:21 +00:00
S_PlaySound ( KICK_HIT ) ;
2014-05-31 12:26:41 +00:00
}
break ;
2008-07-28 21:23:10 +00:00
}
2014-05-31 12:26:41 +00:00
case RangeFloat :
2008-07-28 21:23:10 +00:00
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuRangeFloat_t * ) currentry - > entry ;
2006-04-13 20:47:06 +00:00
2017-06-19 23:07:01 +00:00
if ( currentry - > flags & MEF_Disabled )
2014-05-31 12:26:41 +00:00
break ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
if ( I_SliderLeft ( ) )
2008-07-28 21:23:10 +00:00
{
2014-05-31 12:26:41 +00:00
I_SliderLeftClear ( ) ;
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryRangeFloat_Movement ( currentry , object , MM_Left ) ;
2014-12-27 18:35:21 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2008-07-28 21:23:10 +00:00
}
2014-05-31 12:26:41 +00:00
else if ( I_SliderRight ( ) )
{
I_SliderRightClear ( ) ;
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryRangeFloat_Movement ( currentry , object , MM_Right ) ;
2006-11-16 03:02:42 +00:00
2014-12-27 18:35:21 +00:00
S_PlaySound ( KICK_HIT ) ;
2014-05-31 12:26:41 +00:00
}
break ;
}
2017-07-29 20:39:57 +00:00
# ifdef MENU_ENABLE_RANGEDOUBLE
2014-05-31 12:26:41 +00:00
case RangeDouble :
{
MenuRangeDouble_t * object = ( MenuRangeDouble_t * ) currentry - > entry ;
2010-09-14 18:19:38 +00:00
2017-06-19 23:07:01 +00:00
if ( currentry - > flags & MEF_Disabled )
2014-05-31 12:26:41 +00:00
break ;
2010-09-14 18:19:38 +00:00
2014-05-31 12:26:41 +00:00
if ( I_SliderLeft ( ) )
{
I_SliderLeftClear ( ) ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryRangeDouble_Movement ( /*currentry, */ object , MM_Left ) ;
2014-12-27 18:35:21 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
}
else if ( I_SliderRight ( ) )
{
I_SliderRightClear ( ) ;
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryRangeDouble_Movement ( /*currentry, */ object , MM_Right ) ;
2014-05-31 12:26:41 +00:00
2014-12-27 18:35:21 +00:00
S_PlaySound ( KICK_HIT ) ;
2014-05-31 12:26:41 +00:00
}
break ;
}
2017-07-29 20:39:57 +00:00
# endif
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
case String :
{
2017-06-19 23:07:01 +00:00
if ( currentry - > flags & MEF_Disabled )
2014-12-28 21:34:54 +00:00
break ;
2014-05-31 12:26:41 +00:00
if ( I_AdvanceTrigger ( ) )
{
I_AdvanceTriggerClear ( ) ;
2006-11-15 01:16:55 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryString_Activate ( currentry ) ;
2011-12-21 18:41:38 +00:00
2014-12-27 18:35:21 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2014-05-31 12:26:41 +00:00
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
break ;
}
}
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
if ( I_ReturnTrigger ( ) | | I_EscapeTrigger ( ) | | Menu_RunInput_MouseReturn ( ) )
2006-11-16 03:02:42 +00:00
{
2014-05-31 12:26:41 +00:00
I_ReturnTriggerClear ( ) ;
I_EscapeTriggerClear ( ) ;
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2006-11-16 03:02:42 +00:00
2017-09-27 05:22:35 +00:00
if ( cm - > parentID ! = MENU_CLOSE | | ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) )
S_PlaySound ( EXITMENUSOUND ) ;
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( cm - > parentID , cm - > parentAnimation ) ;
2014-05-31 12:26:41 +00:00
}
2019-11-03 23:53:55 +00:00
else if ( inputState . GetKeyStatus ( sc_Home ) )
2014-05-31 12:26:41 +00:00
{
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_Home ) ;
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
currentry = Menu_RunInput_Menu_Movement ( menu , MM_Home ) ;
2014-05-31 12:26:41 +00:00
}
2019-11-03 23:53:55 +00:00
else if ( inputState . GetKeyStatus ( sc_End ) )
2014-05-31 12:26:41 +00:00
{
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_End ) ;
2006-11-15 01:16:55 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-11-15 01:16:55 +00:00
2016-11-01 01:35:32 +00:00
currentry = Menu_RunInput_Menu_Movement ( menu , MM_End ) ;
2014-05-31 12:26:41 +00:00
}
2014-06-16 23:15:49 +00:00
else if ( I_MenuUp ( ) )
2010-06-22 21:50:01 +00:00
{
2014-06-16 23:15:49 +00:00
I_MenuUpClear ( ) ;
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2016-11-01 01:35:32 +00:00
currentry = Menu_RunInput_Menu_Movement ( menu , MM_Up ) ;
2014-05-31 12:26:41 +00:00
}
2014-06-16 23:15:49 +00:00
else if ( I_MenuDown ( ) )
2014-05-31 12:26:41 +00:00
{
2014-06-16 23:15:49 +00:00
I_MenuDownClear ( ) ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
currentry = Menu_RunInput_Menu_Movement ( menu , MM_Down ) ;
2006-04-13 20:47:06 +00:00
}
2018-03-08 03:55:25 +00:00
if ( currentry ! = NULL )
2016-11-01 01:35:32 +00:00
Menu_PreInput ( currentry ) ;
2014-05-31 12:26:41 +00:00
}
else if ( state = = 1 )
{
if ( currentry - > type = = String )
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuString_t * ) currentry - > entry ;
2006-04-13 20:47:06 +00:00
2017-12-01 06:19:12 +00:00
int32_t hitstate = I_EnterText ( object - > editfield , object - > bufsize - 1 , object - > flags ) ;
2012-06-03 16:11:22 +00:00
2016-11-01 01:35:32 +00:00
if ( hitstate = = - 1 | | Menu_RunInput_MouseReturn ( ) )
2014-05-31 12:26:41 +00:00
{
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryString_Cancel ( /*currentry, */ object ) ;
2006-04-13 20:47:06 +00:00
2014-12-27 18:35:21 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2014-05-31 12:26:41 +00:00
}
2014-12-27 18:37:27 +00:00
else if ( hitstate = = 1 )
{
2017-12-18 11:24:53 +00:00
Menu_RunInput_EntryString_Submit ( /*currentry, */ object ) ;
2014-12-27 18:37:27 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
}
2014-05-31 12:26:41 +00:00
}
}
else if ( state = = 2 )
{
if ( currentry - > type = = Option )
{
2018-12-15 01:39:51 +00:00
auto object = ( MenuOption_t * ) currentry - > entry ;
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
if ( I_ReturnTrigger ( ) | | Menu_RunInput_MouseReturn ( ) )
2014-05-31 12:26:41 +00:00
{
I_ReturnTriggerClear ( ) ;
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2006-11-16 03:02:42 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2012-03-28 19:42:16 +00:00
2014-05-31 12:26:41 +00:00
object - > options - > currentEntry = - 1 ;
}
else if ( I_AdvanceTrigger ( ) )
{
I_AdvanceTriggerClear ( ) ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
if ( ! Menu_RunInput_EntryOptionList_Activate ( currentry , object ) )
2014-12-27 18:35:21 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2014-05-31 12:26:41 +00:00
}
2019-11-03 23:53:55 +00:00
else if ( inputState . GetKeyStatus ( sc_Home ) )
2014-05-31 12:26:41 +00:00
{
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_Home ) ;
2006-12-05 00:16:33 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-04-16 23:36:04 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryOptionList_Movement ( object , MM_Home ) ;
2014-05-31 12:26:41 +00:00
}
2019-11-03 23:53:55 +00:00
else if ( inputState . GetKeyStatus ( sc_End ) )
2014-05-31 12:26:41 +00:00
{
2019-11-03 23:53:55 +00:00
inputState . ClearKeyStatus ( sc_End ) ;
2006-12-05 00:16:33 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-12-05 00:16:33 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryOptionList_Movement ( object , MM_End ) ;
2014-05-31 12:26:41 +00:00
}
2014-06-16 23:15:49 +00:00
else if ( I_MenuUp ( ) )
2014-05-31 12:26:41 +00:00
{
2014-06-16 23:15:49 +00:00
I_MenuUpClear ( ) ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-04-13 20:47:06 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryOptionList_Movement ( object , MM_Up ) ;
2014-05-31 12:26:41 +00:00
}
2014-06-16 23:15:49 +00:00
else if ( I_MenuDown ( ) )
2014-05-31 12:26:41 +00:00
{
2014-06-16 23:15:49 +00:00
I_MenuDownClear ( ) ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-11-16 03:02:42 +00:00
2016-11-01 01:35:32 +00:00
Menu_RunInput_EntryOptionList_Movement ( object , MM_Down ) ;
2014-05-31 12:26:41 +00:00
}
}
else if ( currentry - > type = = Custom2Col )
{
2016-11-01 01:35:32 +00:00
if ( I_EscapeTrigger ( ) | | Menu_RunInput_MouseReturn ( ) )
2014-05-31 12:26:41 +00:00
{
I_EscapeTriggerClear ( ) ;
2014-12-27 18:37:27 +00:00
m_mousecaught = 1 ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
( ( MenuCustom2Col_t * ) currentry - > entry ) - > screenOpen = 0 ;
}
2016-11-01 01:35:32 +00:00
else if ( Menu_PreCustom2ColScreen ( currentry ) )
2014-05-31 12:26:41 +00:00
( ( MenuCustom2Col_t * ) currentry - > entry ) - > screenOpen = 0 ;
}
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
break ;
}
}
}
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
void M_DisplayMenus ( void )
{
2015-01-25 12:16:58 +00:00
vec2_t origin = { 0 , 0 } , previousOrigin = { 0 , 0 } ;
2014-10-27 07:09:41 +00:00
2014-05-31 12:26:41 +00:00
Net_GetPackets ( ) ;
2006-04-13 20:47:06 +00:00
2014-05-31 12:26:41 +00:00
if ( ( g_player [ myconnectindex ] . ps - > gm & MODE_MENU ) = = 0 )
{
return ;
}
2014-09-30 04:07:29 +00:00
2019-11-03 23:53:55 +00:00
if ( ! Menu_IsTextInput ( m_currentMenu ) & & inputState . GetKeyStatus ( sc_Q ) )
2016-11-01 01:35:32 +00:00
Menu_AnimateChange ( MENU_QUIT , MA_Advance ) ;
2014-11-17 07:39:12 +00:00
2019-11-10 14:15:14 +00:00
int32_t mousestatus = inputState . mouseReadAbs ( & m_mousepos ) ;
2019-11-04 00:01:54 +00:00
if ( mousestatus & & inputState . mouseClickState ( ) = = MOUSE_PRESSED )
2014-12-27 18:36:43 +00:00
m_mousedownpos = m_mousepos ;
2016-11-01 01:35:32 +00:00
Menu_RunInput ( m_currentMenu ) ;
2014-11-17 07:39:12 +00:00
2015-02-08 08:02:51 +00:00
g_player [ myconnectindex ] . ps - > gm & = ( 0xff - MODE_TYPE ) ;
2015-03-24 10:49:03 +00:00
// g_player[myconnectindex].ps->fta = 0;
2015-02-08 08:02:51 +00:00
2018-01-26 04:34:43 +00:00
int32_t const backgroundOK = ud . menubackground & & Menu_BlackTranslucentBackgroundOK ( g_currentMenu ) ;
2017-07-05 05:37:43 +00:00
2017-07-06 14:43:07 +00:00
// need EVENT_DISPLAYMENUBACKGROUND here
2019-07-19 01:49:29 +00:00
if ( ! FURY & & ( ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) | | ud . recstat = = 2 ) & & backgroundOK )
2018-04-12 21:03:12 +00:00
videoFadeToBlack ( 1 ) ;
2015-02-08 08:02:51 +00:00
2016-11-01 01:35:32 +00:00
if ( Menu_UpdateScreenOK ( g_currentMenu ) )
2015-02-08 08:02:51 +00:00
G_UpdateScreenArea ( ) ;
# if !defined EDUKE32_TOUCH_DEVICES
if ( m_menuchange_watchpoint > 0 )
m_menuchange_watchpoint + + ;
# endif
2017-06-27 01:50:55 +00:00
if ( m_parentMenu )
{
2018-02-26 20:20:00 +00:00
ud . returnvar [ 0 ] = origin . x ;
ud . returnvar [ 1 ] = origin . y ;
2019-08-09 08:21:19 +00:00
if ( m_parentMenu - > type = = Menu )
{
ud . returnvar [ 2 ] = ( ( MenuMenu_t * ) m_parentMenu - > object ) - > currentEntry ;
if ( m_parentMenu - > menuID = = MENU_NEWGAMECUSTOMSUB )
ud . returnvar [ 3 ] = M_NEWGAMECUSTOM . currentEntry ;
}
2017-06-27 01:50:55 +00:00
VM_OnEventWithReturn ( EVENT_DISPLAYINACTIVEMENU , g_player [ screenpeek ] . ps - > i , screenpeek , m_parentMenu - > menuID ) ;
2018-02-26 20:20:00 +00:00
origin . x = ud . returnvar [ 0 ] ;
origin . y = ud . returnvar [ 1 ] ;
2017-06-27 01:50:55 +00:00
}
2015-01-25 12:16:58 +00:00
// Determine animation values.
if ( totalclock < m_animation . start + m_animation . length )
{
const int32_t screenwidth = scale ( 240 < < 16 , xdim , ydim ) ;
2017-06-24 09:20:37 +00:00
origin . x = mulscale15 ( screenwidth , m_animation . in ( & m_animation ) ) ;
previousOrigin . x = mulscale15 ( screenwidth , m_animation . out ( & m_animation ) ) ;
2015-01-25 12:16:58 +00:00
2018-02-26 20:20:00 +00:00
ud . returnvar [ 0 ] = previousOrigin . x ;
ud . returnvar [ 1 ] = previousOrigin . y ;
2019-08-09 08:21:19 +00:00
if ( m_animation . previous - > type = = Menu )
{
ud . returnvar [ 2 ] = ( ( MenuMenu_t * ) m_animation . previous - > object ) - > currentEntry ;
if ( m_animation . previous - > menuID = = MENU_NEWGAMECUSTOMSUB )
ud . returnvar [ 3 ] = M_NEWGAMECUSTOM . currentEntry ;
}
2015-01-25 12:16:58 +00:00
VM_OnEventWithReturn ( EVENT_DISPLAYINACTIVEMENU , g_player [ screenpeek ] . ps - > i , screenpeek , m_animation . previous - > menuID ) ;
2018-02-26 20:20:00 +00:00
previousOrigin . x = ud . returnvar [ 0 ] ;
previousOrigin . y = ud . returnvar [ 1 ] ;
2015-01-25 12:16:58 +00:00
}
2018-02-26 20:20:00 +00:00
ud . returnvar [ 0 ] = origin . x ;
ud . returnvar [ 1 ] = origin . y ;
2019-08-09 08:21:19 +00:00
if ( m_currentMenu - > type = = Menu )
{
ud . returnvar [ 2 ] = ( ( MenuMenu_t * ) m_currentMenu - > object ) - > currentEntry ;
if ( g_currentMenu = = MENU_NEWGAMECUSTOMSUB )
ud . returnvar [ 3 ] = M_NEWGAMECUSTOM . currentEntry ;
}
2015-01-25 12:16:58 +00:00
VM_OnEventWithReturn ( EVENT_DISPLAYMENU , g_player [ screenpeek ] . ps - > i , screenpeek , g_currentMenu ) ;
2018-02-26 20:20:00 +00:00
origin . x = ud . returnvar [ 0 ] ;
origin . y = ud . returnvar [ 1 ] ;
2006-04-13 20:47:06 +00:00
2017-07-05 05:37:43 +00:00
if ( m_parentMenu & & backgroundOK )
2017-06-27 01:50:55 +00:00
{
Menu_Run ( m_parentMenu , origin ) ;
}
2017-07-06 14:43:07 +00:00
// hack; need EVENT_DISPLAYMENUBACKGROUND above
2019-07-19 01:49:29 +00:00
if ( FURY & & ( ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) | | ud . recstat = = 2 | | m_parentMenu ! = NULL ) & & backgroundOK )
2018-04-12 21:03:12 +00:00
videoFadeToBlack ( 1 ) ;
2017-06-27 01:50:55 +00:00
2014-12-27 18:36:58 +00:00
// Display the menu, with a transition animation if applicable.
2014-10-27 10:14:50 +00:00
if ( totalclock < m_animation . start + m_animation . length )
{
2016-11-01 01:35:32 +00:00
Menu_Run ( m_animation . previous , previousOrigin ) ;
Menu_Run ( m_animation . current , origin ) ;
2014-10-27 10:14:50 +00:00
}
else
2016-11-01 01:35:32 +00:00
Menu_Run ( m_currentMenu , origin ) ;
2014-10-27 10:14:50 +00:00
2014-12-27 18:37:27 +00:00
# if !defined EDUKE32_TOUCH_DEVICES
if ( m_menuchange_watchpoint > = 3 )
m_menuchange_watchpoint = 0 ;
# endif
2017-06-27 01:50:55 +00:00
if ( m_parentMenu )
{
2018-02-26 20:20:00 +00:00
ud . returnvar [ 0 ] = origin . x ;
ud . returnvar [ 1 ] = origin . y ;
2019-08-09 08:21:19 +00:00
if ( m_parentMenu - > type = = Menu )
{
ud . returnvar [ 2 ] = ( ( MenuMenu_t * ) m_parentMenu - > object ) - > currentEntry ;
if ( m_parentMenu - > menuID = = MENU_NEWGAMECUSTOMSUB )
ud . returnvar [ 3 ] = M_NEWGAMECUSTOM . currentEntry ;
}
2017-06-27 01:50:55 +00:00
VM_OnEventWithReturn ( EVENT_DISPLAYINACTIVEMENUREST , g_player [ screenpeek ] . ps - > i , screenpeek , m_parentMenu - > menuID ) ;
}
2015-01-25 12:16:58 +00:00
if ( totalclock < m_animation . start + m_animation . length )
{
2018-02-26 20:20:00 +00:00
ud . returnvar [ 0 ] = previousOrigin . x ;
ud . returnvar [ 1 ] = previousOrigin . y ;
2019-08-09 08:21:19 +00:00
if ( m_animation . previous - > type = = Menu )
{
ud . returnvar [ 2 ] = ( ( MenuMenu_t * ) m_animation . previous - > object ) - > currentEntry ;
if ( m_animation . previous - > menuID = = MENU_NEWGAMECUSTOMSUB )
ud . returnvar [ 3 ] = M_NEWGAMECUSTOM . currentEntry ;
}
2015-01-25 12:16:58 +00:00
VM_OnEventWithReturn ( EVENT_DISPLAYINACTIVEMENUREST , g_player [ screenpeek ] . ps - > i , screenpeek , m_animation . previous - > menuID ) ;
}
2018-02-26 20:20:00 +00:00
ud . returnvar [ 0 ] = origin . x ;
ud . returnvar [ 1 ] = origin . y ;
2019-08-09 08:21:19 +00:00
if ( m_currentMenu - > type = = Menu )
{
ud . returnvar [ 2 ] = ( ( MenuMenu_t * ) m_currentMenu - > object ) - > currentEntry ;
if ( g_currentMenu = = MENU_NEWGAMECUSTOMSUB )
ud . returnvar [ 3 ] = M_NEWGAMECUSTOM . currentEntry ;
}
2015-01-25 12:16:58 +00:00
VM_OnEventWithReturn ( EVENT_DISPLAYMENUREST , g_player [ screenpeek ] . ps - > i , screenpeek , g_currentMenu ) ;
2006-04-13 20:47:06 +00:00
2019-11-07 19:31:16 +00:00
if ( GUICapture & 2 )
{
ImGui_Begin_Frame ( ) ;
2019-11-09 13:05:52 +00:00
bool b = true ;
2019-11-09 18:15:03 +00:00
videoFadeToBlack ( 1 ) ;
#if 0
2019-11-07 19:31:16 +00:00
ImGui : : ShowDemoWindow ( & b ) ;
2019-11-09 13:05:52 +00:00
if ( ! b )
2019-11-09 18:15:03 +00:00
# else
if ( ! ShowOptionMenu ( ) )
# endif
2019-11-09 13:05:52 +00:00
{
GUICapture & = ~ 2 ;
GUICapture | = 4 ;
}
2019-11-07 19:31:16 +00:00
return ;
}
2014-12-28 21:36:09 +00:00
# if !defined EDUKE32_TOUCH_DEVICES
2014-12-28 19:48:20 +00:00
if ( tilesiz [ CROSSHAIR ] . x > 0 & & mousestatus )
2014-12-28 21:36:09 +00:00
# else
if ( mousestatus )
# endif
2014-11-17 07:39:12 +00:00
{
2014-12-27 18:37:27 +00:00
# if !defined EDUKE32_TOUCH_DEVICES
if ( ! MOUSEACTIVECONDITION )
m_mousewake_watchpoint = 1 ;
# endif
2019-11-04 16:58:18 +00:00
if ( MOUSEACTIVECONDITIONAL ( inputState . mouseAdvanceClickState ( ) ) | | m_mousepos . x ! = m_prevmousepos . x | | m_mousepos . y ! = m_prevmousepos . y )
2014-11-17 07:39:12 +00:00
{
m_prevmousepos = m_mousepos ;
2019-08-27 13:39:54 +00:00
m_mouselastactivity = ( int32_t ) totalclock ;
2014-11-17 07:39:12 +00:00
}
2014-12-27 18:37:27 +00:00
# if !defined EDUKE32_TOUCH_DEVICES
else
m_mousewake_watchpoint = 0 ;
# endif
m_mousecaught = 0 ;
2014-11-17 07:39:12 +00:00
}
else
2014-12-27 18:37:27 +00:00
{
2014-11-17 07:39:12 +00:00
m_mouselastactivity = - M_MOUSETIMEOUT ;
2014-12-27 18:37:27 +00:00
# if !defined EDUKE32_TOUCH_DEVICES
m_mousewake_watchpoint = 0 ;
# endif
}
2014-12-27 18:36:58 +00:00
# ifndef EDUKE32_TOUCH_DEVICES
// Display the mouse cursor, except on touch devices.
if ( MOUSEACTIVECONDITION )
2015-02-11 05:22:32 +00:00
{
2018-03-01 13:46:52 +00:00
if ( VM_HaveEvent ( EVENT_DISPLAYCURSOR ) )
{
ud . returnvar [ 0 ] = m_mousepos . x ;
ud . returnvar [ 1 ] = m_mousepos . y ;
ud . returnvar [ 2 ] = CURSORALPHA ;
}
2015-02-11 07:08:27 +00:00
int32_t a = VM_OnEventWithReturn ( EVENT_DISPLAYCURSOR , g_player [ screenpeek ] . ps - > i , screenpeek , CROSSHAIR ) ;
2015-02-11 05:22:32 +00:00
if ( ( unsigned ) a < MAXTILES )
2018-02-13 00:13:06 +00:00
{
vec2_t cursorpos = m_mousepos ;
int32_t z = 65536 ;
uint8_t p = CROSSHAIR_PAL ;
2019-02-19 05:26:49 +00:00
uint32_t o = 2 | 8 ;
2018-02-13 00:13:06 +00:00
auto const oyxaspect = yxaspect ;
2018-03-08 03:55:48 +00:00
int32_t alpha ;
2019-07-19 01:49:29 +00:00
if ( FURY )
2018-02-13 00:13:06 +00:00
{
2018-04-12 21:03:47 +00:00
renderSetAspect ( viewingrange , 65536 ) ;
2018-02-13 00:13:06 +00:00
cursorpos . x = scale ( cursorpos . x - ( 320 < < 15 ) , ydim < < 2 , xdim * 3 ) + ( 320 < < 15 ) ;
cursorpos . y = scale ( cursorpos . y - ( 200 < < 15 ) , ( ydim < < 2 ) * 6 , ( xdim * 3 ) * 5 ) + ( 200 < < 15 ) ;
2018-03-06 10:25:07 +00:00
z = scale ( 32768 , ydim < < 2 , xdim * 3 ) ;
2018-02-13 00:13:06 +00:00
p = 0 ;
o | = 1024 ;
2018-03-08 03:55:48 +00:00
alpha = MOUSEALPHA ;
}
else
{
alpha = CURSORALPHA ;
2018-02-13 00:13:06 +00:00
}
2018-03-08 03:55:48 +00:00
rotatesprite_fs_alpha ( cursorpos . x , cursorpos . y , z , 0 , a , 0 , p , o , alpha ) ;
2018-02-13 00:13:06 +00:00
2019-07-19 01:49:29 +00:00
if ( FURY )
2018-04-12 21:03:47 +00:00
renderSetAspect ( viewingrange , oyxaspect ) ;
2018-02-13 00:13:06 +00:00
}
2015-02-11 05:22:32 +00:00
}
2014-12-27 18:37:27 +00:00
else
2019-11-04 00:01:54 +00:00
inputState . clearMouseClickState ( ) ;
2014-12-27 18:36:58 +00:00
# endif
2014-11-17 07:39:12 +00:00
2007-08-27 06:46:31 +00:00
if ( ( g_player [ myconnectindex ] . ps - > gm & MODE_MENU ) ! = MODE_MENU )
2006-04-13 20:47:06 +00:00
{
2008-11-20 14:06:36 +00:00
G_UpdateScreenArea ( ) ;
2019-08-27 13:39:54 +00:00
CAMERACLOCK = ( int32_t ) totalclock ;
2013-01-19 18:28:32 +00:00
CAMERADIST = 65536 ;
2006-04-13 20:47:06 +00:00
}
}
2019-11-06 18:22:14 +00:00
bool GameInterface : : mouseInactiveConditional ( bool condition )
{
return MOUSEINACTIVECONDITIONAL ( condition ) ;
}
2019-09-21 20:53:00 +00:00
END_DUKE_NS