2006-04-13 20:47:06 +00:00
//-------------------------------------------------------------------------
/*
2010-05-25 10:56:00 +00:00
Copyright ( C ) 2010 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
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
//-------------------------------------------------------------------------
2012-10-14 22:16:07 +00:00
// FIXME: this file is the single worst fucking mess in all of EDuke32
2006-04-13 20:47:06 +00:00
# include "duke3d.h"
2012-01-27 15:03:55 +00:00
# include "net.h"
# include "player.h"
2006-04-13 20:47:06 +00:00
# include "mouse.h"
2012-06-03 16:11:22 +00:00
# include "joystick.h"
2006-04-13 20:47:06 +00:00
# include "osd.h"
2008-07-27 21:33:28 +00:00
# include "osdcmds.h"
2009-01-18 07:32:35 +00:00
# include "gamedef.h"
2010-08-02 08:13:51 +00:00
# include "gameexec.h"
# include "savegame.h"
# include "premap.h"
2010-08-02 08:19:28 +00:00
# include "demo.h"
2010-09-14 18:19:38 +00:00
# include "crc32.h"
2012-03-28 19:42:16 +00:00
# include "common.h"
2012-06-03 16:09:33 +00:00
# include "common_game.h"
2012-06-03 16:11:22 +00:00
# include "input.h"
2012-10-14 22:16:07 +00:00
# include "menus.h"
2010-09-14 18:19:38 +00:00
2006-04-13 20:47:06 +00:00
# include <sys/stat.h>
extern char inputloc ;
2009-01-09 09:29:17 +00:00
int16_t g_skillSoundID = - 1 ;
2012-06-03 16:11:22 +00:00
int32_t probey = 0 ; // the row number on which the menu cursor is positioned
2009-01-09 09:29:17 +00:00
static int32_t lastsavehead = 0 , last_menu_pos = 0 , last_menu , sh , onbar , buttonstat ;
static int32_t last_zero , last_fifty , last_onehundred , last_twoohtwo , last_threehundred = 0 ;
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
// ugly hack to get around inadequacies of calling CONTROL_GetInput() in M_Probe() and still have gamefuncs function throughout menus
// A previous solution was to add CONTROL_GetInput(&minfo); in M_DisplayMenus but that hurt mouse aiming
# define AdvanceTrigger 0x01
# define ReturnTrigger 0x02
# define EscapeTrigger 0x04
# define ProbeTriggers(x) (menutriggers&x)
# define ProbeTriggersClear(x) (menutriggers&=~x)
static int32_t menutriggers = 0 ;
2006-05-04 03:14:49 +00:00
static char menunamecnt ;
2006-04-13 20:47:06 +00:00
2012-03-28 19:42:16 +00:00
static fnlist_t fnlist ;
static CACHE1D_FIND_REC * finddirshigh = NULL , * findfileshigh = NULL ;
2009-01-09 09:29:17 +00:00
static int32_t currentlist = 0 ;
2012-03-28 19:42:16 +00:00
static void set_findhighs ( void )
{
finddirshigh = fnlist . finddirs ;
findfileshigh = fnlist . findfiles ;
currentlist = 0 ;
if ( findfileshigh )
currentlist = 1 ;
}
2009-01-09 09:29:17 +00:00
static int32_t function , whichkey ;
static int32_t changesmade , newvidmode , curvidmode , newfullscreen ;
static int32_t vidsets [ 16 ] = { - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } ;
static int32_t curvidset , newvidset = 0 ;
static int32_t soundbits , soundvoices , soundrate ;
2012-01-26 21:58:55 +00:00
# define NUMDOUBLEMBTNS 3 // # of mouse buttons that can be double-clicked (mouse1 - mouse3)
# define NUMSINGLEMBTNS 4 // # of mouse buttons that can only be single-clicked (the rest)
# define NUMMOUSEFUNCTIONS (NUMDOUBLEMBTNS*2+NUMSINGLEMBTNS)
2013-02-25 15:31:22 +00:00
// NOTE: NUMMOUSEFUNCTIONS must equal MAXMOUSEBUTTONS!!!
static const char * mousebuttonnames [ NUMMOUSEFUNCTIONS = = MAXMOUSEBUTTONS ? MAXMOUSEBUTTONS : - 1 ] =
2012-07-01 22:11:33 +00:00
{ " Mouse1 " , " Mouse2 " , " Mouse3 " , " Mouse4 " , " Wheel Up " ,
" Wheel Down " , " Mouse5 " , " Mouse6 " , " Mouse7 " , " Mouse8 "
} ;
2006-04-13 20:47:06 +00:00
2009-01-09 09:29:17 +00:00
extern int32_t voting ;
2006-05-04 03:14:49 +00:00
2008-07-30 02:51:32 +00:00
# define USERMAPENTRYLENGTH 25
2010-03-02 22:49:26 +00:00
# define mgametext(x,y,t,s,dabits) G_PrintGameText(2,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536)
# define mgametextpal(x,y,t,s,p) G_PrintGameText(2,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536)
2008-08-28 05:57:46 +00:00
2012-10-14 22:16:07 +00:00
void M_ChangeMenu ( int32_t cm )
2006-04-13 20:47:06 +00:00
{
2012-12-10 18:17:57 +00:00
if ( G_HaveEvent ( EVENT_CHANGEMENU ) )
2012-10-29 04:29:45 +00:00
cm = VM_OnEvent ( EVENT_CHANGEMENU , g_player [ myconnectindex ] . ps - > i , myconnectindex , - 1 , cm ) ;
2006-04-13 20:47:06 +00:00
2012-10-29 04:29:45 +00:00
if ( cm > = 0 )
2012-10-14 22:16:07 +00:00
{
2012-10-29 04:29:45 +00:00
g_currentMenu = cm ;
switch ( g_currentMenu )
{
case MENU_MAIN :
probey = last_zero ;
break ;
case MENU_MAIN_INGAME :
probey = last_fifty ;
break ;
case MENU_EPISODE :
probey = last_onehundred ;
break ;
case MENU_OPTIONS :
probey = last_twoohtwo ;
break ;
case MENU_SKILL :
probey = 1 ;
break ;
default :
if ( cm > = MENU_LOAD & & cm < MENU_STORY )
probey = last_threehundred ;
else if ( ( cm > = 1000 & & cm < = 1009 ) )
return ;
else probey = 0 ;
break ;
}
lastsavehead = - 1 ;
2012-10-14 22:16:07 +00:00
}
2012-10-29 04:29:45 +00:00
}
static void M_LinearPanels ( int32_t firstMenu , int32_t lastMenu )
{
int32_t changedMenu = g_currentMenu ;
2012-10-14 22:16:07 +00:00
2012-10-29 04:29:45 +00:00
if ( I_PanelUp ( ) )
{
I_PanelUpClear ( ) ;
S_PlaySound ( KICK_HIT ) ;
changedMenu - - ;
if ( changedMenu < firstMenu ) changedMenu = lastMenu ;
M_ChangeMenu ( changedMenu ) ;
}
else if ( I_PanelDown ( ) )
{
I_PanelDownClear ( ) ;
S_PlaySound ( KICK_HIT ) ;
changedMenu + + ;
if ( changedMenu > lastMenu ) changedMenu = firstMenu ;
M_ChangeMenu ( changedMenu ) ;
}
2006-04-13 20:47:06 +00:00
}
2012-06-03 16:11:22 +00:00
# define LMB (buttonstat&LEFT_MOUSE)
# define RMB (buttonstat&RIGHT_MOUSE)
# define WHEELUP (buttonstat&WHEELUP_MOUSE)
# define WHEELDOWN (buttonstat&WHEELDOWN_MOUSE)
2006-04-13 20:47:06 +00:00
2007-02-08 04:19:39 +00:00
static ControlInfo minfo ;
2006-04-13 20:47:06 +00:00
2009-01-09 09:29:17 +00:00
static int16_t mi , mii ;
2006-04-13 20:47:06 +00:00
2009-01-09 09:29:17 +00:00
static int32_t probe_ ( int32_t type , int32_t x , int32_t y , int32_t i , int32_t n )
2006-04-13 20:47:06 +00:00
{
2009-04-29 19:43:51 +00:00
int16_t centre ;
2006-04-13 20:47:06 +00:00
2010-05-05 07:31:38 +00:00
CONTROL_GetInput ( & minfo ) ;
mi + = ( minfo . dpitch + minfo . dz ) ;
mii + = minfo . dyaw ;
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
menutriggers = 0 ;
2006-11-14 21:35:50 +00:00
if ( x = = ( 320 > > 1 ) )
2006-04-13 20:47:06 +00:00
centre = 320 > > 2 ;
else centre = 0 ;
2012-06-03 16:11:22 +00:00
if ( ! buttonstat | | buttonstat = = WHEELUP_MOUSE | | buttonstat = = WHEELDOWN_MOUSE )
2006-04-13 20:47:06 +00:00
{
2012-06-03 16:11:22 +00:00
if ( KB_KeyPressed ( sc_UpArrow ) | | KB_KeyPressed ( sc_kpad_8 ) | | mi < - 8192 | | WHEELUP | | BUTTON ( gamefunc_Move_Forward ) | | ( JOYSTICK_GetHat ( 0 ) & HAT_UP ) )
2006-04-13 20:47:06 +00:00
{
2006-12-12 06:41:47 +00:00
mi = mii = 0 ;
2006-11-14 21:35:50 +00:00
KB_ClearKeyDown ( sc_UpArrow ) ;
KB_ClearKeyDown ( sc_kpad_8 ) ;
2006-12-12 05:59:47 +00:00
MOUSE_ClearButton ( WHEELUP_MOUSE ) ;
2012-06-03 16:11:22 +00:00
CONTROL_ClearButton ( gamefunc_Move_Forward ) ;
JOYSTICK_ClearHat ( 0 ) ;
2012-02-04 14:30:54 +00:00
2008-11-20 14:06:36 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-04-13 20:47:06 +00:00
probey - - ;
2012-02-04 14:30:54 +00:00
if ( probey < 0 )
probey = n - 1 ;
}
if ( KB_KeyPressed ( sc_PgUp ) )
{
// n is >= NUMGAMEFUNCTIONS from mouse/keyboard setup
int32_t step = ( n > = NUMGAMEFUNCTIONS ) ? 13 / 2 : n / 2 ;
KB_ClearKeyDown ( sc_PgUp ) ;
S_PlaySound ( KICK_HIT ) ;
// if (probey == 0) probey = n-1; else
probey = max ( 0 , probey - step ) ;
2006-04-13 20:47:06 +00:00
}
2012-02-04 14:30:54 +00:00
if ( KB_KeyPressed ( sc_Home ) )
{
// does not get in the way of special HOME handling in user map list
KB_ClearKeyDown ( sc_Home ) ;
S_PlaySound ( KICK_HIT ) ;
probey = 0 ;
}
2012-06-03 16:11:22 +00:00
if ( KB_KeyPressed ( sc_DownArrow ) | | KB_KeyPressed ( sc_kpad_2 ) | | mi > 8192 | | WHEELDOWN | | BUTTON ( gamefunc_Move_Backward ) | | ( JOYSTICK_GetHat ( 0 ) & HAT_DOWN ) )
2006-04-13 20:47:06 +00:00
{
2006-12-12 06:41:47 +00:00
mi = mii = 0 ;
2006-11-14 21:35:50 +00:00
KB_ClearKeyDown ( sc_DownArrow ) ;
KB_ClearKeyDown ( sc_kpad_2 ) ;
KB_ClearKeyDown ( sc_PgDn ) ;
2006-12-12 05:59:47 +00:00
MOUSE_ClearButton ( WHEELDOWN_MOUSE ) ;
2012-06-03 16:11:22 +00:00
CONTROL_ClearButton ( gamefunc_Move_Backward ) ;
JOYSTICK_ClearHat ( 0 ) ;
2012-02-04 14:30:54 +00:00
2008-11-20 14:06:36 +00:00
S_PlaySound ( KICK_HIT ) ;
2012-02-04 14:30:54 +00:00
2006-04-13 20:47:06 +00:00
probey + + ;
2012-02-04 14:30:54 +00:00
if ( probey > = n )
probey = 0 ;
}
if ( KB_KeyPressed ( sc_PgDn ) )
{
int32_t step = ( n > = NUMGAMEFUNCTIONS ) ? 13 / 2 : n / 2 ;
KB_ClearKeyDown ( sc_PgDn ) ;
S_PlaySound ( KICK_HIT ) ;
// if (probey == n-1) probey = 0; else
probey = min ( n - 1 , probey + step ) ;
}
if ( KB_KeyPressed ( sc_End ) )
{
// does not get in the way of special END handling in user map list
KB_ClearKeyDown ( sc_End ) ;
S_PlaySound ( KICK_HIT ) ;
probey = n - 1 ;
2006-04-13 20:47:06 +00:00
}
}
2012-02-04 14:30:54 +00:00
// XXX: check for probey < 0 needed here? (we have M_Probe(..., 0) calls)
if ( probey > = n ) // not sure if still necessary
2006-04-13 20:47:06 +00:00
probey = 0 ;
2010-07-05 04:37:28 +00:00
if ( x | | y )
2006-04-13 20:47:06 +00:00
{
2010-07-05 04:37:28 +00:00
if ( centre )
{
2012-02-02 17:35:05 +00:00
// rotatesprite_fs(((320>>1)+(centre)+54)<<16,(y+(probey*i)-4)<<16,65536L,0,SPINNINGNUKEICON+6-((6+(totalclock>>3))%7),sh,0,10);
// rotatesprite_fs(((320>>1)-(centre)-54)<<16,(y+(probey*i)-4)<<16,65536L,0,SPINNINGNUKEICON+((totalclock>>3)%7),sh,0,10);
2006-04-13 20:47:06 +00:00
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( ( ( 320 > > 1 ) + ( centre > > 1 ) + 70 ) < < 16 , ( y + ( probey * i ) - 4 ) < < 16 , 65536L > > type , 0 , SPINNINGNUKEICON + 6 - ( ( 6 + ( totalclock > > 3 ) ) % 7 ) , sh , 0 , 10 ) ;
rotatesprite_fs ( ( ( 320 > > 1 ) - ( centre > > 1 ) - 70 ) < < 16 , ( y + ( probey * i ) - 4 ) < < 16 , 65536L > > type , 0 , SPINNINGNUKEICON + ( ( totalclock > > 3 ) % 7 ) , sh , 0 , 10 ) ;
2010-07-05 04:37:28 +00:00
}
else
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( ( x < < 16 ) - ( ( tilesizx [ BIGFNTCURSOR ] - 4 ) < < ( 16 - type ) ) , ( y + ( probey * i ) - ( 4 > > type ) ) < < 16 , 65536L > > type , 0 , SPINNINGNUKEICON + ( ( ( totalclock > > 3 ) ) % 7 ) , sh , 0 , 10 ) ;
2006-04-13 20:47:06 +00:00
}
2012-06-03 16:11:22 +00:00
if ( I_AdvanceTrigger ( ) & & ! onbar )
2006-04-13 20:47:06 +00:00
{
2012-10-14 22:16:07 +00:00
if ( g_currentMenu ! = MENU_SKILL )
2008-11-20 14:06:36 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2012-06-03 16:11:22 +00:00
menutriggers | = AdvanceTrigger ;
I_AdvanceTriggerClear ( ) ;
2006-04-13 20:47:06 +00:00
return ( probey ) ;
}
2012-06-03 16:11:22 +00:00
else if ( I_ReturnTrigger ( ) )
2006-04-13 20:47:06 +00:00
{
2008-11-20 14:06:36 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2012-06-03 16:11:22 +00:00
menutriggers | = ReturnTrigger ;
I_ReturnTriggerClear ( ) ;
onbar = 0 ;
2006-04-13 20:47:06 +00:00
return ( - 1 ) ;
}
else
{
2012-06-03 16:11:22 +00:00
if ( onbar = = 0 )
return ( - probey - 2 ) ;
2012-10-14 22:16:07 +00:00
if ( KB_KeyPressed ( sc_LeftArrow ) | | KB_KeyPressed ( sc_kpad_4 ) | | ( LMB & & ( WHEELUP | | mii < - 256 ) ) | | BUTTON ( gamefunc_Turn_Left ) | |
BUTTON ( gamefunc_Strafe_Left ) | | ( JOYSTICK_GetHat ( 0 ) & HAT_LEFT ) )
2006-04-13 20:47:06 +00:00
return ( probey ) ;
2012-10-14 22:16:07 +00:00
else if ( KB_KeyPressed ( sc_RightArrow ) | | KB_KeyPressed ( sc_kpad_6 ) | | ( LMB & & ( WHEELDOWN | | mii > 256 ) ) | | BUTTON ( gamefunc_Turn_Right ) | |
BUTTON ( gamefunc_Strafe_Right ) | | ( JOYSTICK_GetHat ( 0 ) & HAT_RIGHT ) )
2006-04-13 20:47:06 +00:00
return ( probey ) ;
2012-06-03 16:11:22 +00:00
2006-12-15 01:09:25 +00:00
return ( - probey - 2 ) ;
2006-04-13 20:47:06 +00:00
}
}
2009-01-09 09:29:17 +00:00
static inline int32_t M_Probe ( int32_t x , int32_t y , int32_t i , int32_t n )
2006-11-15 01:16:55 +00:00
{
return probe_ ( 0 , x , y , i , n ) ;
}
2006-12-10 06:49:01 +00:00
2009-01-09 09:29:17 +00:00
static inline int32_t probesm ( int32_t x , int32_t y , int32_t i , int32_t n )
2006-11-15 01:16:55 +00:00
{
return probe_ ( 1 , x , y , i , n ) ;
}
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
// see menutriggers for why this is a sorry hack
// calling CONTROL_GetFunctionInput(); from input.c also would not work
// and probe_() must remain static
static int32_t Menu_EnterText ( int32_t x , int32_t y , char * t , int32_t dalen , int32_t c )
{
int32_t probeysave = probey ;
int32_t probeoutputx = M_Probe ( 0 , 0 , 0 , 1 ) ;
probey = probeysave ;
if ( ProbeTriggers ( AdvanceTrigger ) | | I_AdvanceTrigger ( ) )
{
I_AdvanceTriggerClear ( ) ;
return ( 1 ) ;
}
if ( probeoutputx = = - 1 )
{
I_ReturnTriggerClear ( ) ;
return ( - 1 ) ;
}
return G_EnterText ( x , y , t , dalen , c ) ;
}
2009-01-09 09:29:17 +00:00
int32_t menutext_ ( int32_t x , int32_t y , int32_t s , int32_t p , char * t , int32_t bits )
2006-04-13 20:47:06 +00:00
{
2009-01-09 09:29:17 +00:00
int16_t i , ac , centre ;
// int32_t ht = usehightile;
2006-04-13 20:47:06 +00:00
y - = 12 ;
i = centre = 0 ;
2006-11-14 21:35:50 +00:00
if ( x = = ( 320 > > 1 ) )
2006-04-13 20:47:06 +00:00
{
2006-11-14 21:35:50 +00:00
while ( * ( t + i ) )
2006-04-13 20:47:06 +00:00
{
2006-11-13 23:12:47 +00:00
if ( * ( t + i ) = = ' ' )
2006-04-13 20:47:06 +00:00
{
centre + = 5 ;
i + + ;
continue ;
}
ac = 0 ;
2006-11-13 23:12:47 +00:00
if ( * ( t + i ) > = ' 0 ' & & * ( t + i ) < = ' 9 ' )
2006-04-13 20:47:06 +00:00
ac = * ( t + i ) - ' 0 ' + BIGALPHANUM - 10 ;
2006-11-13 23:12:47 +00:00
else if ( * ( t + i ) > = ' a ' & & * ( t + i ) < = ' z ' )
2006-04-13 20:47:06 +00:00
ac = toupper ( * ( t + i ) ) - ' A ' + BIGALPHANUM ;
2006-11-13 23:12:47 +00:00
else if ( * ( t + i ) > = ' A ' & & * ( t + i ) < = ' Z ' )
2006-04-13 20:47:06 +00:00
ac = * ( t + i ) - ' A ' + BIGALPHANUM ;
2006-11-13 23:12:47 +00:00
else switch ( * ( t + i ) )
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
case ' - ' :
ac = BIGALPHANUM - 11 ;
break ;
case ' . ' :
ac = BIGPERIOD ;
break ;
case ' \' ' :
ac = BIGAPPOS ;
break ;
case ' , ' :
ac = BIGCOMMA ;
break ;
case ' ! ' :
2012-05-01 12:41:13 +00:00
ac = BIGX_ ;
2006-11-16 03:02:42 +00:00
break ;
case ' ? ' :
ac = BIGQ ;
break ;
case ' ; ' :
ac = BIGSEMI ;
break ;
case ' : ' :
ac = BIGSEMI ;
break ;
default :
centre + = 5 ;
i + + ;
continue ;
2006-11-15 01:16:55 +00:00
}
centre + = tilesizx [ ac ] - 1 ;
i + + ;
}
}
if ( centre )
x = ( 320 - centre - 10 ) > > 1 ;
2008-08-19 13:26:56 +00:00
// usehightile = (ht && r_downsize < 3);
2006-11-15 01:16:55 +00:00
while ( * t )
{
if ( * t = = ' ' )
{
x + = 5 ;
t + + ;
continue ;
}
ac = 0 ;
if ( * t > = ' 0 ' & & * t < = ' 9 ' )
ac = * t - ' 0 ' + BIGALPHANUM - 10 ;
else if ( * t > = ' a ' & & * t < = ' z ' )
ac = toupper ( * t ) - ' A ' + BIGALPHANUM ;
else if ( * t > = ' A ' & & * t < = ' Z ' )
ac = * t - ' A ' + BIGALPHANUM ;
else switch ( * t )
{
2006-11-16 03:02:42 +00:00
case ' - ' :
ac = BIGALPHANUM - 11 ;
break ;
case ' . ' :
ac = BIGPERIOD ;
break ;
case ' , ' :
ac = BIGCOMMA ;
break ;
case ' ! ' :
2012-05-01 12:41:13 +00:00
ac = BIGX_ ;
2006-11-16 03:02:42 +00:00
break ;
case ' \' ' :
ac = BIGAPPOS ;
break ;
case ' ? ' :
ac = BIGQ ;
break ;
case ' ; ' :
ac = BIGSEMI ;
break ;
case ' : ' :
ac = BIGCOLIN ;
break ;
default :
x + = 5 ;
t + + ;
continue ;
2006-04-13 20:47:06 +00:00
}
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( x < < 16 , y < < 16 , 65536L , 0 , ac , s , p , bits ) ;
2006-04-13 20:47:06 +00:00
x + = tilesizx [ ac ] ;
t + + ;
}
2008-08-19 13:26:56 +00:00
// usehightile = ht;
2006-04-13 20:47:06 +00:00
return ( x ) ;
}
2012-02-18 17:56:39 +00:00
// This function depends on the 'onbar' variable which should be set to the
// 'probey' indices where there's a slider bar.
2012-02-18 17:56:52 +00:00
static void sliderbar ( int32_t type , int32_t x , int32_t y , int32_t * p , int32_t dainc , int32_t damodify , int32_t s , int32_t pa , int32_t min , int32_t max )
2006-04-13 20:47:06 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t xloc ;
2006-04-13 20:47:06 +00:00
char rev ;
2006-11-15 01:16:55 +00:00
if ( dainc < 0 )
{
dainc = - dainc ;
rev = 1 ;
}
2006-04-13 20:47:06 +00:00
else rev = 0 ;
y - = 2 ;
2006-11-13 23:12:47 +00:00
if ( damodify )
2006-04-13 20:47:06 +00:00
{
2012-10-14 22:16:07 +00:00
if ( * p > = min & & * p < = max & & ( KB_KeyPressed ( sc_LeftArrow ) | | KB_KeyPressed ( sc_kpad_4 ) | | ( LMB & & ( WHEELUP | | mii < - 256 ) ) | |
BUTTON ( gamefunc_Turn_Left ) | | BUTTON ( gamefunc_Strafe_Left ) | | ( JOYSTICK_GetHat ( 0 ) & HAT_LEFT ) ) ) // && onbar) )
2006-04-13 20:47:06 +00:00
{
2008-07-29 05:43:47 +00:00
KB_ClearKeyDown ( sc_LeftArrow ) ;
KB_ClearKeyDown ( sc_kpad_4 ) ;
MOUSE_ClearButton ( WHEELUP_MOUSE ) ;
2012-06-03 16:11:22 +00:00
CONTROL_ClearButton ( gamefunc_Turn_Left ) ;
CONTROL_ClearButton ( gamefunc_Strafe_Left ) ;
JOYSTICK_ClearHat ( 0 ) ;
2008-07-29 05:43:47 +00:00
mii = 0 ;
if ( ! rev )
2006-04-13 20:47:06 +00:00
* p - = dainc ;
2008-07-29 05:43:47 +00:00
else * p + = dainc ;
if ( * p < min )
* p = min ;
if ( * p > max )
* p = max ;
2008-11-20 14:06:36 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-04-13 20:47:06 +00:00
}
2012-10-14 22:16:07 +00:00
if ( * p < = max & & * p > = min & & ( KB_KeyPressed ( sc_RightArrow ) | | KB_KeyPressed ( sc_kpad_6 ) | | ( LMB & & ( WHEELDOWN | | mii > 256 ) ) | |
BUTTON ( gamefunc_Turn_Right ) | | BUTTON ( gamefunc_Strafe_Right ) | | ( JOYSTICK_GetHat ( 0 ) & HAT_RIGHT ) ) ) //&& onbar) )
2006-04-13 20:47:06 +00:00
{
2008-07-29 05:43:47 +00:00
KB_ClearKeyDown ( sc_RightArrow ) ;
KB_ClearKeyDown ( sc_kpad_6 ) ;
MOUSE_ClearButton ( WHEELDOWN_MOUSE ) ;
2012-06-03 16:11:22 +00:00
CONTROL_ClearButton ( gamefunc_Turn_Right ) ;
CONTROL_ClearButton ( gamefunc_Strafe_Right ) ;
JOYSTICK_ClearHat ( 0 ) ;
2008-07-29 05:43:47 +00:00
mii = 0 ;
if ( ! rev )
2006-04-13 20:47:06 +00:00
* p + = dainc ;
2008-07-29 05:43:47 +00:00
else * p - = dainc ;
if ( * p > max )
* p = max ;
if ( * p < min )
* p = min ;
2008-11-20 14:06:36 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-04-13 20:47:06 +00:00
}
}
xloc = * p ;
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( ( x < < 16 ) + ( 22 < < ( 16 - type ) ) , ( y < < 16 ) - ( 3 < < ( 16 - type ) ) , 65536L > > type , 0 , SLIDEBAR , s , pa , 10 ) ;
2006-11-13 23:12:47 +00:00
if ( rev = = 0 )
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( ( x < < 16 ) + ( ( scale ( 64 , xloc - min , max - min ) + 1 ) < < ( 16 - type ) ) , ( y < < 16 ) + ( 1 < < ( 16 - type ) ) , 65536L > > type , 0 , SLIDEBAR + 1 , s , pa , 10 ) ;
2006-04-13 20:47:06 +00:00
else
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( ( x < < 16 ) + ( ( 65 - scale ( 64 , xloc - min , max - min ) ) < < ( 16 - type ) ) , ( y < < 16 ) + ( 1 < < ( 16 - type ) ) , 65536L > > type , 0 , SLIDEBAR + 1 , s , pa , 10 ) ;
2006-04-13 20:47:06 +00:00
}
2012-02-18 17:56:52 +00:00
# define bar(x,y,p,dainc,damodify,s,pa) sliderbar(0,x,y,p,dainc,damodify,s,pa,0,63);
# define barsm(x,y,p,dainc,damodify,s,pa) sliderbar(1,x,y,p,dainc,damodify,s,pa,0,63);
2006-04-13 20:47:06 +00:00
2009-01-09 09:29:17 +00:00
static void modval ( int32_t min , int32_t max , int32_t * p , int32_t dainc , int32_t damodify )
2006-04-13 20:47:06 +00:00
{
char rev ;
2006-11-15 01:16:55 +00:00
if ( dainc < 0 )
{
dainc = - dainc ;
rev = 1 ;
}
2006-04-13 20:47:06 +00:00
else rev = 0 ;
2006-11-13 23:12:47 +00:00
if ( damodify )
2006-04-13 20:47:06 +00:00
{
2006-11-13 23:12:47 +00:00
if ( rev = = 0 )
2006-04-13 20:47:06 +00:00
{
2012-10-14 22:16:07 +00:00
if ( KB_KeyPressed ( sc_LeftArrow ) | | KB_KeyPressed ( sc_kpad_4 ) | | ( LMB & & minfo . dyaw < - 256 ) | | BUTTON ( gamefunc_Turn_Left ) | |
BUTTON ( gamefunc_Strafe_Left ) | | ( JOYSTICK_GetHat ( 0 ) & HAT_LEFT ) ) // && onbar) )
2006-04-13 20:47:06 +00:00
{
2006-11-14 21:35:50 +00:00
KB_ClearKeyDown ( sc_LeftArrow ) ;
KB_ClearKeyDown ( sc_kpad_4 ) ;
2012-06-03 16:11:22 +00:00
CONTROL_ClearButton ( gamefunc_Turn_Left ) ;
CONTROL_ClearButton ( gamefunc_Strafe_Left ) ;
JOYSTICK_ClearHat ( 0 ) ;
2006-04-13 20:47:06 +00:00
* p - = dainc ;
2006-11-13 23:12:47 +00:00
if ( * p < min )
2007-02-28 09:12:41 +00:00
{
2007-03-01 00:50:59 +00:00
* p = max ;
2007-02-28 09:12:41 +00:00
if ( damodify = = 2 )
* p = min ;
2007-03-01 00:50:59 +00:00
}
2008-11-20 14:06:36 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2006-04-13 20:47:06 +00:00
}
2012-10-14 22:16:07 +00:00
if ( KB_KeyPressed ( sc_RightArrow ) | | KB_KeyPressed ( sc_kpad_6 ) | | ( LMB & & minfo . dyaw > 256 ) | | BUTTON ( gamefunc_Turn_Right ) | |
BUTTON ( gamefunc_Strafe_Right ) | | ( JOYSTICK_GetHat ( 0 ) & HAT_RIGHT ) ) //&& onbar) )
2006-04-13 20:47:06 +00:00
{
2006-11-14 21:35:50 +00:00
KB_ClearKeyDown ( sc_RightArrow ) ;
KB_ClearKeyDown ( sc_kpad_6 ) ;
2012-06-03 16:11:22 +00:00
CONTROL_ClearButton ( gamefunc_Turn_Right ) ;
CONTROL_ClearButton ( gamefunc_Strafe_Right ) ;
JOYSTICK_ClearHat ( 0 ) ;
2006-04-13 20:47:06 +00:00
* p + = dainc ;
2006-11-13 23:12:47 +00:00
if ( * p > max )
2007-02-28 09:12:41 +00:00
{
2007-03-01 00:50:59 +00:00
* p = min ;
2007-02-28 09:12:41 +00:00
if ( damodify = = 2 )
* p = max ;
2007-03-01 00:50:59 +00:00
}
2008-11-20 14:06:36 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2006-04-13 20:47:06 +00:00
}
}
else
{
2012-10-14 22:16:07 +00:00
if ( KB_KeyPressed ( sc_RightArrow ) | | KB_KeyPressed ( sc_kpad_6 ) | | ( LMB & & minfo . dyaw > 256 ) | | BUTTON ( gamefunc_Turn_Right ) | |
BUTTON ( gamefunc_Strafe_Right ) | | ( JOYSTICK_GetHat ( 0 ) & HAT_RIGHT ) ) //&& onbar ))
2006-04-13 20:47:06 +00:00
{
2006-11-14 21:35:50 +00:00
KB_ClearKeyDown ( sc_RightArrow ) ;
KB_ClearKeyDown ( sc_kpad_6 ) ;
2012-06-03 16:11:22 +00:00
CONTROL_ClearButton ( gamefunc_Turn_Right ) ;
CONTROL_ClearButton ( gamefunc_Strafe_Right ) ;
JOYSTICK_ClearHat ( 0 ) ;
2006-04-13 20:47:06 +00:00
* p - = dainc ;
2006-11-13 23:12:47 +00:00
if ( * p < min )
2007-02-28 09:12:41 +00:00
{
2007-03-01 00:50:59 +00:00
* p = max ;
2007-02-28 09:12:41 +00:00
if ( damodify = = 2 )
* p = min ;
2007-03-01 00:50:59 +00:00
}
2008-11-20 14:06:36 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2006-04-13 20:47:06 +00:00
}
2012-10-14 22:16:07 +00:00
if ( KB_KeyPressed ( sc_LeftArrow ) | | KB_KeyPressed ( sc_kpad_4 ) | | ( LMB & & minfo . dyaw < - 256 ) | | BUTTON ( gamefunc_Turn_Left ) | |
BUTTON ( gamefunc_Strafe_Left ) | | ( JOYSTICK_GetHat ( 0 ) & HAT_LEFT ) ) // && onbar) )
2006-04-13 20:47:06 +00:00
{
2006-11-14 21:35:50 +00:00
KB_ClearKeyDown ( sc_LeftArrow ) ;
KB_ClearKeyDown ( sc_kpad_4 ) ;
2012-06-03 16:11:22 +00:00
CONTROL_ClearButton ( gamefunc_Turn_Left ) ;
CONTROL_ClearButton ( gamefunc_Strafe_Left ) ;
JOYSTICK_ClearHat ( 0 ) ;
2006-04-13 20:47:06 +00:00
* p + = dainc ;
2006-11-13 23:12:47 +00:00
if ( * p > max )
2007-02-28 09:12:41 +00:00
{
2007-03-01 00:50:59 +00:00
* p = min ;
2007-02-28 09:12:41 +00:00
if ( damodify = = 2 )
* p = max ;
2007-03-01 00:50:59 +00:00
}
2008-11-20 14:06:36 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2006-04-13 20:47:06 +00:00
}
}
}
}
2007-02-05 01:33:08 +00:00
# define UNSELMENUSHADE 10
# define DISABLEDMENUSHADE 20
2008-08-26 08:39:45 +00:00
# define MENUHIGHLIGHT(x) probey==x?(sintable[(totalclock<<5)&2047]>>12):UNSELMENUSHADE
2006-04-21 05:11:57 +00:00
// #define MENUHIGHLIGHT(x) probey==x?-(sintable[(totalclock<<4)&2047]>>12):probey-x>=0?(probey-x)<<2:-((probey-x)<<2)
2006-04-13 20:47:06 +00:00
# define SHX(X) 0
// ((x==X)*(-sh))
// ((x==X)?1:2)
2012-08-19 12:56:51 +00:00
//#define MWIN(X) rotatesprite( 320<<15,200<<15,X,0,MENUSCREEN,-16,0,10+64,0,0,xdim-1,ydim-1)
//#define MWINXY(X,OX,OY) rotatesprite( ( 320+(OX) )<<15, ( 200+(OY) )<<15,X,0,MENUSCREEN,-16,0,10+64,0,0,xdim-1,ydim-1)
2006-04-13 20:47:06 +00:00
2011-12-25 15:34:06 +00:00
//extern int32_t G_LoadSaveHeader(char spot,struct savehead_ *saveh);
2006-04-13 20:47:06 +00:00
2010-08-02 08:13:51 +00:00
# pragma pack(push,1)
2011-12-25 15:34:06 +00:00
static savehead_t savehead ;
//static struct savehead_ savehead;
2010-08-02 08:13:51 +00:00
# pragma pack(pop)
2009-04-26 05:57:42 +00:00
//static int32_t volnum,levnum,plrskl,numplr;
2006-04-13 20:47:06 +00:00
//static char brdfn[BMAX_PATH];
2012-10-14 22:16:07 +00:00
static void M_DrawBackground ( void )
{
rotatesprite_fs ( 160 < < 16 , 200 < < 15 , 65536L , 0 , MENUSCREEN , 16 , 0 , 10 + 64 ) ;
}
2012-11-15 14:28:47 +00:00
static void M_DrawTopBar ( const char * caption )
2012-10-14 22:16:07 +00:00
{
rotatesprite_fs ( 160 < < 16 , 19 < < 16 , 65536L , 0 , MENUBAR , 16 , 0 , 10 ) ;
menutext ( 160 , 24 , 0 , 0 , caption ) ;
}
2008-11-20 14:06:36 +00:00
static void M_DisplaySaveGameList ( void )
2006-04-13 20:47:06 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t x , c = 160 ;
2006-04-13 20:47:06 +00:00
c + = 64 ;
2009-02-19 16:47:54 +00:00
for ( x = 0 ; x < = 108 ; x + = 12 )
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( ( c + 91 - 64 ) < < 16 , ( x + 56 ) < < 16 , 65536L , 0 , TEXTBOX , 24 , 0 , 10 ) ;
2006-04-13 20:47:06 +00:00
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( 22 < < 16 , 97 < < 16 , 65536L , 0 , WINDOWBORDER2 , 24 , 0 , 10 ) ;
rotatesprite_fs ( 180 < < 16 , 97 < < 16 , 65536L , 1024 , WINDOWBORDER2 , 24 , 0 , 10 ) ;
rotatesprite_fs ( 99 < < 16 , 50 < < 16 , 65536L , 512 , WINDOWBORDER1 , 24 , 0 , 10 ) ;
rotatesprite_fs ( 103 < < 16 , 144 < < 16 , 65536L , 1024 + 512 , WINDOWBORDER1 , 24 , 0 , 10 ) ;
2006-04-13 20:47:06 +00:00
2009-02-19 16:47:54 +00:00
for ( x = 0 ; x < = 9 ; x + + )
2011-12-21 18:41:38 +00:00
{
if ( ud . savegame [ x ] [ 0 ] )
{
2012-11-13 10:50:06 +00:00
if ( g_oldverSavegame [ x ] & & g_currentMenu ! = 360 + x )
{
// old version and not entering new name
char buf [ sizeof ( ud . savegame [ 0 ] ) ] ;
Bmemcpy ( buf , ud . savegame [ x ] , sizeof ( ud . savegame [ 0 ] ) ) ;
minitext ( c , 48 + ( 12 * x ) , buf , 13 , 10 + 16 ) ;
}
else
{
minitext ( c , 48 + ( 12 * x ) , ud . savegame [ x ] , 2 , 10 + 16 ) ;
}
2011-12-21 18:41:38 +00:00
}
}
2006-04-13 20:47:06 +00:00
}
2010-01-16 23:08:17 +00:00
extern int32_t g_quitDeadline ;
2006-04-13 20:47:06 +00:00
2009-01-09 09:29:17 +00:00
void G_CheckPlayerColor ( int32_t * color , int32_t prev_color )
2006-04-18 19:23:53 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t i , disallowed [ ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 17 , 18 , 19 , 20 , 22 } ;
2006-04-18 19:23:53 +00:00
2009-02-19 16:47:54 +00:00
for ( i = 0 ; i < ( signed ) ( sizeof ( disallowed ) / sizeof ( disallowed [ 0 ] ) ) ; i + + )
2006-11-15 01:16:55 +00:00
{
while ( * color = = disallowed [ i ] )
{
2006-11-13 23:12:47 +00:00
if ( * color > prev_color )
2006-04-18 19:23:53 +00:00
( * color ) + + ;
else ( * color ) - - ;
i = 0 ;
}
}
}
2011-12-21 18:41:38 +00:00
static void Menus_LoadSave_DisplayCommon1 ( void )
{
if ( lastsavehead ! = probey )
2011-12-25 15:34:06 +00:00
G_LoadSaveHeaderNew ( probey , & savehead ) ;
2011-12-21 18:41:38 +00:00
lastsavehead = probey ;
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( 101 < < 16 , 97 < < 16 , 65536L > > 1 , 512 , TILE_LOADSHOT , - 32 , 0 , 4 + 10 + 64 ) ;
2011-12-21 18:41:38 +00:00
2012-11-13 10:50:06 +00:00
if ( g_oldverSavegame [ probey ] )
2011-12-21 18:41:38 +00:00
{
2012-10-01 17:52:49 +00:00
menutext ( 53 , 70 , 0 , 0 , " Version " ) ;
menutext ( 48 , 90 , 0 , 0 , " Mismatch " ) ;
Bsprintf ( tempbuf , " Saved: %d.%d.%d %d-bit " , savehead . majorver , savehead . minorver ,
savehead . bytever , 8 * savehead . ptrsize ) ;
mgametext ( 31 , 104 , tempbuf , 0 , 2 + 8 + 16 ) ;
Bsprintf ( tempbuf , " Our: %d.%d.%d %d-bit " , SV_MAJOR_VER , SV_MINOR_VER , BYTEVERSION ,
( int32_t ) ( 8 * sizeof ( intptr_t ) ) ) ;
2012-10-03 15:29:12 +00:00
mgametext ( 31 + 16 , QUOTE_SAVE_BAD_VERSION , tempbuf , 0 , 2 + 8 + 16 ) ;
2011-12-21 18:41:38 +00:00
}
}
2012-10-14 22:16:07 +00:00
void Menu_Main ( void )
{
int32_t margin = MENU_MARGIN_CENTER ;
int32_t x ;
enum
{
M_MAIN_EPISODE ,
M_MAIN_OPTIONS ,
M_MAIN_LOAD ,
M_MAIN_STORY ,
M_MAIN_CREDITS ,
M_MAIN_QUIT
} ;
rotatesprite_fs ( margin < < 16 , 28 < < 16 , 65536L , 0 , INGAMEDUKETHREEDEE , 0 , 0 , 10 ) ;
if ( PLUTOPAK ) // JBF 20030804
rotatesprite_fs ( ( margin + 100 ) < < 16 , 36 < < 16 , 65536L , 0 , PLUTOPAKSPRITE + 2 , ( sintable [ ( totalclock < < 4 ) & 2047 ] > > 11 ) , 0 , 2 + 8 ) ;
menutext ( margin , 67 , MENUHIGHLIGHT ( 0 ) , 0 , " New Game " ) ;
// menutext(c,67+16,0,1,"NETWORK GAME");
menutext ( margin , 67 + 16 /*+16*/ , MENUHIGHLIGHT ( 1 ) , 0 , " Options " ) ;
menutext ( margin , 67 + 16 + 16 /*+16*/ , MENUHIGHLIGHT ( 2 ) , 0 , " Load Game " ) ;
if ( ! VOLUMEALL )
menutext ( margin , 67 + 16 + 16 + 16 /*+16*/ , MENUHIGHLIGHT ( 3 ) , 0 , " How To Order " ) ;
else
menutext ( margin , 67 + 16 + 16 + 16 /*+16*/ , MENUHIGHLIGHT ( 3 ) , 0 , " Help " ) ;
menutext ( margin , 67 + 16 + 16 + 16 + 16 /*+16*/ , MENUHIGHLIGHT ( 4 ) , 0 , " Credits " ) ;
menutext ( margin , 67 + 16 + 16 + 16 + 16 + 16 /*+16*/ , MENUHIGHLIGHT ( 5 ) , 0 , " Quit " ) ;
x = M_Probe ( margin , 67 , 16 , 6 ) ;
if ( x > = 0 )
{
if ( ( g_netServer | | ud . multimode > 1 ) & & x = = 0 & & ud . recstat ! = 2 )
{
last_zero = 0 ;
M_ChangeMenu ( 600 ) ;
}
else
{
last_zero = x ;
switch ( x )
{
case M_MAIN_EPISODE :
M_ChangeMenu ( MENU_EPISODE ) ;
break ;
//case 1: break;//ChangeToMenu(20001);break; // JBF 20031128: I'm taking over the TEN menu option
case M_MAIN_OPTIONS :
M_ChangeMenu ( MENU_OPTIONS ) ;
break ; // JBF 20031205: was 200
case M_MAIN_LOAD :
M_ChangeMenu ( MENU_LOAD ) ;
break ;
case M_MAIN_STORY :
KB_FlushKeyboardQueue ( ) ;
M_ChangeMenu ( MENU_STORY ) ;
break ;
case M_MAIN_CREDITS :
M_ChangeMenu ( MENU_CREDITS ) ;
break ;
case M_MAIN_QUIT :
M_ChangeMenu ( MENU_QUIT ) ;
break ;
}
}
}
if ( KB_KeyPressed ( sc_Q ) ) M_ChangeMenu ( MENU_QUIT ) ;
if ( x = = - 1 & & ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME | | ud . recstat = = 2 ) )
{
g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
{
ready2send = 1 ;
totalclock = ototalclock ;
}
}
}
2008-11-20 14:06:36 +00:00
void M_DisplayMenus ( void )
2006-04-13 20:47:06 +00:00
{
CACHE1D_FIND_REC * dir ;
2012-10-14 22:16:07 +00:00
int32_t margin , x , i ;
2009-01-09 09:29:17 +00:00
int32_t l , m ;
2012-07-01 22:11:33 +00:00
const char * p = NULL ;
2006-04-13 20:47:06 +00:00
2009-01-09 09:29:17 +00:00
Net_GetPackets ( ) ;
2006-04-13 20:47:06 +00:00
{
2006-11-13 23:12:47 +00:00
if ( buttonstat ! = 0 & & ! onbar )
2006-04-13 20:47:06 +00:00
{
x = MOUSE_GetButtons ( ) < < 3 ;
2006-11-14 21:35:50 +00:00
if ( x ) buttonstat = x < < 3 ;
2006-04-13 20:47:06 +00:00
else buttonstat = 0 ;
}
else
buttonstat = MOUSE_GetButtons ( ) ;
}
2007-08-27 06:46:31 +00:00
if ( ( g_player [ myconnectindex ] . ps - > gm & MODE_MENU ) = = 0 )
2006-04-13 20:47:06 +00:00
{
walock [ TILE_LOADSHOT ] = 1 ;
return ;
}
2012-12-10 18:17:57 +00:00
if ( G_HaveEvent ( EVENT_DISPLAYMENU ) )
2012-05-16 00:45:10 +00:00
VM_OnEvent ( EVENT_DISPLAYMENU , g_player [ screenpeek ] . ps - > i , screenpeek , - 1 , 0 ) ;
2006-04-13 20:47:06 +00:00
2007-08-27 06:46:31 +00:00
g_player [ myconnectindex ] . ps - > gm & = ( 0xff - MODE_TYPE ) ;
g_player [ myconnectindex ] . ps - > fta = 0 ;
2006-04-13 20:47:06 +00:00
2012-02-04 14:30:39 +00:00
// x = 0;
2006-04-13 20:47:06 +00:00
sh = 4 - ( sintable [ ( totalclock < < 4 ) & 2047 ] > > 11 ) ;
2007-01-26 00:28:44 +00:00
2012-02-04 14:30:39 +00:00
// black translucent background
2012-02-11 11:52:19 +00:00
if ( ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) | | ud . recstat = = 2 )
2012-02-18 17:56:39 +00:00
if ( g_currentMenu ! = 231 & & g_currentMenu ! = 232 ) // not in 'color correction' menu
fade_screen_black ( 1 ) ;
2007-01-26 00:28:44 +00:00
2012-10-14 22:16:07 +00:00
if ( ! ( g_currentMenu > = 1000 & & g_currentMenu < = 2999 & & g_currentMenu > = MENU_LOAD & & g_currentMenu < = 369 ) )
2008-11-20 14:06:36 +00:00
G_UpdateScreenArea ( ) ;
2006-04-13 20:47:06 +00:00
2006-12-28 20:36:38 +00:00
if ( KB_KeyPressed ( sc_Q ) )
2006-04-20 09:03:44 +00:00
{
2008-11-20 14:06:36 +00:00
switch ( g_currentMenu )
2006-12-28 20:36:38 +00:00
{
2012-10-14 22:16:07 +00:00
case MENU_SELECTMAP :
case MENU_KEYBOARDASSIGN :
2006-12-28 20:36:38 +00:00
case 360 :
case 361 :
case 362 :
case 363 :
case 364 :
case 365 :
case 366 :
case 367 :
case 368 :
case 369 :
2012-10-14 22:16:07 +00:00
case MENU_QUIT :
case MENU_QUITTOTITLE :
case MENU_QUIT2 :
2006-12-28 20:36:38 +00:00
case 603 :
2012-10-14 22:16:07 +00:00
case MENU_ADULTPASSWORD :
2006-12-28 20:36:38 +00:00
case 20003 :
case 20005 :
break ;
default :
2008-11-20 14:06:36 +00:00
if ( g_currentMenu > = 0 )
2006-12-28 20:36:38 +00:00
{
2008-11-20 14:06:36 +00:00
last_menu = g_currentMenu ;
2007-02-05 01:33:08 +00:00
last_menu_pos = probey ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_QUIT2 ) ;
2006-12-28 20:36:38 +00:00
}
break ;
}
2006-04-20 09:03:44 +00:00
}
2007-01-26 00:28:44 +00:00
2008-11-20 14:06:36 +00:00
switch ( g_currentMenu )
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
case 25000 :
2012-03-26 05:07:12 +00:00
mgametext ( 160 , 90 , " Select a save spot before " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 90 + 9 , " you quick restore. " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
x = M_Probe ( 186 , 124 , 0 , 1 ) ;
2006-11-16 03:02:42 +00:00
if ( x > = - 1 )
{
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
ready2send = 1 ;
totalclock = ototalclock ;
2006-04-13 20:47:06 +00:00
}
2007-08-27 06:46:31 +00:00
g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
2006-11-16 03:02:42 +00:00
}
break ;
2012-10-14 22:16:07 +00:00
case MENU_BUYDUKE :
2008-11-20 14:06:36 +00:00
x = M_Probe ( 326 , 190 , 0 , 1 ) ;
2012-03-26 05:07:12 +00:00
mgametext ( 160 , 41 - 8 , " You are playing the shareware " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 50 - 8 , " version of Duke Nukem 3D. While " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 59 - 8 , " this version is really cool, you " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 68 - 8 , " are missing over 75%% of the total " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 77 - 8 , " game, along with other great extras " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 86 - 8 , " and games, which you'll get when " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 95 - 8 , " you order the complete version and " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 104 - 8 , " get the final three episodes. " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 104 + 8 , " Please read the 'How To Order' item " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 113 + 8 , " on the main menu or visit " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 122 + 8 , " http://www.eduke32.com " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 131 + 8 , " to upgrade to the full registered " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 139 + 8 , " version of Duke Nukem 3D. " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 148 + 16 , " Press any key... " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
if ( x > = - 1 ) M_ChangeMenu ( MENU_EPISODE ) ;
2006-11-16 03:02:42 +00:00
break ;
case 20001 :
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Network Game " ) ;
2006-11-16 03:02:42 +00:00
2008-11-20 14:06:36 +00:00
x = M_Probe ( 160 , 100 - 18 , 18 , 3 ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
if ( x = = - 1 ) M_ChangeMenu ( MENU_MAIN ) ;
else if ( x = = 2 ) M_ChangeMenu ( 20010 ) ;
else if ( x = = 1 ) M_ChangeMenu ( 20020 ) ;
else if ( x = = 0 ) M_ChangeMenu ( 20002 ) ;
2006-11-16 03:02:42 +00:00
2012-03-26 05:07:12 +00:00
menutext ( 160 , 100 - 18 , MENUHIGHLIGHT ( 0 ) , 0 , " Player Setup " ) ;
menutext ( 160 , 100 , MENUHIGHLIGHT ( 1 ) , 0 , " Join Game " ) ;
menutext ( 160 , 100 + 18 , MENUHIGHLIGHT ( 2 ) , 0 , " Host Game " ) ;
2006-11-16 03:02:42 +00:00
break ;
case 20002 :
case 20003 :
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Player Setup " ) ;
margin = MENU_MARGIN_REGULAR ;
2006-11-16 03:02:42 +00:00
{
2012-10-14 22:16:07 +00:00
int32_t io , ii , yy = 37 , d = margin + 140 , enabled ;
2012-07-01 22:11:33 +00:00
const char * opts [ ] =
2007-08-25 01:05:00 +00:00
{
" Name " ,
" - " ,
" Color " ,
" - " ,
" Team " ,
" - " ,
" - " ,
" Auto aim " ,
" Mouse aim " ,
" - " ,
" - " ,
2008-07-24 14:08:56 +00:00
" Switch weapons on pickup " ,
" Switch weapons when empty " ,
2007-08-25 01:05:00 +00:00
" - " ,
" - " ,
" Multiplayer macros " ,
NULL
} ;
2007-01-26 00:28:44 +00:00
x = ud . color ;
if ( probey = = 2 )
2008-11-20 14:06:36 +00:00
x = G_GetTeamPalette ( ud . team ) ;
2007-02-05 01:33:08 +00:00
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( ( 260 ) < < 16 , ( 24 + ( tilesizy [ APLAYER ] > > 1 ) ) < < 16 , 49152L , 0 , 1441 - ( ( ( ( 4 - ( totalclock > > 4 ) ) ) & 3 ) * 5 ) , 0 , x , 10 ) ;
2007-01-26 00:28:44 +00:00
for ( ii = io = 0 ; opts [ ii ] ; ii + + )
2006-11-16 03:02:42 +00:00
{
2007-01-26 00:28:44 +00:00
if ( opts [ ii ] [ 0 ] = = ' - ' & & ! opts [ ii ] [ 1 ] )
{
if ( io < = probey ) yy + = 4 ;
continue ;
}
if ( io < probey ) yy + = 8 ;
io + + ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2007-02-05 01:33:08 +00:00
2008-11-20 14:06:36 +00:00
if ( g_currentMenu = = 20002 )
2006-11-16 03:02:42 +00:00
{
2012-10-14 22:16:07 +00:00
x = probesm ( margin , yy + 5 , 0 , io ) ;
2006-11-16 03:02:42 +00:00
2007-01-26 00:28:44 +00:00
if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_OPTIONS ) ;
2007-01-26 00:28:44 +00:00
probey = 3 ;
break ;
}
2006-11-16 03:02:42 +00:00
2007-01-26 00:28:44 +00:00
for ( ii = io = 0 ; opts [ ii ] ; ii + + )
{
if ( opts [ ii ] [ 0 ] = = ' - ' & & ! opts [ ii ] [ 1 ] )
continue ;
enabled = 1 ;
switch ( io )
{
case 0 :
if ( x = = io )
{
2008-11-20 14:06:36 +00:00
strcpy ( buf , szPlayerName ) ;
2007-01-26 00:28:44 +00:00
inputloc = strlen ( buf ) ;
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( 20003 ) ;
2006-04-18 16:30:15 +00:00
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
2007-01-26 00:28:44 +00:00
}
break ;
2006-04-18 17:34:47 +00:00
2007-01-26 00:28:44 +00:00
case 1 :
2007-02-05 01:33:08 +00:00
i = ud . color ;
2007-01-26 00:28:44 +00:00
if ( x = = io )
{
ud . color + + ;
if ( ud . color > 23 )
ud . color = 0 ;
2009-01-09 09:29:17 +00:00
G_CheckPlayerColor ( ( int32_t * ) & ud . color , - 1 ) ;
2007-01-26 00:28:44 +00:00
}
2009-01-09 09:29:17 +00:00
modval ( 0 , 23 , ( int32_t * ) & ud . color , 1 , probey = = 1 ) ;
G_CheckPlayerColor ( ( int32_t * ) & ud . color , i ) ;
2007-01-26 00:28:44 +00:00
if ( ud . color ! = i )
2008-11-20 14:06:36 +00:00
G_UpdatePlayerFromMenu ( ) ;
2007-01-26 00:28:44 +00:00
break ;
2006-04-18 06:01:16 +00:00
2007-01-26 00:28:44 +00:00
case 2 :
i = ud . team ;
if ( x = = io )
{
ud . team + + ;
if ( ud . team = = 4 )
ud . team = 0 ;
2007-02-05 01:33:08 +00:00
}
2009-01-09 09:29:17 +00:00
modval ( 0 , 3 , ( int32_t * ) & ud . team , 1 , probey = = 2 ) ;
2007-01-26 00:28:44 +00:00
if ( ud . team ! = i )
2008-11-20 14:06:36 +00:00
G_UpdatePlayerFromMenu ( ) ;
2007-01-26 00:28:44 +00:00
break ;
2006-08-18 23:52:26 +00:00
2007-01-26 00:28:44 +00:00
case 3 :
2007-08-27 00:20:15 +00:00
i = ud . config . AutoAim ;
2007-01-26 00:28:44 +00:00
if ( x = = io )
2007-08-27 00:20:15 +00:00
ud . config . AutoAim = ( ud . config . AutoAim = = 2 ) ? 0 : ud . config . AutoAim + 1 ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 2 , ( int32_t * ) & ud . config . AutoAim , 1 , probey = = 3 ) ;
2007-08-27 00:20:15 +00:00
if ( ud . config . AutoAim ! = i )
2008-11-20 14:06:36 +00:00
G_UpdatePlayerFromMenu ( ) ;
2007-01-26 00:28:44 +00:00
break ;
case 4 :
i = ud . mouseaiming ;
if ( x = = io )
ud . mouseaiming = ! ud . mouseaiming ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . mouseaiming , 1 , probey = = 4 ) ;
2007-01-26 00:28:44 +00:00
if ( ud . mouseaiming ! = i )
2008-11-20 14:06:36 +00:00
G_UpdatePlayerFromMenu ( ) ;
2007-01-26 00:28:44 +00:00
break ;
2007-02-05 01:33:08 +00:00
2007-01-26 00:28:44 +00:00
case 5 :
i = 0 ;
if ( ud . weaponswitch & 1 )
2012-08-27 03:52:38 +00:00
{
2007-01-26 00:28:44 +00:00
i = 1 ;
2012-08-27 03:52:38 +00:00
if ( ud . weaponswitch & 4 )
i = 2 ;
}
l = i ;
2007-01-26 00:28:44 +00:00
if ( x = = io )
2012-08-27 03:52:38 +00:00
i = ( i = = 2 ) ? 0 : i + 1 ;
modval ( 0 , 2 , ( int32_t * ) & i , 1 , probey = = 5 ) ;
if ( i ! = l )
2007-01-26 00:28:44 +00:00
{
2012-08-27 03:52:38 +00:00
if ( i > 0 )
{
ud . weaponswitch | = 1 ;
if ( i = = 2 )
ud . weaponswitch | = 4 ;
else
ud . weaponswitch & = ~ 4 ;
}
else
ud . weaponswitch & = ~ ( 1 | 4 ) ;
2008-11-20 14:06:36 +00:00
G_UpdatePlayerFromMenu ( ) ;
2007-01-26 00:28:44 +00:00
}
break ;
case 6 :
i = 0 ;
if ( ud . weaponswitch & 2 )
i = 1 ;
if ( x = = io )
i = 1 - i ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & i , 1 , probey = = 6 ) ;
2007-01-26 00:28:44 +00:00
if ( ( ud . weaponswitch & 2 & & ! i ) | | ( ! ( ud . weaponswitch & 2 ) & & i ) )
{
ud . weaponswitch ^ = 2 ;
2008-11-20 14:06:36 +00:00
G_UpdatePlayerFromMenu ( ) ;
2007-02-05 01:33:08 +00:00
}
2007-01-26 00:28:44 +00:00
break ;
case 7 :
if ( x = = io )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 20004 ) ;
2007-01-26 00:28:44 +00:00
}
break ;
2006-05-05 07:10:36 +00:00
2007-01-26 00:28:44 +00:00
default :
break ;
}
io + + ;
}
}
else
2006-05-05 07:10:36 +00:00
{
2012-06-03 16:11:22 +00:00
// because OSD_StripColors needs a valid target and tempbuf is used in _EnterText()
2008-10-14 08:40:59 +00:00
char dummybuf [ 64 ] ;
2012-06-03 16:11:22 +00:00
x = Menu_EnterText ( d - 50 , 37 , buf , 30 , 0 ) ;
2007-01-26 00:28:44 +00:00
2010-05-02 23:27:30 +00:00
while ( Bstrlen ( OSD_StripColors ( dummybuf , buf ) ) > 10 )
2007-01-26 00:28:44 +00:00
{
buf [ Bstrlen ( buf ) - 1 ] = ' \0 ' ;
inputloc - - ;
}
if ( x )
{
if ( x = = 1 )
{
2008-11-20 14:06:36 +00:00
if ( buf [ 0 ] & & Bstrcmp ( szPlayerName , buf ) )
2007-01-26 00:28:44 +00:00
{
2008-11-20 14:06:36 +00:00
Bstrcpy ( szPlayerName , buf ) ;
2009-12-17 11:17:48 +00:00
Net_SendClientInfo ( ) ;
2007-01-26 00:28:44 +00:00
}
// send name update
}
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
2007-01-26 00:28:44 +00:00
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( 20002 ) ;
2007-01-26 00:28:44 +00:00
}
2006-05-05 07:10:36 +00:00
}
2007-01-26 00:28:44 +00:00
yy = 37 ;
2006-11-15 01:16:55 +00:00
{
2007-01-26 00:28:44 +00:00
for ( ii = io = 0 ; opts [ ii ] ; ii + + )
2006-11-15 01:16:55 +00:00
{
2007-01-26 00:28:44 +00:00
if ( opts [ ii ] [ 0 ] = = ' - ' & & ! opts [ ii ] [ 1 ] )
2006-11-16 03:02:42 +00:00
{
2007-01-26 00:28:44 +00:00
yy + = 4 ;
continue ;
2006-11-16 03:02:42 +00:00
}
2007-01-26 00:28:44 +00:00
enabled = 1 ;
switch ( io )
{
case 0 :
2008-11-20 14:06:36 +00:00
if ( g_currentMenu = = 20002 )
2007-01-26 00:28:44 +00:00
{
2008-11-20 14:06:36 +00:00
mgametext ( d - 50 , yy , szPlayerName , MENUHIGHLIGHT ( io ) , 2 + 8 + 16 ) ;
2007-01-26 00:28:44 +00:00
}
break ;
2006-04-13 20:47:06 +00:00
2007-01-26 00:28:44 +00:00
case 1 :
2008-05-15 03:16:38 +00:00
{
2012-07-01 22:11:33 +00:00
const char * s [ ] =
{ " Auto " , " " , " " , " " , " " , " " , " " , " " , " " , " Blue " , " Red " , " Green " , " Gray " , " Dark gray " , " Dark green " , " Brown " ,
" Dark blue " , " " , " " , " " , " " , " Bright red " , " " , " Yellow " , " " , " "
} ;
2008-07-22 10:56:22 +00:00
mgametext ( d - 50 , yy , s [ ud . color ] , MENUHIGHLIGHT ( io ) , 2 + 8 + 16 ) ;
2008-05-15 03:16:38 +00:00
}
break ;
2006-04-13 20:47:06 +00:00
2007-01-26 00:28:44 +00:00
case 2 :
2008-05-15 03:16:38 +00:00
{
2012-07-01 22:11:33 +00:00
const char * s [ ] = { " Blue " , " Red " , " Green " , " Gray " } ;
2008-07-22 10:56:22 +00:00
mgametext ( d - 50 , yy , s [ ud . team ] , MENUHIGHLIGHT ( io ) , 2 + 8 + 16 ) ;
2008-05-15 03:16:38 +00:00
}
break ;
2006-04-18 06:01:16 +00:00
2007-01-26 00:28:44 +00:00
case 3 :
2008-05-15 03:16:38 +00:00
{
2012-07-01 22:11:33 +00:00
const char * s [ ] = { " Off " , " All weapons " , " Bullets only " } ;
2008-07-22 10:56:22 +00:00
mgametext ( d - 50 , yy , s [ ud . config . AutoAim ] , MENUHIGHLIGHT ( io ) , 2 + 8 + 16 ) ;
2008-05-15 03:16:38 +00:00
}
break ;
2006-11-16 03:02:42 +00:00
2007-01-26 00:28:44 +00:00
case 4 :
2008-07-22 10:56:22 +00:00
mgametext ( d - 50 , yy , ud . mouseaiming ? " Hold button " : " Toggle on/off " , MENUHIGHLIGHT ( io ) , 2 + 8 + 16 ) ;
2007-01-26 00:28:44 +00:00
break ;
2006-04-19 08:00:09 +00:00
2007-01-26 00:28:44 +00:00
case 5 :
2012-08-27 03:52:38 +00:00
{
const char * s [ ] = { " Off " , " All weapons " , " Fav priority " } ;
i = 0 ;
if ( ud . weaponswitch & 1 )
{
i = 1 ;
if ( ud . weaponswitch & 4 )
i = 2 ;
}
2012-09-13 07:02:56 +00:00
mgametext ( d + 45 , yy , s [ i ] , MENUHIGHLIGHT ( io ) , 2 + 8 + 16 ) ;
2012-08-27 03:52:38 +00:00
}
2007-01-26 00:28:44 +00:00
break ;
2007-02-05 01:33:08 +00:00
2007-01-26 00:28:44 +00:00
case 6 :
2012-09-13 07:02:56 +00:00
mgametext ( d + 45 , yy , ud . weaponswitch & 2 ? " On " : " Off " , MENUHIGHLIGHT ( io ) , 2 + 8 + 16 ) ;
2007-01-26 00:28:44 +00:00
break ;
2008-11-11 13:24:05 +00:00
2007-01-26 00:28:44 +00:00
default :
break ;
}
2012-10-14 22:16:07 +00:00
mgametextpal ( margin , yy , opts [ ii ] , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , 10 ) ;
2007-01-26 00:28:44 +00:00
io + + ;
yy + = 8 ;
}
}
2006-04-22 06:10:28 +00:00
2007-01-26 00:28:44 +00:00
break ;
}
2006-11-16 03:02:42 +00:00
case 20004 :
case 20005 :
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Multiplayer Macros " ) ;
2006-11-16 03:02:42 +00:00
2008-11-20 14:06:36 +00:00
if ( g_currentMenu = = 20004 )
2006-11-16 03:02:42 +00:00
{
x = probesm ( 24 , 45 , 8 , 10 ) ;
if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 20002 ) ;
2009-10-01 05:05:19 +00:00
probey = 7 ;
2006-04-22 06:10:28 +00:00
}
2006-11-16 03:02:42 +00:00
else if ( x > = 0 & & x < = 9 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
strcpy ( buf , ud . ridecule [ x ] ) ;
inputloc = strlen ( buf ) ;
2007-02-05 01:33:08 +00:00
last_menu_pos = probey ;
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( 20005 ) ;
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
2006-11-16 03:02:42 +00:00
}
}
else
{
2012-06-03 16:11:22 +00:00
x = Menu_EnterText ( 26 , 40 + ( 8 * probey ) , buf , 34 , 0 ) ;
2006-11-16 03:02:42 +00:00
if ( x )
{
if ( x = = 1 )
2006-11-15 01:16:55 +00:00
{
2007-02-05 01:33:08 +00:00
Bstrcpy ( ud . ridecule [ last_menu_pos ] , buf ) ;
2006-11-15 01:16:55 +00:00
}
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( 20004 ) ;
2006-11-16 03:02:42 +00:00
}
}
2009-02-19 16:47:54 +00:00
for ( i = 0 ; i < 10 ; i + + )
2006-11-16 03:02:42 +00:00
{
2008-11-20 14:06:36 +00:00
if ( g_currentMenu = = 20005 & & i = = last_menu_pos ) continue ;
2008-07-22 10:56:22 +00:00
mgametextpal ( 26 , 40 + ( i < < 3 ) , ud . ridecule [ i ] , MENUHIGHLIGHT ( i ) , 0 ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-22 22:33:52 +00:00
2012-03-26 05:07:12 +00:00
mgametext ( 160 , 144 , " Activate in-game with SHIFT-F# " , 0 , 2 + 8 + 16 ) ;
2006-04-22 06:10:28 +00:00
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
2006-12-05 00:16:33 +00:00
#if 0
2006-11-16 03:02:42 +00:00
case 20010 :
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Host Network Game " ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
x = M_Probe ( 46 , 50 , 80 , 2 ) ;
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
{
2008-11-20 14:06:36 +00:00
ChangeToMenu ( 20001 ) ;
2006-11-16 03:02:42 +00:00
probey = 2 ;
}
2008-11-20 14:06:36 +00:00
else if ( x = = 0 ) ChangeToMenu ( 20011 ) ;
2006-11-16 03:02:42 +00:00
2012-03-26 05:07:12 +00:00
menutext ( 40 , 50 , 0 , 0 , " Game Options " ) ;
minitext ( 90 , 60 , " Game Type " , 2 , 26 ) ;
minitext ( 90 , 60 + 8 , " Episode " , 2 , 26 ) ;
minitext ( 90 , 60 + 8 + 8 , " Level " , 2 , 26 ) ;
minitext ( 90 , 60 + 8 + 8 + 8 , " Monsters " , 2 , 26 ) ;
2006-11-16 03:02:42 +00:00
if ( ud . m_coop = = 0 )
2012-03-26 05:07:12 +00:00
minitext ( 90 , 60 + 8 + 8 + 8 + 8 , " Markers " , 2 , 26 ) ;
2006-11-16 03:02:42 +00:00
else if ( ud . m_coop = = 1 )
2012-03-26 05:07:12 +00:00
minitext ( 90 , 60 + 8 + 8 + 8 + 8 , " Friendly Fire " , 2 , 26 ) ;
minitext ( 90 , 60 + 8 + 8 + 8 + 8 + 8 , " User Map " , 2 , 26 ) ;
2006-11-16 03:02:42 +00:00
2008-11-20 14:06:36 +00:00
mgametext ( 90 + 60 , 60 , GametypeNames [ ud . m_coop ] , 0 , 26 ) ;
2006-11-16 03:02:42 +00:00
2008-11-20 14:06:36 +00:00
minitext ( 90 + 60 , 60 + 8 , EpisodeNames [ ud . m_volume_number ] , 0 , 26 ) ;
2006-12-04 22:05:30 +00:00
minitext ( 90 + 60 , 60 + 8 + 8 , level_names [ MAXLEVELS * ud . m_volume_number + ud . m_level_number ] , 0 , 26 ) ;
2006-11-16 03:02:42 +00:00
if ( ud . m_monsters_off = = 0 | | ud . m_player_skill > 0 )
2008-11-20 14:06:36 +00:00
minitext ( 90 + 60 , 60 + 8 + 8 + 8 , SkillNames [ ud . m_player_skill ] , 0 , 26 ) ;
2012-03-26 05:07:12 +00:00
else minitext ( 90 + 60 , 60 + 8 + 8 + 8 , " None " , 0 , 28 ) ;
2006-11-16 03:02:42 +00:00
if ( ud . m_coop = = 0 )
{
2012-03-26 05:07:12 +00:00
if ( ud . m_marker ) minitext ( 90 + 60 , 60 + 8 + 8 + 8 + 8 , " On " , 0 , 26 ) ;
else minitext ( 90 + 60 , 60 + 8 + 8 + 8 + 8 , " Off " , 0 , 26 ) ;
2006-11-16 03:02:42 +00:00
}
else if ( ud . m_coop = = 1 )
{
2012-03-26 05:07:12 +00:00
if ( ud . m_ffire ) minitext ( 90 + 60 , 60 + 8 + 8 + 8 + 8 , " On " , 0 , 26 ) ;
else minitext ( 90 + 60 , 60 + 8 + 8 + 8 + 8 , " Off " , 0 , 26 ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
menutext ( 40 , 50 + 80 , 0 , 0 , " Launch Game " ) ;
2006-11-16 03:02:42 +00:00
break ;
case 20011 :
c = ( 320 > > 1 ) - 120 ;
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Net Game Options " ) ;
2006-11-16 03:02:42 +00:00
2008-11-20 14:06:36 +00:00
x = M_Probe ( c , 57 - 8 , 16 , 8 ) ;
2006-11-16 03:02:42 +00:00
switch ( x )
{
case - 1 :
2008-11-20 14:06:36 +00:00
ChangeToMenu ( 20010 ) ;
2006-11-16 03:02:42 +00:00
break ;
case 0 :
ud . m_coop + + ;
if ( ud . m_coop = = 3 ) ud . m_coop = 0 ;
break ;
case 1 :
if ( ! VOLUMEONE )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
ud . m_volume_number + + ;
2008-11-20 14:06:36 +00:00
if ( ud . m_volume_number = = g_numVolumes ) ud . m_volume_number = 0 ;
2006-11-16 03:02:42 +00:00
if ( ud . m_volume_number = = 0 & & ud . m_level_number > 6 )
ud . m_level_number = 0 ;
if ( ud . m_level_number > 10 ) ud . m_level_number = 0 ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
break ;
case 2 :
ud . m_level_number + + ;
if ( ! VOLUMEONE )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( ud . m_volume_number = = 0 & & ud . m_level_number > 6 )
ud . m_level_number = 0 ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
else
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( ud . m_volume_number = = 0 & & ud . m_level_number > 5 )
ud . m_level_number = 0 ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
if ( ud . m_level_number > 10 ) ud . m_level_number = 0 ;
2006-11-15 01:16:55 +00:00
break ;
2006-11-16 03:02:42 +00:00
case 3 :
if ( ud . m_monsters_off = = 1 & & ud . m_player_skill > 0 )
ud . m_monsters_off = 0 ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( ud . m_monsters_off = = 0 )
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
ud . m_player_skill + + ;
if ( ud . m_player_skill > 3 )
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
ud . m_player_skill = 0 ;
ud . m_monsters_off = 1 ;
2006-04-13 20:47:06 +00:00
}
}
2006-11-16 03:02:42 +00:00
else ud . m_monsters_off = 0 ;
break ;
case 4 :
if ( ud . m_coop = = 0 )
ud . m_marker = ! ud . m_marker ;
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 5 :
if ( ud . m_coop = = 1 )
ud . m_ffire = ! ud . m_ffire ;
break ;
case 6 :
// pick the user map
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 7 :
2008-11-20 14:06:36 +00:00
ChangeToMenu ( 20010 ) ;
2006-04-13 20:47:06 +00:00
break ;
2006-11-16 03:02:42 +00:00
}
c + = 40 ;
2012-03-26 05:07:12 +00:00
// if(ud.m_coop==1) mgametext(c+70,57-7-9,"Cooperative Play",0,2+8+16);
// else if(ud.m_coop==2) mgametext(c+70,57-7-9,"DukeMatch (No Spawn)",0,2+8+16);
// else mgametext(c+70,57-7-9,"DukeMatch (Spawn)",0,2+8+16);
2008-11-20 14:06:36 +00:00
mgametext ( c + 70 , 57 - 7 - 9 , GametypeNames [ ud . m_coop ] , 0 , 26 ) ;
2006-11-16 03:02:42 +00:00
2008-11-20 14:06:36 +00:00
mgametext ( c + 70 , 57 + 16 - 7 - 9 , EpisodeNames [ ud . m_volume_number ] , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
2008-07-22 10:56:22 +00:00
mgametext ( c + 70 , 57 + 16 + 16 - 7 - 9 , & level_names [ MAXLEVELS * ud . m_volume_number + ud . m_level_number ] [ 0 ] , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
if ( ud . m_monsters_off = = 0 | | ud . m_player_skill > 0 )
2008-11-20 14:06:36 +00:00
mgametext ( c + 70 , 57 + 16 + 16 + 16 - 7 - 9 , SkillNames [ ud . m_player_skill ] , 0 , 2 + 8 + 16 ) ;
2012-03-26 05:07:12 +00:00
else mgametext ( c + 70 , 57 + 16 + 16 + 16 - 7 - 9 , " None " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
if ( ud . m_coop = = 0 )
{
if ( ud . m_marker )
2012-03-26 05:07:12 +00:00
mgametext ( c + 70 , 57 + 16 + 16 + 16 + 16 - 7 - 9 , " On " , 0 , 2 + 8 + 16 ) ;
else mgametext ( c + 70 , 57 + 16 + 16 + 16 + 16 - 7 - 9 , " Off " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
if ( ud . m_coop = = 1 )
{
if ( ud . m_ffire )
2012-03-26 05:07:12 +00:00
mgametext ( c + 70 , 57 + 16 + 16 + 16 + 16 + 16 - 7 - 9 , " On " , 0 , 2 + 8 + 16 ) ;
else mgametext ( c + 70 , 57 + 16 + 16 + 16 + 16 + 16 - 7 - 9 , " Off " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
c - = 44 ;
2012-03-26 05:07:12 +00:00
menutext ( c , 57 - 9 , MENUHIGHLIGHT ( 0 ) , PHX ( - 2 ) , " Game Type " ) ;
2006-11-16 03:02:42 +00:00
2012-03-26 05:07:12 +00:00
sprintf ( tempbuf , " Episode %d " , ud . m_volume_number + 1 ) ;
2006-11-16 03:02:42 +00:00
menutext ( c , 57 + 16 - 9 , MENUHIGHLIGHT ( 1 ) , PHX ( - 3 ) , tempbuf ) ;
2012-03-26 05:07:12 +00:00
sprintf ( tempbuf , " Level %d " , ud . m_level_number + 1 ) ;
2006-11-16 03:02:42 +00:00
menutext ( c , 57 + 16 + 16 - 9 , MENUHIGHLIGHT ( 2 ) , PHX ( - 4 ) , tempbuf ) ;
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
menutext ( c , 57 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 3 ) , PHX ( - 5 ) , " Monsters " ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( ud . m_coop = = 0 )
2012-03-26 05:07:12 +00:00
menutext ( c , 57 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 4 ) , PHX ( - 6 ) , " Markers " ) ;
2006-11-16 03:02:42 +00:00
else
2012-03-26 05:07:12 +00:00
menutext ( c , 57 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 4 ) , 1 , " Markers " ) ;
2006-11-16 03:02:42 +00:00
if ( ud . m_coop = = 1 )
2012-03-26 05:07:12 +00:00
menutext ( c , 57 + 16 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 5 ) , PHX ( - 6 ) , " Fr. Fire " ) ;
else menutext ( c , 57 + 16 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 5 ) , 1 , " Fr. Fire " ) ;
2006-11-16 03:02:42 +00:00
if ( VOLUMEALL )
{
2012-03-26 05:07:12 +00:00
menutext ( c , 57 + 16 + 16 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 6 ) , boardfilename [ 0 ] = = 0 , " User Map " ) ;
2006-11-16 03:02:42 +00:00
if ( boardfilename [ 0 ] ! = 0 )
2008-07-22 10:56:22 +00:00
mgametext ( c + 70 + 44 , 57 + 16 + 16 + 16 + 16 + 16 , boardfilename , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
else
{
2012-03-26 05:07:12 +00:00
menutext ( c , 57 + 16 + 16 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 6 ) , 1 , " User Map " ) ;
2006-11-16 03:02:42 +00:00
}
2012-03-26 05:07:12 +00:00
menutext ( c , 57 + 16 + 16 + 16 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 7 ) , PHX ( - 8 ) , " Accept " ) ;
2006-11-16 03:02:42 +00:00
break ;
case 20020 :
case 20021 : // editing server
case 20022 : // editing port
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Join Network Game " ) ;
2006-11-16 03:02:42 +00:00
2008-11-20 14:06:36 +00:00
if ( g_currentMenu = = 20020 )
2006-11-16 03:02:42 +00:00
{
2008-11-20 14:06:36 +00:00
x = M_Probe ( 46 , 50 , 20 , 3 ) ;
2006-04-13 20:47:06 +00:00
2006-11-15 01:16:55 +00:00
if ( x = = - 1 )
{
2008-11-20 14:06:36 +00:00
ChangeToMenu ( 20001 ) ;
2006-11-16 03:02:42 +00:00
probey = 1 ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
else if ( x = = 0 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
strcpy ( buf , " localhost " ) ;
inputloc = strlen ( buf ) ;
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( 20021 ) ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
else if ( x = = 1 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
strcpy ( buf , " 19014 " ) ;
inputloc = strlen ( buf ) ;
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( 20022 ) ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
else if ( x = = 2 )
2007-08-25 01:05:00 +00:00
{ }
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
2006-11-16 03:02:42 +00:00
}
2008-11-20 14:06:36 +00:00
else if ( g_currentMenu = = 20021 )
2006-11-16 03:02:42 +00:00
{
2012-06-03 16:11:22 +00:00
x = Menu_EnterText ( 40 + 100 , 50 - 9 , buf , 31 , 0 ) ;
2006-11-16 03:02:42 +00:00
if ( x )
{
if ( x = = 1 )
{
2008-11-20 14:06:36 +00:00
//strcpy(szPlayerName,buf);
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
2006-04-13 20:47:06 +00:00
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( 20020 ) ;
2006-11-16 03:02:42 +00:00
}
}
2008-11-20 14:06:36 +00:00
else if ( g_currentMenu = = 20022 )
2006-11-16 03:02:42 +00:00
{
2012-06-03 16:11:22 +00:00
x = Menu_EnterText ( 40 + 100 , 50 + 20 - 9 , buf , 5 , 997 ) ;
2006-11-16 03:02:42 +00:00
if ( x )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( x = = 1 )
{
2008-11-20 14:06:36 +00:00
//strcpy(szPlayerName,buf);
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
2006-04-13 20:47:06 +00:00
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( 20020 ) ;
2006-11-16 03:02:42 +00:00
}
}
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
menutext ( 40 , 50 , 0 , 0 , " Server " ) ;
2008-11-20 14:06:36 +00:00
if ( g_currentMenu ! = 20021 ) mgametext ( 40 + 100 , 50 - 9 , " server " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
menutext ( 40 , 50 + 20 , 0 , 0 , " Port " ) ;
2008-11-20 14:06:36 +00:00
if ( g_currentMenu ! = 20022 )
2006-11-16 03:02:42 +00:00
{
sprintf ( tempbuf , " %d " , 19014 ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 40 + 100 , 50 + 20 - 9 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
menutext ( 160 , 50 + 20 + 20 , 0 , 0 , " Connect " ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
// ADDRESS
// PORT
// CONNECT
break ;
2006-12-05 00:16:33 +00:00
# endif
2006-11-16 03:02:42 +00:00
case 15001 :
case 15000 :
2006-04-13 20:47:06 +00:00
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 90 , " LOAD last game: " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2009-02-02 01:49:14 +00:00
Bsprintf ( tempbuf , " \" %s \" " , ud . savegame [ g_lastSaveSlot ] ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 99 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 99 + 9 , " (Y/N) " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
x = M_Probe ( 186 , 124 + 9 , 0 , 0 ) ;
if ( x = = - 1 | | KB_KeyPressed ( sc_N ) )
2006-11-16 03:02:42 +00:00
{
2007-08-27 06:46:31 +00:00
if ( sprite [ g_player [ myconnectindex ] . ps - > i ] . extra < = 0 )
2006-11-15 01:16:55 +00:00
{
2008-11-20 14:06:36 +00:00
if ( G_EnterLevel ( MODE_GAME ) ) G_BackToMenu ( ) ;
2006-11-16 03:02:42 +00:00
return ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
KB_ClearKeyDown ( sc_N ) ;
2007-08-27 06:46:31 +00:00
g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
ready2send = 1 ;
totalclock = ototalclock ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
if ( ProbeTriggers ( AdvanceTrigger ) | | I_AdvanceTrigger ( ) | | KB_KeyPressed ( sc_Y ) )
2006-11-16 03:02:42 +00:00
{
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
ProbeTriggersClear ( AdvanceTrigger ) ;
KB_ClearKeyDown ( sc_Y ) ;
2006-11-16 03:02:42 +00:00
KB_FlushKeyboardQueue ( ) ;
KB_ClearKeysDown ( ) ;
FX_StopAllSounds ( ) ;
2012-10-30 15:54:35 +00:00
S_ClearSoundLocks ( ) ;
2006-04-13 20:47:06 +00:00
2012-09-05 17:25:43 +00:00
G_LoadPlayerMaybeMulti ( g_lastSaveSlot ) ;
2006-11-16 03:02:42 +00:00
}
break ;
2012-10-14 22:16:07 +00:00
case MENU_ADULTMODE :
case MENU_ADULTPASSWORD :
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
margin = 60 ;
M_DrawTopBar ( " Adult Mode " ) ;
2006-11-16 03:02:42 +00:00
2008-11-20 14:06:36 +00:00
x = M_Probe ( 60 , 50 + 16 , 16 , 2 ) ;
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_GAMESETUP ) ;
2006-11-16 03:02:42 +00:00
probey = 0 ;
2006-11-15 01:16:55 +00:00
break ;
2006-11-16 03:02:42 +00:00
}
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin , 50 + 16 , MENUHIGHLIGHT ( 0 ) , 0 , " Adult Mode " ) ;
menutext ( margin , 50 + 16 + 16 , MENUHIGHLIGHT ( 1 ) , 0 , " Enter Password " ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin + 160 + 40 , 50 + 16 , MENUHIGHLIGHT ( 0 ) , 0 , ud . lockout ? " Off " : " On " ) ;
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
if ( g_currentMenu = = MENU_ADULTPASSWORD )
2006-11-16 03:02:42 +00:00
{
2012-03-26 05:07:12 +00:00
mgametext ( 160 , 50 + 16 + 16 + 16 + 16 - 12 , " Enter Password " , 0 , 2 + 8 + 16 ) ;
2012-06-03 16:11:22 +00:00
x = Menu_EnterText ( ( 320 > > 1 ) , 50 + 16 + 16 + 16 + 16 , buf , 19 , 998 ) ;
2006-11-16 03:02:42 +00:00
if ( x )
{
if ( ud . pwlockout [ 0 ] = = 0 | | ud . lockout = = 0 )
strcpy ( & ud . pwlockout [ 0 ] , buf ) ;
else if ( strcmp ( buf , & ud . pwlockout [ 0 ] ) = = 0 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
ud . lockout = 0 ;
buf [ 0 ] = 0 ;
2012-01-05 20:48:37 +00:00
#if 0
2009-02-19 16:47:54 +00:00
for ( x = 0 ; x < g_numAnimWalls ; x + + )
2006-11-16 03:02:42 +00:00
if ( wall [ animwall [ x ] . wallnum ] . picnum ! = W_SCREENBREAK & &
wall [ animwall [ x ] . wallnum ] . picnum ! = W_SCREENBREAK + 1 & &
wall [ animwall [ x ] . wallnum ] . picnum ! = W_SCREENBREAK + 2 )
if ( wall [ animwall [ x ] . wallnum ] . extra > = 0 )
wall [ animwall [ x ] . wallnum ] . picnum = wall [ animwall [ x ] . wallnum ] . extra ;
2012-01-05 20:48:37 +00:00
# endif
2006-11-15 01:16:55 +00:00
}
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( MENU_ADULTMODE ) ;
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
}
else
{
if ( x = = 0 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( ud . lockout = = 1 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( ud . pwlockout [ 0 ] = = 0 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
ud . lockout = 0 ;
2012-01-05 20:48:37 +00:00
#if 0
2009-02-19 16:47:54 +00:00
for ( x = 0 ; x < g_numAnimWalls ; x + + )
2006-11-16 03:02:42 +00:00
if ( wall [ animwall [ x ] . wallnum ] . picnum ! = W_SCREENBREAK & &
wall [ animwall [ x ] . wallnum ] . picnum ! = W_SCREENBREAK + 1 & &
wall [ animwall [ x ] . wallnum ] . picnum ! = W_SCREENBREAK + 2 )
if ( wall [ animwall [ x ] . wallnum ] . extra > = 0 )
wall [ animwall [ x ] . wallnum ] . picnum = wall [ animwall [ x ] . wallnum ] . extra ;
2012-01-05 20:48:37 +00:00
# endif
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
else
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
buf [ 0 ] = 0 ;
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( MENU_ADULTPASSWORD ) ;
2006-11-16 03:02:42 +00:00
inputloc = 0 ;
KB_FlushKeyboardQueue ( ) ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
}
else
{
ud . lockout = 1 ;
2006-11-15 01:16:55 +00:00
2009-02-19 16:47:54 +00:00
for ( x = 0 ; x < g_numAnimWalls ; x + + )
2012-01-28 14:38:23 +00:00
switch ( DYNAMICTILEMAP ( wall [ animwall [ x ] . wallnum ] . picnum ) )
2006-11-16 03:02:42 +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-15 01:16:55 +00:00
}
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
else if ( x = = 1 )
2006-11-15 01:16:55 +00:00
{
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( MENU_ADULTPASSWORD ) ;
2006-11-16 03:02:42 +00:00
inputloc = 0 ;
KB_FlushKeyboardQueue ( ) ;
2006-11-15 01:16:55 +00:00
}
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
2006-11-16 03:02:42 +00:00
case 1000 :
case 1001 :
case 1002 :
case 1003 :
case 1004 :
case 1005 :
case 1006 :
case 1007 :
case 1008 :
case 1009 :
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
M_DrawBackground ( ) ;
M_DrawTopBar ( " Load Game " ) ;
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( 101 < < 16 , 97 < < 16 , 65536 > > 1 , 512 , TILE_LOADSHOT , - 32 , 0 , 4 + 10 + 64 ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
M_DisplaySaveGameList ( ) ;
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Players: %-2d " , savehead . numplayers ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 156 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Episode: %-2d / Level: %-2d / Skill: %-2d " ,
2011-12-25 15:34:06 +00:00
1 + savehead . volnum , 1 + savehead . levnum , savehead . skill ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 168 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( savehead . volnum = = 0 & & savehead . levnum = = 7 )
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 180 , savehead . boardfn , 0 , 2 + 8 + 16 ) ;
2006-11-15 01:16:55 +00:00
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 90 , " LOAD game: " , 0 , 2 + 8 + 16 ) ;
2009-02-02 01:49:14 +00:00
Bsprintf ( tempbuf , " \" %s \" " , ud . savegame [ g_currentMenu - 1000 ] ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 99 , tempbuf , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 99 + 9 , " (Y/N) " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
x = M_Probe ( 186 , 124 + 9 , 0 , 0 ) ;
if ( ProbeTriggers ( AdvanceTrigger ) | | I_AdvanceTrigger ( ) | | KB_KeyPressed ( sc_Y ) )
2006-11-16 03:02:42 +00:00
{
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
ProbeTriggersClear ( AdvanceTrigger ) ;
KB_ClearKeyDown ( sc_Y ) ;
2008-11-20 14:06:36 +00:00
g_lastSaveSlot = g_currentMenu - 1000 ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
KB_FlushKeyboardQueue ( ) ;
KB_ClearKeysDown ( ) ;
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
2006-11-16 03:02:42 +00:00
{
ready2send = 1 ;
totalclock = ototalclock ;
2006-11-15 01:16:55 +00:00
}
2012-09-05 17:25:43 +00:00
G_LoadPlayerMaybeMulti ( g_lastSaveSlot ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
break ;
}
2006-12-12 05:59:47 +00:00
2012-06-03 16:11:22 +00:00
if ( x = = - 1 | | KB_KeyPressed ( sc_N ) )
2006-11-16 03:02:42 +00:00
{
KB_ClearKeyDown ( sc_N ) ;
2007-08-27 06:46:31 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME )
2006-11-16 03:02:42 +00:00
{
2007-08-27 06:46:31 +00:00
g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
ready2send = 1 ;
totalclock = ototalclock ;
2006-11-15 01:16:55 +00:00
}
2006-12-18 08:37:12 +00:00
}
else
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_LOAD ) ;
2006-12-12 05:59:47 +00:00
probey = last_threehundred ;
2006-04-13 20:47:06 +00:00
}
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
2006-11-16 03:02:42 +00:00
case 1500 :
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
x = M_Probe ( 186 , 124 , 0 , 0 ) ;
if ( ProbeTriggers ( AdvanceTrigger ) | | I_AdvanceTrigger ( ) | | KB_KeyPressed ( sc_Y ) )
2006-11-16 03:02:42 +00:00
{
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
ProbeTriggersClear ( AdvanceTrigger ) ;
KB_ClearKeyDown ( sc_Y ) ;
2006-11-16 03:02:42 +00:00
KB_FlushKeyboardQueue ( ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_EPISODE ) ;
2006-11-16 03:02:42 +00:00
}
2012-06-03 16:11:22 +00:00
if ( x = = - 1 | | KB_KeyPressed ( sc_N ) )
2006-11-16 03:02:42 +00:00
{
KB_ClearKeyDown ( sc_N ) ;
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
2006-11-16 03:02:42 +00:00
{
ready2send = 1 ;
totalclock = ototalclock ;
}
2007-08-27 06:46:31 +00:00
g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
2006-11-16 03:02:42 +00:00
break ;
}
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 90 , " ABORT this game? " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 90 + 9 , " (Y/N) " , 0 , 2 + 8 + 16 ) ;
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
2006-11-16 03:02:42 +00:00
case 2000 :
case 2001 :
case 2002 :
case 2003 :
case 2004 :
case 2005 :
case 2006 :
case 2007 :
case 2008 :
case 2009 :
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
M_DrawBackground ( ) ;
M_DrawTopBar ( " Save Game " ) ;
2006-04-13 20:47:06 +00:00
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( 101 < < 16 , 97 < < 16 , 65536L > > 1 , 512 , TILE_LOADSHOT , - 32 , 0 , 4 + 10 + 64 ) ;
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Players: %-2d " , ud . multimode ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 156 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Episode: %-2d / Level: %-2d / Skill: %-2d " , 1 + ud . volume_number , 1 + ud . level_number , ud . player_skill ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 168 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
if ( ud . volume_number = = 0 & & ud . level_number = = 7 )
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 180 , boardfilename , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
M_DisplaySaveGameList ( ) ;
2006-04-13 20:47:06 +00:00
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 90 , " OVERWRITE previous SAVED game? " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 90 + 9 , " (Y/N) " , 0 , 2 + 8 + 16 ) ;
2006-11-15 01:16:55 +00:00
2012-06-03 16:11:22 +00:00
x = M_Probe ( 186 , 124 , 0 , 0 ) ;
if ( ProbeTriggers ( AdvanceTrigger ) | | I_AdvanceTrigger ( ) | | KB_KeyPressed ( sc_Y ) )
2006-11-16 03:02:42 +00:00
{
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
ProbeTriggersClear ( AdvanceTrigger ) ;
KB_ClearKeyDown ( sc_Y ) ;
2008-11-20 14:06:36 +00:00
inputloc = strlen ( & ud . savegame [ g_currentMenu - 2000 ] [ 0 ] ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( g_currentMenu - 2000 + 360 ) ;
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
KB_FlushKeyboardQueue ( ) ;
2006-04-13 20:47:06 +00:00
break ;
2006-11-16 03:02:42 +00:00
}
2012-06-03 16:11:22 +00:00
if ( x = = - 1 | | KB_KeyPressed ( sc_N ) )
2006-11-16 03:02:42 +00:00
{
KB_ClearKeyDown ( sc_N ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 351 ) ;
2006-11-16 03:02:42 +00:00
}
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_CREDITS :
case MENU_CREDITS2 :
case MENU_CREDITS3 :
case MENU_CREDITS4 :
case MENU_CREDITS5 :
case MENU_CREDITS6 :
case MENU_CREDITS7 :
case MENU_CREDITS8 :
case MENU_CREDITS9 :
case MENU_CREDITS10 :
margin = MENU_MARGIN_CENTER ;
2006-11-16 03:02:42 +00:00
if ( ! VOLUMEALL | | ! PLUTOPAK )
{
2012-10-14 22:16:07 +00:00
//M_DrawBackground();
switch ( g_currentMenu )
{
case MENU_CREDITS9 :
case MENU_CREDITS10 :
M_DrawTopBar ( " About EDuke32 " ) ;
break ;
default :
M_DrawTopBar ( " Credits " ) ;
break ;
}
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
l = 9 ;
2006-11-16 03:02:42 +00:00
}
else
{
2012-10-14 22:16:07 +00:00
l = 4 ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-10-29 04:29:45 +00:00
M_LinearPanels ( MENU_CREDITS , MENU_CREDITS + l ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
x = M_Probe ( 0 , 0 , 0 , 1 ) ;
2007-02-05 01:33:08 +00:00
if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_MAIN ) ;
2007-02-05 01:33:08 +00:00
break ;
}
2006-11-16 03:02:42 +00:00
if ( ! VOLUMEALL | | ! PLUTOPAK )
{
2008-11-20 14:06:36 +00:00
switch ( g_currentMenu )
2006-11-15 01:16:55 +00:00
{
2012-10-14 22:16:07 +00:00
case MENU_CREDITS :
mgametext ( margin , 40 , " Original Concept " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 , " Todd Replogle " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 , " Allen H. Blum III " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 40 + 9 + 9 + 9 + 9 , " Produced & Directed By " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 , " Greg Malone " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Executive Producer " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " George Broussard " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " BUILD Engine " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Ken Silverman " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_CREDITS2 :
mgametext ( margin , 40 , " Game Programming " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 , " Todd Replogle " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 40 + 9 + 9 + 9 , " 3D Engine/Tools/Net " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 , " Ken Silverman " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 , " Network Layer/Setup Program " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Mark Dochtermann " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_CREDITS3 :
mgametext ( margin , 40 , " Map Design " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 , " Allen H. Blum III " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 , " Richard Gray " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 , " 3D Modeling " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 , " Chuck Jones " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 , " Sapphire Corporation " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Artwork " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Dirk Jones, Stephen Hornback " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " James Storey, David Demaret " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Douglas R. Wood " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_CREDITS4 :
mgametext ( margin , 40 , " Sound Engine " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 , " Jim Dose " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 40 + 9 + 9 + 9 , " Sound & Music Development " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 , " Robert Prince " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 , " Lee Jackson " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Voice Talent " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Lani Minella - Voice Producer " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 40 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Jon St. John as \" Duke Nukem \" " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_CREDITS5 :
mgametext ( margin , 60 , " Graphic Design " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 60 + 9 , " Packaging, Manual, Ads " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 60 + 9 + 9 , " Robert M. Atkins " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 60 + 9 + 9 + 9 , " Michael Hadwin " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 60 + 9 + 9 + 9 + 9 + 9 , " Special Thanks To " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 60 + 9 + 9 + 9 + 9 + 9 + 9 , " Steven Blackburn, Tom Hall " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 60 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Scott Miller, Joe Siegler " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 60 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Terry Nagy, Colleen Compton " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 60 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " HASH, Inc., FormGen, Inc. " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_CREDITS6 :
mgametext ( margin , 49 , " The 3D Realms Beta Testers " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 49 + 9 + 9 , " Nathan Anderson, Wayne Benner " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 49 + 9 + 9 + 9 , " Glenn Brensinger, Rob Brown " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 49 + 9 + 9 + 9 + 9 , " Erik Harris, Ken Heckbert " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 49 + 9 + 9 + 9 + 9 + 9 , " Terry Herrin, Greg Hively " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 49 + 9 + 9 + 9 + 9 + 9 + 9 , " Hank Leukart, Eric Baker " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 49 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Jeff Rausch, Kelly Rogers " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 49 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Mike Duncan, Doug Howell " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 49 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Bill Blair " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_CREDITS7 :
mgametext ( margin , 32 , " Company Product Support " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 32 + 9 + 9 , " The following companies were cool " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 32 + 9 + 9 + 9 , " enough to give us lots of stuff " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 32 + 9 + 9 + 9 + 9 , " during the making of Duke Nukem 3D. " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 32 + 9 + 9 + 9 + 9 + 9 + 9 , " Altec Lansing Multimedia " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 32 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " for tons of speakers and the " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 32 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " THX-licensed sound system. " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 32 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " For info call 1-800-548-0620 " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 32 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Creative Labs, Inc. " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 32 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 , " Thanks for the hardware, guys. " , 0 , 2 + 8 + 16 ) ;
2006-11-15 01:16:55 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_CREDITS8 :
mgametext ( margin , 50 , " Duke Nukem is a trademark of " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 50 + 9 , " 3D Realms Entertainment " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 50 + 9 + 9 + 9 , " Duke Nukem " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 50 + 9 + 9 + 9 + 9 , " (C) 1996 3D Realms Entertainment " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( VOLUMEONE )
{
2012-10-14 22:16:07 +00:00
mgametext ( margin , 106 , " Please read LICENSE.DOC for shareware " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 106 + 9 , " distribution grants and restrictions. " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , VOLUMEONE ? 134 : 115 , " Made in Dallas, Texas USA " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_CREDITS9 :
2006-11-16 03:02:42 +00:00
l = 10 ;
goto cheat_for_port_credits ;
2012-10-14 22:16:07 +00:00
case MENU_CREDITS10 :
l = 10 ;
goto cheat_for_port_credits2 ;
2006-04-13 20:47:06 +00:00
}
2006-11-15 01:16:55 +00:00
break ;
2006-11-16 03:02:42 +00:00
}
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
// Plutonium pak menus
2008-11-20 14:06:36 +00:00
switch ( g_currentMenu )
2006-11-16 03:02:42 +00:00
{
2012-10-14 22:16:07 +00:00
case MENU_CREDITS :
case MENU_CREDITS2 :
case MENU_CREDITS3 :
rotatesprite_fs ( 160 < < 16 , 200 < < 15 , 65536L , 0 , 2504 + g_currentMenu - MENU_CREDITS , 0 , 0 , 10 + 64 ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_CREDITS4 : // JBF 20031220
M_DrawBackground ( ) ;
M_DrawTopBar ( " About EDuke32 " ) ;
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
cheat_for_port_credits :
2008-11-20 14:06:36 +00:00
if ( g_scriptVersion = = 13 ) l = ( - 2 ) ;
2012-03-26 05:07:12 +00:00
mgametext ( 160 , 38 - l , " Programming and Project Management " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
p = " Richard \" TerminX \" Gobeille " ;
minitext ( 161 - ( Bstrlen ( p ) < < 1 ) , 39 + 10 - l , p , 4 , 10 + 16 + 128 ) ;
minitext ( 160 - ( Bstrlen ( p ) < < 1 ) , 38 + 10 - l , p , 8 , 10 + 16 + 128 ) ;
2012-10-14 22:16:07 +00:00
mgametext ( 160 , 58 - l , " Polymer Rendering System " , 0 , 2 + 8 + 16 ) ;
2009-12-05 09:22:43 +00:00
p = " Pierre-Loup \" Plagman \" Griffais " ;
2012-10-14 22:16:07 +00:00
minitext ( 161 - ( Bstrlen ( p ) < < 1 ) , 59 + 10 - l , p , 4 , 10 + 16 + 128 ) ;
minitext ( 160 - ( Bstrlen ( p ) < < 1 ) , 58 + 10 - l , p , 8 , 10 + 16 + 128 ) ;
2006-11-16 03:02:42 +00:00
2012-10-30 15:54:35 +00:00
mgametext ( 160 , 78 - l , " Additional Engine and Game Programming " , 0 , 2 + 8 + 16 ) ;
2012-10-14 22:16:07 +00:00
p = " Philipp \" Helixhorned \" Kutin " ;
minitext ( 161 - ( Bstrlen ( p ) < < 1 ) , 79 + 10 - l , p , 4 , 10 + 16 + 128 ) ;
minitext ( 160 - ( Bstrlen ( p ) < < 1 ) , 78 + 10 - l , p , 8 , 10 + 16 + 128 ) ;
2012-10-30 15:54:35 +00:00
mgametext ( 160 , 98 - l , " \" JFDuke3D \" and \" JFBuild \" code " , 0 , 2 + 8 + 16 ) ;
2009-12-05 09:22:43 +00:00
p = " Jonathon \" JonoF \" Fowler " ;
2012-10-14 22:16:07 +00:00
minitext ( 161 - ( Bstrlen ( p ) < < 1 ) , 99 + 10 - l , p , 4 , 10 + 16 + 128 ) ;
minitext ( 160 - ( Bstrlen ( p ) < < 1 ) , 98 + 10 - l , p , 8 , 10 + 16 + 128 ) ;
2012-12-13 02:34:49 +00:00
mgametext ( 160 , 118 - l , " Legacy \" NAM \" , \" WWII GI \" , and \" EDuke \" Code " , 0 , 2 + 8 + 16 ) ;
2012-10-14 22:16:07 +00:00
p = " Matt \" Matteus \" Saettler " ;
minitext ( 161 - ( Bstrlen ( p ) < < 1 ) , 119 + 10 - l , p , 4 , 10 + 16 + 128 ) ;
minitext ( 160 - ( Bstrlen ( p ) < < 1 ) , 118 + 10 - l , p , 8 , 10 + 16 + 128 ) ;
2006-11-16 03:02:42 +00:00
2012-10-30 15:54:35 +00:00
mgametext ( 160 , 138 - l , " Core BUILD Engine functionality " , 0 , 2 + 8 + 16 ) ;
2009-12-05 09:22:43 +00:00
p = " Ken \" Awesoken \" Silverman " ;
2012-10-14 22:16:07 +00:00
minitext ( 161 - ( Bstrlen ( p ) < < 1 ) , 139 + 10 - l , p , 4 , 10 + 16 + 128 ) ;
minitext ( 160 - ( Bstrlen ( p ) < < 1 ) , 138 + 10 - l , p , 8 , 10 + 16 + 128 ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
p = " Visit www.eduke32.com for news and updates " ;
2012-12-14 23:11:26 +00:00
minitext ( 161 - ( Bstrlen ( p ) < < 1 ) , 139 + 10 + 10 + 10 + 10 + 4 - l , p , 4 , 10 + 16 + 128 ) ;
minitext ( 160 - ( Bstrlen ( p ) < < 1 ) , 138 + 10 + 10 + 10 + 10 + 4 - l , p , 8 , 10 + 16 + 128 ) ;
2012-10-14 22:16:07 +00:00
break ;
case MENU_CREDITS5 :
M_DrawBackground ( ) ;
M_DrawTopBar ( " About EDuke32 " ) ;
cheat_for_port_credits2 :
if ( g_scriptVersion = = 13 ) l = ( - 2 ) ;
mgametext ( 160 , 38 - l , " License and Other Contributors " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
{
2012-12-14 23:11:26 +00:00
const char * header [ ] =
2007-08-25 01:05:00 +00:00
{
" This program is distributed under the terms of the " ,
" GNU General Public License version 2 as published by the " ,
" Free Software Foundation. See GNU.TXT for details. " ,
2008-08-26 04:00:42 +00:00
" " ,
2007-08-25 01:05:00 +00:00
" Thanks to the following people for their contributions: " ,
2008-08-26 04:00:42 +00:00
" " ,
2012-12-14 23:11:26 +00:00
} ;
const char * body [ ] =
{
2012-12-13 02:34:49 +00:00
" Adam Fazakerley " , // netcode NAT traversal
2012-03-23 20:24:30 +00:00
" Alan Ondra " , // testing
2012-12-13 02:34:49 +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
2008-08-28 05:57:46 +00:00
" Ed Coolidge " , // Mapster32 improvements
2012-03-23 20:24:30 +00:00
" Ferry Landzaat " , // ? (listed on the wiki page)
2012-10-14 22:16:07 +00:00
" Hendricks266 " , // misc stuff
2012-03-23 20:24:30 +00:00
" Hunter_rus " , // tons of stuff
2008-08-28 05:57:46 +00:00
" James Bentler " , // Mapster32 improvements
2012-12-13 02:34:49 +00:00
" Jasper Foreman " , // netcode contributions
" Javier Martinez " , // "Malone3D" - EDuke 2.1.1 components
2008-08-28 05:57:46 +00:00
" Jeff Hart " , // website graphics
2012-12-13 02:34:49 +00:00
" Jonathan Smith " , // "Mblackwell" - testing
" Jose del Castillo " , // "Renegado" - EDuke 2.1.1 components
2008-08-28 05:57:46 +00:00
" Lachlan McDonald " , // official EDuke32 icon
2012-12-13 02:34:49 +00:00
" LSDNinja " , // OS X help and testing
" Marcus Herbert " , // "rhoenie" - OS X compatibility work
" Matthew Palmer " , // "Usurper" - testing and eduke32.com domain
2008-08-28 05:57:46 +00:00
" Ozkan Sezer " , // SDL/GTK version checking improvements
2012-12-13 02:34:49 +00:00
" Peter Green " , // "Plugwash" - dynamic remapping, custom gametypes
" Peter Veenstra " , // "Qbix" - port to 64-bit
2009-12-05 09:22:43 +00:00
" Randy Heit " , // random snippets of ZDoom here and there
" Robin Green " , // CON array support
2012-12-13 02:34:49 +00:00
" Ryan Gordon " , // "icculus" - icculus.org Duke3D port sound code
2008-08-28 05:57:46 +00:00
" Stephen Anthony " , // early 64-bit porting work
2012-12-13 02:34:49 +00:00
" tueidj " , // Wii port
2008-08-26 04:00:42 +00:00
" " ,
2012-12-14 23:11:26 +00:00
} ;
const char * footer [ ] =
{
2009-12-05 09:22:43 +00:00
" " ,
" BUILD engine technology available under BUILDLIC. " ,
2007-08-25 01:05:00 +00:00
} ;
2012-12-14 23:11:26 +00:00
const int32_t header_numlines = sizeof ( header ) / sizeof ( char * ) ;
const int32_t body_numlines = sizeof ( body ) / sizeof ( char * ) ;
const int32_t footer_numlines = sizeof ( footer ) / sizeof ( char * ) ;
i = 0 ;
for ( m = 0 ; m < header_numlines ; m + + )
{
minitext ( 161 - ( Bstrlen ( header [ m ] ) < < 1 ) , 18 + 10 + 10 + 8 + 4 + ( m * 7 ) - l , header [ m ] , 4 , 10 + 16 + 128 ) ;
minitext ( 160 - ( Bstrlen ( header [ m ] ) < < 1 ) , 17 + 10 + 10 + 8 + 4 + ( m * 7 ) - l , header [ m ] , 8 , 10 + 16 + 128 ) ;
}
i + = m ;
# define CCOLUMNS 3
# define CCOLXBUF 20
for ( m = 0 ; m < body_numlines ; m + + )
{
minitext ( CCOLXBUF + ( ( 320 - CCOLXBUF * 2 ) / ( CCOLUMNS * 2 ) ) + 1 + ( ( 320 - CCOLXBUF * 2 ) / CCOLUMNS ) * ( m / ( body_numlines / CCOLUMNS ) ) - ( Bstrlen ( body [ m ] ) < < 1 ) , 18 + 10 + 10 + 8 + 4 + ( ( m % ( body_numlines / CCOLUMNS ) ) * 7 ) + ( i * 7 ) - l , body [ m ] , 4 , 10 + 16 + 128 ) ;
minitext ( CCOLXBUF + ( ( 320 - CCOLXBUF * 2 ) / ( CCOLUMNS * 2 ) ) + ( ( 320 - CCOLXBUF * 2 ) / CCOLUMNS ) * ( m / ( body_numlines / CCOLUMNS ) ) - ( Bstrlen ( body [ m ] ) < < 1 ) , 17 + 10 + 10 + 8 + 4 + ( ( m % ( body_numlines / CCOLUMNS ) ) * 7 ) + ( i * 7 ) - l , body [ m ] , 8 , 10 + 16 + 128 ) ;
}
i + = m / CCOLUMNS ;
for ( m = 0 ; m < footer_numlines ; m + + )
2006-11-15 01:16:55 +00:00
{
2012-12-14 23:11:26 +00:00
minitext ( 161 - ( Bstrlen ( footer [ m ] ) < < 1 ) , 18 + 10 + 10 + 8 + 4 + ( m * 7 ) + ( i * 7 ) - l , footer [ m ] , 4 , 10 + 16 + 128 ) ;
minitext ( 160 - ( Bstrlen ( footer [ m ] ) < < 1 ) , 17 + 10 + 10 + 8 + 4 + ( m * 7 ) + ( i * 7 ) - l , footer [ m ] , 8 , 10 + 16 + 128 ) ;
2006-11-15 01:16:55 +00:00
}
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
p = " Visit www.eduke32.com for news and updates " ;
2012-12-14 23:11:26 +00:00
minitext ( 161 - ( Bstrlen ( p ) < < 1 ) , 139 + 10 + 10 + 10 + 10 + 4 - l , p , 4 , 10 + 16 + 128 ) ;
minitext ( 160 - ( Bstrlen ( p ) < < 1 ) , 138 + 10 + 10 + 10 + 10 + 4 - l , p , 8 , 10 + 16 + 128 ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
break ;
2006-11-16 03:02:42 +00:00
}
2012-10-14 22:16:07 +00:00
break ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
case MENU_MAIN :
Menu_Main ( ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_MAIN_INGAME :
margin = MENU_MARGIN_CENTER ;
rotatesprite_fs ( margin < < 16 , 32 < < 16 , 65536L , 0 , INGAMEDUKETHREEDEE , 0 , 0 , 10 ) ;
2006-11-16 03:02:42 +00:00
if ( PLUTOPAK ) // JBF 20030804
2012-10-14 22:16:07 +00:00
rotatesprite_fs ( ( margin + 100 ) < < 16 , 36 < < 16 , 65536L , 0 , PLUTOPAKSPRITE + 2 , ( sintable [ ( totalclock < < 4 ) & 2047 ] > > 11 ) , 0 , 2 + 8 ) ;
x = M_Probe ( margin , 67 , 16 , 7 ) ;
2006-11-16 03:02:42 +00:00
switch ( x )
{
case 0 :
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) | | ud . recstat = = 2 )
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 1500 ) ;
2006-11-16 03:02:42 +00:00
else
2006-04-13 20:47:06 +00:00
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 600 ) ;
2006-11-16 03:02:42 +00:00
last_fifty = 0 ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
break ;
case 1 :
if ( ud . recstat ! = 2 )
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
last_fifty = 1 ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 350 ) ;
2006-11-16 03:02:42 +00:00
setview ( 0 , 0 , xdim - 1 , ydim - 1 ) ;
2006-11-15 01:16:55 +00:00
}
break ;
2006-11-16 03:02:42 +00:00
case 2 :
last_fifty = 2 ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_LOAD ) ;
2006-11-16 03:02:42 +00:00
break ;
case 3 :
last_fifty = 3 ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_OPTIONS ) ; // JBF 20031205: was 200
2006-11-16 03:02:42 +00:00
break ;
case 4 :
last_fifty = 4 ;
2006-11-15 01:16:55 +00:00
KB_FlushKeyboardQueue ( ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_STORY ) ;
2006-11-16 03:02:42 +00:00
break ;
case 5 :
2010-01-16 23:08:17 +00:00
if ( numplayers < 2 & & ! g_netServer )
2006-11-16 03:02:42 +00:00
{
last_fifty = 5 ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_QUITTOTITLE ) ;
2006-11-16 03:02:42 +00:00
}
break ;
case 6 :
last_fifty = 6 ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_QUIT ) ;
2006-11-16 03:02:42 +00:00
break ;
case - 1 :
2007-08-27 06:46:31 +00:00
g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
2006-11-16 03:02:42 +00:00
{
ready2send = 1 ;
totalclock = ototalclock ;
}
break ;
}
if ( KB_KeyPressed ( sc_Q ) )
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_QUIT ) ;
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin , 67 , MENUHIGHLIGHT ( 0 ) , 0 , " New Game " ) ;
menutext ( margin , 67 + 16 , MENUHIGHLIGHT ( 1 ) , 0 , " Save Game " ) ;
menutext ( margin , 67 + 16 + 16 , MENUHIGHLIGHT ( 2 ) , 0 , " Load Game " ) ;
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin , 67 + 16 + 16 + 16 , MENUHIGHLIGHT ( 3 ) , 0 , " Options " ) ;
2006-11-16 03:02:42 +00:00
if ( ! VOLUMEALL )
{
2012-10-14 22:16:07 +00:00
menutext ( margin , 67 + 16 + 16 + 16 + 16 , MENUHIGHLIGHT ( 4 ) , 0 , " How To Order " ) ;
2006-11-16 03:02:42 +00:00
}
else
{
2012-10-14 22:16:07 +00:00
menutext ( margin , 67 + 16 + 16 + 16 + 16 , MENUHIGHLIGHT ( 4 ) , 0 , " Help " ) ;
2006-11-16 03:02:42 +00:00
}
2010-01-16 23:08:17 +00:00
if ( g_netServer | | numplayers > 1 )
2012-10-14 22:16:07 +00:00
menutext ( margin , 67 + 16 + 16 + 16 + 16 + 16 , MENUHIGHLIGHT ( 5 ) , 1 , " Quit To Title " ) ;
else menutext ( margin , 67 + 16 + 16 + 16 + 16 + 16 , MENUHIGHLIGHT ( 5 ) , 0 , " Quit To Title " ) ;
menutext ( margin , 67 + 16 + 16 + 16 + 16 + 16 + 16 , MENUHIGHLIGHT ( 6 ) , 0 , " Quit Game " ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_EPISODE :
M_DrawTopBar ( " Select An Episode " ) ;
2008-11-20 14:06:36 +00:00
x = M_Probe ( 160 , VOLUMEONE ? 60 : 60 - ( g_numVolumes * 2 ) , 20 , VOLUMEONE ? 3 : g_numVolumes + 1 ) ;
2006-11-16 03:02:42 +00:00
if ( x > = 0 )
{
if ( VOLUMEONE )
{
if ( x > 0 )
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_BUYDUKE ) ;
2006-11-16 03:02:42 +00:00
else
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
ud . m_volume_number = x ;
ud . m_level_number = 0 ;
last_onehundred = x ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_SKILL ) ;
2006-11-16 03:02:42 +00:00
}
}
if ( ! VOLUMEONE )
{
2008-11-20 14:06:36 +00:00
if ( x = = g_numVolumes /*&& boardfilename[0]*/ )
2006-11-16 03:02:42 +00:00
{
//ud.m_volume_number = 0;
//ud.m_level_number = 7;
currentlist = 1 ;
last_onehundred = x ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_USERMAP ) ;
2006-11-16 03:02:42 +00:00
}
else
{
ud . m_volume_number = x ;
ud . m_level_number = 0 ;
last_onehundred = x ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_SKILL ) ;
2006-11-16 03:02:42 +00:00
}
}
}
else if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) M_ChangeMenu ( MENU_MAIN_INGAME ) ;
else M_ChangeMenu ( MENU_MAIN ) ;
2006-11-16 03:02:42 +00:00
}
2012-10-14 22:16:07 +00:00
margin = 80 ;
2006-11-16 03:02:42 +00:00
if ( VOLUMEONE )
{
2012-10-14 22:16:07 +00:00
menutext ( 160 , 60 , MENUHIGHLIGHT ( 0 ) , 0 , EpisodeNames [ 0 ] ) ;
2008-11-20 14:06:36 +00:00
menutext ( 160 , 60 + 20 , MENUHIGHLIGHT ( 1 ) , 1 , EpisodeNames [ 1 ] ) ;
menutext ( 160 , 60 + 20 + 20 , MENUHIGHLIGHT ( 2 ) , 1 , EpisodeNames [ 2 ] ) ;
2006-11-16 03:02:42 +00:00
if ( PLUTOPAK )
2008-11-20 14:06:36 +00:00
menutext ( 160 , 60 + 20 + 20 , MENUHIGHLIGHT ( 3 ) , 1 , EpisodeNames [ 3 ] ) ;
2006-11-16 03:02:42 +00:00
}
else
{
2009-02-19 16:47:54 +00:00
for ( i = 0 ; i < g_numVolumes ; i + + )
2012-10-14 22:16:07 +00:00
menutext ( 160 , 60 - ( g_numVolumes * 2 ) + ( 20 * i ) , MENUHIGHLIGHT ( i ) , 0 , EpisodeNames [ i ] ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
menutext ( 160 , 60 - ( g_numVolumes * 2 ) + ( 20 * i ) , MENUHIGHLIGHT ( i ) , 0 , " User Map " ) ;
2006-11-16 03:02:42 +00:00
}
break ;
2012-10-14 22:16:07 +00:00
case MENU_USERMAP :
2006-12-12 07:25:01 +00:00
if ( boardfilename [ 0 ] = = 0 ) strcpy ( boardfilename , " ./ " ) ;
Bcorrectfilename ( boardfilename , 1 ) ;
2012-03-28 19:42:16 +00:00
fnlist_getnames ( & fnlist , boardfilename , " *.map " , 0 , 0 ) ;
set_findhighs ( ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_SELECTMAP ) ;
2006-11-16 03:02:42 +00:00
KB_FlushKeyboardQueue ( ) ;
2012-10-14 22:16:07 +00:00
case MENU_SELECTMAP :
M_DrawTopBar ( " Select A User Map " ) ;
2006-11-16 03:02:42 +00:00
2012-08-19 12:56:51 +00:00
{
int32_t width = 160 - ( 40 - 4 ) ;
// black translucent background underneath file lists
rotatesprite ( 0 < < 16 , 0 < < 16 , 65536 < < 5 , 0 , /*tile*/ 0 , numshades , 0 , 10 + 16 + 1 + 32 ,
xdim / 2 - scale ( width , ( ydim * 4 ) / 3 , 320 ) , scale ( 12 + 32 - 2 , ydim , 200 ) ,
xdim / 2 + scale ( width , ( ydim * 4 ) / 3 , 320 ) - 1 , scale ( 12 + 32 + 112 + 4 , ydim , 200 ) - 1 ) ;
}
2006-11-16 03:02:42 +00:00
// path
2008-07-30 01:00:40 +00:00
minitext ( 38 , 45 , boardfilename , 16 , 26 ) ;
2006-11-16 03:02:42 +00:00
2007-08-25 01:05:00 +00:00
{
// JBF 20040208: seek to first name matching pressed character
2012-03-28 19:42:16 +00:00
CACHE1D_FIND_REC * seeker = currentlist ? fnlist . findfiles : fnlist . finddirs ;
2006-11-16 03:02:42 +00:00
if ( ( KB_KeyPressed ( sc_Home ) | KB_KeyPressed ( sc_End ) ) > 0 )
{
2008-03-30 15:39:22 +00:00
while ( seeker & & ( KB_KeyPressed ( sc_End ) ? seeker - > next : seeker - > prev ) )
2006-11-16 03:02:42 +00:00
seeker = KB_KeyPressed ( sc_End ) ? seeker - > next : seeker - > prev ;
if ( seeker )
{
if ( currentlist ) findfileshigh = seeker ;
else finddirshigh = seeker ;
2011-10-30 19:47:07 +00:00
// clear keys, don't play the kick sound a dozen times!
KB_ClearKeyDown ( sc_End ) ;
KB_ClearKeyDown ( sc_Home ) ;
2008-11-20 14:06:36 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-11-16 03:02:42 +00:00
}
}
else if ( ( KB_KeyPressed ( sc_PgUp ) | KB_KeyPressed ( sc_PgDn ) ) > 0 )
{
seeker = currentlist ? findfileshigh : finddirshigh ;
i = 6 ;
while ( i > 0 )
{
2008-03-30 15:39:22 +00:00
if ( seeker & & ( KB_KeyPressed ( sc_PgDn ) ? seeker - > next : seeker - > prev ) )
2006-11-16 03:02:42 +00:00
seeker = KB_KeyPressed ( sc_PgDn ) ? seeker - > next : seeker - > prev ;
i - - ;
}
if ( seeker )
{
if ( currentlist ) findfileshigh = seeker ;
else finddirshigh = seeker ;
2011-10-30 19:47:07 +00:00
// clear keys, don't play the kick sound a dozen times!
KB_ClearKeyDown ( sc_PgDn ) ;
KB_ClearKeyDown ( sc_PgUp ) ;
2008-11-20 14:06:36 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
}
else
{
char ch2 , ch ;
2012-11-17 16:48:11 +00:00
ch = KB_GetCh ( ) ;
2006-11-16 03:02:42 +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
{
2006-11-16 03:02:42 +00:00
if ( ch > = ' a ' ) ch - = ( ' a ' - ' A ' ) ;
while ( seeker )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
ch2 = seeker - > name [ 0 ] ;
if ( ch2 > = ' a ' & & ch2 < = ' z ' ) ch2 - = ( ' a ' - ' A ' ) ;
if ( ch2 = = ch ) break ;
seeker = seeker - > next ;
2006-04-13 20:47:06 +00:00
}
2006-11-15 01:16:55 +00:00
if ( seeker )
{
2006-04-13 20:47:06 +00:00
if ( currentlist ) findfileshigh = seeker ;
else finddirshigh = seeker ;
2008-11-20 14:06:36 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-04-13 20:47:06 +00:00
}
}
}
2006-11-16 03:02:42 +00:00
}
2012-03-26 05:07:12 +00:00
mgametext ( 40 + 4 , 32 , " Directories " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( finddirshigh )
{
2009-01-09 09:29:17 +00:00
int32_t len ;
2008-07-30 02:51:32 +00:00
2006-11-16 03:02:42 +00:00
dir = finddirshigh ;
2008-07-30 02:51:32 +00:00
for ( i = 0 ; i < 5 ; i + + ) if ( ! dir - > prev ) break ;
2006-11-16 03:02:42 +00:00
else dir = dir - > prev ;
2008-07-30 02:51:32 +00:00
for ( i = 5 ; i > - 8 & & dir ; i - - , dir = dir - > next )
2006-11-15 01:16:55 +00:00
{
2012-10-14 22:16:07 +00:00
if ( dir = = finddirshigh & & currentlist = = 0 ) margin = 0 ;
else margin = 16 ;
2008-07-30 02:51:32 +00:00
len = Bstrlen ( dir - > name ) ;
Bstrncpy ( tempbuf , dir - > name , len ) ;
if ( len > USERMAPENTRYLENGTH )
{
len = USERMAPENTRYLENGTH - 3 ;
tempbuf [ len ] = 0 ;
while ( len < USERMAPENTRYLENGTH )
tempbuf [ len + + ] = ' . ' ;
}
tempbuf [ len ] = 0 ;
2012-10-14 22:16:07 +00:00
minitextshade ( 40 , 1 + 12 + 32 + 8 * ( 6 - i ) , tempbuf , margin , 0 , 26 ) ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
mgametext ( 180 + 4 , 32 , " Map Files " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( findfileshigh )
{
2009-01-09 09:29:17 +00:00
int32_t len ;
2008-07-30 02:51:32 +00:00
2006-11-16 03:02:42 +00:00
dir = findfileshigh ;
2008-07-30 02:51:32 +00:00
for ( i = 0 ; i < 6 ; i + + ) if ( ! dir - > prev ) break ;
2006-11-16 03:02:42 +00:00
else dir = dir - > prev ;
2008-07-30 02:51:32 +00:00
for ( i = 6 ; i > - 8 & & dir ; i - - , dir = dir - > next )
2006-11-15 01:16:55 +00:00
{
2012-10-14 22:16:07 +00:00
if ( dir = = findfileshigh & & currentlist = = 1 ) margin = 0 ;
else margin = 16 ;
2008-07-30 02:51:32 +00:00
len = Bstrlen ( dir - > name ) ;
Bstrncpy ( tempbuf , dir - > name , len ) ;
if ( len > USERMAPENTRYLENGTH )
{
len = USERMAPENTRYLENGTH - 3 ;
tempbuf [ len ] = 0 ;
while ( len < USERMAPENTRYLENGTH )
tempbuf [ len + + ] = ' . ' ;
}
tempbuf [ len ] = 0 ;
2012-10-14 22:16:07 +00:00
minitextshade ( 180 , 1 + 12 + 32 + 8 * ( 6 - i ) , tempbuf , margin ,
2012-02-20 19:53:07 +00:00
dir - > source = = CACHE1D_SOURCE_ZIP ? 8 : 2 ,
26 ) ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-05-01 12:39:02 +00:00
if ( KB_KeyPressed ( sc_LeftArrow ) | | KB_KeyPressed ( sc_kpad_4 ) | | ( LMB & & minfo . dyaw < - 256 ) | |
KB_KeyPressed ( sc_RightArrow ) | | KB_KeyPressed ( sc_kpad_6 ) | | ( LMB & & minfo . dyaw > 256 ) | |
2006-11-16 03:02:42 +00:00
KB_KeyPressed ( sc_Tab ) )
{
KB_ClearKeyDown ( sc_LeftArrow ) ;
KB_ClearKeyDown ( sc_kpad_4 ) ;
KB_ClearKeyDown ( sc_RightArrow ) ;
KB_ClearKeyDown ( sc_kpad_6 ) ;
KB_ClearKeyDown ( sc_Tab ) ;
currentlist = 1 - currentlist ;
2008-11-20 14:06:36 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
onbar = 0 ;
probey = 2 ;
2008-07-29 05:43:47 +00:00
if ( currentlist = = 0 ) x = probesm ( 45 , 32 + 4 + 1 , 0 , 3 ) ;
else x = probesm ( 185 , 32 + 4 + 1 , 0 , 3 ) ;
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
if ( probey = = 1 )
{
if ( currentlist = = 0 )
2006-04-20 19:21:40 +00:00
{
2006-11-16 03:02:42 +00:00
if ( finddirshigh )
if ( finddirshigh - > prev ) finddirshigh = finddirshigh - > prev ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
else
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( findfileshigh )
if ( findfileshigh - > prev ) findfileshigh = findfileshigh - > prev ;
}
}
else if ( probey = = 0 )
{
if ( currentlist = = 0 )
{
if ( finddirshigh )
if ( finddirshigh - > next ) finddirshigh = finddirshigh - > next ;
}
else
{
if ( findfileshigh )
if ( findfileshigh - > next ) findfileshigh = findfileshigh - > next ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
}
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
{
2012-03-28 19:42:16 +00:00
fnlist_clearnames ( & fnlist ) ;
2006-11-16 03:02:42 +00:00
boardfilename [ 0 ] = 0 ;
2010-01-16 23:08:17 +00:00
if ( ( g_netServer | | ud . multimode > 1 ) )
2006-11-16 03:02:42 +00:00
{
2008-11-20 14:06:36 +00:00
Net_SendUserMapName ( ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 600 ) ;
2007-02-05 01:33:08 +00:00
probey = last_menu_pos ;
2006-11-16 03:02:42 +00:00
}
2012-10-14 22:16:07 +00:00
else M_ChangeMenu ( MENU_EPISODE ) ;
2006-11-16 03:02:42 +00:00
}
else if ( x > = 0 )
{
if ( currentlist = = 0 )
{
if ( ! finddirshigh ) break ;
strcat ( boardfilename , finddirshigh - > name ) ;
strcat ( boardfilename , " / " ) ;
Bcorrectfilename ( boardfilename , 1 ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_USERMAP ) ;
2006-11-16 03:02:42 +00:00
KB_FlushKeyboardQueue ( ) ;
}
else
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( ! findfileshigh ) break ;
strcat ( boardfilename , findfileshigh - > name ) ;
ud . m_volume_number = 0 ;
ud . m_level_number = 7 ;
2010-01-16 23:08:17 +00:00
if ( ( g_netServer | | ud . multimode > 1 ) )
2006-04-20 19:21:40 +00:00
{
2008-11-20 14:06:36 +00:00
Net_SendUserMapName ( ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 600 ) ;
2007-02-05 01:33:08 +00:00
probey = last_menu_pos ;
2006-11-15 01:16:55 +00:00
}
2012-10-14 22:16:07 +00:00
else M_ChangeMenu ( MENU_SKILL ) ;
2006-04-13 20:47:06 +00:00
}
2012-03-28 19:42:16 +00:00
fnlist_clearnames ( & fnlist ) ;
2006-11-16 03:02:42 +00:00
}
break ;
2012-10-14 22:16:07 +00:00
case MENU_SKILL :
2012-03-25 22:00:27 +00:00
{
// 4 skills (orig) --> 70
const int32_t ybase = 70 + ( 4 - g_numSkills ) * 6 ;
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_CENTER ;
M_DrawTopBar ( " Select Skill " ) ;
x = M_Probe ( margin , ybase , 19 , g_numSkills ) ;
2006-11-16 03:02:42 +00:00
if ( x > = 0 )
{
switch ( x )
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
case 0 :
2008-11-20 14:06:36 +00:00
g_skillSoundID = JIBBED_ACTOR6 ;
2006-11-16 03:02:42 +00:00
break ;
case 1 :
2008-11-20 14:06:36 +00:00
g_skillSoundID = BONUS_SPEECH1 ;
2006-11-16 03:02:42 +00:00
break ;
case 2 :
2008-11-20 14:06:36 +00:00
g_skillSoundID = DUKE_GETWEAPON2 ;
2006-11-16 03:02:42 +00:00
break ;
case 3 :
2008-11-20 14:06:36 +00:00
g_skillSoundID = JIBBED_ACTOR5 ;
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
}
2008-11-20 14:06:36 +00:00
S_PlaySound ( g_skillSoundID ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
ud . m_player_skill = x + 1 ;
if ( x = = 3 ) ud . m_respawn_monsters = 1 ;
else ud . m_respawn_monsters = 0 ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
ud . m_monsters_off = ud . monsters_off = 0 ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
ud . m_respawn_items = 0 ;
ud . m_respawn_inventory = 0 ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
ud . multimode = 1 ;
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
if ( ud . m_volume_number = = 3 )
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
flushperms ( ) ;
setview ( 0 , 0 , xdim - 1 , ydim - 1 ) ;
clearview ( 0L ) ;
nextpage ( ) ;
2006-04-13 20:47:06 +00:00
}
2008-11-20 14:06:36 +00:00
G_NewGame ( ud . m_volume_number , ud . m_level_number , ud . m_player_skill ) ;
if ( G_EnterLevel ( MODE_GAME ) ) G_BackToMenu ( ) ;
2006-11-16 03:02:42 +00:00
}
else if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_EPISODE ) ;
2006-11-16 03:02:42 +00:00
KB_FlushKeyboardQueue ( ) ;
}
2012-03-25 22:00:27 +00:00
for ( i = 0 ; i < g_numSkills ; i + + )
2012-10-14 22:16:07 +00:00
menutext ( margin , ybase + i * 19 , MENUHIGHLIGHT ( i ) , 0 , SkillNames [ i ] ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-03-25 22:00:27 +00:00
}
2006-11-16 03:02:42 +00:00
case 230 :
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Renderer Setup " ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_REGULAR ;
2006-11-16 03:02:42 +00:00
{
2012-10-14 22:16:07 +00:00
int32_t io , ii , yy , d = margin + 160 + 40 , enabled ;
2012-02-18 17:56:39 +00:00
static const char * const opts [ ] =
2007-08-25 01:05:00 +00:00
{
2009-10-17 09:33:32 +00:00
" Aspect ratio " ,
2012-02-18 17:56:39 +00:00
" Ambient light level " ,
# ifdef USE_OPENGL
2007-08-25 01:05:00 +00:00
" Anisotropic filtering " ,
2008-07-29 05:43:47 +00:00
" Use VSync " ,
2007-08-25 01:05:00 +00:00
" - " ,
2008-07-22 05:13:20 +00:00
" Enable hires textures " ,
2008-07-29 05:43:47 +00:00
" Hires texture quality " ,
2009-10-17 09:33:32 +00:00
" Pre-load map textures " ,
" On disk texture cache " ,
2008-07-22 05:13:20 +00:00
" Use detail textures " ,
2007-08-25 01:05:00 +00:00
" - " ,
2008-07-22 05:13:20 +00:00
" Use models " ,
2012-02-18 17:56:39 +00:00
# endif
2007-08-25 01:05:00 +00:00
NULL
} ;
2006-11-16 03:02:42 +00:00
yy = 37 ;
for ( ii = io = 0 ; opts [ ii ] ; ii + + )
{
2012-12-30 20:34:34 +00:00
if ( getrendermode ( ) = = REND_CLASSIC & & io > = 2 )
2012-02-18 17:56:39 +00:00
break ;
2006-11-16 03:02:42 +00:00
if ( opts [ ii ] [ 0 ] = = ' - ' & & ! opts [ ii ] [ 1 ] )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( io < = probey ) yy + = 4 ;
continue ;
2006-04-15 04:06:50 +00:00
}
2006-11-16 03:02:42 +00:00
if ( io < probey ) yy + = 8 ;
io + + ;
}
2006-04-15 04:06:50 +00:00
2012-02-18 17:56:39 +00:00
onbar = ( probey = = 1 | | probey = = 5 ) ;
2012-10-14 22:16:07 +00:00
x = probesm ( margin , yy + 5 , 0 , io ) ;
2006-04-15 04:06:50 +00:00
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_VIDEOSETUP ) ;
2007-02-16 00:11:25 +00:00
probey = 6 ;
2006-11-16 03:02:42 +00:00
break ;
}
yy = 37 ;
for ( ii = io = 0 ; opts [ ii ] ; ii + + )
{
2012-12-30 20:34:34 +00:00
if ( getrendermode ( ) = = REND_CLASSIC & & io > = 2 )
2012-02-18 17:56:39 +00:00
break ;
2006-11-16 03:02:42 +00:00
if ( opts [ ii ] [ 0 ] = = ' - ' & & ! opts [ ii ] [ 1 ] )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
yy + = 4 ;
continue ;
2006-04-15 04:06:50 +00:00
}
2012-02-18 17:56:39 +00:00
2006-11-16 03:02:42 +00:00
enabled = 1 ;
switch ( io )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
case 0 :
2012-12-30 20:34:34 +00:00
if ( getrendermode ( ) < = REND_POLYMOST )
2009-10-17 09:33:32 +00:00
{
2012-02-18 17:56:39 +00:00
# ifdef USE_OPENGL
int32_t tmp = r_usenewaspect ? 2 : glwidescreen ;
if ( x = = io )
{
tmp = tmp + 1 ;
if ( tmp > 2 )
tmp = 0 ;
}
modval ( 0 , 2 , & tmp , 1 , probey = = io ) ;
r_usenewaspect = ( tmp = = 2 ) ;
// with r_usenewaspect, glwidescreen has no effect...
glwidescreen = ( tmp < 2 ) ? tmp : 0 ;
mgametextpal ( d , yy , r_usenewaspect ? " Auto " :
( glwidescreen ? " Old wide " : " Old reg. " ) ,
MENUHIGHLIGHT ( io ) , 0 ) ;
# else
if ( x = = io )
r_usenewaspect = ! r_usenewaspect ;
modval ( 0 , 1 , & r_usenewaspect , 1 , probey = = io ) ;
mgametextpal ( d , yy , r_usenewaspect ? " Auto " : " Old reg. " ,
MENUHIGHLIGHT ( io ) , 0 ) ;
# endif
2009-10-17 09:33:32 +00:00
}
# ifdef POLYMER
else
{
2012-11-15 14:28:47 +00:00
double ratios [ ] = { 0.0 , 1.33 , 1.66 , 1.78 , 1.85 , 2.35 } ;
2010-01-23 22:12:02 +00:00
int32_t j = ( sizeof ( ratios ) / sizeof ( ratios [ 0 ] ) ) ;
for ( i = 0 ; i < j ; i + + )
if ( ratios [ i ] = = pr_customaspect )
break ;
modval ( 0 , j - 1 , ( int32_t * ) & i , 1 , probey = = io ) ;
if ( x = = io )
{
i + + ;
if ( i > = j )
i = 0 ;
}
if ( i = = j )
Bsprintf ( tempbuf , " Custom " ) ;
else
{
if ( i = = 0 ) Bsprintf ( tempbuf , " Auto " ) ;
else Bsprintf ( tempbuf , " %.2f:1 " , ratios [ i ] ) ;
if ( ratios [ i ] ! = pr_customaspect )
pr_customaspect = ratios [ i ] ;
}
mgametextpal ( d , yy , tempbuf , MENUHIGHLIGHT ( io ) , 0 ) ;
2009-10-17 09:33:32 +00:00
}
# endif
2006-11-16 03:02:42 +00:00
break ;
case 1 :
2012-02-18 17:56:39 +00:00
{
int32_t i = ( int32_t ) ( r_ambientlight * 1024.f ) ;
int32_t j = i ;
2012-02-18 17:56:52 +00:00
sliderbar ( 1 , d + 8 , yy + 7 , & i , 128 , x = = io , MENUHIGHLIGHT ( io ) , 0 , 128 , 4096 ) ;
2012-02-18 17:56:39 +00:00
Bsprintf ( tempbuf , " %.2f " , r_ambientlight ) ;
mgametextpal ( d - 35 , yy , tempbuf , MENUHIGHLIGHT ( io ) , 0 ) ;
if ( i ! = j )
{
r_ambientlight = ( float ) i / 1024.f ;
r_ambientlightrecip = 1.f / r_ambientlight ;
}
break ;
}
# ifdef USE_OPENGL
case 2 :
2008-07-09 23:25:38 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t dummy = glanisotropy ;
modval ( 0 , ( int32_t ) glinfo . maxanisotropy + 1 , ( int32_t * ) & dummy , 1 , probey = = io ) ;
2008-07-09 23:25:38 +00:00
if ( dummy > glanisotropy ) glanisotropy * = 2 ;
else if ( dummy < glanisotropy ) glanisotropy / = 2 ;
2007-02-16 00:11:25 +00:00
if ( x = = io )
glanisotropy * = 2 ;
2008-07-09 23:25:38 +00:00
if ( glanisotropy > glinfo . maxanisotropy ) glanisotropy = 1 ;
2009-01-09 09:29:17 +00:00
else if ( glanisotropy < 1 ) glanisotropy = ( int32_t ) glinfo . maxanisotropy ;
2008-07-09 23:25:38 +00:00
gltexapplyprops ( ) ;
2012-03-26 05:07:12 +00:00
if ( glanisotropy = = 1 ) strcpy ( tempbuf , " None " ) ;
2009-02-02 01:49:14 +00:00
else Bsprintf ( tempbuf , " %dx " , glanisotropy ) ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , tempbuf , MENUHIGHLIGHT ( io ) , 0 ) ;
2007-02-16 00:11:25 +00:00
break ;
2008-07-09 23:25:38 +00:00
}
2012-02-18 17:56:39 +00:00
case 3 :
2008-07-29 05:43:47 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t ovsync = vsync ;
2008-07-29 05:43:47 +00:00
if ( x = = io ) vsync = ! vsync ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & vsync , 1 , probey = = io ) ;
2008-07-29 05:43:47 +00:00
mgametextpal ( d , yy , vsync ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
if ( vsync ! = ovsync )
setvsync ( vsync ) ;
break ;
}
case 4 :
2006-11-16 03:02:42 +00:00
if ( x = = io ) usehightile = 1 - usehightile ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & usehightile , 1 , probey = = io ) ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , usehightile ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
2008-07-29 05:43:47 +00:00
case 5 :
{
i = r_downsize ;
enabled = usehightile ;
2012-02-18 17:56:52 +00:00
sliderbar ( 1 , d + 8 , yy + 7 , & r_downsize , - 1 , enabled & & x = = io , MENUHIGHLIGHT ( io ) , ! enabled , 0 , 2 ) ;
2008-07-29 05:43:47 +00:00
if ( r_downsize ! = i )
{
2008-11-25 13:06:36 +00:00
invalidatecache ( ) ;
2008-07-29 05:43:47 +00:00
resetvideomode ( ) ;
if ( setgamemode ( fullscreen , xdim , ydim , bpp ) )
OSD_Printf ( " restartvid: Reset failed... \n " ) ;
2010-05-04 23:40:49 +00:00
r_downsizevar = r_downsize ;
2008-07-29 09:57:09 +00:00
return ;
2008-07-29 05:43:47 +00:00
}
break ;
}
case 6 :
2006-11-16 03:02:42 +00:00
enabled = usehightile ;
2007-08-27 00:20:15 +00:00
if ( enabled & & x = = io ) ud . config . useprecache = ! ud . config . useprecache ;
2009-01-09 09:29:17 +00:00
if ( enabled ) modval ( 0 , 1 , ( int32_t * ) & ud . config . useprecache , 1 , probey = = io ) ;
2008-07-30 11:01:39 +00:00
mgametextpal ( d , yy , ud . config . useprecache ? " On " : " Off " , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
2008-07-29 05:43:47 +00:00
case 7 :
2010-01-23 22:12:02 +00:00
{
2012-07-01 22:11:33 +00:00
const char * s [ ] = { " Off " , " On " , " Compress " } ;
2010-01-23 22:12:02 +00:00
enabled = ( glusetexcompr & & usehightile ) ;
if ( enabled & & x = = io )
2009-10-17 09:33:32 +00:00
{
2010-01-23 22:12:02 +00:00
glusetexcache + + ;
if ( glusetexcache > 2 )
glusetexcache = 0 ;
2009-10-17 09:33:32 +00:00
}
2010-01-23 22:12:02 +00:00
if ( enabled ) modval ( 0 , 2 , ( int32_t * ) & glusetexcache , 1 , probey = = io ) ;
mgametextpal ( d , yy , s [ glusetexcache ] , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , 0 ) ;
}
break ;
2008-07-29 05:43:47 +00:00
case 8 :
2007-01-20 03:10:32 +00:00
enabled = usehightile ;
if ( enabled & & x = = io ) r_detailmapping = ! r_detailmapping ;
2009-01-09 09:29:17 +00:00
if ( enabled ) modval ( 0 , 1 , ( int32_t * ) & r_detailmapping , 1 , probey = = io ) ;
2008-07-30 11:01:39 +00:00
mgametextpal ( d , yy , r_detailmapping ? " Yes " : " No " , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , 0 ) ;
2007-01-20 03:10:32 +00:00
break ;
2009-10-17 09:33:32 +00:00
case 9 :
2006-11-16 03:02:42 +00:00
if ( x = = io ) usemodels = 1 - usemodels ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & usemodels , 1 , probey = = io ) ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , usemodels ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-02-18 17:56:39 +00:00
# endif
2006-11-16 03:02:42 +00:00
default :
break ;
2006-11-15 01:16:55 +00:00
}
2012-10-14 22:16:07 +00:00
mgametextpal ( margin , yy , opts [ ii ] , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , 10 ) ;
2006-11-16 03:02:42 +00:00
io + + ;
yy + = 8 ;
2006-04-15 04:06:50 +00:00
}
2006-11-16 03:02:42 +00:00
}
break ;
2008-07-20 11:03:57 +00:00
case 231 :
2008-07-25 23:39:41 +00:00
case 232 :
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Color Correction " ) ;
2008-07-20 11:03:57 +00:00
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_REGULAR ;
2008-07-20 11:03:57 +00:00
x = 4 ;
2008-07-24 04:54:40 +00:00
onbar = ( probey ! = 3 ) ;
2012-10-14 22:16:07 +00:00
x = M_Probe ( margin , probey = = 3 ? 106 : 98 , 16 , x ) ;
2008-07-20 11:03:57 +00:00
if ( x = = - 1 )
{
2010-08-02 08:13:51 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME & & g_currentMenu = = 232 )
2008-07-25 23:39:41 +00:00
{
g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
2008-07-25 23:39:41 +00:00
{
ready2send = 1 ;
totalclock = ototalclock ;
}
}
else
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_VIDEOSETUP ) ;
2008-07-25 23:39:41 +00:00
probey = 4 ;
}
2008-07-20 11:03:57 +00:00
break ;
}
2012-10-14 22:16:07 +00:00
menutext ( margin , 98 , MENUHIGHLIGHT ( 0 ) , 0 , " Gamma " ) ;
menutext ( margin , 98 + 16 , MENUHIGHLIGHT ( 1 ) , 0 , " Contrast " ) ;
menutext ( margin , 98 + 16 + 16 , MENUHIGHLIGHT ( 2 ) , 0 , " Brightness " ) ;
menutext ( margin , 98 + 16 + 16 + 16 + 8 , MENUHIGHLIGHT ( 3 ) , 0 , " Reset To Defaults " ) ;
2008-07-20 11:18:42 +00:00
2008-07-21 03:06:34 +00:00
Bsprintf ( tempbuf , " %s%.2f " , vid_gamma > = 0 ? " " : " " , vid_gamma ) ;
2012-10-14 22:16:07 +00:00
mgametext ( margin + 177 - 56 , 98 - 8 , tempbuf , MENUHIGHLIGHT ( 0 ) , 2 + 8 + 16 ) ;
2008-07-21 03:06:34 +00:00
Bsprintf ( tempbuf , " %s%.2f " , vid_contrast > = 0 ? " " : " " , vid_contrast ) ;
2012-10-14 22:16:07 +00:00
mgametext ( margin + 177 - 56 , 98 + 16 - 8 , tempbuf , MENUHIGHLIGHT ( 1 ) , 2 + 8 + 16 ) ;
2008-07-21 03:06:34 +00:00
Bsprintf ( tempbuf , " %s%.2f " , vid_brightness > = 0 ? " " : " " , vid_brightness ) ;
2012-10-14 22:16:07 +00:00
mgametext ( margin + 177 - 56 , 98 + 16 + 16 - 8 , tempbuf , MENUHIGHLIGHT ( 2 ) , 2 + 8 + 16 ) ;
2008-07-24 04:54:40 +00:00
rotatesprite ( 40 < < 16 , 24 < < 16 , 24576 , 0 , BONUSSCREEN , 0 , 0 , 2 + 8 + 16 , 0 , scale ( ydim , 35 , 200 ) , xdim - 1 , scale ( ydim , 80 , 200 ) - 1 ) ;
rotatesprite ( 160 < < 16 , 27 < < 16 , 24576 , 0 , 3290 , 0 , 0 , 2 + 8 + 16 , 0 , scale ( ydim , 35 , 200 ) , xdim - 1 , scale ( ydim , 80 , 200 ) - 1 ) ;
2008-07-20 11:18:42 +00:00
2008-07-20 11:03:57 +00:00
{
2012-05-05 22:22:19 +00:00
extern int32_t gammabrightness ;
2009-01-09 09:29:17 +00:00
int32_t b = ( int32_t ) ( vid_gamma * 40960.f ) ;
2012-10-14 22:16:07 +00:00
sliderbar ( 0 , margin + 177 , 98 , & b , 4096 , x = = 0 , MENUHIGHLIGHT ( 0 ) , 0 , 8192 , 163840 ) ;
2008-07-20 11:03:57 +00:00
2008-07-26 07:20:57 +00:00
if ( b ! = ( double ) ( vid_gamma * 40960.f ) )
2008-07-20 11:03:57 +00:00
{
2008-07-26 07:20:57 +00:00
vid_gamma = ( double ) b / 40960.f ;
2012-05-05 22:23:17 +00:00
ud . brightness = GAMMA_CALC ;
2008-07-20 11:03:57 +00:00
ud . brightness < < = 2 ;
2011-01-27 06:35:52 +00:00
setbrightness ( ud . brightness > > 2 , g_player [ myconnectindex ] . ps - > palette , 0 ) ;
2008-07-20 11:03:57 +00:00
}
2009-01-09 09:29:17 +00:00
b = ( int32_t ) ( vid_contrast * 40960.f ) ;
2012-10-14 22:16:07 +00:00
sliderbar ( 0 , margin + 177 , 98 + 16 , & b , 2048 , x = = 1 , gammabrightness ? MENUHIGHLIGHT ( 1 ) : DISABLEDMENUSHADE , 0 , 4096 , 110592 ) ;
2008-07-20 11:03:57 +00:00
if ( b ! = ( vid_contrast * 40960.f ) )
{
2008-07-26 07:20:57 +00:00
vid_contrast = ( double ) b / 40960.f ;
2011-01-27 06:35:52 +00:00
setbrightness ( ud . brightness > > 2 , g_player [ myconnectindex ] . ps - > palette , 0 ) ;
2008-07-20 11:03:57 +00:00
}
2009-01-09 09:29:17 +00:00
b = ( int32_t ) ( vid_brightness * 40960.f ) ;
2012-10-14 22:16:07 +00:00
sliderbar ( 0 , margin + 177 , 98 + 16 + 16 , & b , 2048 , x = = 2 , gammabrightness ? MENUHIGHLIGHT ( 2 ) : DISABLEDMENUSHADE , 0 , - 32768 , 32768 ) ;
2008-07-20 11:03:57 +00:00
if ( b ! = ( vid_brightness * 40960.f ) )
{
2008-07-26 07:20:57 +00:00
vid_brightness = ( double ) b / 40960.f ;
2011-01-27 06:35:52 +00:00
setbrightness ( ud . brightness > > 2 , g_player [ myconnectindex ] . ps - > palette , 0 ) ;
2008-07-20 11:03:57 +00:00
}
if ( x = = 3 )
{
vid_gamma = DEFAULT_GAMMA ;
vid_contrast = DEFAULT_CONTRAST ;
vid_brightness = DEFAULT_BRIGHTNESS ;
2008-07-24 02:07:22 +00:00
ud . brightness = 0 ;
2011-01-27 06:35:52 +00:00
setbrightness ( ud . brightness > > 2 , g_player [ myconnectindex ] . ps - > palette , 0 ) ;
2008-07-20 11:03:57 +00:00
}
}
break ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
case MENU_SETUP :
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Game Setup " ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_REGULAR ;
2006-11-16 03:02:42 +00:00
{
2012-10-14 22:16:07 +00:00
int32_t io , ii , yy , d = margin + 160 + 40 , enabled ;
2012-07-01 22:11:33 +00:00
const char * opts [ ] =
2007-08-25 01:05:00 +00:00
{
2008-07-28 21:23:10 +00:00
" Show setup window at start " ,
2008-07-21 03:06:34 +00:00
" Show crosshair " ,
2008-07-21 09:05:53 +00:00
" Crosshair size " ,
2007-08-25 01:05:00 +00:00
" - " ,
" Screen size " ,
" Status bar size " ,
2008-11-22 11:42:22 +00:00
" Stats and chat text size " ,
2008-07-21 09:05:53 +00:00
" Show level stats " ,
2007-08-25 01:05:00 +00:00
" - " ,
2008-07-21 03:06:34 +00:00
" Allow walk with autorun " ,
2007-08-25 01:05:00 +00:00
" - " ,
" Shadows " ,
" Screen tilting " ,
" - " ,
2008-07-28 21:23:10 +00:00
" Show framerate " ,
2008-07-21 03:06:34 +00:00
" Demo recording " ,
2007-08-25 01:05:00 +00:00
" - " ,
" More... " ,
NULL
} ;
2006-11-16 03:02:42 +00:00
yy = 37 ;
for ( ii = io = 0 ; opts [ ii ] ; ii + + )
{
if ( opts [ ii ] [ 0 ] = = ' - ' & & ! opts [ ii ] [ 1 ] )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( io < = probey ) yy + = 4 ;
continue ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
if ( io < probey ) yy + = 8 ;
io + + ;
}
2008-10-05 11:51:59 +00:00
onbar = ( probey > = 2 & & probey < = 5 ) ;
2012-10-14 22:16:07 +00:00
x = probesm ( margin , yy + 5 , 0 , io ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_OPTIONS ) ;
2006-11-16 03:02:42 +00:00
break ;
}
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
yy = 37 ;
for ( ii = io = 0 ; opts [ ii ] ; ii + + )
{
if ( opts [ ii ] [ 0 ] = = ' - ' & & ! opts [ ii ] [ 1 ] )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
yy + = 4 ;
continue ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
enabled = 1 ;
switch ( io )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
case 0 :
2008-07-28 21:23:10 +00:00
if ( x = = io ) ud . config . ForceSetup = 1 - ud . config . ForceSetup ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . config . ForceSetup , 1 , probey = = io ) ;
2008-07-28 21:23:10 +00:00
mgametextpal ( d , yy , ud . config . ForceSetup ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
break ;
case 1 :
2008-07-21 09:05:53 +00:00
if ( x = = io ) ud . crosshair = ! ud . crosshair ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . crosshair , 1 , probey = = io ) ;
2006-11-15 01:16:55 +00:00
{
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , ud . crosshair ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
2006-11-13 23:12:47 +00:00
}
2008-07-28 21:23:10 +00:00
case 2 :
2008-07-21 09:05:53 +00:00
{
2013-01-17 21:59:11 +00:00
int32_t chs = ud . crosshairscale ;
sliderbar ( 1 , d + 8 , yy + 7 , & chs , 5 , x = = io , MENUHIGHLIGHT ( io ) , 0 , 25 , 100 ) ;
ud . crosshairscale = clamp ( chs , 10 , 100 ) ;
2008-07-21 09:05:53 +00:00
}
break ;
2008-07-28 21:23:10 +00:00
case 3 :
2008-05-15 03:16:38 +00:00
{
2013-01-17 21:59:11 +00:00
int32_t vpsize = ud . screen_size + 4 * ( ud . screen_size > = 8 & & ud . statusbarmode = = 0 ) ;
const int32_t ovpsize = vpsize ;
2013-01-17 21:59:01 +00:00
2013-01-17 21:59:11 +00:00
sliderbar ( 1 , d + 8 , yy + 7 , & vpsize , - 4 , x = = io , MENUHIGHLIGHT ( io ) , 0 , 0 , 68 ) ;
2013-01-17 21:59:01 +00:00
2013-01-17 21:59:11 +00:00
if ( vpsize - ovpsize )
G_SetViewportShrink ( vpsize - ovpsize ) ;
2008-05-15 03:16:38 +00:00
}
break ;
2008-07-28 21:23:10 +00:00
case 4 :
2008-05-15 03:16:38 +00:00
{
2013-01-17 21:59:11 +00:00
int32_t sbs = ud . statusbarscale ;
const int32_t osbs = sbs ;
sliderbar ( 1 , d + 8 , yy + 7 , & sbs , 4 , x = = io , MENUHIGHLIGHT ( io ) , 0 , 36 , 100 ) ;
if ( x = = io & & sbs ! = osbs )
G_SetStatusBarScale ( sbs ) ;
2008-05-15 03:16:38 +00:00
}
break ;
2008-07-28 21:23:10 +00:00
case 5 :
2008-10-05 11:51:59 +00:00
{
2012-02-18 17:56:52 +00:00
sliderbar ( 1 , d + 8 , yy + 7 , & ud . textscale , 50 , enabled & & x = = io , MENUHIGHLIGHT ( io ) , 0 , 100 , 400 ) ;
2008-10-05 11:51:59 +00:00
}
break ;
case 6 :
2008-07-21 09:05:53 +00:00
if ( x = = io ) ud . levelstats = 1 - ud . levelstats ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . levelstats , 1 , probey = = io ) ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , ud . levelstats ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
2008-07-21 09:05:53 +00:00
break ;
2008-10-05 11:51:59 +00:00
case 7 :
2006-11-16 03:02:42 +00:00
if ( x = = io ) ud . runkey_mode = 1 - ud . runkey_mode ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . runkey_mode , 1 , probey = = io ) ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , ud . runkey_mode ? " No " : " Yes " , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
2008-10-05 11:51:59 +00:00
case 8 :
2006-11-16 03:02:42 +00:00
if ( x = = io ) ud . shadows = 1 - ud . shadows ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . shadows , 1 , probey = = io ) ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , ud . shadows ? " On " : " Off " , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
2008-10-05 11:51:59 +00:00
case 9 :
2013-02-10 16:24:20 +00:00
if ( x = = io ) ud . screen_tilting = ! ud . screen_tilting ;
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2008-07-24 11:16:20 +00:00
if ( ! ud . screen_tilting ) setrollangle ( 0 ) ;
# endif
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . screen_tilting , 1 , probey = = io ) ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , ud . screen_tilting ? " On " : " Off " , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ; // original had a 'full' option
2008-10-05 11:51:59 +00:00
case 10 :
2008-07-28 21:23:10 +00:00
if ( x = = io ) ud . tickrate = 1 - ud . tickrate ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . tickrate , 1 , probey = = io ) ;
2008-07-28 21:23:10 +00:00
mgametextpal ( d , yy , ud . tickrate ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
2008-10-05 11:51:59 +00:00
case 11 :
2012-08-24 18:54:01 +00:00
{
DukePlayer_t * ps = g_player [ myconnectindex ] . ps ;
2006-11-16 03:02:42 +00:00
if ( x = = io )
{
2012-08-24 18:54:01 +00:00
enabled = ! ( ( ps - > gm & MODE_GAME ) & & ud . m_recstat ! = 1 ) ;
if ( ( ps - > gm & MODE_GAME ) ) G_CloseDemoWrite ( ) ;
2006-11-16 03:02:42 +00:00
else ud . m_recstat = ! ud . m_recstat ;
2006-04-13 20:47:06 +00:00
}
2012-08-24 18:54:01 +00:00
if ( ( ps - > gm & MODE_GAME ) & & ud . m_recstat ! = 1 )
2006-11-16 03:02:42 +00:00
enabled = 0 ;
2012-08-24 18:54:01 +00:00
mgametextpal ( d , yy , ud . m_recstat ? ( ( enabled & & ps - > gm & MODE_GAME ) ? " Running " : " On " ) : " Off " ,
enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , ! enabled ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-08-24 18:54:01 +00:00
}
2008-10-05 11:51:59 +00:00
case 12 :
2012-10-14 22:16:07 +00:00
if ( x = = io ) M_ChangeMenu ( MENU_GAMESETUP ) ;
2006-11-16 03:02:42 +00:00
break ;
default :
break ;
2006-04-13 20:47:06 +00:00
}
2012-10-14 22:16:07 +00:00
mgametextpal ( margin , yy , opts [ ii ] , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , 10 ) ;
2006-11-16 03:02:42 +00:00
io + + ;
yy + = 8 ;
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
2012-10-14 22:16:07 +00:00
case MENU_GAMESETUP :
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Game Setup " ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_REGULAR ;
2006-11-16 03:02:42 +00:00
{
2012-10-14 22:16:07 +00:00
int32_t io , ii , yy , d = margin + 160 + 40 , enabled ;
2012-07-01 22:11:33 +00:00
const char * opts [ ] =
2007-08-25 01:05:00 +00:00
{
" Parental lock " ,
" - " ,
2008-07-22 10:56:22 +00:00
" Show inv & pickup messages " ,
2009-10-17 09:33:32 +00:00
" Display current weapon " ,
" Upgraded status bar " ,
" Camera view in demos " ,
2007-08-25 01:05:00 +00:00
" - " ,
2008-07-28 21:23:10 +00:00
" DM: Ignore map votes " ,
" DM: Use private messages " ,
" DM: Show player names " ,
" DM: Show player weapons " ,
2008-07-31 10:35:23 +00:00
" DM: Show player obituaries " ,
2007-08-25 01:05:00 +00:00
" - " ,
2008-07-23 03:56:50 +00:00
" Console text style " ,
" - " ,
2006-12-18 08:37:12 +00:00
# ifdef _WIN32
2008-07-28 21:23:10 +00:00
" Check for updates at start " ,
2006-12-18 08:37:12 +00:00
# else
2007-08-25 01:05:00 +00:00
" - " ,
" - " ,
2006-12-14 08:50:18 +00:00
# endif
2007-08-25 01:05:00 +00:00
" - " ,
" Previous page " ,
NULL
} ;
2006-11-16 03:02:42 +00:00
yy = 37 ;
for ( ii = io = 0 ; opts [ ii ] ; ii + + )
{
if ( opts [ ii ] [ 0 ] = = ' - ' & & ! opts [ ii ] [ 1 ] )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( io < = probey ) yy + = 4 ;
continue ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
if ( io < probey ) yy + = 8 ;
io + + ;
}
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
x = probesm ( margin , yy + 5 , 0 , io ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_SETUP ) ;
2008-10-05 11:51:59 +00:00
probey = 12 ;
2006-11-16 03:02:42 +00:00
break ;
}
yy = 37 ;
for ( ii = io = 0 ; opts [ ii ] ; ii + + )
{
if ( opts [ ii ] [ 0 ] = = ' - ' & & ! opts [ ii ] [ 1 ] )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
yy + = 4 ;
continue ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
enabled = 1 ;
switch ( io )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
case 0 :
if ( ! NAM )
2006-11-15 01:16:55 +00:00
{
2012-10-14 22:16:07 +00:00
if ( x = = io ) M_ChangeMenu ( MENU_ADULTMODE ) ;
2006-11-13 23:12:47 +00:00
}
2006-11-16 03:02:42 +00:00
else enabled = 0 ;
break ;
case 1 :
2007-01-04 07:15:17 +00:00
if ( x = = io )
ud . fta_on = 1 - ud . fta_on ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . fta_on , 1 , probey = = io ) ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , ud . fta_on ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
2007-01-04 07:15:17 +00:00
break ;
case 2 :
2006-11-16 03:02:42 +00:00
if ( x = = io )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
ud . drawweapon = ( ud . drawweapon = = 2 ) ? 0 : ud . drawweapon + 1 ;
}
2009-01-09 09:29:17 +00:00
modval ( 0 , 2 , ( int32_t * ) & ud . drawweapon , 1 , probey = = io ) ;
2006-11-16 03:02:42 +00:00
{
2012-07-01 22:11:33 +00:00
const char * s [ ] = { " Off " , " On " , " Icon only " } ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , s [ ud . drawweapon ] , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
2006-11-13 23:12:47 +00:00
}
2007-01-04 07:15:17 +00:00
case 3 :
2013-02-10 16:24:20 +00:00
if ( x = = io ) ud . althud = ! ud . althud ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . althud , 1 , probey = = io ) ;
2008-08-07 07:52:36 +00:00
mgametextpal ( d , yy , ud . althud ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
break ;
case 4 :
2008-07-28 21:23:10 +00:00
if ( x = = io ) ud . democams = 1 - ud . democams ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . democams , 1 , probey = = io ) ;
2008-07-28 21:23:10 +00:00
mgametextpal ( d , yy , ud . democams ? " On " : " Off " , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
2008-08-07 07:52:36 +00:00
case 5 :
2006-11-16 03:02:42 +00:00
if ( x = = io )
{
ud . autovote = ( ud . autovote = = 2 ) ? 0 : ud . autovote + 1 ;
}
2009-01-09 09:29:17 +00:00
modval ( 0 , 2 , ( int32_t * ) & ud . autovote , 1 , probey = = io ) ;
2006-11-16 03:02:42 +00:00
{
2012-07-01 22:11:33 +00:00
const char * s [ ] = { " Off " , " Vote No " , " Vote Yes " } ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , s [ ud . autovote ] , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
}
2008-08-07 07:52:36 +00:00
case 6 :
2006-11-16 03:02:42 +00:00
if ( x = = io ) ud . automsg = 1 - ud . automsg ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . automsg , 1 , probey = = io ) ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , ud . automsg ? " Off " : " On " , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
2008-08-07 07:52:36 +00:00
case 7 :
2006-11-16 03:02:42 +00:00
if ( x = = io ) ud . idplayers = 1 - ud . idplayers ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . idplayers , 1 , probey = = io ) ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , ud . idplayers ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-11-16 03:02:42 +00:00
break ;
2008-08-07 07:52:36 +00:00
case 8 :
2008-07-28 21:23:10 +00:00
if ( x = = io ) ud . showweapons = 1 - ud . showweapons ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . showweapons , 1 , probey = = io ) ;
2008-07-28 21:23:10 +00:00
ud . config . ShowOpponentWeapons = ud . showweapons ;
mgametextpal ( d , yy , ud . config . ShowOpponentWeapons ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
break ;
2008-08-07 07:52:36 +00:00
case 9 :
2008-07-31 10:35:23 +00:00
if ( x = = io ) ud . obituaries = 1 - ud . obituaries ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . obituaries , 1 , probey = = io ) ;
2008-07-31 10:35:23 +00:00
mgametextpal ( d , yy , ud . obituaries ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
break ;
2008-08-07 07:52:36 +00:00
case 10 :
2008-07-25 01:09:39 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t osdmode = OSD_GetTextMode ( ) ;
2008-07-25 01:09:39 +00:00
if ( x = = io ) osdmode = ! osdmode ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & osdmode , 1 , probey = = io ) ;
2010-05-25 10:56:00 +00:00
mgametextpal ( d , yy , osdmode ? " Basic " : " Sprites " , MENUHIGHLIGHT ( io ) , 0 ) ;
2008-07-25 01:09:39 +00:00
if ( OSD_GetTextMode ( ) ! = osdmode )
OSD_SetTextMode ( osdmode ) ;
break ;
}
2006-12-18 08:37:12 +00:00
# ifdef _WIN32
2008-08-07 07:52:36 +00:00
case 11 :
2007-08-27 00:20:15 +00:00
i = ud . config . CheckForUpdates ;
if ( x = = io ) ud . config . CheckForUpdates = 1 - ud . config . CheckForUpdates ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . config . CheckForUpdates , 1 , probey = = io ) ;
2007-08-27 00:20:15 +00:00
if ( ud . config . CheckForUpdates ! = i )
ud . config . LastUpdateCheck = 0 ;
2008-07-22 10:56:22 +00:00
mgametextpal ( d , yy , ud . config . CheckForUpdates ? " Yes " : " No " , MENUHIGHLIGHT ( io ) , 0 ) ;
2006-12-14 08:50:18 +00:00
break ;
2008-08-07 07:52:36 +00:00
case 12 :
2006-12-14 08:50:18 +00:00
# else
2008-08-07 07:52:36 +00:00
case 11 :
2006-12-18 08:37:12 +00:00
# endif
2012-10-14 22:16:07 +00:00
if ( x = = io ) M_ChangeMenu ( MENU_SETUP ) ;
2006-11-16 03:02:42 +00:00
break ;
default :
break ;
2006-04-13 20:47:06 +00:00
}
2012-10-14 22:16:07 +00:00
mgametextpal ( margin , yy , opts [ ii ] , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , 10 ) ;
2006-11-16 03:02:42 +00:00
io + + ;
yy + = 8 ;
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
2006-11-16 03:02:42 +00:00
// JBF 20031205: Second level options menu selection
2012-10-14 22:16:07 +00:00
case MENU_OPTIONS :
M_DrawTopBar ( " Options " ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
margin = 50 ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
onbar = 0 ;
2012-10-14 22:16:07 +00:00
x = M_Probe ( 160 , margin , 18 , 7 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
last_twoohtwo = probey ;
2006-04-19 08:00:09 +00:00
2006-11-16 03:02:42 +00:00
switch ( x )
{
case - 1 :
2012-10-14 22:16:07 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) M_ChangeMenu ( MENU_MAIN_INGAME ) ;
else M_ChangeMenu ( MENU_MAIN ) ;
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 0 :
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_SETUP ) ;
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 1 :
2008-07-28 21:23:10 +00:00
changesmade = 0 ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_SOUND ) ;
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 2 :
2008-05-15 03:16:38 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t dax = xdim , day = ydim , daz ;
2008-05-15 03:16:38 +00:00
curvidmode = newvidmode = checkvideomode ( & dax , & day , bpp , fullscreen , 0 ) ;
if ( newvidmode = = 0x7fffffffl ) newvidmode = validmodecnt ;
newfullscreen = fullscreen ;
changesmade = 0 ;
2006-04-13 20:47:06 +00:00
2008-05-15 03:16:38 +00:00
dax = 0 ;
for ( day = 0 ; day < validmodecnt ; day + + )
{
if ( dax = = sizeof ( vidsets ) / sizeof ( vidsets [ 1 ] ) ) break ;
for ( daz = 0 ; daz < dax ; daz + + )
if ( ( validmode [ day ] . bpp | ( ( validmode [ day ] . fs & 1 ) < < 16 ) ) = = ( vidsets [ daz ] & 0x1ffffl ) ) break ;
if ( vidsets [ daz ] ! = - 1 ) continue ;
if ( validmode [ day ] . bpp = = 8 )
2006-11-16 03:02:42 +00:00
{
2008-05-15 03:16:38 +00:00
vidsets [ dax + + ] = 8 | ( ( validmode [ day ] . fs & 1 ) < < 16 ) ;
2006-12-17 21:20:35 +00:00
// 8-bit Polymost can diaf
// vidsets[dax++] = 0x20000|8|((validmode[day].fs&1)<<16);
2006-11-16 03:02:42 +00:00
}
2008-05-15 03:16:38 +00:00
else
vidsets [ dax + + ] = 0x20000 | validmode [ day ] . bpp | ( ( validmode [ day ] . fs & 1 ) < < 16 ) ;
2006-11-16 03:02:42 +00:00
}
2009-01-09 09:29:17 +00:00
for ( dax = 0 ; dax < ( int32_t ) ( sizeof ( vidsets ) / sizeof ( vidsets [ 1 ] ) ) & & vidsets [ dax ] ! = - 1 ; dax + + )
2012-12-30 20:34:34 +00:00
if ( vidsets [ dax ] = = ( ( ( getrendermode ( ) > = REND_POLYMOST ) < < 17 ) | ( fullscreen < < 16 ) | bpp ) ) break ;
2009-01-09 09:29:17 +00:00
if ( dax < ( int32_t ) ( sizeof ( vidsets ) / sizeof ( vidsets [ 1 ] ) ) ) newvidset = dax ;
2008-05-15 03:16:38 +00:00
curvidset = newvidset ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_VIDEOSETUP ) ;
2008-05-15 03:16:38 +00:00
}
break ;
2006-11-16 03:02:42 +00:00
case 3 :
if ( ud . recstat ! = 1 )
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 20002 ) ;
2006-11-16 03:02:42 +00:00
break ;
case 4 :
currentlist = 0 ;
case 5 :
case 6 :
if ( x = = 6 & & ! CONTROL_JoyPresent ) break ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_KEYBOARDSETUP + x - 4 ) ;
2006-11-16 03:02:42 +00:00
break ;
}
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
menutext ( 160 , margin , MENUHIGHLIGHT ( 0 ) , 0 , " Game Setup " ) ;
menutext ( 160 , margin + 18 , MENUHIGHLIGHT ( 1 ) , 0 , " Sound Setup " ) ;
menutext ( 160 , margin + 18 + 18 , MENUHIGHLIGHT ( 2 ) , 0 , " Video Setup " ) ;
menutext ( 160 , margin + 18 + 18 + 18 , MENUHIGHLIGHT ( 3 ) , ud . recstat = = 1 , " Player Setup " ) ;
menutext ( 160 , margin + 18 + 18 + 18 + 18 , MENUHIGHLIGHT ( 4 ) , 0 , " Keyboard Setup " ) ;
menutext ( 160 , margin + 18 + 18 + 18 + 18 + 18 , MENUHIGHLIGHT ( 5 ) , 0 , " Mouse Setup " ) ;
menutext ( 160 , margin + 18 + 18 + 18 + 18 + 18 + 18 , MENUHIGHLIGHT ( 6 ) , CONTROL_JoyPresent = = 0 , " Joystick Setup " ) ;
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
// JBF 20031206: Video settings menu
2012-10-14 22:16:07 +00:00
case MENU_VIDEOSETUP :
M_DrawTopBar ( " Video Setup " ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_REGULAR ;
2006-04-13 20:47:06 +00:00
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2012-12-30 20:34:34 +00:00
x = ( 7 /*+(getrendermode() >= REND_POLYMOST)*/ ) ;
2006-04-13 20:47:06 +00:00
# else
2008-07-27 21:33:28 +00:00
x = 7 ;
2006-04-13 20:47:06 +00:00
# endif
2012-12-30 20:34:34 +00:00
// onbar = (getrendermode() == REND_CLASSIC && probey == 6); // (probey == 4);
2006-11-16 03:02:42 +00:00
if ( probey = = 0 | | probey = = 1 | | probey = = 2 )
2012-10-14 22:16:07 +00:00
x = M_Probe ( margin , 50 , 16 , x ) ;
2006-11-16 03:02:42 +00:00
else if ( probey = = 3 )
2012-10-14 22:16:07 +00:00
x = M_Probe ( margin , 50 + 16 + 16 + 22 , 0 , x ) ;
2006-11-16 03:02:42 +00:00
else
2012-10-14 22:16:07 +00:00
x = M_Probe ( margin , 50 + 62 - 16 - 16 - 16 , 16 , x ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
if ( ( probey > = 0 & & probey < = 2 ) & & ( KB_KeyPressed ( sc_LeftArrow ) | | KB_KeyPressed ( sc_RightArrow ) ) )
2006-11-16 03:02:42 +00:00
{
2008-11-20 14:06:36 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2008-07-28 06:59:08 +00:00
x = probey ;
2006-11-16 03:02:42 +00:00
}
2008-07-28 06:59:08 +00:00
2006-11-16 03:02:42 +00:00
switch ( x )
{
case - 1 :
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_OPTIONS ) ;
2006-11-16 03:02:42 +00:00
probey = 2 ;
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 0 :
do
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
if ( KB_KeyPressed ( sc_LeftArrow ) )
{
newvidmode - - ;
if ( newvidmode < 0 ) newvidmode = validmodecnt - 1 ;
}
else
{
newvidmode + + ;
if ( newvidmode > = validmodecnt ) newvidmode = 0 ;
}
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
while ( ( validmode [ newvidmode ] . fs & 1 ) ! = ( ( vidsets [ newvidset ] > > 16 ) & 1 ) | | validmode [ newvidmode ] . bpp ! = ( vidsets [ newvidset ] & 0x0ffff ) ) ;
//OSD_Printf("New mode is %dx%dx%d-%d %d\n",validmode[newvidmode].xdim,validmode[newvidmode].ydim,validmode[newvidmode].bpp,validmode[newvidmode].fs,newvidmode);
if ( ( curvidmode = = 0x7fffffffl & & newvidmode = = validmodecnt ) | | curvidmode = = newvidmode )
changesmade & = ~ 1 ;
else
changesmade | = 1 ;
KB_ClearKeyDown ( sc_LeftArrow ) ;
KB_ClearKeyDown ( sc_RightArrow ) ;
break ;
case 1 :
2008-05-15 03:16:38 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t lastvidset , lastvidmode , safevidmode = - 1 ;
2008-05-15 03:16:38 +00:00
lastvidset = newvidset ;
lastvidmode = newvidmode ;
// find the next vidset compatible with the current fullscreen setting
while ( vidsets [ 0 ] ! = - 1 )
2006-11-15 01:16:55 +00:00
{
2008-05-15 03:16:38 +00:00
newvidset + + ;
if ( newvidset = = sizeof ( vidsets ) / sizeof ( vidsets [ 0 ] ) | | vidsets [ newvidset ] = = - 1 )
2006-11-16 03:02:42 +00:00
{
2008-05-15 03:16:38 +00:00
newvidset = - 1 ;
continue ;
2006-11-16 03:02:42 +00:00
}
2008-05-15 03:16:38 +00:00
if ( ( ( vidsets [ newvidset ] > > 16 ) & 1 ) ! = newfullscreen ) continue ;
break ;
}
2006-04-13 20:47:06 +00:00
2008-05-15 03:16:38 +00:00
if ( ( vidsets [ newvidset ] & 0x0ffff ) ! = ( vidsets [ lastvidset ] & 0x0ffff ) )
{
// adjust the video mode to something legal for the new vidset
do
2006-11-16 03:02:42 +00:00
{
2008-05-15 03:16:38 +00:00
newvidmode + + ;
if ( newvidmode = = lastvidmode ) break ; // end of cycle
if ( newvidmode > = validmodecnt )
2006-11-15 01:16:55 +00:00
{
2008-05-15 03:16:38 +00:00
if ( safevidmode ! = - 1 )
break ;
newvidmode = 0 ;
2006-04-13 20:47:06 +00:00
}
2008-05-15 03:16:38 +00:00
if ( validmode [ newvidmode ] . bpp = = ( vidsets [ newvidset ] & 0x0ffff ) & &
validmode [ newvidmode ] . fs = = newfullscreen & &
validmode [ newvidmode ] . xdim < = validmode [ lastvidmode ] . xdim & &
( safevidmode = = - 1 ? 1 : ( validmode [ newvidmode ] . xdim > = validmode [ safevidmode ] . xdim ) ) & &
validmode [ newvidmode ] . ydim < = validmode [ lastvidmode ] . ydim & &
( safevidmode = = - 1 ? 1 : ( validmode [ newvidmode ] . ydim > = validmode [ safevidmode ] . ydim ) )
)
safevidmode = newvidmode ;
}
while ( 1 ) ;
if ( safevidmode = = - 1 )
{
//OSD_Printf("No best fit!\n");
newvidmode = lastvidmode ;
newvidset = lastvidset ;
}
else
{
//OSD_Printf("Best fit is %dx%dx%d-%d %d\n",validmode[safevidmode].xdim,validmode[safevidmode].ydim,validmode[safevidmode].bpp,validmode[safevidmode].fs,safevidmode);
newvidmode = safevidmode ;
2006-11-16 03:02:42 +00:00
}
}
2008-05-15 03:16:38 +00:00
if ( newvidset ! = curvidset ) changesmade | = 4 ;
else changesmade & = ~ 4 ;
if ( newvidmode ! = curvidmode ) changesmade | = 1 ;
else changesmade & = ~ 1 ;
2008-07-28 21:23:10 +00:00
KB_ClearKeyDown ( sc_LeftArrow ) ;
KB_ClearKeyDown ( sc_RightArrow ) ;
2008-05-15 03:16:38 +00:00
}
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 2 :
newfullscreen = ! newfullscreen ;
{
2009-01-09 09:29:17 +00:00
int32_t lastvidset , lastvidmode , safevidmode = - 1 , safevidset = - 1 ;
2006-11-16 03:02:42 +00:00
lastvidset = newvidset ;
lastvidmode = newvidmode ;
// find the next vidset compatible with the current fullscreen setting
while ( vidsets [ 0 ] ! = - 1 )
{
newvidset + + ;
if ( newvidset = = lastvidset ) break ;
if ( newvidset = = sizeof ( vidsets ) / sizeof ( vidsets [ 0 ] ) | | vidsets [ newvidset ] = = - 1 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
newvidset = - 1 ;
continue ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
if ( ( ( vidsets [ newvidset ] > > 16 ) & 1 ) ! = newfullscreen ) continue ;
if ( ( vidsets [ newvidset ] & 0x2ffff ) ! = ( vidsets [ lastvidset ] & 0x2ffff ) )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( ( vidsets [ newvidset ] & 0x20000 ) = = ( vidsets [ lastvidset ] & 0x20000 ) ) safevidset = newvidset ;
continue ;
2006-11-15 01:16:55 +00:00
}
break ;
2006-11-16 03:02:42 +00:00
}
if ( newvidset = = lastvidset )
{
if ( safevidset = = - 1 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
newfullscreen = ! newfullscreen ;
break ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
else
{
newvidset = safevidset ;
}
}
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
// adjust the video mode to something legal for the new vidset
do
{
newvidmode + + ;
if ( newvidmode = = lastvidmode ) break ; // end of cycle
if ( newvidmode > = validmodecnt ) newvidmode = 0 ;
if ( validmode [ newvidmode ] . bpp = = ( vidsets [ newvidset ] & 0x0ffff ) & &
validmode [ newvidmode ] . fs = = newfullscreen & &
validmode [ newvidmode ] . xdim < = validmode [ lastvidmode ] . xdim & &
( safevidmode = = - 1 ? 1 : ( validmode [ newvidmode ] . xdim > = validmode [ safevidmode ] . xdim ) ) & &
validmode [ newvidmode ] . ydim < = validmode [ lastvidmode ] . ydim & &
( safevidmode = = - 1 ? 1 : ( validmode [ newvidmode ] . ydim > = validmode [ safevidmode ] . ydim ) )
)
safevidmode = newvidmode ;
}
while ( 1 ) ;
if ( safevidmode = = - 1 )
{
//OSD_Printf("No best fit!\n");
newvidmode = lastvidmode ;
newvidset = lastvidset ;
newfullscreen = ! newfullscreen ;
}
else
{
//OSD_Printf("Best fit is %dx%dx%d-%d %d\n",validmode[safevidmode].xdim,validmode[safevidmode].ydo,,validmode[safevidmode].bpp,validmode[safevidmode].fs,safevidmode);
newvidmode = safevidmode ;
}
if ( newvidset ! = curvidset ) changesmade | = 4 ;
else changesmade & = ~ 4 ;
if ( newvidmode ! = curvidmode ) changesmade | = 1 ;
else changesmade & = ~ 1 ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
if ( newfullscreen = = fullscreen ) changesmade & = ~ 2 ;
else changesmade | = 2 ;
2008-07-28 21:23:10 +00:00
KB_ClearKeyDown ( sc_LeftArrow ) ;
KB_ClearKeyDown ( sc_RightArrow ) ;
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 3 :
if ( ! changesmade ) break ;
{
2009-01-09 09:29:17 +00:00
int32_t pxdim , pydim , pfs , pbpp , prend ;
int32_t nxdim , nydim , nfs , nbpp , nrend ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
pxdim = xdim ;
pydim = ydim ;
pbpp = bpp ;
pfs = fullscreen ;
prend = getrendermode ( ) ;
nxdim = ( newvidmode = = validmodecnt ) ? xdim : validmode [ newvidmode ] . xdim ;
nydim = ( newvidmode = = validmodecnt ) ? ydim : validmode [ newvidmode ] . ydim ;
nfs = newfullscreen ;
nbpp = ( newvidmode = = validmodecnt ) ? bpp : validmode [ newvidmode ] . bpp ;
2009-04-23 07:09:24 +00:00
nrend = ( vidsets [ newvidset ] & 0x20000 ) ? ( nbpp = = 8 ? 2 :
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2009-04-23 07:09:24 +00:00
glrendmode
# else
0
2009-05-07 16:00:49 +00:00
# endif
2009-04-23 07:09:24 +00:00
) : 0 ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( setgamemode ( nfs , nxdim , nydim , nbpp ) < 0 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( setgamemode ( pfs , pxdim , pydim , pbpp ) < 0 )
{
setrendermode ( prend ) ;
2008-11-20 14:06:36 +00:00
G_GameExit ( " Failed restoring old video mode. " ) ;
2006-11-16 03:02:42 +00:00
}
else onvideomodechange ( pbpp > 8 ) ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
else onvideomodechange ( nbpp > 8 ) ;
2012-02-02 17:34:16 +00:00
g_restorePalette = - 1 ;
2008-11-20 14:06:36 +00:00
G_UpdateScreenArea ( ) ;
2006-11-16 03:02:42 +00:00
setrendermode ( nrend ) ;
curvidmode = newvidmode ;
curvidset = newvidset ;
changesmade = 0 ;
2007-08-27 00:20:15 +00:00
ud . config . ScreenMode = fullscreen ;
ud . config . ScreenWidth = xdim ;
ud . config . ScreenHeight = ydim ;
ud . config . ScreenBPP = bpp ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
break ;
case 4 :
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 231 ) ;
2006-11-16 03:02:42 +00:00
break ;
2007-02-13 09:50:58 +00:00
2006-11-16 03:02:42 +00:00
case 5 :
2012-12-30 20:34:34 +00:00
if ( getrendermode ( ) = = REND_CLASSIC )
2007-02-13 02:22:17 +00:00
{
ud . detail = 1 - ud . detail ;
break ;
2007-02-13 09:50:58 +00:00
}
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2007-01-04 07:15:17 +00:00
gltexfiltermode + + ;
if ( gltexfiltermode > 5 )
gltexfiltermode = 0 ;
2006-11-16 03:02:42 +00:00
gltexapplyprops ( ) ;
break ;
2012-02-18 17:56:39 +00:00
# endif
2006-11-16 03:02:42 +00:00
case 6 :
2012-12-30 20:34:34 +00:00
// if (getrendermode() == REND_CLASSIC) break;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 230 ) ;
2006-11-15 01:16:55 +00:00
break ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin , 50 , MENUHIGHLIGHT ( 0 ) , 0 , " Resolution " ) ;
2009-02-02 01:49:14 +00:00
Bsprintf ( tempbuf , " %d x %d " ,
2009-02-19 09:39:19 +00:00
( newvidmode = = validmodecnt ) ? xdim : validmode [ newvidmode ] . xdim ,
( newvidmode = = validmodecnt ) ? ydim : validmode [ newvidmode ] . ydim ) ;
2012-10-14 22:16:07 +00:00
mgametext ( margin + 168 , 50 - 8 , tempbuf , MENUHIGHLIGHT ( 0 ) , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin , 50 + 16 , MENUHIGHLIGHT ( 1 ) , 0 , " Renderer " ) ;
2012-03-05 07:25:24 +00:00
if ( vidsets [ newvidset ] & 0x20000 )
Bsprintf ( tempbuf , " %d-bit OpenGL " , vidsets [ newvidset ] & 0x0ffff ) ;
else
Bsprintf ( tempbuf , " Software " ) ;
2012-10-14 22:16:07 +00:00
mgametext ( margin + 168 , 50 + 16 - 8 , tempbuf , MENUHIGHLIGHT ( 1 ) , 2 + 8 + 16 ) ;
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin , 50 + 16 + 16 , MENUHIGHLIGHT ( 2 ) , 0 , " Fullscreen " ) ;
menutext ( margin + 168 , 50 + 16 + 16 , MENUHIGHLIGHT ( 2 ) , 0 , newfullscreen ? " Yes " : " No " ) ;
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin + 16 , 50 + 16 + 16 + 22 , MENUHIGHLIGHT ( 3 ) , changesmade = = 0 , " Apply Changes " ) ;
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin , 50 + 62 + 16 , MENUHIGHLIGHT ( 4 ) , 0 , " Color Correction " ) ;
2008-07-20 11:03:57 +00:00
/* {
short ss = ud . brightness ;
bar ( c + 171 , 50 + 62 + 16 , & ss , 8 , x = = 4 , MENUHIGHLIGHT ( 4 ) , PHX ( - 6 ) ) ;
if ( x = = 4 )
{
ud . brightness = ss ;
setbrightness ( ud . brightness > > 2 , & g_player [ myconnectindex ] . ps - > palette [ 0 ] , 0 ) ;
}
}
*/
2012-12-30 20:34:34 +00:00
if ( getrendermode ( ) = = REND_CLASSIC )
2006-11-16 03:02:42 +00:00
{
2012-10-14 22:16:07 +00:00
menutext ( margin , 50 + 62 + 16 + 16 , MENUHIGHLIGHT ( 5 ) , 0 , " Pixel Doubling " ) ;
menutext ( margin + 168 , 50 + 62 + 16 + 16 , MENUHIGHLIGHT ( 5 ) , 0 , ud . detail ? " Off " : " On " ) ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . detail , 1 , probey = = 5 ) ;
2006-11-16 03:02:42 +00:00
}
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2007-02-16 00:11:25 +00:00
else
2007-02-13 02:22:17 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t filter = gltexfiltermode ;
2012-10-14 22:16:07 +00:00
menutext ( margin , 50 + 62 + 16 + 16 , MENUHIGHLIGHT ( 5 ) , 0 , " Texture Filter " ) ;
2007-02-13 02:22:17 +00:00
switch ( gltexfiltermode )
{
case 0 :
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " Nearest " ) ;
2007-02-13 02:22:17 +00:00
break ;
case 1 :
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " Linear " ) ;
2007-02-13 02:22:17 +00:00
break ;
case 2 :
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " Near_MM_Near " ) ;
2007-02-13 02:22:17 +00:00
break ;
case 3 :
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " Bilinear " ) ;
2007-02-13 02:22:17 +00:00
break ;
case 4 :
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " Near_MM_Lin " ) ;
2007-02-13 02:22:17 +00:00
break ;
case 5 :
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " Trilinear " ) ;
2007-02-13 02:22:17 +00:00
break ;
default :
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " Other " ) ;
2007-02-13 02:22:17 +00:00
break ;
}
2009-01-09 09:29:17 +00:00
modval ( 0 , 5 , ( int32_t * ) & gltexfiltermode , 1 , probey = = 5 ) ;
2008-07-28 06:59:08 +00:00
if ( gltexfiltermode ! = filter )
gltexapplyprops ( ) ;
2012-12-30 20:34:34 +00:00
mgametextpal ( margin + 168 , 50 + 62 + 16 + 16 - 8 , tempbuf , MENUHIGHLIGHT ( 5 ) , getrendermode ( ) = = REND_CLASSIC ) ;
2007-02-13 02:22:17 +00:00
}
2006-11-16 03:02:42 +00:00
# endif
2012-10-14 22:16:07 +00:00
menutext ( margin , 50 + 62 + 16 + 16 + 16 , MENUHIGHLIGHT ( 6 ) , 0 /*bpp==8*/ , " Renderer Setup " ) ;
2006-11-16 03:02:42 +00:00
break ;
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
case MENU_KEYBOARDSETUP :
M_DrawTopBar ( " Keyboard Setup " ) ;
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_REGULAR ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
onbar = 0 ;
2007-02-13 09:50:58 +00:00
2007-02-14 00:22:12 +00:00
if ( probey = = NUMGAMEFUNCTIONS )
x = probesm ( 60 , 145 , 0 , NUMGAMEFUNCTIONS + 2 ) ;
else if ( probey = = NUMGAMEFUNCTIONS + 1 )
x = probesm ( 60 , 152 , 0 , NUMGAMEFUNCTIONS + 2 ) ;
else x = probesm ( 0 , 0 , 0 , NUMGAMEFUNCTIONS + 2 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_OPTIONS ) ;
2006-11-16 03:02:42 +00:00
probey = 4 ;
}
2007-02-13 09:50:58 +00:00
else if ( x = = NUMGAMEFUNCTIONS )
{
2012-11-08 22:09:00 +00:00
CONFIG_SetDefaultKeys ( ( const char ( * ) [ MAXGAMEFUNCLEN ] ) keydefaults ) ;
2007-02-14 00:22:12 +00:00
break ;
}
else if ( x = = NUMGAMEFUNCTIONS + 1 )
{
2012-11-08 22:09:00 +00:00
CONFIG_SetDefaultKeys ( oldkeydefaults ) ;
2007-02-13 09:50:58 +00:00
break ;
}
2006-11-16 03:02:42 +00:00
else if ( x > = 0 )
{
function = probey ;
whichkey = currentlist ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_KEYBOARDASSIGN ) ;
2006-11-16 03:02:42 +00:00
KB_FlushKeyboardQueue ( ) ;
KB_ClearLastScanCode ( ) ;
break ;
}
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
// the top of our list
2012-02-04 14:30:54 +00:00
m = clamp ( probey - 6 , 0 , NUMGAMEFUNCTIONS - 13 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( probey = = gamefunc_Show_Console ) currentlist = 0 ;
else if ( KB_KeyPressed ( sc_LeftArrow ) | | KB_KeyPressed ( sc_kpad_4 ) | |
KB_KeyPressed ( sc_RightArrow ) | | KB_KeyPressed ( sc_kpad_6 ) | |
KB_KeyPressed ( sc_Tab ) )
{
currentlist ^ = 1 ;
KB_ClearKeyDown ( sc_LeftArrow ) ;
KB_ClearKeyDown ( sc_RightArrow ) ;
KB_ClearKeyDown ( sc_kpad_4 ) ;
KB_ClearKeyDown ( sc_kpad_6 ) ;
KB_ClearKeyDown ( sc_Tab ) ;
2008-11-20 14:06:36 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-11-16 03:02:42 +00:00
}
else if ( KB_KeyPressed ( sc_Delete ) )
{
2008-06-30 09:00:33 +00:00
char key [ 2 ] ;
key [ 0 ] = ud . config . KeyboardKeys [ probey ] [ 0 ] ;
key [ 1 ] = ud . config . KeyboardKeys [ probey ] [ 1 ] ;
2008-06-30 11:01:58 +00:00
ud . config . KeyboardKeys [ probey ] [ currentlist ] = 0xff ;
2008-07-09 23:25:38 +00:00
CONFIG_MapKey ( probey , ud . config . KeyboardKeys [ probey ] [ 0 ] , key [ 0 ] , ud . config . KeyboardKeys [ probey ] [ 1 ] , key [ 1 ] ) ;
2008-11-20 14:06:36 +00:00
S_PlaySound ( KICK_HIT ) ;
2006-11-16 03:02:42 +00:00
KB_ClearKeyDown ( sc_Delete ) ;
}
2006-11-15 01:16:55 +00:00
2008-08-25 23:48:00 +00:00
for ( l = min ( 13 , NUMGAMEFUNCTIONS ) - 1 ; l > = 0 ; l - - )
2006-11-16 03:02:42 +00:00
{
p = CONFIG_FunctionNumToName ( m + l ) ;
if ( ! p ) continue ;
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
strcpy ( tempbuf , p ) ;
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2012-02-04 14:30:54 +00:00
// game function name redefined --> pal 8 text
minitextshade ( 70 , 34 + l * 8 , tempbuf , ( m + l = = probey ) ? 0 : 16 ,
Bstrcmp ( keydefaults [ 3 * ( m + l ) ] , oldkeydefaults [ 3 * ( m + l ) ] ) ? 8 : 1 , 10 + 16 ) ;
2006-11-16 03:02:42 +00:00
2007-08-27 00:20:15 +00:00
//strcpy(tempbuf, KB_ScanCodeToString(ud.config.KeyboardKeys[m+l][0]));
strcpy ( tempbuf , ( char * ) getkeyname ( ud . config . KeyboardKeys [ m + l ] [ 0 ] ) ) ;
2006-11-16 03:02:42 +00:00
if ( ! tempbuf [ 0 ] ) strcpy ( tempbuf , " - " ) ;
minitextshade ( 70 + 100 , 34 + l * 8 , tempbuf ,
( m + l = = probey & & ! currentlist ? 0 : 16 ) , 2 , 10 + 16 ) ;
2007-08-27 00:20:15 +00:00
//strcpy(tempbuf, KB_ScanCodeToString(ud.config.KeyboardKeys[m+l][1]));
strcpy ( tempbuf , ( char * ) getkeyname ( ud . config . KeyboardKeys [ m + l ] [ 1 ] ) ) ;
2006-11-16 03:02:42 +00:00
if ( ! tempbuf [ 0 ] ) strcpy ( tempbuf , " - " ) ;
minitextshade ( 70 + 120 + 34 , 34 + l * 8 , tempbuf ,
( m + l = = probey & & currentlist ? 0 : 16 ) , 2 , 10 + 16 ) ;
}
2006-11-15 01:16:55 +00:00
2012-03-26 05:07:12 +00:00
mgametextpal ( 160 , 140 , " Reset Keys To Defaults " , MENUHIGHLIGHT ( NUMGAMEFUNCTIONS ) , 10 ) ;
mgametextpal ( 160 , 140 + 7 , " Set Classic Key Layout " , MENUHIGHLIGHT ( NUMGAMEFUNCTIONS + 1 ) , 10 ) ;
mgametext ( 160 , 144 + 9 + 3 , " Up/Down = Select Action " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 144 + 9 + 9 + 3 , " Left/Right = Select List " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 144 + 9 + 9 + 9 + 3 , " Enter = Modify Delete = Clear " , 0 , 2 + 8 + 16 ) ;
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
break ;
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
case MENU_KEYBOARDASSIGN :
2008-05-15 03:16:38 +00:00
{
2009-04-26 05:57:42 +00:00
int32_t sc ;
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Keyboard Setup " ) ;
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
mgametext ( 320 > > 1 , 90 , " Press the key to assign as " , 0 , 2 + 8 + 16 ) ;
Bsprintf ( tempbuf , " %s for \" %s \" " , whichkey ? " secondary " : " primary " , CONFIG_FunctionNumToName ( function ) ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 320 > > 1 , 90 + 9 , tempbuf , 0 , 2 + 8 + 16 ) ;
2012-03-26 05:07:12 +00:00
mgametext ( 320 > > 1 , 90 + 9 + 9 + 9 , " Press \" Escape \" To Cancel " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2008-05-15 03:16:38 +00:00
sc = KB_GetLastScanCode ( ) ;
if ( sc ! = sc_None | | RMB )
{
if ( sc = = sc_Escape | | RMB )
2006-11-15 01:16:55 +00:00
{
2008-11-20 14:06:36 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2008-05-15 03:16:38 +00:00
}
else
{
2008-06-30 09:00:33 +00:00
char key [ 2 ] ;
key [ 0 ] = ud . config . KeyboardKeys [ function ] [ 0 ] ;
key [ 1 ] = ud . config . KeyboardKeys [ function ] [ 1 ] ;
2008-11-20 14:06:36 +00:00
S_PlaySound ( PISTOL_BODYHIT ) ;
2006-04-13 20:47:06 +00:00
2008-05-15 03:16:38 +00:00
ud . config . KeyboardKeys [ function ] [ whichkey ] = KB_GetLastScanCode ( ) ;
2012-11-08 17:00:31 +00:00
CONFIG_MapKey ( function , ud . config . KeyboardKeys [ function ] [ 0 ] , key [ 0 ] , ud . config . KeyboardKeys [ function ] [ 1 ] , key [ 1 ] ) ;
2008-05-15 03:16:38 +00:00
}
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_KEYBOARDSETUP ) ;
2006-11-16 03:02:42 +00:00
2008-05-15 03:16:38 +00:00
currentlist = whichkey ;
probey = function ;
2006-11-16 03:02:42 +00:00
2008-05-15 03:16:38 +00:00
KB_ClearKeyDown ( sc ) ;
2006-11-16 03:02:42 +00:00
}
2008-05-15 03:16:38 +00:00
break ;
}
2006-11-16 03:02:42 +00:00
case 205 :
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Mouse Setup " ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
margin = 60 - 4 ;
2006-11-16 03:02:42 +00:00
2012-01-26 21:58:55 +00:00
onbar = ( probey = = NUMMOUSEFUNCTIONS ) ;
if ( probey < NUMMOUSEFUNCTIONS )
x = probesm ( 73 , 38 , 8 , NUMMOUSEFUNCTIONS + 2 + 2 + 1 ) ;
2006-11-16 03:02:42 +00:00
else
2012-01-26 21:58:55 +00:00
x = probesm ( 40 , 123 - ( NUMMOUSEFUNCTIONS ) * 9 , 9 , NUMMOUSEFUNCTIONS + 2 + 2 + 1 ) ;
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_OPTIONS ) ;
2006-11-16 03:02:42 +00:00
probey = 5 ;
break ;
}
2012-01-26 21:58:55 +00:00
else if ( x = = NUMMOUSEFUNCTIONS )
2006-11-16 03:02:42 +00:00
{
// sensitivity
}
2012-01-26 21:58:55 +00:00
else if ( x = = NUMMOUSEFUNCTIONS + 1 )
2006-11-16 03:02:42 +00:00
{
// mouse aiming toggle
2008-11-20 14:06:36 +00:00
if ( ! ud . mouseaiming ) g_myAimMode = 1 - g_myAimMode ;
2006-11-16 03:02:42 +00:00
}
2012-01-26 21:58:55 +00:00
else if ( x = = NUMMOUSEFUNCTIONS + 2 )
2006-11-16 03:02:42 +00:00
{
// invert mouse aim
ud . mouseflip = 1 - ud . mouseflip ;
}
2012-01-26 21:58:55 +00:00
else if ( x = = NUMMOUSEFUNCTIONS + 2 + 1 )
2008-07-24 14:08:56 +00:00
{
//input smoothing
ud . config . SmoothInput = ! ud . config . SmoothInput ;
2012-11-17 16:47:47 +00:00
CONTROL_SmoothMouse = ud . config . SmoothInput ;
2008-07-24 14:08:56 +00:00
}
2012-01-26 21:58:55 +00:00
else if ( x = = NUMMOUSEFUNCTIONS + 2 + 2 )
2006-11-16 03:02:42 +00:00
{
//advanced
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 212 ) ;
2006-11-16 03:02:42 +00:00
break ;
}
else if ( x > = 0 )
{
//set an option
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 211 ) ;
2006-11-16 03:02:42 +00:00
function = 0 ;
whichkey = x ;
2012-01-26 21:58:55 +00:00
if ( x < NUMDOUBLEMBTNS * 2 )
2007-08-27 00:20:15 +00:00
probey = ud . config . MouseFunctions [ x > > 1 ] [ x & 1 ] ;
2006-11-16 03:02:42 +00:00
else
2012-01-26 21:58:55 +00:00
probey = ud . config . MouseFunctions [ x - NUMDOUBLEMBTNS ] [ 0 ] ;
2006-11-16 03:02:42 +00:00
if ( probey < 0 ) probey = NUMGAMEFUNCTIONS - 1 ;
break ;
}
2012-01-26 21:58:55 +00:00
for ( l = 0 ; l < NUMMOUSEFUNCTIONS ; l + + )
2006-11-16 03:02:42 +00:00
{
tempbuf [ 0 ] = 0 ;
2012-01-26 21:58:55 +00:00
if ( l < NUMDOUBLEMBTNS * 2 )
2006-11-16 03:02:42 +00:00
{
if ( l & 1 )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
Bstrcpy ( tempbuf , " Double " ) ;
2007-08-27 00:20:15 +00:00
m = ud . config . MouseFunctions [ l > > 1 ] [ 1 ] ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
else
2007-08-27 00:20:15 +00:00
m = ud . config . MouseFunctions [ l > > 1 ] [ 0 ] ;
2006-11-16 03:02:42 +00:00
Bstrcat ( tempbuf , mousebuttonnames [ l > > 1 ] ) ;
}
else
{
2012-01-26 21:58:55 +00:00
Bstrcpy ( tempbuf , mousebuttonnames [ l - NUMDOUBLEMBTNS ] ) ;
m = ud . config . MouseFunctions [ l - NUMDOUBLEMBTNS ] [ 0 ] ;
2006-04-13 20:47:06 +00:00
}
2012-10-14 22:16:07 +00:00
minitextshade ( margin + 20 , 34 + l * 8 , tempbuf , ( l = = probey ) ? 0 : 16 , 1 , 10 + 16 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( m = = - 1 )
2012-10-14 22:16:07 +00:00
minitextshade ( margin + 100 + 20 , 34 + l * 8 , " -None- " , ( l = = probey ) ? 0 : 16 , 2 , 10 + 16 ) ;
2006-11-16 03:02:42 +00:00
else
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
strcpy ( tempbuf , CONFIG_FunctionNumToName ( m ) ) ;
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2012-10-14 22:16:07 +00:00
minitextshade ( margin + 100 + 20 , 34 + l * 8 , tempbuf , ( l = = probey ) ? 0 : 16 , 2 , 10 + 16 ) ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-01-26 21:58:55 +00:00
mgametextpal ( 40 , 118 , " Base mouse sensitivity " , MENUHIGHLIGHT ( NUMMOUSEFUNCTIONS ) , 10 ) ;
mgametextpal ( 40 , 118 + 9 , " Use mouse aiming " , ! ud . mouseaiming ? MENUHIGHLIGHT ( NUMMOUSEFUNCTIONS + 1 ) : DISABLEDMENUSHADE , 10 ) ;
mgametextpal ( 40 , 118 + 9 + 9 , " Invert mouse " , MENUHIGHLIGHT ( NUMMOUSEFUNCTIONS + 2 ) , 10 ) ;
mgametextpal ( 40 , 118 + 9 + 9 + 9 , " Smooth mouse movement " , MENUHIGHLIGHT ( NUMMOUSEFUNCTIONS + 2 + 1 ) , 10 ) ;
mgametextpal ( 40 , 118 + 9 + 9 + 9 + 9 , " Advanced mouse setup " , MENUHIGHLIGHT ( NUMMOUSEFUNCTIONS + 2 + 2 ) , 10 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
{
2010-05-07 20:45:40 +00:00
int32_t sense = ( int32_t ) ( CONTROL_MouseSensitivity * 4.0f ) ;
2010-07-19 15:14:00 +00:00
sense = clamp ( sense , 0 , 63 ) ;
2012-10-14 22:16:07 +00:00
barsm ( 248 , 126 , & sense , 2 , x = = NUMMOUSEFUNCTIONS , MENUHIGHLIGHT ( NUMMOUSEFUNCTIONS ) , 0 ) ;
2010-05-07 20:45:40 +00:00
CONTROL_MouseSensitivity = sense / 4.0f ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-01-26 21:58:55 +00:00
if ( ! ud . mouseaiming ) modval ( 0 , 1 , ( int32_t * ) & g_myAimMode , 1 , probey = = NUMMOUSEFUNCTIONS + 1 ) ;
else if ( probey = = NUMMOUSEFUNCTIONS + 1 )
2007-01-05 23:40:37 +00:00
{
2012-03-26 05:07:12 +00:00
mgametext ( 160 , 140 + 9 + 9 + 9 , " Set mouse aim type to toggle on/off " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 140 + 9 + 9 + 9 + 9 , " in the Player Setup menu to enable " , 0 , 2 + 8 + 16 ) ;
2007-01-05 23:40:37 +00:00
}
2012-01-26 21:58:55 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . mouseflip , 1 , probey = = NUMMOUSEFUNCTIONS + 2 ) ;
modval ( 0 , 1 , ( int32_t * ) & ud . config . SmoothInput , 1 , probey = = NUMMOUSEFUNCTIONS + 2 + 1 ) ;
if ( probey = = NUMMOUSEFUNCTIONS + 2 + 1 )
2008-10-13 01:16:40 +00:00
{
2012-03-26 05:07:12 +00:00
// mgametext(160,160+9,"This option incurs a movement delay",0,2+8+16);
2012-11-17 16:47:47 +00:00
CONTROL_SmoothMouse = ud . config . SmoothInput ;
2008-10-13 01:16:40 +00:00
}
2006-04-13 20:47:06 +00:00
2012-01-26 21:58:55 +00:00
mgametextpal ( 240 , 118 + 9 , g_myAimMode & & ! ud . mouseaiming ? " Yes " : " No " ,
! ud . mouseaiming ? MENUHIGHLIGHT ( NUMMOUSEFUNCTIONS + 1 ) : DISABLEDMENUSHADE , 0 ) ;
mgametextpal ( 240 , 118 + 9 + 9 , ! ud . mouseflip ? " Yes " : " No " , MENUHIGHLIGHT ( NUMMOUSEFUNCTIONS + 2 ) , 0 ) ;
mgametextpal ( 240 , 118 + 9 + 9 + 9 , ud . config . SmoothInput ? " Yes " : " No " , MENUHIGHLIGHT ( NUMMOUSEFUNCTIONS + 2 + 1 ) , 0 ) ;
2006-04-19 08:00:09 +00:00
2012-01-26 21:58:55 +00:00
if ( probey < NUMMOUSEFUNCTIONS )
2006-11-16 03:02:42 +00:00
{
2012-03-26 05:07:12 +00:00
mgametext ( 160 , 160 + 9 , " Up/Down = Select Button " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 160 + 9 + 9 , " Enter = Modify " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 211 :
2012-10-14 22:16:07 +00:00
if ( function = = 0 ) M_DrawTopBar ( " Mouse Setup " ) ;
else if ( function = = 1 ) M_DrawTopBar ( " Advanced Mouse " ) ;
else if ( function = = 2 ) M_DrawTopBar ( " Joystick Buttons " ) ;
else if ( function = = 3 ) M_DrawTopBar ( " Joystick Axes " ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
x = M_Probe ( 0 , 0 , 0 , NUMGAMEFUNCTIONS ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
{
if ( function = = 0 )
2007-08-25 01:05:00 +00:00
{
// mouse button
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 205 ) ;
2006-11-16 03:02:42 +00:00
probey = whichkey ;
}
else if ( function = = 1 )
2007-08-25 01:05:00 +00:00
{
// mouse digital axis
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 212 ) ;
2006-11-16 03:02:42 +00:00
probey = 3 + ( whichkey ^ 2 ) ;
}
else if ( function = = 2 )
2007-08-25 01:05:00 +00:00
{
// joystick button/hat
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 207 ) ;
2006-11-16 03:02:42 +00:00
probey = whichkey ;
}
else if ( function = = 3 )
2007-08-25 01:05:00 +00:00
{
// joystick digital axis
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( ( whichkey > > 2 ) + 208 ) ;
2006-11-16 03:02:42 +00:00
probey = 1 + ( ( whichkey > > 1 ) & 1 ) * 4 + ( whichkey & 1 ) ;
}
break ;
}
else if ( x > = 0 )
{
if ( x = = NUMGAMEFUNCTIONS - 1 ) x = - 1 ;
2006-04-13 20:47:06 +00:00
2006-11-15 01:16:55 +00:00
if ( function = = 0 )
{
2012-01-26 21:58:55 +00:00
if ( whichkey < NUMDOUBLEMBTNS * 2 )
2006-11-16 03:02:42 +00:00
{
2007-08-27 00:20:15 +00:00
ud . config . MouseFunctions [ whichkey > > 1 ] [ whichkey & 1 ] = x ;
2006-11-16 03:02:42 +00:00
CONTROL_MapButton ( x , whichkey > > 1 , whichkey & 1 , controldevice_mouse ) ;
2012-11-18 15:44:18 +00:00
CONTROL_FreeMouseBind ( whichkey > > 1 ) ;
2006-11-16 03:02:42 +00:00
}
2006-11-15 01:16:55 +00:00
else
2006-11-16 03:02:42 +00:00
{
2012-01-26 21:58:55 +00:00
ud . config . MouseFunctions [ whichkey - NUMDOUBLEMBTNS ] [ 0 ] = x ;
CONTROL_MapButton ( x , whichkey - NUMDOUBLEMBTNS , 0 , controldevice_mouse ) ;
2012-11-18 15:44:18 +00:00
CONTROL_FreeMouseBind ( whichkey - NUMDOUBLEMBTNS ) ;
2012-11-17 16:47:58 +00:00
2006-11-16 03:02:42 +00:00
}
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 205 ) ;
2006-11-16 03:02:42 +00:00
probey = whichkey ;
2006-11-15 01:16:55 +00:00
}
else if ( function = = 1 )
{
2007-08-27 00:20:15 +00:00
ud . config . MouseDigitalFunctions [ whichkey > > 1 ] [ whichkey & 1 ] = x ;
2006-11-16 03:02:42 +00:00
CONTROL_MapDigitalAxis ( whichkey > > 1 , x , whichkey & 1 , controldevice_mouse ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 212 ) ;
2006-11-16 03:02:42 +00:00
probey = 3 + ( whichkey ^ 2 ) ;
2006-11-15 01:16:55 +00:00
}
else if ( function = = 2 )
{
if ( whichkey < 2 * joynumbuttons )
2006-11-16 03:02:42 +00:00
{
2007-08-27 00:20:15 +00:00
ud . config . JoystickFunctions [ whichkey > > 1 ] [ whichkey & 1 ] = x ;
2006-11-16 03:02:42 +00:00
CONTROL_MapButton ( x , whichkey > > 1 , whichkey & 1 , controldevice_joystick ) ;
}
2006-11-15 01:16:55 +00:00
else
2006-11-16 03:02:42 +00:00
{
2007-08-27 00:20:15 +00:00
ud . config . JoystickFunctions [ joynumbuttons + ( whichkey - 2 * joynumbuttons ) ] [ 0 ] = x ;
2006-11-16 03:02:42 +00:00
CONTROL_MapButton ( x , joynumbuttons + ( whichkey - 2 * joynumbuttons ) , 0 , controldevice_joystick ) ;
}
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 207 ) ;
2006-11-16 03:02:42 +00:00
probey = whichkey ;
2006-11-15 01:16:55 +00:00
}
else if ( function = = 3 )
{
2007-08-27 00:20:15 +00:00
ud . config . JoystickDigitalFunctions [ whichkey > > 1 ] [ whichkey & 1 ] = x ;
2006-11-16 03:02:42 +00:00
CONTROL_MapDigitalAxis ( whichkey > > 1 , x , whichkey & 1 , controldevice_joystick ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( ( whichkey > > 2 ) + 208 ) ;
2006-11-16 03:02:42 +00:00
probey = 1 + ( ( whichkey > > 1 ) & 1 ) * 4 + ( whichkey & 1 ) ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
break ;
}
2012-03-26 05:07:12 +00:00
mgametext ( 320 > > 1 , 31 , " Select a function to assign " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
if ( function = = 0 )
{
2012-01-26 21:58:55 +00:00
if ( whichkey < NUMDOUBLEMBTNS * 2 )
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " to %s%s " , ( whichkey & 1 ) ? " double-clicked " : " " , mousebuttonnames [ whichkey > > 1 ] ) ;
2006-11-16 03:02:42 +00:00
else
2012-01-26 21:58:55 +00:00
Bstrcpy ( tempbuf , mousebuttonnames [ whichkey - NUMDOUBLEMBTNS ] ) ;
2006-11-16 03:02:42 +00:00
}
else if ( function = = 1 )
{
2012-03-26 05:07:12 +00:00
Bstrcpy ( tempbuf , " to digital " ) ;
2006-11-16 03:02:42 +00:00
switch ( whichkey )
{
case 0 :
2012-03-26 05:07:12 +00:00
Bstrcat ( tempbuf , " Left " ) ;
2006-11-16 03:02:42 +00:00
break ;
case 1 :
2012-03-26 05:07:12 +00:00
Bstrcat ( tempbuf , " Right " ) ;
2006-11-16 03:02:42 +00:00
break ;
case 2 :
2012-03-26 05:07:12 +00:00
Bstrcat ( tempbuf , " Up " ) ;
2006-11-16 03:02:42 +00:00
break ;
case 3 :
2012-03-26 05:07:12 +00:00
Bstrcat ( tempbuf , " Down " ) ;
2006-11-16 03:02:42 +00:00
break ;
}
}
else if ( function = = 2 )
{
2012-07-01 22:11:33 +00:00
static const char * directions [ ] =
2010-02-23 18:13:46 +00:00
{
2012-03-26 05:07:12 +00:00
" Up " , " Right " , " Down " , " Left "
2010-02-23 18:13:46 +00:00
} ;
2006-11-16 03:02:42 +00:00
if ( whichkey < 2 * joynumbuttons )
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " to %s%s " , ( whichkey & 1 ) ? " double-clicked " : " " , getjoyname ( 1 , whichkey > > 1 ) ) ;
2006-11-16 03:02:42 +00:00
else
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " to hat %s " , directions [ whichkey - 2 * joynumbuttons ] ) ;
2006-11-16 03:02:42 +00:00
}
else if ( function = = 3 )
{
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " to digital %s %s " , getjoyname ( 0 , whichkey > > 1 ) , ( whichkey & 1 ) ? " positive " : " negative " ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2008-07-22 10:56:22 +00:00
mgametext ( 320 > > 1 , 31 + 9 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-01-26 21:58:55 +00:00
m = clamp ( probey - 6 , 0 , NUMGAMEFUNCTIONS - 13 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
for ( l = 0 ; l < min ( 13 , NUMGAMEFUNCTIONS ) ; l + + )
{
if ( l + m = = NUMGAMEFUNCTIONS - 1 )
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " -None- " ) ;
2006-11-16 03:02:42 +00:00
else
strcpy ( tempbuf , CONFIG_FunctionNumToName ( m + l ) ) ;
2006-04-13 20:47:06 +00:00
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2012-02-04 14:30:54 +00:00
minitextshade ( 100 , 51 + l * 8 , tempbuf , ( m + l = = probey ) ? 0 : 16 ,
Bstrcmp ( keydefaults [ 3 * ( m + l ) ] , oldkeydefaults [ 3 * ( m + l ) ] ) ? 8 : 1 , 10 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
mgametext ( 320 > > 1 , 161 , " Press \" Escape \" To Cancel " , 0 , 2 + 8 + 16 ) ;
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
2006-11-16 03:02:42 +00:00
case 212 :
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Advanced Mouse " ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_REGULAR ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
onbar = ( probey = = 0 | | probey = = 1 | | probey = = 2 ) ;
if ( probey < 3 )
2012-10-14 22:16:07 +00:00
x = M_Probe ( margin , 46 , 16 , 7 ) ;
2006-11-16 03:02:42 +00:00
else if ( probey < 7 )
{
m = 50 ;
2012-10-14 22:16:07 +00:00
x = probesm ( margin + 10 , 97 + 16 - ( 9 + 9 + 9 ) , 9 , 7 ) ;
2006-11-16 03:02:42 +00:00
}
else
{
2012-10-14 22:16:07 +00:00
x = M_Probe ( margin , 146 + 16 - ( 16 + 16 + 16 + 16 + 16 + 16 ) , 16 , 7 ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
switch ( x )
{
case - 1 :
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 205 ) ;
2012-01-26 21:58:55 +00:00
probey = NUMMOUSEFUNCTIONS + 2 + 2 ;
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 0 :
// x-axis scale
case 1 :
// y-axis scale
case 2 :
// mouse filter
break ;
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
case 3 :
// digital up
case 4 :
// digital down
case 5 :
// digital left
case 6 :
// digital right
function = 1 ;
whichkey = ( x - 3 ) ^ 2 ; // flip the actual axis number
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 211 ) ;
2007-08-27 00:20:15 +00:00
probey = ud . config . MouseDigitalFunctions [ whichkey > > 1 ] [ whichkey & 1 ] ;
2006-11-16 03:02:42 +00:00
if ( probey < 0 ) probey = NUMGAMEFUNCTIONS - 1 ;
break ;
}
2006-04-13 20:47:06 +00:00
2007-01-05 23:40:37 +00:00
switch ( probey )
{
case 3 :
case 4 :
case 5 :
case 6 :
2012-03-26 05:07:12 +00:00
mgametext ( 160 , 144 + 9 + 9 , " Digital axes are not for mouse look " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 144 + 9 + 9 + 9 , " or for aiming up and down " , 0 , 2 + 8 + 16 ) ;
2007-01-05 23:40:37 +00:00
break ;
}
2012-10-14 22:16:07 +00:00
menutext ( margin , 46 , MENUHIGHLIGHT ( 0 ) , 0 , " X-Axis Scale " ) ;
2007-08-27 00:20:15 +00:00
l = ( ud . config . MouseAnalogueScale [ 0 ] + 262144 ) > > 13 ;
2012-10-14 22:16:07 +00:00
bar ( margin + 160 + 40 , 46 , & l , 1 , x = = 0 , MENUHIGHLIGHT ( 0 ) , 0 ) ;
2006-11-16 03:02:42 +00:00
l = ( l < < 13 ) - 262144 ;
2007-08-27 00:20:15 +00:00
if ( l ! = ud . config . MouseAnalogueScale [ 0 ] )
2006-11-16 03:02:42 +00:00
{
CONTROL_SetAnalogAxisScale ( 0 , l , controldevice_mouse ) ;
2007-08-27 00:20:15 +00:00
ud . config . MouseAnalogueScale [ 0 ] = l ;
2006-11-16 03:02:42 +00:00
}
Bsprintf ( tempbuf , " %s%.2f " , l > = 0 ? " " : " " , ( float ) l / 65536.0 ) ;
2012-10-14 22:16:07 +00:00
mgametext ( margin + 160 - 16 , 46 - 8 , tempbuf , MENUHIGHLIGHT ( 0 ) , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin , 46 + 16 , MENUHIGHLIGHT ( 1 ) , 0 , " Y-Axis Scale " ) ;
2007-08-27 00:20:15 +00:00
l = ( ud . config . MouseAnalogueScale [ 1 ] + 262144 ) > > 13 ;
2012-10-14 22:16:07 +00:00
bar ( margin + 160 + 40 , 46 + 16 , & l , 1 , x = = 1 , MENUHIGHLIGHT ( 1 ) , 0 ) ;
2006-11-16 03:02:42 +00:00
l = ( l < < 13 ) - 262144 ;
2007-08-27 00:20:15 +00:00
if ( l ! = ud . config . MouseAnalogueScale [ 1 ] )
2006-11-16 03:02:42 +00:00
{
CONTROL_SetAnalogAxisScale ( 1 , l , controldevice_mouse ) ;
2007-08-27 00:20:15 +00:00
ud . config . MouseAnalogueScale [ 1 ] = l ;
2006-11-16 03:02:42 +00:00
}
Bsprintf ( tempbuf , " %s%.2f " , l > = 0 ? " " : " " , ( float ) l / 65536.0 ) ;
2012-10-14 22:16:07 +00:00
mgametext ( margin + 160 - 16 , 46 + 16 - 8 , tempbuf , MENUHIGHLIGHT ( 1 ) , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin , 46 + 16 + 16 , MENUHIGHLIGHT ( 2 ) , 0 , " Dead Zone " ) ;
2008-10-13 01:16:40 +00:00
l = ud . config . MouseDeadZone > > 1 ;
2012-10-14 22:16:07 +00:00
bar ( margin + 160 + 40 , 46 + 16 + 16 , & l , 2 , x = = 2 , MENUHIGHLIGHT ( 2 ) , 0 ) ;
2008-10-13 01:16:40 +00:00
ud . config . MouseDeadZone = l < < 1 ;
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Digital Axes Setup " ) ;
2006-11-16 03:02:42 +00:00
2008-10-13 01:16:40 +00:00
if ( ud . config . MouseDeadZone = = 0 )
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Off " ) ;
2008-10-13 01:16:40 +00:00
else if ( ud . config . MouseDeadZone < 48 )
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Low " ) ;
2008-10-13 01:16:40 +00:00
else if ( ud . config . MouseDeadZone < 96 )
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Med " ) ;
2008-10-13 01:16:40 +00:00
else if ( ud . config . MouseDeadZone < 128 )
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " High " ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin + 160 - 16 , 46 + 16 + 16 - 8 , tempbuf , MENUHIGHLIGHT ( 2 ) , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
mgametextpal ( margin + 10 , 92 + 16 , " Up: " , MENUHIGHLIGHT ( 3 ) , 10 ) ;
2007-08-27 00:20:15 +00:00
if ( ud . config . MouseDigitalFunctions [ 1 ] [ 0 ] < 0 )
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " -None- " ) ;
2006-11-16 03:02:42 +00:00
else
2007-08-27 00:20:15 +00:00
strcpy ( tempbuf , CONFIG_FunctionNumToName ( ud . config . MouseDigitalFunctions [ 1 ] [ 0 ] ) ) ;
2006-04-13 20:47:06 +00:00
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2012-10-14 22:16:07 +00:00
minitextshade ( margin + 10 + 60 , 93 + 16 , tempbuf , MENUHIGHLIGHT ( 3 ) , 0 , 10 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametextpal ( margin + 10 , 92 + 16 + 9 , " Down: " , MENUHIGHLIGHT ( 4 ) , 10 ) ;
2007-08-27 00:20:15 +00:00
if ( ud . config . MouseDigitalFunctions [ 1 ] [ 1 ] < 0 )
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " -None- " ) ;
2006-11-16 03:02:42 +00:00
else
2007-08-27 00:20:15 +00:00
strcpy ( tempbuf , CONFIG_FunctionNumToName ( ud . config . MouseDigitalFunctions [ 1 ] [ 1 ] ) ) ;
2006-04-13 20:47:06 +00:00
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2012-10-14 22:16:07 +00:00
minitextshade ( margin + 10 + 60 , 93 + 16 + 9 , tempbuf , MENUHIGHLIGHT ( 4 ) , 0 , 10 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametextpal ( margin + 10 , 92 + 16 + 9 + 9 , " Left: " , MENUHIGHLIGHT ( 5 ) , 10 ) ;
2007-08-27 00:20:15 +00:00
if ( ud . config . MouseDigitalFunctions [ 0 ] [ 0 ] < 0 )
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " -None- " ) ;
2006-11-16 03:02:42 +00:00
else
2007-08-27 00:20:15 +00:00
strcpy ( tempbuf , CONFIG_FunctionNumToName ( ud . config . MouseDigitalFunctions [ 0 ] [ 0 ] ) ) ;
2006-04-13 20:47:06 +00:00
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2012-10-14 22:16:07 +00:00
minitextshade ( margin + 10 + 60 , 93 + 16 + 9 + 9 , tempbuf , MENUHIGHLIGHT ( 5 ) , 0 , 10 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametextpal ( margin + 10 , 92 + 16 + 9 + 9 + 9 , " Right: " , MENUHIGHLIGHT ( 6 ) , 10 ) ;
2007-08-27 00:20:15 +00:00
if ( ud . config . MouseDigitalFunctions [ 0 ] [ 1 ] < 0 )
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " -None- " ) ;
2006-11-16 03:02:42 +00:00
else
2007-08-27 00:20:15 +00:00
strcpy ( tempbuf , CONFIG_FunctionNumToName ( ud . config . MouseDigitalFunctions [ 0 ] [ 1 ] ) ) ;
2006-04-13 20:47:06 +00:00
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2012-10-14 22:16:07 +00:00
minitextshade ( margin + 10 + 60 , 93 + 16 + 9 + 9 + 9 , tempbuf , MENUHIGHLIGHT ( 6 ) , 0 , 10 + 16 ) ;
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
2006-11-16 03:02:42 +00:00
case 206 :
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Joystick Setup " ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
x = M_Probe ( 160 , 100 - 18 , 18 , 3 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
switch ( x )
{
case - 1 :
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_OPTIONS ) ;
2006-11-16 03:02:42 +00:00
probey = 6 ;
break ;
case 0 :
case 1 :
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 207 + x ) ;
2006-11-16 03:02:42 +00:00
break ;
case 2 :
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 213 ) ;
2006-11-16 03:02:42 +00:00
break ;
}
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
menutext ( 160 , 100 - 18 , 0 , 0 , " Edit Buttons " ) ;
menutext ( 160 , 100 , 0 , 0 , " Edit Axes " ) ;
menutext ( 160 , 100 + 18 , 0 , 0 , " Dead Zones " ) ;
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
2006-11-16 03:02:42 +00:00
case 207 :
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Joystick Buttons " ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
margin = 2 * joynumbuttons + 4 * ( joynumhats > 0 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
x = M_Probe ( 0 , 0 , 0 , margin ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 206 ) ;
2006-11-16 03:02:42 +00:00
probey = 0 ;
break ;
}
else if ( x > = 0 )
{
function = 2 ;
whichkey = x ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 211 ) ;
2006-11-16 03:02:42 +00:00
if ( x < 2 * joynumbuttons )
2006-11-15 01:16:55 +00:00
{
2007-08-27 00:20:15 +00:00
probey = ud . config . JoystickFunctions [ x > > 1 ] [ x & 1 ] ;
2006-11-16 03:02:42 +00:00
}
else
{
2007-08-27 00:20:15 +00:00
probey = ud . config . JoystickFunctions [ joynumbuttons + ( x - 2 * joynumbuttons ) ] [ 0 ] ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
if ( probey < 0 ) probey = NUMGAMEFUNCTIONS - 1 ;
break ;
}
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
// the top of our list
2012-10-14 22:16:07 +00:00
if ( margin < 13 ) m = 0 ;
2006-11-16 03:02:42 +00:00
else
{
m = probey - 6 ;
if ( m < 0 ) m = 0 ;
2012-10-14 22:16:07 +00:00
else if ( m + 13 > = margin ) m = margin - 13 ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
for ( l = 0 ; l < min ( 13 , margin ) ; l + + )
2006-11-16 03:02:42 +00:00
{
if ( m + l < 2 * joynumbuttons )
{
2009-02-02 01:49:14 +00:00
Bsprintf ( tempbuf , " %s%s " , ( ( l + m ) & 1 ) ? " Double " : " " , getjoyname ( 1 , ( l + m ) > > 1 ) ) ;
2007-08-27 00:20:15 +00:00
x = ud . config . JoystickFunctions [ ( l + m ) > > 1 ] [ ( l + m ) & 1 ] ;
2006-11-16 03:02:42 +00:00
}
else
{
2012-07-01 22:11:33 +00:00
static const char * directions [ ] =
2010-02-23 18:13:46 +00:00
{
" Up " , " Right " , " Down " , " Left "
} ;
2009-02-02 01:49:14 +00:00
Bsprintf ( tempbuf , " Hat %s " , directions [ ( l + m ) - 2 * joynumbuttons ] ) ;
2007-08-27 00:20:15 +00:00
x = ud . config . JoystickFunctions [ joynumbuttons + ( ( l + m ) - 2 * joynumbuttons ) ] [ 0 ] ;
2006-11-16 03:02:42 +00:00
}
minitextshade ( 80 - 4 , 33 + l * 8 , tempbuf , ( m + l = = probey ) ? 0 : 16 , 1 , 10 + 16 ) ;
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
2012-03-26 05:07:12 +00:00
minitextshade ( 176 , 33 + l * 8 , " -None- " , ( m + l = = probey ) ? 0 : 16 , 2 , 10 + 16 ) ;
2006-11-16 03:02:42 +00:00
else
{
strcpy ( tempbuf , CONFIG_FunctionNumToName ( x ) ) ;
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2006-11-16 03:02:42 +00:00
minitextshade ( 176 , 33 + l * 8 , tempbuf , ( m + l = = probey ) ? 0 : 16 , 2 , 10 + 16 ) ;
}
}
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 149 , " UP/DOWN = SELECT BUTTON " , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 149 + 9 , " ENTER = MODIFY " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
break ;
case 208 :
case 209 :
case 217 :
case 218 :
case 219 :
case 220 :
case 221 :
case 222 :
2008-05-15 03:16:38 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t thispage , twothispage ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Joystick Axes " ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
thispage = ( g_currentMenu < 217 ) ? ( g_currentMenu - 208 ) : ( g_currentMenu - 217 ) + 2 ;
2008-05-15 03:16:38 +00:00
twothispage = ( thispage * 2 + 1 < joynumaxes ) ;
2006-11-15 01:16:55 +00:00
2008-05-15 03:16:38 +00:00
onbar = 0 ;
switch ( probey )
{
case 0 :
case 4 :
onbar = 1 ;
2008-11-20 14:06:36 +00:00
x = M_Probe ( 88 , 45 + ( probey = = 4 ) * 64 , 0 , 1 + ( 4 < < twothispage ) ) ;
2008-05-15 03:16:38 +00:00
break ;
case 1 :
case 2 :
case 5 :
case 6 :
2008-11-20 14:06:36 +00:00
x = M_Probe ( 172 + ( probey = = 2 | | probey = = 6 ) * 72 , 45 + 15 + ( probey = = 5 | | probey = = 6 ) * 64 , 0 , 1 + ( 4 < < twothispage ) ) ;
2008-05-15 03:16:38 +00:00
break ;
case 3 :
case 7 :
2008-11-20 14:06:36 +00:00
x = M_Probe ( 88 , 45 + 15 + 15 + ( probey = = 7 ) * 64 , 0 , 1 + ( 4 < < twothispage ) ) ;
2008-05-15 03:16:38 +00:00
break ;
default :
2008-11-20 14:06:36 +00:00
x = M_Probe ( 60 , 79 + 79 * twothispage , 0 , 1 + ( 4 < < twothispage ) ) ;
2008-05-15 03:16:38 +00:00
break ;
}
2006-11-16 03:02:42 +00:00
2008-05-15 03:16:38 +00:00
switch ( x )
{
case - 1 :
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 206 ) ;
2008-05-15 03:16:38 +00:00
probey = 1 ;
break ;
case 8 :
if ( joynumaxes > 2 )
2006-11-15 01:16:55 +00:00
{
2012-10-14 22:16:07 +00:00
if ( thispage = = ( ( joynumaxes + 1 ) / 2 ) - 1 ) M_ChangeMenu ( 208 ) ;
2008-05-15 03:16:38 +00:00
else
2006-11-15 01:16:55 +00:00
{
2012-10-14 22:16:07 +00:00
if ( g_currentMenu = = 209 ) M_ChangeMenu ( 217 ) ;
else M_ChangeMenu ( g_currentMenu + 1 ) ;
2006-04-13 20:47:06 +00:00
}
2008-05-15 03:16:38 +00:00
}
break ;
2006-11-16 03:02:42 +00:00
2008-05-15 03:16:38 +00:00
case 4 : // bar
if ( ! twothispage & & joynumaxes > 2 )
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 208 ) ;
2008-05-15 03:16:38 +00:00
case 0 :
break ;
2006-11-16 03:02:42 +00:00
2008-05-15 03:16:38 +00:00
case 1 : // digitals
case 2 :
case 5 :
case 6 :
function = 3 ;
whichkey = ( ( thispage * 2 + ( x = = 5 | | x = = 6 ) ) < < 1 ) + ( x = = 2 | | x = = 6 ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 211 ) ;
2008-05-15 03:16:38 +00:00
probey = ud . config . JoystickDigitalFunctions [ whichkey > > 1 ] [ whichkey & 1 ] ;
if ( probey < 0 ) probey = NUMGAMEFUNCTIONS - 1 ;
break ;
2006-11-16 03:02:42 +00:00
2008-05-15 03:16:38 +00:00
case 3 : // analogues
case 7 :
l = ud . config . JoystickAnalogueAxes [ thispage * 2 + ( x = = 7 ) ] ;
if ( l = = analog_turning ) l = analog_strafing ;
else if ( l = = analog_strafing ) l = analog_lookingupanddown ;
else if ( l = = analog_lookingupanddown ) l = analog_moving ;
else if ( l = = analog_moving ) l = - 1 ;
else l = analog_turning ;
ud . config . JoystickAnalogueAxes [ thispage * 2 + ( x = = 7 ) ] = l ;
CONTROL_MapAnalogAxis ( thispage * 2 + ( x = = 7 ) , l , controldevice_joystick ) ;
{
mouseyaxismode = - 1 ;
2006-11-15 01:16:55 +00:00
}
2008-05-15 03:16:38 +00:00
break ;
default :
break ;
}
2012-10-14 22:16:07 +00:00
if ( getjoyname ( 0 , thispage * 2 ) ! = NULL )
{
Bstrcpy ( tempbuf , ( char * ) getjoyname ( 0 , thispage * 2 ) ) ;
menutext ( 42 , 32 , 0 , 0 , tempbuf ) ;
}
2008-05-15 03:16:38 +00:00
if ( twothispage )
{
2012-10-14 22:16:07 +00:00
if ( getjoyname ( 0 , thispage * 2 + 1 ) ! = NULL )
{
Bstrcpy ( tempbuf , ( char * ) getjoyname ( 0 , thispage * 2 + 1 ) ) ;
menutext ( 42 , 32 + 64 , 0 , 0 , tempbuf ) ;
}
2008-05-15 03:16:38 +00:00
}
2012-10-14 22:16:07 +00:00
2012-03-26 05:07:12 +00:00
mgametext ( 76 , 38 , " Scale " , 0 , 2 + 8 + 16 ) ;
2008-05-15 03:16:38 +00:00
l = ( ud . config . JoystickAnalogueScale [ thispage * 2 ] + 262144 ) > > 13 ;
2008-07-20 11:03:57 +00:00
bar ( 140 + 56 , 38 + 8 , & l , 1 , x = = 0 , 0 , 0 ) ;
2008-05-15 03:16:38 +00:00
l = ( l < < 13 ) - 262144 ;
if ( l ! = ud . config . JoystickAnalogueScale [ thispage * 2 ] )
{
CONTROL_SetAnalogAxisScale ( thispage * 2 , l , controldevice_joystick ) ;
ud . config . JoystickAnalogueScale [ thispage * 2 ] = l ;
}
Bsprintf ( tempbuf , " %s%.2f " , l > = 0 ? " " : " " , ( float ) l / 65536.0 ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 140 , 38 , tempbuf , 0 , 2 + 8 + 16 ) ;
2008-05-15 03:16:38 +00:00
2012-03-26 05:07:12 +00:00
mgametext ( 76 , 38 + 15 , " Digital " , 0 , 2 + 8 + 16 ) ;
2008-05-15 03:16:38 +00:00
if ( ud . config . JoystickDigitalFunctions [ thispage * 2 ] [ 0 ] < 0 )
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " -None- " ) ;
2008-05-15 03:16:38 +00:00
else
strcpy ( tempbuf , CONFIG_FunctionNumToName ( ud . config . JoystickDigitalFunctions [ thispage * 2 ] [ 0 ] ) ) ;
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2008-05-15 03:16:38 +00:00
minitext ( 140 + 12 , 38 + 15 , tempbuf , 0 , 10 + 16 ) ;
2006-04-13 20:47:06 +00:00
2008-05-15 03:16:38 +00:00
if ( ud . config . JoystickDigitalFunctions [ thispage * 2 ] [ 1 ] < 0 )
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " -None- " ) ;
2008-05-15 03:16:38 +00:00
else
strcpy ( tempbuf , CONFIG_FunctionNumToName ( ud . config . JoystickDigitalFunctions [ thispage * 2 ] [ 1 ] ) ) ;
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2008-05-15 03:16:38 +00:00
minitext ( 140 + 12 + 72 , 38 + 15 , tempbuf , 0 , 10 + 16 ) ;
2012-03-26 05:07:12 +00:00
mgametext ( 76 , 38 + 15 + 15 , " Analog " , 0 , 2 + 8 + 16 ) ;
2008-05-15 03:16:38 +00:00
if ( CONFIG_AnalogNumToName ( ud . config . JoystickAnalogueAxes [ thispage * 2 ] ) )
{
p = CONFIG_AnalogNumToName ( ud . config . JoystickAnalogueAxes [ thispage * 2 ] ) ;
if ( p )
2006-11-15 01:16:55 +00:00
{
2008-07-22 10:56:22 +00:00
mgametext ( 140 + 12 , 38 + 15 + 15 , strchr ( p , ' _ ' ) + 1 , 0 , 2 + 8 + 16 ) ;
2006-11-15 01:16:55 +00:00
}
2008-05-15 03:16:38 +00:00
}
if ( twothispage )
{
2012-03-26 05:07:12 +00:00
mgametext ( 76 , 38 + 64 , " Scale " , 0 , 2 + 8 + 16 ) ;
2008-05-15 03:16:38 +00:00
l = ( ud . config . JoystickAnalogueScale [ thispage * 2 + 1 ] + 262144 ) > > 13 ;
2008-07-20 11:03:57 +00:00
bar ( 140 + 56 , 38 + 8 + 64 , & l , 1 , x = = 4 , 0 , 0 ) ;
2006-11-16 03:02:42 +00:00
l = ( l < < 13 ) - 262144 ;
2008-05-15 03:16:38 +00:00
if ( l ! = ud . config . JoystickAnalogueScale [ thispage * 2 + 1 ] )
2006-11-15 01:16:55 +00:00
{
2008-05-15 03:16:38 +00:00
CONTROL_SetAnalogAxisScale ( thispage * 2 + 1 , l , controldevice_joystick ) ;
ud . config . JoystickAnalogueScale [ thispage * 2 + 1 ] = l ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
Bsprintf ( tempbuf , " %s%.2f " , l > = 0 ? " " : " " , ( float ) l / 65536.0 ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 140 , 38 + 64 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-03-26 05:07:12 +00:00
mgametext ( 76 , 38 + 64 + 15 , " Digital " , 0 , 2 + 8 + 16 ) ;
2008-05-15 03:16:38 +00:00
if ( ud . config . JoystickDigitalFunctions [ thispage * 2 + 1 ] [ 0 ] < 0 )
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " -None- " ) ;
2006-11-16 03:02:42 +00:00
else
2008-05-15 03:16:38 +00:00
strcpy ( tempbuf , CONFIG_FunctionNumToName ( ud . config . JoystickDigitalFunctions [ thispage * 2 + 1 ] [ 0 ] ) ) ;
2006-04-13 20:47:06 +00:00
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2008-05-15 03:16:38 +00:00
minitext ( 140 + 12 , 38 + 15 + 64 , tempbuf , 0 , 10 + 16 ) ;
2006-04-13 20:47:06 +00:00
2008-05-15 03:16:38 +00:00
if ( ud . config . JoystickDigitalFunctions [ thispage * 2 + 1 ] [ 1 ] < 0 )
2012-03-26 05:07:12 +00:00
strcpy ( tempbuf , " -None- " ) ;
2006-11-16 03:02:42 +00:00
else
2008-05-15 03:16:38 +00:00
strcpy ( tempbuf , CONFIG_FunctionNumToName ( ud . config . JoystickDigitalFunctions [ thispage * 2 + 1 ] [ 1 ] ) ) ;
2006-11-15 01:16:55 +00:00
2009-02-19 16:47:54 +00:00
for ( i = 0 ; tempbuf [ i ] ; i + + ) if ( tempbuf [ i ] = = ' _ ' ) tempbuf [ i ] = ' ' ;
2008-05-15 03:16:38 +00:00
minitext ( 140 + 12 + 72 , 38 + 15 + 64 , tempbuf , 0 , 10 + 16 ) ;
2006-11-15 01:16:55 +00:00
2012-03-26 05:07:12 +00:00
mgametext ( 76 , 38 + 64 + 15 + 15 , " Analog " , 0 , 2 + 8 + 16 ) ;
2008-05-15 03:16:38 +00:00
if ( CONFIG_AnalogNumToName ( ud . config . JoystickAnalogueAxes [ thispage * 2 + 1 ] ) )
2006-11-16 03:02:42 +00:00
{
2008-05-15 03:16:38 +00:00
p = CONFIG_AnalogNumToName ( ud . config . JoystickAnalogueAxes [ thispage * 2 + 1 ] ) ;
2006-11-16 03:02:42 +00:00
if ( p )
2006-11-15 01:16:55 +00:00
{
2008-07-22 10:56:22 +00:00
mgametext ( 140 + 12 , 38 + 64 + 15 + 15 , strchr ( p , ' _ ' ) + 1 , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
}
2008-05-15 03:16:38 +00:00
}
2006-04-13 20:47:06 +00:00
2008-05-15 03:16:38 +00:00
if ( joynumaxes > 2 )
{
2012-03-26 05:07:12 +00:00
menutext ( 320 > > 1 , twothispage ? 158 : 108 , SHX ( - 10 ) , ( joynumaxes < = 2 ) , " Next... " ) ;
2009-02-02 01:49:14 +00:00
Bsprintf ( tempbuf , " Page %d of %d " , thispage + 1 , ( joynumaxes + 1 ) / 2 ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 320 - 100 , 158 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
2008-05-15 03:16:38 +00:00
break ;
}
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 213 :
case 214 :
case 215 :
case 216 :
2008-05-15 03:16:38 +00:00
{
// Pray this is enough pages for now :-|
2009-01-09 09:29:17 +00:00
int32_t first , last ;
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( " Joy Dead Zones " ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
first = 4 * ( g_currentMenu - 213 ) ;
last = min ( 4 * ( g_currentMenu - 213 ) + 4 , joynumaxes ) ;
2006-04-13 20:47:06 +00:00
2008-05-15 03:16:38 +00:00
onbar = 1 ;
2008-11-20 14:06:36 +00:00
x = M_Probe ( 320 , 48 , 15 , 2 * ( last - first ) + ( joynumaxes > 4 ) ) ;
2006-04-13 20:47:06 +00:00
2008-05-15 03:16:38 +00:00
if ( x = = - 1 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 206 ) ;
2008-05-15 03:16:38 +00:00
probey = 2 ;
break ;
}
else if ( x = = 2 * ( last - first ) & & joynumaxes > 4 )
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( ( g_currentMenu - 213 ) = = ( joynumaxes / 4 ) ? 213 : ( g_currentMenu + 1 ) ) ;
2008-05-15 03:16:38 +00:00
probey = 0 ;
break ;
}
2006-04-13 20:47:06 +00:00
2010-10-21 02:20:40 +00:00
for ( m = first ; m < last ; m + + )
2008-05-15 03:16:38 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t odx , dx , ody , dy ;
2008-06-09 23:41:54 +00:00
Bstrcpy ( tempbuf , ( char * ) getjoyname ( 0 , m ) ) ;
2008-05-15 03:16:38 +00:00
menutext ( 32 , 48 + 30 * ( m - first ) , 0 , 0 , tempbuf ) ;
2006-11-15 01:16:55 +00:00
2012-03-26 05:07:12 +00:00
mgametext ( 128 , 48 + 30 * ( m - first ) - 8 , " Dead " , 0 , 2 + 8 + 16 ) ;
mgametext ( 128 , 48 + 30 * ( m - first ) - 8 + 15 , " Satu " , 0 , 2 + 8 + 16 ) ;
2006-11-15 01:16:55 +00:00
2008-05-15 03:16:38 +00:00
dx = odx = min ( 64 , 64l * ud . config . JoystickAnalogueDead [ m ] / 10000l ) ;
dy = ody = min ( 64 , 64l * ud . config . JoystickAnalogueSaturate [ m ] / 10000l ) ;
2006-11-15 01:16:55 +00:00
2008-07-20 11:03:57 +00:00
bar ( 217 , 48 + 30 * ( m - first ) , & dx , 4 , x = = ( ( m - first ) * 2 ) , 0 , 0 ) ;
bar ( 217 , 48 + 30 * ( m - first ) + 15 , & dy , 4 , x = = ( ( m - first ) * 2 + 1 ) , 0 , 0 ) ;
2006-11-16 03:02:42 +00:00
2008-05-15 03:16:38 +00:00
Bsprintf ( tempbuf , " %3d%% " , 100 * dx / 64 ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 217 - 49 , 48 + 30 * ( m - first ) - 8 , tempbuf , 0 , 2 + 8 + 16 ) ;
2008-05-15 03:16:38 +00:00
Bsprintf ( tempbuf , " %3d%% " , 100 * dy / 64 ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 217 - 49 , 48 + 30 * ( m - first ) - 8 + 15 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
2008-05-15 03:16:38 +00:00
if ( dx ! = odx ) ud . config . JoystickAnalogueDead [ m ] = 10000l * dx / 64l ;
if ( dy ! = ody ) ud . config . JoystickAnalogueSaturate [ m ] = 10000l * dy / 64l ;
if ( dx ! = odx | | dy ! = ody )
setjoydeadzone ( m , ud . config . JoystickAnalogueDead [ m ] , ud . config . JoystickAnalogueSaturate [ m ] ) ;
}
2012-03-26 05:07:12 +00:00
//mgametext(160,158,"Dead = Dead Zone, Sat. = Saturation",0,2+8+16);
2008-05-15 03:16:38 +00:00
if ( joynumaxes > 4 )
{
2012-03-26 05:07:12 +00:00
menutext ( 32 , 48 + 30 * ( last - first ) , 0 , 0 , " Next... " ) ;
2009-02-02 01:49:14 +00:00
Bsprintf ( tempbuf , " Page %d of %d " , 1 + ( g_currentMenu - 213 ) , ( joynumaxes + 3 ) / 4 ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 320 - 100 , 158 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
2008-05-15 03:16:38 +00:00
break ;
}
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
case MENU_SOUND :
case MENU_SOUND_INGAME :
2008-07-28 21:23:10 +00:00
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_REGULAR ;
M_DrawTopBar ( " Sound Setup " ) ;
2006-11-15 01:16:55 +00:00
2008-08-06 11:50:34 +00:00
if ( ! ( changesmade & 8 ) )
{
soundrate = ud . config . MixRate ;
soundvoices = ud . config . NumVoices ;
soundbits = ud . config . NumBits ;
}
2006-11-16 03:02:42 +00:00
{
2012-10-14 22:16:07 +00:00
int32_t io , ii , yy , d = margin + 160 + 40 , enabled , j ;
2012-07-01 22:11:33 +00:00
const char * opts [ ] =
2006-11-16 03:02:42 +00:00
{
2008-07-28 21:23:10 +00:00
" Sound " ,
" Sound volume " ,
" - " ,
" Music " ,
" Music volume " ,
" - " ,
2009-10-07 06:47:35 +00:00
" Playback sampling rate " ,
2008-08-06 11:50:34 +00:00
" Sample size " ,
2008-07-28 21:23:10 +00:00
" Number of voices " ,
" - " ,
" Restart sound system " ,
" - " ,
" Duke talk " ,
2008-10-13 01:16:40 +00:00
" Dukematch player sounds " ,
2008-07-28 21:23:10 +00:00
" Ambient sounds " ,
" Reverse stereo channels " ,
NULL
} ;
2006-11-15 01:16:55 +00:00
2008-07-28 21:23:10 +00:00
yy = 37 ;
for ( ii = io = 0 ; opts [ ii ] ; ii + + )
2006-05-02 03:51:06 +00:00
{
2008-07-28 21:23:10 +00:00
if ( opts [ ii ] [ 0 ] = = ' - ' & & ! opts [ ii ] [ 1 ] )
2006-11-16 03:02:42 +00:00
{
2008-07-28 21:23:10 +00:00
if ( io < = probey ) yy + = 4 ;
continue ;
2006-11-16 03:02:42 +00:00
}
2008-07-28 21:23:10 +00:00
if ( io < probey ) yy + = 8 ;
io + + ;
2006-11-15 01:16:55 +00:00
}
2008-07-28 21:23:10 +00:00
onbar = ( probey = = 1 | | probey = = 3 ) ;
2012-10-14 22:16:07 +00:00
x = probesm ( margin , yy + 5 , 0 , io ) ;
2008-07-28 21:23:10 +00:00
if ( x = = - 1 )
2006-11-15 01:16:55 +00:00
{
2008-08-06 11:50:34 +00:00
ud . config . MixRate = soundrate ;
ud . config . NumVoices = soundvoices ;
ud . config . NumBits = soundbits ;
2012-10-14 22:16:07 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME & & g_currentMenu = = MENU_SOUND_INGAME )
2006-11-16 03:02:42 +00:00
{
2008-07-28 21:23:10 +00:00
g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
2006-12-06 23:14:49 +00:00
{
2008-07-28 21:23:10 +00:00
ready2send = 1 ;
totalclock = ototalclock ;
2006-12-06 23:14:49 +00:00
}
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
else M_ChangeMenu ( MENU_OPTIONS ) ;
2008-07-28 21:23:10 +00:00
probey = 1 ;
2006-04-13 20:47:06 +00:00
}
2006-11-15 01:16:55 +00:00
2008-07-28 21:23:10 +00:00
yy = 37 ;
for ( ii = io = 0 ; opts [ ii ] ; ii + + )
{
if ( opts [ ii ] [ 0 ] = = ' - ' & & ! opts [ ii ] [ 1 ] )
{
yy + = 4 ;
continue ;
}
enabled = 1 ;
2006-11-15 01:16:55 +00:00
2008-07-28 21:23:10 +00:00
switch ( io )
{
case 0 :
if ( ud . config . FXDevice > = 0 )
{
i = ud . config . SoundToggle ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . config . SoundToggle , 1 , probey = = io ) ;
2008-07-28 21:23:10 +00:00
if ( x = = io )
ud . config . SoundToggle = 1 - ud . config . SoundToggle ;
if ( i ! = ud . config . SoundToggle )
{
if ( ud . config . SoundToggle = = 0 )
{
FX_StopAllSounds ( ) ;
2008-11-20 14:06:36 +00:00
S_ClearSoundLocks ( ) ;
2008-07-28 21:23:10 +00:00
}
}
}
mgametextpal ( d , yy , ud . config . SoundToggle ? " On " : " Off " , MENUHIGHLIGHT ( io ) , 0 ) ;
break ;
case 1 :
{
enabled = ( ud . config . SoundToggle & & ud . config . FXDevice > = 0 ) ;
l = ud . config . FXVolume ;
2012-02-18 17:56:52 +00:00
sliderbar ( 1 , d + 8 , yy + 7 , & ud . config . FXVolume , 15 , probey = = io , enabled ? MENUHIGHLIGHT ( io ) : UNSELMENUSHADE , ! enabled , 0 , 255 ) ;
2008-07-28 21:23:10 +00:00
if ( l ! = ud . config . FXVolume )
2009-01-09 09:29:17 +00:00
FX_SetVolume ( ( int16_t ) ud . config . FXVolume ) ;
2008-07-28 21:23:10 +00:00
}
break ;
case 2 :
2010-01-05 14:22:46 +00:00
if ( ud . config . MusicDevice > = 0 )
2008-07-28 21:23:10 +00:00
{
i = ud . config . MusicToggle ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . config . MusicToggle , 1 , probey = = io ) ;
2008-07-28 21:23:10 +00:00
if ( x = = io )
ud . config . MusicToggle = 1 - ud . config . MusicToggle ;
if ( i ! = ud . config . MusicToggle )
{
2009-07-27 05:33:12 +00:00
if ( ud . config . MusicToggle = = 0 ) S_PauseMusic ( 1 ) ;
2008-07-28 21:23:10 +00:00
else
{
if ( ud . recstat ! = 2 & & g_player [ myconnectindex ] . ps - > gm & MODE_GAME )
{
2012-06-04 22:01:45 +00:00
if ( MapInfo [ g_musicIndex ] . musicfn ! = NULL )
S_PlayMusic ( & MapInfo [ g_musicIndex ] . musicfn [ 0 ] , g_musicIndex ) ;
2008-07-28 21:23:10 +00:00
}
2008-11-20 14:06:36 +00:00
else S_PlayMusic ( & EnvMusicFilename [ 0 ] [ 0 ] , MAXVOLUMES * MAXLEVELS ) ;
2008-07-28 21:23:10 +00:00
2009-07-27 05:33:12 +00:00
S_PauseMusic ( 0 ) ;
2008-07-28 21:23:10 +00:00
}
}
}
mgametextpal ( d , yy , ud . config . MusicToggle ? " On " : " Off " , MENUHIGHLIGHT ( io ) , 0 ) ;
break ;
case 3 :
{
enabled = ( ud . config . MusicToggle & & ud . config . MusicDevice > = 0 ) ;
l = ud . config . MusicVolume ;
2012-02-18 17:56:52 +00:00
sliderbar ( 1 , d + 8 , yy + 7 , & ud . config . MusicVolume , 15 , probey = = io , enabled ? MENUHIGHLIGHT ( io ) : UNSELMENUSHADE , ! enabled , 0 , 255 ) ;
2008-07-28 21:23:10 +00:00
if ( l ! = ud . config . MusicVolume )
2009-07-27 05:33:12 +00:00
S_MusicVolume ( ( int16_t ) ud . config . MusicVolume ) ;
2008-07-28 21:23:10 +00:00
}
break ;
case 4 :
{
2009-10-07 06:47:35 +00:00
int32_t rates [ ] = { 22050 , 24000 , 32000 , 44100 , 48000 } ;
2009-01-09 09:29:17 +00:00
int32_t j = ( sizeof ( rates ) / sizeof ( rates [ 0 ] ) ) ;
2006-11-15 01:16:55 +00:00
2009-02-19 16:47:54 +00:00
for ( i = 0 ; i < j ; i + + )
2008-07-28 21:23:10 +00:00
if ( rates [ i ] = = ud . config . MixRate )
break ;
2006-11-15 01:16:55 +00:00
2009-01-09 09:29:17 +00:00
modval ( 0 , j - 1 , ( int32_t * ) & i , 1 , enabled & & probey = = io ) ;
2008-07-28 21:23:10 +00:00
if ( x = = io )
{
i + + ;
if ( i > = j )
i = 0 ;
}
if ( i = = j )
Bsprintf ( tempbuf , " Other " ) ;
else
{
Bsprintf ( tempbuf , " %d Hz " , rates [ i ] ) ;
if ( rates [ i ] ! = ud . config . MixRate )
{
ud . config . MixRate = rates [ i ] ;
changesmade | = 8 ;
}
}
mgametextpal ( d , yy , tempbuf , MENUHIGHLIGHT ( io ) , 0 ) ;
}
break ;
case 5 :
2008-08-06 11:50:34 +00:00
i = ud . config . NumBits ;
if ( x = = io )
{
if ( ud . config . NumBits = = 8 )
ud . config . NumBits = 16 ;
else if ( ud . config . NumBits = = 16 )
ud . config . NumBits = 8 ;
}
2009-01-09 09:29:17 +00:00
modval ( 8 , 16 , ( int32_t * ) & ud . config . NumBits , 8 , probey = = io ) ;
2008-08-06 11:50:34 +00:00
if ( ud . config . NumBits ! = i )
changesmade | = 8 ;
Bsprintf ( tempbuf , " %d-bit " , ud . config . NumBits ) ;
mgametextpal ( d , yy , tempbuf , MENUHIGHLIGHT ( io ) , 0 ) ;
break ;
case 6 :
2008-07-28 21:23:10 +00:00
i = ud . config . NumVoices ;
if ( x = = io )
{
ud . config . NumVoices + + ;
2012-10-14 22:16:07 +00:00
if ( ud . config . NumVoices > 256 )
2008-07-28 21:23:10 +00:00
ud . config . NumVoices = 4 ;
}
2012-10-14 22:16:07 +00:00
modval ( 4 , 256 , ( int32_t * ) & ud . config . NumVoices , 4 , probey = = io ) ;
2008-07-28 21:23:10 +00:00
if ( ud . config . NumVoices ! = i )
changesmade | = 8 ;
Bsprintf ( tempbuf , " %d " , ud . config . NumVoices ) ;
mgametextpal ( d , yy , tempbuf , MENUHIGHLIGHT ( io ) , 0 ) ;
break ;
2008-08-06 11:50:34 +00:00
case 7 :
2008-07-28 21:23:10 +00:00
enabled = ( changesmade & 8 ) ;
if ( ! enabled ) break ;
if ( x = = io )
{
2008-11-20 14:06:36 +00:00
S_SoundShutdown ( ) ;
S_MusicShutdown ( ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
S_MusicStartup ( ) ;
S_SoundStartup ( ) ;
2006-04-13 20:47:06 +00:00
2008-07-28 21:23:10 +00:00
FX_StopAllSounds ( ) ;
2008-11-20 14:06:36 +00:00
S_ClearSoundLocks ( ) ;
2006-04-13 20:47:06 +00:00
2008-07-28 21:23:10 +00:00
if ( ud . config . MusicToggle = = 1 )
{
if ( ud . recstat ! = 2 & & g_player [ myconnectindex ] . ps - > gm & MODE_GAME )
{
2012-06-04 22:01:45 +00:00
if ( MapInfo [ g_musicIndex ] . musicfn ! = NULL )
S_PlayMusic ( & MapInfo [ g_musicIndex ] . musicfn [ 0 ] , g_musicIndex ) ;
2008-07-28 21:23:10 +00:00
}
2008-11-20 14:06:36 +00:00
else S_PlayMusic ( & EnvMusicFilename [ 0 ] [ 0 ] , MAXVOLUMES * MAXLEVELS ) ;
2008-07-28 21:23:10 +00:00
}
changesmade & = ~ 8 ;
}
break ;
2008-08-06 11:50:34 +00:00
case 8 :
2008-07-28 21:23:10 +00:00
enabled = ( ud . config . SoundToggle & & ud . config . FXDevice > = 0 ) ;
i = j = ( ud . config . VoiceToggle & 1 ) ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & i , 1 , enabled & & probey = = io ) ;
2008-07-28 21:23:10 +00:00
if ( x = = io | | j ! = i )
ud . config . VoiceToggle ^ = 1 ;
mgametextpal ( d , yy , ud . config . VoiceToggle & 1 ? " Yes " : " No " , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , enabled ? 0 : 1 ) ;
break ;
2008-08-06 11:50:34 +00:00
case 9 :
2008-07-28 21:23:10 +00:00
enabled = ( ud . config . SoundToggle & & ud . config . FXDevice > = 0 ) ;
i = j = ( ud . config . VoiceToggle & 4 ) ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & i , 1 , enabled & & probey = = io ) ;
2008-07-28 21:23:10 +00:00
if ( x = = io | | j ! = i )
ud . config . VoiceToggle ^ = 4 ;
mgametextpal ( d , yy , ud . config . VoiceToggle & 4 ? " Yes " : " No " , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , enabled ? 0 : 1 ) ;
break ;
2008-08-06 11:50:34 +00:00
case 10 :
2008-07-28 21:23:10 +00:00
enabled = ( ud . config . SoundToggle & & ud . config . FXDevice > = 0 ) ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . config . AmbienceToggle , 1 , enabled & & probey = = io ) ;
2008-07-28 21:23:10 +00:00
if ( enabled & & x = = io )
ud . config . AmbienceToggle = 1 - ud . config . AmbienceToggle ;
mgametextpal ( d , yy , ud . config . AmbienceToggle ? " Yes " : " No " , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , enabled ? 0 : 1 ) ;
break ;
2008-08-06 11:50:34 +00:00
case 11 :
2008-07-28 21:23:10 +00:00
enabled = ( ud . config . SoundToggle & & ud . config . FXDevice > = 0 ) ;
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . config . ReverseStereo , 1 , enabled & & probey = = io ) ;
2008-07-28 21:23:10 +00:00
if ( enabled & & x = = io )
ud . config . ReverseStereo = 1 - ud . config . ReverseStereo ;
mgametextpal ( d , yy , ud . config . ReverseStereo ? " Yes " : " No " , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , enabled ? 0 : 1 ) ;
break ;
2006-11-16 03:02:42 +00:00
2008-07-28 21:23:10 +00:00
default :
break ;
}
2012-10-14 22:16:07 +00:00
mgametextpal ( margin , yy , opts [ ii ] , enabled ? MENUHIGHLIGHT ( io ) : DISABLEDMENUSHADE , enabled ? 10 : 1 ) ;
2008-07-28 21:23:10 +00:00
io + + ;
yy + = 8 ;
2006-11-16 03:02:42 +00:00
2008-07-28 21:23:10 +00:00
}
}
2006-11-16 03:02:42 +00:00
break ;
case 350 :
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 351 ) ;
2008-11-20 14:06:36 +00:00
g_screenCapture = 1 ;
G_DrawRooms ( myconnectindex , 65536 ) ;
g_screenCapture = 0 ;
2006-11-16 03:02:42 +00:00
break ;
case 360 :
case 361 :
case 362 :
case 363 :
case 364 :
case 365 :
case 366 :
case 367 :
case 368 :
case 369 :
case 351 :
2012-10-14 22:16:07 +00:00
case MENU_LOAD :
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_CENTER ;
M_DrawBackground ( ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( g_currentMenu = = MENU_LOAD ? " Load Game " : " Save Game " ) ;
2006-11-16 03:02:42 +00:00
2008-11-20 14:06:36 +00:00
if ( g_currentMenu > = 360 & & g_currentMenu < = 369 )
2006-11-16 03:02:42 +00:00
{
2010-09-14 18:19:38 +00:00
static uint32_t crc = 0 ;
if ( ! crc ) crc = crc32once ( ( uint8_t * ) & ud . savegame [ g_currentMenu - 360 ] [ 0 ] , 19 ) ;
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Players: %-2d " , ud . multimode ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 156 , tempbuf , 0 , 2 + 8 + 16 ) ;
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Episode: %-2d / Level: %-2d / Skill: %-2d " , 1 + ud . volume_number , 1 + ud . level_number , ud . player_skill ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 168 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
if ( ud . volume_number = = 0 & & ud . level_number = = 7 )
2008-09-15 02:47:02 +00:00
mgametext ( 160 , 180 , currentboardfilename , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
x = Menu_EnterText ( ( 320 > > 1 ) , 184 , & ud . savegame [ g_currentMenu - 360 ] [ 0 ] , 20 , 999 ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( x = = - 1 )
{
2010-09-14 18:19:38 +00:00
crc = 0 ;
ReadSaveGameHeaders ( ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 351 ) ;
2006-11-16 03:02:42 +00:00
goto DISPLAYNAMES ;
}
if ( x = = 1 )
{
2010-09-14 18:19:38 +00:00
// dirty hack... char 127 in last position indicates an auto-filled name
if ( ud . savegame [ g_currentMenu - 360 ] [ 0 ] = = 0 | | ( ud . savegame [ g_currentMenu - 360 ] [ 20 ] = = 127 & &
crc = = crc32once ( ( uint8_t * ) & ud . savegame [ g_currentMenu - 360 ] [ 0 ] , 19 ) ) )
2006-11-16 03:02:42 +00:00
{
2010-09-14 18:19:38 +00:00
Bstrncpy ( & ud . savegame [ g_currentMenu - 360 ] [ 0 ] , MapInfo [ ud . volume_number * MAXLEVELS + ud . level_number ] . name , 19 ) ;
ud . savegame [ g_currentMenu - 360 ] [ 20 ] = 127 ;
2006-11-16 03:02:42 +00:00
}
2012-09-05 17:25:43 +00:00
G_SavePlayerMaybeMulti ( g_currentMenu - 360 ) ;
2010-09-14 18:19:38 +00:00
g_lastSaveSlot = g_currentMenu - 360 ;
g_player [ myconnectindex ] . ps - > gm = MODE_GAME ;
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
{
ready2send = 1 ;
totalclock = ototalclock ;
2006-11-15 01:16:55 +00:00
}
2010-09-14 18:19:38 +00:00
crc = 0 ;
2006-11-15 01:16:55 +00:00
}
2006-04-13 20:47:06 +00:00
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( 101 < < 16 , 97 < < 16 , 65536 > > 1 , 512 , TILE_SAVESHOT , - 32 , 0 , 2 + 4 + 8 + 64 ) ;
2008-11-20 14:06:36 +00:00
M_DisplaySaveGameList ( ) ;
2012-10-14 22:16:07 +00:00
rotatesprite_fs ( ( margin + 67 + strlen ( & ud . savegame [ g_currentMenu - 360 ] [ 0 ] ) * 4 ) < < 16 , ( 50 + 12 * probey ) < < 16 , 32768L - 10240 , 0 , SPINNINGNUKEICON + ( ( ( totalclock ) > > 3 ) % 7 ) , 0 , 0 , 10 ) ;
2006-11-16 03:02:42 +00:00
break ;
}
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
last_threehundred = probey ;
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
x = M_Probe ( margin + 68 , 54 , 12 , 10 ) ;
2006-11-15 01:16:55 +00:00
2012-10-14 22:16:07 +00:00
if ( g_currentMenu = = MENU_LOAD )
2006-11-16 03:02:42 +00:00
{
2011-12-21 18:41:38 +00:00
// load game
2012-11-13 10:50:06 +00:00
if ( ud . savegame [ probey ] [ 0 ] )
2006-04-13 20:47:06 +00:00
{
2011-12-21 18:41:38 +00:00
Menus_LoadSave_DisplayCommon1 ( ) ;
2006-11-16 03:02:42 +00:00
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Players: %-2d " , savehead . numplayers ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 156 , tempbuf , 0 , 2 + 8 + 16 ) ;
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Episode: %-2d / Level: %-2d / Skill: %-2d " ,
2011-12-25 15:34:06 +00:00
1 + savehead . volnum , 1 + savehead . levnum , savehead . skill ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 168 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
if ( savehead . volnum = = 0 & & savehead . levnum = = 7 )
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 180 , savehead . boardfn , 0 , 2 + 8 + 16 ) ;
2006-11-15 01:16:55 +00:00
}
2011-12-21 18:41:38 +00:00
else
{
2012-03-26 05:07:12 +00:00
menutext ( 69 , 70 , 0 , 0 , " Empty " ) ;
2011-12-21 18:41:38 +00:00
}
2006-11-16 03:02:42 +00:00
}
else
{
2011-12-21 18:41:38 +00:00
// save game
2012-11-13 10:50:06 +00:00
if ( ud . savegame [ probey ] [ 0 ] )
2006-11-15 01:16:55 +00:00
{
2011-12-21 18:41:38 +00:00
Menus_LoadSave_DisplayCommon1 ( ) ;
2006-11-16 03:02:42 +00:00
}
2012-03-26 05:07:12 +00:00
else menutext ( 69 , 70 , 0 , 0 , " Empty " ) ;
2011-12-21 18:41:38 +00:00
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Players: %-2d " , ud . multimode ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 156 , tempbuf , 0 , 2 + 8 + 16 ) ;
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Episode: %-2d / Level: %-2d / Skill: %-2d " , 1 + ud . volume_number , 1 + ud . level_number , ud . player_skill ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 168 , tempbuf , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
if ( ud . volume_number = = 0 & & ud . level_number = = 7 )
2008-09-15 02:47:02 +00:00
mgametext ( 160 , 180 , currentboardfilename , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
switch ( x )
{
case - 1 :
2012-10-14 22:16:07 +00:00
if ( g_currentMenu = = MENU_LOAD )
2006-11-16 03:02:42 +00:00
{
2007-08-27 06:46:31 +00:00
if ( ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) ! = MODE_GAME )
2006-11-16 03:02:42 +00:00
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_MAIN ) ;
2006-11-15 01:16:55 +00:00
break ;
2006-11-16 03:02:42 +00:00
}
else
2007-08-27 06:46:31 +00:00
g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
else
2007-08-27 06:46:31 +00:00
g_player [ myconnectindex ] . ps - > gm = MODE_GAME ;
2006-04-13 20:47:06 +00:00
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
ready2send = 1 ;
totalclock = ototalclock ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
break ;
case 0 :
case 1 :
case 2 :
case 3 :
case 4 :
case 5 :
case 6 :
case 7 :
case 8 :
case 9 :
2012-10-14 22:16:07 +00:00
if ( g_currentMenu = = MENU_LOAD )
2006-04-13 20:47:06 +00:00
{
2012-11-13 10:50:06 +00:00
if ( ud . savegame [ x ] [ 0 ] & & ! g_oldverSavegame [ x ] )
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( 1000 + x ) ;
2006-11-16 03:02:42 +00:00
}
else
{
if ( ud . savegame [ x ] [ 0 ] ! = 0 )
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( 2000 + x ) ;
2006-11-16 03:02:42 +00:00
else
{
KB_FlushKeyboardQueue ( ) ;
2012-10-29 04:29:45 +00:00
M_ChangeMenu ( 360 + x ) ;
2006-11-16 03:02:42 +00:00
ud . savegame [ x ] [ 0 ] = 0 ;
inputloc = 0 ;
}
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
break ;
}
DISPLAYNAMES :
2008-11-20 14:06:36 +00:00
M_DisplaySaveGameList ( ) ;
2006-11-16 03:02:42 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_STORY :
case MENU_F1HELP :
2006-11-16 03:02:42 +00:00
if ( VOLUMEALL ) goto VOLUME_ALL_40x ;
case 402 :
case 403 :
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_CENTER ;
2006-11-16 03:02:42 +00:00
2012-10-29 04:29:45 +00:00
M_LinearPanels ( MENU_STORY , 403 ) ;
2006-11-16 03:02:42 +00:00
2012-06-03 16:11:22 +00:00
x = M_Probe ( 0 , 0 , 0 , 1 ) ;
if ( x = = - 1 )
2006-11-16 03:02:42 +00:00
{
2007-08-27 06:46:31 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME )
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_MAIN_INGAME ) ;
else M_ChangeMenu ( MENU_MAIN ) ;
2006-11-16 03:02:42 +00:00
return ;
}
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
flushperms ( ) ;
2012-10-14 22:16:07 +00:00
rotatesprite_fs ( 0 , 0 , 65536L , 0 , ORDERING + g_currentMenu - MENU_STORY , 0 , 0 , 10 + 16 + 64 ) ;
2006-11-15 01:16:55 +00:00
2006-11-16 03:02:42 +00:00
break ;
2006-11-15 01:16:55 +00:00
VOLUME_ALL_40x :
2012-10-14 22:16:07 +00:00
margin = MENU_MARGIN_CENTER ;
2006-11-15 01:16:55 +00:00
2012-10-29 04:29:45 +00:00
M_LinearPanels ( MENU_STORY , MENU_F1HELP ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
x = M_Probe ( 0 , 0 , 0 , 1 ) ;
2006-12-12 06:41:47 +00:00
if ( x = = - 1 )
2006-11-16 03:02:42 +00:00
{
2007-08-27 06:46:31 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME )
2010-06-22 21:50:01 +00:00
{
switch ( g_currentMenu )
{
2012-10-14 22:16:07 +00:00
case MENU_STORY :
case MENU_F1HELP :
2010-06-22 21:50:01 +00:00
g_player [ myconnectindex ] . ps - > gm = MODE_GAME ;
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
{
ready2send = 1 ;
totalclock = ototalclock ;
}
break ;
default :
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_MAIN_INGAME ) ;
2010-06-22 21:50:01 +00:00
break ;
}
}
2012-10-14 22:16:07 +00:00
else M_ChangeMenu ( MENU_MAIN ) ;
2006-11-16 03:02:42 +00:00
return ;
}
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
flushperms ( ) ;
2008-11-20 14:06:36 +00:00
switch ( g_currentMenu )
2006-11-16 03:02:42 +00:00
{
2012-10-14 22:16:07 +00:00
case MENU_STORY :
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( 0 , 0 , 65536L , 0 , TEXTSTORY , 0 , 0 , 10 + 16 + 64 ) ;
2006-11-15 01:16:55 +00:00
break ;
2012-10-14 22:16:07 +00:00
case MENU_F1HELP :
2012-02-02 17:35:05 +00:00
rotatesprite_fs ( 0 , 0 , 65536L , 0 , F1HELP , 0 , 0 , 10 + 16 + 64 ) ;
2006-11-16 03:02:42 +00:00
break ;
}
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
2012-10-14 22:16:07 +00:00
case MENU_QUIT :
case MENU_QUIT2 :
margin = MENU_MARGIN_CENTER ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin , 90 , " Are you sure you want to quit? " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 99 , " (Y/N) " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
x = M_Probe ( 186 , 124 , 0 , 1 ) ;
if ( ProbeTriggers ( AdvanceTrigger ) | | I_AdvanceTrigger ( ) | | KB_KeyPressed ( sc_Y ) )
2006-11-16 03:02:42 +00:00
{
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
ProbeTriggersClear ( AdvanceTrigger ) ;
KB_ClearKeyDown ( sc_Y ) ;
2006-11-16 03:02:42 +00:00
KB_FlushKeyboardQueue ( ) ;
2006-04-13 20:47:06 +00:00
2009-12-14 20:14:12 +00:00
G_GameQuit ( ) ;
2006-11-16 03:02:42 +00:00
}
2012-06-03 16:11:22 +00:00
if ( x = = - 1 | | KB_KeyPressed ( sc_N ) )
2006-11-16 03:02:42 +00:00
{
KB_ClearKeyDown ( sc_N ) ;
2010-01-16 23:08:17 +00:00
g_quitDeadline = 0 ;
2010-08-02 08:13:51 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_DEMO & & ud . recstat = = 2 )
2007-08-27 06:46:31 +00:00
g_player [ myconnectindex ] . ps - > gm = MODE_DEMO ;
2006-11-16 03:02:42 +00:00
else
2006-04-13 20:47:06 +00:00
{
2012-10-14 22:16:07 +00:00
if ( g_currentMenu = = MENU_QUIT2 )
2006-11-16 03:02:42 +00:00
{
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( last_menu ) ;
2007-02-05 01:33:08 +00:00
probey = last_menu_pos ;
2006-11-16 03:02:42 +00:00
}
2010-08-02 08:13:51 +00:00
else if ( ! ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME | | ud . recstat = = 2 ) )
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_MAIN ) ;
2007-08-27 06:46:31 +00:00
else g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
2006-04-13 20:47:06 +00:00
{
ready2send = 1 ;
totalclock = ototalclock ;
}
}
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 ;
2012-10-14 22:16:07 +00:00
case MENU_QUITTOTITLE :
margin = MENU_MARGIN_CENTER ;
mgametext ( margin , 90 , " Quit to Title? " , 0 , 2 + 8 + 16 ) ;
mgametext ( margin , 99 , " (Y/N) " , 0 , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
x = M_Probe ( 186 , 124 , 0 , 0 ) ;
if ( ProbeTriggers ( AdvanceTrigger ) | | I_AdvanceTrigger ( ) | | KB_KeyPressed ( sc_Y ) )
2006-11-16 03:02:42 +00:00
{
2012-06-03 16:11:22 +00:00
I_AdvanceTriggerClear ( ) ;
ProbeTriggersClear ( AdvanceTrigger ) ;
KB_ClearKeyDown ( sc_Y ) ;
2006-11-16 03:02:42 +00:00
KB_FlushKeyboardQueue ( ) ;
2007-08-27 06:46:31 +00:00
g_player [ myconnectindex ] . ps - > gm = MODE_DEMO ;
2006-11-16 03:02:42 +00:00
if ( ud . recstat = = 1 )
2008-11-20 14:06:36 +00:00
G_CloseDemoWrite ( ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_MAIN ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
if ( x = = - 1 | | KB_KeyPressed ( sc_N ) )
2006-11-16 03:02:42 +00:00
{
2007-08-27 06:46:31 +00:00
g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
2010-01-16 23:08:17 +00:00
if ( ( ! g_netServer & & ud . multimode < 2 ) & & ud . recstat ! = 2 )
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
ready2send = 1 ;
totalclock = ototalclock ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
}
break ;
case 601 :
2008-11-20 14:06:36 +00:00
G_DrawFrags ( ) ;
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( & g_player [ myconnectindex ] . user_name [ 0 ] ) ;
2006-04-13 20:47:06 +00:00
2009-02-02 01:49:14 +00:00
Bsprintf ( tempbuf , " Waiting for master " ) ;
2008-07-22 10:56:22 +00:00
mgametext ( 160 , 50 , tempbuf , 0 , 2 + 8 + 16 ) ;
mgametext ( 160 , 59 , " to select level " , 0 , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
2012-06-03 16:11:22 +00:00
if ( I_EscapeTrigger ( ) )
2006-11-16 03:02:42 +00:00
{
2012-06-03 16:11:22 +00:00
I_EscapeTriggerClear ( ) ;
2008-11-20 14:06:36 +00:00
S_PlaySound ( EXITMENUSOUND ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_MAIN ) ;
2006-11-16 03:02:42 +00:00
}
break ;
case 602 :
if ( menunamecnt = = 0 )
{
// getfilenames("SUBD");
2012-03-28 19:42:16 +00:00
fnlist_getnames ( & fnlist , " . " , " *.MAP " , 0 , 0 ) ;
set_findhighs ( ) ;
2006-04-13 20:47:06 +00:00
if ( menunamecnt = = 0 )
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 600 ) ;
2006-11-16 03:02:42 +00:00
}
2006-05-04 03:14:49 +00:00
2006-11-16 03:02:42 +00:00
case 603 :
2008-05-15 03:16:38 +00:00
{
2008-11-20 14:06:36 +00:00
x = M_Probe ( 186 , 124 , 0 , 0 ) ;
2006-04-13 20:47:06 +00:00
2008-05-15 03:16:38 +00:00
if ( voting ! = myconnectindex )
2012-10-28 22:27:53 +00:00
{
2008-05-15 03:16:38 +00:00
g_player [ myconnectindex ] . ps - > gm & = ~ MODE_MENU ;
2012-10-28 22:27:53 +00:00
}
else if ( x = = - 1 )
{
Net_SendMapVoteCancel ( 0 ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_MAIN ) ;
2012-10-28 22:27:53 +00:00
}
else
{
2012-03-26 05:07:12 +00:00
mgametext ( 160 , 90 , " Waiting for votes " , 0 , 2 ) ;
2012-10-28 22:27:53 +00:00
}
break ;
2008-05-15 03:16:38 +00:00
}
2006-11-16 03:02:42 +00:00
case 600 :
2012-10-14 22:16:07 +00:00
margin = ( 320 > > 1 ) - 120 ;
2007-08-27 06:46:31 +00:00
if ( ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) ! = MODE_GAME )
2008-11-20 14:06:36 +00:00
G_DrawFrags ( ) ;
2012-10-14 22:16:07 +00:00
M_DrawTopBar ( & g_player [ myconnectindex ] . user_name [ 0 ] ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
x = M_Probe ( margin , 57 - 8 , 16 , 8 ) ;
2006-04-16 23:36:04 +00:00
2009-01-09 09:29:17 +00:00
modval ( 0 , g_numGametypes - 1 , ( int32_t * ) & ud . m_coop , 1 , probey = = 0 ) ;
2006-11-16 03:02:42 +00:00
if ( ! VOLUMEONE )
2009-01-09 09:29:17 +00:00
modval ( 0 , g_numVolumes - 1 , ( int32_t * ) & ud . m_volume_number , 1 , probey = = 1 ) ;
2006-12-05 00:16:33 +00:00
i = ud . m_level_number ;
2009-01-09 09:29:17 +00:00
modval ( 0 , ud . m_volume_number = = 0 ? 6 + ( boardfilename [ 0 ] ! = 0 ) : MAXLEVELS - 1 , ( int32_t * ) & ud . m_level_number , 1 , probey = = 2 ) ;
2006-04-16 23:36:04 +00:00
2008-11-20 14:06:36 +00:00
if ( ( GametypeFlags [ ud . m_coop ] & GAMETYPE_MARKEROPTION ) )
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . m_marker , 1 , probey = = 4 ) ;
2008-11-20 14:06:36 +00:00
if ( ( GametypeFlags [ ud . m_coop ] & ( GAMETYPE_PLAYERSFRIENDLY | GAMETYPE_TDM ) ) )
2009-01-09 09:29:17 +00:00
modval ( 0 , 1 , ( int32_t * ) & ud . m_ffire , 1 , probey = = 5 ) ;
else modval ( 0 , 1 , ( int32_t * ) & ud . m_noexits , 1 , probey = = 5 ) ;
2006-04-13 20:47:06 +00:00
2006-12-05 00:16:33 +00:00
if ( probey = = 1 )
if ( ud . m_volume_number = = 0 & & ud . m_level_number > 6 + ( boardfilename [ 0 ] ! = 0 ) )
ud . m_level_number = 0 ;
2008-11-20 14:06:36 +00:00
while ( MapInfo [ ( ud . m_volume_number * MAXLEVELS ) + ud . m_level_number ] . name = = NULL )
2006-12-05 00:16:33 +00:00
{
if ( ud . m_level_number < i | | i = = 0 )
ud . m_level_number - - ;
else ud . m_level_number + + ;
if ( ud . m_level_number > MAXLEVELS - 1 | | ud . m_level_number < 0 )
{
ud . m_level_number = 0 ;
break ;
}
}
2006-11-16 03:02:42 +00:00
switch ( x )
{
case - 1 :
ud . m_recstat = 0 ;
2012-10-14 22:16:07 +00:00
if ( g_player [ myconnectindex ] . ps - > gm & MODE_GAME ) M_ChangeMenu ( MENU_MAIN_INGAME ) ;
else M_ChangeMenu ( MENU_MAIN ) ;
2006-11-16 03:02:42 +00:00
break ;
case 0 :
ud . m_coop + + ;
2008-11-20 14:06:36 +00:00
if ( ud . m_coop = = g_numGametypes ) ud . m_coop = 0 ;
2006-11-16 03:02:42 +00:00
break ;
case 1 :
if ( ! VOLUMEONE )
{
ud . m_volume_number + + ;
2008-11-20 14:06:36 +00:00
if ( ud . m_volume_number = = g_numVolumes ) ud . m_volume_number = 0 ;
2006-12-05 00:16:33 +00:00
if ( ud . m_volume_number = = 0 & & ud . m_level_number > 6 + ( boardfilename [ 0 ] ! = 0 ) )
2006-11-16 03:02:42 +00:00
ud . m_level_number = 0 ;
2006-12-05 00:16:33 +00:00
if ( ud . m_level_number > MAXLEVELS - 1 ) ud . m_level_number = 0 ;
2006-04-13 20:47:06 +00:00
}
2006-11-16 03:02:42 +00:00
break ;
case 2 :
ud . m_level_number + + ;
if ( ! VOLUMEONE )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
if ( ud . m_volume_number = = 0 & & ud . m_level_number > 6 + ( boardfilename [ 0 ] ! = 0 ) )
ud . m_level_number = 0 ;
2006-04-13 20:47:06 +00:00
}
2006-11-15 01:16:55 +00:00
else
2006-04-13 20:47:06 +00:00
{
2006-11-16 03:02:42 +00:00
if ( ud . m_volume_number = = 0 & & ud . m_level_number > 5 )
ud . m_level_number = 0 ;
2006-05-04 03:14:49 +00:00
}
2006-12-05 00:16:33 +00:00
if ( ud . m_level_number > MAXLEVELS - 1 ) ud . m_level_number = 0 ;
2006-11-16 03:02:42 +00:00
break ;
case 3 :
if ( ud . m_monsters_off = = 1 & & ud . m_player_skill > 0 )
ud . m_monsters_off = 0 ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( ud . m_monsters_off = = 0 )
{
ud . m_player_skill + + ;
if ( ud . m_player_skill > 3 )
{
ud . m_player_skill = 0 ;
ud . m_monsters_off = 1 ;
}
}
else ud . m_monsters_off = 0 ;
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
2006-11-16 03:02:42 +00:00
case 4 :
2008-11-20 14:06:36 +00:00
if ( ( GametypeFlags [ ud . m_coop ] & GAMETYPE_MARKEROPTION ) )
2006-11-16 03:02:42 +00:00
ud . m_marker = ! ud . m_marker ;
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 5 :
2008-11-20 14:06:36 +00:00
if ( ( GametypeFlags [ ud . m_coop ] & ( GAMETYPE_PLAYERSFRIENDLY | GAMETYPE_TDM ) ) )
2006-11-16 03:02:42 +00:00
ud . m_ffire = ! ud . m_ffire ;
else ud . m_noexits = ! ud . m_noexits ;
break ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
case 6 :
if ( VOLUMEALL )
2006-11-15 01:16:55 +00:00
{
2006-11-16 03:02:42 +00:00
currentlist = 1 ;
2007-02-05 01:33:08 +00:00
last_menu_pos = probey ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( MENU_USERMAP ) ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
break ;
case 7 :
2008-11-20 14:06:36 +00:00
// master does whatever it wants
2010-01-16 23:08:17 +00:00
if ( g_netServer )
2008-11-20 14:06:36 +00:00
{
2012-10-28 22:27:53 +00:00
Net_FillNewGame ( & pendingnewgame , 1 ) ;
Net_StartNewGame ( ) ;
Net_SendNewGame ( 1 , NULL ) ;
2008-11-20 14:06:36 +00:00
break ;
}
2006-11-16 03:02:42 +00:00
if ( voting = = - 1 )
2006-11-15 01:16:55 +00:00
{
2012-10-28 22:27:53 +00:00
Net_SendMapVoteInitiate ( ) ;
2012-10-14 22:16:07 +00:00
M_ChangeMenu ( 603 ) ;
2006-11-15 01:16:55 +00:00
}
2006-11-16 03:02:42 +00:00
break ;
}
2012-10-14 22:16:07 +00:00
margin + = 40 ;
2006-11-16 03:02:42 +00:00
2012-03-26 05:07:12 +00:00
//if(ud.m_coop==1) mgametext(c+70,57-7-9,"Cooperative Play",0,2+8+16);
//else if(ud.m_coop==2) mgametext(c+70,57-7-9,"DukeMatch (No Spawn)",0,2+8+16);
//else mgametext(c+70,57-7-9,"DukeMatch (Spawn)",0,2+8+16);
2012-10-14 22:16:07 +00:00
mgametext ( margin + 70 , 57 - 7 - 9 , GametypeNames [ ud . m_coop ] , MENUHIGHLIGHT ( 0 ) , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
if ( VOLUMEONE )
{
2012-10-14 22:16:07 +00:00
mgametext ( margin + 70 , 57 + 16 - 7 - 9 , EpisodeNames [ ud . m_volume_number ] , MENUHIGHLIGHT ( 1 ) , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
else
{
2012-10-14 22:16:07 +00:00
mgametext ( margin + 70 , 57 + 16 - 7 - 9 , EpisodeNames [ ud . m_volume_number ] , MENUHIGHLIGHT ( 1 ) , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin + 70 , 57 + 16 + 16 - 7 - 9 , & MapInfo [ MAXLEVELS * ud . m_volume_number + ud . m_level_number ] . name [ 0 ] , MENUHIGHLIGHT ( 2 ) , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
mgametext ( margin + 70 , 57 + 16 + 16 + 16 - 7 - 9 , ud . m_monsters_off = = 0 | | ud . m_player_skill > 0 ? SkillNames [ ud . m_player_skill ] : " None " , MENUHIGHLIGHT ( 3 ) , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
if ( GametypeFlags [ ud . m_coop ] & GAMETYPE_MARKEROPTION )
2012-10-14 22:16:07 +00:00
mgametext ( margin + 70 , 57 + 16 + 16 + 16 + 16 - 7 - 9 , ud . m_marker ? " On " : " Off " , MENUHIGHLIGHT ( 4 ) , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2008-11-20 14:06:36 +00:00
if ( GametypeFlags [ ud . m_coop ] & ( GAMETYPE_PLAYERSFRIENDLY | GAMETYPE_TDM ) )
2012-10-14 22:16:07 +00:00
mgametext ( margin + 70 , 57 + 16 + 16 + 16 + 16 + 16 - 7 - 9 , ud . m_ffire ? " On " : " Off " , MENUHIGHLIGHT ( 5 ) , 2 + 8 + 16 ) ;
else mgametext ( margin + 70 , 57 + 16 + 16 + 16 + 16 + 16 - 7 - 9 , ud . m_noexits ? " Off " : " On " , MENUHIGHLIGHT ( 5 ) , 2 + 8 + 16 ) ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
margin - = 44 ;
2006-04-13 20:47:06 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin , 57 - 9 , MENUHIGHLIGHT ( 0 ) , 0 , " Game Type " ) ;
2006-04-13 20:47:06 +00:00
2006-11-16 03:02:42 +00:00
if ( VOLUMEONE )
{
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Episode %d " , ud . m_volume_number + 1 ) ;
2012-10-14 22:16:07 +00:00
menutext ( margin , 57 + 16 - 9 , MENUHIGHLIGHT ( 1 ) , 1 , tempbuf ) ;
2006-11-16 03:02:42 +00:00
}
else
{
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Episode %d " , ud . m_volume_number + 1 ) ;
2012-10-14 22:16:07 +00:00
menutext ( margin , 57 + 16 - 9 , MENUHIGHLIGHT ( 1 ) , 0 , tempbuf ) ;
2006-11-16 03:02:42 +00:00
}
2012-03-26 05:07:12 +00:00
Bsprintf ( tempbuf , " Level %d " , ud . m_level_number + 1 ) ;
2012-10-14 22:16:07 +00:00
menutext ( margin , 57 + 16 + 16 - 9 , MENUHIGHLIGHT ( 2 ) , 0 , tempbuf ) ;
2006-11-16 03:02:42 +00:00
2012-10-14 22:16:07 +00:00
menutext ( margin , 57 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 3 ) , 0 , " Monsters " ) ;
2006-11-16 03:02:42 +00:00
2008-11-20 14:06:36 +00:00
if ( GametypeFlags [ ud . m_coop ] & GAMETYPE_MARKEROPTION )
2012-10-14 22:16:07 +00:00
menutext ( margin , 57 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 4 ) , 0 , " Markers " ) ;
2006-11-16 03:02:42 +00:00
else
2012-10-14 22:16:07 +00:00
menutext ( margin , 57 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 4 ) , 1 , " Markers " ) ;
2006-11-16 03:02:42 +00:00
2008-11-20 14:06:36 +00:00
if ( GametypeFlags [ ud . m_coop ] & ( GAMETYPE_PLAYERSFRIENDLY | GAMETYPE_TDM ) )
2012-10-14 22:16:07 +00:00
menutext ( margin , 57 + 16 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 5 ) , 0 , " Fr. Fire " ) ;
else menutext ( margin , 57 + 16 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 5 ) , 0 , " Map Exits " ) ;
2006-11-16 03:02:42 +00:00
if ( VOLUMEALL )
{
2012-10-14 22:16:07 +00:00
menutext ( margin , 57 + 16 + 16 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 6 ) , 0 , " User Map " ) ;
2006-11-16 03:02:42 +00:00
if ( boardfilename [ 0 ] ! = 0 )
2012-10-14 22:16:07 +00:00
mgametext ( margin + 70 + 44 , 57 + 16 + 16 + 16 + 16 + 16 , boardfilename , MENUHIGHLIGHT ( 6 ) , 2 + 8 + 16 ) ;
2006-11-16 03:02:42 +00:00
}
else
{
2012-10-14 22:16:07 +00:00
menutext ( margin , 57 + 16 + 16 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 6 ) , 1 , " User Map " ) ;
2006-11-16 03:02:42 +00:00
}
2012-10-14 22:16:07 +00:00
menutext ( margin , 57 + 16 + 16 + 16 + 16 + 16 + 16 + 16 - 9 , MENUHIGHLIGHT ( 7 ) , voting ! = - 1 , " Start Game " ) ;
2006-11-16 03:02:42 +00:00
break ;
2006-04-13 20:47:06 +00:00
}
2012-12-10 18:17:57 +00:00
if ( G_HaveEvent ( EVENT_DISPLAYMENUREST ) )
2012-10-29 04:29:45 +00:00
VM_OnEvent ( EVENT_DISPLAYMENUREST , g_player [ screenpeek ] . ps - > i , screenpeek , - 1 , 0 ) ;
2006-04-13 20:47:06 +00:00
2012-06-03 16:11:22 +00:00
if ( I_EscapeTrigger ( ) )
I_EscapeTriggerClear ( ) ;
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 ( ) ;
2013-01-19 18:28:32 +00:00
CAMERACLOCK = totalclock ;
CAMERADIST = 65536 ;
2006-04-13 20:47:06 +00:00
}
}