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"
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
2004-08-23 00:15:46 +00:00
int selectitem ;
2019-09-04 07:59:40 +00:00
emenu_t * menu_script ;
2013-10-29 17:38:22 +00:00
2019-09-04 07:59:40 +00:00
void M_Script_Option ( emenu_t * menu , char * optionvalue , qboolean isexplicit )
2013-10-29 17:38:22 +00:00
{
menuoption_t * mo ;
2016-10-22 07:06:51 +00:00
char * scriptname = menu - > data ;
2013-10-29 17:38:22 +00:00
char buf [ 8192 ] ;
2016-10-22 07:06:51 +00:00
//FIXME: not sure about these, as the user typically can't see what they'll do.
int expandlevel = RESTRICT_SERVER ;
int execlevel = RESTRICT_LOCAL ;
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
2016-10-22 07:06:51 +00:00
Cbuf_AddText ( " wait \n " , execlevel ) ;
if ( ! * scriptname )
{
if ( isexplicit )
Cbuf_AddText ( va ( " %s \n " , optionvalue ) , execlevel ) ;
return ;
}
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
2013-10-29 17:38:22 +00:00
//update the option
2016-10-22 07:06:51 +00:00
Cbuf_AddText ( va ( " set option %s \n " , COM_QuotedString ( optionvalue , buf , sizeof ( buf ) , false ) ) , execlevel ) ;
2013-10-29 17:38:22 +00:00
//expand private arguments
for ( mo = menu - > options , * buf = 0 ; mo ; mo = mo - > common . next )
{
if ( mo - > common . type = = mt_edit )
{
if ( strlen ( buf ) + strlen ( mo - > edit . text ) + 2 > = sizeof ( buf ) )
break ;
memmove ( buf + strlen ( mo - > edit . text ) + 1 , buf , strlen ( buf ) + 1 ) ;
memcpy ( buf , mo - > edit . text , strlen ( mo - > edit . text ) ) ;
buf [ strlen ( mo - > edit . text ) ] = ' ' ;
}
}
Cmd_TokenizeString ( buf , false , false ) ;
2023-03-15 01:29:30 +00:00
Cmd_ExpandString ( scriptname , buf , sizeof ( buf ) , & expandlevel , true , false , false ) ;
2013-10-29 17:38:22 +00:00
//and execute it as-is
2016-10-22 07:06:51 +00:00
Cbuf_AddText ( buf , execlevel ) ;
Cbuf_AddText ( " \n " , execlevel ) ;
2013-10-29 17:38:22 +00:00
}
2004-08-23 00:15:46 +00:00
2019-09-04 07:59:40 +00:00
void M_Script_Remove ( emenu_t * menu )
2004-08-23 00:15:46 +00:00
{
2013-10-29 17:38:22 +00:00
if ( menu = = menu_script )
menu_script = NULL ;
2016-10-22 07:06:51 +00:00
M_Script_Option ( menu , " cancel " , false ) ;
2004-08-23 00:15:46 +00:00
}
2019-09-04 07:59:40 +00:00
qboolean M_Script_Key ( int key , emenu_t * menu )
2004-08-23 00:15:46 +00:00
{
if ( menu - > selecteditem & & menu - > selecteditem - > common . type = = mt_edit )
return false ;
2013-10-29 17:38:22 +00:00
if ( key > = ' 0 ' & & key < = ' 9 ' & & menu - > data )
2004-08-23 00:15:46 +00:00
{
2006-11-03 15:53:04 +00:00
if ( key = = ' 0 ' ) //specal case so that "hello" < "0"... (plus matches common impulses)
2016-10-22 07:06:51 +00:00
M_Script_Option ( menu , " 10 " , false ) ;
2006-11-03 15:53:04 +00:00
else
2016-10-22 07:06:51 +00:00
M_Script_Option ( menu , va ( " %i " , key - ' 0 ' ) , false ) ;
2004-08-23 00:15:46 +00:00
return true ;
}
return false ;
}
2013-10-29 17:38:22 +00:00
void M_MenuS_Callback_f ( void )
{
if ( menu_script )
{
2016-10-22 07:06:51 +00:00
M_Script_Option ( menu_script , Cmd_Argv ( 1 ) , true ) ;
2013-10-29 17:38:22 +00:00
}
}
2004-09-07 18:20:05 +00:00
void M_MenuS_Clear_f ( void )
2004-08-23 00:15:46 +00:00
{
if ( menu_script )
{
M_RemoveMenu ( menu_script ) ;
}
}
2004-09-07 18:20:05 +00:00
void M_MenuS_Script_f ( void ) //create a menu.
2004-08-23 00:15:46 +00:00
{
int items ;
char * alias = Cmd_Argv ( 1 ) ;
selectitem = 0 ;
items = 0 ;
if ( menu_script )
{
menuoption_t * option ;
for ( option = menu_script - > options ; option ; option = option - > common . next )
{
if ( option - > common . type = = mt_button )
{
if ( menu_script - > selecteditem = = option )
selectitem = items ;
items + + ;
}
}
selectitem = items - selectitem - 1 ;
2004-09-07 18:20:05 +00:00
M_MenuS_Clear_f ( ) ;
2004-08-23 00:15:46 +00:00
}
menu_script = M_CreateMenu ( 0 ) ;
menu_script - > remove = M_Script_Remove ;
menu_script - > key = M_Script_Key ;
2013-10-29 17:38:22 +00:00
Key_Dest_Remove ( kdm_console ) ;
if ( Cmd_Argc ( ) = = 1 )
menu_script - > data = Cmd_ParseMultiline ( true ) ;
2004-08-23 00:15:46 +00:00
else
2013-10-29 17:38:22 +00:00
menu_script - > data = Z_StrDup ( alias ) ;
2004-08-23 00:15:46 +00:00
}
2004-09-07 18:20:05 +00:00
void M_MenuS_Box_f ( void )
2004-08-23 00:15:46 +00:00
{
int x = atoi ( Cmd_Argv ( 1 ) ) ;
int y = atoi ( Cmd_Argv ( 2 ) ) ;
int width = atoi ( Cmd_Argv ( 3 ) ) ;
int height = atoi ( Cmd_Argv ( 4 ) ) ;
if ( ! menu_script )
{
Con_Printf ( " %s with no active menu \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
2020-04-19 01:23:32 +00:00
MC_AddBox ( menu_script , x , y , width , height ) ;
2004-08-23 00:15:46 +00:00
}
2004-09-07 18:20:05 +00:00
void M_MenuS_CheckBox_f ( void )
2004-08-23 00:15:46 +00:00
{
int x = atoi ( Cmd_Argv ( 1 ) ) ;
int y = atoi ( Cmd_Argv ( 2 ) ) ;
char * text = Cmd_Argv ( 3 ) ;
char * cvarname = Cmd_Argv ( 4 ) ;
2004-09-13 03:10:10 +00:00
int bitmask = atoi ( Cmd_Argv ( 5 ) ) ;
2004-08-23 00:15:46 +00:00
cvar_t * cvar ;
if ( ! menu_script )
{
Con_Printf ( " %s with no active menu \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
cvar = Cvar_Get ( cvarname , text , 0 , " User variables " ) ;
if ( ! cvar )
return ;
2013-10-29 17:38:22 +00:00
MC_AddCheckBox ( menu_script , x , x + 160 , y , text , cvar , bitmask ) ;
2004-08-23 00:15:46 +00:00
}
2004-09-07 18:20:05 +00:00
void M_MenuS_Slider_f ( void )
2004-08-23 00:15:46 +00:00
{
int x = atoi ( Cmd_Argv ( 1 ) ) ;
int y = atoi ( Cmd_Argv ( 2 ) ) ;
char * text = Cmd_Argv ( 3 ) ;
char * cvarname = Cmd_Argv ( 4 ) ;
float min = atof ( Cmd_Argv ( 5 ) ) ;
float max = atof ( Cmd_Argv ( 6 ) ) ;
cvar_t * cvar ;
if ( ! menu_script )
{
Con_Printf ( " %s with no active menu \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
cvar = Cvar_Get ( cvarname , text , 0 , " User variables " ) ;
if ( ! cvar )
return ;
2013-10-29 17:38:22 +00:00
MC_AddSlider ( menu_script , x , x + 160 , y , text , cvar , min , max , 0 ) ;
2004-08-23 00:15:46 +00:00
}
2004-09-07 18:20:05 +00:00
void M_MenuS_Picture_f ( void )
2004-08-23 00:15:46 +00:00
{
int x = atoi ( Cmd_Argv ( 1 ) ) ;
int y = atoi ( Cmd_Argv ( 2 ) ) ;
char * picname = Cmd_Argv ( 3 ) ;
2009-11-04 21:16:50 +00:00
mpic_t * p ;
2004-08-23 00:15:46 +00:00
if ( ! menu_script )
{
Con_Printf ( " %s with no active menu \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
2011-03-31 01:14:01 +00:00
p = R2D_SafeCachePic ( picname ) ;
2009-11-04 21:16:50 +00:00
if ( ! p )
return ;
2006-11-03 15:53:04 +00:00
if ( ! strcmp ( Cmd_Argv ( 1 ) , " - " ) )
2009-11-04 21:16:50 +00:00
MC_AddCenterPicture ( menu_script , y , p - > height , picname ) ;
2006-11-03 15:53:04 +00:00
else
2009-11-04 21:16:50 +00:00
MC_AddPicture ( menu_script , x , y , p - > width , p - > height , picname ) ;
2004-08-23 00:15:46 +00:00
}
2004-09-07 18:20:05 +00:00
void M_MenuS_Edit_f ( void )
2004-08-23 00:15:46 +00:00
{
int x = atoi ( Cmd_Argv ( 1 ) ) ;
int y = atoi ( Cmd_Argv ( 2 ) ) ;
char * text = Cmd_Argv ( 3 ) ;
char * def = Cmd_Argv ( 4 ) ;
if ( ! menu_script )
{
Con_Printf ( " %s with no active menu \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
2013-10-29 17:38:22 +00:00
MC_AddEditCvar ( menu_script , x , x + 160 , y , text , def , false ) ;
}
void M_MenuS_EditPriv_f ( void )
{
int x = atoi ( Cmd_Argv ( 1 ) ) ;
int y = atoi ( Cmd_Argv ( 2 ) ) ;
char * text = Cmd_Argv ( 3 ) ;
char * def = Cmd_Argv ( 4 ) ;
if ( ! menu_script )
{
Con_Printf ( " %s with no active menu \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
MC_AddEdit ( menu_script , x , x + 160 , y , text , def ) ;
2004-08-23 00:15:46 +00:00
}
2004-09-07 18:20:05 +00:00
void M_MenuS_Text_f ( void )
2004-08-23 00:15:46 +00:00
{
menuoption_t * option ;
int x = atoi ( Cmd_Argv ( 1 ) ) ;
int y = atoi ( Cmd_Argv ( 2 ) ) ;
char * text = Cmd_Argv ( 3 ) ;
char * command = Cmd_Argv ( 4 ) ;
if ( ! menu_script )
{
Con_Printf ( " %s with no active menu \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
if ( Cmd_Argc ( ) = = 4 )
2014-03-30 08:55:06 +00:00
MC_AddBufferedText ( menu_script , x , 0 , y , text , false , false ) ;
2004-08-23 00:15:46 +00:00
else
{
2016-10-22 07:06:51 +00:00
option = ( menuoption_t * ) MC_AddConsoleCommand ( menu_script , x , 0 , y , text , va ( " menucallback \" %s \" \n " , command ) ) ;
2004-08-23 00:15:46 +00:00
if ( selectitem - - = = 0 )
menu_script - > selecteditem = option ;
}
}
2004-09-07 18:20:05 +00:00
2006-03-06 01:41:09 +00:00
void M_MenuS_TextBig_f ( void )
{
menuoption_t * option ;
int x = atoi ( Cmd_Argv ( 1 ) ) ;
int y = atoi ( Cmd_Argv ( 2 ) ) ;
char * text = Cmd_Argv ( 3 ) ;
char * command = Cmd_Argv ( 4 ) ;
if ( ! menu_script )
{
Con_Printf ( " %s with no active menu \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( ! * command )
2006-03-06 01:41:09 +00:00
MC_AddConsoleCommandQBigFont ( menu_script , x , y , text , command ) ;
else
{
2013-10-29 17:38:22 +00:00
option = ( menuoption_t * ) MC_AddConsoleCommandQBigFont ( menu_script , x , y , text , va ( " menucallback %s \n " , command ) ) ;
2006-03-06 01:41:09 +00:00
if ( selectitem - - = = 0 )
menu_script - > selecteditem = option ;
}
}
2004-09-07 18:20:05 +00:00
void M_MenuS_Bind_f ( void )
{
int x = atoi ( Cmd_Argv ( 1 ) ) ;
int y = atoi ( Cmd_Argv ( 2 ) ) ;
char * caption = Cmd_Argv ( 3 ) ;
char * command = Cmd_Argv ( 4 ) ;
if ( ! menu_script )
{
Con_Printf ( " %s with no active menu \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
if ( ! * caption )
caption = command ;
2014-05-10 17:26:41 +00:00
MC_AddBind ( menu_script , x , x + 160 , y , command , caption , NULL ) ;
2004-09-07 18:20:05 +00:00
}
2007-01-08 03:13:03 +00:00
void M_MenuS_Comboi_f ( void )
{
int opt ;
char * opts [ 64 ] ;
char * values [ 64 ] ;
char valuesb [ 64 ] [ 8 ] ;
int x = atoi ( Cmd_Argv ( 1 ) ) ;
int y = atoi ( Cmd_Argv ( 2 ) ) ;
char * caption = Cmd_Argv ( 3 ) ;
char * command = Cmd_Argv ( 4 ) ;
char * line ;
cvar_t * var ;
if ( ! menu_script )
{
Con_Printf ( " %s with no active menu \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
var = Cvar_Get ( command , " 0 " , 0 , " custom cvars " ) ;
if ( ! var )
return ;
if ( ! * caption )
caption = command ;
for ( opt = 0 ; opt < sizeof ( opts ) / sizeof ( opts [ 0 ] ) - 2 & & * ( line = Cmd_Argv ( 5 + opt ) ) ; opt + + )
{
opts [ opt ] = line ;
2011-07-22 15:11:35 +00:00
Q_snprintfz ( valuesb [ opt ] , sizeof ( valuesb [ opt ] ) , " %i " , opt ) ;
2007-01-08 03:13:03 +00:00
values [ opt ] = valuesb [ opt ] ;
}
opts [ opt ] = NULL ;
2013-10-29 17:38:22 +00:00
MC_AddCvarCombo ( menu_script , x , x + 160 , y , caption , var , ( const char * * ) opts , ( const char * * ) values ) ;
2007-01-08 03:13:03 +00:00
}
char * Hunk_TempString ( char * s )
{
char * h ;
h = Hunk_TempAllocMore ( strlen ( s ) + 1 ) ;
strcpy ( h , s ) ;
return h ;
}
void M_MenuS_Combos_f ( void )
{
int opt ;
char * opts [ 64 ] ;
char * values [ 64 ] ;
int x = atoi ( Cmd_Argv ( 1 ) ) ;
int y = atoi ( Cmd_Argv ( 2 ) ) ;
char * caption = Cmd_Argv ( 3 ) ;
char * command = Cmd_Argv ( 4 ) ;
char * line ;
cvar_t * var ;
if ( ! menu_script )
{
Con_Printf ( " %s with no active menu \n " , Cmd_Argv ( 0 ) ) ;
return ;
}
var = Cvar_Get ( command , " 0 " , 0 , " custom cvars " ) ;
if ( ! var )
return ;
if ( ! * caption )
caption = command ;
line = Cmd_Argv ( 5 ) ;
if ( ! * line )
{
2011-12-05 15:23:40 +00:00
line = Cbuf_GetNext ( Cmd_ExecLevel , true ) ;
2007-01-08 03:13:03 +00:00
if ( * line ! = ' { ' )
Cbuf_InsertText ( line , Cmd_ExecLevel , true ) ; //whoops. Stick the trimmed string back in to the cbuf.
else
line = " { " ;
}
if ( ! strcmp ( line , " { " ) )
{
char * line ;
Hunk_TempAlloc ( 4 ) ;
for ( opt = 0 ; opt < sizeof ( opts ) / sizeof ( opts [ 0 ] ) - 2 ; opt + + )
{
2011-12-05 15:23:40 +00:00
line = Cbuf_GetNext ( Cmd_ExecLevel , true ) ;
2007-01-08 03:13:03 +00:00
line = COM_Parse ( line ) ;
if ( ! strcmp ( com_token , " } " ) )
break ;
opts [ opt ] = Hunk_TempString ( com_token ) ;
line = COM_Parse ( line ) ;
values [ opt ] = Hunk_TempString ( com_token ) ;
}
}
else
{
for ( opt = 0 ; opt < sizeof ( opts ) / sizeof ( opts [ 0 ] ) - 2 ; opt + + )
{
line = Cmd_Argv ( 5 + opt * 2 ) ;
if ( ! * line )
break ;
opts [ opt ] = line ;
values [ opt ] = Cmd_Argv ( 5 + opt * 2 + 1 ) ;
}
}
opts [ opt ] = NULL ;
2013-10-29 17:38:22 +00:00
MC_AddCvarCombo ( menu_script , x , x + 160 , y , caption , var , ( const char * * ) opts , ( const char * * ) values ) ;
2007-01-08 03:13:03 +00:00
}
2004-08-23 00:15:46 +00:00
/*
menuclear
2013-11-21 23:02:28 +00:00
conmenu menucallback
2004-08-23 00:15:46 +00:00
menubox 0 0 320 8
menutext 0 0 " GO GO GO!!! " " radio21 "
menutext 0 8 " Fall back " " radio22 "
menutext 0 8 " Stick together " " radio23 "
menutext 0 16 " Get in position " " radio24 "
menutext 0 24 " Storm the front " " radio25 "
menutext 0 24 " Report in " " radio26 "
menutext 0 24 " Cancel "
*/
void M_Script_Init ( void )
{
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
Cmd_AddCommandD ( " menuclear " , M_MenuS_Clear_f , " Pop the currently scripted menu. " ) ;
Cmd_AddCommandD ( " menucallback " , M_MenuS_Callback_f , " Explicitly invoke the active script menu's callback function with the given option set. " ) ;
Cmd_AddCommandD ( " conmenu " , M_MenuS_Script_f , " conmenu <callback> \n Creates a new (built-in) scripted menu. any following commands that define scipted menu items will add their items to this new menu. The callback will be called with argument 'cancel' when the menu is closed. " ) ;
Cmd_AddCommandD ( " menubox " , M_MenuS_Box_f , " x y width height " ) ;
Cmd_AddCommandD ( " menuedit " , M_MenuS_Edit_f , " x y caption cvarname " ) ;
Cmd_AddCommandD ( " menueditpriv " , M_MenuS_EditPriv_f , " x y caption def " ) ;
Cmd_AddCommandD ( " menutext " , M_MenuS_Text_f , " x y caption cbcommand " ) ;
Cmd_AddCommandD ( " menutextbig " , M_MenuS_TextBig_f , " x y caption cbcommand " ) ;
Cmd_AddCommandD ( " menupic " , M_MenuS_Picture_f , " x y picname " ) ;
Cmd_AddCommandD ( " menucheck " , M_MenuS_CheckBox_f , " x y caption cvarname bitmask " ) ;
Cmd_AddCommandD ( " menuslider " , M_MenuS_Slider_f , " x y caption cvarname min max " ) ;
Cmd_AddCommandD ( " menubind " , M_MenuS_Bind_f , " x y caption bindcommand " ) ;
Cmd_AddCommandD ( " menucomboi " , M_MenuS_Comboi_f , " x y caption cvarname [caption0] [caption1] ... " ) ;
Cmd_AddCommandD ( " menucombos " , M_MenuS_Combos_f , " x y caption cvarname [caption0] [value0] [caption1] [value1] ... \n if 'caption0' is { then the options will be parsed from trailing lines \n " ) ;
2004-08-23 00:15:46 +00:00
}
2014-09-02 02:44:43 +00:00
# endif