2005-02-28 07:16:19 +00:00
//read menu.h
2004-08-23 00:15:46 +00:00
# include "quakedef.h"
2009-11-04 21:16:50 +00:00
# include "shader.h"
2021-09-07 23:43:25 +00:00
# include "fs.h"
2004-08-23 00:15:46 +00:00
2020-04-19 01:23:32 +00:00
//draws the size specified, plus a little extra border (about 8 pixels in each direction, could be more though).
//size is in vpixels.
void Draw_ApproxTextBox ( float x , float y , float width , float height )
2004-08-23 00:15:46 +00:00
{
2004-12-24 08:45:56 +00:00
mpic_t * p ;
2020-04-19 01:23:32 +00:00
float cx , cy ;
int n , lines , columns ;
2004-08-23 00:15:46 +00:00
2020-04-19 01:23:32 +00:00
x - = 8 ;
y - = 8 ;
2004-08-23 00:15:46 +00:00
2020-04-19 01:23:32 +00:00
p = R2D_SafeCachePic ( " gfx/box_tl.lmp " ) ;
2014-10-05 20:04:11 +00:00
if ( R_GetShaderSizes ( p , NULL , NULL , false ) ! = true ) //assume none exist
2020-04-19 01:23:32 +00:00
{ //simple fill.
R2D_ImageColours ( 0.1 , 0.1 , 0.1 , 0.9 ) ;
R2D_FillBlock ( x , y , width + 16 , height + 16 ) ;
2011-03-31 01:14:01 +00:00
R2D_ImageColours ( 1.0 , 1.0 , 1.0 , 1.0 ) ;
2004-08-23 00:15:46 +00:00
return ;
2009-04-19 10:50:31 +00:00
}
2004-08-23 00:15:46 +00:00
2020-04-19 01:23:32 +00:00
//okay, we're drawing it with pics.
//expand the border to keep things centred.
lines = ceil ( height / 8 ) ;
y - = ( lines * 8 - height ) / 2 ;
columns = ceil ( width / 16 ) * 2 ; //columns must be a multiple of 2.
x - = ( columns * 8 - width ) / 2 ;
// draw left side
cx = x ;
cy = y ;
2004-08-23 00:15:46 +00:00
if ( p )
2011-03-31 01:14:01 +00:00
R2D_ScalePic ( cx , cy , 8 , 8 , p ) ;
p = R2D_SafeCachePic ( " gfx/box_ml.lmp " ) ;
2004-08-23 00:15:46 +00:00
for ( n = 0 ; n < lines ; n + + )
{
cy + = 8 ;
if ( p )
2011-03-31 01:14:01 +00:00
R2D_ScalePic ( cx , cy , 8 , 8 , p ) ;
2004-08-23 00:15:46 +00:00
}
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( " gfx/box_bl.lmp " ) ;
2004-08-23 00:15:46 +00:00
if ( p )
2011-03-31 01:14:01 +00:00
R2D_ScalePic ( cx , cy + 8 , 8 , 8 , p ) ;
2004-08-23 00:15:46 +00:00
// draw middle
cx + = 8 ;
2020-04-19 01:23:32 +00:00
while ( columns > 0 )
2004-08-23 00:15:46 +00:00
{
cy = y ;
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( " gfx/box_tm.lmp " ) ;
2004-08-23 00:15:46 +00:00
if ( p )
2011-03-31 01:14:01 +00:00
R2D_ScalePic ( cx , cy , 16 , 8 , p ) ;
p = R2D_SafeCachePic ( " gfx/box_mm.lmp " ) ;
2004-08-23 00:15:46 +00:00
for ( n = 0 ; n < lines ; n + + )
{
cy + = 8 ;
if ( n = = 1 )
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( " gfx/box_mm2.lmp " ) ;
2004-08-23 00:15:46 +00:00
if ( p )
2011-03-31 01:14:01 +00:00
R2D_ScalePic ( cx , cy , 16 , 8 , p ) ;
2004-08-23 00:15:46 +00:00
}
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( " gfx/box_bm.lmp " ) ;
2004-08-23 00:15:46 +00:00
if ( p )
2011-03-31 01:14:01 +00:00
R2D_ScalePic ( cx , cy + 8 , 16 , 8 , p ) ;
2020-04-19 01:23:32 +00:00
columns - = 2 ;
2004-08-23 00:15:46 +00:00
cx + = 16 ;
}
// draw right side
cy = y ;
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( " gfx/box_tr.lmp " ) ;
2004-08-23 00:15:46 +00:00
if ( p )
2011-03-31 01:14:01 +00:00
R2D_ScalePic ( cx , cy , 8 , 8 , p ) ;
p = R2D_SafeCachePic ( " gfx/box_mr.lmp " ) ;
2004-08-23 00:15:46 +00:00
for ( n = 0 ; n < lines ; n + + )
{
cy + = 8 ;
if ( p )
2011-03-31 01:14:01 +00:00
R2D_ScalePic ( cx , cy , 8 , 8 , p ) ;
2004-08-23 00:15:46 +00:00
}
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( " gfx/box_br.lmp " ) ;
2004-08-23 00:15:46 +00:00
if ( p )
2011-03-31 01:14:01 +00:00
R2D_ScalePic ( cx , cy + 8 , 8 , 8 , p ) ;
2004-08-23 00:15:46 +00:00
}
2014-09-08 23:47:19 +00:00
# ifndef NOBUILTINMENUS
2014-09-02 02:44:43 +00:00
2019-09-04 07:59:40 +00:00
static int omousex ;
static int omousey ;
static qboolean mousemoved ;
static qboolean bindingactive ;
2014-09-02 02:44:43 +00:00
extern cvar_t cl_cursor ;
extern cvar_t cl_cursorsize ;
extern cvar_t cl_cursorbias ;
extern cvar_t m_preset_chosen ;
2019-09-04 07:59:40 +00:00
extern menu_t * topmenu ;
2021-08-09 23:06:28 +00:00
menuoption_t * M_NextSelectableItem ( emenu_t * m , menuoption_t * old , qboolean wrap ) ;
2014-09-02 02:44:43 +00:00
2014-10-11 19:39:45 +00:00
# ifdef HEXEN2
//this function is so fucked up.
//firstly, the source image uses 0 for transparent instead of 255. this means we need special handling. *sigh*.
//secondly we have to avoid sampling too much of the image, because i chars seem to have stray white pixels in them
//thirdly, we hard-code (by eye) the space between chars, which should be different for any character pair.
//but we're lazy so we don't consider the next char. italic fonts are annoying like that. feel free to refudge it.
2006-03-06 01:41:09 +00:00
void Draw_Hexen2BigFontString ( int x , int y , const char * text )
2004-08-23 00:15:46 +00:00
{
2023-03-15 01:35:11 +00:00
conchar_t * w , buffer [ 256 ] ;
unsigned int codeflags , oldflags = CON_WHITEMASK , c ;
2004-08-23 00:15:46 +00:00
int sx , sy ;
2004-12-24 08:45:56 +00:00
mpic_t * p ;
2014-10-11 19:39:45 +00:00
p = R_RegisterShader ( " gfx/menu/bigfont.lmp " , SUF_2D ,
" { \n "
" if $nofixed \n "
" program default2d \n "
" endif \n "
" affine \n "
" nomipmaps \n "
" { \n "
" clampmap $diffuse \n "
" rgbgen vertex \n "
" alphagen vertex \n "
" blendfunc gl_one gl_one_minus_src_alpha \n "
" } \n "
" sort additive \n "
" } \n " ) ;
2015-05-03 19:57:46 +00:00
if ( ! p - > defaulttextures - > base )
2014-10-11 19:39:45 +00:00
{
void * file ;
qofs_t fsize = FS_LoadFile ( " gfx/menu/bigfont.lmp " , & file ) ;
if ( file )
{
unsigned int w = ( ( unsigned int * ) file ) [ 0 ] ;
unsigned int h = ( ( unsigned int * ) file ) [ 1 ] ;
2014-12-11 16:26:26 +00:00
if ( 8 + w * h = = fsize )
2015-05-03 19:57:46 +00:00
p - > defaulttextures - > base = R_LoadReplacementTexture ( " gfx/menu/bigfont.lmp " , NULL , IF_NOPCX | IF_PREMULTIPLYALPHA | IF_UIPIC | IF_NOPICMIP | IF_NOMIPMAP | IF_CLAMP , ( qbyte * ) file + 8 , w , h , TF_H2_TRANS8_0 ) ;
2014-10-11 19:39:45 +00:00
FS_FreeFile ( file ) ; //got image data
}
2015-05-03 19:57:46 +00:00
if ( ! p - > defaulttextures - > base )
p - > defaulttextures - > base = R_LoadHiResTexture ( " gfx/menu/bigfont.lmp " , NULL , IF_PREMULTIPLYALPHA | IF_UIPIC | IF_NOPICMIP | IF_NOMIPMAP | IF_CLAMP ) ;
2014-10-11 19:39:45 +00:00
}
2004-08-23 00:15:46 +00:00
2023-03-15 01:35:11 +00:00
COM_ParseFunString ( oldflags , text , buffer , sizeof ( buffer ) , false ) ;
for ( w = buffer ; * w ; )
2004-08-23 00:15:46 +00:00
{
2023-03-15 01:35:11 +00:00
w = Font_Decode ( w , & codeflags , & c ) ;
if ( codeflags & CON_HIDDEN )
continue ;
if ( c > = 0xe020 & & c < = 0xe07f )
c & = 0x00ff ; //convert to quake glyph to unicode/ascii...
if ( codeflags ! = oldflags )
{
vec4_t rgba ;
unsigned int col ;
oldflags = codeflags ;
col = ( codeflags & CON_FGMASK ) > > CON_FGSHIFT ;
rgba [ 0 ] = consolecolours [ col ] . fr ;
rgba [ 1 ] = consolecolours [ col ] . fg ;
rgba [ 2 ] = consolecolours [ col ] . fb ;
if ( codeflags & CON_HALFALPHA )
rgba [ 3 ] = 0.5 ;
else
rgba [ 3 ] = 1 ;
if ( vid . flags & VID_SRGBAWARE )
{
rgba [ 0 ] = M_SRGBToLinear ( rgba [ 0 ] , 1 ) ;
rgba [ 1 ] = M_SRGBToLinear ( rgba [ 1 ] , 1 ) ;
rgba [ 2 ] = M_SRGBToLinear ( rgba [ 2 ] , 1 ) ;
}
if ( codeflags & CON_BLINKTEXT )
{
float a = ( sin ( realtime * 3 ) + 1 ) * 0.3 + 0.4 ;
VectorScale ( rgba , a , rgba ) ;
}
R2D_ImageColours ( rgba [ 0 ] , rgba [ 1 ] , rgba [ 2 ] , rgba [ 3 ] ) ;
}
2014-10-11 19:39:45 +00:00
if ( c > = ' a ' & & c < = ' z ' )
2004-08-23 00:15:46 +00:00
{
2014-10-11 19:39:45 +00:00
sx = ( ( c - ' a ' ) % 8 ) * 20 ;
sy = ( ( c - ' a ' ) / 8 ) * 20 ;
2004-08-23 00:15:46 +00:00
}
2014-10-11 19:39:45 +00:00
else if ( c > = ' A ' & & c < = ' Z ' )
2004-08-23 00:15:46 +00:00
{
2014-10-11 19:39:45 +00:00
c = c - ' A ' + ' a ' ;
sx = ( ( c - ' a ' ) % 8 ) * 20 ;
sy = ( ( c - ' a ' ) / 8 ) * 20 ;
2004-08-23 00:15:46 +00:00
}
else // if (*text <= ' ')
{
sx = - 1 ;
sy = - 1 ;
}
if ( sx > = 0 )
2014-10-11 19:39:45 +00:00
R2D_SubPic ( x , y , 18 , 20 , p , sx , sy , 20 * 8 , 20 * 4 ) ;
switch ( c )
{
case ' a ' : x + = 15 ; break ;
case ' b ' : x + = 15 ; break ;
case ' c ' : x + = 15 ; break ;
case ' d ' : x + = 15 ; break ;
case ' e ' : x + = 15 ; break ;
case ' f ' : x + = 15 ; break ;
case ' g ' : x + = 15 ; break ;
case ' h ' : x + = 15 ; break ;
case ' i ' : x + = 10 ; break ;
case ' j ' : x + = 15 ; break ;
case ' k ' : x + = 18 ; break ;
case ' l ' : x + = 15 ; break ;
case ' m ' : x + = 18 ; break ;
case ' n ' : x + = 15 ; break ;
case ' o ' : x + = 15 ; break ;
case ' p ' : x + = 15 ; break ;
case ' q ' : x + = 18 ; break ;
case ' r ' : x + = 18 ; break ;
case ' s ' : x + = 13 ; break ;
case ' t ' : x + = 15 ; break ;
case ' u ' : x + = 15 ; break ;
case ' v ' : x + = 12 ; break ;
case ' w ' : x + = 15 ; break ;
case ' x ' : x + = 18 ; break ;
case ' y ' : x + = 15 ; break ;
case ' z ' : x + = 18 ; break ;
default : x + = 20 ; break ;
}
2004-08-23 00:15:46 +00:00
}
2023-03-15 01:35:11 +00:00
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ;
2004-08-23 00:15:46 +00:00
}
2014-10-11 19:39:45 +00:00
# endif
2004-08-23 00:15:46 +00:00
2006-03-06 01:41:09 +00:00
mpic_t * QBigFontWorks ( void )
{
mpic_t * p ;
2014-10-05 20:04:11 +00:00
int i ;
char * names [ ] = {
" gfx/mcharset.lmp " ,
" mcharset.lmp " ,
" textures/gfx/mcharset.lmp " ,
" textures/mcharset.lmp " ,
NULL
} ;
for ( i = 0 ; names [ i ] ; i + + )
{
p = R2D_SafeCachePic ( names [ i ] ) ;
if ( p & & R_GetShaderSizes ( p , NULL , NULL , true ) )
return p ;
}
2021-08-23 06:37:21 +00:00
return ( mpic_t * ) font_menu ;
2006-03-06 01:41:09 +00:00
}
void Draw_BigFontString ( int x , int y , const char * text )
{
2021-09-07 23:43:25 +00:00
conchar_t * w , buffer [ 256 ] ;
unsigned int codeflags , oldflags = CON_WHITEMASK , codepoint ;
2006-03-06 01:41:09 +00:00
int sx , sy ;
mpic_t * p ;
p = QBigFontWorks ( ) ;
if ( ! p )
2014-04-03 02:16:21 +00:00
{
2018-11-19 06:37:25 +00:00
Draw_AltFunString ( x , y + ( 20 - 8 ) / 2 , text ) ;
2006-03-06 01:41:09 +00:00
return ;
2014-04-03 02:16:21 +00:00
}
2021-08-23 06:37:21 +00:00
if ( p = = ( mpic_t * ) font_menu )
{
Draw_FunStringWidthFont ( font_menu , x , y , text , vid . width - x , false , false ) ;
return ;
}
2006-03-06 01:41:09 +00:00
{ //a hack for scaling
p - > width = 20 * 8 ;
p - > height = 20 * 8 ;
}
2021-09-07 23:43:25 +00:00
COM_ParseFunString ( oldflags , text , buffer , sizeof ( buffer ) , false ) ;
for ( w = buffer ; * w ; )
2006-03-06 01:41:09 +00:00
{
2021-09-07 23:43:25 +00:00
w = Font_Decode ( w , & codeflags , & codepoint ) ;
2023-03-15 01:35:11 +00:00
if ( codeflags & CON_HIDDEN )
continue ;
2021-09-07 23:43:25 +00:00
if ( codepoint > = 0xe020 & & codepoint < = 0xe07f )
codepoint & = 0x00ff ; //convert to quake glyph to unicode/ascii...
if ( codeflags ! = oldflags )
2006-03-06 01:41:09 +00:00
{
2021-09-07 23:43:25 +00:00
vec4_t rgba ;
unsigned int col ;
oldflags = codeflags ;
col = ( codeflags & CON_FGMASK ) > > CON_FGSHIFT ;
rgba [ 0 ] = consolecolours [ col ] . fr ;
rgba [ 1 ] = consolecolours [ col ] . fg ;
rgba [ 2 ] = consolecolours [ col ] . fb ;
if ( codeflags & CON_HALFALPHA )
rgba [ 3 ] = 0.5 ;
else
rgba [ 3 ] = 1 ;
if ( vid . flags & VID_SRGBAWARE )
{
rgba [ 0 ] = M_SRGBToLinear ( rgba [ 0 ] , 1 ) ;
rgba [ 1 ] = M_SRGBToLinear ( rgba [ 1 ] , 1 ) ;
rgba [ 2 ] = M_SRGBToLinear ( rgba [ 2 ] , 1 ) ;
}
if ( codeflags & CON_BLINKTEXT )
{
float a = ( sin ( realtime * 3 ) + 1 ) * 0.3 + 0.4 ;
VectorScale ( rgba , a , rgba ) ;
}
R2D_ImageColours ( rgba [ 0 ] , rgba [ 1 ] , rgba [ 2 ] , rgba [ 3 ] ) ;
2006-03-06 01:41:09 +00:00
}
2021-09-07 23:43:25 +00:00
if ( codepoint > = ' A ' & & codepoint < = ' Z ' )
{
sx = ( ( codepoint - ' A ' ) % 8 ) * ( p - > width > > 3 ) ;
sy = ( ( codepoint - ' A ' ) / 8 ) * ( p - > height > > 3 ) ;
}
else if ( codepoint > = ' a ' & & codepoint < = ' z ' )
2006-03-06 01:41:09 +00:00
{
2021-09-07 23:43:25 +00:00
sx = ( ( codepoint - ' a ' + 26 ) % 8 ) * ( p - > width > > 3 ) ;
sy = ( ( codepoint - ' a ' + 26 ) / 8 ) * ( p - > height > > 3 ) ;
2006-03-06 01:41:09 +00:00
}
2021-09-07 23:43:25 +00:00
else if ( codepoint > = ' 0 ' & & codepoint < = ' 1 ' )
2006-03-06 01:41:09 +00:00
{
2021-09-07 23:43:25 +00:00
sx = ( ( codepoint - ' 0 ' + 26 * 2 ) % 8 ) * ( p - > width > > 3 ) ;
sy = ( ( codepoint - ' 0 ' + 26 * 2 ) / 8 ) * ( p - > height > > 3 ) ;
2006-03-06 01:41:09 +00:00
}
2021-09-07 23:43:25 +00:00
else if ( codepoint = = ' : ' )
2006-03-06 01:41:09 +00:00
{
2021-09-07 23:43:25 +00:00
sx = ( ( codepoint - ' 0 ' + 26 * 2 + 10 ) % 8 ) * ( p - > width > > 3 ) ;
sy = ( ( codepoint - ' 0 ' + 26 * 2 + 10 ) / 8 ) * ( p - > height > > 3 ) ;
2006-03-06 01:41:09 +00:00
}
2021-09-07 23:43:25 +00:00
else if ( codepoint = = ' / ' )
2006-03-06 01:41:09 +00:00
{
2021-09-07 23:43:25 +00:00
sx = ( ( codepoint - ' 0 ' + 26 * 2 + 11 ) % 8 ) * ( p - > width > > 3 ) ;
sy = ( ( codepoint - ' 0 ' + 26 * 2 + 11 ) / 8 ) * ( p - > height > > 3 ) ;
2006-03-06 01:41:09 +00:00
}
else // if (*text <= ' ')
{
sx = - 1 ;
sy = - 1 ;
}
if ( sx > = 0 )
2011-03-31 01:14:01 +00:00
R2D_SubPic ( x , y , 20 , 20 , p , sx , sy , 20 * 8 , 20 * 8 ) ;
2006-03-06 01:41:09 +00:00
x + = ( p - > width > > 3 ) ;
}
2021-09-07 23:43:25 +00:00
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ;
2006-03-06 01:41:09 +00:00
}
2023-05-27 17:00:32 +00:00
static char * menudotstyle ;
static int maxdots ;
static int mindot ;
static int dotofs ;
2004-08-23 00:15:46 +00:00
2019-09-04 07:59:40 +00:00
static void MenuTooltipChange ( emenu_t * menu , const char * text )
2009-04-19 10:50:31 +00:00
{
2023-03-27 17:19:00 +00:00
unsigned int MAX_CHARS = 2048 ;
2009-04-19 10:50:31 +00:00
menutooltip_t * mtt ;
if ( menu - > tooltip )
{
Z_Free ( menu - > tooltip ) ;
menu - > tooltip = NULL ;
}
if ( ! text | | ! text [ 0 ] | | vid . width < 320 | | vid . height < 200 )
return ;
// allocate new tooltip structure, copy text to structure
2016-08-25 00:12:14 +00:00
mtt = ( menutooltip_t * ) Z_Malloc ( sizeof ( menutooltip_t ) + sizeof ( conchar_t ) * MAX_CHARS ) ;
mtt - > end = COM_ParseFunString ( CON_WHITEMASK , text , mtt - > text , sizeof ( conchar_t ) * MAX_CHARS , false ) ;
2009-04-19 10:50:31 +00:00
menu - > tooltip = mtt ;
}
2012-02-27 12:23:15 +00:00
static qboolean MI_Selectable ( menuoption_t * op )
2009-11-04 21:16:50 +00:00
{
switch ( op - > common . type )
{
case mt_text :
return false ;
case mt_button :
return true ;
2014-10-11 22:16:40 +00:00
# ifdef HEXEN2
2009-11-04 21:16:50 +00:00
case mt_hexen2buttonbigfont :
return true ;
2014-10-11 22:16:40 +00:00
# endif
2009-11-04 21:16:50 +00:00
case mt_qbuttonbigfont :
return true ;
case mt_menudot :
return false ;
case mt_picturesel :
return true ;
case mt_picture :
return false ;
2019-01-13 16:51:50 +00:00
case mt_framestart :
return false ;
case mt_frameend :
2009-11-04 21:16:50 +00:00
return true ;
case mt_box :
return false ;
case mt_slider :
return true ;
case mt_checkbox :
return true ;
case mt_edit :
return true ;
case mt_bind :
return true ;
case mt_combo :
return true ;
case mt_custom :
return true ;
default :
return false ;
}
}
2019-09-04 07:59:40 +00:00
static qboolean M_MouseMoved ( emenu_t * menu )
2004-08-23 00:15:46 +00:00
{
2019-01-13 16:51:50 +00:00
int ypos = menu - > ypos , framescroll = 0 ;
2012-02-27 12:23:15 +00:00
menuoption_t * option ;
2019-01-15 14:12:49 +00:00
qboolean havemouseitem = false ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
// if (menu->prev && !menu->exclusive)
// if (M_MouseMoved(menu->prev))
// return true;
2019-01-13 16:51:50 +00:00
if ( bindingactive )
return true ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
for ( option = menu - > options ; option ; option = option - > common . next )
2004-08-23 00:15:46 +00:00
{
2019-01-13 16:51:50 +00:00
if ( option - > common . ishidden )
continue ;
if ( mousecursor_x > menu - > xpos + option - > common . posx - option - > common . extracollide & & mousecursor_x < menu - > xpos + option - > common . posx + option - > common . width )
2004-08-23 00:15:46 +00:00
{
2019-01-13 16:51:50 +00:00
if ( mousecursor_y > ypos + option - > common . posy & & mousecursor_y < ypos + option - > common . posy + option - > common . height )
2010-07-11 02:22:39 +00:00
{
2019-01-13 16:51:50 +00:00
if ( MI_Selectable ( option ) )
2004-08-23 00:15:46 +00:00
{
2019-01-13 16:51:50 +00:00
if ( menu - > mouseitem ! = option )
2004-09-07 18:19:22 +00:00
{
2019-01-13 16:51:50 +00:00
menu - > mouseitem = option ;
2021-12-20 10:06:43 +00:00
if ( vrui . enabled )
{
menu - > selecteditem = option ;
if ( menu - > cursoritem )
2023-02-20 08:21:56 +00:00
menu - > cursoritem - > common . posy = menu - > selecteditem - > common . posy + ( menu - > selecteditem - > common . height - menu - > cursoritem - > common . height ) / 2 ;
2021-12-20 10:06:43 +00:00
}
2019-01-13 16:51:50 +00:00
menu - > tooltiptime = realtime + 1 ;
MenuTooltipChange ( menu , menu - > mouseitem - > common . tooltip ) ;
2004-09-07 18:19:22 +00:00
}
2019-01-15 14:12:49 +00:00
havemouseitem = true ;
2019-01-13 16:51:50 +00:00
}
}
}
switch ( option - > common . type )
{
2019-01-13 17:56:26 +00:00
default :
break ;
2019-01-13 16:51:50 +00:00
case mt_framestart :
ypos + = framescroll ;
framescroll = 0 ;
break ;
case mt_frameend :
{
menuoption_t * opt2 ;
int maxy = option - > frame . common . posy ;
for ( opt2 = option - > common . next ; opt2 ; opt2 = opt2 - > common . next )
{
if ( opt2 - > common . posy + opt2 - > common . height > maxy )
maxy = opt2 - > common . posy + opt2 - > common . height ;
2004-08-23 00:15:46 +00:00
}
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
maxy - = vid . height ;
2019-01-13 16:51:50 +00:00
framescroll + = option - > frame . frac * maxy ;
ypos - = option - > frame . frac * maxy ;
2010-07-11 02:22:39 +00:00
}
2019-01-13 16:51:50 +00:00
break ;
2004-08-23 00:15:46 +00:00
}
2012-02-27 12:23:15 +00:00
}
2019-01-15 14:12:49 +00:00
if ( ! havemouseitem & & menu - > mouseitem )
{
menu - > mouseitem = NULL ;
MenuTooltipChange ( menu , NULL ) ;
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
return true ;
}
2019-09-04 07:59:40 +00:00
static void M_CheckMouseMove ( emenu_t * m )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
{
if ( omousex ! = ( int ) mousecursor_x | | omousey ! = ( int ) mousecursor_y )
mousemoved = true ;
else
mousemoved = false ;
omousex = mousecursor_x ;
omousey = mousecursor_y ;
if ( mousemoved )
2019-09-04 07:59:40 +00:00
M_MouseMoved ( m ) ;
2012-02-27 12:23:15 +00:00
}
2019-01-13 16:51:50 +00:00
static float M_DrawScrollbar ( int x , int y , int width , int height , float frac , qboolean mgrabbed )
{
float unused = 0 ;
mpic_t * pic ;
int knob = y ;
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ;
pic = R2D_SafeCachePic ( " scrollbars/slidebg.tga " ) ;
if ( pic & & R_GetShaderSizes ( pic , NULL , NULL , false ) > 0 )
{
unused = 8 * 2 + 64 ; //top+bottom are 8 pixels, knob is 64
R2D_ScalePic ( x + width - 8 , y + 8 , 8 , height - 16 , pic ) ;
pic = R2D_SafeCachePic ( " scrollbars/arrow_up.tga " ) ;
R2D_ScalePic ( x + width - 8 , y , 8 , 8 , pic ) ;
pic = R2D_SafeCachePic ( " scrollbars/arrow_down.tga " ) ;
R2D_ScalePic ( x + width - 8 , y + height - 8 , 8 , 8 , pic ) ;
knob + = 8 ;
knob + = frac * ( float ) ( height - ( unused ) ) ;
pic = R2D_SafeCachePic ( " scrollbars/slider.tga " ) ;
R2D_ScalePic ( x + width - 8 , knob , 8 , 64 , pic ) ;
}
else
{
unused = width ; //top+bottom are invisible, knob is square
R2D_ImageColours ( 0.1 , 0.1 , 0.2 , 1.0 ) ;
R2D_FillBlock ( x , y , width , height ) ;
knob + = frac * ( height - unused ) ;
R2D_ImageColours ( 0.35 , 0.35 , 0.55 , 1.0 ) ;
R2D_FillBlock ( x , knob , width , width ) ;
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ;
}
if ( mgrabbed )
{
float my ;
my = mousecursor_y - y ;
my - = unused / 2 ;
my / = height - unused ;
if ( my > 1 )
my = 1 ;
if ( my < 0 )
my = 0 ;
frac = my ;
}
return frac ;
}
2019-09-04 07:59:40 +00:00
static void MenuDrawItems ( int xpos , int ypos , menuoption_t * option , emenu_t * menu )
2012-02-27 12:23:15 +00:00
{
int i ;
mpic_t * p ;
2014-10-05 20:04:11 +00:00
int pw , ph ;
2019-01-13 16:51:50 +00:00
int framescroll = 0 ;
2021-07-17 15:10:40 +00:00
int framescrollheight = 0 ;
2012-02-27 12:23:15 +00:00
2020-09-08 05:11:09 +00:00
menuframe_t * framescroller = NULL ;
2019-01-13 16:51:50 +00:00
for ( ; option ; option = option - > common . next )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
{
2019-01-13 16:51:50 +00:00
if ( option - > common . ishidden )
continue ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
2021-07-17 15:10:40 +00:00
if ( framescroller & & option = = menu - > selecteditem & & framescrollheight )
2020-09-08 05:11:09 +00:00
{
if ( ypos + option - > common . posy < framescroller - > common . posy )
{
2021-07-17 15:10:40 +00:00
int i = ypos + option - > common . posy + framescroll - framescroller - > common . posy ;
i - = 8 ;
framescroller - > frac = ( i ) / ( float ) framescrollheight ;
2020-09-08 05:11:09 +00:00
if ( framescroller - > frac < 0 )
framescroller - > frac = 0 ;
}
else if ( ypos + option - > common . posy + option - > common . height > framescroller - > common . posy + framescroller - > common . height )
{
2021-07-17 15:10:40 +00:00
int i = ypos + option - > common . posy + framescroll - framescroller - > common . posy ;
i - = vid . height - 8 - framescroller - > common . posy - option - > common . height ;
framescroller - > frac = ( i ) / ( float ) framescrollheight ;
2020-09-08 05:11:09 +00:00
if ( framescroller - > frac > 1 )
framescroller - > frac = 1 ;
}
}
2019-09-04 08:32:22 +00:00
if ( & menu - > menu = = topmenu & & menu - > mouseitem = = option & & option - > common . type ! = mt_frameend )
2019-01-13 16:51:50 +00:00
{
float alphamax = 0.5 , alphamin = 0.2 ;
R2D_ImageColours ( .5 , .4 , 0 , ( sin ( realtime * 2 ) + 1 ) * 0.5 * ( alphamax - alphamin ) + alphamin ) ;
R2D_FillBlock ( xpos + menu - > mouseitem - > common . posx , ypos + menu - > mouseitem - > common . posy , menu - > mouseitem - > common . width , menu - > mouseitem - > common . height ) ;
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ;
}
2004-08-23 00:15:46 +00:00
switch ( option - > common . type )
{
2014-08-17 03:18:43 +00:00
case mt_menucursor :
if ( ( int ) ( realtime * 4 ) & 1 )
Draw_FunString ( xpos + option - > common . posx , ypos + option - > common . posy , " ^Ue00d " ) ;
break ;
2004-08-23 00:15:46 +00:00
case mt_text :
if ( ! option - > text . text )
2014-08-17 03:18:43 +00:00
{ //blinking cursor image hack (FIXME)
2009-11-04 21:16:50 +00:00
if ( ( int ) ( realtime * 4 ) & 1 )
Draw_FunString ( xpos + option - > common . posx , ypos + option - > common . posy , " ^Ue00d " ) ;
}
2014-03-30 08:55:06 +00:00
else if ( option - > common . width )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
Draw_FunStringWidth ( xpos + option - > common . posx , ypos + option - > common . posy , option - > text . text , option - > common . width , option - > text . rightalign , option - > text . isred ) ;
2004-08-23 00:15:46 +00:00
else if ( option - > text . isred )
2009-11-04 21:16:50 +00:00
Draw_AltFunString ( xpos + option - > common . posx , ypos + option - > common . posy , option - > text . text ) ;
2004-08-23 00:15:46 +00:00
else
2009-11-04 21:16:50 +00:00
Draw_FunString ( xpos + option - > common . posx , ypos + option - > common . posy , option - > text . text ) ;
2004-08-23 00:15:46 +00:00
break ;
case mt_button :
2015-01-21 18:18:37 +00:00
Draw_FunStringWidth ( xpos + option - > common . posx , ypos + option - > common . posy , option - > button . text , option - > common . width , option - > button . rightalign , ! menu - > cursoritem & & menu - > selecteditem = = option ) ;
2004-08-23 00:15:46 +00:00
break ;
2014-10-11 22:16:40 +00:00
# ifdef HEXEN2
2006-03-06 01:41:09 +00:00
case mt_hexen2buttonbigfont :
Draw_Hexen2BigFontString ( xpos + option - > common . posx , ypos + option - > common . posy , option - > button . text ) ;
break ;
2014-10-11 22:16:40 +00:00
# endif
2006-03-06 01:41:09 +00:00
case mt_qbuttonbigfont :
2004-08-23 00:15:46 +00:00
Draw_BigFontString ( xpos + option - > common . posx , ypos + option - > common . posy , option - > button . text ) ;
break ;
case mt_menudot :
i = ( int ) ( realtime * 10 ) % maxdots ;
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( va ( menudotstyle , i + mindot ) ) ;
2018-11-19 06:37:25 +00:00
if ( R_GetShaderSizes ( p , NULL , NULL , false ) > 0 )
R2D_ScalePic ( xpos + option - > common . posx , ypos + option - > common . posy + dotofs , option - > common . width , option - > common . height , p ) ;
else if ( ( int ) ( realtime * 4 ) & 1 )
Draw_FunString ( xpos + option - > common . posx , ypos + option - > common . posy + ( option - > common . height - 8 ) / 2 , " ^a^Ue00d " ) ;
2004-08-23 00:15:46 +00:00
break ;
2006-05-11 00:41:47 +00:00
case mt_picturesel :
2004-08-23 00:15:46 +00:00
p = NULL ;
if ( menu - > selecteditem & & menu - > selecteditem - > common . posx = = option - > common . posx & & menu - > selecteditem - > common . posy = = option - > common . posy )
2006-01-21 00:06:49 +00:00
{
char selname [ MAX_QPATH ] ;
Q_strncpyz ( selname , option - > picture . picturename , sizeof ( selname ) ) ;
2006-03-11 03:12:10 +00:00
COM_StripExtension ( selname , selname , sizeof ( selname ) ) ;
2006-05-11 00:41:47 +00:00
Q_strncatz ( selname , " _sel " , sizeof ( selname ) ) ;
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( selname ) ;
2006-01-21 00:06:49 +00:00
}
2014-10-05 20:04:11 +00:00
if ( ! R_GetShaderSizes ( p , & pw , & ph , false ) )
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( option - > picture . picturename ) ;
2004-08-23 00:15:46 +00:00
2014-12-23 15:26:42 +00:00
if ( R_GetShaderSizes ( p , & pw , & ph , false ) > 0 )
2019-01-13 16:51:50 +00:00
{
float scale = ( option - > common . height ? option - > common . height : 20.0 ) / ph ;
R2D_ScalePic ( xpos + option - > common . posx , ypos + option - > common . posy , option - > common . width ? option - > common . width : ( pw * scale ) , ph * scale , p ) ;
}
2004-08-23 00:15:46 +00:00
break ;
2006-05-11 00:41:47 +00:00
case mt_picture :
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( option - > picture . picturename ) ;
2014-12-23 15:26:42 +00:00
if ( R_GetShaderSizes ( p , NULL , NULL , false ) > 0 ) R2D_ScalePic ( xpos + option - > common . posx , ypos + option - > common . posy , option - > common . width , option - > common . height , p ) ;
2006-02-28 00:46:04 +00:00
break ;
2019-01-13 16:51:50 +00:00
case mt_framestart :
ypos + = framescroll ;
framescroll = 0 ;
if ( R2D_Flush )
R2D_Flush ( ) ;
BE_Scissor ( NULL ) ;
2020-09-08 05:11:09 +00:00
framescroller = NULL ;
2019-01-13 16:51:50 +00:00
break ;
case mt_frameend :
{
srect_t srect ;
menuoption_t * opt2 ;
int maxy = option - > frame . common . posy ;
option - > frame . common . width = 16 ;
option - > frame . common . posx = vid . width - option - > frame . common . width - xpos ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
option - > frame . common . height = vid . height - maxy - ypos ;
2019-01-13 16:51:50 +00:00
for ( opt2 = option - > common . next ; opt2 ; opt2 = opt2 - > common . next )
{
if ( opt2 - > common . posy + opt2 - > common . height > maxy )
maxy = opt2 - > common . posy + opt2 - > common . height ;
}
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
maxy - = vid . height ;
2021-07-17 15:10:40 +00:00
framescrollheight = maxy ;
2019-01-13 16:51:50 +00:00
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( maxy < = 0 )
2019-01-13 16:51:50 +00:00
{
option - > frame . mousedown = false ;
option - > frame . frac = 0 ;
option - > frame . common . width = 0 ;
option - > frame . common . height = 0 ;
2021-07-17 15:10:40 +00:00
framescrollheight = 0 ;
2019-01-13 16:51:50 +00:00
}
else
{
2023-01-09 05:14:38 +00:00
if ( ! keydown [ K_MOUSE1 ] & & ! keydown [ K_TOUCHTAP ] )
2019-01-13 16:51:50 +00:00
option - > frame . mousedown = false ;
option - > frame . frac = M_DrawScrollbar ( xpos + option - > frame . common . posx , ypos + option - > common . posy , option - > frame . common . width , option - > frame . common . height , option - > frame . frac , option - > frame . mousedown ) ;
if ( R2D_Flush )
R2D_Flush ( ) ;
srect . x = 0 ;
srect . y = ( float ) ( ypos + option - > common . posy ) / vid . height ;
srect . width = 1 ;
srect . height = 1 - srect . y ;
srect . dmin = - 99999 ;
srect . dmax = 99999 ;
srect . y = ( 1 - srect . y ) - srect . height ;
BE_Scissor ( & srect ) ;
2020-09-08 05:11:09 +00:00
framescroller = & option - > frame ;
framescroll + = framescroller - > frac * maxy ;
ypos - = framescroller - > frac * maxy ;
2019-01-13 16:51:50 +00:00
}
}
2004-08-23 00:15:46 +00:00
break ;
case mt_box :
2020-04-19 01:23:32 +00:00
Draw_ApproxTextBox ( xpos + option - > common . posx , ypos + option - > common . posy , option - > box . width , option - > box . height ) ;
2004-08-23 00:15:46 +00:00
break ;
case mt_slider :
if ( option - > slider . var )
{
# define SLIDER_RANGE 10
2004-09-07 23:15:19 +00:00
float range ;
2004-08-23 00:15:46 +00:00
int i ;
int x = xpos + option - > common . posx ;
int y = ypos + option - > common . posy ;
2009-11-04 21:16:50 +00:00
int s ;
2004-08-23 00:15:46 +00:00
2004-09-07 23:15:19 +00:00
range = ( option - > slider . current - option - > slider . min ) / ( option - > slider . max - option - > slider . min ) ;
2004-08-23 00:15:46 +00:00
if ( option - > slider . text )
{
2013-10-29 17:38:22 +00:00
Draw_FunStringWidth ( x , y , option - > slider . text , option - > slider . textwidth , true , ! menu - > cursoritem & & menu - > selecteditem = = option ) ;
x + = option - > slider . textwidth + 3 * 8 ;
2004-08-23 00:15:46 +00:00
}
if ( range < 0 )
range = 0 ;
if ( range > 1 )
range = 1 ;
2013-07-26 17:19:06 +00:00
option - > slider . vx = x ;
2009-11-04 21:16:50 +00:00
x - = 8 ;
2013-12-29 22:48:28 +00:00
Font_BeginString ( font_default , x , y , & x , & y ) ;
2015-07-14 14:47:00 +00:00
x = Font_DrawChar ( x , y , CON_WHITEMASK , 0xe080 ) ;
2009-11-04 21:16:50 +00:00
s = x ;
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < SLIDER_RANGE ; i + + )
2015-07-14 14:47:00 +00:00
x = Font_DrawChar ( x , y , CON_WHITEMASK , 0xe081 ) ;
Font_DrawChar ( x , y , CON_WHITEMASK , 0xe082 ) ;
Font_DrawChar ( s + ( x - s ) * range - Font_CharWidth ( CON_WHITEMASK , 0xe083 ) / 2 , y , CON_WHITEMASK , 0xe083 ) ;
2013-12-29 22:48:28 +00:00
Font_EndString ( font_default ) ;
2004-08-23 00:15:46 +00:00
}
break ;
case mt_checkbox :
{
int x = xpos + option - > common . posx ;
int y = ypos + option - > common . posy ;
qboolean on ;
if ( option - > check . func )
2006-02-28 00:46:04 +00:00
on = option - > check . func ( & option - > check , menu , CHK_CHECKED ) ;
2004-08-23 00:15:46 +00:00
else if ( ! option - > check . var )
2004-09-13 03:10:10 +00:00
on = option - > check . value ;
else if ( option - > check . bits ) //bits is a bitmask for use with cvars (users can be clumsy, so bittage of 0 uses non-zero as true, but sets only bit 1)
{
if ( option - > check . var - > latched_string )
on = atoi ( option - > check . var - > latched_string ) & option - > check . bits ;
else
on = ( int ) ( option - > check . var - > value ) & option - > check . bits ;
}
2004-08-23 00:15:46 +00:00
else
2004-09-13 03:10:10 +00:00
{
if ( option - > check . var - > latched_string )
on = ! ! atof ( option - > check . var - > latched_string ) ;
else
on = ! ! option - > check . var - > value ;
}
2004-08-23 00:15:46 +00:00
if ( option - > check . text )
{
2024-04-13 21:13:06 +00:00
Draw_FunStringWidth ( x , y , option - > check . text , option - > check . textwidth , true , ( ! menu - > cursoritem & & menu - > selecteditem = = option ) | ( ( option - > check . var & & ( option - > check . var - > flags & CVAR_RENDEREROVERRIDE ) ) ? 4 : 0 ) ) ;
2013-10-29 17:38:22 +00:00
x + = option - > check . textwidth + 3 * 8 ;
2004-08-23 00:15:46 +00:00
}
#if 0
if ( on )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
Draw_Character ( x , y , 0xe083 ) ;
2004-08-23 00:15:46 +00:00
else
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
Draw_Character ( x , y , 0xe081 ) ;
2004-08-23 00:15:46 +00:00
# endif
2006-03-23 06:45:17 +00:00
if ( ! menu - > cursoritem & & menu - > selecteditem = = option )
2023-05-27 17:00:32 +00:00
Draw_AltFunString ( x , y , on ? localtext ( " on " ) : localtext ( " off " ) ) ;
2004-08-23 00:15:46 +00:00
else
2023-05-27 17:00:32 +00:00
Draw_FunString ( x , y , on ? localtext ( " on " ) : localtext ( " off " ) ) ;
2004-08-23 00:15:46 +00:00
}
break ;
case mt_edit :
{
int x = xpos + option - > common . posx ;
int y = ypos + option - > common . posy ;
2022-02-07 14:34:11 +00:00
if ( ! option - > edit . slim )
2023-02-20 08:21:56 +00:00
y + = ( option - > common . height - 8 ) / 2 ; //fat ones are twice the height on account of the text box's borders.
2022-02-07 14:34:11 +00:00
2013-10-29 17:38:22 +00:00
Draw_FunStringWidth ( x , y , option - > edit . caption , option - > edit . captionwidth , true , ! menu - > cursoritem & & menu - > selecteditem = = option ) ;
x + = option - > edit . captionwidth + 3 * 8 ;
2011-06-07 23:54:58 +00:00
if ( option - > edit . slim )
x + = 8 ; // more space for cursor
else
2020-04-19 01:23:32 +00:00
Draw_ApproxTextBox ( x , y , 16 * 8 , 8 ) ;
2009-11-04 21:16:50 +00:00
Draw_FunString ( x , y , option - > edit . text ) ;
2004-08-23 00:15:46 +00:00
if ( menu - > selecteditem = = option & & ( int ) ( realtime * 4 ) & 1 )
{
2018-11-27 16:48:19 +00:00
vid . ime_allow = true ;
vid . ime_position [ 0 ] = x ;
vid . ime_position [ 1 ] = y + 8 ;
2004-08-23 00:15:46 +00:00
x + = strlen ( option - > edit . text ) * 8 ;
2009-11-04 21:16:50 +00:00
Draw_FunString ( x , y , " ^Ue00b " ) ;
2004-08-23 00:15:46 +00:00
}
}
break ;
2004-09-07 18:19:22 +00:00
case mt_bind :
{
int x = xpos + option - > common . posx ;
int y = ypos + option - > common . posy ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int keys [ 8 ] , keymods [ countof ( keys ) ] ;
int keycount ;
2018-07-05 16:21:44 +00:00
const char * keyname ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int j ;
2004-09-07 18:19:22 +00:00
2013-10-29 17:38:22 +00:00
Draw_FunStringWidth ( x , y , option - > bind . caption , option - > bind . captionwidth , true , ! menu - > cursoritem & & menu - > selecteditem = = option ) ;
x + = option - > bind . captionwidth + 3 * 8 ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
keycount = M_FindKeysForCommand ( 0 , cl_forceseat . ival , option - > bind . command , keys , keymods , countof ( keys ) ) ;
2010-01-15 05:35:27 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( bindingactive & & menu - > selecteditem = = option )
Draw_FunString ( x , y , " Press key " ) ;
else if ( ! keycount )
2023-01-09 05:14:38 +00:00
Draw_FunString ( x , y , " ^8?? " " ? " ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
else
{
for ( j = 0 ; j < keycount ; j + + )
{ /*these offsets are wrong*/
if ( j )
{
2023-01-09 05:14:38 +00:00
Draw_FunString ( x + 8 , y , " ^8or " ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
x + = 32 ;
2004-09-07 18:19:22 +00:00
}
2022-05-28 17:59:01 +00:00
keyname = Key_KeynumToLocalString ( keys [ j ] , keymods [ j ] ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
Draw_FunString ( x , y , keyname ) ;
x + = strlen ( keyname ) * 8 ;
2004-09-07 18:19:22 +00:00
}
}
}
break ;
2004-08-23 00:15:46 +00:00
case mt_combo :
{
int x = xpos + option - > common . posx ;
int y = ypos + option - > common . posy ;
2013-10-29 17:38:22 +00:00
Draw_FunStringWidth ( x , y , option - > combo . caption , option - > combo . captionwidth , true , ! menu - > cursoritem & & menu - > selecteditem = = option ) ;
x + = option - > combo . captionwidth + 3 * 8 ;
2007-01-08 03:13:03 +00:00
if ( option - > combo . numoptions )
{
if ( ! menu - > cursoritem & & menu - > selecteditem = = option )
2009-11-04 21:16:50 +00:00
Draw_AltFunString ( x , y , option - > combo . options [ option - > combo . selectedoption ] ) ;
2007-01-08 03:13:03 +00:00
else
2009-11-04 21:16:50 +00:00
Draw_FunString ( x , y , option - > combo . options [ option - > combo . selectedoption ] ) ;
2007-01-08 03:13:03 +00:00
}
2004-08-23 00:15:46 +00:00
}
break ;
case mt_custom :
option - > custom . draw ( xpos + option - > common . posx , ypos + option - > common . posy , & option - > custom , menu ) ;
break ;
default :
Sys_Error ( " Bad item type \n " ) ;
break ;
}
}
}
2019-09-04 07:59:40 +00:00
static void MenuDraw ( emenu_t * menu )
2004-08-23 00:15:46 +00:00
{
2006-02-28 00:46:04 +00:00
if ( ! menu - > dontexpand )
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
{
menu - > width = min ( vid . width , 320 ) ;
menu - > xpos = ( ( vid . width - menu - > width ) > > 1 ) ;
}
2015-06-18 22:11:30 +00:00
if ( menu - > predraw )
menu - > predraw ( menu ) ;
2023-01-09 05:14:38 +00:00
if ( menu - > selecteditem & & menu - > selecteditem - > common . type = = mt_text )
menu - > menu . showosk = true ;
else
menu - > menu . showosk = false ;
2004-08-23 00:15:46 +00:00
MenuDrawItems ( menu - > xpos , menu - > ypos , menu - > options , menu ) ;
2009-04-19 10:50:31 +00:00
// draw tooltip
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( menu - > mouseitem & & menu - > tooltip & & realtime > menu - > tooltiptime )
2009-04-19 10:50:31 +00:00
{
2019-01-15 14:12:49 +00:00
// menuoption_t *option = menu->mouseitem;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
2019-01-15 14:12:49 +00:00
// if (omousex > menu->xpos+option->common.posx && omousex < menu->xpos+option->common.posx+option->common.width)
// if (omousey > menu->ypos+option->common.posy && omousey < menu->ypos+option->common.posy+option->common.height)
2009-04-19 10:50:31 +00:00
{
2016-08-25 00:12:14 +00:00
int x = omousex + 8 ;
2020-04-19 01:23:32 +00:00
int y = omousey + 8 ;
2016-08-25 00:12:14 +00:00
int w ;
int h ;
2009-04-19 10:50:31 +00:00
int l , lines ;
2016-08-25 00:12:14 +00:00
conchar_t * line_start [ 16 ] ;
conchar_t * line_end [ countof ( line_start ) ] ;
//figure out the line breaks
Font_BeginString ( font_default , 0 , 0 , & l , & l ) ;
lines = Font_LineBreaks ( menu - > tooltip - > text , menu - > tooltip - > end , min ( vid . pixelwidth / 2 , 30 * 8 * vid . pixelwidth / vid . width ) , countof ( line_start ) , line_start , line_end ) ;
Font_EndString ( font_default ) ;
//figure out how wide that makes the tip
2020-04-19 01:23:32 +00:00
w = 0 ;
h = lines * 8 ;
2016-08-25 00:12:14 +00:00
for ( l = 0 ; l < lines ; l + + )
{
2020-04-19 01:23:32 +00:00
int lw = Font_LineWidth ( line_start [ l ] , line_end [ l ] ) * vid . width / vid . pixelwidth ;
2016-08-25 00:12:14 +00:00
if ( w < lw )
w = lw ;
}
2009-04-19 10:50:31 +00:00
// keep the tooltip within view
if ( x + w > = vid . width )
x = vid . width - w - 1 ;
if ( y + h > = vid . height )
y - = h ;
2016-08-25 00:12:14 +00:00
// draw the background
2020-04-19 01:23:32 +00:00
Draw_ApproxTextBox ( x , y , w , lines * 8 ) ;
2016-08-25 00:12:14 +00:00
//draw the text
Font_BeginString ( font_default , x , y , & x , & y ) ;
2009-04-19 10:50:31 +00:00
for ( l = 0 ; l < lines ; l + + )
{
2016-08-25 00:12:14 +00:00
Font_LineDraw ( x , y , line_start [ l ] , line_end [ l ] ) ;
y + = Font_CharHeight ( ) ;
2009-04-19 10:50:31 +00:00
}
2016-08-25 00:12:14 +00:00
Font_EndString ( font_default ) ;
2009-04-19 10:50:31 +00:00
}
}
2015-06-18 22:11:30 +00:00
if ( menu - > postdraw )
menu - > postdraw ( menu ) ;
2004-08-23 00:15:46 +00:00
}
2019-09-04 07:59:40 +00:00
menutext_t * MC_AddWhiteText ( emenu_t * menu , int lhs , int rhs , int y , const char * text , int rightalign )
2004-08-23 00:15:46 +00:00
{
2014-05-10 17:26:41 +00:00
menutext_t * n = Z_Malloc ( sizeof ( menutext_t ) + ( text ? strlen ( text ) : 0 ) + 1 ) ;
2004-08-23 00:15:46 +00:00
n - > common . type = mt_text ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2014-03-30 08:55:06 +00:00
n - > common . posx = lhs ;
2004-08-23 00:15:46 +00:00
n - > common . posy = y ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
n - > common . width = ( rhs ) ? rhs - lhs : 0 ;
2023-02-20 08:21:56 +00:00
n - > common . height = 8 ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
n - > rightalign = rightalign ;
2014-05-16 17:45:37 +00:00
if ( text )
{
n - > text = ( char * ) ( n + 1 ) ;
strcpy ( ( char * ) ( n + 1 ) , ( text ) ) ;
}
2004-08-23 00:15:46 +00:00
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2019-09-04 07:59:40 +00:00
menutext_t * MC_AddBufferedText ( emenu_t * menu , int lhs , int rhs , int y , const char * text , int rightalign , qboolean red )
2004-08-23 00:15:46 +00:00
{
menutext_t * n = Z_Malloc ( sizeof ( menutext_t ) + strlen ( text ) + 1 ) ;
n - > common . type = mt_text ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2014-03-30 08:55:06 +00:00
n - > common . posx = lhs ;
2004-08-23 00:15:46 +00:00
n - > common . posy = y ;
2014-03-30 08:55:06 +00:00
n - > common . width = rhs ? rhs - lhs : 0 ;
2004-08-23 00:15:46 +00:00
n - > text = ( char * ) ( n + 1 ) ;
strcpy ( ( char * ) ( n + 1 ) , text ) ;
n - > isred = red ;
if ( rightalign & & text )
n - > common . posx - = strlen ( text ) * 8 ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2019-09-04 07:59:40 +00:00
menutext_t * MC_AddRedText ( emenu_t * menu , int lhs , int rhs , int y , const char * text , int rightalign )
2004-08-23 00:15:46 +00:00
{
menutext_t * n ;
2014-05-10 17:26:41 +00:00
n = MC_AddWhiteText ( menu , lhs , rhs , y , text , rightalign ) ;
2004-08-23 00:15:46 +00:00
n - > isred = true ;
return n ;
}
2023-05-27 17:00:32 +00:00
menubind_t * MC_AddBind ( emenu_t * menu , int cx , int bx , int y , const char * caption , char * command , const char * tooltip )
2004-09-07 18:19:22 +00:00
{
2014-05-10 17:26:41 +00:00
menubind_t * n = Z_Malloc ( sizeof ( * n ) + strlen ( caption ) + 1 + strlen ( command ) + 1 + ( tooltip ? strlen ( tooltip ) + 1 : 0 ) ) ;
2004-09-07 18:19:22 +00:00
n - > common . type = mt_bind ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2013-10-29 17:38:22 +00:00
n - > common . posx = cx ;
2004-09-07 18:19:22 +00:00
n - > common . posy = y ;
2013-10-29 17:38:22 +00:00
n - > captionwidth = bx - cx ;
2004-09-07 18:19:22 +00:00
n - > caption = ( char * ) ( n + 1 ) ;
strcpy ( n - > caption , caption ) ;
n - > command = n - > caption + strlen ( n - > caption ) + 1 ;
strcpy ( n - > command , command ) ;
2014-05-10 17:26:41 +00:00
if ( tooltip )
{
2016-02-10 23:23:43 +00:00
char * tip = n - > command + strlen ( n - > command ) + 1 ;
n - > common . tooltip = tip ;
strcpy ( tip , tooltip ) ;
2014-05-10 17:26:41 +00:00
}
2013-10-29 17:38:22 +00:00
n - > common . width = n - > captionwidth + 64 ;
2006-01-28 06:41:20 +00:00
n - > common . height = 8 ;
2004-09-07 18:19:22 +00:00
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2023-05-27 17:00:32 +00:00
menupicture_t * MC_AddSelectablePicture ( emenu_t * menu , int x , int y , int height , const char * picname )
2006-05-11 00:41:47 +00:00
{
char selname [ MAX_QPATH ] ;
menupicture_t * n ;
2010-02-06 01:25:04 +00:00
if ( qrenderer = = QR_NONE )
2006-05-11 00:41:47 +00:00
return NULL ;
Q_strncpyz ( selname , picname , sizeof ( selname ) ) ;
COM_StripExtension ( selname , selname , sizeof ( selname ) ) ;
Q_strncatz ( selname , " _sel " , sizeof ( selname ) ) ;
2011-03-31 01:14:01 +00:00
R2D_SafeCachePic ( picname ) ;
R2D_SafeCachePic ( selname ) ;
2006-05-11 00:41:47 +00:00
n = Z_Malloc ( sizeof ( menupicture_t ) + strlen ( picname ) + 1 ) ;
n - > common . type = mt_picturesel ;
n - > common . iszone = true ;
n - > common . posx = x ;
n - > common . posy = y ;
2019-01-13 16:51:50 +00:00
n - > common . height = height ;
2006-05-11 00:41:47 +00:00
n - > picturename = ( char * ) ( n + 1 ) ;
strcpy ( n - > picturename , picname ) ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2023-05-27 17:00:32 +00:00
menupicture_t * MC_AddPicture ( emenu_t * menu , int x , int y , int width , int height , const char * picname )
2004-08-23 00:15:46 +00:00
{
menupicture_t * n ;
2010-02-06 01:25:04 +00:00
if ( qrenderer = = QR_NONE )
2004-08-23 00:15:46 +00:00
return NULL ;
2011-03-31 01:14:01 +00:00
R2D_SafeCachePic ( picname ) ;
2004-08-23 00:15:46 +00:00
n = Z_Malloc ( sizeof ( menupicture_t ) + strlen ( picname ) + 1 ) ;
n - > common . type = mt_picture ;
n - > common . iszone = true ;
n - > common . posx = x ;
n - > common . posy = y ;
2006-02-28 00:46:04 +00:00
n - > common . width = width ;
n - > common . height = height ;
n - > picturename = ( char * ) ( n + 1 ) ;
strcpy ( n - > picturename , picname ) ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2023-05-27 17:00:32 +00:00
menupicture_t * MC_AddCenterPicture ( emenu_t * menu , int y , int height , const char * picname )
2004-08-23 00:15:46 +00:00
{
int x ;
2009-11-04 21:16:50 +00:00
int width ;
2004-12-24 08:45:56 +00:00
mpic_t * p ;
2004-08-23 00:15:46 +00:00
2010-02-06 01:25:04 +00:00
if ( qrenderer = = QR_NONE )
2004-08-23 00:15:46 +00:00
return NULL ;
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( picname ) ;
2004-08-23 00:15:46 +00:00
if ( ! p )
2009-11-04 21:16:50 +00:00
{
2004-08-23 00:15:46 +00:00
x = 320 / 2 ;
2009-11-04 21:16:50 +00:00
width = 64 ;
}
2004-08-23 00:15:46 +00:00
else
2009-11-04 21:16:50 +00:00
{
2014-10-05 20:04:11 +00:00
int pwidth , pheight ;
if ( R_GetShaderSizes ( p , & pwidth , & pheight , true ) )
width = ( pwidth * ( float ) height ) / pheight ;
else
width = 64 ;
2009-11-04 21:16:50 +00:00
x = ( 320 - ( int ) width ) / 2 ;
}
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
return MC_AddPicture ( menu , x , y , width , height , picname ) ;
2004-08-23 00:15:46 +00:00
}
2023-02-20 08:21:56 +00:00
menuoption_t * MC_AddCursorSmall ( emenu_t * menu , menuresel_t * reselection , int x )
2014-08-17 03:18:43 +00:00
{
menuoption_t * n = Z_Malloc ( sizeof ( menucommon_t ) ) ;
if ( reselection )
menu - > reselection = reselection ;
n - > common . type = mt_menucursor ;
n - > common . iszone = true ;
n - > common . posx = x ;
2023-02-20 08:21:56 +00:00
n - > common . height = 8 ;
if ( ! menu - > selecteditem )
n - > common . posy = - 8 ;
else
n - > common . posy = menu - > selecteditem - > common . posy + ( menu - > selecteditem - > common . height - n - > common . height ) / 2 ;
2014-08-17 03:18:43 +00:00
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
if ( menu - > reselection )
{
2021-08-09 23:06:28 +00:00
menuoption_t * sel , * firstsel = M_NextSelectableItem ( menu , NULL , false ) ;
2014-08-17 03:18:43 +00:00
for ( sel = firstsel ; sel ; )
{
if ( sel - > common . posx = = menu - > reselection - > x & & sel - > common . posy = = menu - > reselection - > y )
{
menu - > selecteditem = sel ;
2023-02-20 08:21:56 +00:00
n - > common . posy = sel - > common . posy + ( sel - > common . height - n - > common . height ) / 2 ;
2014-08-17 03:18:43 +00:00
break ;
}
2021-08-09 23:06:28 +00:00
sel = M_NextSelectableItem ( menu , sel , false ) ;
2014-08-17 03:18:43 +00:00
if ( sel = = firstsel )
break ;
}
}
return n ;
}
2019-09-04 07:59:40 +00:00
menupicture_t * MC_AddCursor ( emenu_t * menu , menuresel_t * reselection , int x , int y )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
int i ;
2004-08-23 00:15:46 +00:00
menupicture_t * n = Z_Malloc ( sizeof ( menupicture_t ) ) ;
2014-08-17 03:18:43 +00:00
if ( reselection )
menu - > reselection = reselection ;
2004-08-23 00:15:46 +00:00
n - > common . type = mt_menudot ;
n - > common . iszone = true ;
n - > common . posx = x ;
n - > common . posy = y ;
2014-10-05 20:04:11 +00:00
n - > common . width = 20 ;
n - > common . height = 20 ;
2004-08-23 00:15:46 +00:00
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
2016-02-15 06:01:17 +00:00
switch ( M_GameType ( ) )
2014-10-05 20:04:11 +00:00
{
# ifdef Q2CLIENT
case MGT_QUAKE2 :
//AND QUAKE 2 WINS!!!
menudotstyle = " pics/m_cursor%i.pcx " ;
2004-08-23 00:15:46 +00:00
mindot = 0 ;
maxdots = 15 ;
dotofs = 0 ;
2014-10-05 20:04:11 +00:00
//this is *obviously* the correct size... not.
n - > common . width = 22 ;
n - > common . height = 29 ;
break ;
# endif
# ifdef HEXEN2
case MGT_HEXEN2 :
//AND THE WINNER IS HEXEN 2!!!
2004-08-23 00:15:46 +00:00
menudotstyle = " gfx/menu/menudot%i.lmp " ;
mindot = 1 ;
maxdots = 8 ;
2010-08-12 00:48:05 +00:00
dotofs = - 2 ;
2014-10-05 20:04:11 +00:00
break ;
# endif
default :
//QUAKE 1 WINS BY DEFAULT!
2004-08-23 00:15:46 +00:00
menudotstyle = " gfx/menudot%i.lmp " ;
mindot = 1 ;
maxdots = 6 ;
dotofs = 0 ;
2014-10-05 20:04:11 +00:00
break ;
2004-08-23 00:15:46 +00:00
}
2014-08-17 03:18:43 +00:00
2016-07-12 00:40:13 +00:00
//cache them all. this avoids weird flickering as things get dynamically loaded
for ( i = 0 ; i < maxdots ; i + + )
R2D_SafeCachePic ( va ( menudotstyle , i + mindot ) ) ;
2014-08-17 03:18:43 +00:00
if ( menu - > reselection )
{
2021-08-09 23:06:28 +00:00
menuoption_t * sel , * firstsel = M_NextSelectableItem ( menu , NULL , false ) ;
2014-08-17 03:18:43 +00:00
for ( sel = firstsel ; sel ; )
{
if ( sel - > common . posx = = menu - > reselection - > x & & sel - > common . posy = = menu - > reselection - > y )
{
menu - > selecteditem = sel ;
n - > common . posy = sel - > common . posy ;
break ;
}
2021-08-09 23:06:28 +00:00
sel = M_NextSelectableItem ( menu , sel , false ) ;
2014-08-17 03:18:43 +00:00
if ( sel = = firstsel )
break ;
}
}
2004-08-23 00:15:46 +00:00
return n ;
}
2023-05-27 17:00:32 +00:00
menuedit_t * MC_AddEdit ( emenu_t * menu , int cx , int ex , int y , const char * text , const char * def )
2004-08-23 00:15:46 +00:00
{
2013-10-29 17:38:22 +00:00
menuedit_t * n = Z_Malloc ( sizeof ( menuedit_t ) + strlen ( text ) + 1 ) ;
n - > slim = false ;
2004-08-23 00:15:46 +00:00
n - > common . type = mt_edit ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2013-10-29 17:38:22 +00:00
n - > common . posx = cx ;
2004-08-23 00:15:46 +00:00
n - > common . posy = y ;
2013-10-29 17:38:22 +00:00
n - > common . width = ex - cx + ( 17 ) * 8 ;
2023-02-20 08:21:56 +00:00
n - > common . height = 8 + ( n - > slim ? 0 : ( 8 * 2 ) ) ; //the 8bit artwork has 8*8 borders - only 4 pixels of that contains any actual data, but replacement images don't stick to that. so just treat them as the full +/- 8 extents here.
2005-02-12 18:56:04 +00:00
n - > modified = true ;
2013-10-29 17:38:22 +00:00
n - > captionwidth = ex - cx ;
n - > caption = ( char * ) ( n + 1 ) ;
strcpy ( ( char * ) ( n + 1 ) , text ) ;
2004-08-23 00:15:46 +00:00
Q_strncpyz ( n - > text , def , sizeof ( n - > text ) ) ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2023-05-27 17:00:32 +00:00
menuedit_t * MC_AddEditCvar ( emenu_t * menu , int cx , int ex , int y , const char * text , const char * name , qboolean isslim )
2004-08-23 00:15:46 +00:00
{
menuedit_t * n = Z_Malloc ( sizeof ( menuedit_t ) + strlen ( text ) + 1 ) ;
cvar_t * cvar ;
cvar = Cvar_Get ( name , " " , CVAR_USERCREATED | CVAR_ARCHIVE , NULL ) ; //well, this is a menu/
2013-10-29 17:38:22 +00:00
n - > slim = isslim ;
2004-08-23 00:15:46 +00:00
n - > common . type = mt_edit ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2013-10-29 17:38:22 +00:00
n - > common . posx = cx ;
2004-08-23 00:15:46 +00:00
n - > common . posy = y ;
2013-10-29 17:38:22 +00:00
n - > common . width = ex - cx + ( 17 ) * 8 ;
n - > common . height = n - > slim ? 8 : 16 ;
2010-07-11 02:22:39 +00:00
n - > common . tooltip = cvar - > description ;
2005-02-12 18:56:04 +00:00
n - > modified = true ;
2013-10-29 17:38:22 +00:00
n - > captionwidth = ex - cx ;
2004-08-23 00:15:46 +00:00
n - > caption = ( char * ) ( n + 1 ) ;
strcpy ( ( char * ) ( n + 1 ) , text ) ;
n - > cvar = cvar ;
2011-06-18 05:41:10 +00:00
# ifdef _DEBUG
2006-03-06 01:41:09 +00:00
if ( ! ( cvar - > flags & CVAR_ARCHIVE ) )
Con_Printf ( " Warning: %s is not set for archiving \n " , cvar - > name ) ;
2011-06-18 05:41:10 +00:00
# endif
2004-08-23 00:15:46 +00:00
Q_strncpyz ( n - > text , cvar - > string , sizeof ( n - > text ) ) ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2019-09-04 07:59:40 +00:00
menubox_t * MC_AddBox ( emenu_t * menu , int x , int y , int width , int height )
2004-08-23 00:15:46 +00:00
{
2005-06-19 09:08:47 +00:00
menubox_t * n = Z_Malloc ( sizeof ( menubox_t ) ) ;
2004-08-23 00:15:46 +00:00
n - > common . type = mt_box ;
n - > common . iszone = true ;
n - > common . posx = x ;
n - > common . posy = y ;
n - > width = width ;
n - > height = height ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2019-09-04 07:59:40 +00:00
menucustom_t * MC_AddCustom ( emenu_t * menu , int x , int y , void * dptr , int dint , const char * tooltip )
2004-08-23 00:15:46 +00:00
{
2019-01-15 14:12:49 +00:00
menucustom_t * n = Z_Malloc ( sizeof ( menucustom_t ) + ( tooltip ? strlen ( tooltip ) + 1 : 0 ) ) ;
2004-08-23 00:15:46 +00:00
n - > common . type = mt_custom ;
n - > common . iszone = true ;
n - > common . posx = x ;
n - > common . posy = y ;
2013-03-12 22:47:42 +00:00
n - > dptr = dptr ;
n - > dint = dint ;
2019-01-15 14:12:49 +00:00
n - > common . tooltip = tooltip ? strcpy ( ( char * ) ( n + 1 ) , tooltip ) : NULL ;
2004-08-23 00:15:46 +00:00
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2019-09-04 07:59:40 +00:00
menucheck_t * MC_AddCheckBox ( emenu_t * menu , int tx , int cx , int y , const char * text , cvar_t * var , int bits )
2004-08-23 00:15:46 +00:00
{
menucheck_t * n = Z_Malloc ( sizeof ( menucheck_t ) + strlen ( text ) + 1 ) ;
n - > common . type = mt_checkbox ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2013-10-29 17:38:22 +00:00
n - > common . posx = tx ;
2004-08-23 00:15:46 +00:00
n - > common . posy = y ;
n - > common . height = 8 ;
2013-10-29 17:38:22 +00:00
n - > textwidth = cx - tx ;
n - > common . width = cx - tx + 7 * 8 ;
2010-07-11 02:22:39 +00:00
n - > common . tooltip = var ? var - > description : NULL ;
2004-08-23 00:15:46 +00:00
n - > text = ( char * ) ( n + 1 ) ;
strcpy ( ( char * ) ( n + 1 ) , text ) ;
n - > var = var ;
2004-09-13 03:10:10 +00:00
n - > bits = bits ;
2004-08-23 00:15:46 +00:00
2011-06-18 05:41:10 +00:00
# ifdef _DEBUG
2006-03-06 01:41:09 +00:00
if ( var )
2018-08-09 06:21:39 +00:00
{
2006-03-06 01:41:09 +00:00
if ( ! ( var - > flags & CVAR_ARCHIVE ) )
Con_Printf ( " Warning: %s is not set for archiving \n " , var - > name ) ;
2018-01-22 19:18:04 +00:00
else if ( var - > flags & ( CVAR_RENDERERLATCH | CVAR_VIDEOLATCH ) )
2009-12-29 14:00:56 +00:00
Con_Printf ( " Warning: %s requires a vid_restart \n " , var - > name ) ;
2018-08-09 06:21:39 +00:00
}
2011-06-18 05:41:10 +00:00
# endif
2006-03-06 01:41:09 +00:00
2004-08-23 00:15:46 +00:00
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2019-09-04 07:59:40 +00:00
menuframe_t * MC_AddFrameStart ( emenu_t * menu , int y )
2019-01-13 16:51:50 +00:00
{
menuframe_t * n = Z_Malloc ( sizeof ( menuframe_t ) ) ;
n - > common . type = mt_framestart ;
n - > common . iszone = true ;
n - > common . posx = 0 ;
n - > common . posy = y ;
n - > common . height = 0 ;
n - > common . width = 0 ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2019-09-04 07:59:40 +00:00
menuframe_t * MC_AddFrameEnd ( emenu_t * menu , int y )
2019-01-13 16:51:50 +00:00
{
menuframe_t * n = Z_Malloc ( sizeof ( menuframe_t ) ) ;
n - > common . type = mt_frameend ;
n - > common . iszone = true ;
n - > common . posx = 0 ;
n - > common . posy = y ;
n - > common . height = 0 ;
n - > common . width = 0 ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2019-09-04 07:59:40 +00:00
menucheck_t * MC_AddCheckBoxFunc ( emenu_t * menu , int tx , int cx , int y , const char * text , qboolean ( * func ) ( menucheck_t * option , emenu_t * menu , chk_set_t set ) , int bits )
2006-02-28 00:46:04 +00:00
{
menucheck_t * n = Z_Malloc ( sizeof ( menucheck_t ) + strlen ( text ) + 1 ) ;
n - > common . type = mt_checkbox ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2013-10-29 17:38:22 +00:00
n - > common . posx = tx ;
2006-02-28 00:46:04 +00:00
n - > common . posy = y ;
n - > common . height = 8 ;
2013-10-29 17:38:22 +00:00
n - > textwidth = cx - tx ;
n - > common . width = cx - tx + 7 * 8 ;
2006-02-28 00:46:04 +00:00
n - > text = ( char * ) ( n + 1 ) ;
strcpy ( ( char * ) ( n + 1 ) , text ) ;
n - > func = func ;
n - > bits = bits ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2007-05-25 22:16:29 +00:00
//delta may be 0
2019-09-04 07:59:40 +00:00
menuslider_t * MC_AddSlider ( emenu_t * menu , int tx , int sx , int y , const char * text , cvar_t * var , float min , float max , float delta )
2010-01-15 05:35:27 +00:00
{
2004-08-23 00:15:46 +00:00
menuslider_t * n = Z_Malloc ( sizeof ( menuslider_t ) + strlen ( text ) + 1 ) ;
n - > common . type = mt_slider ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2013-10-29 17:38:22 +00:00
n - > common . posx = tx ;
2004-08-23 00:15:46 +00:00
n - > common . posy = y ;
n - > common . height = 8 ;
2013-10-29 17:38:22 +00:00
n - > common . width = sx - tx + ( SLIDER_RANGE + 5 ) * 8 ;
2010-07-11 02:22:39 +00:00
n - > common . tooltip = var - > description ;
2004-08-23 00:15:46 +00:00
n - > var = var ;
2013-10-29 17:38:22 +00:00
n - > textwidth = sx - tx ;
2004-08-23 00:15:46 +00:00
n - > text = ( char * ) ( n + 1 ) ;
strcpy ( ( char * ) ( n + 1 ) , text ) ;
if ( var )
2006-03-06 01:41:09 +00:00
{
2004-08-23 00:15:46 +00:00
n - > current = var - > value ;
2010-01-15 05:35:27 +00:00
# ifdef _DEBUG
2006-03-06 01:41:09 +00:00
if ( ! ( var - > flags & CVAR_ARCHIVE ) )
Con_Printf ( " Warning: %s is not set for archiving \n " , var - > name ) ;
2010-01-15 05:35:27 +00:00
# endif
2006-03-06 01:41:09 +00:00
}
2004-08-23 00:15:46 +00:00
n - > min = min ;
n - > max = max ;
2007-05-25 22:16:29 +00:00
n - > smallchange = delta ;
n - > largechange = delta * 5 ;
2004-08-23 00:15:46 +00:00
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2019-09-04 07:59:40 +00:00
menucombo_t * MC_AddCombo ( emenu_t * menu , int tx , int cx , int y , const char * caption , const char * * ops , int initialvalue )
2004-08-23 00:15:46 +00:00
{
2007-01-08 03:13:03 +00:00
int numopts ;
int optlen ;
int maxoptlen ;
int optbufsize ;
menucombo_t * n ;
char * * newops ;
char * optbuf ;
2023-05-27 17:00:32 +00:00
const char * o ;
2007-01-08 03:13:03 +00:00
int i ;
maxoptlen = 0 ;
optbufsize = sizeof ( char * ) ;
numopts = 0 ;
optlen = 0 ;
2023-01-09 05:12:59 +00:00
if ( ops ) while ( ops [ numopts ] )
2007-01-08 03:13:03 +00:00
{
2023-05-27 17:00:32 +00:00
o = localtext ( ops [ numopts ] ) ;
optlen = strlen ( o ) ;
2007-01-08 03:13:03 +00:00
if ( maxoptlen < optlen )
maxoptlen = optlen ;
optbufsize + = optlen + 1 + sizeof ( char * ) ;
numopts + + ;
}
2010-01-15 05:35:27 +00:00
2007-01-08 03:13:03 +00:00
n = Z_Malloc ( sizeof ( * n ) + optbufsize ) ;
newops = ( char * * ) ( n + 1 ) ;
optbuf = ( char * ) ( newops + numopts + 1 ) ;
2004-08-23 00:15:46 +00:00
n - > common . type = mt_combo ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2013-10-29 17:38:22 +00:00
n - > common . posx = tx ;
2010-01-15 05:35:27 +00:00
n - > common . posy = y ;
2004-08-23 00:15:46 +00:00
n - > common . height = 8 ;
2013-10-29 17:38:22 +00:00
n - > common . width = cx - tx + maxoptlen * 8 ;
n - > captionwidth = cx - tx ;
2004-08-23 00:15:46 +00:00
n - > caption = caption ;
2007-08-20 02:13:51 +00:00
n - > options = ( const char * * ) newops ;
2004-08-23 00:15:46 +00:00
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
2007-01-08 03:13:03 +00:00
n - > numoptions = numopts ;
for ( i = 0 ; i < numopts ; i + + )
2004-08-23 00:15:46 +00:00
{
2023-05-27 17:00:32 +00:00
o = localtext ( ops [ i ] ) ;
strcpy ( optbuf , o ) ;
2007-01-08 03:13:03 +00:00
newops [ i ] = optbuf ;
optbuf + = strlen ( optbuf ) + 1 ;
2004-08-23 00:15:46 +00:00
}
2007-01-08 03:13:03 +00:00
newops [ i ] = NULL ;
2004-08-23 00:15:46 +00:00
2019-04-16 22:40:05 +00:00
if ( initialvalue & & initialvalue > = n - > numoptions )
2004-08-23 00:15:46 +00:00
{
Con_Printf ( " WARNING: Fixed initialvalue for %s \n " , caption ) ;
initialvalue = n - > numoptions - 1 ;
}
n - > selectedoption = initialvalue ;
return n ;
}
2019-09-04 07:59:40 +00:00
menucombo_t * MC_AddCvarCombo ( emenu_t * menu , int tx , int cx , int y , const char * caption , cvar_t * cvar , const char * * ops , const char * * values )
2004-08-23 00:15:46 +00:00
{
2007-01-08 03:13:03 +00:00
int numopts ;
int optlen ;
int maxoptlen ;
int optbufsize ;
menucombo_t * n ;
char * * newops ;
char * * newvalues ;
char * optbuf ;
2023-05-27 17:00:32 +00:00
const char * v , * o ;
2007-01-08 03:13:03 +00:00
int i ;
maxoptlen = 0 ;
optbufsize = sizeof ( char * ) * 2 + strlen ( caption ) + 1 ;
optlen = 0 ;
2021-04-14 05:21:04 +00:00
for ( i = 0 ; ops [ i ] ; i + + )
2007-01-08 03:13:03 +00:00
{
2021-04-14 05:21:04 +00:00
v = values ? values [ i ] : va ( " %i " , i ) ;
2023-05-27 17:00:32 +00:00
o = localtext ( ops [ i ] ) ;
2021-04-14 05:21:04 +00:00
2023-05-27 17:00:32 +00:00
optlen = strlen ( o ) ;
2007-01-08 03:13:03 +00:00
if ( maxoptlen < optlen )
maxoptlen = optlen ;
optbufsize + = optlen + 1 + sizeof ( char * ) ;
2021-04-14 05:21:04 +00:00
optbufsize + = strlen ( v ) + 1 + sizeof ( char * ) ;
2007-01-08 03:13:03 +00:00
}
2021-04-14 05:21:04 +00:00
numopts = i ;
2010-01-15 05:35:27 +00:00
2007-01-08 03:13:03 +00:00
n = Z_Malloc ( sizeof ( * n ) + optbufsize ) ;
newops = ( char * * ) ( n + 1 ) ;
newvalues = ( char * * ) ( newops + numopts + 1 ) ;
optbuf = ( char * ) ( newvalues + numopts + 1 ) ;
2004-08-23 00:15:46 +00:00
n - > common . type = mt_combo ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2013-10-29 17:38:22 +00:00
n - > common . posx = tx ;
2010-01-15 05:35:27 +00:00
n - > common . posy = y ;
2004-08-23 00:15:46 +00:00
n - > common . height = 8 ;
2013-10-29 17:38:22 +00:00
n - > common . width = cx - tx + maxoptlen * 8 ;
2023-05-27 17:00:32 +00:00
n - > common . tooltip = localtext ( cvar - > description ) ;
2013-10-29 17:38:22 +00:00
n - > captionwidth = cx - tx ;
2007-01-08 03:13:03 +00:00
strcpy ( optbuf , caption ) ;
n - > caption = optbuf ;
optbuf + = strlen ( optbuf ) + 1 ;
2019-09-04 07:59:40 +00:00
n - > options = ( char const * const * ) newops ;
n - > values = ( char const * const * ) newvalues ;
2004-08-23 00:15:46 +00:00
n - > cvar = cvar ;
2007-01-08 03:13:03 +00:00
// if (!(cvar->flags & CVAR_ARCHIVE))
// Con_Printf("Warning: %s is not set for archiving\n", cvar->name);
2006-03-06 01:41:09 +00:00
2004-08-23 00:15:46 +00:00
n - > selectedoption = 0 ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
2007-01-08 03:13:03 +00:00
n - > numoptions = numopts ;
for ( i = 0 ; i < numopts ; i + + )
2004-08-23 00:15:46 +00:00
{
2021-04-14 05:21:04 +00:00
v = values ? values [ i ] : va ( " %i " , i ) ;
2023-05-27 17:00:32 +00:00
o = localtext ( ops [ i ] ) ;
2021-04-14 05:21:04 +00:00
if ( ! strcmp ( v , cvar - > string ) )
2007-01-08 03:13:03 +00:00
n - > selectedoption = i ;
2023-05-27 17:00:32 +00:00
strcpy ( optbuf , o ) ;
2007-01-08 03:13:03 +00:00
newops [ i ] = optbuf ;
optbuf + = strlen ( optbuf ) + 1 ;
2021-04-14 05:21:04 +00:00
strcpy ( optbuf , v ) ;
2007-01-08 03:13:03 +00:00
newvalues [ i ] = optbuf ;
optbuf + = strlen ( optbuf ) + 1 ;
2004-08-23 00:15:46 +00:00
}
2007-01-08 03:13:03 +00:00
newops [ i ] = NULL ;
newvalues [ i ] = NULL ;
2004-08-23 00:15:46 +00:00
return n ;
}
2019-09-04 07:59:40 +00:00
menubutton_t * MC_AddConsoleCommand ( emenu_t * menu , int lhs , int rhs , int y , const char * text , const char * command )
2004-08-23 00:15:46 +00:00
{
menubutton_t * n = Z_Malloc ( sizeof ( menubutton_t ) + strlen ( text ) + 1 + strlen ( command ) + 1 ) ;
n - > common . type = mt_button ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2014-03-30 08:55:06 +00:00
n - > common . posx = lhs ;
2004-08-23 00:15:46 +00:00
n - > common . posy = y ;
n - > common . height = 8 ;
2014-03-30 08:55:06 +00:00
n - > common . width = rhs ? rhs - lhs : strlen ( text ) * 8 ;
2015-01-21 18:18:37 +00:00
n - > rightalign = true ;
2004-08-23 00:15:46 +00:00
n - > text = ( char * ) ( n + 1 ) ;
strcpy ( ( char * ) ( n + 1 ) , text ) ;
n - > command = n - > text + strlen ( n - > text ) + 1 ;
strcpy ( ( char * ) n - > command , command ) ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2006-03-06 01:41:09 +00:00
2019-09-04 07:59:40 +00:00
menubutton_t * MC_AddConsoleCommandQBigFont ( emenu_t * menu , int x , int y , const char * text , const char * command )
2004-08-23 00:15:46 +00:00
{
menubutton_t * n = Z_Malloc ( sizeof ( menubutton_t ) + strlen ( text ) + 1 + strlen ( command ) + 1 ) ;
2006-03-06 01:41:09 +00:00
n - > common . type = mt_qbuttonbigfont ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2006-03-06 01:41:09 +00:00
n - > common . posx = x ;
n - > common . posy = y ;
n - > common . height = 20 ;
n - > common . width = strlen ( text ) * 20 ;
n - > text = ( char * ) ( n + 1 ) ;
strcpy ( ( char * ) ( n + 1 ) , text ) ;
n - > command = n - > text + strlen ( n - > text ) + 1 ;
strcpy ( ( char * ) n - > command , command ) ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2014-10-11 22:16:40 +00:00
# ifdef HEXEN2
2019-09-04 07:59:40 +00:00
menubutton_t * MC_AddConsoleCommandHexen2BigFont ( emenu_t * menu , int x , int y , const char * text , const char * command )
2006-03-06 01:41:09 +00:00
{
menubutton_t * n = Z_Malloc ( sizeof ( menubutton_t ) + strlen ( text ) + 1 + strlen ( command ) + 1 ) ;
n - > common . type = mt_hexen2buttonbigfont ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2004-08-23 00:15:46 +00:00
n - > common . posx = x ;
n - > common . posy = y ;
2010-08-28 17:14:38 +00:00
n - > common . height = 20 ;
n - > common . width = strlen ( text ) * 20 ;
2004-08-23 00:15:46 +00:00
n - > text = ( char * ) ( n + 1 ) ;
strcpy ( ( char * ) ( n + 1 ) , text ) ;
n - > command = n - > text + strlen ( n - > text ) + 1 ;
strcpy ( ( char * ) n - > command , command ) ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2014-10-11 22:16:40 +00:00
# endif
2023-05-27 17:00:32 +00:00
menubutton_t * MC_AddCommand ( emenu_t * menu , int lhs , int rhs , int y , const char * text , qboolean ( * command ) ( union menuoption_s * , struct emenu_s * , int ) )
2004-08-23 00:15:46 +00:00
{
2023-05-27 17:00:32 +00:00
menubutton_t * n = Z_Malloc ( sizeof ( menubutton_t ) + strlen ( text ) + 1 ) ;
2004-08-23 00:15:46 +00:00
n - > common . type = mt_button ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2014-03-30 08:55:06 +00:00
n - > common . posx = lhs ;
2004-08-23 00:15:46 +00:00
n - > common . posy = y ;
2015-01-21 18:18:37 +00:00
n - > rightalign = true ;
2023-05-27 17:00:32 +00:00
n - > text = strcpy ( ( char * ) ( n + 1 ) , text ) ;
2004-08-23 00:15:46 +00:00
n - > command = NULL ;
n - > key = command ;
2006-01-28 06:41:20 +00:00
n - > common . height = 8 ;
2014-03-30 08:55:06 +00:00
n - > common . width = rhs ? rhs - lhs : strlen ( text ) * 8 ;
2004-08-23 00:15:46 +00:00
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
2019-09-04 07:59:40 +00:00
menubutton_t * VARGS MC_AddConsoleCommandf ( emenu_t * menu , int lhs , int rhs , int y , int rightalign , const char * text , char * command , . . . )
2004-08-23 00:15:46 +00:00
{
va_list argptr ;
static char string [ 1024 ] ;
menubutton_t * n ;
2010-01-15 05:35:27 +00:00
2004-08-23 00:15:46 +00:00
va_start ( argptr , command ) ;
2006-03-06 01:41:09 +00:00
vsnprintf ( string , sizeof ( string ) - 1 , command , argptr ) ;
2010-01-15 05:35:27 +00:00
va_end ( argptr ) ;
2004-08-23 00:15:46 +00:00
n = Z_Malloc ( sizeof ( menubutton_t ) + strlen ( string ) + 1 ) ;
n - > common . type = mt_button ;
2010-01-15 05:35:27 +00:00
n - > common . iszone = true ;
2014-03-30 08:55:06 +00:00
n - > common . posx = lhs ;
2004-08-23 00:15:46 +00:00
n - > common . posy = y ;
2014-03-30 08:55:06 +00:00
n - > common . width = rhs - lhs ;
2015-01-21 18:18:37 +00:00
n - > rightalign = rightalign ;
2010-01-15 05:35:27 +00:00
n - > text = text ;
2004-08-23 00:15:46 +00:00
n - > command = ( char * ) ( n + 1 ) ;
strcpy ( ( char * ) ( n + 1 ) , string ) ;
n - > common . next = menu - > options ;
menu - > options = ( menuoption_t * ) n ;
return n ;
}
void MC_Slider_Key ( menuslider_t * option , int key )
{
2007-05-25 22:16:29 +00:00
float range = option - > current ;
float delta ;
2013-07-26 17:19:06 +00:00
float ix = option - > vx ;
float ex = ix + 10 * 8 ;
2007-05-25 22:16:29 +00:00
if ( option - > smallchange )
delta = option - > smallchange ;
else
delta = 0.1 ;
2004-08-23 00:15:46 +00:00
2023-01-09 05:12:59 +00:00
if ( key = = K_LEFTARROW | | key = = K_KP_LEFTARROW | | key = = K_GP_DPAD_LEFT | | key = = K_GP_LEFT_THUMB_LEFT | | key = = K_GP_DIAMOND_CONFIRM | | key = = K_MWHEELDOWN )
2004-08-23 00:15:46 +00:00
{
2007-05-25 22:16:29 +00:00
range - = delta ;
2015-04-14 23:12:17 +00:00
if ( option - > min > option - > max )
range = bound ( option - > max , range , option - > min ) ;
else
range = bound ( option - > min , range , option - > max ) ;
2007-05-25 22:16:29 +00:00
option - > current = range ;
2004-08-23 00:15:46 +00:00
}
2023-01-09 05:12:59 +00:00
else if ( key = = K_RIGHTARROW | | key = = K_KP_RIGHTARROW | | key = = K_GP_DPAD_RIGHT | | key = = K_GP_LEFT_THUMB_RIGHT | | key = = K_GP_DIAMOND_ALTCONFIRM | | key = = K_MWHEELUP )
2004-08-23 00:15:46 +00:00
{
2007-05-25 22:16:29 +00:00
range + = delta ;
2015-04-14 23:12:17 +00:00
if ( option - > min > option - > max )
range = bound ( option - > max , range , option - > min ) ;
else
range = bound ( option - > min , range , option - > max ) ;
2007-05-25 22:16:29 +00:00
option - > current = range ;
2013-07-26 17:19:06 +00:00
}
2023-01-09 05:14:38 +00:00
else if ( ( key = = K_TOUCHTAP | | key = = K_MOUSE1 ) & & mousecursor_x > = ix - 8 & & mousecursor_x < ex + 8 )
2013-07-26 17:19:06 +00:00
{
range = ( mousecursor_x - ix ) / ( ex - ix ) ;
range = option - > min + range * ( option - > max - option - > min ) ;
2015-04-14 23:12:17 +00:00
if ( option - > min > option - > max )
range = bound ( option - > max , range , option - > min ) ;
else
range = bound ( option - > min , range , option - > max ) ;
2013-07-26 17:19:06 +00:00
option - > current = range ;
2004-08-23 00:15:46 +00:00
}
2023-01-09 05:14:38 +00:00
else if ( key = = K_ENTER | | key = = K_KP_ENTER | | key = = K_GP_START | | key = = K_MOUSE1 | | key = = K_TOUCHTAP )
2004-08-23 00:15:46 +00:00
{
2015-04-14 23:12:17 +00:00
if ( range = = option - > max )
2007-05-25 22:16:29 +00:00
range = option - > min ;
2015-04-14 23:12:17 +00:00
else
{
range + = delta ;
if ( option - > min > option - > max )
{
if ( range < option - > max - delta / 2 )
range = option - > max ;
}
else
if ( range > option - > max - delta / 2 )
range = option - > max ;
}
2007-05-25 22:16:29 +00:00
option - > current = range ;
2004-08-23 00:15:46 +00:00
}
2019-04-15 18:43:42 +00:00
else if ( key = = K_DEL | | key = = K_BACKSPACE )
{
if ( option - > var & & option - > var - > defaultstr )
option - > current = atof ( option - > var - > defaultstr ) ;
else
option - > current = ( option - > max - option - > min ) / 2 ;
}
2004-09-07 18:19:22 +00:00
else
return ;
2004-08-23 00:15:46 +00:00
2004-09-07 18:19:22 +00:00
S_LocalSound ( " misc/menu2.wav " ) ;
2013-07-26 17:19:06 +00:00
if ( option - > var )
Cvar_SetValue ( option - > var , option - > current ) ;
2004-08-23 00:15:46 +00:00
}
2019-09-04 07:59:40 +00:00
void MC_CheckBox_Key ( menucheck_t * option , emenu_t * menu , int key )
2004-08-23 00:15:46 +00:00
{
2023-05-27 17:00:32 +00:00
if ( key = = K_DEL & & option - > var & & ! option - > func )
Cvar_Set ( option - > var , option - > var - > defaultstr ) ;
2023-01-09 05:14:38 +00:00
if ( key ! = K_ENTER & & key ! = K_KP_ENTER & & key ! = K_GP_START & & key ! = K_GP_DIAMOND_CONFIRM & & key ! = K_GP_DIAMOND_ALTCONFIRM & & key ! = K_LEFTARROW & & key ! = K_KP_LEFTARROW & & key ! = K_GP_DPAD_LEFT & & key ! = K_GP_LEFT_THUMB_LEFT & & key ! = K_RIGHTARROW & & key ! = K_KP_LEFTARROW & & key ! = K_GP_DPAD_RIGHT & & key ! = K_GP_LEFT_THUMB_RIGHT & & key ! = K_MWHEELUP & & key ! = K_MWHEELDOWN & & key ! = K_MOUSE1 & & key ! = K_TOUCHTAP )
2004-08-23 00:15:46 +00:00
return ;
if ( option - > func )
2006-02-28 00:46:04 +00:00
option - > func ( option , menu , CHK_TOGGLE ) ;
2004-08-23 00:15:46 +00:00
else if ( ! option - > var )
option - > value = ! option - > value ;
else
2004-09-07 18:19:22 +00:00
{
2004-09-13 03:10:10 +00:00
if ( option - > bits )
{
int old ;
if ( option - > var - > latched_string )
old = atoi ( option - > var - > latched_string ) ;
else
old = option - > var - > value ;
if ( old & option - > bits )
Cvar_SetValue ( option - > var , old & ~ option - > bits ) ;
else
Cvar_SetValue ( option - > var , old | option - > bits ) ;
}
2004-09-07 23:15:19 +00:00
else
2004-09-13 03:10:10 +00:00
{
if ( option - > var - > latched_string )
Cvar_SetValue ( option - > var , ! atof ( option - > var - > latched_string ) ) ;
else
Cvar_SetValue ( option - > var , ! option - > var - > value ) ;
}
2004-09-07 18:19:22 +00:00
}
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
S_LocalSound ( " misc/menu2.wav " ) ;
2004-08-23 00:15:46 +00:00
}
2009-11-04 21:16:50 +00:00
void MC_EditBox_Key ( menuedit_t * edit , int key , unsigned int unicode )
2004-08-23 00:15:46 +00:00
{
int len = strlen ( edit - > text ) ;
if ( key = = K_DEL | | key = = K_BACKSPACE )
{
if ( ! len )
return ;
edit - > text [ len - 1 ] = ' \0 ' ;
}
2009-11-04 21:16:50 +00:00
else if ( ! unicode )
2004-08-23 00:15:46 +00:00
return ;
else
{
2009-11-04 21:16:50 +00:00
if ( unicode < 128 )
{
if ( len < sizeof ( edit - > text ) )
{
edit - > text [ len ] = unicode ;
edit - > text [ len + 1 ] = ' \0 ' ;
}
}
2004-08-23 00:15:46 +00:00
}
2005-02-12 18:56:04 +00:00
edit - > modified = true ;
2004-08-23 00:15:46 +00:00
if ( edit - > cvar )
2004-09-07 18:19:22 +00:00
{
2004-08-23 00:15:46 +00:00
Cvar_Set ( edit - > cvar , edit - > text ) ;
2004-09-07 18:19:22 +00:00
S_LocalSound ( " misc/menu2.wav " ) ;
}
2004-08-23 00:15:46 +00:00
}
void MC_Combo_Key ( menucombo_t * combo , int key )
{
2023-05-27 17:00:32 +00:00
if ( key = = K_DEL & & combo - > cvar )
Cvar_Set ( combo - > cvar , combo - > cvar - > defaultstr ) ;
else if ( key = = K_ENTER | | key = = K_KP_ENTER | | key = = K_GP_START | | key = = K_RIGHTARROW | | key = = K_KP_RIGHTARROW | | key = = K_GP_DPAD_RIGHT | | key = = K_GP_LEFT_THUMB_RIGHT | | key = = K_GP_DIAMOND_ALTCONFIRM | | key = = K_MWHEELDOWN | | key = = K_MOUSE1 | | key = = K_TOUCHTAP )
2004-08-23 00:15:46 +00:00
{
combo - > selectedoption + + ;
if ( combo - > selectedoption > = combo - > numoptions )
combo - > selectedoption = 0 ;
changed :
2007-01-08 03:13:03 +00:00
if ( combo - > cvar & & combo - > numoptions )
2004-08-23 00:15:46 +00:00
Cvar_Set ( combo - > cvar , ( char * ) combo - > values [ combo - > selectedoption ] ) ;
2013-07-26 17:19:06 +00:00
S_LocalSound ( " misc/menu2.wav " ) ;
2004-08-23 00:15:46 +00:00
}
2023-01-09 05:12:59 +00:00
else if ( key = = K_LEFTARROW | | key = = K_KP_LEFTARROW | | key = = K_GP_DPAD_LEFT | | key = = K_GP_LEFT_THUMB_LEFT | | key = = K_GP_DIAMOND_CONFIRM | | key = = K_MWHEELUP )
2004-08-23 00:15:46 +00:00
{
combo - > selectedoption - - ;
if ( combo - > selectedoption < 0 )
2019-04-16 22:40:05 +00:00
combo - > selectedoption = combo - > numoptions ? combo - > numoptions - 1 : 0 ;
2004-08-23 00:15:46 +00:00
goto changed ;
}
}
2019-09-04 07:59:40 +00:00
static qboolean menu_mousedown ;
2020-05-14 15:50:26 +00:00
extern emenu_t * menu_script ;
2019-09-04 07:59:40 +00:00
static void M_Draw ( menu_t * menu )
2004-08-23 00:15:46 +00:00
{
2019-09-04 07:59:40 +00:00
emenu_t * m = ( emenu_t * ) menu ;
qboolean stillactive = false ;
2004-08-23 00:15:46 +00:00
2019-09-04 07:59:40 +00:00
if ( ! Key_Dest_Has ( kdm_menu ) )
{
M_RemoveAllMenus ( false ) ;
menu_mousedown = false ;
return ;
}
2021-12-20 10:06:43 +00:00
if ( ! vrui . enabled & & ( ! menu_script | | scr_con_current ) )
2019-09-04 07:59:40 +00:00
{
2021-04-14 05:21:04 +00:00
if ( m - > nobacktint | | ( m - > selecteditem & & m - > selecteditem - > common . type = = mt_slider & & ( m - > selecteditem - > slider . var = = & v_gamma | | m - > selecteditem - > slider . var = = & v_contrast ) ) )
2019-09-04 07:59:40 +00:00
/*no menu tint if we're trying to adjust gamma*/ ;
else
R2D_FadeScreen ( ) ;
}
2004-08-23 00:15:46 +00:00
2019-09-04 07:59:40 +00:00
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ;
2004-08-23 00:15:46 +00:00
2019-09-04 07:59:40 +00:00
if ( m )
{
M_CheckMouseMove ( m ) ;
2012-04-24 07:59:11 +00:00
2019-09-04 07:59:40 +00:00
MenuDraw ( m ) ;
stillactive = true ;
}
2012-04-24 07:59:11 +00:00
2019-09-04 07:59:40 +00:00
if ( ! stillactive )
Key_Dest_Remove ( kdm_menu ) ;
2012-04-24 07:59:11 +00:00
}
2019-09-04 07:59:40 +00:00
static qboolean M_KeyEvent ( menu_t * m , qboolean isdown , unsigned int devid , int key , int unicode )
2004-08-23 00:15:46 +00:00
{
2019-09-04 07:59:40 +00:00
emenu_t * menu = ( emenu_t * ) m ;
if ( isdown )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
{
2023-01-09 05:14:38 +00:00
if ( key = = K_MOUSE1 | | key = = K_TOUCHTAP ) //mouse clicks are deferred until the release event. this is for touch screens and aiming.
2019-09-04 07:59:40 +00:00
{
2023-08-16 04:17:26 +00:00
if ( menu - > mouseitem & & menu - > selecteditem ! = menu - > mouseitem )
{
menu - > selecteditem = menu - > mouseitem ;
# ifdef HEXEN2
if ( M_GameType ( ) = = MGT_HEXEN2 )
S_LocalSound ( " raven/menu1.wav " ) ;
else
# endif
S_LocalSound ( " misc/menu1.wav " ) ;
if ( menu - > cursoritem )
menu - > cursoritem - > common . posy = menu - > selecteditem - > common . posy + ( menu - > selecteditem - > common . height - menu - > cursoritem - > common . height ) / 2 ;
}
2019-09-04 07:59:40 +00:00
if ( menu - > mouseitem & & menu - > mouseitem - > common . type = = mt_frameend )
menu - > mouseitem - > frame . mousedown = true ;
else
menu_mousedown = true ;
}
else if ( key = = K_LSHIFT | | key = = K_RSHIFT | | key = = K_LALT | | key = = K_RALT | | key = = K_LCTRL | | key = = K_RCTRL )
; //modifiers are sent on up events instead.
else
M_Complex_Key ( menu , key , unicode ) ;
return true ; //eat all keys...
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
}
2004-08-23 00:15:46 +00:00
else
{
2023-01-09 05:14:38 +00:00
if ( ( key = = K_MOUSE1 | | key = = K_TOUCHTAP ) & & menu_mousedown )
2019-09-04 07:59:40 +00:00
M_Complex_Key ( menu , key , unicode ) ;
else if ( key = = K_LSHIFT | | key = = K_RSHIFT | | key = = K_LALT | | key = = K_RALT | | key = = K_LCTRL | | key = = K_RCTRL )
M_Complex_Key ( menu , key , unicode ) ;
menu_mousedown = false ;
return false ;
2004-08-23 00:15:46 +00:00
}
}
2019-09-04 07:59:40 +00:00
2021-07-01 21:05:45 +00:00
void M_Release ( menu_t * m , qboolean forced )
2010-01-15 05:35:27 +00:00
{
2019-09-04 07:59:40 +00:00
emenu_t * menu = ( emenu_t * ) m ;
2004-08-23 00:15:46 +00:00
menuoption_t * op , * oop ;
2014-08-17 03:18:43 +00:00
if ( menu - > reselection )
{
menu - > reselection - > x = menu - > selecteditem - > common . posx ;
menu - > reselection - > y = menu - > selecteditem - > common . posy ;
}
2004-08-23 00:15:46 +00:00
if ( menu - > remove )
menu - > remove ( menu ) ;
op = menu - > options ;
while ( op )
{
oop = op ;
op = op - > common . next ;
if ( oop - > common . iszone )
Z_Free ( oop ) ;
}
menu - > options = NULL ;
2009-04-19 10:50:31 +00:00
if ( menu - > tooltip )
2012-04-24 07:59:11 +00:00
{
2009-04-19 10:50:31 +00:00
Z_Free ( menu - > tooltip ) ;
2012-04-24 07:59:11 +00:00
menu - > tooltip = NULL ;
}
2009-04-19 10:50:31 +00:00
2004-08-23 00:15:46 +00:00
if ( menu - > iszone )
{
menu - > iszone = false ;
Z_Free ( menu ) ;
}
}
2019-09-04 07:59:40 +00:00
emenu_t * M_CreateMenu ( int extrasize )
{
emenu_t * menu ;
menu = Z_Malloc ( sizeof ( emenu_t ) + extrasize ) ;
menu - > iszone = true ;
menu - > data = menu + 1 ;
menu - > menu . cursor = & key_customcursor [ kc_console ] ;
/*void (*videoreset) (struct menu_s *); //called after a video mode switch / shader reload.
void ( * release ) ( struct menu_s * ) ; //
qboolean ( * keyevent ) ( struct menu_s * , qboolean isdown , unsigned int devid , int key , int unicode ) ; //true if key was handled
qboolean ( * mousemove ) ( struct menu_s * , qboolean abs , unsigned int devid , float x , float y ) ;
qboolean ( * joyaxis ) ( struct menu_s * , unsigned int devid , int axis , float val ) ;
void ( * drawmenu ) ( struct menu_s * ) ;
*/
menu - > menu . drawmenu = M_Draw ;
menu - > menu . keyevent = M_KeyEvent ;
menu - > menu . release = M_Release ;
Menu_Push ( & menu - > menu , false ) ;
return menu ;
}
void M_RemoveMenu ( emenu_t * menu )
{
2021-07-01 21:05:45 +00:00
Menu_Unlink ( ( menu_t * ) menu , false ) ;
2019-09-04 07:59:40 +00:00
}
2016-07-12 00:40:13 +00:00
void M_ReloadMenus ( void )
{
menu_t * m ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
for ( m = topmenu ; m ; m = m - > prev )
2016-07-12 00:40:13 +00:00
{
2019-09-04 07:59:40 +00:00
if ( m - > videoreset )
m - > videoreset ( m ) ;
2016-07-12 00:40:13 +00:00
}
}
2015-07-14 14:47:00 +00:00
void M_RemoveAllMenus ( qboolean leaveprompts )
2021-07-01 21:05:45 +00:00
{ //certain menuqc mods are evil and force themselves open again each time we ask them to close, which means we get into an infinite loop trying to ask them to kindly fuck off.
//so only kill the current ones.
menu_t * * list , * m ;
int count = 0 ;
for ( m = topmenu ; m ; m = m - > prev )
count + + ;
list = BZ_Malloc ( count * sizeof ( list ) ) ;
2004-08-23 00:15:46 +00:00
2021-07-01 21:05:45 +00:00
for ( count = 0 , m = topmenu ; m ; m = m - > prev )
2015-07-14 14:47:00 +00:00
{
2019-09-04 07:59:40 +00:00
if ( m - > persist & & leaveprompts )
2021-07-01 21:05:45 +00:00
continue ;
list [ count + + ] = m ;
2015-07-14 14:47:00 +00:00
}
2021-07-01 21:05:45 +00:00
while ( count - - > 0 )
Menu_Unlink ( list [ count ] , true ) ;
BZ_Free ( list ) ;
2004-08-23 00:15:46 +00:00
}
2012-04-24 07:59:11 +00:00
void M_MenuPop_f ( void )
{
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( ! topmenu )
2012-04-24 07:59:11 +00:00
return ;
2021-07-01 21:05:45 +00:00
Menu_Unlink ( topmenu , false ) ;
2012-04-24 07:59:11 +00:00
}
2004-08-23 00:15:46 +00:00
2021-09-07 23:43:25 +00:00
menubutton_t * M_FindButton ( emenu_t * menu , const char * command )
{
menuoption_t * o ;
for ( o = menu - > options ; o ; o = o - > common . next )
{
if ( ( o - > common . type = = mt_button
| | o - > common . type = = mt_qbuttonbigfont
| | o - > common . type = = mt_hexen2buttonbigfont )
& & ! strcmp ( o - > button . command , command ) )
return ( menubutton_t * ) o ;
}
return NULL ;
}
2021-04-14 05:21:04 +00:00
static menuoption_t * M_NextItem ( emenu_t * m , menuoption_t * old )
2004-08-23 00:15:46 +00:00
{
menuoption_t * op = m - > options ;
while ( op - > common . next )
{
if ( op - > common . next = = old )
return op ;
op = op - > common . next ;
}
return op ;
}
2021-08-09 23:06:28 +00:00
menuoption_t * M_NextSelectableItem ( emenu_t * m , menuoption_t * old , qboolean wrap )
2004-08-23 00:15:46 +00:00
{
menuoption_t * op ;
2021-04-14 05:21:04 +00:00
if ( ! m - > options )
return NULL ; //erk!
2004-08-23 00:15:46 +00:00
if ( ! old )
old = M_NextItem ( m , old ) ;
2010-01-15 05:35:27 +00:00
2004-08-23 00:15:46 +00:00
op = old ;
while ( 1 )
{
if ( ! op )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
op = m - > options ;
2004-08-23 00:15:46 +00:00
2021-08-09 23:06:28 +00:00
if ( op = = m - > options & & ! wrap )
return NULL ;
2004-08-23 00:15:46 +00:00
op = M_NextItem ( m , op ) ;
if ( ! op )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
op = m - > options ;
2004-08-23 00:15:46 +00:00
if ( op = = old )
{
2010-08-12 00:48:05 +00:00
if ( op - > common . type = = mt_slider | | op - > common . type = = mt_checkbox | | op - > common . type = = mt_button | | op - > common . type = = mt_hexen2buttonbigfont | | op - > common . type = = mt_qbuttonbigfont | | op - > common . type = = mt_edit | | op - > common . type = = mt_combo | | op - > common . type = = mt_bind | | ( op - > common . type = = mt_custom & & op - > custom . key ) )
2004-08-23 00:15:46 +00:00
return op ;
return NULL ; //whoops.
}
2010-08-12 00:48:05 +00:00
if ( op - > common . type = = mt_slider | | op - > common . type = = mt_checkbox | | op - > common . type = = mt_button | | op - > common . type = = mt_hexen2buttonbigfont | | op - > common . type = = mt_qbuttonbigfont | | op - > common . type = = mt_edit | | op - > common . type = = mt_combo | | op - > common . type = = mt_bind | | ( op - > common . type = = mt_custom & & op - > custom . key ) )
2005-01-26 18:56:49 +00:00
if ( ! op - > common . ishidden )
return op ;
2004-08-23 00:15:46 +00:00
}
}
2021-08-09 23:06:28 +00:00
menuoption_t * M_PrevSelectableItem ( emenu_t * m , menuoption_t * old , qboolean wrap )
2004-08-23 00:15:46 +00:00
{
2010-01-15 05:35:27 +00:00
menuoption_t * op ;
2004-08-23 00:15:46 +00:00
2021-04-14 05:21:04 +00:00
if ( ! m - > options )
return NULL ; //erk!
2004-08-23 00:15:46 +00:00
if ( ! old )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
old = m - > options ;
2010-01-15 05:35:27 +00:00
2004-08-23 00:15:46 +00:00
op = old ;
while ( 1 )
{
if ( ! op )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
op = m - > options ;
2004-08-23 00:15:46 +00:00
op = op - > common . next ;
if ( ! op )
2021-08-09 23:06:28 +00:00
{
if ( ! wrap )
return NULL ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
op = m - > options ;
2021-08-09 23:06:28 +00:00
}
2004-08-23 00:15:46 +00:00
if ( op = = old )
return old ; //whoops.
2010-08-12 00:48:05 +00:00
if ( op - > common . type = = mt_slider | | op - > common . type = = mt_checkbox | | op - > common . type = = mt_button | | op - > common . type = = mt_hexen2buttonbigfont | | op - > common . type = = mt_qbuttonbigfont | | op - > common . type = = mt_edit | | op - > common . type = = mt_combo | | op - > common . type = = mt_bind | | ( op - > common . type = = mt_custom & & op - > custom . key ) )
2005-01-26 18:56:49 +00:00
if ( ! op - > common . ishidden )
return op ;
2004-08-23 00:15:46 +00:00
}
}
2019-09-04 07:59:40 +00:00
void M_Complex_Key ( emenu_t * currentmenu , int key , int unicode )
2004-08-23 00:15:46 +00:00
{
2023-03-27 17:19:00 +00:00
menuoption_t * mi ;
2004-08-23 00:15:46 +00:00
if ( ! currentmenu )
return ; //erm...
2010-01-15 05:35:27 +00:00
2019-09-04 07:59:40 +00:00
M_CheckMouseMove ( currentmenu ) ;
2012-02-27 12:23:15 +00:00
2004-08-23 00:15:46 +00:00
if ( currentmenu - > key )
2023-03-27 17:19:00 +00:00
if ( currentmenu - > key ( currentmenu , key , unicode ) )
2004-08-23 00:15:46 +00:00
return ;
2023-01-09 05:12:59 +00:00
if ( currentmenu - > selecteditem & & currentmenu - > selecteditem - > common . type = = mt_custom & & ( key = = K_DOWNARROW | | key = = K_KP_DOWNARROW | | key = = K_GP_DPAD_DOWN | | key = = K_GP_LEFT_THUMB_DOWN | | key = = K_GP_DIAMOND_CONFIRM | | key = = K_GP_DIAMOND_ALTCONFIRM | | key = = K_UPARROW | | key = = K_KP_UPARROW | | key = = K_GP_DPAD_UP | | key = = K_GP_LEFT_THUMB_UP | | key = = K_TAB | | key = = K_MWHEELUP | | key = = K_MWHEELDOWN | | key = = K_PGUP | | key = = K_PGDN ) )
2006-02-11 18:06:54 +00:00
if ( currentmenu - > selecteditem - > custom . key )
2015-06-16 23:53:58 +00:00
if ( currentmenu - > selecteditem - > custom . key ( & currentmenu - > selecteditem - > custom , currentmenu , key , unicode ) )
2006-02-11 18:06:54 +00:00
return ;
2004-09-07 18:19:22 +00:00
if ( currentmenu - > selecteditem & & currentmenu - > selecteditem - > common . type = = mt_bind )
{
if ( bindingactive )
{
2013-03-12 23:09:25 +00:00
//don't let key 0 be bound here. unicode-only keys are also not bindable.
if ( key = = 0 )
return ;
2014-10-05 20:04:11 +00:00
# ifdef HEXEN2
2016-02-15 06:01:17 +00:00
if ( M_GameType ( ) = = MGT_HEXEN2 )
2010-01-16 04:59:13 +00:00
S_LocalSound ( " raven/menu1.wav " ) ;
else
2014-10-05 20:04:11 +00:00
# endif
2010-01-16 04:59:13 +00:00
S_LocalSound ( " misc/menu1.wav " ) ;
2004-09-07 18:19:22 +00:00
if ( key ! = K_ESCAPE & & key ! = ' ` ' )
{
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int modifiers = 0 ;
if ( keydown [ K_LSHIFT ] & & key ! = K_LSHIFT )
modifiers | = 1 ;
if ( keydown [ K_RSHIFT ] & & key ! = K_RSHIFT )
modifiers | = 1 ;
if ( keydown [ K_LALT ] & & key ! = K_LALT )
modifiers | = 2 ;
if ( keydown [ K_RALT ] & & key ! = K_RALT )
modifiers | = 2 ;
if ( keydown [ K_LCTRL ] & & key ! = K_LCTRL )
modifiers | = 4 ;
if ( keydown [ K_RCTRL ] & & key ! = K_RCTRL )
modifiers | = 4 ;
Cbuf_InsertText ( va ( " bind \" %s \" \" %s \" \n " , Key_KeynumToString ( key , modifiers ) , currentmenu - > selecteditem - > bind . command ) , RESTRICT_LOCAL , false ) ;
2004-09-07 18:19:22 +00:00
}
bindingactive = false ;
return ;
}
}
2010-01-15 05:35:27 +00:00
2004-08-23 00:15:46 +00:00
switch ( key )
{
2022-05-28 17:59:01 +00:00
case K_MOUSE2 : //right
case K_MOUSE4 : //back
2004-08-23 00:15:46 +00:00
case K_ESCAPE :
2023-01-09 05:14:38 +00:00
case K_TOUCHLONG :
2017-08-16 02:14:07 +00:00
case K_GP_BACK :
2023-01-09 05:12:59 +00:00
case K_GP_START :
case K_GP_DIAMOND_CANCEL :
2004-08-23 00:15:46 +00:00
//remove
M_RemoveMenu ( currentmenu ) ;
2014-10-05 20:04:11 +00:00
# ifdef HEXEN2
2016-02-15 06:01:17 +00:00
if ( M_GameType ( ) = = MGT_HEXEN2 )
2010-01-16 04:59:13 +00:00
S_LocalSound ( " raven/menu3.wav " ) ;
else
2014-10-05 20:04:11 +00:00
# endif
2010-01-16 04:59:13 +00:00
S_LocalSound ( " misc/menu3.wav " ) ;
2004-08-23 00:15:46 +00:00
break ;
case K_TAB :
case K_DOWNARROW :
2017-08-16 02:14:07 +00:00
case K_KP_DOWNARROW :
case K_GP_DPAD_DOWN :
2023-01-09 05:12:59 +00:00
case K_GP_LEFT_THUMB_DOWN :
2020-09-08 05:11:09 +00:00
godown :
2021-08-09 23:06:28 +00:00
currentmenu - > selecteditem = M_NextSelectableItem ( currentmenu , currentmenu - > selecteditem , true ) ;
goto gone ;
2010-01-16 04:59:13 +00:00
2004-08-23 00:15:46 +00:00
case K_UPARROW :
2017-08-16 02:14:07 +00:00
case K_KP_UPARROW :
case K_GP_DPAD_UP :
2023-01-09 05:12:59 +00:00
case K_GP_LEFT_THUMB_UP :
2020-09-08 05:11:09 +00:00
goup :
2021-08-09 23:06:28 +00:00
currentmenu - > selecteditem = M_PrevSelectableItem ( currentmenu , currentmenu - > selecteditem , true ) ;
goto gone ;
case K_PGDN :
for ( key = 0 ; key < 10 ; key + + )
{
menuoption_t * op = M_NextSelectableItem ( currentmenu , currentmenu - > selecteditem , false ) ;
if ( op )
currentmenu - > selecteditem = op ;
else
break ;
}
goto gone ;
case K_PGUP :
for ( key = 0 ; key < 10 ; key + + )
{
menuoption_t * op = M_PrevSelectableItem ( currentmenu , currentmenu - > selecteditem , false ) ;
if ( op )
currentmenu - > selecteditem = op ;
else
break ;
}
goto gone ;
2004-08-23 00:15:46 +00:00
2021-08-09 23:06:28 +00:00
gone :
2010-01-15 05:35:27 +00:00
if ( currentmenu - > selecteditem )
2004-08-23 00:15:46 +00:00
{
2014-10-05 20:04:11 +00:00
# ifdef HEXEN2
2016-02-15 06:01:17 +00:00
if ( M_GameType ( ) = = MGT_HEXEN2 )
2010-01-16 04:59:13 +00:00
S_LocalSound ( " raven/menu1.wav " ) ;
else
2014-10-05 20:04:11 +00:00
# endif
2010-01-16 04:59:13 +00:00
S_LocalSound ( " misc/menu1.wav " ) ;
2004-08-23 00:15:46 +00:00
if ( currentmenu - > cursoritem )
2023-02-20 08:21:56 +00:00
currentmenu - > cursoritem - > common . posy = currentmenu - > selecteditem - > common . posy + ( currentmenu - > selecteditem - > common . height - currentmenu - > cursoritem - > common . height ) / 2 ;
2004-08-23 00:15:46 +00:00
}
break ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
2020-09-08 05:11:09 +00:00
case K_MWHEELUP :
case K_MWHEELDOWN :
2023-03-27 17:19:00 +00:00
mi = currentmenu - > mouseitem ;
if ( ! mi )
mi = currentmenu - > selecteditem ;
if ( mi )
2020-09-08 05:11:09 +00:00
{
qboolean handled = false ;
2023-03-27 17:19:00 +00:00
switch ( mi - > common . type )
2020-09-08 05:11:09 +00:00
{
case mt_combo :
2023-03-27 17:19:00 +00:00
if ( mousecursor_x > = currentmenu - > xpos + mi - > common . posx + mi - > combo . captionwidth + 3 * 8 )
2020-09-08 05:11:09 +00:00
{
2023-03-27 17:19:00 +00:00
MC_Combo_Key ( & mi - > combo , key ) ;
2020-09-08 05:11:09 +00:00
handled = true ;
}
break ;
case mt_checkbox :
2023-03-27 17:19:00 +00:00
if ( mousecursor_x > = currentmenu - > xpos + mi - > common . posx + mi - > check . textwidth + 3 * 8 )
2020-09-08 05:11:09 +00:00
{
2023-03-27 17:19:00 +00:00
MC_CheckBox_Key ( & mi - > check , currentmenu , key ) ;
2020-09-08 05:11:09 +00:00
handled = true ;
}
break ;
case mt_custom :
2023-03-27 17:19:00 +00:00
if ( mi - > custom . key )
handled = mi - > custom . key ( & mi - > custom , currentmenu , key , unicode ) ;
2020-09-08 05:11:09 +00:00
break ;
default :
break ;
}
if ( handled )
{
2023-03-27 17:19:00 +00:00
currentmenu - > selecteditem = mi ;
2020-09-08 05:11:09 +00:00
if ( currentmenu - > cursoritem )
2023-02-20 08:21:56 +00:00
currentmenu - > cursoritem - > common . posy = currentmenu - > selecteditem - > common . posy + ( currentmenu - > selecteditem - > common . height - currentmenu - > cursoritem - > common . height ) / 2 ;
2020-09-08 05:11:09 +00:00
break ;
}
else if ( key = = K_MWHEELUP )
goto goup ;
else goto godown ;
}
2023-01-09 05:14:38 +00:00
case K_TOUCHTAP :
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
case K_MOUSE1 :
case K_MOUSE3 :
case K_MOUSE5 :
case K_MOUSE6 :
case K_MOUSE7 :
case K_MOUSE8 :
case K_MOUSE9 :
case K_MOUSE10 :
if ( ! currentmenu - > mouseitem )
break ;
if ( currentmenu - > mouseitem & & currentmenu - > selecteditem ! = currentmenu - > mouseitem )
{
2023-08-16 04:17:26 +00:00
/* currentmenu->selecteditem = currentmenu->mouseitem;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
# ifdef HEXEN2
if ( M_GameType ( ) = = MGT_HEXEN2 )
S_LocalSound ( " raven/menu1.wav " ) ;
else
# endif
S_LocalSound ( " misc/menu1.wav " ) ;
if ( currentmenu - > cursoritem )
2023-02-20 08:21:56 +00:00
currentmenu - > cursoritem - > common . posy = currentmenu - > selecteditem - > common . posy + ( currentmenu - > selecteditem - > common . height - currentmenu - > cursoritem - > common . height ) / 2 ;
2023-08-16 04:17:26 +00:00
*/ break ; //require a double-click when selecting... too easy to miss, and a touble-tap at least makes it easier to clarify what you meant.
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
}
//fall through
2004-08-23 00:15:46 +00:00
default :
if ( ! currentmenu - > selecteditem )
{
if ( ! currentmenu - > options )
return ;
currentmenu - > selecteditem = currentmenu - > options ;
}
switch ( currentmenu - > selecteditem - > common . type )
{
case mt_slider :
MC_Slider_Key ( & currentmenu - > selecteditem - > slider , key ) ;
break ;
case mt_checkbox :
2006-02-28 00:46:04 +00:00
MC_CheckBox_Key ( & currentmenu - > selecteditem - > check , currentmenu , key ) ;
2004-08-23 00:15:46 +00:00
break ;
case mt_button :
2006-03-06 01:41:09 +00:00
case mt_hexen2buttonbigfont :
case mt_qbuttonbigfont :
2004-08-23 00:15:46 +00:00
if ( ! currentmenu - > selecteditem - > button . command )
currentmenu - > selecteditem - > button . key ( currentmenu - > selecteditem , currentmenu , key ) ;
2023-01-09 05:14:38 +00:00
else if ( key = = K_ENTER | | key = = K_KP_ENTER | | key = = K_GP_DIAMOND_CONFIRM | | key = = K_GP_DIAMOND_ALTCONFIRM | | key = = K_MOUSE1 | | key = = K_TOUCHTAP )
2004-09-07 18:19:22 +00:00
{
2004-08-23 00:15:46 +00:00
Cbuf_AddText ( currentmenu - > selecteditem - > button . command , RESTRICT_LOCAL ) ;
2014-10-05 20:04:11 +00:00
# ifdef HEXEN2
2016-02-15 06:01:17 +00:00
if ( M_GameType ( ) = = MGT_HEXEN2 )
2010-01-16 04:59:13 +00:00
S_LocalSound ( " raven/menu2.wav " ) ;
else
2014-10-05 20:04:11 +00:00
# endif
2010-01-16 04:59:13 +00:00
S_LocalSound ( " misc/menu2.wav " ) ;
2004-09-07 18:19:22 +00:00
}
2004-08-23 00:15:46 +00:00
break ;
case mt_custom :
2006-02-11 18:06:54 +00:00
if ( currentmenu - > selecteditem - > custom . key )
2015-06-16 23:53:58 +00:00
currentmenu - > selecteditem - > custom . key ( & currentmenu - > selecteditem - > custom , currentmenu , key , unicode ) ;
2004-08-23 00:15:46 +00:00
break ;
case mt_edit :
2009-11-04 21:16:50 +00:00
MC_EditBox_Key ( & currentmenu - > selecteditem - > edit , key , unicode ) ;
2004-08-23 00:15:46 +00:00
break ;
case mt_combo :
MC_Combo_Key ( & currentmenu - > selecteditem - > combo , key ) ;
break ;
2004-09-07 18:19:22 +00:00
case mt_bind :
2023-01-09 05:14:38 +00:00
if ( key = = K_ENTER | | key = = K_KP_ENTER | | key = = K_GP_DIAMOND_CONFIRM | | key = = K_MOUSE1 | | key = = K_TOUCHTAP )
2004-09-07 18:19:22 +00:00
bindingactive = true ;
2023-01-09 05:12:59 +00:00
else if ( key = = K_BACKSPACE | | key = = K_DEL | | key = = K_GP_DIAMOND_ALTCONFIRM )
2004-09-07 18:19:22 +00:00
M_UnbindCommand ( currentmenu - > selecteditem - > bind . command ) ;
2004-08-23 00:15:46 +00:00
default :
break ;
}
break ;
}
}
2023-03-27 17:19:00 +00:00
qboolean MC_Main_Key ( emenu_t * menu , int key , unsigned int unicode ) //here purly to restart demos.
2004-08-23 00:15:46 +00:00
{
2023-01-09 05:12:59 +00:00
if ( key = = K_ESCAPE | | key = = K_GP_BACK | | key = = K_GP_DIAMOND_CANCEL | | key = = K_MOUSE2 )
2004-08-23 00:15:46 +00:00
{
2016-02-15 06:01:17 +00:00
extern cvar_t con_stayhidden ;
2014-08-27 08:41:31 +00:00
//don't spam menu open+close events if we're not going to be allowing the console to appear
if ( con_stayhidden . ival & & cls . state = = ca_disconnected )
if ( ! CL_TryingToConnect ( ) )
2023-09-11 09:31:09 +00:00
{
extern cvar_t cl_demoreel ;
if ( cl_demoreel . ival )
{ //start a demo instead. this should probably be on a timer...
cls . demonum = MAX_DEMOS ;
CL_NextDemo ( ) ;
if ( cls . state )
return false ;
}
2014-08-27 08:41:31 +00:00
return true ;
2023-09-11 09:31:09 +00:00
}
2004-08-23 00:15:46 +00:00
}
return false ;
}
2019-09-04 07:59:40 +00:00
static int M_Main_AddExtraOptions ( emenu_t * mainm , int y )
2018-05-28 10:12:10 +00:00
{
if ( Cmd_AliasExist ( " mod_menu " , RESTRICT_LOCAL ) )
{ MC_AddConsoleCommandQBigFont ( mainm , 72 , y , va ( " %-14s " , Cvar_Get ( " mod_menu " , " Mod Menu " , 0 , NULL ) - > string ) , " mod_menu \n " ) ; y + = 20 ; }
if ( Cmd_Exists ( " xmpp " ) )
2023-05-27 17:00:32 +00:00
{ MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Social " ) , " xmpp \n " ) ; y + = 20 ; }
2018-05-28 10:12:10 +00:00
if ( Cmd_Exists ( " irc " ) )
2023-05-27 17:00:32 +00:00
{ MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " IRC " ) , " irc \n " ) ; y + = 20 ; }
2018-05-28 10:12:10 +00:00
if ( Cmd_Exists ( " qi " ) )
2023-05-27 17:00:32 +00:00
{ MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Quake Injector " ) , " qi \n " ) ; y + = 20 ; }
2018-06-06 09:09:14 +00:00
else if ( PM_CanInstall ( " qi " ) )
2023-05-27 17:00:32 +00:00
{ MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Get Quake Injector " ) , " pkg reset; pkg add qi; pkg apply \n " ) ; y + = 20 ; }
2018-05-28 10:12:10 +00:00
if ( Cmd_Exists ( " menu_download " ) )
2019-07-02 04:12:20 +00:00
{
# ifdef WEBCLIENT
2023-05-27 17:00:32 +00:00
MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " ^bUpdates " ) , " menu_download \n " ) ; y + = 20 ;
2019-07-02 04:12:20 +00:00
# else
2023-05-27 17:00:32 +00:00
MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " ^bPackages " ) , " menu_download \n " ) ; y + = 20 ;
2019-07-02 04:12:20 +00:00
# endif
2020-04-19 01:23:32 +00:00
}
if ( Cmd_Exists ( " menu_mods " ) )
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
{ MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Mods " ) , " menu_mods \n " ) ; y + = 20 ; }
if ( Cmd_Exists ( " sys_openfile " ) )
{ MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Open File " ) , " sys_openfile \n " ) ; y + = 20 ; }
# ifdef FTE_TARGET_WEB
if ( Cmd_Exists ( " xr_toggle " ) )
{ MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Toggle WebXR " ) , " xr_toggle \n " ) ; y + = 20 ; }
# endif
2018-05-28 10:12:10 +00:00
return y ;
}
2021-09-07 23:43:25 +00:00
void MC_Main_Predraw ( emenu_t * menu )
{
extern cvar_t m_preset_chosen ;
menubutton_t * b ;
b = M_FindButton ( menu , " menu_options \n " ) ;
if ( b & & b - > text [ 0 ] & & b - > text [ 1 ] )
{
qboolean flash =
# ifdef PACKAGEMANAGER
PM_AreSourcesNew ( false ) | |
# endif
! m_preset_chosen . ival ;
2023-05-27 17:00:32 +00:00
b - > text = ( char * ) ( b + 1 ) ;
if ( b - > text [ 0 ] = = ' ^ ' & & b - > text [ 1 ] = = ' b ' & & ! flash )
b - > text + = 2 ;
2021-09-07 23:43:25 +00:00
}
# ifdef PACKAGEMANAGER
b = M_FindButton ( menu , " menu_download \n " ) ;
if ( b & & b - > text [ 0 ] & & b - > text [ 1 ] )
{
qboolean flash = PM_AreSourcesNew ( false ) ;
2023-05-27 17:00:32 +00:00
b - > text = ( char * ) ( b + 1 ) ;
if ( b - > text [ 0 ] = = ' ^ ' & & b - > text [ 1 ] = = ' b ' & & ! flash )
b - > text + = 2 ;
2021-09-07 23:43:25 +00:00
}
# endif
}
2004-08-23 00:15:46 +00:00
void M_Menu_Main_f ( void )
{
extern cvar_t m_helpismedia ;
menubutton_t * b ;
2019-09-04 07:59:40 +00:00
emenu_t * mainm = NULL ;
2004-12-24 08:45:56 +00:00
mpic_t * p ;
2014-08-17 03:18:43 +00:00
static menuresel_t resel ;
2018-06-06 09:09:14 +00:00
int y ;
2004-08-23 00:15:46 +00:00
2018-08-23 06:03:31 +00:00
# ifndef SERVERONLY
if ( isDedicated | | ! Renderer_Started ( ) )
return ;
# endif
2013-03-12 22:53:23 +00:00
# ifdef CSQC_DAT
2017-11-16 22:20:40 +00:00
if ( CSQC_ConsoleCommand ( - 1 , va ( " %s %s " , Cmd_Argv ( 0 ) , Cmd_Args ( ) ) ) )
2013-03-12 22:53:23 +00:00
return ;
# endif
2015-06-18 22:11:30 +00:00
/* if (cls.demoplayback)
{
m_save_demonum = cls . demonum ;
cls . demonum = - 1 ;
}
*/
2004-08-23 00:15:46 +00:00
SCR_EndLoadingPlaque ( ) ; //just in case...
2023-04-21 11:36:13 +00:00
if ( ! FS_GameIsInitialised ( ) )
{ //if you canceled the mods menu, quit instead.
if ( ! Key_Dest_Has ( kdm_prompt ) & & ! Key_Dest_Has ( kdm_menu ) )
{
M_Menu_Mods_f ( ) ; //bring back the mods menu... THERE'S NO ESCAPE!!! (no basedir, so options etc is ponitless)
M_Menu_Quit_f ( ) ; //and a quit prompt, cos they probably hit escape or something.
}
return ;
}
2004-08-23 00:15:46 +00:00
/*
if ( 0 )
{
int x , i ;
guiinfo_t * gui ;
m_state = m_complex ;
key_dest = key_menu ;
m_entersound = true ;
mainm = M_CreateMenu ( sizeof ( guiinfo_t ) ) ;
mainm - > key = MC_GuiKey ;
mainm - > xpos = 0 ;
2010-01-15 05:35:27 +00:00
gui = ( guiinfo_t * ) mainm - > data ;
2004-08-23 00:15:46 +00:00
gui - > text [ 0 ] = " Single " ;
gui - > text [ 1 ] = " Multiplayer " ;
gui - > text [ 2 ] = " Quit " ;
for ( x = 0 , i = 0 ; gui - > text [ i ] ; i + + )
{
gui - > op [ i ] = MC_AddRedText ( mainm , x , 0 , gui - > text [ i ] , false ) ;
x + = ( strlen ( gui - > text [ i ] ) + 1 ) * 8 ;
2010-01-15 05:35:27 +00:00
}
2004-08-23 00:15:46 +00:00
return ;
}
*/
2006-01-01 09:01:15 +00:00
S_LocalSound ( " misc/menu2.wav " ) ;
2014-10-05 20:04:11 +00:00
# ifdef Q2CLIENT
2016-02-15 06:01:17 +00:00
if ( M_GameType ( ) = = MGT_QUAKE2 ) //quake2 main menu.
2004-08-23 00:15:46 +00:00
{
2014-10-05 20:04:11 +00:00
if ( R_GetShaderSizes ( R2D_SafeCachePic ( " pics/m_main_quit " ) , NULL , NULL , true ) > 0 )
2010-01-15 05:35:27 +00:00
{
2019-01-13 16:51:50 +00:00
int itemheight = 32 ;
2004-08-23 00:15:46 +00:00
2010-01-15 05:35:27 +00:00
mainm = M_CreateMenu ( 0 ) ;
mainm - > key = MC_Main_Key ;
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
MC_AddPicture ( mainm , 0 , 4 , 38 , 166 , " pics/m_main_plaque " ) ;
MC_AddPicture ( mainm , 0 , 173 , 36 , 42 , " pics/m_main_logo " ) ;
2021-10-22 22:27:58 +00:00
# if defined(HAVE_SERVER) && defined(Q2SERVER)
2019-01-13 16:51:50 +00:00
MC_AddSelectablePicture ( mainm , 68 , 13 , itemheight , " pics/m_main_game " ) ;
2009-04-01 22:03:56 +00:00
# endif
2019-01-13 16:51:50 +00:00
MC_AddSelectablePicture ( mainm , 68 , 53 , itemheight , " pics/m_main_multiplayer " ) ;
MC_AddSelectablePicture ( mainm , 68 , 93 , itemheight , " pics/m_main_options " ) ;
MC_AddSelectablePicture ( mainm , 68 , 133 , itemheight , " pics/m_main_video " ) ;
MC_AddSelectablePicture ( mainm , 68 , 173 , itemheight , " pics/m_main_quit " ) ;
2004-08-23 00:15:46 +00:00
2021-10-22 22:27:58 +00:00
# if defined(HAVE_SERVER) && defined(Q2SERVER)
2014-03-30 08:55:06 +00:00
b = MC_AddConsoleCommand ( mainm , 68 , 320 , 13 , " " , " menu_single \n " ) ;
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Singleplayer. " ) ;
2006-01-28 22:49:10 +00:00
mainm - > selecteditem = ( menuoption_t * ) b ;
2006-01-28 19:34:21 +00:00
b - > common . width = 12 * 20 ;
2019-01-13 16:51:50 +00:00
b - > common . height = itemheight ;
2009-04-01 22:03:56 +00:00
# endif
2014-03-30 08:55:06 +00:00
b = MC_AddConsoleCommand ( mainm , 68 , 320 , 53 , " " , " menu_multi \n " ) ;
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Multiplayer. " ) ;
2021-10-22 22:27:58 +00:00
if ( ! mainm - > selecteditem )
mainm - > selecteditem = ( menuoption_t * ) b ;
2006-01-28 19:34:21 +00:00
b - > common . width = 12 * 20 ;
2019-01-13 16:51:50 +00:00
b - > common . height = itemheight ;
2014-03-30 08:55:06 +00:00
b = MC_AddConsoleCommand ( mainm , 68 , 320 , 93 , " " , " menu_options \n " ) ;
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Options. " ) ;
2006-01-28 19:34:21 +00:00
b - > common . width = 12 * 20 ;
2019-01-13 16:51:50 +00:00
b - > common . height = itemheight ;
2014-03-30 08:55:06 +00:00
b = MC_AddConsoleCommand ( mainm , 68 , 320 , 133 , " " , " menu_video \n " ) ;
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Video Options. " ) ;
2006-01-28 19:34:21 +00:00
b - > common . width = 12 * 20 ;
2019-01-13 16:51:50 +00:00
b - > common . height = itemheight ;
2014-03-30 08:55:06 +00:00
b = MC_AddConsoleCommand ( mainm , 68 , 320 , 173 , " " , " menu_quit \n " ) ;
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Quit to DOS. " ) ;
2006-01-28 19:34:21 +00:00
b - > common . width = 12 * 20 ;
2019-01-13 16:51:50 +00:00
b - > common . height = itemheight ;
2004-08-23 00:15:46 +00:00
2014-08-17 03:18:43 +00:00
mainm - > cursoritem = ( menuoption_t * ) MC_AddCursor ( mainm , & resel , 42 , mainm - > selecteditem - > common . posy ) ;
2004-08-23 00:15:46 +00:00
}
}
2014-10-05 20:04:11 +00:00
else
# endif
# ifdef HEXEN2
2016-02-15 06:01:17 +00:00
if ( M_GameType ( ) = = MGT_HEXEN2 )
2004-08-23 00:15:46 +00:00
{
2014-09-17 03:04:08 +00:00
p = R2D_SafeCachePic ( " gfx/menu/title0.lmp " ) ;
2018-06-06 09:09:14 +00:00
if ( R_GetShaderSizes ( p , NULL , NULL , true ) > 0 )
{
2020-04-19 01:23:32 +00:00
int y = 64 ;
2018-06-06 09:09:14 +00:00
mainm = M_CreateMenu ( 0 ) ;
mainm - > key = MC_Main_Key ;
2004-08-23 00:15:46 +00:00
2018-06-06 09:09:14 +00:00
MC_AddPicture ( mainm , 16 , 0 , 35 , 176 , " gfx/menu/hplaque.lmp " ) ;
MC_AddCenterPicture ( mainm , 0 , 60 , " gfx/menu/title0.lmp " ) ;
2004-08-23 00:15:46 +00:00
2010-08-12 00:48:05 +00:00
# ifndef CLIENTONLY
2023-05-27 17:00:32 +00:00
b = MC_AddConsoleCommandHexen2BigFont ( mainm , 80 , y , localtext ( " Single Player " ) , " menu_single \n " ) ;
2018-06-06 09:09:14 +00:00
mainm - > selecteditem = ( menuoption_t * ) b ;
b - > common . width = 12 * 20 ;
b - > common . height = 20 ;
2020-04-19 01:23:32 +00:00
y + = 20 ;
2010-08-12 00:48:05 +00:00
# endif
2023-05-27 17:00:32 +00:00
b = MC_AddConsoleCommandHexen2BigFont ( mainm , 80 , y , localtext ( " MultiPlayer " ) , " menu_multi \n " ) ;
2010-08-12 00:48:05 +00:00
# ifdef CLIENTONLY
2018-06-06 09:09:14 +00:00
mainm - > selecteditem = ( menuoption_t * ) b ;
2010-08-12 00:48:05 +00:00
# endif
2018-06-06 09:09:14 +00:00
b - > common . width = 12 * 20 ;
b - > common . height = 20 ;
2020-04-19 01:23:32 +00:00
y + = 20 ;
2023-05-27 17:00:32 +00:00
b = MC_AddConsoleCommandHexen2BigFont ( mainm , 80 , y , localtext ( " ^bOptions " ) , " menu_options \n " ) ;
2018-06-06 09:09:14 +00:00
b - > common . width = 12 * 20 ;
b - > common . height = 20 ;
2020-04-19 01:23:32 +00:00
y + = 20 ;
2018-06-06 09:09:14 +00:00
if ( m_helpismedia . value )
2023-05-27 17:00:32 +00:00
b = MC_AddConsoleCommandHexen2BigFont ( mainm , 80 , y , localtext ( " Media " ) , " menu_media \n " ) ;
2018-06-06 09:09:14 +00:00
else
2023-05-27 17:00:32 +00:00
b = MC_AddConsoleCommandHexen2BigFont ( mainm , 80 , y , localtext ( " Help " ) , " help \n " ) ;
2018-06-06 09:09:14 +00:00
b - > common . width = 12 * 20 ;
b - > common . height = 20 ;
2020-04-19 01:23:32 +00:00
y + = 20 ;
2023-05-27 17:00:32 +00:00
b = MC_AddConsoleCommandHexen2BigFont ( mainm , 80 , y , localtext ( " Mods " ) , " menu_mods \n " ) ;
2020-04-19 01:23:32 +00:00
b - > common . width = 12 * 20 ;
b - > common . height = 20 ;
y + = 20 ;
2023-05-27 17:00:32 +00:00
b = MC_AddConsoleCommandHexen2BigFont ( mainm , 80 , y , localtext ( " Quit " ) , " menu_quit \n " ) ;
2018-06-06 09:09:14 +00:00
b - > common . width = 12 * 20 ;
b - > common . height = 20 ;
2020-04-19 01:23:32 +00:00
y + = 20 ;
2004-08-23 00:15:46 +00:00
2018-06-06 09:09:14 +00:00
mainm - > cursoritem = ( menuoption_t * ) MC_AddCursor ( mainm , & resel , 56 , mainm - > selecteditem - > common . posy ) ;
}
2004-08-23 00:15:46 +00:00
}
2014-10-05 20:04:11 +00:00
else
# endif
if ( QBigFontWorks ( ) )
2006-03-06 01:41:09 +00:00
{
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( " gfx/ttl_main.lmp " ) ;
2018-06-06 09:09:14 +00:00
if ( R_GetShaderSizes ( p , NULL , NULL , true ) > 0 )
2006-03-06 01:41:09 +00:00
{
2018-06-06 09:09:14 +00:00
mainm = M_CreateMenu ( 0 ) ;
mainm - > key = MC_Main_Key ;
MC_AddPicture ( mainm , 16 , 4 , 32 , 144 , " gfx/qplaque.lmp " ) ;
2006-03-06 01:41:09 +00:00
2018-06-06 09:09:14 +00:00
MC_AddCenterPicture ( mainm , 4 , 24 , " gfx/ttl_main.lmp " ) ;
2006-03-06 01:41:09 +00:00
2018-06-06 09:09:14 +00:00
y = 32 ;
mainm - > selecteditem = ( menuoption_t * )
2016-07-12 00:40:13 +00:00
# ifndef CLIENTONLY
2023-05-27 17:00:32 +00:00
MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Single " ) , " menu_single \n " ) ; y + = 20 ;
2016-07-12 00:40:13 +00:00
# endif
2023-05-27 17:00:32 +00:00
MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Multiplayer " ) , " menu_multi \n " ) ; y + = 20 ;
MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " ^bOptions " ) , " menu_options \n " ) ; y + = 20 ;
2018-06-06 09:09:14 +00:00
if ( m_helpismedia . value )
2023-05-27 17:00:32 +00:00
{ MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Media " ) , " menu_media \n " ) ; y + = 20 ; }
2018-06-06 09:09:14 +00:00
else
2023-05-27 17:00:32 +00:00
{ MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Help " ) , " help \n " ) ; y + = 20 ; }
2018-06-06 09:09:14 +00:00
y = M_Main_AddExtraOptions ( mainm , y ) ;
2014-08-27 08:41:31 +00:00
# ifdef FTE_TARGET_WEB
2023-05-27 17:00:32 +00:00
MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Save Settings " ) , " menu_quit \n " ) ; y + = 20 ;
2014-08-27 08:41:31 +00:00
# else
2023-05-27 17:00:32 +00:00
MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Quit " ) , " menu_quit \n " ) ; y + = 20 ;
2014-08-27 08:41:31 +00:00
# endif
2006-03-06 01:41:09 +00:00
2021-09-07 23:43:25 +00:00
mainm - > cursoritem = ( menuoption_t * ) MC_AddCursor ( mainm , & resel , 54 , mainm - > selecteditem - > common . posy ) ;
2018-06-06 09:09:14 +00:00
}
2006-03-06 01:41:09 +00:00
}
2004-08-23 00:15:46 +00:00
else
{
2018-06-02 08:55:57 +00:00
int width ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
p = R2D_SafeCachePic ( " gfx/mainmenu.lmp " ) ;
R2D_SafeCachePic ( " gfx/ttl_main.lmp " ) ;
2018-06-06 09:09:14 +00:00
if ( R_GetShaderSizes ( p , & width , NULL , true ) > 0 )
2004-12-15 19:39:21 +00:00
{
2018-06-06 09:09:14 +00:00
mainm = M_CreateMenu ( 0 ) ;
2005-01-13 16:29:20 +00:00
2018-06-06 09:09:14 +00:00
mainm - > key = MC_Main_Key ;
MC_AddPicture ( mainm , 16 , 4 , 32 , 144 , " gfx/qplaque.lmp " ) ;
MC_AddCenterPicture ( mainm , 4 , 24 , " gfx/ttl_main.lmp " ) ;
MC_AddPicture ( mainm , 72 , 32 , 240 , 112 , " gfx/mainmenu.lmp " ) ;
b = MC_AddConsoleCommand ( mainm , 72 , 312 , 32 , " " , " menu_single \n " ) ;
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Start singleplayer Quake game. " ) ;
2018-06-06 09:09:14 +00:00
mainm - > selecteditem = ( menuoption_t * ) b ;
b - > common . width = width ;
b - > common . height = 20 ;
b = MC_AddConsoleCommand ( mainm , 72 , 312 , 52 , " " , " menu_multi \n " ) ;
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Multiplayer menu. " ) ;
2018-06-06 09:09:14 +00:00
b - > common . width = width ;
b - > common . height = 20 ;
b = MC_AddConsoleCommand ( mainm , 72 , 312 , 72 , " " , " menu_options \n " ) ;
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Options menu. " ) ;
2018-06-06 09:09:14 +00:00
b - > common . width = width ;
b - > common . height = 20 ;
if ( m_helpismedia . value )
{
b = MC_AddConsoleCommand ( mainm , 72 , 312 , 92 , " " , " menu_media \n " ) ;
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Media menu. " ) ;
2018-06-06 09:09:14 +00:00
}
else
{
b = MC_AddConsoleCommand ( mainm , 72 , 312 , 92 , " " , " help \n " ) ;
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Help menu. " ) ;
2018-06-06 09:09:14 +00:00
}
b - > common . width = width ;
b - > common . height = 20 ;
b = MC_AddConsoleCommand ( mainm , 72 , 312 , 112 , " " , " menu_quit \n " ) ;
2014-08-27 08:41:31 +00:00
# ifdef FTE_TARGET_WEB
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Save settings to local storage. " ) ;
2014-08-27 08:41:31 +00:00
# else
2023-05-27 17:00:32 +00:00
b - > common . tooltip = localtext ( " Exit to DOS. " ) ;
2014-08-27 08:41:31 +00:00
# endif
2018-06-06 09:09:14 +00:00
b - > common . width = width ;
b - > common . height = 20 ;
M_Main_AddExtraOptions ( mainm , 112 + 20 ) ;
2004-08-23 00:15:46 +00:00
2021-09-07 23:43:25 +00:00
mainm - > cursoritem = ( menuoption_t * ) MC_AddCursor ( mainm , & resel , 54 , mainm - > selecteditem - > common . posy ) ;
2018-06-06 09:09:14 +00:00
}
}
if ( ! mainm )
{
mainm = M_CreateMenu ( 0 ) ;
2022-03-08 05:31:34 +00:00
MC_AddRedText ( mainm , 72 , 320 , 0 , " Main Menu " , false ) ;
2018-05-28 10:12:10 +00:00
2018-06-06 09:09:14 +00:00
y = 36 ;
mainm - > selecteditem = ( menuoption_t * )
//skip menu_single if we don't seem to have any content.
2023-05-27 17:00:32 +00:00
MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Join server " ) , " menu_servers \n " ) ; y + = 20 ;
MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " ^bOptions " ) , " menu_options \n " ) ; y + = 20 ;
2018-06-06 09:09:14 +00:00
y = M_Main_AddExtraOptions ( mainm , y ) ;
2023-05-27 17:00:32 +00:00
MC_AddConsoleCommandQBigFont ( mainm , 72 , y , localtext ( " Quit " ) , " menu_quit \n " ) ; y + = 20 ;
2018-11-19 06:37:25 +00:00
2021-09-07 23:43:25 +00:00
mainm - > cursoritem = ( menuoption_t * ) MC_AddCursor ( mainm , & resel , 54 , mainm - > selecteditem - > common . posy ) ;
2004-08-23 00:15:46 +00:00
}
2012-04-24 07:59:11 +00:00
2021-09-07 23:43:25 +00:00
mainm - > predraw = MC_Main_Predraw ; //disable flashes as appropriate.
//pick a better default option...
b = NULL ;
if ( ! b & & ! m_preset_chosen . ival )
b = M_FindButton ( mainm , " menu_options \n " ) ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
# ifdef PACKAGEMANAGER
2021-09-07 23:43:25 +00:00
if ( ! b & & PM_AreSourcesNew ( false ) )
b = M_FindButton ( mainm , " menu_download \n " ) ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
# endif
2021-09-07 23:43:25 +00:00
if ( b )
{
mainm - > selecteditem = ( menuoption_t * ) b ;
2023-02-20 08:21:56 +00:00
mainm - > cursoritem - > common . posy = mainm - > selecteditem - > common . posy + ( mainm - > selecteditem - > common . height - mainm - > cursoritem - > common . height ) / 2 ;
2021-09-07 23:43:25 +00:00
}
2004-08-23 00:15:46 +00:00
}
2019-09-04 07:59:40 +00:00
int MC_AddBulk ( struct emenu_s * menu , menuresel_t * resel , menubulk_t * bulk , int xstart , int xtextend , int y )
2011-06-07 23:54:58 +00:00
{
2023-02-20 08:21:56 +00:00
int last_y = y ;
2011-06-07 23:54:58 +00:00
menuoption_t * selected = NULL ;
while ( bulk )
{
2011-06-16 21:41:05 +00:00
menuoption_t * control ;
int x = xtextend ;
int xleft ;
2011-06-18 05:41:10 +00:00
int spacing = 8 ;
2011-07-22 15:05:40 +00:00
2011-06-16 21:41:05 +00:00
if ( bulk - > text )
2016-07-12 00:40:13 +00:00
{ //lots of fancy code just to figure out the correct width of the string. yay. :(
int px , py ;
conchar_t buffer [ 2048 ] , * end ;
2018-08-23 06:03:31 +00:00
if ( font_default )
{
end = COM_ParseFunString ( CON_WHITEMASK , bulk - > text , buffer , sizeof ( buffer ) , false ) ;
Font_BeginString ( font_default , 0 , 0 , & px , & py ) ;
px = Font_LineWidth ( buffer , end ) ;
Font_EndString ( NULL ) ;
}
else
{
Con_DPrintf ( " MC_AddBulk: default font not initialised yet \n " ) ;
px = strlen ( bulk - > text ) * 8 ;
}
2016-07-12 00:40:13 +00:00
x - = ( ( float ) px * vid . width ) / vid . rotpixelwidth ;
}
2011-06-16 21:41:05 +00:00
xleft = x - xstart ;
2011-06-07 23:54:58 +00:00
switch ( bulk - > type )
{
case mt_text :
switch ( bulk - > variant )
{
case - 1 : // end of menu
2011-10-27 15:46:36 +00:00
default :
2011-06-07 23:54:58 +00:00
bulk = NULL ;
2011-10-27 15:46:36 +00:00
control = NULL ;
2011-06-07 23:54:58 +00:00
continue ;
case 0 : // white text
2014-03-30 08:55:06 +00:00
control = ( union menuoption_s * ) MC_AddWhiteText ( menu , xleft , xtextend , y , bulk - > text , bulk - > rightalign ) ;
2011-06-07 23:54:58 +00:00
break ;
case 1 : // red text
2014-03-30 08:55:06 +00:00
control = ( union menuoption_s * ) MC_AddRedText ( menu , xleft , xtextend , y , bulk - > text , bulk - > rightalign ) ;
2011-06-07 23:54:58 +00:00
break ;
case 2 : // spacing
2011-06-18 05:41:10 +00:00
spacing = bulk - > spacing ;
2011-10-27 15:46:36 +00:00
control = NULL ;
2011-06-07 23:54:58 +00:00
break ;
}
break ;
case mt_button :
2011-06-16 21:41:05 +00:00
switch ( bulk - > variant )
2011-06-07 23:54:58 +00:00
{
2011-06-16 21:41:05 +00:00
default :
case 0 : // console command
2014-03-30 08:55:06 +00:00
control = ( union menuoption_s * ) MC_AddConsoleCommand ( menu , xleft , xtextend , y , bulk - > text , bulk - > consolecmd ) ;
2011-06-16 21:41:05 +00:00
break ;
case 1 : // function command
2014-03-30 08:55:06 +00:00
control = ( union menuoption_s * ) MC_AddCommand ( menu , xleft , xtextend , y , bulk - > text , bulk - > command ) ;
2011-06-16 21:41:05 +00:00
break ;
2011-06-07 23:54:58 +00:00
}
break ;
case mt_checkbox :
2013-10-29 17:38:22 +00:00
control = ( union menuoption_s * ) MC_AddCheckBox ( menu , xleft , xtextend , y , bulk - > text , bulk - > cvar , bulk - > flags ) ;
2011-06-16 21:41:05 +00:00
control - > check . func = bulk - > func ;
2011-06-07 23:54:58 +00:00
break ;
case mt_slider :
2013-10-29 17:38:22 +00:00
control = ( union menuoption_s * ) MC_AddSlider ( menu , xleft , xtextend , y , bulk - > text , bulk - > cvar , bulk - > min , bulk - > max , bulk - > delta ) ;
2011-06-07 23:54:58 +00:00
break ;
case mt_combo :
2011-06-16 21:41:05 +00:00
switch ( bulk - > variant )
2011-06-07 23:54:58 +00:00
{
2011-06-16 21:41:05 +00:00
default :
case 0 : // cvar combo
2013-10-29 17:38:22 +00:00
control = ( union menuoption_s * ) MC_AddCvarCombo ( menu , xleft , xtextend , y , bulk - > text , bulk - > cvar , bulk - > options , bulk - > values ) ;
2011-06-16 21:41:05 +00:00
break ;
case 1 : // combo with return value
2015-01-21 18:18:37 +00:00
if ( bulk - > selectedoption < 0 )
{ //invalid...
control = NULL ;
spacing = 0 ;
break ;
}
2013-10-29 17:38:22 +00:00
control = ( union menuoption_s * ) MC_AddCombo ( menu , xleft , xtextend , y , bulk - > text , bulk - > options , bulk - > selectedoption ) ;
2011-06-16 21:41:05 +00:00
break ;
2011-06-07 23:54:58 +00:00
}
break ;
case mt_edit :
2011-06-16 21:41:05 +00:00
switch ( bulk - > variant )
2011-06-07 23:54:58 +00:00
{
2011-06-16 21:41:05 +00:00
default :
case 0 :
2013-10-29 17:38:22 +00:00
control = ( union menuoption_s * ) MC_AddEditCvar ( menu , xleft , xtextend , y , bulk - > text , bulk - > cvarname , false ) ;
2011-06-16 21:41:05 +00:00
break ;
case 1 :
2013-10-29 17:38:22 +00:00
control = ( union menuoption_s * ) MC_AddEditCvar ( menu , xleft , xtextend , y , bulk - > text , bulk - > cvarname , true ) ;
2011-06-16 21:41:05 +00:00
break ;
2011-06-07 23:54:58 +00:00
}
2022-02-07 14:34:11 +00:00
spacing = control - > common . height ;
2011-06-07 23:54:58 +00:00
break ;
default :
Con_Printf ( CON_ERROR " Invalid type in bulk menu! \n " ) ;
bulk = NULL ;
continue ;
}
2011-06-16 21:41:05 +00:00
if ( bulk - > ret )
* bulk - > ret = control ;
2021-04-14 05:21:04 +00:00
if ( control )
2021-06-21 13:44:28 +00:00
{
2021-04-14 05:21:04 +00:00
control - > common . grav_y = y - last_y ;
2021-06-21 13:44:28 +00:00
last_y = y ;
}
2011-10-27 15:46:36 +00:00
if ( control & & MI_Selectable ( control ) & & ! selected )
2011-06-16 21:41:05 +00:00
selected = control ;
2011-10-27 15:46:36 +00:00
if ( control & & bulk - > tooltip )
2011-06-16 21:41:05 +00:00
control - > common . tooltip = bulk - > tooltip ;
2011-10-27 15:46:36 +00:00
if ( control & & xleft > 0 )
2011-06-16 21:41:05 +00:00
control - > common . extracollide = xleft ;
2011-06-18 05:41:10 +00:00
y + = spacing ;
2011-06-16 21:41:05 +00:00
2011-06-07 23:54:58 +00:00
bulk + + ;
}
menu - > selecteditem = selected ;
2023-02-20 08:21:56 +00:00
menu - > cursoritem = ( menuoption_t * ) MC_AddCursorSmall ( menu , resel , xtextend + 8 ) ;
2011-06-07 23:54:58 +00:00
return y ;
}
2014-09-02 02:44:43 +00:00
# endif