2004-08-23 00:15:46 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2005-11-03 23:49:49 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2004-08-23 00:15:46 +00:00
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
# include "quakedef.h"
# include "winquake.h"
2009-11-04 21:16:50 +00:00
# include "shader.h"
2017-12-09 21:22:46 +00:00
# include "cl_master.h"
2004-08-23 00:15:46 +00:00
2019-09-04 07:59:40 +00:00
menu_t * topmenu ;
menu_t * promptmenu ;
void Menu_KeyEvent ( qboolean isdown , int deviceid , int key , int unicode )
{
if ( promptmenu & & promptmenu - > keyevent )
promptmenu - > keyevent ( promptmenu , isdown , deviceid , key , unicode ) ;
else if ( topmenu & & topmenu - > keyevent )
topmenu - > keyevent ( topmenu , isdown , deviceid , key , unicode ) ;
else if ( isdown )
Key_Dest_Remove ( kdm_menu ) ; //it doesn't want it then...
}
static void Menu_UpdateFocus ( void )
{
if ( ! promptmenu | | ! promptmenu - > keyevent )
Key_Dest_Remove ( kdm_prompt ) ; //can't take key presses, so don't take keys.
if ( promptmenu & & promptmenu - > cursor )
key_dest_absolutemouse | = kdm_prompt ;
else
key_dest_absolutemouse & = ~ kdm_prompt ;
if ( ! topmenu | | ! topmenu - > keyevent )
Key_Dest_Remove ( kdm_menu ) ; //can't take key presses, so don't take keys.
if ( topmenu & & topmenu - > cursor )
key_dest_absolutemouse | = kdm_menu ;
else
key_dest_absolutemouse & = ~ kdm_menu ;
}
qboolean Menu_IsLinked ( menu_t * menu )
{
menu_t * link ;
for ( link = topmenu ; link ; link = link - > prev )
{
if ( menu = = link )
return true ;
}
return false ;
}
menu_t * Menu_FindContext ( void * ctx )
{
menu_t * link ;
for ( link = promptmenu ; link ; link = link - > prev )
{
if ( link - > ctx = = ctx )
return link ;
}
for ( link = topmenu ; link ; link = link - > prev )
{
if ( link - > ctx = = ctx )
return link ;
}
return NULL ;
}
void Menu_Unlink ( menu_t * menu )
{
menu_t * * link ;
for ( link = & promptmenu ; * link ; link = & ( * link ) - > prev )
{
if ( menu = = * link )
{
* link = menu - > prev ;
if ( menu - > release )
menu - > release ( menu ) ;
Menu_UpdateFocus ( ) ;
return ;
}
}
for ( link = & topmenu ; * link ; link = & ( * link ) - > prev )
{
if ( menu = = * link )
{
* link = menu - > prev ;
if ( menu - > release )
menu - > release ( menu ) ;
Menu_UpdateFocus ( ) ;
return ;
}
}
}
void Menu_Push ( menu_t * menu , qboolean prompt )
{
if ( ! Menu_IsLinked ( menu ) )
{ //only link once.
if ( prompt )
{
menu - > prev = promptmenu ;
promptmenu = menu ;
}
else
{
menu - > prev = topmenu ;
topmenu = menu ;
}
}
if ( menu = = promptmenu )
{
Key_Dest_Add ( kdm_prompt ) ;
Menu_UpdateFocus ( ) ;
}
if ( menu = = topmenu )
{
Key_Dest_Add ( kdm_menu ) ;
Menu_UpdateFocus ( ) ;
}
}
void Menu_PopAll ( void )
{
2019-09-25 20:23:24 +00:00
menu_t * * menus , * menu ;
size_t count , i ;
//first loop to count them
for ( count = 0 , menu = topmenu ; menu ; menu = menu - > prev )
2019-09-04 07:59:40 +00:00
{
if ( menu - > persist )
2019-09-25 20:23:24 +00:00
continue ;
count + + ;
2019-09-04 07:59:40 +00:00
}
2019-09-25 20:23:24 +00:00
menus = alloca ( sizeof ( * menus ) * count ) ;
//second loop to track them
for ( i = 0 , menu = topmenu ; i < count & & menu ; menu = menu - > prev )
{
if ( menu - > persist )
continue ;
menus [ i + + ] = menu ;
}
//third link to actually unlink them safely without unlinking multiple times etc (grr menuqc mods re-grabbing focus when closing)
for ( i = 0 ; i < count ; i + + )
Menu_Unlink ( menus [ i ] ) ;
2019-09-04 07:59:40 +00:00
}
void Menu_Draw ( void )
{
# ifdef MENU_DAT
//shitty always-drawn crap
MP_Draw ( ) ;
# endif
//draw whichever menu has focus
if ( topmenu & & topmenu - > drawmenu )
topmenu - > drawmenu ( topmenu ) ;
}
void Prompts_Draw ( void )
{
//prompts always appear over the top of everything else, particuarly other menus.
if ( promptmenu & & promptmenu - > drawmenu )
promptmenu - > drawmenu ( promptmenu ) ;
}
2014-09-02 02:44:43 +00:00
void M_DrawScalePic ( int x , int y , int w , int h , mpic_t * pic )
{
R2D_ScalePic ( x + ( ( vid . width - 320 ) > > 1 ) , y , w , h , pic ) ;
}
void M_DrawTextBox ( int x , int y , int width , int lines )
{
mpic_t * p ;
int cx , cy ;
int n ;
// draw left side
cx = x ;
cy = y ;
p = R2D_SafeCachePic ( " gfx/box_tl.lmp " ) ;
2015-05-14 03:06:58 +00:00
switch ( R_GetShaderSizes ( p , NULL , NULL , false ) )
{
case - 1 :
return ; //still pending
case 0 :
R2D_ImageColours ( 0.0 , 0.0 , 0.0 , 1.0 ) ;
R2D_FillBlock ( x + ( ( vid . width - 320 ) > > 1 ) , y , width * 8 + 16 , lines * 8 + 16 ) ;
R2D_ImageColours ( 1.0 , 1.0 , 1.0 , 1.0 ) ;
return ;
}
2014-09-02 02:44:43 +00:00
M_DrawScalePic ( cx , cy , 8 , 8 , p ) ;
p = R2D_SafeCachePic ( " gfx/box_ml.lmp " ) ;
if ( p )
for ( n = 0 ; n < lines ; n + + )
{
cy + = 8 ;
M_DrawScalePic ( cx , cy , 8 , 8 , p ) ;
}
p = R2D_SafeCachePic ( " gfx/box_bl.lmp " ) ;
if ( p )
M_DrawScalePic ( cx , cy + 8 , 8 , 8 , p ) ;
// draw middle
cx + = 8 ;
while ( width > 0 )
{
cy = y ;
p = R2D_SafeCachePic ( " gfx/box_tm.lmp " ) ;
if ( p )
M_DrawScalePic ( cx , cy , 16 , 8 , p ) ;
p = R2D_SafeCachePic ( " gfx/box_mm.lmp " ) ;
if ( p )
for ( n = 0 ; n < lines ; n + + )
{
cy + = 8 ;
if ( n = = 1 )
{
p = R2D_SafeCachePic ( " gfx/box_mm2.lmp " ) ;
if ( ! p )
break ;
}
M_DrawScalePic ( cx , cy , 16 , 8 , p ) ;
}
p = R2D_SafeCachePic ( " gfx/box_bm.lmp " ) ;
if ( p )
M_DrawScalePic ( cx , cy + 8 , 16 , 8 , p ) ;
width - = 2 ;
cx + = 16 ;
}
// draw right side
cy = y ;
p = R2D_SafeCachePic ( " gfx/box_tr.lmp " ) ;
if ( p )
M_DrawScalePic ( cx , cy , 8 , 8 , p ) ;
p = R2D_SafeCachePic ( " gfx/box_mr.lmp " ) ;
if ( p )
for ( n = 0 ; n < lines ; n + + )
{
cy + = 8 ;
M_DrawScalePic ( cx , cy , 8 , 8 , p ) ;
}
p = R2D_SafeCachePic ( " gfx/box_br.lmp " ) ;
if ( p )
M_DrawScalePic ( cx , cy + 8 , 8 , 8 , p ) ;
}
2019-09-04 07:59:40 +00:00
int QDECL M_FindKeysForBind ( int bindmap , const char * command , int * keylist , int * keymods , int keycount )
2014-09-02 02:44:43 +00:00
{
int count ;
2015-06-04 06:15:14 +00:00
int j , m ;
int l , p ;
2014-09-02 02:44:43 +00:00
char * b ;
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 firstmod , lastmod ;
2014-09-02 02:44:43 +00:00
l = strlen ( command ) ;
count = 0 ;
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 ( bindmap > 0 & & bindmap < = KEY_MODIFIER_ALTBINDMAP )
{
//bindmaps don't support modifiers
firstmod = ( bindmap - 1 ) | KEY_MODIFIER_ALTBINDMAP ;
lastmod = firstmod + 1 ;
}
else
{
firstmod = 0 ;
lastmod = KEY_MODIFIER_ALTBINDMAP ;
}
2015-11-18 07:37:39 +00:00
for ( j = 0 ; j < K_MAX ; j + + )
2014-09-02 02:44:43 +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
for ( m = firstmod ; m < lastmod ; m + + )
2014-09-02 02:44:43 +00:00
{
2015-06-04 06:15:14 +00:00
b = keybindings [ j ] [ m ] ;
if ( ! b )
continue ;
if ( ! strncmp ( b , command , l ) & & ( ! b [ l ] | | b [ l ] = = ' ' | | b [ l ] = = ' ; ' ) )
{
//if ctrl_a and ctrl_shift_a do the same thing, don't report ctrl_shift_a because its redundant.
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
for ( p = firstmod ; p < m ; p + + )
2015-06-04 06:15:14 +00:00
{
if ( p & ~ m ) //ignore shift_a if we're checking ctrl_a
continue ;
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 ( keybindings [ j ] [ p ] & & ! strcmp ( keybindings [ j ] [ p ] , b ) )
2015-06-04 06:15:14 +00:00
break ; //break+continue
}
if ( p ! = m )
continue ;
keylist [ count ] = j ;
if ( keymods )
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
keymods [ count ] = m ;
2015-06-04 06:15:14 +00:00
count + + ;
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 ( count = = keycount )
2015-06-04 06:15:14 +00:00
return count ;
}
2014-09-02 02:44:43 +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
for ( j = count ; j < keycount ; j + + )
2015-06-04 06:15:14 +00:00
{
keylist [ j ] = - 1 ;
if ( keymods )
keymods [ j ] = 0 ;
}
2014-09-02 02:44:43 +00:00
return count ;
}
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 M_FindKeysForCommand ( int bindmap , int pnum , const char * command , int * keylist , int * keymods , int keycount )
2014-09-02 02:44:43 +00:00
{
char prefix [ 5 ] ;
if ( * command = = ' + ' | | * command = = ' - ' )
{
prefix [ 0 ] = * command ;
prefix [ 1 ] = 0 ;
if ( pnum ! = 0 )
{
prefix [ 1 ] = ' p ' ;
prefix [ 2 ] = ' 0 ' + pnum ;
prefix [ 3 ] = ' ' ;
prefix [ 4 ] = 0 ;
}
command + + ;
}
else
{
prefix [ 0 ] = 0 ;
if ( pnum ! = 0 )
{
prefix [ 0 ] = ' p ' ;
prefix [ 1 ] = ' 0 ' + pnum ;
prefix [ 2 ] = ' ' ;
prefix [ 3 ] = 0 ;
}
}
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
return M_FindKeysForBind ( bindmap , va ( " %s%s " , prefix , command ) , keylist , keymods , keycount ) ;
2014-09-02 02:44:43 +00:00
}
2018-05-21 13:47:53 +00:00
/*
= = = = = = = = = = = = = = = =
M_ToggleMenu_f
= = = = = = = = = = = = = = = =
*/
void M_ToggleMenu_f ( void )
{
if ( topmenu )
{
2019-09-04 07:59:40 +00:00
Key_Dest_Add ( kdm_menu ) ;
2018-05-21 13:47:53 +00:00
return ;
}
# ifdef CSQC_DAT
if ( CSQC_ConsoleCommand ( - 1 , " togglemenu " ) )
{
Key_Dest_Remove ( kdm_console | kdm_cwindows ) ;
return ;
}
# endif
# ifdef MENU_DAT
if ( MP_Toggle ( 1 ) )
{
Key_Dest_Remove ( kdm_console | kdm_cwindows ) ;
return ;
}
# endif
# ifdef MENU_NATIVECODE
if ( mn_entry )
{
mn_entry - > Toggle ( 1 ) ;
Key_Dest_Remove ( kdm_console | kdm_cwindows ) ;
return ;
}
# endif
# ifdef VM_UI
if ( UI_OpenMenu ( ) )
return ;
# endif
# ifndef NOBUILTINMENUS
M_Menu_Main_f ( ) ;
Key_Dest_Remove ( kdm_console | kdm_cwindows ) ;
# endif
}
/*
= = = = = = = = = = = = = = = =
M_Restart_f
= = = = = = = = = = = = = = = =
*/
void M_Init_Internal ( void ) ;
void M_Restart_f ( void )
{
M_Shutdown ( false ) ;
if ( ! strcmp ( Cmd_Argv ( 1 ) , " off " ) )
{ //explicitly restart the engine's menu. not the menuqc crap
//don't even start csqc menus.
M_Init_Internal ( ) ;
}
else
M_Reinit ( ) ;
}
2019-09-04 07:59:40 +00:00
//=============================================================================
/* Various callback-based prompts */
typedef struct
{
menu_t m ;
2020-04-19 01:23:32 +00:00
void ( * callback ) ( void * , promptbutton_t ) ;
2019-09-04 07:59:40 +00:00
void * ctx ;
int lines ;
const char * messages ;
const char * buttons [ 3 ] ;
int kbutton , mbutton ;
2020-04-19 01:23:32 +00:00
qboolean mousedown ;
2019-09-04 07:59:40 +00:00
} promptmenu_t ;
static qboolean Prompt_MenuKeyEvent ( struct menu_s * gm , qboolean isdown , unsigned int devid , int key , int unicode )
{
promptmenu_t * m = ( promptmenu_t * ) gm ;
2020-04-19 01:23:32 +00:00
promptbutton_t action ;
void ( * callback ) ( void * , promptbutton_t ) = m - > callback ;
2019-09-04 07:59:40 +00:00
void * ctx = m - > ctx ;
extern qboolean keydown [ ] ;
2020-04-19 01:23:32 +00:00
if ( key = = K_MOUSE1 )
{ //mouse events fire their action on release.
if ( isdown )
{
m - > mousedown = true ; //so we don't respond to stray release events.
return true ;
}
else if ( ! m - > mousedown )
return false ; //looks like a stray release event. ignore it.
}
else
{ //keyboard events fire on press.
if ( ! isdown )
return false ;
}
2019-09-04 07:59:40 +00:00
if ( key = = ' n ' | | key = = ' N ' )
2020-04-19 01:23:32 +00:00
action = PROMPT_NO ;
2019-09-04 07:59:40 +00:00
else if ( key = = ' y ' | | key = = ' Y ' )
2020-04-19 01:23:32 +00:00
action = PROMPT_YES ;
2019-09-04 07:59:40 +00:00
else if ( key = = K_RIGHTARROW | | key = = K_GP_DPAD_RIGHT | | key = = K_DOWNARROW | | key = = K_GP_DPAD_DOWN | | ( key = = K_TAB & & ! keydown [ K_LSHIFT ] & & ! keydown [ K_RSHIFT ] ) )
{
for ( ; ; )
{
m - > kbutton + + ;
if ( m - > kbutton > = 3 )
m - > kbutton - = 3 ;
if ( m - > buttons [ m - > kbutton ] )
break ;
}
return true ;
}
else if ( key = = K_LEFTARROW | | key = = K_GP_DPAD_LEFT | | key = = K_UPARROW | | key = = K_GP_DPAD_UP | | key = = K_TAB )
{
for ( ; ; )
{
m - > kbutton - - ;
if ( m - > kbutton < 0 )
m - > kbutton + = 3 ;
if ( m - > buttons [ m - > kbutton ] )
break ;
}
return true ;
}
else if ( key = = K_ESCAPE | | key = = K_GP_BACK | | key = = K_MOUSE2 )
2020-04-19 01:23:32 +00:00
action = PROMPT_CANCEL ;
2019-09-04 07:59:40 +00:00
else if ( key = = K_ENTER | | key = = K_KP_ENTER | | key = = K_MOUSE1 | | key = = K_GP_A )
{
2020-04-19 01:23:32 +00:00
int button ;
2019-09-04 07:59:40 +00:00
if ( key = = K_MOUSE1 )
2020-04-19 01:23:32 +00:00
button = m - > mbutton ;
2019-09-04 07:59:40 +00:00
else
2020-04-19 01:23:32 +00:00
button = m - > kbutton ;
2019-09-04 07:59:40 +00:00
2020-04-19 01:23:32 +00:00
switch ( button )
{
case 0 :
action = PROMPT_YES ;
break ;
case 1 :
action = PROMPT_NO ;
break ;
case 2 :
action = PROMPT_CANCEL ;
break ;
default :
return false ; //nothing focused.
}
2019-09-04 07:59:40 +00:00
}
else
return false ; // no idea what that is
m - > callback = NULL ; //so the remove handler can't fire.
Menu_Unlink ( & m - > m ) ;
if ( callback )
callback ( ctx , action ) ;
return true ;
}
static void Prompt_Draw ( struct menu_s * g )
{
promptmenu_t * m = ( promptmenu_t * ) g ;
int x = 64 ;
int y = 76 ;
2020-04-19 01:23:32 +00:00
float scale = Font_CharVHeight ( font_console ) ;
2020-08-13 10:09:39 +00:00
int w = 320 * scale / 8 ;
2020-04-19 01:23:32 +00:00
int h = ( m - > lines + 3 ) * scale ;
2019-09-04 07:59:40 +00:00
int i ;
const char * msg = m - > messages ;
int bx [ 4 ] ;
x = ( ( vid . width - w ) > > 1 ) ;
2020-04-19 01:23:32 +00:00
Draw_ApproxTextBox ( x , y , w , h ) ;
y + = scale ;
2019-09-04 07:59:40 +00:00
for ( i = 0 ; i < m - > lines ; i + + , msg = msg + strlen ( msg ) + 1 )
{
2020-04-19 01:23:32 +00:00
Draw_FunStringWidthFont ( font_console , x , y , msg , w , 2 , false ) ;
y + = scale ;
2019-09-04 07:59:40 +00:00
}
2020-04-19 01:23:32 +00:00
y + = scale ;
2019-09-04 07:59:40 +00:00
m - > mbutton = - 1 ;
bx [ 0 ] = x ;
bx [ 1 ] = x + w / 3 ;
bx [ 2 ] = x + w - w / 3 ;
bx [ 3 ] = x + w ;
2020-04-19 01:23:32 +00:00
if ( mousecursor_y > = y & & mousecursor_y < = y + scale )
2019-09-04 07:59:40 +00:00
{
for ( i = 0 ; i < 3 ; i + + )
{
if ( m - > buttons [ i ] & & mousecursor_x > = bx [ i ] & & mousecursor_x < bx [ i + 1 ] )
m - > mbutton = i ;
}
}
for ( i = 0 ; i < 3 ; i + + )
{
if ( m - > buttons [ i ] )
{
if ( m - > mbutton = = i )
{
float alphamax = 0.5 , alphamin = 0.2 ;
R2D_ImageColours ( .5 , .4 , 0 , ( sin ( realtime * 2 ) + 1 ) * 0.5 * ( alphamax - alphamin ) + alphamin ) ;
2020-04-19 01:23:32 +00:00
R2D_FillBlock ( bx [ i ] , y , bx [ i + 1 ] - bx [ i ] , scale ) ;
2019-09-04 07:59:40 +00:00
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ;
}
2020-04-19 01:23:32 +00:00
Draw_FunStringWidthFont ( font_console , bx [ i ] , y , m - > buttons [ i ] , bx [ i + 1 ] - bx [ i ] , 2 , m - > kbutton = = i ) ;
2019-09-04 07:59:40 +00:00
}
}
}
static void Prompt_Release ( struct menu_s * gm )
{
promptmenu_t * m = ( promptmenu_t * ) gm ;
2020-04-19 01:23:32 +00:00
void ( * callback ) ( void * , promptbutton_t ) = m - > callback ;
2019-09-04 07:59:40 +00:00
void * ctx = m - > ctx ;
m - > callback = NULL ;
if ( callback )
2020-04-19 01:23:32 +00:00
callback ( ctx , PROMPT_CANCEL ) ;
2019-09-04 07:59:40 +00:00
Z_Free ( m ) ;
}
2020-08-13 08:39:48 +00:00
void Menu_Prompt ( void ( * callback ) ( void * , promptbutton_t ) , void * ctx , const char * messages , const char * optionyes , const char * optionno , const char * optioncancel )
2019-09-04 07:59:40 +00:00
{
promptmenu_t * m ;
char * t ;
m = ( promptmenu_t * ) Z_Malloc ( sizeof ( * m ) + strlen ( messages ) + ( optionyes ? strlen ( optionyes ) : 0 ) + ( optionno ? strlen ( optionno ) : 0 ) + ( optioncancel ? strlen ( optioncancel ) : 0 ) + 7 ) ;
m - > m . 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 * ) ;
*/
m - > m . drawmenu = Prompt_Draw ;
m - > m . keyevent = Prompt_MenuKeyEvent ;
m - > m . release = Prompt_Release ;
m - > mbutton = - 1 ;
m - > kbutton = - 1 ;
Menu_Push ( & m - > m , true ) ;
m - > callback = callback ;
m - > ctx = ctx ;
t = ( char * ) ( m + 1 ) ;
if ( optionyes )
{
m - > buttons [ 0 ] = t ;
strcpy ( t , optionyes ) ;
t + = strlen ( t ) + 1 ;
}
if ( optionno )
{
m - > buttons [ 1 ] = t ;
strcpy ( t , optionno ) ;
t + = strlen ( t ) + 1 ;
}
if ( optioncancel )
{
m - > buttons [ 2 ] = t ;
strcpy ( t , optioncancel ) ;
t + = strlen ( t ) + 1 ;
}
m - > messages = t ;
strcpy ( t , messages ) ;
for ( messages = t ; t ; )
{
t = strchr ( t , ' \n ' ) ;
if ( t )
* t + + = 0 ;
m - > lines + + ;
}
}
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
void M_Menu_Audio_f ( void ) ;
void M_Menu_Demos_f ( void ) ;
2014-03-30 08:55:06 +00:00
void M_Menu_Mods_f ( void ) ;
void M_Menu_ModelViewer_f ( void ) ;
2018-10-11 10:31:23 +00:00
void M_Menu_ModelViewer_c ( int argn , const char * partial , struct xcommandargcompletioncb_s * ctx ) ;
2004-08-23 00:15:46 +00:00
void M_ConfigureNetSubsystem ( void ) ;
2016-09-08 19:04:35 +00:00
cvar_t m_helpismedia = CVAR ( " m_helpismedia " , " 0 " ) ;
2012-04-24 07:59:11 +00:00
cvar_t m_preset_chosen = CVARF ( " m_preset_chosen " , " 0 " , CVAR_ARCHIVE ) ;
2004-08-23 00:15:46 +00:00
//=============================================================================
/* Support Routines */
void M_Print ( int cx , int cy , qbyte * str )
{
2009-11-04 21:16:50 +00:00
Draw_AltFunString ( cx + ( ( vid . width - 320 ) > > 1 ) , cy , str ) ;
2004-08-23 00:15:46 +00:00
}
void M_PrintWhite ( int cx , int cy , qbyte * str )
{
2009-11-04 21:16:50 +00:00
Draw_FunString ( cx + ( ( vid . width - 320 ) > > 1 ) , cy , str ) ;
2004-08-23 00:15:46 +00:00
}
2014-10-11 19:39:45 +00:00
void M_BuildTranslationTable ( unsigned int pc , unsigned int top , unsigned int bottom , unsigned int * translationTable )
2004-08-23 00:15:46 +00:00
{
int j ;
2014-09-17 03:04:08 +00:00
# ifdef HEXEN2
2010-08-28 17:14:38 +00:00
if ( h2playertranslations & & pc )
{
int i ;
unsigned int color_offsets [ 5 ] = { 2 * 14 * 256 , 0 , 1 * 14 * 256 , 2 * 14 * 256 , 2 * 14 * 256 } ;
unsigned char * colorA , * colorB , * sourceA , * sourceB ;
colorA = h2playertranslations + 256 + color_offsets [ pc - 1 ] ;
colorB = colorA + 256 ;
sourceA = colorB + ( top * 256 ) ;
sourceB = colorB + ( bottom * 256 ) ;
2014-03-30 08:55:06 +00:00
for ( i = 0 ; i < 255 ; i + + )
2010-08-28 17:14:38 +00:00
{
2011-05-19 13:34:07 +00:00
if ( bottom > 0 & & ( colorB [ i ] ! = 255 ) )
2014-10-11 19:39:45 +00:00
{
if ( bottom > = 16 )
{
unsigned int v = d_8to24rgbtable [ colorB [ i ] ] ;
v = max ( max ( ( v > > 0 ) & 0xff , ( v > > 8 ) & 0xff ) , ( v > > 16 ) & 0xff ) ;
* ( ( unsigned char * ) & translationTable [ i ] + 0 ) = ( ( ( bottom & 0xff0000 ) > > 16 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ i ] + 1 ) = ( ( ( bottom & 0x00ff00 ) > > 8 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ i ] + 2 ) = ( ( ( bottom & 0x0000ff ) > > 0 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ i ] + 3 ) = 0xff ;
}
else
translationTable [ i ] = d_8to24rgbtable [ sourceB [ i ] ] | 0xff000000 ;
}
2011-05-19 13:34:07 +00:00
else if ( top > 0 & & ( colorA [ i ] ! = 255 ) )
2014-10-11 19:39:45 +00:00
{
if ( top > = 16 )
{
unsigned int v = d_8to24rgbtable [ colorA [ i ] ] ;
v = max ( max ( ( v > > 0 ) & 0xff , ( v > > 8 ) & 0xff ) , ( v > > 16 ) & 0xff ) ;
* ( ( unsigned char * ) & translationTable [ i ] + 0 ) = ( ( ( top & 0xff0000 ) > > 16 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ i ] + 1 ) = ( ( ( top & 0x00ff00 ) > > 8 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ i ] + 2 ) = ( ( ( top & 0x0000ff ) > > 0 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ i ] + 3 ) = 0xff ;
}
else
translationTable [ i ] = d_8to24rgbtable [ sourceA [ i ] ] | 0xff000000 ;
}
2010-08-28 17:14:38 +00:00
else
2014-03-30 08:55:06 +00:00
translationTable [ i ] = d_8to24rgbtable [ i ] | 0xff000000 ;
2010-08-28 17:14:38 +00:00
}
}
2004-08-23 00:15:46 +00:00
else
2014-09-17 03:04:08 +00:00
# endif
2010-08-28 17:14:38 +00:00
{
2014-03-30 08:55:06 +00:00
for ( j = 0 ; j < 255 ; j + + )
{
if ( j > = TOP_RANGE & & j < TOP_RANGE + ( 1 < < 4 ) )
{
if ( top > = 16 )
{
* ( ( unsigned char * ) & translationTable [ j ] + 0 ) = ( ( ( top & 0xff0000 ) > > 16 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ j & 15 ] + 0 ) ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ j ] + 1 ) = ( ( ( top & 0x00ff00 ) > > 8 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ j & 15 ] + 1 ) ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ j ] + 2 ) = ( ( ( top & 0x0000ff ) > > 0 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ j & 15 ] + 2 ) ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ j ] + 3 ) = 0xff ;
}
else
translationTable [ j ] = d_8to24rgbtable [ top < 8 ? j - TOP_RANGE + ( top < < 4 ) : ( top < < 4 ) + 15 - ( j - TOP_RANGE ) ] | 0xff000000 ;
}
else if ( j > = BOTTOM_RANGE & & j < BOTTOM_RANGE + ( 1 < < 4 ) )
{
if ( bottom > = 16 )
{
* ( ( unsigned char * ) & translationTable [ j ] + 0 ) = ( ( ( bottom & 0xff0000 ) > > 16 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ j & 15 ] + 0 ) ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ j ] + 1 ) = ( ( ( bottom & 0x00ff00 ) > > 8 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ j & 15 ] + 1 ) ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ j ] + 2 ) = ( ( ( bottom & 0x0000ff ) > > 0 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ j & 15 ] + 2 ) ) > > 8 ;
* ( ( unsigned char * ) & translationTable [ j ] + 3 ) = 0xff ;
}
else
translationTable [ j ] = d_8to24rgbtable [ bottom < 8 ? j - BOTTOM_RANGE + ( bottom < < 4 ) : ( bottom < < 4 ) + 15 - ( j - BOTTOM_RANGE ) ] | 0xff000000 ;
}
else
translationTable [ j ] = d_8to24rgbtable [ j ] | 0xff000000 ;
}
2010-08-28 17:14:38 +00:00
}
2014-03-30 08:55:06 +00:00
translationTable [ 255 ] = 0 ; //alpha
2004-08-23 00:15:46 +00:00
}
//=============================================================================
2009-07-14 15:04:32 +00:00
void M_CloseMenu_f ( void )
{
2019-09-04 07:59:40 +00:00
if ( ! Key_Dest_Has ( kdm_menu ) )
2009-07-14 15:04:32 +00:00
return ;
2015-07-14 14:47:00 +00:00
M_RemoveAllMenus ( false ) ;
2009-07-14 15:04:32 +00:00
}
2004-08-23 00:15:46 +00:00
//=============================================================================
/* KEYS MENU */
typedef struct {
char * command ;
char * name ;
} bindnames_t ;
bindnames_t qwbindnames [ ] =
{
2006-01-28 06:41:20 +00:00
{ " +attack " , " attack " } ,
{ " impulse 10 " , " change weapon " } ,
{ " impulse 12 " , " prev weapon " } ,
2004-08-23 00:15:46 +00:00
{ " +jump " , " jump / swim up " } ,
2006-01-28 06:41:20 +00:00
{ " +forward " , " walk forward " } ,
{ " +back " , " backpedal " } ,
{ " +left " , " turn left " } ,
{ " +right " , " turn right " } ,
{ " +speed " , " run " } ,
{ " +moveleft " , " step left " } ,
{ " +moveright " , " step right " } ,
{ " +strafe " , " sidestep " } ,
{ " +lookup " , " look up " } ,
{ " +lookdown " , " look down " } ,
{ " centerview " , " center view " } ,
{ " +mlook " , " mouse look " } ,
{ " +klook " , " keyboard look " } ,
{ " +moveup " , " swim up " } ,
{ " +movedown " , " swim down " } ,
2011-01-04 02:56:16 +00:00
# ifdef VOICECHAT
{ " +voip " , " voice chat " } ,
# endif
2004-08-23 00:15:46 +00:00
{ NULL }
} ;
# ifdef Q2CLIENT
bindnames_t q2bindnames [ ] =
{
2006-01-28 06:41:20 +00:00
{ " +attack " , " attack " } ,
{ " cmd weapnext " , " next weapon " } ,
2016-01-18 05:22:07 +00:00
{ " cmd weapprev " , " prev weapon " } ,
2006-01-28 06:41:20 +00:00
{ " +forward " , " walk forward " } ,
{ " +back " , " backpedal " } ,
{ " +left " , " turn left " } ,
{ " +right " , " turn right " } ,
{ " +speed " , " run " } ,
{ " +moveleft " , " step left " } ,
{ " +moveright " , " step right " } ,
{ " +strafe " , " sidestep " } ,
{ " +lookup " , " look up " } ,
{ " +lookdown " , " look down " } ,
{ " centerview " , " center view " } ,
{ " +mlook " , " mouse look " } ,
{ " +klook " , " keyboard look " } ,
{ " +moveup " , " up / jump " } ,
{ " +movedown " , " down / crouch " } ,
{ " cmd inven " , " inventory " } ,
{ " cmd invuse " , " use item " } ,
{ " cmd invdrop " , " drop item " } ,
{ " cmd invprev " , " prev item " } ,
{ " cmd invnext " , " next item " } ,
{ " cmd help " , " help computer " } ,
2004-08-23 00:15:46 +00:00
{ NULL }
} ;
# endif
2007-05-25 22:16:29 +00:00
bindnames_t h2bindnames [ ] =
{
{ " +attack " , " attack " } ,
{ " impulse 10 " , " change weapon " } ,
{ " +jump " , " jump / swim up " } ,
{ " +forward " , " walk forward " } ,
{ " +back " , " backpedal " } ,
{ " +left " , " turn left " } ,
{ " +right " , " turn right " } ,
{ " +speed " , " run " } ,
{ " +moveleft " , " step left " } ,
{ " +moveright " , " step right " } ,
{ " +strafe " , " sidestep " } ,
{ " +crouch " , " crouch " } ,
{ " +lookup " , " look up " } ,
{ " +lookdown " , " look down " } ,
{ " centerview " , " center view " } ,
{ " +mlook " , " mouse look " } ,
{ " +klook " , " keyboard look " } ,
{ " +moveup " , " swim up " } ,
{ " +movedown " , " swim down " } ,
{ " impulse 13 " , " lift object " } ,
{ " invuse " , " use inv item " } ,
{ " impulse 44 " , " drop inv item " } ,
{ " +showinfo " , " full inventory " } ,
{ " +showdm " , " info / frags " } ,
//{"toggle_dm", "toggle frags "},
2010-08-16 02:03:02 +00:00
{ " +infoplaque " , " objectives " } , //requires pulling info out of the mod... on the client.
2007-05-25 22:16:29 +00:00
{ " invleft " , " inv move left " } ,
{ " invright " , " inv move right " } ,
{ " impulse 100 " , " inv:torch " } ,
{ " impulse 101 " , " inv:qrtz flask " } ,
{ " impulse 102 " , " inv:mystic urn " } ,
{ " impulse 103 " , " inv:krater " } ,
{ " impulse 104 " , " inv:chaos devc " } ,
{ " impulse 105 " , " inv:tome power " } ,
{ " impulse 106 " , " inv:summon stn " } ,
{ " impulse 107 " , " inv:invisiblty " } ,
{ " impulse 108 " , " inv:glyph " } ,
{ " impulse 109 " , " inv:boots " } ,
{ " impulse 110 " , " inv:repulsion " } ,
{ " impulse 111 " , " inv:bo peep " } ,
{ " impulse 112 " , " inv:flight " } ,
{ " impulse 113 " , " inv:force cube " } ,
{ " impulse 114 " , " inv:icon defn " } ,
2011-01-04 02:56:16 +00:00
# ifdef VOICECHAT
{ " +voip " , " voice chat " } ,
# endif
2007-05-25 22:16:29 +00:00
{ NULL }
} ;
2004-08-23 00:15:46 +00:00
bindnames_t * bindnames ;
int numbindnames ;
int keys_cursor ;
int bind_grab ;
void M_Menu_Keys_f ( void )
2006-01-28 06:41:20 +00:00
{
int y ;
2019-09-04 07:59:40 +00:00
emenu_t * menu ;
2014-05-10 13:42:13 +00:00
vfsfile_t * bindslist ;
2018-03-25 09:36:14 +00:00
# if MAX_SPLITS > 1
2016-01-18 05:22:07 +00:00
extern cvar_t cl_splitscreen ;
2018-03-25 09:36:14 +00:00
# endif
2006-01-29 00:50:13 +00:00
2006-01-28 06:41:20 +00:00
menu = M_CreateMenu ( 0 ) ;
2014-10-05 20:04:11 +00:00
switch ( M_GameType ( ) )
2010-08-16 02:03:02 +00:00
{
2014-10-05 20:04:11 +00:00
# ifdef Q2CLIENT
case MGT_QUAKE2 :
2019-01-13 16:51:50 +00:00
MC_AddCenterPicture ( menu , 0 , 60 , " pics/m_banner_customize.pcx " ) ;
2010-08-16 02:03:02 +00:00
y = 48 ;
2006-01-28 06:41:20 +00:00
bindnames = q2bindnames ;
2014-10-05 20:04:11 +00:00
break ;
2006-01-28 06:41:20 +00:00
# endif
2014-10-05 20:04:11 +00:00
# ifdef HEXEN2
case MGT_HEXEN2 :
2010-08-16 02:03:02 +00:00
MC_AddCenterPicture ( menu , 0 , 60 , " gfx/menu/title6.lmp " ) ;
y = 64 ;
2007-05-25 22:16:29 +00:00
bindnames = h2bindnames ;
2014-10-05 20:04:11 +00:00
break ;
# endif
default :
2010-08-16 02:03:02 +00:00
MC_AddCenterPicture ( menu , 4 , 24 , " gfx/ttl_cstm.lmp " ) ;
y = 48 ;
2006-01-28 06:41:20 +00:00
bindnames = qwbindnames ;
2014-10-05 20:04:11 +00:00
break ;
2010-08-16 02:03:02 +00:00
}
2018-03-25 09:36:14 +00:00
# if MAX_SPLITS > 1
2016-01-18 05:22:07 +00:00
if ( cl . splitclients | | cl_splitscreen . ival | | cl_forceseat . ival )
2010-08-16 02:03:02 +00:00
{
static char * texts [ MAX_SPLITS + 2 ] =
{
" Depends on device " ,
" Player 1 " ,
" Player 2 " ,
2018-03-25 09:36:14 +00:00
# if MAX_SPLITS >= 3
2010-08-16 02:03:02 +00:00
" Player 3 " ,
2018-03-25 09:36:14 +00:00
# endif
# if MAX_SPLITS >= 4
2010-08-16 02:03:02 +00:00
" Player 4 " ,
2018-03-25 09:36:14 +00:00
# endif
2010-08-16 02:03:02 +00:00
NULL
} ;
static char * values [ MAX_SPLITS + 1 ] =
{
" 0 " ,
" 1 " ,
" 2 " ,
2018-03-25 09:36:14 +00:00
# if MAX_SPLITS >= 3
2010-08-16 02:03:02 +00:00
" 3 " ,
2018-03-25 09:36:14 +00:00
# endif
# if MAX_SPLITS >= 4
2010-08-16 02:03:02 +00:00
" 4 "
2018-03-25 09:36:14 +00:00
# endif
2010-08-16 02:03:02 +00:00
} ;
2015-03-03 00:14:43 +00:00
MC_AddCvarCombo ( menu , 16 , 170 , y , " Force client " , & cl_forceseat , ( const char * * ) texts , ( const char * * ) values ) ;
2010-08-16 02:03:02 +00:00
y + = 8 ;
}
2018-03-25 09:36:14 +00:00
# endif
2006-01-28 06:41:20 +00:00
2014-05-10 13:42:13 +00:00
bindslist = FS_OpenVFS ( " bindlist.lst " , " rb " , FS_GAME ) ;
if ( bindslist )
{
char line [ 1024 ] ;
while ( VFS_GETS ( bindslist , line , sizeof ( line ) ) )
{
2014-05-10 17:26:41 +00:00
char * cmd , * desc , * tip ;
2014-05-10 13:42:13 +00:00
Cmd_TokenizeString ( line , false , false ) ;
2014-05-10 17:26:41 +00:00
cmd = Cmd_Argv ( 0 ) ;
desc = Cmd_Argv ( 1 ) ;
tip = Cmd_Argv ( 2 ) ;
if ( * cmd )
{
if ( strcmp ( cmd , " - " ) ) //lines with a command of "-" are spacers/comments.
MC_AddBind ( menu , ( 320 - ( int ) vid . width ) / 2 , 170 , y , desc , cmd , tip ) ;
else if ( * desc )
MC_AddRedText ( menu , ( 320 - ( int ) vid . width ) / 2 , 170 , y , desc , true ) ;
y + = 8 ;
}
2014-05-10 13:42:13 +00:00
}
VFS_CLOSE ( bindslist ) ;
return ;
}
2019-01-13 16:51:50 +00:00
MC_AddFrameStart ( menu , 48 + 8 ) ;
2006-01-28 06:41:20 +00:00
while ( bindnames - > name )
{
2014-05-10 17:26:41 +00:00
MC_AddBind ( menu , 16 , 170 , y , bindnames - > name , bindnames - > command , NULL ) ;
2006-01-28 06:41:20 +00:00
y + = 8 ;
bindnames + + ;
}
2019-01-13 16:51:50 +00:00
MC_AddFrameEnd ( menu , 48 + 8 ) ;
2006-01-28 06:41:20 +00:00
}
2004-08-23 00:15:46 +00:00
2014-03-30 08:55:06 +00:00
void M_UnbindCommand ( const char * command )
2004-08-23 00:15:46 +00:00
{
int j ;
int l ;
char * b ;
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 m ;
2004-08-23 00:15:46 +00:00
l = strlen ( command ) ;
for ( j = 0 ; j < 256 ; 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
{ //FIXME: not sure what to do about bindmaps here. oh well.
for ( m = 0 ; m < KEY_MODIFIERSTATES ; m + + )
{
b = keybindings [ j ] [ m ] ;
if ( ! b )
continue ;
if ( ! strncmp ( b , command , l ) )
Key_SetBinding ( j , m , " " , RESTRICT_LOCAL ) ;
}
2004-08-23 00:15:46 +00:00
}
}
//=============================================================================
/* HELP MENU */
2020-06-27 19:32:36 +00:00
static int help_page ;
static int num_help_pages ;
2004-08-23 00:15:46 +00:00
2020-06-27 19:32:36 +00:00
static struct
2014-03-30 08:55:06 +00:00
{
char * pattern ;
int base ;
} helpstyles [ ] =
{
{ " gfx/help%i.dxt " , 0 } , //quake extended
{ " gfx/help%i.tga " , 0 } , //quake extended
{ " gfx/help%i.png " , 0 } , //quake extended
{ " gfx/help%i.jpeg " , 0 } , //quake extended
{ " gfx/help%i.lmp " , 0 } , //quake
{ " gfx/menu/help%02i.lmp " , 1 } //hexen2
} ;
2004-08-23 00:15:46 +00:00
2019-09-04 07:59:40 +00:00
void M_Help_Draw ( emenu_t * m )
2004-08-23 00:15:46 +00:00
{
2014-03-30 08:55:06 +00:00
int i ;
mpic_t * pic = NULL ;
for ( i = 0 ; i < sizeof ( helpstyles ) / sizeof ( helpstyles [ 0 ] ) & & ! pic ; i + + )
2014-10-05 20:04:11 +00:00
{
2014-03-30 08:55:06 +00:00
pic = R2D_SafeCachePic ( va ( helpstyles [ i ] . pattern , help_page + helpstyles [ i ] . base ) ) ;
2014-10-05 20:04:11 +00:00
if ( R_GetShaderSizes ( pic , NULL , NULL , true ) < = 0 )
pic = NULL ;
}
2004-08-23 00:15:46 +00:00
if ( ! pic )
M_Menu_Main_f ( ) ;
else
2017-04-18 11:12:17 +00:00
{
//define default aspect ratio
int width = 320 ;
int height = 200 ;
2004-08-23 00:15:46 +00:00
2017-04-18 11:12:17 +00:00
//figure out which axis we're meeting.
if ( vid . width / ( float ) width > vid . height / ( float ) height )
{
width = width * ( vid . height / ( float ) height ) ;
height = vid . height ;
}
else
{
height = height * ( vid . width / ( float ) width ) ;
width = vid . width ;
}
R2D_ScalePic ( ( vid . width - width ) / 2 , ( vid . height - height ) / 2 , width , height , pic ) ;
}
}
2019-09-04 07:59:40 +00:00
qboolean M_Help_Key ( int key , emenu_t * m )
2004-08-23 00:15:46 +00:00
{
switch ( key )
{
case K_ESCAPE :
2017-08-16 02:14:07 +00:00
case K_GP_BACK :
2014-08-27 08:41:31 +00:00
case K_MOUSE2 :
2020-01-20 17:53:39 +00:00
M_RemoveMenu ( m ) ;
2017-04-18 11:12:17 +00:00
return true ;
2005-11-03 23:49:49 +00:00
2004-08-23 00:15:46 +00:00
case K_UPARROW :
case K_RIGHTARROW :
2017-08-16 02:14:07 +00:00
case K_KP_RIGHTARROW :
case K_GP_DPAD_RIGHT :
2014-08-27 08:41:31 +00:00
case K_MOUSE1 :
2006-01-01 09:01:15 +00:00
S_LocalSound ( " misc/menu2.wav " ) ;
2004-08-23 00:15:46 +00:00
if ( + + help_page > = num_help_pages )
help_page = 0 ;
2017-04-18 11:12:17 +00:00
return true ;
2004-08-23 00:15:46 +00:00
case K_DOWNARROW :
case K_LEFTARROW :
2017-08-16 02:14:07 +00:00
case K_KP_LEFTARROW :
case K_GP_DPAD_LEFT :
2006-01-01 09:01:15 +00:00
S_LocalSound ( " misc/menu2.wav " ) ;
2004-08-23 00:15:46 +00:00
if ( - - help_page < 0 )
help_page = num_help_pages - 1 ;
2017-04-18 11:12:17 +00:00
return true ;
default :
return false ;
2004-08-23 00:15:46 +00:00
}
2017-04-18 11:12:17 +00:00
}
void M_Menu_Help_f ( void )
{
int i ;
2020-06-27 19:32:36 +00:00
emenu_t * helpmenu ;
# ifdef CSQC_DAT
if ( CSQC_ConsoleCommand ( CL_TargettedSplit ( false ) , Cmd_Argv ( 0 ) ) )
; //return;
# endif
helpmenu = M_CreateMenu ( 0 ) ;
2017-04-18 11:12:17 +00:00
helpmenu - > predraw = M_Help_Draw ;
helpmenu - > key = M_Help_Key ;
help_page = 0 ;
2004-08-23 00:15:46 +00:00
2017-04-18 11:12:17 +00:00
num_help_pages = 1 ;
while ( num_help_pages < 100 )
{
for ( i = 0 ; i < sizeof ( helpstyles ) / sizeof ( helpstyles [ 0 ] ) ; i + + )
{
if ( COM_FCheckExists ( va ( helpstyles [ i ] . pattern , num_help_pages + helpstyles [ i ] . base ) ) )
break ;
}
if ( i = = sizeof ( helpstyles ) / sizeof ( helpstyles [ 0 ] ) )
break ;
num_help_pages + + ;
}
2004-08-23 00:15:46 +00:00
}
//=============================================================================
/* QUIT MENU */
2019-09-04 07:59:40 +00:00
static char * quitMessage [ ] =
2004-08-23 00:15:46 +00:00
{
/* .........1.........2.... */
2019-09-04 07:59:40 +00:00
" Are you gonna quit \n "
" this game just like \n "
" everything else? " ,
" Milord, methinks that \n "
" thou art a lowly \n "
" quitter. Is this true? " ,
" Do I need to bust your \n "
" face open for trying \n "
" to quit? " ,
" Man, I oughta smack you \n "
" for trying to quit! \n "
" Press Y to get \n "
" smacked out. " ,
" Press Y to quit like a \n "
" big loser in life. \n "
" Press N to stay proud \n "
" and successful! " ,
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
//this is a vanilla message... but I'm having enough issues with false-positives in malware scanners right now that I really don't want to risk an already-suspicious actual hunam seeing stuff like this... :)
/* "If you press Y to\n"
2019-09-04 07:59:40 +00:00
" quit, I will summon \n "
" Satan all over your \n "
" hard drive! " ,
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
*/
2019-09-04 07:59:40 +00:00
" Um, Asmodeus dislikes \n "
" his children trying to \n "
" quit. Press Y to return \n "
" to your Tinkertoys. " ,
" If you quit now, I'll \n "
" throw a blanket-party \n "
" for you next time! " ,
2020-06-27 19:32:36 +00:00
// "Only cowards press Y here.\n",
// "Is your life empty and\n"
// "devoid of enjoyment?\n",
// "Are you off to play with\n"
// "your joy stick now?\n",
2004-08-23 00:15:46 +00:00
} ;
2019-09-04 07:59:40 +00:00
/* char *cmsg[] = {
// 0123456789012345678901234567890123456789
2004-08-23 00:15:46 +00:00
" 0 QuakeWorld " ,
" 1 version " VSTR2 ( VERSION ) ,
" 1modified by Forethought Entertainment " ,
2005-11-03 23:49:49 +00:00
" 0Based on QuakeWorld Version 2.40 " ,
2004-08-23 00:15:46 +00:00
" 1 " ,
" 0Additional Programming " ,
" 1 David Walton " ,
" 1 " ,
" 0Id Software is not responsible for " ,
" 0providing technical support for " ,
" 0QUAKEWORLD(tm). (c)1996 Id Software, " ,
" 0Inc. All Rights Reserved. " ,
" 0QUAKEWORLD(tm) is a trademark of Id " ,
" 0Software, Inc. " ,
" 1NOTICE: THE COPYRIGHT AND TRADEMARK " ,
" 1NOTICES APPEARING IN YOUR COPY OF " ,
" 1QUAKE(r) ARE NOT MODIFIED BY THE USE " ,
" 1OF QUAKEWORLD(tm) AND REMAIN IN FULL " ,
" 1FORCE. " ,
" 0NIN(r) is a registered trademark " ,
" 0licensed to Nothing Interactive, Inc. " ,
" 0All rights reserved. Press y to exit " ,
2019-09-04 07:59:40 +00:00
NULL } ; */
2004-08-23 00:15:46 +00:00
2019-09-04 07:59:40 +00:00
void Cmd_WriteConfig_f ( void ) ;
2020-04-19 01:23:32 +00:00
static void M_Menu_DoQuit ( void * ctx , promptbutton_t option )
2004-08-23 00:15:46 +00:00
{
2020-04-19 01:23:32 +00:00
if ( option = = PROMPT_YES ) //'yes - quit'
2019-09-04 07:59:40 +00:00
Cmd_ExecuteString ( " menu_quit force \n " , RESTRICT_LOCAL ) ;
2020-04-19 01:23:32 +00:00
// else if (option == PROMPT_NO) //'no - don't quit'
// else if (option == PROMPT_CANCEL) //'cancel - don't quit'
2004-08-23 00:15:46 +00:00
}
2020-04-19 01:23:32 +00:00
static void M_Menu_DoQuitSave ( void * ctx , promptbutton_t option )
2005-11-03 23:49:49 +00:00
{
2020-04-19 01:23:32 +00:00
if ( option = = PROMPT_YES ) //'yes - save-and-quit'
2019-09-04 07:59:40 +00:00
Cmd_ExecuteString ( " menu_quit forcesave \n " , RESTRICT_LOCAL ) ;
2020-04-19 01:23:32 +00:00
else if ( option = = PROMPT_NO ) //'no - nosave-and-quit'
2019-09-04 07:59:40 +00:00
Cmd_ExecuteString ( " menu_quit force \n " , RESTRICT_LOCAL ) ;
2020-04-19 01:23:32 +00:00
// else if (option == PROMPT_CANCEL) //'cancel - don't quit'
2012-04-24 07:59:11 +00:00
}
2014-08-27 08:41:31 +00:00
//quit menu
2012-04-24 07:59:11 +00:00
void M_Menu_Quit_f ( void )
{
int mode ;
2015-08-28 03:13:45 +00:00
extern cvar_t cfg_save_auto ;
2012-04-24 07:59:11 +00:00
char * arg = Cmd_Argv ( 1 ) ;
2015-08-28 03:13:45 +00:00
2019-01-29 23:43:50 +00:00
# ifdef CL_MASTER
2017-12-09 21:22:46 +00:00
MasterInfo_WriteServers ( ) ;
2019-01-29 23:43:50 +00:00
# endif
2017-12-09 21:22:46 +00:00
2012-04-24 07:59:11 +00:00
if ( ! strcmp ( arg , " force " ) )
mode = 0 ;
2015-08-28 03:13:45 +00:00
else if ( ! strcmp ( arg , " forcesave " ) | | cfg_save_auto . ival )
2012-10-18 10:13:15 +00:00
{
Cmd_ExecuteString ( " cfg_save " , RESTRICT_LOCAL ) ;
mode = 0 ;
}
2012-04-24 07:59:11 +00:00
else if ( ! strcmp ( arg , " save " ) )
mode = 2 ;
2009-04-01 22:03:56 +00:00
else
2012-10-18 10:13:15 +00:00
{ //prompt to save, but not otherwise.
2012-04-24 07:59:11 +00:00
if ( Cvar_UnsavedArchive ( ) )
mode = 2 ;
else
2014-08-15 02:20:41 +00:00
{
if ( ! strcmp ( arg , " prompt " ) )
mode = 1 ;
else if ( ! strcmp ( arg , " noprompt " ) )
mode = 0 ;
2014-08-27 08:41:31 +00:00
else
mode = 1 ;
2014-08-15 02:20:41 +00:00
}
2012-04-24 07:59:11 +00:00
}
switch ( mode )
{
case 0 :
2014-08-27 08:41:31 +00:00
# ifndef FTE_TARGET_WEB
2018-12-06 04:55:35 +00:00
CL_Disconnect ( NULL ) ;
2012-04-24 07:59:11 +00:00
Sys_Quit ( ) ;
2014-08-27 08:41:31 +00:00
# endif
2012-04-24 07:59:11 +00:00
break ;
case 2 :
2019-09-04 07:59:40 +00:00
Menu_Prompt ( M_Menu_DoQuitSave , NULL , " You have unsaved settings \n Would you like to \n save them now? " , " Yes " , " No " , " Cancel " ) ;
2012-04-24 07:59:11 +00:00
break ;
case 1 :
2019-09-04 07:59:40 +00:00
Menu_Prompt ( M_Menu_DoQuit , NULL , quitMessage [ rand ( ) % countof ( quitMessage ) ] , " Quit " , NULL , " Cancel " ) ;
2012-04-24 07:59:11 +00:00
break ;
2009-04-01 22:03:56 +00:00
}
2004-08-23 00:15:46 +00:00
}
//=============================================================================
/* Menu Subsystem */
2006-02-28 00:46:04 +00:00
void M_Menu_ServerList2_f ( void ) ;
2006-12-25 18:29:05 +00:00
void M_QuickConnect_f ( void ) ;
2004-08-23 00:15:46 +00:00
void M_Menu_MediaFiles_f ( void ) ;
2004-11-23 01:10:10 +00:00
void M_Menu_FPS_f ( void ) ;
2011-06-07 23:54:58 +00:00
void M_Menu_Lighting_f ( void ) ;
void M_Menu_Render_f ( void ) ;
2009-12-29 14:00:56 +00:00
void M_Menu_Textures_f ( void ) ;
2009-12-30 04:06:14 +00:00
void M_Menu_Teamplay_f ( void ) ;
void M_Menu_Teamplay_Locations_f ( void ) ;
void M_Menu_Teamplay_Needs_f ( void ) ;
void M_Menu_Teamplay_Items_f ( void ) ;
2010-01-15 13:23:08 +00:00
void M_Menu_Teamplay_Items_Armor_f ( void ) ;
void M_Menu_Teamplay_Items_Weapons_f ( void ) ;
void M_Menu_Teamplay_Items_Powerups_f ( void ) ;
void M_Menu_Teamplay_Items_Ammo_Health_f ( void ) ;
void M_Menu_Teamplay_Items_Team_Fortress_f ( void ) ;
void M_Menu_Teamplay_Items_Status_Location_Misc_f ( void ) ;
2011-06-15 23:01:07 +00:00
void M_Menu_Network_f ( void ) ;
2010-01-23 07:14:37 +00:00
void M_Menu_Singleplayer_Cheats_f ( void ) ;
2004-11-23 01:10:10 +00:00
void M_Menu_Particles_f ( void ) ;
2005-01-13 16:29:20 +00:00
void M_Menu_Audio_Speakers_f ( void ) ;
2005-04-16 16:21:27 +00:00
void Menu_DownloadStuff_f ( void ) ;
2004-11-23 01:10:10 +00:00
static qboolean internalmenusregistered ;
void M_Init_Internal ( void )
2004-08-23 00:15:46 +00:00
{
2004-11-29 01:21:00 +00:00
# ifdef MENU_DAT
2004-11-23 01:10:10 +00:00
MP_Shutdown ( ) ;
2004-11-29 01:21:00 +00:00
# endif
2004-11-23 01:10:10 +00:00
if ( internalmenusregistered )
return ;
internalmenusregistered = true ;
2018-08-04 07:05:20 +00:00
# if !defined(CLIENTONLY) && defined(SAVEDGAMES)
2012-05-09 15:30:53 +00:00
Cmd_AddCommand ( " menu_save " , M_Menu_Save_f ) ;
Cmd_AddCommand ( " menu_load " , M_Menu_Load_f ) ;
Cmd_AddCommand ( " menu_loadgame " , M_Menu_Load_f ) ; //q2...
2004-08-23 00:15:46 +00:00
# endif
2012-05-09 15:30:53 +00:00
Cmd_AddCommand ( " menu_single " , M_Menu_SinglePlayer_f ) ;
Cmd_AddCommand ( " menu_multi " , M_Menu_MultiPlayer_f ) ;
2005-11-03 23:49:49 +00:00
2012-05-09 15:30:53 +00:00
Cmd_AddCommand ( " menu_keys " , M_Menu_Keys_f ) ;
Cmd_AddCommand ( " help " , M_Menu_Help_f ) ;
Cmd_AddCommand ( " menu_quit " , M_Menu_Quit_f ) ;
2014-03-30 08:55:06 +00:00
Cmd_AddCommand ( " menu_mods " , M_Menu_Mods_f ) ;
2004-08-23 00:15:46 +00:00
# ifdef CL_MASTER
2012-05-09 15:30:53 +00:00
Cmd_AddCommand ( " menu_slist " , M_Menu_ServerList2_f ) ;
2004-08-23 00:15:46 +00:00
# endif
2012-05-09 15:30:53 +00:00
Cmd_AddCommand ( " menu_setup " , M_Menu_Setup_f ) ;
Cmd_AddCommand ( " menu_newmulti " , M_Menu_GameOptions_f ) ;
2004-08-23 00:15:46 +00:00
2012-05-09 15:30:53 +00:00
Cmd_AddCommand ( " menu_main " , M_Menu_Main_f ) ; //I've moved main to last because that way tab give us main and not quit.
2004-08-23 00:15:46 +00:00
2012-05-09 15:30:53 +00:00
Cmd_AddCommand ( " menu_options " , M_Menu_Options_f ) ;
Cmd_AddCommand ( " menu_video " , M_Menu_Video_f ) ;
Cmd_AddCommand ( " menu_audio " , M_Menu_Audio_f ) ;
2005-12-15 19:15:39 +00:00
# ifndef __CYGWIN__
2012-05-09 15:30:53 +00:00
Cmd_AddCommand ( " menu_speakers " , M_Menu_Audio_Speakers_f ) ;
2005-12-15 19:15:39 +00:00
# endif
2012-05-09 15:30:53 +00:00
Cmd_AddCommand ( " menu_spcheats " , M_Menu_Singleplayer_Cheats_f ) ;
Cmd_AddCommand ( " menu_fps " , M_Menu_FPS_f ) ;
Cmd_AddCommand ( " menu_render " , M_Menu_Render_f ) ;
Cmd_AddCommand ( " menu_lighting " , M_Menu_Lighting_f ) ;
Cmd_AddCommand ( " menu_textures " , M_Menu_Textures_f ) ;
Cmd_AddCommand ( " menu_teamplay " , M_Menu_Teamplay_f ) ;
Cmd_AddCommand ( " menu_teamplay_locations " , M_Menu_Teamplay_Locations_f ) ;
Cmd_AddCommand ( " menu_teamplay_needs " , M_Menu_Teamplay_Needs_f ) ;
Cmd_AddCommand ( " menu_teamplay_items " , M_Menu_Teamplay_Items_f ) ;
Cmd_AddCommand ( " menu_teamplay_armor " , M_Menu_Teamplay_Items_Armor_f ) ;
Cmd_AddCommand ( " menu_teamplay_weapons " , M_Menu_Teamplay_Items_Weapons_f ) ;
Cmd_AddCommand ( " menu_teamplay_powerups " , M_Menu_Teamplay_Items_Powerups_f ) ;
Cmd_AddCommand ( " menu_teamplay_ammo_health " , M_Menu_Teamplay_Items_Ammo_Health_f ) ;
Cmd_AddCommand ( " menu_teamplay_team_fortress " , M_Menu_Teamplay_Items_Team_Fortress_f ) ;
Cmd_AddCommand ( " menu_teamplay_status_location_misc " , M_Menu_Teamplay_Items_Status_Location_Misc_f ) ;
Cmd_AddCommand ( " menu_particles " , M_Menu_Particles_f ) ;
Cmd_AddCommand ( " menu_network " , M_Menu_Network_f ) ;
2005-04-16 16:21:27 +00:00
2012-04-09 19:12:12 +00:00
# ifdef CL_MASTER
2012-05-09 15:30:53 +00:00
Cmd_AddCommand ( " quickconnect " , M_QuickConnect_f ) ;
2012-04-09 19:12:12 +00:00
# endif
2004-11-23 01:10:10 +00:00
}
2004-08-23 00:15:46 +00:00
2004-11-23 01:10:10 +00:00
void M_DeInit_Internal ( void )
{
2015-07-14 14:47:00 +00:00
M_RemoveAllMenus ( true ) ;
2004-11-23 01:10:10 +00:00
if ( ! internalmenusregistered )
return ;
internalmenusregistered = false ;
# ifndef CLIENTONLY
Cmd_RemoveCommand ( " menu_save " ) ;
Cmd_RemoveCommand ( " menu_load " ) ;
Cmd_RemoveCommand ( " menu_loadgame " ) ; //q2...
# endif
Cmd_RemoveCommand ( " menu_single " ) ;
Cmd_RemoveCommand ( " menu_multi " ) ;
2005-11-03 23:49:49 +00:00
2004-11-23 01:10:10 +00:00
Cmd_RemoveCommand ( " menu_keys " ) ;
Cmd_RemoveCommand ( " help " ) ;
Cmd_RemoveCommand ( " menu_quit " ) ;
2019-07-02 04:12:20 +00:00
Cmd_RemoveCommand ( " menu_mods " ) ;
2004-11-23 01:10:10 +00:00
# ifdef CL_MASTER
Cmd_RemoveCommand ( " menu_slist " ) ;
# endif
Cmd_RemoveCommand ( " menu_setup " ) ;
Cmd_RemoveCommand ( " menu_newmulti " ) ;
Cmd_RemoveCommand ( " menu_options " ) ;
Cmd_RemoveCommand ( " menu_video " ) ;
Cmd_RemoveCommand ( " menu_audio " ) ;
2005-09-14 04:07:57 +00:00
Cmd_RemoveCommand ( " menu_speakers " ) ;
2009-12-30 04:06:14 +00:00
Cmd_RemoveCommand ( " menu_teamplay " ) ;
Cmd_RemoveCommand ( " menu_teamplay_locations " ) ;
Cmd_RemoveCommand ( " menu_teamplay_needs " ) ;
Cmd_RemoveCommand ( " menu_teamplay_items " ) ;
2010-01-15 13:23:08 +00:00
Cmd_RemoveCommand ( " menu_teamplay_armor " ) ;
Cmd_RemoveCommand ( " menu_teamplay_weapons " ) ;
Cmd_RemoveCommand ( " menu_teamplay_powerups " ) ;
Cmd_RemoveCommand ( " menu_teamplay_ammo_health " ) ;
Cmd_RemoveCommand ( " menu_teamplay_team_fortress " ) ;
Cmd_RemoveCommand ( " menu_teamplay_status_location_misc " ) ;
2010-01-23 07:14:37 +00:00
Cmd_RemoveCommand ( " menu_spcheats " ) ;
2004-11-23 01:10:10 +00:00
Cmd_RemoveCommand ( " menu_fps " ) ;
2011-06-07 23:54:58 +00:00
Cmd_RemoveCommand ( " menu_render " ) ;
Cmd_RemoveCommand ( " menu_lighting " ) ;
2009-12-29 14:00:56 +00:00
Cmd_RemoveCommand ( " menu_textures " ) ;
2004-11-23 01:10:10 +00:00
Cmd_RemoveCommand ( " menu_particles " ) ;
2019-07-02 04:12:20 +00:00
Cmd_RemoveCommand ( " menu_network " ) ;
2005-04-16 16:21:27 +00:00
2009-11-04 21:16:50 +00:00
2014-09-02 02:44:43 +00:00
Cmd_RemoveCommand ( " menu_main " ) ; //I've moved main to last because that way tab gives us main and not quit.
2006-12-25 18:29:05 +00:00
Cmd_RemoveCommand ( " quickconnect " ) ;
2004-11-23 01:10:10 +00:00
}
2014-03-30 08:55:06 +00:00
void M_Shutdown ( qboolean total )
2010-07-12 22:46:37 +00:00
{
2018-05-21 13:47:53 +00:00
# ifdef MENU_NATIVECODE
MN_Shutdown ( ) ;
# endif
2010-07-12 22:46:37 +00:00
# ifdef MENU_DAT
MP_Shutdown ( ) ;
# endif
2017-03-04 19:36:06 +00:00
M_RemoveAllMenus ( ! total ) ;
M_DeInit_Internal ( ) ;
2010-07-12 22:46:37 +00:00
}
void M_Reinit ( void )
{
2018-05-21 13:47:53 +00:00
# ifdef MENU_NATIVECODE
if ( ! MN_Init ( ) )
# endif
2010-07-12 22:46:37 +00:00
# ifdef MENU_DAT
if ( ! MP_Init ( ) )
# endif
{
M_Init_Internal ( ) ;
2013-03-12 22:53:23 +00:00
2016-02-15 06:01:17 +00:00
( void ) CSQC_UnconnectedInit ( ) ;
2010-07-12 22:46:37 +00:00
}
}
2005-09-14 20:56:34 +00:00
void FPS_Preset_f ( void ) ;
2012-04-24 07:59:11 +00:00
void M_MenuPop_f ( void ) ;
2005-09-14 20:56:34 +00:00
2004-11-23 01:10:10 +00:00
//menu.dat is loaded later... after the video and everything is up.
void M_Init ( void )
{
2018-05-21 13:47:53 +00:00
Cmd_AddCommand ( " menu_restart " , M_Restart_f ) ;
2004-11-23 01:10:10 +00:00
Cmd_AddCommand ( " togglemenu " , M_ToggleMenu_f ) ;
2009-07-14 15:04:32 +00:00
Cmd_AddCommand ( " closemenu " , M_CloseMenu_f ) ;
2005-09-14 20:56:34 +00:00
Cmd_AddCommand ( " fps_preset " , FPS_Preset_f ) ;
2012-04-24 07:59:11 +00:00
Cmd_AddCommand ( " menupop " , M_MenuPop_f ) ;
2004-08-23 00:15:46 +00:00
2015-07-08 19:32:16 +00:00
//server browser is kinda complex, and has clipboard integration which we need to sandbox a little
# ifdef CL_MASTER
Cmd_AddCommand ( " menu_servers " , M_Menu_ServerList2_f ) ;
2016-07-21 19:27:59 +00:00
# endif
//downloads menu needs sandboxing, so cannot be provided by qc.
2018-08-04 07:05:20 +00:00
# ifdef PACKAGEMANAGER
2016-07-21 19:27:59 +00:00
Cmd_AddCommand ( " menu_download " , Menu_DownloadStuff_f ) ;
2019-07-02 04:12:20 +00:00
# endif
# ifndef MINIMAL
Cmd_AddCommandAD ( " modelviewer " , M_Menu_ModelViewer_f , M_Menu_ModelViewer_c , " View a model... " ) ;
2015-07-08 19:32:16 +00:00
# endif
//demo menu is allowed to see outside of the quakedir. you can't replicate that in qc's sandbox.
Cmd_AddCommand ( " menu_demo " , M_Menu_Demos_f ) ;
2017-02-21 20:22:07 +00:00
# ifdef HAVE_JUKEBOX
2015-07-14 14:47:00 +00:00
Cmd_AddCommand ( " menu_mediafiles " , M_Menu_MediaFiles_f ) ;
2017-02-21 20:22:07 +00:00
# endif
2015-07-08 19:32:16 +00:00
2012-04-24 07:59:11 +00:00
Cvar_Register ( & m_preset_chosen , " Menu thingumiebobs " ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & m_helpismedia , " Menu thingumiebobs " ) ;
Media_Init ( ) ;
# ifdef CL_MASTER
M_Serverlist_Init ( ) ;
# endif
M_Script_Init ( ) ;
2010-07-12 22:46:37 +00:00
M_Reinit ( ) ;
2004-08-23 00:15:46 +00:00
}
2014-09-02 02:44:43 +00:00
//end builtin-menu code.
# else
void M_Init_Internal ( void ) { }
void M_DeInit_Internal ( void ) { }
void M_Shutdown ( qboolean total )
{
2018-05-21 13:47:53 +00:00
# ifdef MENU_NATIVECODE
MN_Shutdown ( ) ;
# endif
2014-09-02 02:44:43 +00:00
# ifdef MENU_DAT
MP_Shutdown ( ) ;
# endif
}
void M_Reinit ( void )
{
2018-05-21 13:47:53 +00:00
# ifdef MENU_NATIVECODE
if ( ! MN_Init ( ) )
# endif
2014-09-02 02:44:43 +00:00
# ifdef MENU_DAT
if ( ! MP_Init ( ) )
# endif
{
2016-02-15 06:01:17 +00:00
( void ) CSQC_UnconnectedInit ( ) ;
2014-09-02 02:44:43 +00:00
}
}
void M_Init ( void )
{
2018-05-21 13:47:53 +00:00
Cmd_AddCommand ( " menu_restart " , M_Restart_f ) ;
Cmd_AddCommand ( " togglemenu " , M_ToggleMenu_f ) ;
2014-09-02 02:44:43 +00:00
Media_Init ( ) ;
M_Reinit ( ) ;
}
# endif
2004-08-23 00:15:46 +00:00
2005-03-15 22:51:01 +00:00
// Generic function to choose which game menu to draw
int M_GameType ( void )
{
2010-07-11 02:22:39 +00:00
static int cached ;
static unsigned int cachedrestarts ;
if ( FS_Restarted ( & cachedrestarts ) )
{
2014-10-05 20:04:11 +00:00
struct
{
int gametype ;
char * path ;
} configs [ ] =
{
{ MGT_QUAKE1 , " gfx/sp_menu.lmp " } ,
# ifdef Q2CLIENT
{ MGT_QUAKE2 , " pics/m_banner_game.pcx " } ,
2009-11-04 21:16:50 +00:00
# endif
2014-10-05 20:04:11 +00:00
# ifdef HEXEN2
{ MGT_HEXEN2 , " gfx/menu/title2.lmp " } ,
# endif
{ 0 , NULL }
} ;
int bd = COM_FDepthFile ( configs [ 0 ] . path , true ) ;
int i ;
cached = configs [ 0 ] . gametype ;
for ( i = 1 ; configs [ i ] . path ; i + + )
{
int gd = COM_FDepthFile ( configs [ i ] . path , true ) ;
if ( bd > gd )
{
bd = gd ;
cached = configs [ i ] . gametype ;
}
}
2010-07-11 02:22:39 +00:00
}
2005-03-15 22:51:01 +00:00
2009-04-06 00:34:32 +00:00
return cached ;
2005-03-15 22:51:01 +00:00
}
2004-08-23 00:15:46 +00:00