2005-02-28 07:16:19 +00:00
//read menu.h
2004-08-23 00:15:46 +00:00
# include "quakedef.h"
# include "winquake.h"
2014-09-02 02:44:43 +00:00
static const char * res4x3 [ ] =
{
" 640x480 " ,
" 800x600 " ,
" 960x720 " ,
" 1024x768 " ,
" 1152x864 " ,
" 1280x960 " ,
" 1440x1080 " ,
" 1600x1200 " ,
// "1792x1344",
// "1856x1392",
" 1920x1440 " ,
" 2048x1536 " ,
NULL
} ;
static const char * res5x4 [ ] =
{
" 1280x1024 " ,
" 1800x1440 " ,
" 2560x2048 " ,
NULL
} ;
static const char * res16x9 [ ] =
{
" 856x480 " ,
" 1024x576 " ,
" 1280x720 " ,
" 1366x768 " ,
" 1600x900 " ,
" 1920x1080 " ,
" 2048x1152 " ,
" 2560x1440 " ,
" 3840x2160 " ,
" 4096x2304 " ,
NULL
} ;
static const char * res16x10 [ ] =
{
" 1024x640 " ,
" 1152x720 " ,
" 1280x800 " ,
" 1440x900 " ,
" 1680x1050 " ,
" 1920x1200 " ,
" 2304x1440 " ,
" 2560x1600 " ,
NULL
} ;
# define ASPECT_RATIOS 4
static const char * * resaspects [ ASPECT_RATIOS ] =
{
res4x3 ,
res5x4 ,
res16x9 ,
res16x10
} ;
# define ASPECT_LIST "4:3", "5:4", "16:9", "16:10",
2018-01-22 19:18:04 +00:00
enum
{
ASPECT3D_DESKTOP = ASPECT_RATIOS ,
ASPECT3D_CUSTOM ,
} ;
enum
{
ASPECT2D_AUTO = ASPECT_RATIOS ,
ASPECT2D_HEIGHT ,
ASPECT2D_SCALED ,
ASPECT2D_CUSTOM ,
} ;
2014-09-02 02:44:43 +00:00
2018-12-28 00:04:36 +00:00
qboolean M_Vid_GetMode ( qboolean forfullscreen , int num , int * w , int * h )
2014-09-02 02:44:43 +00:00
{
int i ;
for ( i = 0 ; i < 4 ; i + + )
{
const char * * v = resaspects [ i ] ;
while ( * v & & num )
{
v + + ;
num - - ;
}
if ( * v )
{
const char * c = * v ;
const char * s = strchr ( c , ' x ' ) ;
if ( s )
{
* w = atoi ( c ) ;
* h = atoi ( s + 1 ) ;
return true ;
}
return false ;
}
}
return false ;
}
2014-09-08 23:47:19 +00:00
# ifndef NOBUILTINMENUS
2014-09-02 02:44:43 +00:00
2013-03-12 22:40:16 +00:00
extern qboolean forcesaveprompt ;
2014-05-07 20:25:08 +00:00
extern cvar_t pr_debugger ;
2004-08-23 00:15:46 +00:00
2010-07-11 02:22:39 +00:00
menu_t * M_Options_Title ( int * y , int infosize )
{
struct menu_s * menu ;
* y = 32 ;
2015-07-14 14:47:00 +00:00
Key_Dest_Add ( kdm_emenu ) ;
2010-07-11 02:22:39 +00:00
menu = M_CreateMenu ( infosize ) ;
switch ( M_GameType ( ) )
{
case MGT_QUAKE2 : //q2...
MC_AddCenterPicture ( menu , 4 , 24 , " pics/m_banner_options " ) ;
break ;
2014-10-05 20:04:11 +00:00
# ifdef HEXEN2
2010-07-11 02:22:39 +00:00
case MGT_HEXEN2 : //h2
MC_AddPicture ( menu , 16 , 0 , 35 , 176 , " gfx/menu/hplaque.lmp " ) ;
MC_AddCenterPicture ( menu , 0 , 60 , " gfx/menu/title3.lmp " ) ;
* y + = 32 ;
break ;
2014-10-05 20:04:11 +00:00
# endif
2010-07-11 02:22:39 +00:00
default : //q1
MC_AddPicture ( menu , 16 , 4 , 32 , 144 , " gfx/qplaque.lmp " ) ;
MC_AddCenterPicture ( menu , 4 , 24 , " gfx/p_option.lmp " ) ;
break ;
}
return menu ;
}
2004-08-23 00:15:46 +00:00
//these are awkward/strange
2006-02-28 00:46:04 +00:00
qboolean M_Options_AlwaysRun ( menucheck_t * option , struct menu_s * menu , chk_set_t set )
2004-08-23 00:15:46 +00:00
{
2014-03-30 08:55:06 +00:00
if ( M_GameType ( ) = = MGT_QUAKE2 )
2004-08-23 00:15:46 +00:00
{
2014-03-30 08:55:06 +00:00
extern cvar_t cl_run ;
//quake2 mods have a nasty tendancy to hack at the various cvars, which breaks everything
if ( set ! = CHK_CHECKED )
Cvar_SetValue ( & cl_run , ! cl_run . ival ) ;
return cl_run . ival ;
2004-08-23 00:15:46 +00:00
}
else
{
2014-03-30 08:55:06 +00:00
//for better compat with other quake engines, we just ignore the cl_run cvar, at least for the menu.
if ( set = = CHK_CHECKED )
return cl_forwardspeed . value > 200 ;
else if ( cl_forwardspeed . value > 200 )
{
Cvar_SetValue ( & cl_forwardspeed , 200 ) ;
if ( * cl_backspeed . string )
Cvar_SetValue ( & cl_backspeed , 200 ) ;
return false ;
}
else
{
Cvar_SetValue ( & cl_forwardspeed , 400 ) ;
if ( * cl_backspeed . string )
Cvar_SetValue ( & cl_backspeed , 400 ) ;
return true ;
}
2009-12-29 14:00:56 +00:00
}
2004-08-23 00:15:46 +00:00
}
2006-02-28 00:46:04 +00:00
qboolean M_Options_InvertMouse ( menucheck_t * option , struct menu_s * menu , chk_set_t set )
2004-08-23 00:15:46 +00:00
{
if ( set = = CHK_CHECKED )
return m_pitch . value < 0 ;
else
{
Cvar_SetValue ( & m_pitch , - m_pitch . value ) ;
return m_pitch . value < 0 ;
2009-12-29 14:00:56 +00:00
}
2004-08-23 00:15:46 +00:00
}
//options menu.
void M_Menu_Options_f ( void )
{
2016-02-15 06:01:17 +00:00
extern cvar_t crosshair , r_projection ;
2010-07-11 02:22:39 +00:00
int y ;
2004-08-23 00:15:46 +00:00
2015-07-03 02:07:41 +00:00
static const char * projections [ ] = {
" Regular " ,
" Stereographic " ,
" Fisheye " ,
" Panoramic " ,
" Lambert Azimuthal Equal-Area " ,
2016-02-10 23:23:43 +00:00
" Equirectangular " ,
2015-07-03 02:07:41 +00:00
NULL
} ;
static const char * projectionvalues [ ] = {
" 0 " ,
" 1 " ,
" 2 " ,
" 3 " ,
" 4 " ,
2016-02-15 06:01:17 +00:00
" 5 " ,
2015-07-03 02:07:41 +00:00
NULL
} ;
2018-08-04 07:05:20 +00:00
# if !defined(CLIENTONLY) && defined(SAVEDGAMES)
extern cvar_t sv_autosave ;
2016-01-18 05:22:07 +00:00
static const char * autosaveopts [ ] = {
" Off " ,
" 30 secs " ,
" 60 secs " ,
" 90 secs " ,
" 120 secs " ,
" 5 mins " ,
NULL
} ;
2016-02-15 06:01:17 +00:00
static const char * autosavevals [ ] = {
2016-01-18 05:22:07 +00:00
" 0 " ,
" 0.5 " ,
" 1 " ,
" 1.5 " ,
" 2 " ,
" 5 " ,
NULL
} ;
2016-02-15 06:01:17 +00:00
# endif
2018-09-01 04:18:08 +00:00
# if !defined(CLIENTONLY) && defined(MVD_RECORDING)
extern cvar_t sv_demoAutoRecord ;
static const char * autorecordopts [ ] = {
" Off " ,
2019-06-18 13:03:37 +00:00
" Clientside Only " ,
" Prefer Serverside " ,
2018-09-01 04:18:08 +00:00
NULL
} ;
static const char * autorecordvals [ ] = {
" 0 " ,
" -1 " ,
" 1 " ,
NULL
} ;
extern cvar_t cl_loopbackprotocol ;
static const char * lprotopts [ ] = {
" Vanilla QW " ,
" FTE QW (recommended) " ,
# ifdef NQPROT
" FTE NQ " ,
" 666 " ,
" BJP3 " ,
// "DP6",
// "DP7",
" Automatic (FTE NQ/QW) " ,
" Vanilla NQ " ,
# endif
NULL
} ;
static const char * lprotvals [ ] = {
" qwid " ,
" qw " ,
# ifdef NQPROT
" nq " ,
" fitz " ,
" bjp3 " ,
// "dp6",
// "dp7",
" auto " ,
" nqid " ,
# endif
NULL
} ;
# endif
2016-01-18 05:22:07 +00:00
2019-02-24 08:28:39 +00:00
extern cvar_t scr_fov_mode ;
static const char * fovmodes [ ] = {
" Major- " ,
" Minor+ " ,
" Horizontal " ,
" Vertical " ,
" 4:3 stretched " ,
NULL
} ;
static const char * fovmodevalues [ ] = {
" 0 " ,
" 1 " ,
" 2 " ,
" 3 " ,
" 4 " ,
NULL
} ;
2019-03-23 07:06:37 +00:00
extern cvar_t cfg_save_auto ;
2011-06-07 23:54:58 +00:00
menubulk_t bulk [ ] = {
MB_CONSOLECMD ( " Customize controls " , " menu_keys \n " , " Modify keyboard and mouse inputs. " ) ,
2018-08-04 07:05:20 +00:00
# ifdef PACKAGEMANAGER
MB_CONSOLECMD ( " Updates and Packages " , " menu_download \n " , " Configure additional content and plugins. " ) ,
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
# endif
2011-06-07 23:54:58 +00:00
MB_CONSOLECMD ( " Go to console " , " toggleconsole \n play misc/menu2.wav \n " , " Open up the engine console. " ) ,
2013-07-14 12:22:51 +00:00
MB_CONSOLECMD ( " Reset to defaults " , " cvarreset * \n exec default.cfg \n play misc/menu2.wav \n " , " Reloads the default configuration. " ) ,
2011-06-07 23:54:58 +00:00
MB_CONSOLECMD ( " Save all settings " , " cfg_save \n " , " Writes changed settings out to a config file. " ) ,
2019-03-23 07:06:37 +00:00
MB_CHECKBOXCVARTIP ( " Auto-save Settings " , cfg_save_auto , 1 , " If this is disabled, you will need to explicitly save your settings. " ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( 4 ) ,
2015-07-03 02:07:41 +00:00
MB_COMBOCVAR ( " View Projection " , r_projection , projections , projectionvalues , NULL ) ,
2019-02-24 08:28:39 +00:00
MB_COMBOCVAR ( " FOV Mode " , scr_fov_mode , fovmodes , fovmodevalues , NULL ) ,
2015-07-03 02:07:41 +00:00
MB_SLIDER ( " Field of View " , scr_fov , 70 , 360 , 5 , NULL ) ,
2011-06-07 23:54:58 +00:00
MB_SLIDER ( " Mouse Speed " , sensitivity , 1 , 10 , 0.2 , NULL ) ,
MB_SLIDER ( " Crosshair " , crosshair , 0 , 22 , 1 , NULL ) , // move this to hud setup?
MB_CHECKBOXFUNC ( " Always Run " , M_Options_AlwaysRun , 0 , " Set movement to run at fastest speed by default. " ) ,
MB_CHECKBOXFUNC ( " Invert Mouse " , M_Options_InvertMouse , 0 , " Invert vertical mouse movement. " ) ,
MB_CHECKBOXCVAR ( " Lookspring " , lookspring , 0 ) ,
MB_CHECKBOXCVAR ( " Lookstrafe " , lookstrafe , 0 ) ,
2019-04-15 18:43:42 +00:00
MB_CHECKBOXCVAR ( " Windowed Mouse " , in_windowed_mouse , 0 ) ,
2018-08-04 07:05:20 +00:00
# if !defined(CLIENTONLY) && defined(SAVEDGAMES)
2016-02-15 06:01:17 +00:00
MB_COMBOCVAR ( " Auto Save " , sv_autosave , autosaveopts , autosavevals , NULL ) ,
2018-09-01 04:18:08 +00:00
# endif
# if !defined(CLIENTONLY) && defined(MVD_RECORDING)
MB_COMBOCVAR ( " Auto Record " , sv_demoAutoRecord , autorecordopts , autorecordvals , NULL ) ,
MB_COMBOCVAR ( " Force Protocol " , cl_loopbackprotocol , lprotopts , lprotvals , " Some protocols may impose additional limitations/breakages, and are listed only for potential demo-recording compat. " ) ,
2016-01-18 05:22:07 +00:00
# endif
2011-06-07 23:54:58 +00:00
MB_SPACING ( 4 ) ,
// removed hud options (cl_sbar, cl_hudswap, old-style chat, old-style msg)
MB_CONSOLECMD ( " Video Options " , " menu_video \n " , " Set video resolution, color depth, refresh rate, and anti-aliasing options. " ) ,
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
MB_CONSOLECMD ( " Graphics Presets " , " fps_preset \n " , " Choose a different graphical preset to use. " ) ,
2011-06-07 23:54:58 +00:00
MB_CONSOLECMD ( " Audio Options " , " menu_audio \n " , " Set audio quality and speaker setup options. " ) ,
MB_SPACING ( 4 ) ,
MB_CONSOLECMD ( " FPS Options " , " menu_fps \n " , " Set model filtering and graphical profile options. " ) ,
MB_CONSOLECMD ( " Rendering Options " , " menu_render \n " , " Set rendering options such as water warp and tinting effects. " ) ,
MB_CONSOLECMD ( " Lighting Options " , " menu_lighting \n " , " Set options for level lighting and dynamic lights. " ) ,
MB_CONSOLECMD ( " Texture Options " , " menu_textures \n " , " Set options for texture detail and effects. " ) ,
# ifndef MINIMAL
MB_CONSOLECMD ( " Particle Options " , " menu_particles \n " , " Set particle effect options. " ) ,
2014-05-07 20:25:08 +00:00
# endif
# ifdef TEXTEDITOR
//this option is a bit strange in q2.
2016-01-18 05:22:07 +00:00
// MB_CHECKBOXCVAR("QC Debugger", pr_debugger, 0),
2004-08-23 00:15:46 +00:00
# endif
2011-06-07 23:54:58 +00:00
// removed downloads (is this still appropriate?)
// removed teamplay
// removed singleplayer cheats (move this to single player menu)
MB_END ( )
} ;
menu_t * menu = M_Options_Title ( & y , 0 ) ;
2014-08-17 03:18:43 +00:00
static menuresel_t resel ;
2019-01-13 16:51:50 +00:00
int framey = y ;
MC_AddFrameStart ( menu , framey ) ;
2015-10-27 15:20:15 +00:00
y = MC_AddBulk ( menu , & resel , bulk , 16 , 216 , y ) ;
# ifdef PLUGINS
if ( Cmd_Exists ( " ezhud_nquake " ) )
{
extern cvar_t plug_sbar ;
static const char * hudplugopts [ ] = {
" Never " ,
" Deathmatch " ,
" Single Player/Coop " ,
" Always " ,
NULL
} ;
static const char * hudplugvalues [ ] = {
" 0 " ,
" 1 " ,
" 2 " ,
" 3 " ,
NULL
} ;
MC_AddCvarCombo ( menu , 16 , 216 , y , " Use Hud Plugin " , & plug_sbar , hudplugopts , hudplugvalues ) ; y + = 8 ;
}
# endif
2019-01-13 16:51:50 +00:00
MC_AddFrameEnd ( menu , framey ) ;
2004-08-23 00:15:46 +00:00
}
# ifndef __CYGWIN__
typedef struct {
int cursorpos ;
menuoption_t * cursoritem ;
2016-07-12 00:40:13 +00:00
menutext_t * speaker [ MAXSOUNDCHANNELS ] ;
2004-08-23 00:15:46 +00:00
menutext_t * testsoundsource ;
soundcardinfo_t * card ;
} audiomenuinfo_t ;
qboolean M_Audio_Key ( int key , struct menu_s * menu )
{
2016-07-12 00:40:13 +00:00
int i ;
2004-08-23 00:15:46 +00:00
audiomenuinfo_t * info = menu - > data ;
soundcardinfo_t * sc ;
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
{
if ( sc = = info - > card )
break ;
}
if ( ! sc )
{
M_RemoveMenu ( menu ) ;
return true ;
}
2009-12-29 14:00:56 +00:00
2017-08-16 02:14:07 +00:00
if ( key = = K_DOWNARROW | | key = = K_KP_DOWNARROW | | key = = K_GP_DPAD_DOWN )
2004-08-23 00:15:46 +00:00
{
info - > testsoundsource - > common . posy + = 10 ;
}
2017-08-16 02:14:07 +00:00
if ( key = = K_UPARROW | | key = = K_KP_UPARROW | | key = = K_GP_DPAD_UP )
2004-08-23 00:15:46 +00:00
{
info - > testsoundsource - > common . posy - = 10 ;
}
2017-08-16 02:14:07 +00:00
if ( key = = K_RIGHTARROW | | key = = K_KP_RIGHTARROW | | key = = K_GP_DPAD_RIGHT )
2004-08-23 00:15:46 +00:00
{
info - > testsoundsource - > common . posx + = 10 ;
}
2017-08-16 02:14:07 +00:00
if ( key = = K_LEFTARROW | | key = = K_KP_LEFTARROW | | key = = K_GP_DPAD_LEFT )
2004-08-23 00:15:46 +00:00
{
info - > testsoundsource - > common . posx - = 10 ;
}
2005-01-13 16:29:20 +00:00
if ( key > = ' 0 ' & & key < = ' 5 ' )
{
i = key - ' 0 ' ;
2016-07-12 00:40:13 +00:00
sc - > speakerdir [ i ] [ 0 ] = ( info - > testsoundsource - > common . posy - 200 / 2 ) / - 50.0 ;
sc - > speakerdir [ i ] [ 1 ] = ( info - > testsoundsource - > common . posx - 320 / 2 ) / - 50.0 ;
sc - > speakerdir [ i ] [ 2 ] = 0 ;
sc - > dist [ i ] = VectorLength ( sc - > speakerdir [ i ] ) ;
2005-01-13 16:29:20 +00:00
}
2004-08-23 00:15:46 +00:00
menu - > selecteditem = NULL ;
return false ;
}
void M_Audio_StartSound ( struct menu_s * menu )
{
int i ;
vec3_t org ;
audiomenuinfo_t * info = menu - > data ;
soundcardinfo_t * sc ;
2009-04-01 22:03:56 +00:00
vec3_t mat [ 4 ] ;
2004-08-23 00:15:46 +00:00
static float lasttime ;
for ( sc = sndcardinfo ; sc ; sc = sc - > next )
{
if ( sc = = info - > card )
break ;
}
if ( ! sc )
{
M_RemoveMenu ( menu ) ;
return ;
}
for ( i = 0 ; i < sc - > sn . numchannels ; i + + )
{
2016-07-12 00:40:13 +00:00
info - > speaker [ i ] - > common . posx = 320 / 2 + sc - > speakerdir [ i ] [ 1 ] * 50 ;
info - > speaker [ i ] - > common . posy = 200 / 2 - sc - > speakerdir [ i ] [ 0 ] * 50 ;
2004-08-23 00:15:46 +00:00
}
2005-01-13 16:29:20 +00:00
for ( ; i < 6 ; i + + )
info - > speaker [ i ] - > common . posy = - 100 ;
2004-08-23 00:15:46 +00:00
if ( lasttime + 0.5 < Sys_DoubleTime ( ) )
{
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
S_GetListenerInfo ( 0 , mat [ 0 ] , mat [ 1 ] , mat [ 2 ] , mat [ 3 ] ) ;
2009-04-01 22:03:56 +00:00
2004-08-23 00:15:46 +00:00
lasttime = Sys_DoubleTime ( ) ;
2016-07-12 00:40:13 +00:00
org [ 0 ] = mat [ 0 ] [ 0 ] + 2 * ( mat [ 2 ] [ 0 ] * ( info - > testsoundsource - > common . posx - 320 / 2 ) - mat [ 1 ] [ 0 ] * ( info - > testsoundsource - > common . posy - 200 / 2 ) ) ;
org [ 1 ] = mat [ 0 ] [ 1 ] + 2 * ( mat [ 2 ] [ 1 ] * ( info - > testsoundsource - > common . posx - 320 / 2 ) - mat [ 1 ] [ 1 ] * ( info - > testsoundsource - > common . posy - 200 / 2 ) ) ;
org [ 2 ] = mat [ 0 ] [ 2 ] + 2 * ( mat [ 2 ] [ 2 ] * ( info - > testsoundsource - > common . posx - 320 / 2 ) - mat [ 1 ] [ 2 ] * ( info - > testsoundsource - > common . posy - 200 / 2 ) ) ;
S_StartSound ( 0 , 0 , S_PrecacheSound ( " player/pain3.wav " ) , org , NULL , 1 , 4 , 0 , 0 , 0 ) ;
2004-08-23 00:15:46 +00:00
}
}
void M_Menu_Audio_Speakers_f ( void )
{
int i ;
audiomenuinfo_t * info ;
menu_t * menu ;
2015-07-14 14:47:00 +00:00
Key_Dest_Add ( kdm_emenu ) ;
2004-08-23 00:15:46 +00:00
menu = M_CreateMenu ( sizeof ( audiomenuinfo_t ) ) ;
info = menu - > data ;
menu - > key = M_Audio_Key ;
2015-06-18 22:11:30 +00:00
menu - > predraw = M_Audio_StartSound ;
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < 6 ; i + + )
2014-03-30 08:55:06 +00:00
info - > speaker [ i ] = MC_AddBufferedText ( menu , 0 , 0 , 0 , va ( " %i " , i ) , false , true ) ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
info - > testsoundsource = MC_AddBufferedText ( menu , 320 / 2 , 320 / 2 , 200 / 2 , " X " , false , true ) ;
2004-08-23 00:15:46 +00:00
info - > card = sndcardinfo ;
menu - > selecteditem = NULL ;
}
2013-09-06 22:57:44 +00:00
struct audiomenuinfo
{
char * * outdevnames ;
char * * outdevdescs ;
2015-08-07 17:49:49 +00:00
# ifdef VOICECHAT
2013-09-06 22:57:44 +00:00
char * * capdevnames ;
char * * capdevdescs ;
2015-08-07 17:49:49 +00:00
# endif
2013-09-06 22:57:44 +00:00
} ;
void M_Menu_Audio_Remove ( menu_t * menu )
{
int i ;
struct audiomenuinfo * info = menu - > data ;
for ( i = 0 ; info - > outdevnames [ i ] ; i + + )
Z_Free ( info - > outdevnames [ i ] ) ;
2014-08-25 07:35:41 +00:00
Z_Free ( info - > outdevnames ) ;
2013-09-06 22:57:44 +00:00
for ( i = 0 ; info - > outdevdescs [ i ] ; i + + )
Z_Free ( info - > outdevdescs [ i ] ) ;
2014-08-25 07:35:41 +00:00
Z_Free ( info - > outdevdescs ) ;
2015-08-07 17:49:49 +00:00
# ifdef VOICECHAT
2013-09-06 22:57:44 +00:00
for ( i = 0 ; info - > capdevnames [ i ] ; i + + )
Z_Free ( info - > capdevnames [ i ] ) ;
2014-08-25 07:35:41 +00:00
Z_Free ( info - > capdevnames ) ;
2013-09-06 22:57:44 +00:00
for ( i = 0 ; info - > capdevdescs [ i ] ; i + + )
Z_Free ( info - > capdevdescs [ i ] ) ;
2014-08-25 07:35:41 +00:00
Z_Free ( info - > capdevdescs ) ;
2015-08-07 17:49:49 +00:00
# endif
2013-09-06 22:57:44 +00:00
}
struct audiomenuinfo * M_Menu_Audio_Setup ( menu_t * menu )
{
# ifdef VOICECHAT
extern cvar_t snd_voip_capturedevice_opts ;
# endif
extern cvar_t snd_device_opts ;
int pairs , i ;
struct audiomenuinfo * info = menu - > data ;
menu - > remove = M_Menu_Audio_Remove ;
Cmd_TokenizeString ( snd_device_opts . string ? snd_device_opts . string : " " , false , false ) ;
pairs = Cmd_Argc ( ) / 2 ;
info - > outdevnames = BZ_Malloc ( ( pairs + 1 ) * sizeof ( char * ) ) ;
info - > outdevdescs = BZ_Malloc ( ( pairs + 1 ) * sizeof ( char * ) ) ;
for ( i = 0 ; i < pairs ; i + + )
{
info - > outdevnames [ i ] = Z_StrDup ( Cmd_Argv ( i * 2 + 0 ) ) ;
info - > outdevdescs [ i ] = Z_StrDup ( Cmd_Argv ( i * 2 + 1 ) ) ;
}
info - > outdevnames [ i ] = NULL ;
info - > outdevdescs [ i ] = NULL ;
# ifdef VOICECHAT
Cmd_TokenizeString ( snd_voip_capturedevice_opts . string ? snd_voip_capturedevice_opts . string : " " , false , false ) ;
pairs = Cmd_Argc ( ) / 2 ;
info - > capdevnames = BZ_Malloc ( ( pairs + 1 ) * sizeof ( char * ) ) ;
info - > capdevdescs = BZ_Malloc ( ( pairs + 1 ) * sizeof ( char * ) ) ;
for ( i = 0 ; i < pairs ; i + + )
{
info - > capdevnames [ i ] = Z_StrDup ( Cmd_Argv ( i * 2 + 0 ) ) ;
info - > capdevdescs [ i ] = Z_StrDup ( Cmd_Argv ( i * 2 + 1 ) ) ;
}
info - > capdevnames [ i ] = NULL ;
info - > capdevdescs [ i ] = NULL ;
# endif
return info ;
}
2004-08-23 00:15:46 +00:00
void M_Menu_Audio_f ( void )
{
2013-07-26 17:19:06 +00:00
int y ;
2013-09-06 22:57:44 +00:00
menu_t * menu = M_Options_Title ( & y , sizeof ( struct audiomenuinfo ) ) ;
struct audiomenuinfo * info = M_Menu_Audio_Setup ( menu ) ;
2016-07-12 00:40:13 +00:00
extern cvar_t nosound , snd_leftisright , snd_device , snd_khz , snd_speakers , ambient_level , bgmvolume , snd_playersoundvolume , ambient_fade , cl_staticsounds , snd_inactive , _snd_mixahead , snd_doppler ;
2013-03-12 22:47:42 +00:00
// extern cvar_t snd_noextraupdate, snd_eax, precache;
2013-05-11 05:03:07 +00:00
# ifdef VOICECHAT
2019-08-03 02:07:40 +00:00
extern cvar_t snd_voip_capturedevice , snd_voip_play , snd_voip_send , snd_voip_test , snd_voip_micamp , snd_voip_vad_threshhold , snd_voip_ducking , snd_voip_codec ;
# ifdef HAVE_SPEEX
extern cvar_t snd_voip_noisefilter ;
# endif
2013-05-11 05:03:07 +00:00
# endif
2004-08-23 00:15:46 +00:00
static const char * soundqualityoptions [ ] = {
" 11025 Hz " ,
" 22050 Hz " ,
" 44100 Hz " ,
2011-06-07 23:54:58 +00:00
" 48000 Hz " ,
2004-08-23 00:15:46 +00:00
NULL
} ;
static const char * soundqualityvalues [ ] = {
2011-06-07 23:54:58 +00:00
" 11 " ,
" 22 " ,
" 44 " ,
" 48 " ,
2004-08-23 00:15:46 +00:00
NULL
} ;
static const char * speakeroptions [ ] = {
" Mono " ,
" Stereo " ,
" Quad " ,
2011-06-07 23:54:58 +00:00
" 5.1 " ,
2004-08-23 00:15:46 +00:00
NULL
} ;
static const char * speakervalues [ ] = {
" 1 " ,
" 2 " ,
" 4 " ,
" 6 " ,
NULL
} ;
2014-08-15 02:20:41 +00:00
# ifdef VOICECHAT
2013-07-26 17:19:06 +00:00
static const char * voipcodecoptions [ ] = {
2019-04-16 22:40:05 +00:00
# ifdef HAVE_OPUS
2017-01-17 19:04:09 +00:00
" Opus " ,
2019-04-16 22:40:05 +00:00
# endif
# ifdef HAVE_SPEEX
# ifdef HAVE_LEGACY
" Speex (ez-compat) " ,
# endif
2013-07-26 17:19:06 +00:00
" Speex (Narrow) " ,
" Speex (Wide) " ,
2017-01-17 19:04:09 +00:00
// "Speex (UltraWide)",
2019-04-16 22:40:05 +00:00
# endif
// "Raw16 (11025)",
2017-06-21 01:24:25 +00:00
// "PCM A-Law",
// "PCM U-Law",
2013-07-26 17:19:06 +00:00
NULL
} ;
static const char * voipcodecvalue [ ] = {
2019-04-16 22:40:05 +00:00
# ifdef HAVE_OPUS
2017-06-21 01:24:25 +00:00
" 2 " , //opus
2019-04-16 22:40:05 +00:00
# endif
# ifdef HAVE_SPEEX
# ifdef HAVE_LEGACY
" 0 " , //speex non-standard (outdated)
# endif
2017-06-21 01:24:25 +00:00
" 3 " , //speex narrow
" 4 " , //speex wide
// "5", //speex UW
2019-04-16 22:40:05 +00:00
# endif
// "1", //pcm16 sucks
2017-06-21 01:24:25 +00:00
// "6", //pcma
// "7", //pcmu
2013-07-26 17:19:06 +00:00
NULL
} ;
static const char * voipsendoptions [ ] = {
" Push To Talk " ,
" Voice Activation " ,
" Continuous " ,
NULL
} ;
static const char * voipsendvalue [ ] = {
" 0 " ,
" 1 " ,
" 2 " ,
NULL
} ;
2014-08-15 02:20:41 +00:00
# endif
2011-06-07 23:54:58 +00:00
menubulk_t bulk [ ] = {
2016-07-12 00:40:13 +00:00
MB_REDTEXT ( " Sound Options " , true ) ,
MB_TEXT ( " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , true ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( 8 ) ,
2013-07-26 17:19:06 +00:00
MB_CONSOLECMD ( " Restart Sound " , " snd_restart \n " , " Restart audio systems and apply set options. " ) ,
MB_SPACING ( 4 ) ,
2016-07-12 00:40:13 +00:00
MB_COMBOCVAR ( " Output Device " , snd_device , ( const char * * ) info - > outdevdescs , ( const char * * ) info - > outdevnames , " Choose which audio driver and device to use. " ) ,
2011-06-07 23:54:58 +00:00
MB_SLIDER ( " Volume " , volume , 0 , 1 , 0.1 , NULL ) ,
MB_COMBOCVAR ( " Speaker Setup " , snd_speakers , speakeroptions , speakervalues , NULL ) ,
MB_COMBOCVAR ( " Frequency " , snd_khz , soundqualityoptions , soundqualityvalues , NULL ) ,
MB_CHECKBOXCVAR ( " Low Quality (8-bit) " , loadas8bit , 0 ) ,
MB_CHECKBOXCVAR ( " Flip Speakers " , snd_leftisright , 0 ) ,
MB_SLIDER ( " Mixahead " , _snd_mixahead , 0 , 1 , 0.05 , NULL ) ,
MB_CHECKBOXCVAR ( " Disable All Sounds " , nosound , 0 ) ,
MB_SPACING ( 4 ) ,
2013-07-26 17:19:06 +00:00
2011-06-07 23:54:58 +00:00
MB_SLIDER ( " Player Sound Volume " , snd_playersoundvolume , 0 , 1 , 0.1 , NULL ) ,
MB_SLIDER ( " Ambient Volume " , ambient_level , 0 , 1 , 0.1 , NULL ) ,
MB_SLIDER ( " Ambient Fade " , ambient_fade , 0 , 1000 , 1 , NULL ) ,
MB_CHECKBOXCVAR ( " Static Sounds " , cl_staticsounds , 0 ) ,
2014-11-05 05:39:24 +00:00
MB_SLIDER ( " Music Volume " , bgmvolume , 0 , 1 , 0.1 , NULL ) ,
2016-07-12 00:40:13 +00:00
MB_SLIDER ( " Doppler Factor " , snd_doppler , 0 , 10 , 0.1 , NULL ) ,
2011-06-07 23:54:58 +00:00
// removed music buffer
// removed precache
// removed eax2
// remove no extra update
MB_CHECKBOXCVAR ( " Sound While Inactive " , snd_inactive , 0 ) ,
MB_SPACING ( 4 ) ,
2013-07-26 17:19:06 +00:00
# ifdef VOICECHAT
2016-07-12 00:40:13 +00:00
MB_REDTEXT ( " Voice Options " , true ) ,
MB_TEXT ( " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , true ) ,
2014-02-07 08:38:40 +00:00
MB_COMBOCVAR ( " Microphone Device " , snd_voip_capturedevice , ( const char * * ) info - > capdevdescs , ( const char * * ) info - > capdevnames , NULL ) ,
2013-09-06 22:57:44 +00:00
MB_SLIDER ( " Voice Volume " , snd_voip_play , 0 , 2 , 0.1 , NULL ) ,
MB_CHECKBOXCVAR ( " Microphone Test " , snd_voip_test , 0 ) ,
MB_SLIDER ( " Microphone Volume " , snd_voip_micamp , 0 , 2 , 0.1 , NULL ) ,
MB_COMBOCVAR ( " Activation Mode " , snd_voip_send , voipsendoptions , voipsendvalue , NULL ) ,
MB_SLIDER ( " Act. Threshhold " , snd_voip_vad_threshhold , 0 , 30 , 1 , NULL ) ,
MB_CHECKBOXCVAR ( " Audio Ducking " , snd_voip_ducking , 0 ) ,
2019-08-03 02:07:40 +00:00
# ifdef HAVE_SPEEX
2013-09-06 22:57:44 +00:00
MB_CHECKBOXCVAR ( " Noise Cancelation " , snd_voip_noisefilter , 0 ) ,
2019-08-03 02:07:40 +00:00
# endif
2013-09-06 22:57:44 +00:00
MB_COMBOCVAR ( " Codec " , snd_voip_codec , voipcodecoptions , voipcodecvalue , NULL ) ,
2013-07-26 17:19:06 +00:00
# endif
2011-06-07 23:54:58 +00:00
//MB_CONSOLECMD("Speaker Test", "menu_speakers\n", "Test speaker setup output."),
MB_END ( )
} ;
2014-08-17 03:18:43 +00:00
static menuresel_t resel ;
2019-01-13 16:51:50 +00:00
MC_AddFrameStart ( menu , y ) ;
2014-08-17 03:18:43 +00:00
MC_AddBulk ( menu , & resel , bulk , 16 , 216 , y ) ;
2019-01-13 16:51:50 +00:00
MC_AddFrameEnd ( menu , y ) ;
2004-08-23 00:15:46 +00:00
}
# else
void M_Menu_Audio_f ( void )
{
Con_Printf ( " No sound in cygwin \n " ) ;
}
# endif
void M_Menu_Particles_f ( void )
{
menu_t * menu ;
2013-03-12 22:47:42 +00:00
extern cvar_t r_bouncysparks , r_part_rain , gl_part_flame , r_grenadetrail , r_rockettrail , r_part_rain_quantity , r_particledesc , r_particle_tracelimit , r_part_contentswitch , r_bloodstains ;
// extern cvar_t r_part_sparks_trifan, r_part_sparks_textured, r_particlesystem;
2009-07-14 15:04:32 +00:00
2013-03-12 22:47:42 +00:00
/* static const char *psystemopts[] =
2009-07-14 15:04:32 +00:00
{
2011-06-07 23:54:58 +00:00
" Classic " ,
" Script " ,
" None " ,
2009-07-14 15:04:32 +00:00
NULL
} ;
2011-06-07 23:54:58 +00:00
static const char * psystemvals [ ] =
2009-07-14 15:04:32 +00:00
{
" classic " ,
" script " ,
2011-06-07 23:54:58 +00:00
" null " ,
2009-07-14 15:04:32 +00:00
NULL
} ;
2013-03-12 22:47:42 +00:00
*/
2012-06-16 08:58:36 +00:00
static const char * pdescopts [ ] =
2011-06-07 23:54:58 +00:00
{
2011-12-23 03:12:29 +00:00
" Classic " ,
2011-06-07 23:54:58 +00:00
" Faithful " ,
" High FPS " ,
" Fancy " ,
" Fancy+LG " ,
2011-12-05 15:23:40 +00:00
" Snazzy " ,
2011-06-07 23:54:58 +00:00
" Bare bones " ,
NULL
} ;
static const char * pdescvals [ ] =
{
2011-12-23 03:12:29 +00:00
" classic " ,
2011-06-07 23:54:58 +00:00
" faithful " ,
" highfps " ,
" spikeset " ,
" spikeset tsshaft " ,
2011-12-05 15:23:40 +00:00
" spikeset high tsshaft " ,
2011-06-07 23:54:58 +00:00
" minimal " ,
NULL
} ;
2004-08-23 00:15:46 +00:00
2011-06-07 23:54:58 +00:00
static const char * trailopts [ ] =
{
" Disable " ,
" Default " ,
" Swap " ,
" Alternate " ,
" Blood " ,
" Zombie " ,
" Scrag " ,
" Knight " ,
" Vore " ,
" Rail " ,
NULL
} ;
static const char * trailvals [ ] = { " 0 " , " 1 " , " 2 " , " 3 " , " 4 " , " 5 " , " 6 " , " 7 " , " 8 " , " 9 " , NULL } ;
2004-08-23 00:15:46 +00:00
2011-06-07 23:54:58 +00:00
int y ;
menubulk_t bulk [ ] = {
2016-07-12 00:40:13 +00:00
MB_REDTEXT ( " Particle Options " , true ) ,
MB_TEXT ( " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , true ) ,
2011-12-23 03:12:29 +00:00
// MB_COMBOCVAR("Particle System", r_particlesystem, psystemopts, psystemvals, "Selects particle system to use. Classic is standard Quake particles, script is FTE style scripted particles, and none disables particles entirely."),
MB_COMBOCVAR ( " Particle Set " , r_particledesc , pdescopts , pdescvals , " Selects particle set to use with the scripted particle system. " ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( 4 ) ,
MB_COMBOCVAR ( " Rocket Trail " , r_rockettrail , trailopts , trailvals , " Chooses effect to replace rocket trails. " ) ,
MB_COMBOCVAR ( " Grenade Trail " , r_grenadetrail , trailopts , trailvals , " Chooses effect to replace grenade trails. " ) ,
MB_SPACING ( 4 ) ,
// removed texture sparks
// removed trifan sparks
MB_CHECKBOXCVAR ( " Particle Physics " , r_bouncysparks , 0 ) ,
MB_CHECKBOXCVAR ( " Particle Stains " , r_bloodstains , 0 ) ,
MB_CHECKBOXCVAR ( " Content Switching " , r_part_contentswitch , 0 ) ,
MB_CHECKBOXCVAR ( " Surface Emitting " , r_part_rain , 0 ) ,
MB_SLIDER ( " Surface Quantity " , r_part_rain_quantity , 0 , 10 , 1 , NULL ) ,
MB_CHECKBOXCVAR ( " Model Emitting " , gl_part_flame , 0 ) ,
MB_SLIDER ( " Trace Limit " , r_particle_tracelimit , 0 , 2000 , 100 , NULL ) ,
// removed particle beams
MB_END ( )
} ;
2014-08-17 03:18:43 +00:00
static menuresel_t resel ;
2004-08-23 00:15:46 +00:00
2011-06-07 23:54:58 +00:00
menu = M_Options_Title ( & y , 0 ) ;
2019-01-13 16:51:50 +00:00
MC_AddFrameStart ( menu , y ) ;
2014-08-17 03:18:43 +00:00
MC_AddBulk ( menu , & resel , bulk , 16 , 200 , y ) ;
2019-01-13 16:51:50 +00:00
MC_AddFrameEnd ( menu , y ) ;
2004-08-23 00:15:46 +00:00
}
2011-06-07 23:54:58 +00:00
const char * presetname [ ] =
{
2012-04-24 07:59:11 +00:00
" 286 " , //everything turned off to make it as fast as possible, even if you're crippled without it
2012-06-16 08:58:36 +00:00
" Fast " , //typical deathmatch settings.
2017-07-04 05:07:51 +00:00
" Spasm " , //faithful NQ aesthetics (fairly strict, but not all out).
2014-08-15 02:20:41 +00:00
" Vanilla " , //vanilla effects enabled, no content replacement.
" Normal " , //content replacement enabled
2012-04-24 07:59:11 +00:00
" Nice " , //potentially expensive, but not painful
" Realtime " , //everything on
2011-06-07 23:54:58 +00:00
NULL
2005-09-14 20:56:34 +00:00
} ;
2017-11-30 17:59:11 +00:00
# define PRESET_NUM (countof(presetname)-1)
2011-06-07 23:54:58 +00:00
// this is structured like this for a possible future feature
// also don't include cvars that need a restart here
const char * presetexec [ ] =
2005-09-14 20:56:34 +00:00
{
2011-06-07 23:54:58 +00:00
// 286 options (also the first commands to be execed in the chain)
2014-08-15 02:20:41 +00:00
" seta m_preset_chosen 1; "
" seta gl_texturemode nn; "
2014-08-16 05:33:50 +00:00
" seta gl_texturemode2d n; "
2014-08-15 02:20:41 +00:00
" seta gl_blendsprites 0; "
" seta r_particlesystem null; "
" seta r_particledesc \" \" ; "
" seta r_part_classic_square 0; "
2014-09-02 02:44:43 +00:00
" seta r_part_classic_expgrav 10; "
2016-07-12 00:40:13 +00:00
" seta r_part_classic_opaque 0; "
2017-12-28 16:24:50 +00:00
" seta cl_expsprite 1; "
2014-08-15 02:20:41 +00:00
" seta r_stains 0; "
" seta r_drawflat 1; "
2016-09-08 19:04:35 +00:00
" seta r_lightmap 0; "
2014-08-15 02:20:41 +00:00
" seta r_nolerp 1; "
2017-07-04 05:07:51 +00:00
" seta r_noframegrouplerp 1; "
2014-08-15 02:20:41 +00:00
" seta r_nolightdir 1; "
" seta r_dynamic 0; "
2015-04-14 23:12:17 +00:00
" seta r_bloom 0; "
" seta r_softwarebanding 0; "
2016-07-12 00:40:13 +00:00
" seta d_mipcap 0 1000; "
" seta gl_affinemodels 0; "
2014-08-15 02:20:41 +00:00
" seta gl_polyblend 0; "
" seta gl_flashblend 0; "
" seta gl_specular 0; "
2018-07-05 16:21:44 +00:00
" seta r_deluxemapping 0; "
2014-08-15 02:20:41 +00:00
" seta r_loadlit 0; "
" seta r_fastsky 1; "
" seta r_drawflame 0; "
" seta r_waterstyle 1; "
" seta r_lavastyle 1; " //defer to water
// "seta r_slimestyle \"\";" //defer to water
" seta r_coronas 0; "
" seta r_shadow_realtime_dlight 0; "
" seta r_shadow_realtime_world 0; "
2019-07-02 04:12:20 +00:00
" seta r_shadow_realtime_dlight_shadows 1; "
2014-08-15 02:20:41 +00:00
" seta r_glsl_offsetmapping 0; "
2017-01-18 11:34:44 +00:00
" seta vid_hardwaregamma 3; " //people benchmarking against other engines with fte using glsl gamma and the other not is annoying as fuck.
2014-08-15 02:20:41 +00:00
// "seta gl_detail 0;"
" seta gl_load24bit 0; "
" seta r_replacemodels \" \" ; "
" seta r_waterwarp 0; "
" seta r_lightstylesmooth 0; "
" seta r_part_density 0.25; "
" seta cl_nolerp 1; "
" seta r_lerpmuzzlehack 0; "
" seta v_gunkick 0; "
2018-04-27 16:40:50 +00:00
" seta v_viewmodel_quake 0; "
2014-08-15 02:20:41 +00:00
" seta cl_rollangle 0; "
" seta cl_bob 0; "
" seta cl_sbar 0; "
2018-10-11 10:31:23 +00:00
" cvarreset sv_nqplayerphysics; " //server settings in a preset might be bad.
2014-08-15 02:20:41 +00:00
" seta cl_demoreel 0; "
2015-08-04 15:16:24 +00:00
" seta cl_gibfilter 1; "
" if cl_deadbodyfilter == 0 then seta cl_deadbodyfilter 1; " //as useful as 2 is, some mods use death frames for crouching etc.
2015-08-10 18:28:23 +00:00
" seta gl_simpleitems 1; "
2018-07-22 11:49:37 +00:00
" seta cl_fullpitch 1;seta maxpitch \" \" ;seta minpitch \" \" ; " //mimic quakespasm where possible.
2018-08-13 06:27:29 +00:00
" seta r_graphics 1; "
" seta r_renderscale 1; "
2012-11-27 03:23:19 +00:00
2019-06-05 20:48:06 +00:00
, // fast options (for deathmatch)
2011-06-07 23:54:58 +00:00
" gl_texturemode ln; "
2014-08-16 05:33:50 +00:00
" gl_texturemode2d n; "
2016-07-12 00:40:13 +00:00
# ifdef MINIMAL
2011-06-07 23:54:58 +00:00
" r_particlesystem classic; "
2016-07-12 00:40:13 +00:00
# else
" r_particlesystem script; "
# endif
2012-11-27 23:50:58 +00:00
" r_particledesc classic; "
2011-06-07 23:54:58 +00:00
" r_drawflat 0; "
" r_nolerp 0; "
" gl_flashblend 1; "
" r_loadlit 1; "
" r_fastsky 0; "
2012-11-27 03:23:19 +00:00
" r_waterstyle 1; "
" r_lavastyle 1; "
2012-04-24 07:59:11 +00:00
" r_nolightdir 0; "
2015-08-10 18:28:23 +00:00
" seta gl_simpleitems 0; "
2012-11-27 03:23:19 +00:00
2019-06-05 20:48:06 +00:00
, //quakespasm-esque options (for singleplayer faithful).
2014-08-15 02:20:41 +00:00
" r_part_density 1; "
" gl_polyblend 1; "
2017-07-04 05:07:51 +00:00
" r_dynamic 2; "
2014-08-15 02:20:41 +00:00
" gl_flashblend 0; "
2016-07-12 00:40:13 +00:00
" cl_nolerp 0; " //projectiles lerped at least.
2017-07-04 05:07:51 +00:00
" r_noframegrouplerp 1; " //flames won't lerp
2014-08-15 02:20:41 +00:00
" r_waterwarp 1; "
" r_drawflame 1; "
" v_gunkick 1; "
" cl_rollangle 2.0; "
" cl_bob 0.02; "
2017-12-02 22:11:20 +00:00
" vid_hardwaregamma 1; " //auto hardware gamma, for fast fullscreen and usable windowed.
2014-09-02 02:44:43 +00:00
" r_part_classic_expgrav 1; " //vanillaery
2016-07-12 00:40:13 +00:00
" r_part_classic_opaque 1; "
// "r_particlesystem script;" //q2 or hexen2 particle effects need to be loadable
2017-07-04 05:07:51 +00:00
" cl_sbar 2; " //its a style thing
" sv_nqplayerphysics 1; " //gb wanted this, should give nq physics to people who want nq settings. note that this disables prediction.
2014-08-15 02:20:41 +00:00
" cl_demoreel 1; " //yup, arcadey
//"d_mipcap \"0 3\";" //logically correct, but will fuck up on ATI drivers if increased mid-map, because ATI will just ignore any levels that are not currently enabled.
2017-07-04 05:07:51 +00:00
" cl_gibfilter 0; "
2015-08-04 15:16:24 +00:00
" seta cl_deadbodyfilter 0; "
2019-07-29 05:28:20 +00:00
" gl_texture_anisotropic_filtering 4; "
2018-07-22 11:49:37 +00:00
" cl_fullpitch 1;maxpitch 90;seta minpitch -90; " //QS has cheaty viewpitch range. some maps require it.
2014-08-15 02:20:41 +00:00
2019-06-05 20:48:06 +00:00
, //vanilla-esque options (for purists).
2018-07-22 11:49:37 +00:00
" cl_fullpitch 0;maxpitch \" \" ;seta minpitch \" \" ; " //quakespasm is not vanilla
2017-12-02 22:11:20 +00:00
" gl_texturemode nll; " //yup, we went there.
2017-07-04 05:07:51 +00:00
" gl_texturemode2d n.l; " //yeah, 2d too.
" r_nolerp 1; "
" cl_sbar 1; "
2019-06-05 20:48:06 +00:00
" d_mipcap 0 2; " //gl without anisotropic filtering favours too-distant mips too often, so lets just pretend it doesn't exist. should probably mess with lod instead or something
2018-04-27 16:40:50 +00:00
" v_viewmodel_quake 1; "
2019-06-05 20:48:06 +00:00
" r_loadlit 0; "
2017-07-04 05:07:51 +00:00
" gl_affinemodels 1; "
" r_softwarebanding 1; " //ugly software banding.
" r_part_classic_square 1; " //blocky baby!
2013-10-29 17:38:22 +00:00
, // normal (faithful) options, but with content replacement thrown in
2016-07-12 00:40:13 +00:00
//#ifdef MINIMAL
// "r_particlesystem classic;"
//#else
// "r_particlesystem script;"
// "r_particledesc classic;"
//#endif
2014-08-15 02:20:41 +00:00
" r_part_classic_square 0; "
2014-09-02 02:44:43 +00:00
" r_part_classic_expgrav 10; " //gives a slightly more dynamic feel to them
2016-07-12 00:40:13 +00:00
" r_part_classic_opaque 0; "
2011-06-07 23:54:58 +00:00
" gl_load24bit 1; "
" r_replacemodels \" md3 md2 \" ; "
2013-10-29 17:38:22 +00:00
" r_coronas 1; "
2017-07-04 05:07:51 +00:00
" r_dynamic 1; "
2015-04-14 23:12:17 +00:00
" r_softwarebanding 0; "
2016-07-12 00:40:13 +00:00
" d_mipcap 0 1000; "
" gl_affinemodels 0; "
2013-11-21 23:02:28 +00:00
" r_lerpmuzzlehack 1; "
2014-08-15 02:20:41 +00:00
" gl_texturemode ln; "
2014-08-16 05:33:50 +00:00
" gl_texturemode2d l; "
2014-08-15 02:20:41 +00:00
" cl_sbar 0; "
2018-04-27 16:40:50 +00:00
" v_viewmodel_quake 0; " //don't move the gun around weirdly.
2018-10-11 10:31:23 +00:00
" cvarreset sv_nqplayerphysics; "
2014-08-15 02:20:41 +00:00
" cl_demoreel 0; "
2014-08-16 05:33:50 +00:00
" r_loadlit 1; "
2016-07-12 00:40:13 +00:00
" r_nolerp 0; "
2017-07-04 05:07:51 +00:00
" r_noframegrouplerp 0; "
2018-07-22 11:49:37 +00:00
" cl_fullpitch 1;maxpitch 90;seta minpitch -90; "
2012-11-27 03:23:19 +00:00
2011-06-07 23:54:58 +00:00
, // nice options
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
// "r_stains 0.75;"
2017-12-02 22:11:20 +00:00
" gl_texturemode lll; "
2011-06-07 23:54:58 +00:00
# ifndef MINIMAL
2016-07-12 00:40:13 +00:00
// "r_particlesystem script;"
2014-02-07 08:38:40 +00:00
" r_particledesc \" high tsshaft \" ; "
2011-06-07 23:54:58 +00:00
# endif
" gl_specular 1; "
2014-03-30 08:55:06 +00:00
// "r_loadlit 2;"
2012-11-27 03:23:19 +00:00
" r_waterstyle 2; "
2013-03-12 22:37:03 +00:00
" gl_blendsprites 1; "
2011-06-07 23:54:58 +00:00
// "r_fastsky -1;"
2017-07-04 05:07:51 +00:00
" r_dynamic 0; "
2011-06-07 23:54:58 +00:00
" r_shadow_realtime_dlight 1; "
2014-02-07 08:38:40 +00:00
// "gl_detail 1;"
2011-06-07 23:54:58 +00:00
" r_lightstylesmooth 1; "
2018-07-05 16:21:44 +00:00
" r_deluxemapping 2; "
2012-11-27 03:23:19 +00:00
2011-06-07 23:54:58 +00:00
, // realtime options
2015-04-14 23:12:17 +00:00
" r_bloom 1; "
2018-07-05 16:21:44 +00:00
" r_deluxemapping 0; " //won't be seen anyway
2015-04-14 23:12:17 +00:00
" r_particledesc \" high tsshaft \" ; "
2018-09-01 04:18:08 +00:00
// "r_waterstyle 3;" //too expensive.
2012-04-24 07:59:11 +00:00
" r_glsl_offsetmapping 1; "
2011-06-07 23:54:58 +00:00
" r_shadow_realtime_world 1; "
" gl_texture_anisotropic_filtering 16; "
2019-06-17 04:21:41 +00:00
" vid_hardwaregamma 4; " //scene gamma
2005-09-14 20:56:34 +00:00
} ;
2011-06-07 23:54:58 +00:00
2012-06-16 08:58:36 +00:00
typedef struct fpsmenuinfo_s
2011-06-15 23:01:07 +00:00
{
menucombo_t * preset ;
} fpsmenuinfo_t ;
2005-09-14 20:56:34 +00:00
static void ApplyPreset ( int presetnum )
{
int i ;
2013-03-12 23:09:25 +00:00
//this function is written backwards, to ensure things work properly in configs etc.
2012-11-27 23:50:58 +00:00
2013-03-12 23:09:25 +00:00
// TODO: work backwards and only set cvars once
2015-09-07 14:34:39 +00:00
Cbuf_InsertText ( " \n fs_restart \n vid_reload \n " , RESTRICT_LOCAL , true ) ;
2013-03-12 23:09:25 +00:00
for ( i = presetnum ; i > = 0 ; i - - )
{
Cbuf_InsertText ( presetexec [ i ] , RESTRICT_LOCAL , true ) ;
2012-11-27 23:50:58 +00:00
}
2013-03-12 22:40:16 +00:00
forcesaveprompt = true ;
2005-09-14 20:56:34 +00:00
}
2012-04-24 07:59:11 +00:00
void M_Menu_Preset_f ( void )
{
2019-03-23 07:06:37 +00:00
extern cvar_t cfg_save_auto ;
2012-04-24 07:59:11 +00:00
menu_t * menu ;
int y ;
menubulk_t bulk [ ] =
{
2016-07-12 00:40:13 +00:00
MB_REDTEXT ( " Please Choose Preset " , true ) ,
MB_TEXT ( " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , true ) ,
2015-08-20 03:17:47 +00:00
MB_CONSOLECMD ( " simple (untextured) " , " fps_preset 286;menupop \n " , " Lacks textures, particles, pretty much everything. " ) ,
2012-05-11 01:57:00 +00:00
MB_CONSOLECMD ( " fast (deathmatch) " , " fps_preset fast;menupop \n " , " Fullscreen effects off to give consistant framerates " ) ,
2017-07-04 05:07:51 +00:00
MB_CONSOLECMD ( " spasm (nq compat) " , " fps_preset spasm;menupop \n " , " Aims for visual compatibility with common NQ engines. Also affects mods slightly. " ) ,
2014-08-15 02:20:41 +00:00
MB_CONSOLECMD ( " vanilla (softwarey) " , " fps_preset vanilla;menupop \n " , " This is for purists! Party like its 1995! No sanity spared! " ) ,
2017-07-04 05:07:51 +00:00
MB_CONSOLECMD ( " normal (qw faithful) " , " fps_preset normal;menupop \n " , " An updated but still faithful appearance, using content replacements where applicable " ) ,
2012-05-11 01:57:00 +00:00
MB_CONSOLECMD ( " nice (dynamic) " , " fps_preset nice;menupop \n " , " For people who like nice things, but still want to actually play " ) ,
2015-08-20 03:32:09 +00:00
# ifdef RTLIGHTS
2012-05-11 01:57:00 +00:00
MB_CONSOLECMD ( " realtime (all on) " , " fps_preset realtime;menupop \n " , " For people who value pretty over fast/smooth. Not viable for deathmatch. " ) ,
2015-08-20 03:32:09 +00:00
# endif
2019-03-23 07:06:37 +00:00
MB_SPACING ( 16 ) ,
MB_CHECKBOXCVARTIP ( " Auto-save Settings " , cfg_save_auto , 1 , " If this is disabled, you will need to explicitly save your settings. " ) ,
2012-04-24 07:59:11 +00:00
MB_END ( )
} ;
2014-08-17 03:18:43 +00:00
static menuresel_t resel ;
2015-08-20 03:32:09 +00:00
int item , bias = 0 ;
2015-08-20 03:17:47 +00:00
extern cvar_t r_drawflat ;
2012-04-24 07:59:11 +00:00
menu = M_Options_Title ( & y , 0 ) ;
2014-08-17 03:18:43 +00:00
MC_AddBulk ( menu , & resel , bulk , 16 , 216 , y ) ;
2015-08-20 03:17:47 +00:00
menu - > selecteditem = menu - > options ;
//bottoms up!
2015-08-20 03:32:09 +00:00
# ifdef RTLIGHTS
2015-08-20 03:17:47 +00:00
if ( r_shadow_realtime_world . ival )
item = 1 ; //realtime
2015-08-20 03:32:09 +00:00
else
# else
bias = 1 ;
# endif
2018-07-05 16:21:44 +00:00
if ( r_deluxemapping_cvar . ival )
2015-08-20 03:17:47 +00:00
item = 2 ; //nice
else if ( gl_load24bit . ival )
item = 3 ; //normal
else if ( r_softwarebanding_cvar . ival )
2017-07-04 05:07:51 +00:00
item = 4 ; //vanilla
else if ( cl_sbar . ival = = 2 )
item = 5 ; //spasm
2015-08-20 03:17:47 +00:00
else if ( ! r_drawflat . ival )
2017-07-04 05:07:51 +00:00
item = 6 ; //fast
2015-08-20 03:17:47 +00:00
else
2017-07-04 05:07:51 +00:00
item = 7 ; //simple
2019-05-23 15:11:32 +00:00
item + + ; //the autosave option
2015-08-20 03:32:09 +00:00
item - = bias ;
2015-08-20 03:17:47 +00:00
while ( item - - > 0 )
menu - > selecteditem = menu - > selecteditem - > common . next ;
2012-05-11 01:57:00 +00:00
menu - > cursoritem - > common . posy = menu - > selecteditem - > common . posy ;
2012-04-24 07:59:11 +00:00
}
2005-09-14 20:56:34 +00:00
void FPS_Preset_f ( void )
{
2014-05-07 20:25:08 +00:00
char * presetfname ;
2005-09-14 20:56:34 +00:00
char * arg = Cmd_Argv ( 1 ) ;
int i ;
2011-06-07 23:54:58 +00:00
2012-04-24 07:59:11 +00:00
if ( ! * arg )
{
M_Menu_Preset_f ( ) ;
return ;
}
2014-05-07 20:25:08 +00:00
presetfname = va ( " configs/preset_%s.cfg " , arg ) ;
if ( COM_FCheckExists ( presetfname ) )
{
char buffer [ MAX_OSPATH ] ;
2015-01-02 05:20:56 +00:00
COM_QuotedString ( presetfname , buffer , sizeof ( buffer ) , false ) ;
2017-12-09 21:22:46 +00:00
Cbuf_InsertText ( va ( " \n exec %s \n fs_restart \n " , buffer ) , RESTRICT_LOCAL , false ) ;
return ;
}
2018-07-24 13:59:42 +00:00
if ( ! stricmp ( " hdr " , arg ) )
{
Cbuf_InsertText (
" set vid_srgb 2 \n "
" set r_hdr_irisadaptation 1 \n "
, RESTRICT_LOCAL , false ) ;
return ;
}
2019-07-16 02:59:12 +00:00
if ( ! stricmp ( " qw " , arg ) )
{ //enable qwisms
Cbuf_InsertText (
" set sv_nqplayerphysics 0 \n "
" set sv_gameplayfix_multiplethinks 1 \n "
, RESTRICT_LOCAL , false ) ;
return ;
}
if ( ! stricmp ( " nq " , arg ) )
{ //disable qwisms, for better mod compat
Cbuf_InsertText (
" set sv_nqplayerphysics 1 \n "
" set sv_gameplayfix_multiplethinks 0 \n "
, RESTRICT_LOCAL , false ) ;
return ;
}
2019-01-20 01:00:18 +00:00
if ( ! stricmp ( " dp " , arg ) )
{
2019-02-16 19:09:07 +00:00
# ifdef HAVE_SERVER
2019-01-29 07:18:07 +00:00
if ( sv . state )
Cbuf_InsertText ( " echo Be sure to restart your server \n " , RESTRICT_LOCAL , false ) ;
2019-02-16 19:09:07 +00:00
# endif
2019-01-20 01:00:18 +00:00
Cbuf_InsertText (
2019-07-16 02:59:12 +00:00
" fps_preset nq \n "
2019-01-29 07:18:07 +00:00
//these are for smc+derived mods
" sv_listen_dp 1 \n " //awkward, but forces the server to load the effectinfo.txt in advance.
" sv_bigcoords 1 \n " //for viewmodel lep precision (would be better to use csqc)
" r_particledesc \" effectinfo high \" \n " //blurgh.
" dpcompat_noretouchground 1 \n " //don't call touch functions on entities that already appear onground. this also changes the order that the onground flag is set relative to touch functions.
" cl_nopred 1 \n " //DP doesn't predict by default, and DP mods have a nasty habit of clearing .solid values during prethinks, which screws up prediction. so play safe.
" r_dynamic 0 \n r_shadow_realtime_dlight 1 \n " //fte has separate cvars for everything. which kinda surprises people and makes stuff twice as bright as it should be.
2019-02-16 19:09:07 +00:00
" r_coronas_intensity 0.25 \n "
" con_logcenterprint 0 \n " //kinda annoying....
" scr_fov_mode 4 \n " //for fairer framerate comparisons
2019-01-29 07:18:07 +00:00
//general compat stuff
" dpcompat_console 1 \n " //
" dpcompat_findradiusarealinks 1 \n " //faster findradiuses (but that require things are setorigined properly)
" dpcompat_makeshitup 2 \n " //flatten shaders to a single pass, then add new specular etc passes.
//"dpcompat_nopremulpics 1\n" //don't use premultiplied alpha (solving issues with compressed image formats)
" dpcompat_psa_ungroup 1 \n " //don't use framegroups with psk models at all.
" dpcompat_set 1 \n " //handle 3-arg sets differently
" dpcompat_stats 1 \n " //truncate float stats
" dpcompat_strcat_limit 16383 \n " //xonotic compat. maximum length of strcat strings.
// "sv_listen_dp 1\nsv_listen_nq 0\nsv_listen_qw 0\ncl_loopbackprotocol dpp7\ndpcompat_nopreparse 1\n"
2019-01-20 01:00:18 +00:00
, RESTRICT_LOCAL , false ) ;
return ;
}
2018-01-22 19:18:04 +00:00
if ( ! stricmp ( " tenebrae " , arg ) )
{ //for the luls. combine with the tenebrae mod for maximum effect.
Cbuf_InsertText (
2019-07-16 02:59:12 +00:00
" fps_preset nq \n "
2018-01-22 19:18:04 +00:00
" set r_shadow_realtime_world 1 \n "
" set r_shadow_realtime_dlight 1 \n "
" set r_shadow_bumpscale_basetexture 4 \n "
" set r_shadow_shadowmapping 0 \n "
" set gl_specular 1 \n "
" set gl_specular_power 16 \n "
" set gl_specular_fallback 1 \n "
" set mod_litsprites_force 1 \n "
" set r_nolerp 1 \n " //well, that matches tenebrae. for the luls, right?
, RESTRICT_LOCAL , false ) ;
return ;
}
2017-12-09 21:22:46 +00:00
if ( ! stricmp ( " timedemo " , arg ) )
{
//some extra things to pwn timedemos.
Cbuf_InsertText (
" fps_preset fast \n "
" set r_renderscale 1 \n "
" set contrast 1 \n "
" set gamma 1 \n "
" set brightness 0 \n "
" set scr_autoid 0 \n "
" set scr_autoid_team 0 \n "
" set r_dynamic 0 \n "
" set sbar_teamstatus 2 \n "
" set gl_polyblend 0 \n "
# if 1
//these are cheaty settings.
" set gl_flashblend 0 \n "
" set cl_predict_players 0 \n " //very cheaty. you won't realise its off, but noone would disable it for actual play.
# else
//to make things fair
" set gl_flashblend 1 \n "
" set r_part_density 1 \n "
# endif
, RESTRICT_LOCAL , false ) ;
2014-05-07 20:25:08 +00:00
return ;
}
2011-06-07 23:54:58 +00:00
for ( i = 0 ; i < PRESET_NUM ; i + + )
2005-09-14 20:56:34 +00:00
{
2011-06-07 23:54:58 +00:00
if ( ! stricmp ( presetname [ i ] , arg ) )
2005-09-14 20:56:34 +00:00
{
ApplyPreset ( i ) ;
return ;
}
}
Con_Printf ( " Preset %s not recognised \n " , arg ) ;
Con_Printf ( " Valid presests: \n " ) ;
2011-06-07 23:54:58 +00:00
for ( i = 0 ; i < PRESET_NUM ; i + + )
Con_Printf ( " %s \n " , presetname [ i ] ) ;
2005-09-14 20:56:34 +00:00
}
2011-06-15 23:01:07 +00:00
qboolean M_PresetApply ( union menuoption_s * op , struct menu_s * menu , int key )
{
fpsmenuinfo_t * info = ( fpsmenuinfo_t * ) menu - > data ;
2017-08-16 02:14:07 +00:00
if ( key ! = K_ENTER & & key ! = K_KP_ENTER & & key ! = K_GP_START & & key ! = K_MOUSE1 )
2011-06-15 23:01:07 +00:00
return false ;
Cbuf_AddText ( " fps_preset " , RESTRICT_LOCAL ) ;
Cbuf_AddText ( info - > preset - > options [ info - > preset - > selectedoption ] , RESTRICT_LOCAL ) ;
Cbuf_AddText ( " \n " , RESTRICT_LOCAL ) ;
return true ;
}
2004-08-23 00:15:46 +00:00
void M_Menu_FPS_f ( void )
{
2011-06-15 23:01:07 +00:00
static const char * fpsopts [ ] =
{
" Disabled " ,
" Average FPS " ,
" Worst FPS " ,
" Best FPS " ,
" Immediate FPS " ,
" Average MSEC " ,
" Worst MSEC " ,
" Best MSEC " ,
" Immediate MSEC " ,
NULL
} ;
static const char * fpsvalues [ ] = { " 0 " , " 1 " , " 2 " , " 3 " , " 4 " , " -1 " , " -2 " , " -3 " , " -4 " , NULL } ;
2011-12-05 15:23:40 +00:00
static const char * entlerpopts [ ] =
{
" Enabled (always) " ,
" Disabled " ,
" Enabled (SP only) " ,
NULL
} ;
static const char * playerlerpopts [ ] =
{
" Disabled " ,
" Enabled " ,
NULL
} ;
2011-06-15 23:01:07 +00:00
static const char * bodyopts [ ] =
{
" Disabled " ,
" Ground " ,
" All " ,
NULL
} ;
2011-12-05 15:23:40 +00:00
static const char * values_0_1_2 [ ] = { " 0 " , " 1 " , " 2 " , NULL } ;
static const char * values_0_1 [ ] = { " 0 " , " 1 " , NULL } ;
2011-06-15 23:01:07 +00:00
2004-08-23 00:15:46 +00:00
menu_t * menu ;
2011-06-15 23:01:07 +00:00
fpsmenuinfo_t * info ;
2004-08-23 00:15:46 +00:00
2018-07-22 11:49:37 +00:00
extern cvar_t v_contentblend , show_fps , cl_r2g , cl_gibfilter , cl_expsprite , cl_deadbodyfilter , cl_lerp_players , cl_nolerp , cl_maxfps , cl_yieldcpu ;
2014-08-17 03:18:43 +00:00
static menuresel_t resel ;
2010-07-11 02:22:39 +00:00
int y ;
2011-06-15 23:01:07 +00:00
menu = M_Options_Title ( & y , sizeof ( fpsmenuinfo_t ) ) ;
info = ( fpsmenuinfo_t * ) menu - > data ;
2004-08-23 00:15:46 +00:00
2011-12-05 15:23:40 +00:00
/*lerping is here because I'm not sure where else to put it. if they care about framerate that much then they'll want to disable interpolation to get as up-to-date stuff as possible*/
2005-03-15 22:51:01 +00:00
{
2012-06-16 08:58:36 +00:00
menubulk_t bulk [ ] =
2011-06-15 23:01:07 +00:00
{
2016-07-12 00:40:13 +00:00
MB_REDTEXT ( " FPS Options " , true ) ,
MB_TEXT ( " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , true ) ,
2011-06-15 23:01:07 +00:00
MB_COMBORETURN ( " Preset " , presetname , 2 , info - > preset , " Select a builtin configuration of graphical settings. " ) ,
MB_CMD ( " Apply " , M_PresetApply , " Applies selected preset. " ) ,
MB_SPACING ( 4 ) ,
MB_COMBOCVAR ( " Show FPS " , show_fps , fpsopts , fpsvalues , " Display FPS or frame millisecond values on screen. Settings except immediate are for values across 1 second. " ) ,
2018-07-22 11:49:37 +00:00
MB_EDITCVARSLIM ( " Framerate Limiter " , cl_maxfps . name , " Limits the maximum framerate. Set to 0 for none. " ) ,
MB_CHECKBOXCVARTIP ( " Yield CPU " , cl_yieldcpu , 1 , " Reduce CPU usage between frames. \n Should probably be off when using vsync. " ) ,
2011-12-05 15:23:40 +00:00
MB_COMBOCVAR ( " Player lerping " , cl_lerp_players , playerlerpopts , values_0_1 , " Smooth movement of other players, but will increase effective latency. Does not affect all network protocols. " ) ,
MB_COMBOCVAR ( " Entity lerping " , cl_nolerp , entlerpopts , values_0_1_2 , " Smooth movement of entities, but will increase effective latency. " ) ,
2011-06-15 23:01:07 +00:00
MB_CHECKBOXCVAR ( " Content Blend " , v_contentblend , 0 ) ,
MB_CHECKBOXCVAR ( " Gib Filter " , cl_gibfilter , 0 ) ,
2011-12-05 15:23:40 +00:00
MB_COMBOCVAR ( " Dead Body Filter " , cl_deadbodyfilter , bodyopts , values_0_1_2 , " Selects which dead player frames to filter out in rendering. Ground frames are those of the player lying on the ground, and all frames include all used in the player dying animation. " ) ,
2011-06-15 23:01:07 +00:00
MB_CHECKBOXCVAR ( " Explosion Sprite " , cl_expsprite , 0 ) ,
MB_CHECKBOXCVAR ( " Rockets to Grenades " , cl_r2g , 0 ) ,
MB_EDITCVAR ( " Skybox " , " r_skybox " ) ,
MB_END ( )
} ;
2019-01-13 16:51:50 +00:00
MC_AddFrameStart ( menu , y ) ;
2014-08-17 03:18:43 +00:00
MC_AddBulk ( menu , & resel , bulk , 16 , 216 , y ) ;
2019-01-13 16:51:50 +00:00
MC_AddFrameEnd ( menu , y ) ;
2005-03-15 22:51:01 +00:00
}
2009-12-29 14:00:56 +00:00
}
2005-09-28 23:36:08 +00:00
2011-06-07 23:54:58 +00:00
void M_Menu_Render_f ( void )
2009-12-29 14:00:56 +00:00
{
2011-06-07 23:54:58 +00:00
static const char * warpopts [ ] =
{
" Disabled " ,
" FOV Warp " ,
" Shader " ,
NULL
} ;
static const char * warpvalues [ ] =
{
" 0 " ,
" -1 " ,
" 1 " ,
NULL
} ;
2016-01-18 05:22:07 +00:00
static const char * logcenteropts [ ] = { " Off " , " Singleplayer " , " Always " , NULL } ;
static const char * logcentervalues [ ] = { " 0 " , " 1 " , " 2 " , NULL } ;
2009-12-29 14:00:56 +00:00
2018-10-11 10:31:23 +00:00
static const char * cshiftopts [ ] = { " Off " , " Fullscreen " , " Edges " , NULL } ;
static const char * cshiftvalues [ ] = { " 0 " , " 1 " , " 2 " , NULL } ;
2011-06-07 23:54:58 +00:00
menu_t * menu ;
2018-08-13 06:27:29 +00:00
extern cvar_t r_novis , cl_item_bobbing , r_waterwarp , r_nolerp , r_noframegrouplerp , r_fastsky , gl_nocolors , gl_lerpimages , r_wateralpha , r_drawviewmodel , gl_cshiftenabled , r_hdr_irisadaptation , scr_logcenterprint , r_fxaa , r_graphics ;
2011-06-09 07:09:53 +00:00
# ifdef GLQUAKE
extern cvar_t r_bloom ;
# endif
2014-08-17 03:18:43 +00:00
static menuresel_t resel ;
2009-12-29 14:00:56 +00:00
2011-06-07 23:54:58 +00:00
int y ;
menubulk_t bulk [ ] =
{
2016-07-12 00:40:13 +00:00
MB_REDTEXT ( " Rendering Options " , true ) ,
MB_TEXT ( " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , true ) ,
2018-08-13 06:27:29 +00:00
MB_CHECKBOXCVAR ( " Graphics " , r_graphics , 0 ) , //graphics on / off. Its a general dig at modern games not having any real options.
2014-04-02 00:58:02 +00:00
MB_CHECKBOXCVAR ( " Disable VIS " , r_novis , 0 ) ,
2011-06-07 23:54:58 +00:00
MB_CHECKBOXCVAR ( " Fast Sky " , r_fastsky , 0 ) ,
MB_CHECKBOXCVAR ( " Disable Model Lerp " , r_nolerp , 0 ) ,
2013-03-12 22:40:16 +00:00
MB_CHECKBOXCVAR ( " Disable Framegroup Lerp " , r_noframegrouplerp , 0 ) ,
2011-06-07 23:54:58 +00:00
MB_CHECKBOXCVAR ( " Lerp Images " , gl_lerpimages , 0 ) ,
MB_COMBOCVAR ( " Water Warp " , r_waterwarp , warpopts , warpvalues , NULL ) ,
MB_SLIDER ( " Water Alpha " , r_wateralpha , 0 , 1 , 0.1 , NULL ) ,
MB_SLIDER ( " Viewmodel Alpha " , r_drawviewmodel , 0 , 1 , 0.1 , NULL ) ,
2018-10-11 10:31:23 +00:00
MB_COMBOCVAR ( " Screen Tints " , gl_cshiftenabled , cshiftopts , cshiftvalues , " Changes how screen flashes should be displayed (otherwise known as polyblends). " ) ,
2018-03-04 14:41:16 +00:00
# ifdef QWSKINS
2011-06-07 23:54:58 +00:00
MB_CHECKBOXCVAR ( " Disable Colormap " , gl_nocolors , 0 ) ,
2018-03-04 14:41:16 +00:00
# endif
2016-01-18 05:22:07 +00:00
MB_COMBOCVAR ( " Log Centerprints " , scr_logcenterprint , logcenteropts , logcentervalues , " Display centerprints in the console also. " ) ,
2018-08-13 06:27:29 +00:00
MB_CHECKBOXCVAR ( " FXAA " , r_fxaa , 0 ) ,
2011-06-09 07:09:53 +00:00
# ifdef GLQUAKE
2011-06-07 23:54:58 +00:00
MB_CHECKBOXCVAR ( " Bloom " , r_bloom , 0 ) ,
2011-06-09 07:09:53 +00:00
# endif
2015-04-27 12:51:42 +00:00
MB_CHECKBOXCVAR ( " HDR " , r_hdr_irisadaptation , 0 ) ,
2011-06-07 23:54:58 +00:00
MB_CHECKBOXCVAR ( " Model Bobbing " , cl_item_bobbing , 0 ) ,
MB_END ( )
} ;
menu = M_Options_Title ( & y , 0 ) ;
2019-01-13 16:51:50 +00:00
MC_AddFrameStart ( menu , y ) ;
2014-08-17 03:18:43 +00:00
MC_AddBulk ( menu , & resel , bulk , 16 , 216 , y ) ;
2019-01-13 16:51:50 +00:00
MC_AddFrameEnd ( menu , y ) ;
2009-12-29 14:00:56 +00:00
}
2011-06-07 23:54:58 +00:00
void M_Menu_Textures_f ( void )
2009-12-29 14:00:56 +00:00
{
2011-06-07 23:54:58 +00:00
static const char * texturefilternames [ ] =
{
" Nearest " ,
" Bilinear " ,
" Trilinear " ,
NULL
} ;
static const char * texturefiltervalues [ ] =
{
" GL_NEAREST_MIPMAP_NEAREST " ,
" GL_LINEAR_MIPMAP_NEAREST " ,
" GL_LINEAR_MIPMAP_LINEAR " ,
NULL
} ;
2010-01-17 06:42:30 +00:00
2011-06-07 23:54:58 +00:00
static const char * texture2dfilternames [ ] =
2005-03-15 22:51:01 +00:00
{
2011-06-07 23:54:58 +00:00
" Nearest " ,
" Linear " ,
NULL
} ;
static const char * texture2dfiltervalues [ ] =
2005-03-15 22:51:01 +00:00
{
2011-06-07 23:54:58 +00:00
" GL_NEAREST " ,
" GL_LINEAR " ,
NULL
} ;
2009-12-29 14:00:56 +00:00
2011-06-07 23:54:58 +00:00
static const char * anisotropylevels [ ] =
{
" Off " ,
" 2x " ,
" 4x " ,
" 8x " ,
" 16x " ,
NULL
} ;
static const char * anisotropyvalues [ ] =
{
" 1 " ,
" 2 " ,
" 4 " ,
" 8 " ,
" 16 " ,
NULL
} ;
2009-12-29 14:00:56 +00:00
2011-06-07 23:54:58 +00:00
static const char * texturesizeoptions [ ] =
{
" 128 " ,
2017-02-19 00:15:42 +00:00
// "192",
2011-06-07 23:54:58 +00:00
" 256 " ,
2017-02-19 00:15:42 +00:00
// "384",
2011-06-07 23:54:58 +00:00
" 512 " ,
2017-02-19 00:15:42 +00:00
// "768",
2011-06-07 23:54:58 +00:00
" 1024 " ,
" 2048 " ,
" 4096 " ,
" 8192 " ,
NULL
2009-12-29 14:00:56 +00:00
} ;
2014-02-13 23:54:57 +00:00
extern cvar_t gl_load24bit , gl_specular , gl_compress , gl_picmip , gl_picmip2d , gl_max_size , r_drawflat , r_glsl_offsetmapping ;
2012-01-01 02:26:42 +00:00
extern cvar_t gl_texture_anisotropic_filtering , gl_texturemode , gl_texturemode2d , gl_mipcap ;
2010-07-11 02:22:39 +00:00
int y ;
2011-06-07 23:54:58 +00:00
menubulk_t bulk [ ] =
{
2016-07-12 00:40:13 +00:00
MB_REDTEXT ( " Texture Options " , true ) ,
MB_TEXT ( " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , true ) ,
2011-06-07 23:54:58 +00:00
MB_CHECKBOXCVAR ( " Load Replacements " , gl_load24bit , 0 ) ,
MB_CHECKBOXCVAR ( " Simple Texturing " , r_drawflat , 0 ) ,
2011-06-15 23:01:07 +00:00
MB_COMBOCVAR ( " 3D Filter Mode " , gl_texturemode , texturefilternames , texturefiltervalues , " Chooses the texture filtering method used for 3D objects. " ) ,
MB_COMBOCVAR ( " 2D Filter Mode " , gl_texturemode2d , texture2dfilternames , texture2dfiltervalues , " Chooses the texture filtering method used for HUD, menus, and other 2D assets. " ) ,
2011-06-07 23:54:58 +00:00
MB_COMBOCVAR ( " Anisotropy " , gl_texture_anisotropic_filtering , anisotropylevels , anisotropyvalues , NULL ) ,
MB_SPACING ( 4 ) ,
2019-02-16 19:09:07 +00:00
# ifdef GLQUAKE
2015-08-07 17:49:49 +00:00
MB_CHECKBOXCVAR ( " Software-style Rendering " , r_softwarebanding_cvar , 0 ) ,
2019-02-16 19:09:07 +00:00
# endif
2011-06-07 23:54:58 +00:00
MB_CHECKBOXCVAR ( " Specular Highlights " , gl_specular , 0 ) ,
2014-02-07 08:38:40 +00:00
// MB_CHECKBOXCVAR("Detail Textures", gl_detail, 0),
2011-12-26 15:19:13 +00:00
MB_CHECKBOXCVAR ( " offsetmapping " , r_glsl_offsetmapping , 0 ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( 4 ) ,
MB_CHECKBOXCVAR ( " Texture Compression " , gl_compress , 0 ) , // merge the save compressed tex options into here?
MB_SLIDER ( " 3D Picmip " , gl_picmip , 0 , 16 , 1 , NULL ) ,
MB_SLIDER ( " 2D Picmip " , gl_picmip2d , 0 , 16 , 1 , NULL ) ,
2012-01-01 02:26:42 +00:00
MB_SLIDER ( " World Mipcap " , gl_mipcap , 0 , 3 , 1 , NULL ) ,
2011-06-07 23:54:58 +00:00
MB_COMBOCVAR ( " Max Texture Size " , gl_max_size , texturesizeoptions , texturesizeoptions , NULL ) ,
MB_END ( )
} ;
menu_t * menu = M_Options_Title ( & y , 0 ) ;
2014-08-17 03:18:43 +00:00
static menuresel_t resel ;
2019-01-13 16:51:50 +00:00
MC_AddFrameStart ( menu , y ) ;
2014-08-17 03:18:43 +00:00
MC_AddBulk ( menu , & resel , bulk , 16 , 216 , y ) ;
2019-01-13 16:51:50 +00:00
MC_AddFrameEnd ( menu , y ) ;
2009-12-29 14:00:56 +00:00
}
2004-08-23 00:15:46 +00:00
2009-12-29 14:00:56 +00:00
typedef struct {
2011-06-07 23:54:58 +00:00
menucombo_t * lightcombo ;
menucombo_t * dlightcombo ;
} lightingmenuinfo_t ;
2010-01-17 06:42:30 +00:00
2011-06-07 23:54:58 +00:00
qboolean M_VideoApplyShadowLighting ( union menuoption_s * op , struct menu_s * menu , int key )
{
lightingmenuinfo_t * info = ( lightingmenuinfo_t * ) menu - > data ;
2009-12-29 14:00:56 +00:00
2017-08-16 02:14:07 +00:00
if ( key ! = K_ENTER & & key ! = K_KP_ENTER & & key ! = K_GP_START & & key ! = K_MOUSE1 )
2009-12-29 14:00:56 +00:00
return false ;
2016-02-15 06:01:17 +00:00
# ifdef RTLIGHTS
2005-09-14 20:56:34 +00:00
{
2011-06-07 23:54:58 +00:00
char * cvarsrw = " 0 " ;
char * cvarsrws = " 0 " ;
char * cvarv = " 0 " ;
switch ( info - > lightcombo - > selectedoption )
2010-01-17 06:42:30 +00:00
{
case 1 :
2011-06-07 23:54:58 +00:00
cvarsrw = " 1 " ;
2010-01-17 06:42:30 +00:00
break ;
case 2 :
2011-06-07 23:54:58 +00:00
cvarsrw = " 1 " ;
cvarsrws = " 1 " ;
2010-01-17 06:42:30 +00:00
break ;
case 3 :
2011-06-07 23:54:58 +00:00
cvarv = " 1 " ;
2010-01-17 06:42:30 +00:00
break ;
}
2011-06-07 23:54:58 +00:00
# ifdef MINIMAL
2018-11-27 16:48:19 +00:00
( void ) cvarv ;
2011-06-07 23:54:58 +00:00
Cbuf_AddText ( va ( " r_shadow_realtime_world %s;r_shadow_realtime_world_shadows %s \n " , cvarsrw , cvarsrws ) , RESTRICT_LOCAL ) ;
# else
Cbuf_AddText ( va ( " r_vertexlight %s;r_shadow_realtime_world %s;r_shadow_realtime_world_shadows %s \n " , cvarv , cvarsrw , cvarsrws ) , RESTRICT_LOCAL ) ;
# endif
2010-01-17 06:42:30 +00:00
}
2016-02-15 06:01:17 +00:00
# endif
2010-01-17 06:42:30 +00:00
{
2011-06-07 23:54:58 +00:00
char * cvard = " 0 " ;
char * cvarvd = " 0 " ;
char * cvarsrd = " 0 " ;
char * cvarsrds = " 0 " ;
2012-05-09 15:30:53 +00:00
switch ( info - > dlightcombo - > selectedoption )
2010-01-17 06:42:30 +00:00
{
case 1 :
2011-06-07 23:54:58 +00:00
cvard = " 1 " ;
2010-01-17 06:42:30 +00:00
break ;
case 2 :
2011-06-07 23:54:58 +00:00
cvarsrd = " 1 " ;
2010-01-23 07:14:37 +00:00
break ;
case 3 :
2011-06-07 23:54:58 +00:00
cvarsrd = " 1 " ;
cvarsrds = " 1 " ;
2010-01-17 06:42:30 +00:00
break ;
2010-01-23 07:14:37 +00:00
case 4 :
2015-10-27 15:20:15 +00:00
cvard = " -1 " ;
break ;
case 5 :
2011-06-07 23:54:58 +00:00
cvard = " 1 " ;
cvarvd = " 1 " ;
2010-01-23 07:14:37 +00:00
break ;
2010-01-17 06:42:30 +00:00
}
2016-02-15 06:01:17 +00:00
# ifdef RTLIGHTS
2011-06-07 23:54:58 +00:00
# ifdef MINIMAL
2012-03-23 07:23:39 +00:00
Cbuf_AddText ( va ( " r_shadow_realtime_dlight %s;r_shadow_realtime_dlight_shadows %s;r_dynamic %s \n " , cvarsrd , cvarsrds , cvard ) , RESTRICT_LOCAL ) ;
2011-06-07 23:54:58 +00:00
# else
2012-03-23 07:23:39 +00:00
Cbuf_AddText ( va ( " r_shadow_realtime_dlight %s;r_shadow_realtime_dlight_shadows %s;r_dynamic %s;r_vertexdlight %s \n " , cvarsrd , cvarsrds , cvard , cvarvd ) , RESTRICT_LOCAL ) ;
2010-01-17 06:42:30 +00:00
# endif
2016-02-15 06:01:17 +00:00
# else
# ifdef MINIMAL
Cbuf_AddText ( va ( " r_dynamic %s \n " , cvard ) , RESTRICT_LOCAL ) ;
# else
Cbuf_AddText ( va ( " r_dynamic %s;r_vertexdlight %s \n " , cvard , cvarvd ) , RESTRICT_LOCAL ) ;
# endif
# endif
( void ) cvarsrd , ( void ) cvarsrds , ( void ) cvard , ( void ) cvarvd ;
2011-06-07 23:54:58 +00:00
}
2010-01-17 06:42:30 +00:00
2009-12-29 14:00:56 +00:00
Cbuf_AddText ( " vid_restart \n " , RESTRICT_LOCAL ) ;
M_RemoveMenu ( menu ) ;
2011-06-09 07:09:53 +00:00
Cbuf_AddText ( " menu_lighting \n " , RESTRICT_LOCAL ) ;
2009-12-29 14:00:56 +00:00
return true ;
2004-08-23 00:15:46 +00:00
}
2009-12-29 14:00:56 +00:00
2011-06-07 23:54:58 +00:00
void M_Menu_Lighting_f ( void )
2009-12-29 14:00:56 +00:00
{
2011-06-07 23:54:58 +00:00
# ifndef MINIMAL
2016-07-12 00:40:13 +00:00
extern cvar_t r_vertexlight ;
2011-06-07 23:54:58 +00:00
# endif
2018-03-04 14:41:16 +00:00
extern cvar_t r_stains , r_shadows , r_loadlits , r_lightmap_format ;
2013-03-12 22:47:42 +00:00
extern cvar_t r_lightstylesmooth , r_nolightdir ;
2016-02-15 06:01:17 +00:00
# ifdef RTLIGHTS
extern cvar_t r_dynamic , r_shadow_realtime_world , r_shadow_realtime_dlight , r_shadow_realtime_dlight_shadows ;
2016-07-12 00:40:13 +00:00
# ifndef MINIMAL
extern cvar_t r_vertexdlights ;
# endif
2016-02-15 06:01:17 +00:00
# endif
2013-03-12 22:47:42 +00:00
extern cvar_t r_fb_models , r_rocketlight , r_powerupglow ;
2011-06-07 23:54:58 +00:00
extern cvar_t v_powerupshell , r_explosionlight ;
2013-03-12 22:47:42 +00:00
//extern cvar_t r_fb_bmodels, r_shadow_realtime_world_lightmaps, r_lightstylespeed;
2011-06-07 23:54:58 +00:00
static const char * lightingopts [ ] =
2009-12-29 14:00:56 +00:00
{
2011-06-07 23:54:58 +00:00
" Standard " ,
2016-02-15 06:01:17 +00:00
# ifdef RTLIGHTS
2011-06-07 23:54:58 +00:00
" Realtime " ,
" RT+Shadows " ,
# ifndef MINIMAL
" Vertex " ,
2016-02-15 06:01:17 +00:00
# endif
2011-06-07 23:54:58 +00:00
# endif
2009-12-29 14:00:56 +00:00
NULL
} ;
2011-06-07 23:54:58 +00:00
static const char * dlightopts [ ] =
2009-12-29 14:00:56 +00:00
{
2011-06-07 23:54:58 +00:00
" None " ,
" Standard " ,
2016-02-15 06:01:17 +00:00
# ifdef RTLIGHTS
2011-06-07 23:54:58 +00:00
" Realtime " ,
" RT+Shadows " ,
2015-10-27 15:20:15 +00:00
" Threaded Lightmaps " ,
2011-06-07 23:54:58 +00:00
# ifndef MINIMAL
" Vertex " ,
2016-02-15 06:01:17 +00:00
# endif
2011-06-07 23:54:58 +00:00
# endif
2009-12-29 14:00:56 +00:00
NULL
} ;
2011-06-07 23:54:58 +00:00
static const char * loadlitopts [ ] =
2009-12-29 14:00:56 +00:00
{
2011-06-07 23:54:58 +00:00
" Disabled " ,
" Enabled " ,
2012-02-12 05:18:31 +00:00
" Generate " ,
2011-06-07 23:54:58 +00:00
NULL
} ;
static const char * loadlitvalues [ ] =
{
" 0 " ,
" 1 " ,
" 2 " ,
2009-12-29 14:00:56 +00:00
NULL
} ;
2011-06-07 23:54:58 +00:00
static const char * fbopts [ ] =
{
" Disabled " ,
" Enabled " ,
" Traced " ,
NULL
} ;
static const char * fbvalues [ ] =
{
" 0 " ,
" 1 " ,
" 2 " ,
2010-01-17 06:42:30 +00:00
NULL
} ;
2011-06-07 23:54:58 +00:00
static const char * powerupopts [ ] =
2010-01-17 06:42:30 +00:00
{
2011-06-07 23:54:58 +00:00
" Disabled " ,
" Enabled " ,
" Non-Self " ,
NULL
} ;
static const char * powerupvalues [ ] =
{
" 0 " ,
" 1 " ,
" 2 " ,
2010-01-17 06:42:30 +00:00
NULL
} ;
2012-01-24 04:24:14 +00:00
static const char * fb_models_opts [ ] =
{
" Disabled " ,
" Entire model " ,
" If textured " ,
NULL
} ;
static const char * fb_models_values [ ] =
{
" 0 " ,
" 1 " ,
" 2 " ,
NULL
} ;
2018-03-04 14:41:16 +00:00
static const char * lightmapformatopts [ ] =
{
" Automatic " ,
" 8bit (Greyscale) " ,
" 8bit (Misaligned) " ,
" 8bit (Aligned) " ,
" 10bit " ,
" 9bit (HDR) " ,
" Half-Float (HDR) " ,
" Float (HDR) " ,
NULL
} ;
static const char * lightmapformatvalues [ ] =
{
" " ,
" l8 " ,
" rgb8 " ,
" bgrx8 " ,
" rgb10 " ,
" rgb9e5 " ,
" rgba16f " ,
" rgba32f " ,
// "rgb4",
// "rgb565",
// "rgba5551",
NULL
} ;
2010-07-11 02:22:39 +00:00
int y ;
2011-06-07 23:54:58 +00:00
menu_t * menu = M_Options_Title ( & y , sizeof ( lightingmenuinfo_t ) ) ;
2013-10-08 14:28:11 +00:00
2011-06-07 23:54:58 +00:00
int lightselect , dlightselect ;
2009-12-29 14:00:56 +00:00
2016-02-15 06:01:17 +00:00
# ifdef RTLIGHTS
2011-06-07 23:54:58 +00:00
if ( r_shadow_realtime_world . ival )
{
if ( r_shadow_realtime_world_shadows . ival )
lightselect = 2 ;
else
lightselect = 1 ;
}
2016-02-15 06:01:17 +00:00
else
# endif
2011-06-07 23:54:58 +00:00
# ifndef MINIMAL
2016-02-15 06:01:17 +00:00
if ( r_vertexlight . ival )
2011-06-07 23:54:58 +00:00
lightselect = 3 ;
2009-12-29 14:00:56 +00:00
else
2016-02-15 06:01:17 +00:00
# endif
2011-06-07 23:54:58 +00:00
lightselect = 0 ;
2010-01-16 04:59:13 +00:00
2016-02-15 06:01:17 +00:00
# ifdef RTLIGHTS
2011-06-07 23:54:58 +00:00
if ( r_shadow_realtime_dlight . ival )
2010-01-16 04:59:13 +00:00
{
2011-06-07 23:54:58 +00:00
if ( r_shadow_realtime_dlight_shadows . ival )
dlightselect = 3 ;
else
dlightselect = 2 ;
2010-01-16 04:59:13 +00:00
}
2015-10-27 15:20:15 +00:00
else if ( r_dynamic . ival < 0 )
dlightselect = 4 ;
2010-01-16 06:16:42 +00:00
# ifndef MINIMAL
2011-06-07 23:54:58 +00:00
else if ( r_vertexdlights . ival )
2015-10-27 15:20:15 +00:00
dlightselect = 5 ;
2004-08-23 00:15:46 +00:00
# endif
2016-02-15 06:01:17 +00:00
else
# endif
if ( r_dynamic . ival > 0 )
2011-06-07 23:54:58 +00:00
dlightselect = 1 ;
else
dlightselect = 0 ;
2009-12-30 04:06:14 +00:00
{
2011-06-07 23:54:58 +00:00
lightingmenuinfo_t * info = menu - > data ;
menubulk_t bulk [ ] =
{
2016-07-12 00:40:13 +00:00
MB_REDTEXT ( " Lighting Options " , true ) ,
MB_TEXT ( " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , true ) ,
2011-06-07 23:54:58 +00:00
MB_COMBORETURN ( " Lighting Mode " , lightingopts , lightselect , info - > lightcombo , " Selects method used for world lighting. Realtime lighting requires appropriate realtime lighting files for maps. " ) ,
MB_COMBORETURN ( " Dynamic Lighting Mode " , dlightopts , dlightselect , info - > dlightcombo , " Selects method used for dynamic lighting such as explosion lights and muzzle flashes. " ) ,
2016-02-15 06:01:17 +00:00
# ifdef RTLIGHTS
2013-10-08 14:28:11 +00:00
MB_CHECKBOXCVARTIP ( " Soft Shadows " , r_shadow_shadowmapping , 0 , " Enables softer shadows instead of course-edged pixelated shadows. " ) ,
2011-06-07 23:54:58 +00:00
MB_CMD ( " Apply Lighting " , M_VideoApplyShadowLighting , " Applies set lighting modes and restarts video. " ) ,
MB_SPACING ( 4 ) ,
2013-10-08 14:28:11 +00:00
# endif
2018-03-04 14:41:16 +00:00
MB_COMBOCVAR ( " Lightmap Format " , r_lightmap_format , lightmapformatopts , lightmapformatvalues , " Selects which format to use for lightmaps. " ) ,
2011-06-07 23:54:58 +00:00
MB_COMBOCVAR ( " LIT Loading " , r_loadlits , loadlitopts , loadlitvalues , " Determines if the engine should use external colored lighting for maps. The generated setting will cause the engine to generate colored lighting for maps that don't have the associated data. " ) ,
2018-07-05 16:21:44 +00:00
MB_COMBOCVAR ( " Deluxemapping " , r_deluxemapping_cvar , loadlitopts , loadlitvalues , " Controls whether static lighting should respond to lighting directions. " ) ,
2011-06-07 23:54:58 +00:00
MB_CHECKBOXCVAR ( " Lightstyle Lerp " , r_lightstylesmooth , 0 ) ,
MB_SPACING ( 4 ) ,
MB_COMBOCVAR ( " Flash Blend " , r_flashblend , fbopts , fbvalues , " Disables or enables the spherical light effect for dynamic lights. Traced means the sphere effect will be line of sight checked before displaying the effect. " ) ,
MB_SLIDER ( " Explosion Light " , r_explosionlight , 0 , 1 , 0.1 , NULL ) ,
MB_SLIDER ( " Rocket Light " , r_rocketlight , 0 , 1 , 0.1 , NULL ) ,
2011-06-15 23:01:07 +00:00
MB_COMBOCVAR ( " Powerup Glow " , r_powerupglow , powerupopts , powerupvalues , " Disables or enables the dynamic light effect for powerups. Non-self will disable the light only for the current player. " ) ,
2011-06-07 23:54:58 +00:00
MB_CHECKBOXCVAR ( " Powerup Shell " , v_powerupshell , 0 ) ,
MB_SPACING ( 4 ) ,
2011-12-05 15:23:40 +00:00
MB_SLIDER ( " Blob Shadows " , r_shadows , 0 , 1 , 0.05 , " Small blobs underneath monsters and players, to add depth to the scene without excessive rendering. " ) ,
MB_SLIDER ( " Stains " , r_stains , 0 , 1 , 0.05 , " Allows discolouration of world surfaces, commonly used for blood trails. " ) ,
MB_CHECKBOXCVARTIP ( " No Light Direction " , r_nolightdir , 0 , " Disables shading calculations for uniform light levels on models from all directions. " ) ,
2012-01-24 04:24:14 +00:00
MB_COMBOCVAR ( " Model Fullbrights " , r_fb_models , fb_models_opts , fb_models_values , " Affects loading of fullbrights on models/polymeshes. " ) ,
2011-06-07 23:54:58 +00:00
MB_END ( )
} ;
2014-08-17 03:18:43 +00:00
static menuresel_t resel ;
2019-01-13 16:51:50 +00:00
MC_AddFrameStart ( menu , y ) ;
2014-08-17 03:18:43 +00:00
MC_AddBulk ( menu , & resel , bulk , 16 , 216 , y ) ;
2019-01-13 16:51:50 +00:00
MC_AddFrameEnd ( menu , y ) ;
2009-12-30 04:06:14 +00:00
}
}
2010-01-23 07:14:37 +00:00
typedef struct {
menucombo_t * skillcombo ;
menucombo_t * mapcombo ;
} singleplayerinfo_t ;
2016-02-15 06:01:17 +00:00
# ifndef CLIENTONLY
2010-07-11 02:22:39 +00:00
static const char * maplist_q1 [ ] =
{
" start " ,
" e1m1 " ,
" e1m2 " ,
" e1m3 " ,
" e1m4 " ,
" e1m5 " ,
" e1m6 " ,
" e1m7 " ,
" e1m8 " ,
" e2m1 " ,
" e2m2 " ,
" e2m3 " ,
" e2m4 " ,
" e2m5 " ,
" e2m6 " ,
" e2m7 " ,
" e3m1 " ,
" e3m2 " ,
" e3m3 " ,
" e3m4 " ,
" e3m5 " ,
" e3m6 " ,
" e3m7 " ,
" e4m1 " ,
" e4m2 " ,
" e4m3 " ,
" e4m4 " ,
" e4m5 " ,
" e4m6 " ,
" e4m7 " ,
" e4m8 " ,
" end "
} ;
static const char * mapoptions_q1 [ ] =
{
" Start (Introduction) " ,
" E1M1 (The Slipgate Complex) " ,
" E1M2 (Castle Of The Damned) " ,
" E1M3 (The Necropolis) " ,
" E1M4 (The Grisly Grotto) " ,
" E1M5 (Gloom Keep) " ,
" E1M6 (The Door To Chthon) " ,
" E1M7 (The House Of Chthon) " ,
" E1M8 (Ziggarat Vertigo) " ,
" E2M1 (The Installation) " ,
" E2M2 (The Ogre Citadel) " ,
" E2M3 (The Crypt Of Decay) " ,
" E2M4 (The Ebon Fortress) " ,
" E2M5 (The Wizard's Manse) " ,
" E2M6 (The Dismal Oubliette " ,
" E2M7 (The Underearth) " ,
" E3M1 (Termination Central) " ,
" E3M2 (The Vaults Of Zin) " ,
" E3M3 (The Tomb Of Terror) " ,
" E3M4 (Satan's Dark Delight) " ,
" E3M5 (The Wind Tunnels) " ,
" E3M6 (Chambers Of Torment) " ,
" E3M7 (Tha Haunted Halls) " ,
" E4M1 (The Sewage System) " ,
" E4M2 (The Tower Of Despair) " ,
" E4M3 (The Elder God Shrine) " ,
" E4M4 (The Palace Of Hate) " ,
" E4M5 (Hell's Atrium) " ,
" E4M6 (The Pain Maze) " ,
" E4M7 (Azure Agony) " ,
" E4M8 (The Nameless City) " ,
" End (Shub-Niggurath's Pit) " ,
NULL
} ;
2016-02-15 06:01:17 +00:00
# ifdef Q2CLIENT
2010-07-11 02:22:39 +00:00
static const char * maplist_q2 [ ] =
{
" base1 " ,
" base2 " ,
" base3 " ,
" train " ,
" bunk1 " ,
" ware1 " ,
" ware2 " ,
" jail1 " ,
" jail2 " ,
" jail3 " ,
" jail4 " ,
" jail5 " ,
" security " ,
" mintro " ,
" mine1 " ,
" mine2 " ,
" mine3 " ,
" mine4 " ,
" fact1 " ,
" fact3 " ,
" fact2 " ,
" power1 " ,
" power2 " ,
" cool1 " ,
" waste1 " ,
" waste2 " ,
" waste3 " ,
" biggun " ,
" hangar1 " ,
" space " ,
" lab " ,
" hangar2 " ,
" command " ,
" strike " ,
" city1 " ,
" city2 " ,
" city3 " ,
" boss1 " ,
2017-10-31 22:52:58 +00:00
" boss2 " ,
NULL
2010-07-11 02:22:39 +00:00
} ;
static const char * mapoptions_q2 [ ] =
{
" base1 (Unit 1 Base Unit: Outer Base) " ,
" base2 (Unit 1 Base Unit: Installation) " ,
" base3 (Unit 1 Base Unit: Comm Center) " ,
" train (Unit 1 Base Unit: Lost Station) " ,
" bunk1 (Unit 2 Warehouse Unit: Ammo Depot) " ,
" ware1 (Unit 2 Warehouse Unit: Supply Station) " ,
" ware2 (Unit 2 Warehouse Unit: Warehouse) " ,
" jail1 (Unit 3 Jail Unit: Main Gate) " ,
" jail2 (Unit 3 Jail Unit: Destination Center) " ,
" jail3 (Unit 3 Jail Unit: Security Compex) " ,
" jail4 (Unit 3 Jail Unit: Torture Chambers) " ,
" jail5 (Unit 3 Jail Unit: Guard House) " ,
" security (Unit 3 Jail Unit: Grid Control) " ,
" mintro (Unit 4 Mine Unit: Mine Entrance) " ,
" mine1 (Unit 4 Mine Unit: Upper Mines) " ,
" mine2 (Unit 4 Mine Unit: Borehole) " ,
" mine3 (Unit 4 Mine Unit: Drilling Area) " ,
" mine4 (Unit 4 Mine Unit: Lower Mines) " ,
" fact1 (Unit 5 Factory Unit: Receiving Center) " ,
" fact3 (Unit 5 Factory Unit: Sudden Death) " ,
" fact2 (Unit 5 Factory Unit: Processing Plant) " ,
" power1 (Unit 6 Power Unit/Big Gun: Power Plant) " ,
" power2 (Unit 6 Power Unit/Big Gun: The Reactor) " ,
" cool1 (Unit 6 Power Unit/Big Gun: Cooling Facility) " ,
" waste1 (Unit 6 Power Unit/Big Gun: Toxic Waste Dump) " ,
" waste2 (Unit 6 Power Unit/Big Gun: Pumping Station 1) " ,
" waste3 (Unit 6 Power Unit/Big Gun: Pumping Station 2) " ,
" biggun (Unit 6 Power Unit/Big Gun: Big Gun) " ,
" hangar1 (Unit 7 Hangar Unit: Outer Hangar) " ,
" space (Unit 7 Hangar Unit: Comm Satelite) " ,
" lab (Unit 7 Hangar Unit: Research Lab) " ,
" hangar2 (Unit 7 Hangar Unit: Inner Hangar) " ,
" command (Unit 7 Hangar Unit: Launch Command) " ,
" strike (Unit 7 Hangar Unit: Outlands) " ,
" city1 (Unit 8 City Unit: Outer Courts) " ,
" city2 (Unit 8 City Unit: Lower Palace) " ,
" city3 (Unit 8 City Unit: Upper Palace) " ,
" boss1 (Unit 9 Boss Levels: Inner Chamber) " ,
" boss2 (Unit 9 Boss Levels: Final Showdown) " ,
NULL
} ;
2016-02-15 06:01:17 +00:00
# endif
# endif
2010-07-11 02:22:39 +00:00
2010-01-23 07:14:37 +00:00
qboolean M_Apply_SP_Cheats ( union menuoption_s * op , struct menu_s * menu , int key )
{
singleplayerinfo_t * info = menu - > data ;
2017-08-16 02:14:07 +00:00
if ( key ! = K_ENTER & & key ! = K_KP_ENTER & & key ! = K_GP_START & & key ! = K_MOUSE1 )
2010-01-23 07:14:37 +00:00
return false ;
switch ( info - > skillcombo - > selectedoption )
{
case 0 :
Cbuf_AddText ( " skill 0 \n " , RESTRICT_LOCAL ) ;
break ;
case 1 :
Cbuf_AddText ( " skill 1 \n " , RESTRICT_LOCAL ) ;
break ;
case 2 :
Cbuf_AddText ( " skill 2 \n " , RESTRICT_LOCAL ) ;
break ;
case 3 :
Cbuf_AddText ( " skill 3 \n " , RESTRICT_LOCAL ) ;
2004-08-23 00:15:46 +00:00
break ;
}
2016-02-15 06:01:17 +00:00
# ifndef CLIENTONLY
2017-10-31 22:52:58 +00:00
if ( ( unsigned int ) info - > mapcombo - > selectedoption < countof ( maplist_q1 ) - 1 )
2010-07-11 02:22:39 +00:00
Cbuf_AddText ( va ( " map %s \n " , maplist_q1 [ info - > mapcombo - > selectedoption ] ) , RESTRICT_LOCAL ) ;
2016-02-15 06:01:17 +00:00
# endif
2010-01-23 07:14:37 +00:00
M_RemoveMenu ( menu ) ;
Cbuf_AddText ( " menu_spcheats \n " , RESTRICT_LOCAL ) ;
return true ;
}
2011-06-07 23:54:58 +00:00
void M_Menu_Singleplayer_Cheats_Quake ( void )
2010-01-23 07:14:37 +00:00
{
2016-02-15 06:01:17 +00:00
# ifndef CLIENTONLY
2010-01-23 07:14:37 +00:00
static const char * skilloptions [ ] =
{
" Easy " ,
" Normal " ,
" Hard " ,
" Nightmare " ,
" None Set " ,
NULL
} ;
int currentskill ;
int currentmap ;
2010-07-11 02:22:39 +00:00
extern cvar_t sv_gravity , sv_cheats , sv_maxspeed , skill ;
2010-01-23 08:13:21 +00:00
extern cvar_t host_mapname ;
2010-07-11 02:22:39 +00:00
# endif
2016-02-15 06:01:17 +00:00
singleplayerinfo_t * info ;
int cursorpositionY ;
2010-07-11 02:22:39 +00:00
int y ;
menu_t * menu = M_Options_Title ( & y , sizeof ( * info ) ) ;
2010-01-23 07:14:37 +00:00
info = menu - > data ;
cursorpositionY = ( y + 24 ) ;
2010-07-11 02:22:39 +00:00
# ifndef CLIENTONLY
2014-08-27 08:41:31 +00:00
if ( ! * skill . string )
2010-01-23 07:14:37 +00:00
currentskill = 4 ; // no skill selected
2014-08-27 08:41:31 +00:00
else
currentskill = skill . value ;
2010-01-23 07:14:37 +00:00
2017-10-31 22:52:58 +00:00
for ( currentmap = countof ( maplist_q1 ) ; currentmap - - > 0 ; )
2010-07-11 02:22:39 +00:00
if ( ! strcmp ( host_mapname . string , maplist_q1 [ currentmap ] ) )
break ;
/*anything that doesn't match will end up with 0*/
# endif
2010-01-23 07:14:37 +00:00
2014-03-30 08:55:06 +00:00
MC_AddRedText ( menu , 16 , 170 , y , " Quake Singleplayer Cheats " , false ) ; y + = 8 ;
2014-10-05 20:04:11 +00:00
MC_AddWhiteText ( menu , 16 , 170 , y , " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , false ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
y + = 8 ;
# ifndef CLIENTONLY
2013-10-29 17:38:22 +00:00
info - > skillcombo = MC_AddCombo ( menu , 16 , 170 , y , " Difficulty " , skilloptions , currentskill ) ; y + = 8 ;
info - > mapcombo = MC_AddCombo ( menu , 16 , 170 , y , " Map " , mapoptions_q1 , currentmap ) ; y + = 8 ;
MC_AddCheckBox ( menu , 16 , 170 , y , " Cheats " , & sv_cheats , 0 ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# endif
2011-05-20 04:10:46 +00:00
# ifdef TEXTEDITOR
2014-05-07 20:25:08 +00:00
MC_AddCheckBox ( menu , 16 , 170 , y , " Debugger " , & pr_debugger , 0 ) ; y + = 8 ;
2011-05-20 04:10:46 +00:00
# endif
2014-03-30 08:55:06 +00:00
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Toggle Godmode " , " god \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Toggle Flymode " , " fly \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Toggle Noclip " , " noclip \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Quad Damage " , " impulse 255 \n " ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# ifndef CLIENTONLY
2013-10-29 17:38:22 +00:00
MC_AddSlider ( menu , 16 , 170 , y , " Gravity " , & sv_gravity , 0 , 800 , 25 ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# endif
2013-10-29 17:38:22 +00:00
MC_AddSlider ( menu , 16 , 170 , y , " Forward Speed " , & cl_forwardspeed , 0 , 1000 , 50 ) ; y + = 8 ;
MC_AddSlider ( menu , 16 , 170 , y , " Side Speed " , & cl_sidespeed , 0 , 1000 , 50 ) ; y + = 8 ;
MC_AddSlider ( menu , 16 , 170 , y , " Back Speed " , & cl_backspeed , 0 , 1000 , 50 ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# ifndef CLIENTONLY
2013-10-29 17:38:22 +00:00
MC_AddSlider ( menu , 16 , 170 , y , " Max Movement Speed " , & sv_maxspeed , 0 , 1000 , 50 ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# endif
2014-03-30 08:55:06 +00:00
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Silver & Gold Keys " , " impulse 13 \n impulse 14 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " All Weapons & Items " , " impulse 9 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " No Enemy Targetting " , " notarget \n " ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# ifndef CLIENTONLY
2014-03-30 08:55:06 +00:00
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Restart Map " , " restart \n " ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# else
2014-03-30 08:55:06 +00:00
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Suicide " , " kill \n " ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# endif
2010-01-23 07:14:37 +00:00
2010-07-11 02:22:39 +00:00
y + = 8 ;
2014-03-30 08:55:06 +00:00
MC_AddCommand ( menu , 16 , 170 , y , " Apply Changes " , M_Apply_SP_Cheats ) ; y + = 8 ;
2010-01-23 07:14:37 +00:00
menu - > selecteditem = ( union menuoption_s * ) info - > skillcombo ;
2014-03-30 08:55:06 +00:00
menu - > cursoritem = ( menuoption_t * ) MC_AddWhiteText ( menu , 170 , 0 , cursorpositionY , NULL , false ) ;
2010-01-23 07:14:37 +00:00
}
2018-03-24 04:02:09 +00:00
# ifdef Q2SERVER
2010-01-23 07:14:37 +00:00
// Quake 2
typedef struct {
menucombo_t * skillcombo ;
menucombo_t * mapcombo ;
} singleplayerq2info_t ;
qboolean M_Apply_SP_Cheats_Q2 ( union menuoption_s * op , struct menu_s * menu , int key )
{
singleplayerq2info_t * info = menu - > data ;
2017-08-16 02:14:07 +00:00
if ( key ! = K_ENTER & & key ! = K_KP_ENTER & & key ! = K_GP_START & & key ! = K_MOUSE1 )
2010-01-23 07:14:37 +00:00
return false ;
switch ( info - > skillcombo - > selectedoption )
{
case 0 :
Cbuf_AddText ( " skill 0 \n " , RESTRICT_LOCAL ) ;
break ;
case 1 :
Cbuf_AddText ( " skill 1 \n " , RESTRICT_LOCAL ) ;
break ;
case 2 :
Cbuf_AddText ( " skill 2 \n " , RESTRICT_LOCAL ) ;
break ;
}
2017-10-31 22:52:58 +00:00
if ( ( unsigned int ) info - > mapcombo - > selectedoption < countof ( maplist_q2 ) - 1 )
2010-07-11 02:22:39 +00:00
Cbuf_AddText ( va ( " map %s \n " , maplist_q2 [ info - > mapcombo - > selectedoption ] ) , RESTRICT_LOCAL ) ;
2010-01-23 07:14:37 +00:00
M_RemoveMenu ( menu ) ;
2011-06-07 23:54:58 +00:00
Cbuf_AddText ( " menu_spcheats \n " , RESTRICT_LOCAL ) ;
2010-01-23 07:14:37 +00:00
return true ;
}
2011-06-07 23:54:58 +00:00
void M_Menu_Singleplayer_Cheats_Quake2 ( void )
2010-01-23 07:14:37 +00:00
{
static const char * skilloptions [ ] =
{
" Easy " ,
" Normal " ,
" Hard " ,
" None Set " ,
NULL
} ;
singleplayerq2info_t * info ;
int cursorpositionY ;
2010-11-07 03:58:09 +00:00
# ifndef CLIENTONLY
2010-01-23 07:14:37 +00:00
int currentskill ;
int currentmap ;
2010-07-11 02:22:39 +00:00
extern cvar_t sv_gravity , sv_cheats , sv_maxspeed , skill ;
2010-01-23 08:13:21 +00:00
extern cvar_t host_mapname ;
2010-07-11 02:22:39 +00:00
# endif
int y ;
menu_t * menu = M_Options_Title ( & y , sizeof ( * info ) ) ;
2010-01-23 07:14:37 +00:00
info = menu - > data ;
cursorpositionY = ( y + 24 ) ;
2010-11-07 03:58:09 +00:00
# ifndef CLIENTONLY
2014-08-27 08:41:31 +00:00
if ( ! * skill . string )
currentskill = 3 ; // no skill selected
else
currentskill = skill . value ;
2010-01-23 07:14:37 +00:00
2017-10-31 22:52:58 +00:00
for ( currentmap = countof ( maplist_q2 ) ; currentmap - - > 0 ; )
2010-07-11 02:22:39 +00:00
if ( ! strcmp ( host_mapname . string , maplist_q2 [ currentmap ] ) )
break ;
/*anything that doesn't match will end up with 0*/
# endif
2010-01-23 07:14:37 +00:00
2014-03-30 08:55:06 +00:00
MC_AddRedText ( menu , 16 , 170 , y , " Quake2 Singleplayer Cheats " , false ) ; y + = 8 ;
2014-10-05 20:04:11 +00:00
MC_AddWhiteText ( menu , 16 , 170 , y , " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , false ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
y + = 8 ;
# ifndef CLIENTONLY
2013-10-29 17:38:22 +00:00
info - > skillcombo = MC_AddCombo ( menu , 16 , 170 , y , " Difficulty " , skilloptions , currentskill ) ; y + = 8 ;
info - > mapcombo = MC_AddCombo ( menu , 16 , 170 , y , " Map " , mapoptions_q2 , currentmap ) ; y + = 8 ;
MC_AddCheckBox ( menu , 16 , 170 , y , " Cheats " , & sv_cheats , 0 ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# endif
2014-03-30 08:55:06 +00:00
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Toggle Godmode " , " god \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Toggle Noclip " , " noclip \n " ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# ifndef CLIENTONLY
2013-10-29 17:38:22 +00:00
MC_AddSlider ( menu , 16 , 170 , y , " Gravity " , & sv_gravity , 0 , 850 , 25 ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# endif
2013-10-29 17:38:22 +00:00
MC_AddSlider ( menu , 16 , 170 , y , " Forward Speed " , & cl_forwardspeed , 0 , 1000 , 50 ) ; y + = 8 ;
MC_AddSlider ( menu , 16 , 170 , y , " Side Speed " , & cl_sidespeed , 0 , 1000 , 50 ) ; y + = 8 ;
MC_AddSlider ( menu , 16 , 170 , y , " Back Speed " , & cl_backspeed , 0 , 1000 , 50 ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# ifndef CLIENTONLY
2013-10-29 17:38:22 +00:00
MC_AddSlider ( menu , 16 , 170 , y , " Max Movement Speed " , & sv_maxspeed , 0 , 1000 , 50 ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# endif
2014-03-30 08:55:06 +00:00
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Unlimited Ammo " , " dmflags 8192 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Quad Damage " , " give quad damage \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Blue & Red Key " , " give blue key \n give red key \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Pyramid Key " , " give pyramid key \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " All Weapons & Items " , " give all \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Data Spinner " , " give data spinner \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Power Cube " , " give power cube \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Data CD " , " give data cd \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Ammo Pack " , " give ammo pack \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Bandolier " , " give bandolier \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Adrenaline " , " give adrenaline \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Ancient Head " , " give ancient head \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Environment Suit " , " give environment suit \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Rebreather " , " give rebreather \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Invulnerability " , " give invulnerability \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Silencer " , " give silencer \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Power Shield " , " give power shield \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Commander's Head " , " give commander's head \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Security Pass " , " give security pass \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Airstrike Marker " , " give airstrike marker \n " ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# ifndef CLIENTONLY
2014-03-30 08:55:06 +00:00
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Restart Map " , va ( " restart \n " ) ) ; y + = 8 ;
2010-07-11 02:22:39 +00:00
# endif
2010-01-23 07:14:37 +00:00
2010-07-11 02:22:39 +00:00
y + = 8 ;
2014-03-30 08:55:06 +00:00
MC_AddCommand ( menu , 16 , 170 , y , " Apply Changes " , M_Apply_SP_Cheats_Q2 ) ; y + = 8 ;
2010-01-23 07:14:37 +00:00
menu - > selecteditem = ( union menuoption_s * ) info - > skillcombo ;
2014-03-30 08:55:06 +00:00
menu - > cursoritem = ( menuoption_t * ) MC_AddWhiteText ( menu , 170 , 0 , cursorpositionY , NULL , false ) ;
2010-01-23 07:14:37 +00:00
}
2016-02-15 06:01:17 +00:00
# endif // Quake 2
2010-01-23 07:14:37 +00:00
2016-02-15 06:01:17 +00:00
# ifdef HEXEN2 // Hexen 2
2010-01-23 07:14:37 +00:00
typedef struct {
menucombo_t * skillcombo ;
menucombo_t * mapcombo ;
} singleplayerh2info_t ;
qboolean M_Apply_SP_Cheats_H2 ( union menuoption_s * op , struct menu_s * menu , int key )
{
singleplayerh2info_t * info = menu - > data ;
2017-08-16 02:14:07 +00:00
if ( key ! = K_ENTER & & key ! = K_KP_ENTER & & key ! = K_GP_START & & key ! = K_MOUSE1 )
2010-01-23 07:14:37 +00:00
return false ;
switch ( info - > skillcombo - > selectedoption )
{
case 0 :
Cbuf_AddText ( " skill 0 \n " , RESTRICT_LOCAL ) ;
break ;
case 1 :
Cbuf_AddText ( " skill 1 \n " , RESTRICT_LOCAL ) ;
break ;
case 2 :
Cbuf_AddText ( " skill 2 \n " , RESTRICT_LOCAL ) ;
break ;
case 3 :
Cbuf_AddText ( " skill 3 \n " , RESTRICT_LOCAL ) ;
break ;
}
switch ( info - > mapcombo - > selectedoption )
{
case 0 :
Cbuf_AddText ( " map demo1 \n " , RESTRICT_LOCAL ) ;
break ;
case 1 :
Cbuf_AddText ( " map demo2 \n " , RESTRICT_LOCAL ) ;
break ;
case 2 :
Cbuf_AddText ( " map demo3 \n " , RESTRICT_LOCAL ) ;
break ;
case 3 :
Cbuf_AddText ( " map village1 \n " , RESTRICT_LOCAL ) ;
break ;
case 4 :
Cbuf_AddText ( " map village2 \n " , RESTRICT_LOCAL ) ;
break ;
case 5 :
Cbuf_AddText ( " map village3 \n " , RESTRICT_LOCAL ) ;
break ;
case 6 :
Cbuf_AddText ( " map village4 \n " , RESTRICT_LOCAL ) ;
break ;
case 7 :
Cbuf_AddText ( " map village5 \n " , RESTRICT_LOCAL ) ;
break ;
case 8 :
Cbuf_AddText ( " map rider1a \n " , RESTRICT_LOCAL ) ;
break ;
case 9 :
Cbuf_AddText ( " map meso1 \n " , RESTRICT_LOCAL ) ;
break ;
case 10 :
Cbuf_AddText ( " map meso2 \n " , RESTRICT_LOCAL ) ;
break ;
case 11 :
Cbuf_AddText ( " map meso3 \n " , RESTRICT_LOCAL ) ;
break ;
case 12 :
Cbuf_AddText ( " map meso4 \n " , RESTRICT_LOCAL ) ;
break ;
case 13 :
Cbuf_AddText ( " map meso5 \n " , RESTRICT_LOCAL ) ;
break ;
case 14 :
Cbuf_AddText ( " map meso6 \n " , RESTRICT_LOCAL ) ;
break ;
case 15 :
Cbuf_AddText ( " map meso8 \n " , RESTRICT_LOCAL ) ;
break ;
case 16 :
Cbuf_AddText ( " map meso9 \n " , RESTRICT_LOCAL ) ;
break ;
case 17 :
Cbuf_AddText ( " map egypt1 \n " , RESTRICT_LOCAL ) ;
break ;
case 18 :
Cbuf_AddText ( " map egypt2 \n " , RESTRICT_LOCAL ) ;
break ;
case 19 :
Cbuf_AddText ( " map egypt3 \n " , RESTRICT_LOCAL ) ;
break ;
case 20 :
Cbuf_AddText ( " map egypt4 \n " , RESTRICT_LOCAL ) ;
break ;
case 21 :
Cbuf_AddText ( " map egypt5 \n " , RESTRICT_LOCAL ) ;
break ;
case 22 :
Cbuf_AddText ( " map egypt6 \n " , RESTRICT_LOCAL ) ;
break ;
case 23 :
Cbuf_AddText ( " map egypt7 \n " , RESTRICT_LOCAL ) ;
break ;
case 24 :
Cbuf_AddText ( " map rider2c \n " , RESTRICT_LOCAL ) ;
break ;
case 25 :
Cbuf_AddText ( " map romeric1 \n " , RESTRICT_LOCAL ) ;
break ;
case 26 :
Cbuf_AddText ( " map romeric2 \n " , RESTRICT_LOCAL ) ;
break ;
case 27 :
Cbuf_AddText ( " map romeric3 \n " , RESTRICT_LOCAL ) ;
break ;
case 28 :
Cbuf_AddText ( " map romeric4 \n " , RESTRICT_LOCAL ) ;
break ;
case 29 :
Cbuf_AddText ( " map romeric5 \n " , RESTRICT_LOCAL ) ;
break ;
case 30 :
Cbuf_AddText ( " map romeric6 \n " , RESTRICT_LOCAL ) ;
break ;
case 31 :
Cbuf_AddText ( " map romeric7 \n " , RESTRICT_LOCAL ) ;
break ;
case 32 :
Cbuf_AddText ( " map castle4 \n " , RESTRICT_LOCAL ) ;
break ;
case 33 :
Cbuf_AddText ( " map castle5 \n " , RESTRICT_LOCAL ) ;
break ;
case 34 :
Cbuf_AddText ( " map cath \n " , RESTRICT_LOCAL ) ;
break ;
case 35 :
Cbuf_AddText ( " map tower \n " , RESTRICT_LOCAL ) ;
break ;
case 36 :
Cbuf_AddText ( " map eidolon \n " , RESTRICT_LOCAL ) ;
break ;
}
M_RemoveMenu ( menu ) ;
2011-06-07 23:54:58 +00:00
Cbuf_AddText ( " menu_spcheats \n " , RESTRICT_LOCAL ) ;
2010-01-23 07:14:37 +00:00
return true ;
}
2011-06-07 23:54:58 +00:00
void M_Menu_Singleplayer_Cheats_Hexen2 ( void )
2010-01-23 07:14:37 +00:00
{
static const char * skilloptions [ ] =
{
" Easy " ,
" Normal " ,
" Hard " ,
" Nightmare " ,
" None Set " ,
NULL
} ;
static const char * mapoptions [ ] =
{
" demo1 (Blackmarsh: Hub 1 Blackmarsh) " ,
" demo2 (Barbican: Hub 1 Blackmarsh) " ,
" demo3 (The Mill: Hub 1 Blackmarsh) " ,
" village1 (King's Court: Hub 1 Blackmarsh) " ,
" village3 (Stables: Hub 1 Blackmarsh) " ,
" village2 (Inner Courtyard: Hub 1 Blackmarsh) " ,
" village4 (Palance Entrance: Hub 1 Blackmarsh) " ,
" village5 (The Forgotten Chapel: Hub 1 Blackmarsh) " ,
" rider1a (Famine's Domain: Hub 1 Blackmarsh) " ,
" meso1 (Palance of Columns: Hub 2 Mazaera) " ,
" meso2 (Plaza of the Sun: Hub 2 Mazaera) " ,
" meso3 (Square of the Stream: Hub 2 Mazaera) " ,
" meso4 (Tomb of the High Priest: Hub 2 Mazaera) " ,
" meso5 (Obelisk of the Moon: Hub 2 Mazaera) " ,
" meso6 (Court of 1000 Warriors: Hub 2 Mazaera) " ,
" meso8 (Bridge of Stars: Hub 2 Mazaera) " ,
" meso9 (Well of Souls: Hub 2 Mazaera) " ,
" egypt1 (Temple of Horus: Hub 3 Thysis) " ,
" egypt2 (Ancient Tempor of Nefertum: Hub 3 Thysis) " ,
" egypt3 (Tempor of Nefertum: Hub 3 Thysis) " ,
" egypt4 (Palace of the Pharaoh: Hub 3 Thysis " ,
" egypt5 (Pyramid of Anubus: Hub 3 Thysis) " ,
" egypt6 (Temple of Light: Hub 3 Thysis) " ,
" egypt7 (Shrine of Naos: Hub 3 Thysis) " ,
" rider2c (Pestilence's Lair: Hub 3 Thysis) " ,
" romeric1 (The Hall of Heroes: Hub 4 Septimus) " ,
" romeric2 (Gardens of Athena: Hub 4 Septimus) " ,
" romeric3 (Forum of Zeus: Hub 4 Septimus) " ,
" romeric4 (Baths of Demetrius: Hub 4 Septimus) " ,
" romeric5 (Temple of Mars: Hub 4 Septimus) " ,
" romeric6 (Coliseum of War: Hub 4 Septimus) " ,
" romeric7 (Reflecting Pool: Hub 4 Septimus) " ,
" castle4 (The Underhalls: Hub 5 Return to Blackmarsh) " ,
" castle5 (Eidolon's Ordeal: Hub 5 Return to Blackmarsh) " ,
" cath (Cathedral: Hub 5 Return to Blackmarsh) " ,
" tower (Tower of the Dark Mage: Hub 5 Return to Blackmarsh) " ,
" eidolon (Eidolon's Lair: Hub 5 Return to Blackmarsh) " ,
NULL
} ;
singleplayerh2info_t * info ;
int cursorpositionY ;
int currentmap ;
2010-11-07 02:20:14 +00:00
# ifndef CLIENTONLY
2010-07-11 02:22:39 +00:00
int currentskill ;
2010-01-23 08:13:21 +00:00
extern cvar_t sv_gravity , sv_cheats , sv_maxspeed , skill ;
# endif
extern cvar_t host_mapname ;
2010-07-11 02:22:39 +00:00
int y ;
menu_t * menu = M_Options_Title ( & y , sizeof ( * info ) ) ;
2010-01-23 07:14:37 +00:00
info = menu - > data ;
cursorpositionY = ( y + 24 ) ;
2010-11-07 02:20:14 +00:00
# ifndef CLIENTONLY
2014-08-27 08:41:31 +00:00
if ( ! * skill . string )
2010-01-23 07:14:37 +00:00
currentskill = 4 ; // no skill selected
2014-08-27 08:41:31 +00:00
else
currentskill = skill . value ;
2010-01-23 08:13:21 +00:00
# endif
2010-01-23 07:14:37 +00:00
if ( strcmp ( host_mapname . string , " " ) = = 0 )
currentmap = 0 ;
else if ( stricmp ( host_mapname . string , " demo1 " ) = = 0 )
currentmap = 0 ;
else if ( stricmp ( host_mapname . string , " demo2 " ) = = 0 )
currentmap = 1 ;
else if ( stricmp ( host_mapname . string , " demo3 " ) = = 0 )
currentmap = 2 ;
else if ( stricmp ( host_mapname . string , " village1 " ) = = 0 )
currentmap = 3 ;
else if ( stricmp ( host_mapname . string , " village2 " ) = = 0 )
currentmap = 4 ;
else if ( stricmp ( host_mapname . string , " village3 " ) = = 0 )
currentmap = 5 ;
else if ( stricmp ( host_mapname . string , " village4 " ) = = 0 )
currentmap = 6 ;
else if ( stricmp ( host_mapname . string , " village5 " ) = = 0 )
currentmap = 7 ;
else if ( stricmp ( host_mapname . string , " rider1a " ) = = 0 )
currentmap = 8 ;
else if ( stricmp ( host_mapname . string , " meso1 " ) = = 0 )
currentmap = 9 ;
else if ( stricmp ( host_mapname . string , " meso2 " ) = = 0 )
currentmap = 10 ;
else if ( stricmp ( host_mapname . string , " meso3 " ) = = 0 )
currentmap = 11 ;
else if ( stricmp ( host_mapname . string , " meso4 " ) = = 0 )
currentmap = 12 ;
else if ( stricmp ( host_mapname . string , " meso5 " ) = = 0 )
currentmap = 13 ;
else if ( stricmp ( host_mapname . string , " meso6 " ) = = 0 )
currentmap = 14 ;
else if ( stricmp ( host_mapname . string , " meso8 " ) = = 0 )
currentmap = 15 ;
else if ( stricmp ( host_mapname . string , " meso9 " ) = = 0 )
currentmap = 16 ;
else if ( stricmp ( host_mapname . string , " egypt1 " ) = = 0 )
currentmap = 17 ;
else if ( stricmp ( host_mapname . string , " egypt2 " ) = = 0 )
currentmap = 18 ;
else if ( stricmp ( host_mapname . string , " egypt3 " ) = = 0 )
currentmap = 19 ;
else if ( stricmp ( host_mapname . string , " egypt4 " ) = = 0 )
currentmap = 20 ;
else if ( stricmp ( host_mapname . string , " egypt5 " ) = = 0 )
currentmap = 21 ;
else if ( stricmp ( host_mapname . string , " egypt6 " ) = = 0 )
currentmap = 22 ;
else if ( stricmp ( host_mapname . string , " egypt7 " ) = = 0 )
currentmap = 23 ;
else if ( stricmp ( host_mapname . string , " rider2c " ) = = 0 )
currentmap = 24 ;
else if ( stricmp ( host_mapname . string , " romeric1 " ) = = 0 )
currentmap = 25 ;
else if ( stricmp ( host_mapname . string , " romeric2 " ) = = 0 )
currentmap = 26 ;
else if ( stricmp ( host_mapname . string , " romeric3 " ) = = 0 )
currentmap = 27 ;
else if ( stricmp ( host_mapname . string , " romeric4 " ) = = 0 )
currentmap = 28 ;
else if ( stricmp ( host_mapname . string , " romeric5 " ) = = 0 )
currentmap = 29 ;
else if ( stricmp ( host_mapname . string , " romeric6 " ) = = 0 )
currentmap = 30 ;
else if ( stricmp ( host_mapname . string , " romeric7 " ) = = 0 )
currentmap = 31 ;
else if ( stricmp ( host_mapname . string , " castle4 " ) = = 0 )
currentmap = 32 ;
else if ( stricmp ( host_mapname . string , " castle5 " ) = = 0 )
currentmap = 33 ;
else if ( stricmp ( host_mapname . string , " cath " ) = = 0 )
currentmap = 34 ;
else if ( stricmp ( host_mapname . string , " tower " ) = = 0 )
currentmap = 35 ;
else if ( stricmp ( host_mapname . string , " eidolon " ) = = 0 )
currentmap = 36 ;
else
currentmap = 0 ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
MC_AddRedText ( menu , 16 , 170 , y , " Hexen2 Singleplayer Cheats " , false ) ; y + = 8 ;
MC_AddWhiteText ( menu , 16 , 170 , y , " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , false ) ; y + = 8 ;
y + = 8 ;
# ifndef CLIENTONLY
info - > skillcombo = MC_AddCombo ( menu , 16 , 170 , y , " Difficulty " , skilloptions , currentskill ) ; y + = 8 ;
# endif
info - > mapcombo = MC_AddCombo ( menu , 16 , 170 , y , " Map " , mapoptions , currentmap ) ; y + = 8 ;
# ifndef CLIENTONLY
MC_AddCheckBox ( menu , 16 , 170 , y , " Cheats " , & sv_cheats , 0 ) ; y + = 8 ;
# endif
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Toggle Godmode " , " god \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Toggle Flymode " , " fly \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Toggle Noclip " , " noclip \n " ) ; y + = 8 ;
# ifndef CLIENTONLY
MC_AddSlider ( menu , 16 , 170 , y , " Gravity " , & sv_gravity , 0 , 800 , 25 ) ; y + = 8 ;
# endif
MC_AddSlider ( menu , 16 , 170 , y , " Forward Speed " , & cl_forwardspeed , 0 , 1000 , 50 ) ; y + = 8 ;
MC_AddSlider ( menu , 16 , 170 , y , " Side Speed " , & cl_sidespeed , 0 , 1000 , 50 ) ; y + = 8 ;
MC_AddSlider ( menu , 16 , 170 , y , " Back Speed " , & cl_backspeed , 0 , 1000 , 50 ) ; y + = 8 ;
# ifndef CLIENTONLY
MC_AddSlider ( menu , 16 , 170 , y , " Max Movement Speed " , & sv_maxspeed , 0 , 1000 , 50 ) ; y + = 8 ;
# endif
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Sheep Transformation " , " impulse 14 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Change To Paladin (lvl3+) " , " impulse 171 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Change To Crusader (lvl3+) " , " impulse 172 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Change to Necromancer (lvl3+) " , " impulse 173 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Change to Assassin (lvl3+) " , " impulse 174 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Remove Monsters " , " impulse 35 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Freeze Monsters " , " impulse 36 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Unfreeze Monsters " , " impulse 37 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Increase Level By 1 " , " impulse 40 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Increase Experience " , " impulse 41 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Display Co-ordinates " , " impulse 42 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " All Weapons & Mana " , " impulse 9 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " All Weapons & Mana & Items " , " impulse 43 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " No Enemy Targetting " , " notarget \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Enable Crosshair " , " crosshair 1 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " 20 Of Each Artifact " , " impulse 299 \n " ) ; y + = 8 ;
MC_AddConsoleCommand ( menu , 16 , 170 , y , " Restart Map " , " impulse 99 \n " ) ; y + = 8 ;
y + = 8 ;
MC_AddCommand ( menu , 16 , 170 , y , " Apply Changes " , M_Apply_SP_Cheats_H2 ) ; y + = 8 ;
2010-01-23 07:14:37 +00:00
menu - > selecteditem = ( union menuoption_s * ) info - > skillcombo ;
2014-03-30 08:55:06 +00:00
menu - > cursoritem = ( menuoption_t * ) MC_AddWhiteText ( menu , 250 , 0 , cursorpositionY , NULL , false ) ;
2004-08-23 00:15:46 +00:00
}
2016-02-15 06:01:17 +00:00
# endif
2011-06-07 23:54:58 +00:00
void M_Menu_Singleplayer_Cheats_f ( void )
{
switch ( M_GameType ( ) )
{
case MGT_QUAKE1 :
M_Menu_Singleplayer_Cheats_Quake ( ) ;
break ;
2018-03-24 04:02:09 +00:00
# ifdef Q2SERVER
2011-06-07 23:54:58 +00:00
case MGT_QUAKE2 :
M_Menu_Singleplayer_Cheats_Quake2 ( ) ;
break ;
2014-10-05 20:04:11 +00:00
# endif
# ifdef HEXEN2
2011-06-07 23:54:58 +00:00
case MGT_HEXEN2 :
M_Menu_Singleplayer_Cheats_Hexen2 ( ) ;
break ;
2014-10-05 20:04:11 +00:00
# endif
2011-06-07 23:54:58 +00:00
}
}
// video mode options
# if defined(D3DQUAKE) && defined(GLQUAKE)
# define MULTIRENDERER // allow options for selecting renderer
# endif
typedef struct {
2015-01-21 18:18:37 +00:00
menucombo_t * dispmode ;
2011-06-07 23:54:58 +00:00
menucombo_t * resmode ;
menuedit_t * width ;
menuedit_t * height ;
menuedit_t * bpp ;
menuedit_t * hz ;
menucombo_t * bppfixed ;
menucombo_t * hzfixed ;
menucombo_t * res2dmode ;
menucombo_t * scale ;
menuedit_t * width2d ;
menuedit_t * height2d ;
menucombo_t * ressize [ ASPECT_RATIOS ] ;
menucombo_t * res2dsize [ ASPECT_RATIOS ] ;
} videomenuinfo_t ;
void CheckCustomMode ( struct menu_s * menu )
{
int i , sel ;
videomenuinfo_t * info = ( videomenuinfo_t * ) menu - > data ;
// hide all display controls
2015-01-21 18:18:37 +00:00
info - > resmode - > common . ishidden = true ;
2011-06-07 23:54:58 +00:00
info - > width - > common . ishidden = true ;
info - > height - > common . ishidden = true ;
info - > bpp - > common . ishidden = true ;
info - > hz - > common . ishidden = true ;
info - > bppfixed - > common . ishidden = true ;
info - > hzfixed - > common . ishidden = true ;
for ( i = 0 ; i < ASPECT_RATIOS ; i + + )
info - > ressize [ i ] - > common . ishidden = true ;
2017-03-26 01:46:08 +00:00
if ( ! info - > dispmode | | info - > dispmode - > selectedoption ! = 2 )
2011-06-07 23:54:58 +00:00
{
2015-01-21 18:18:37 +00:00
info - > resmode - > common . ishidden = false ;
sel = info - > resmode - > selectedoption ;
2018-01-22 19:18:04 +00:00
if ( sel = = ASPECT3D_CUSTOM )
2015-01-21 18:18:37 +00:00
{ // unhide custom entries for custom option
info - > width - > common . ishidden = false ;
info - > height - > common . ishidden = false ;
info - > bpp - > common . ishidden = false ;
info - > hz - > common . ishidden = false ;
}
2018-01-22 19:18:04 +00:00
else if ( sel ! = ASPECT3D_DESKTOP )
{
// unhide appropriate aspect ratio combo and restricted bpp/hz combos
info - > bppfixed - > common . ishidden = false ;
info - > hzfixed - > common . ishidden = false ;
info - > ressize [ sel ] - > common . ishidden = false ;
}
2011-06-07 23:54:58 +00:00
}
// hide all 2d display controls
info - > width2d - > common . ishidden = true ;
info - > height2d - > common . ishidden = true ;
info - > scale - > common . ishidden = true ;
for ( i = 0 ; i < ASPECT_RATIOS ; i + + )
info - > res2dsize [ i ] - > common . ishidden = true ;
sel = info - > res2dmode - > selectedoption ;
2018-01-22 19:18:04 +00:00
if ( sel = = ASPECT2D_SCALED ) // unhide scale option
2011-06-07 23:54:58 +00:00
info - > scale - > common . ishidden = false ;
2018-01-22 19:18:04 +00:00
else if ( sel = = ASPECT2D_HEIGHT ) // unhide custom entries for height-only option
info - > height2d - > common . ishidden = false ;
else if ( sel = = ASPECT2D_CUSTOM ) // unhide custom entries for custom option
2011-06-07 23:54:58 +00:00
{
info - > width2d - > common . ishidden = false ;
info - > height2d - > common . ishidden = false ;
}
2018-01-22 19:18:04 +00:00
else if ( sel ! = ASPECT2D_AUTO ) // unhide appropriate aspect ratio combo
info - > res2dsize [ sel ] - > common . ishidden = false ;
2011-06-07 23:54:58 +00:00
}
int M_MatchModes ( int width , int height , int * outres )
{
int i ;
int ratio = - 1 ;
// find closest resolution for each ratio
for ( i = 0 ; i < ASPECT_RATIOS ; i + + )
{
const char * * v = resaspects [ i ] ;
outres [ i ] = 0 ;
// search through each string in ratio array
while ( * v )
{
const char * c = * v ;
int w = atoi ( c ) ;
if ( width < = w )
{
if ( width = = w )
{
// if we match height as well we have a direct resolution match
// so record ratio index
const char * s = strchr ( c , ' x ' ) ;
if ( s )
{
int h = atoi ( s + 1 ) ;
if ( height = = h )
ratio = i ;
}
}
break ;
}
outres [ i ] + + ;
v + + ;
}
}
return ratio ;
}
2011-06-15 23:01:07 +00:00
qboolean M_VideoApply ( union menuoption_s * op , struct menu_s * menu , int key )
2011-06-07 23:54:58 +00:00
{
extern cvar_t vid_desktopsettings ;
videomenuinfo_t * info = ( videomenuinfo_t * ) menu - > data ;
2017-08-16 02:14:07 +00:00
if ( key ! = K_ENTER & & key ! = K_KP_ENTER & & key ! = K_GP_START & & key ! = K_MOUSE1 )
2011-06-07 23:54:58 +00:00
return false ;
2012-06-16 08:58:36 +00:00
2011-06-07 23:54:58 +00:00
// force update display options
{
int w = 0 , h = 0 ;
const char * wc = NULL ;
const char * hc = NULL ;
const char * bc = " 32 " ;
const char * fc = " 0 " ;
const char * dc = " 0 " ;
switch ( info - > resmode - > selectedoption )
{
2018-01-22 19:18:04 +00:00
case ASPECT3D_DESKTOP : // Desktop
2011-06-07 23:54:58 +00:00
dc = " 1 " ;
break ;
2018-01-22 19:18:04 +00:00
case ASPECT3D_CUSTOM : // Custom
2011-06-07 23:54:58 +00:00
wc = info - > width - > text ;
hc = info - > height - > text ;
bc = info - > bpp - > text ;
fc = info - > hz - > text ;
break ;
default : // Aspects
{
menucombo_t * c = info - > ressize [ info - > resmode - > selectedoption ] ;
const char * res = c - > options [ c - > selectedoption ] ;
const char * x = strchr ( res , ' x ' ) ;
w = atoi ( res ) ;
h = atoi ( x + 1 ) ;
bc = info - > bppfixed - > values [ info - > bppfixed - > selectedoption ] ;
fc = info - > hzfixed - > values [ info - > hzfixed - > selectedoption ] ;
}
}
if ( ! wc )
Cvar_SetValue ( info - > width - > cvar , w ) ;
else
Cvar_Set ( info - > width - > cvar , wc ) ;
if ( ! hc )
Cvar_SetValue ( info - > height - > cvar , h ) ;
else
Cvar_Set ( info - > height - > cvar , hc ) ;
Cvar_Set ( info - > bpp - > cvar , bc ) ;
Cvar_Set ( info - > hz - > cvar , fc ) ;
Cvar_Set ( & vid_desktopsettings , dc ) ;
}
// force update 2d options
{
int w = 0 , h = 0 ;
const char * wc = NULL ;
const char * hc = NULL ;
const char * sc = " 0 " ;
switch ( info - > res2dmode - > selectedoption )
{
case ASPECT_RATIOS : // Default
break ;
2018-01-22 19:18:04 +00:00
case ASPECT2D_SCALED : // Scale
2011-06-07 23:54:58 +00:00
sc = info - > scale - > values [ info - > scale - > selectedoption ] ;
break ;
2018-01-22 19:18:04 +00:00
case ASPECT2D_HEIGHT :
wc = " 0 " ;
hc = info - > height2d - > text ;
break ;
case ASPECT2D_CUSTOM : // Custom
2011-06-07 23:54:58 +00:00
wc = info - > width2d - > text ;
hc = info - > height2d - > text ;
break ;
default : // Aspects
{
menucombo_t * c = info - > res2dsize [ info - > res2dmode - > selectedoption ] ;
const char * res = c - > options [ c - > selectedoption ] ;
const char * x = strchr ( res , ' x ' ) ;
w = atoi ( res ) ;
h = atoi ( x + 1 ) ;
}
}
if ( ! wc )
Cvar_SetValue ( info - > width2d - > cvar , w ) ;
else
Cvar_Set ( info - > width2d - > cvar , wc ) ;
if ( ! hc )
Cvar_SetValue ( info - > height2d - > cvar , h ) ;
else
Cvar_Set ( info - > height2d - > cvar , hc ) ;
Cvar_Set ( info - > scale - > cvar , sc ) ;
}
// restart video to apply latched cvars
M_RemoveMenu ( menu ) ;
Cbuf_AddText ( " vid_restart \n menu_video \n " , RESTRICT_LOCAL ) ;
return true ;
}
void M_Menu_Video_f ( void )
{
2013-03-12 22:47:42 +00:00
extern cvar_t v_contrast , vid_conwidth , vid_conheight ;
// extern cvar_t vid_width, vid_height, vid_preservegamma, vid_hardwaregamma, vid_desktopgamma;
2017-03-26 01:46:08 +00:00
extern cvar_t vid_desktopsettings , vid_conautoscale ;
2018-04-27 16:40:50 +00:00
extern cvar_t vid_bpp , vid_refreshrate , vid_multisample , vid_srgb ;
2011-06-07 23:54:58 +00:00
2018-03-04 14:41:16 +00:00
static const char * gammamodeopts [ ] = {
" Off " ,
" Auto " ,
" GLSL " ,
" Hardware " ,
" Scene-Only " ,
NULL
} ;
static const char * gammamodevalues [ ] = {
" 0 " ,
" 1 " ,
" 2 " ,
" 3 " ,
" 4 " ,
NULL
} ;
2018-04-27 16:40:50 +00:00
static const char * srgbopts [ ] = {
" Non-Linear " ,
" sRGB-Aware (PBR) " ,
" Linear (HDR) " ,
" Linearised " , //-1
NULL
} ;
static const char * srgbvalues [ ] = { " 0 " , " 1 " , " 2 " , " -1 " , NULL } ;
2017-03-26 01:46:08 +00:00
# ifdef ANDROID
extern cvar_t sys_orientation ;
static const char * orientationopts [ ] = {
" Auto " ,
" Landscape " ,
" Portrait " ,
" Reverse Landscape " ,
" Reverse Portrait " ,
NULL
} ;
static const char * orientationvalues [ ] = {
" " ,
" landscape " ,
" portrait " ,
" reverselandscape " ,
" reverseportrait " ,
NULL
} ;
# else
2013-03-12 22:47:42 +00:00
extern cvar_t vid_renderer ;
2012-06-16 08:58:36 +00:00
static const char * rendererops [ ] =
2011-06-07 23:54:58 +00:00
{
# ifdef GLQUAKE
" OpenGL " ,
# endif
2016-07-12 00:40:13 +00:00
# ifdef VKQUAKE
" Vulkan (Experimental) " ,
# endif
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
# ifdef D3D8QUAKE
" Direct3D 8 (limited) " ,
# endif
2013-03-12 22:47:42 +00:00
# ifdef D3D9QUAKE
2016-07-12 00:40:13 +00:00
" Direct3D 9 (limited) " ,
2013-03-12 22:47:42 +00:00
# endif
# ifdef D3D11QUAKE
2016-07-12 00:40:13 +00:00
" Direct3D 11 Hardware (Experimental) " ,
" Direct3D 11 Software (Experimental) " ,
2013-03-12 22:47:42 +00:00
# endif
# ifdef SWQUAKE
2016-07-12 00:40:13 +00:00
" Software Rendering (unusable) " ,
# endif
# if defined(_WIN32) && !defined(CLIENTONLY) //win32 because other systems probably won't display a console if started via some shortcut
" Dedicated Server " ,
# endif
#if 0
" Headless " ,
2011-06-07 23:54:58 +00:00
# endif
NULL
} ;
2012-06-16 08:58:36 +00:00
static const char * renderervalues [ ] =
2011-06-07 23:54:58 +00:00
{
# ifdef GLQUAKE
" gl " ,
# endif
2016-07-12 00:40:13 +00:00
# ifdef VKQUAKE
" vk " ,
# endif
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
# ifdef D3D8QUAKE
" d3d8 " ,
# endif
2013-03-12 22:47:42 +00:00
# ifdef D3D9QUAKE
" d3d9 " ,
# endif
# ifdef D3D11QUAKE
" d3d11 " ,
2016-07-12 00:40:13 +00:00
" d3d11 warp " ,
2013-03-12 22:47:42 +00:00
# endif
# ifdef SWQUAKE
" sw " ,
2016-07-12 00:40:13 +00:00
# endif
# if defined(_WIN32) && !defined(CLIENTONLY)
" sv " ,
# endif
#if 0
" headless " ,
2011-06-07 23:54:58 +00:00
# endif
NULL
} ;
2017-03-26 01:46:08 +00:00
extern cvar_t vid_fullscreen ;
2015-01-21 18:18:37 +00:00
static const char * fullscreenopts [ ] = {
" Windowed " ,
" Fullscreen " ,
" Borderless Windowed " ,
NULL
} ;
static const char * fullscreenvalues [ ] = { " 0 " , " 1 " , " 2 " , NULL } ;
2017-03-26 01:46:08 +00:00
# endif
2015-01-21 18:18:37 +00:00
2011-06-07 23:54:58 +00:00
static const char * aaopts [ ] = {
" 1x " ,
" 2x " ,
" 4x " ,
" 6x " ,
" 8x " ,
NULL
} ;
static const char * aavalues [ ] = { " 0 " , " 2 " , " 4 " , " 6 " , " 8 " , NULL } ;
static const char * resmodeopts [ ] = {
ASPECT_LIST
" Desktop " ,
" Custom " ,
NULL
} ;
2012-06-16 08:58:36 +00:00
static const char * bppopts [ ] =
2011-06-07 23:54:58 +00:00
{
" 16-bit " ,
2018-04-27 16:40:50 +00:00
" 24-bit " ,
2011-06-07 23:54:58 +00:00
NULL
} ;
2018-04-27 16:40:50 +00:00
static const char * bppvalues [ ] = { " 16 " , " 24 " , NULL } ;
2019-07-02 04:37:11 +00:00
# if defined(_WIN32) && !defined(FTE_SDL)
2018-04-27 16:40:50 +00:00
extern int qwinvermaj , qwinvermin ;
//on win8+, hide the 16bpp option - windows would just reject it.
int bppbias = ( ( qwinvermaj = = 6 & & qwinvermin > = 2 ) | | qwinvermaj > 6 ) ? 1 : 0 ;
# else
const int bppbias = 0 ;
# endif
2011-06-07 23:54:58 +00:00
static const char * refreshopts [ ] =
{
" Default " ,
" 59Hz " ,
" 60Hz " ,
" 70Hz " ,
" 72Hz " ,
" 75Hz " ,
" 85Hz " ,
" 100Hz " ,
" 120Hz " ,
2017-11-16 22:20:40 +00:00
" 144Hz " ,
2011-06-07 23:54:58 +00:00
NULL
} ;
2017-11-16 22:20:40 +00:00
static const char * refreshvalues [ ] = { " " , " 59 " , " 60 " , " 70 " , " 72 " , " 75 " , " 85 " , " 100 " , " 120 " , " 144 " , NULL } ;
2011-06-07 23:54:58 +00:00
static const char * res2dmodeopts [ ] = {
ASPECT_LIST
" Default " ,
2018-01-22 19:18:04 +00:00
" Square (by height) " ,
2011-06-07 23:54:58 +00:00
" Scale " ,
" Custom " ,
NULL
} ;
static const char * scaleopts [ ] = {
" 1x " ,
" 1.5x " ,
" 2x " ,
" 2.5x " ,
" 3x " ,
" 4x " ,
" 5x " ,
" 6x " ,
NULL
} ;
static const char * scalevalues [ ] = { " 1 " , " 1.5 " , " 2 " , " 2.5 " , " 3 " , " 4 " , " 5 " , " 6 " , NULL } ;
2017-03-26 01:46:08 +00:00
2018-07-22 11:49:37 +00:00
static const char * vsyncopts [ ] =
{
" Off " ,
" Strict " ,
" Lax " ,
" Alternate Frames " ,
NULL
} ;
static const char * vsyncvalues [ ] = { " 0 " , " 1 " , " -1 " , " 2 " , NULL } ;
extern cvar_t vid_vsync ;
extern cvar_t cl_maxfps ;
extern cvar_t cl_yieldcpu ;
2017-03-26 01:46:08 +00:00
2013-03-12 22:47:42 +00:00
/*
2011-06-07 23:54:58 +00:00
static const char * vsyncoptions [ ] =
{
" Off " ,
" Wait for Vertical Sync " ,
" Wait for Display Enable " ,
NULL
} ;
2014-02-07 08:38:40 +00:00
extern cvar_t vid_vsync ;
2013-03-12 22:47:42 +00:00
*/
2011-06-07 23:54:58 +00:00
videomenuinfo_t * info ;
static char current3dres [ 32 ] ; // enough to fit 1920x1200
2014-08-17 03:18:43 +00:00
static menuresel_t resel ;
2011-06-07 23:54:58 +00:00
int y ;
int resmodechoice , res2dmodechoice ;
int reschoices [ ASPECT_RATIOS ] , res2dchoices [ ASPECT_RATIOS ] ;
2019-01-13 16:51:50 +00:00
menu_t * menu ;
//not calling M_Options_Title because of quake2's different banner.
y = 32 ;
Key_Dest_Add ( kdm_emenu ) ;
menu = M_CreateMenu ( sizeof ( videomenuinfo_t ) ) ;
switch ( M_GameType ( ) )
{
case MGT_QUAKE2 : //q2...
MC_AddCenterPicture ( menu , 4 , 24 , " pics/m_banner_video " ) ;
break ;
# ifdef HEXEN2
case MGT_HEXEN2 : //h2
MC_AddPicture ( menu , 16 , 0 , 35 , 176 , " gfx/menu/hplaque.lmp " ) ;
MC_AddCenterPicture ( menu , 0 , 60 , " gfx/menu/title3.lmp " ) ;
y + = 32 ;
break ;
# endif
default : //q1
MC_AddPicture ( menu , 16 , 4 , 32 , 144 , " gfx/qplaque.lmp " ) ;
MC_AddCenterPicture ( menu , 4 , 24 , " gfx/p_option.lmp " ) ;
break ;
}
2011-06-07 23:54:58 +00:00
info = ( videomenuinfo_t * ) menu - > data ;
snprintf ( current3dres , sizeof ( current3dres ) , " Current: %ix%i " , vid . pixelwidth , vid . pixelheight ) ;
resmodechoice = M_MatchModes ( vid . pixelwidth , vid . pixelheight , reschoices ) ;
if ( vid_desktopsettings . ival )
2018-01-22 19:18:04 +00:00
resmodechoice = ASPECT3D_DESKTOP ;
2011-06-07 23:54:58 +00:00
else if ( resmodechoice < 0 )
2018-01-22 19:18:04 +00:00
resmodechoice = ASPECT3D_CUSTOM ;
2011-06-07 23:54:58 +00:00
res2dmodechoice = M_MatchModes ( vid . pixelwidth , vid . pixelheight , res2dchoices ) ;
2018-01-22 19:18:04 +00:00
if ( vid_conautoscale . value > 0 )
res2dmodechoice = ASPECT2D_SCALED ;
2011-06-07 23:54:58 +00:00
else if ( ! vid_conwidth . ival & & ! vid_conheight . ival )
2018-01-22 19:18:04 +00:00
res2dmodechoice = ASPECT2D_AUTO ;
else if ( ! vid_conwidth . ival )
res2dmodechoice = ASPECT2D_HEIGHT ;
2011-06-07 23:54:58 +00:00
else if ( res2dmodechoice < 0 )
2018-01-22 19:18:04 +00:00
res2dmodechoice = ASPECT2D_CUSTOM ;
2011-06-07 23:54:58 +00:00
{
menubulk_t bulk [ ] =
{
2016-07-12 00:40:13 +00:00
MB_REDTEXT ( " Video Options " , true ) ,
MB_TEXT ( " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , true ) ,
2017-03-26 01:46:08 +00:00
# ifdef ANDROID
MB_COMBOCVAR ( " Orientation " , sys_orientation , orientationopts , orientationvalues , NULL ) ,
# else
2011-06-07 23:54:58 +00:00
MB_COMBOCVAR ( " Renderer " , vid_renderer , rendererops , renderervalues , NULL ) ,
2015-01-21 18:18:37 +00:00
MB_COMBOCVARRETURN ( " Display Mode " , vid_fullscreen , fullscreenopts , fullscreenvalues , info - > dispmode , vid_fullscreen . description ) ,
2017-03-26 01:46:08 +00:00
# endif
2011-06-07 23:54:58 +00:00
MB_COMBOCVAR ( " Anti-aliasing " , vid_multisample , aaopts , aavalues , NULL ) ,
2016-07-12 00:40:13 +00:00
MB_REDTEXT ( current3dres , true ) ,
2015-01-21 18:18:37 +00:00
MB_COMBORETURN ( " Aspect " , resmodeopts , resmodechoice , info - > resmode , " Select method for determining or configuring display options. The desktop option will attempt to use the width, height, color depth, and refresh from your operating system's desktop environment. " ) ,
2011-06-07 23:54:58 +00:00
// aspect entries
2011-06-15 23:01:07 +00:00
MB_COMBORETURN ( " Size " , resaspects [ 0 ] , reschoices [ 0 ] , info - > ressize [ 0 ] , " Select resolution for display. " ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( - 8 ) ,
2011-06-15 23:01:07 +00:00
MB_COMBORETURN ( " Size " , resaspects [ 1 ] , reschoices [ 1 ] , info - > ressize [ 1 ] , " Select resolution for display. " ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( - 8 ) ,
2011-06-15 23:01:07 +00:00
MB_COMBORETURN ( " Size " , resaspects [ 2 ] , reschoices [ 2 ] , info - > ressize [ 2 ] , " Select resolution for display. " ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( - 8 ) ,
2011-06-15 23:01:07 +00:00
MB_COMBORETURN ( " Size " , resaspects [ 3 ] , reschoices [ 3 ] , info - > ressize [ 3 ] , " Select resolution for display. " ) ,
2018-04-27 16:40:50 +00:00
MB_COMBOCVARRETURN ( " Color Depth " , vid_bpp , bppopts + bppbias , bppvalues + bppbias , info - > bppfixed , vid_bpp . description ) ,
2011-06-15 23:01:07 +00:00
MB_COMBOCVARRETURN ( " Refresh Rate " , vid_refreshrate , refreshopts , refreshvalues , info - > hzfixed , vid_refreshrate . description ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( - 24 ) , // really hacky...
2013-03-12 22:47:42 +00:00
// custom entries
2011-06-07 23:54:58 +00:00
MB_EDITCVARSLIMRETURN ( " Width " , " vid_width " , info - > width ) ,
MB_EDITCVARSLIMRETURN ( " Height " , " vid_height " , info - > height ) ,
MB_EDITCVARSLIMRETURN ( " Color Depth " , " vid_bpp " , info - > bpp ) ,
2013-03-12 23:02:18 +00:00
MB_EDITCVARSLIMRETURN ( " Refresh Rate " , " vid_displayfrequency " , info - > hz ) ,
2018-07-22 11:49:37 +00:00
2011-06-07 23:54:58 +00:00
MB_SPACING ( 4 ) ,
2011-06-15 23:01:07 +00:00
MB_COMBORETURN ( " 2D Mode " , res2dmodeopts , res2dmodechoice , info - > res2dmode , " Select method for determining or configuring 2D resolution and scaling. The default option matches the current display resolution, and the scale option scales by a factor of the display resolution. " ) ,
2011-06-07 23:54:58 +00:00
// scale entry
MB_COMBOCVARRETURN ( " Amount " , vid_conautoscale , scaleopts , scalevalues , info - > scale , NULL ) ,
MB_SPACING ( - 8 ) ,
// 2d aspect entries
2011-06-15 23:01:07 +00:00
MB_COMBORETURN ( " Size " , resaspects [ 0 ] , res2dchoices [ 0 ] , info - > res2dsize [ 0 ] , " Select resolution for 2D rendering. " ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( - 8 ) ,
2011-06-15 23:01:07 +00:00
MB_COMBORETURN ( " Size " , resaspects [ 1 ] , res2dchoices [ 1 ] , info - > res2dsize [ 1 ] , " Select resolution for 2D rendering. " ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( - 8 ) ,
2011-06-15 23:01:07 +00:00
MB_COMBORETURN ( " Size " , resaspects [ 2 ] , res2dchoices [ 2 ] , info - > res2dsize [ 2 ] , " Select resolution for 2D rendering. " ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( - 8 ) ,
2011-06-15 23:01:07 +00:00
MB_COMBORETURN ( " Size " , resaspects [ 3 ] , res2dchoices [ 3 ] , info - > res2dsize [ 3 ] , " Select resolution for 2D rendering. " ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( - 8 ) ,
// 2d custom entries
MB_EDITCVARSLIMRETURN ( " Width " , " vid_conwidth " , info - > width2d ) ,
MB_EDITCVARSLIMRETURN ( " Height " , " vid_conheight " , info - > height2d ) ,
MB_SPACING ( 4 ) ,
2011-06-15 23:01:07 +00:00
MB_CMD ( " Apply Settings " , M_VideoApply , " Restart video and apply renderer, display, and 2D resolution options. " ) ,
2011-06-07 23:54:58 +00:00
MB_SPACING ( 4 ) ,
2019-04-15 18:43:42 +00:00
MB_COMBOCVAR ( " sRGB " , vid_srgb , srgbopts , srgbvalues , " Controls the colour space to try to use. " ) ,
2018-03-04 14:41:16 +00:00
MB_COMBOCVAR ( " Gamma Mode " , v_gamma , gammamodeopts , gammamodevalues , " Controls how gamma is applied " ) ,
2015-04-14 23:12:17 +00:00
MB_SLIDER ( " Gamma " , v_gamma , 1.5 , 0.25 , - 0.05 , NULL ) ,
2011-06-07 23:54:58 +00:00
MB_SLIDER ( " Contrast " , v_contrast , 0.8 , 3 , 0.05 , NULL ) ,
2019-04-15 18:43:42 +00:00
MB_SLIDER ( " Brightness " , v_brightness , 0.0 , 0.5 , 0.05 , NULL ) ,
MB_SPACING ( 4 ) ,
MB_SLIDER ( " View Size " , scr_viewsize , 30 , 120 , 10 , NULL ) ,
2018-07-22 11:49:37 +00:00
MB_COMBOCVAR ( " VSync " , vid_vsync , vsyncopts , vsyncvalues , " Controls whether to wait for rendering to finish. " ) ,
MB_EDITCVARSLIM ( " Framerate Limiter " , cl_maxfps . name , " Limits the maximum framerate. Set to 0 for none. " ) ,
MB_CHECKBOXCVARTIP ( " Yield CPU " , cl_yieldcpu , 1 , " Reduce CPU usage between frames. \n Should probably be off when using vsync. " ) ,
2011-06-07 23:54:58 +00:00
MB_END ( )
} ;
2019-01-13 16:51:50 +00:00
MC_AddFrameStart ( menu , y ) ;
2014-08-17 03:18:43 +00:00
MC_AddBulk ( menu , & resel , bulk , 16 , 200 , y ) ;
2019-01-13 16:51:50 +00:00
MC_AddFrameEnd ( menu , y ) ;
2011-06-07 23:54:58 +00:00
}
/*
y + = 8 ;
MC_AddRedText ( menu , 200 , y , current3dres , false ) ; y + = 8 ;
y + = 8 ;
2018-09-23 19:35:24 +00:00
MC_AddRedText ( menu , 0 , y , " ^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082 " , false ) ; y + = 8 ;
2011-06-07 23:54:58 +00:00
y + = 8 ;
info - > renderer = MC_AddCombo ( menu , 16 , y , " Renderer " , rendererops , i ) ; y + = 8 ;
info - > bppcombo = MC_AddCombo ( menu , 16 , y , " Color Depth " , bppnames , currentbpp ) ; y + = 8 ;
info - > refreshratecombo = MC_AddCombo ( menu , 16 , y , " Refresh Rate " , refreshrates , currentrefreshrate ) ; y + = 8 ;
info - > modecombo = MC_AddCombo ( menu , 16 , y , " Video Size " , modenames , prefabmode + 1 ) ; y + = 8 ;
MC_AddWhiteText ( menu , 16 , y , " 3D Aspect Ratio " , false ) ; y + = 8 ;
info - > conscalecombo = MC_AddCombo ( menu , 16 , y , " 2D Size " , modenames , prefab2dmode + 1 ) ; y + = 8 ;
MC_AddWhiteText ( menu , 16 , y , " 2D Aspect Ratio " , false ) ; y + = 8 ;
MC_AddCheckBox ( menu , 16 , y , " Fullscreen " , & vid_fullscreen , 0 ) ; y + = 8 ;
y + = 4 ; info - > customwidth = MC_AddEdit ( menu , 16 , y , " Custom width " , vid_width . string ) ; y + = 8 ;
y + = 4 ; info - > customheight = MC_AddEdit ( menu , 16 , y , " Custom height " , vid_height . string ) ; y + = 12 ;
info - > vsynccombo = MC_AddCombo ( menu , 16 , y , " VSync " , vsyncoptions , currentvsync ) ; y + = 8 ;
2014-02-07 08:38:40 +00:00
//MC_AddCheckBox(menu, 16, y, " Override VSync", &vid_vsync,0); y+=8;
2011-06-07 23:54:58 +00:00
MC_AddCheckBox ( menu , 16 , y , " Desktop Settings " , & vid_desktopsettings , 0 ) ; y + = 8 ;
y + = 8 ;
MC_AddCommand ( menu , 16 , y , " = Apply Changes = " , M_VideoApply ) ; y + = 8 ;
y + = 8 ;
MC_AddSlider ( menu , 16 , y , " Screen size " , & scr_viewsize , 30 , 120 , 1 ) ; y + = 8 ;
MC_AddSlider ( menu , 16 , y , " Console Autoscale " , & vid_conautoscale , 0 , 6 , 0.25 ) ; y + = 8 ;
MC_AddSlider ( menu , 16 , y , " Gamma " , & v_gamma , 0.3 , 1 , 0.05 ) ; y + = 8 ;
MC_AddCheckBox ( menu , 16 , y , " Desktop Gamma " , & vid_desktopgamma , 0 ) ; y + = 8 ;
MC_AddCheckBox ( menu , 16 , y , " Hardware Gamma " , & vid_hardwaregamma , 0 ) ; y + = 8 ;
MC_AddCheckBox ( menu , 16 , y , " Preserve Gamma " , & vid_preservegamma , 0 ) ; y + = 8 ;
MC_AddSlider ( menu , 16 , y , " Contrast " , & v_contrast , 1 , 3 , 0.05 ) ; y + = 8 ;
y + = 8 ;
2019-04-15 18:43:42 +00:00
MC_AddCheckBox ( menu , 16 , y , " Windowed Mouse " , & in_windowed_mouse , 0 ) ; y + = 8 ;
2011-06-07 23:54:58 +00:00
menu - > selecteditem = ( union menuoption_s * ) info - > renderer ;
menu - > cursoritem = ( menuoption_t * ) MC_AddWhiteText ( menu , 152 , menu - > selecteditem - > common . posy , NULL , false ) ;
*/
2015-06-18 22:11:30 +00:00
menu - > predraw = CheckCustomMode ;
2011-06-07 23:54:58 +00:00
}
2014-03-30 08:55:06 +00:00
2014-03-31 17:06:41 +00:00
# ifndef MINIMAL
2017-01-13 00:39:50 +00:00
# ifdef RAGDOLL
# include "pr_common.h"
# endif
2014-03-30 08:55:06 +00:00
typedef struct
{
2014-10-05 20:04:11 +00:00
enum {
MV_NONE ,
MV_BONES ,
2016-07-12 00:40:13 +00:00
MV_SHADER ,
2016-12-19 13:31:05 +00:00
MV_TEXTURE ,
2017-01-13 00:39:50 +00:00
MV_COLLISION ,
MV_EVENTS ,
2019-02-16 19:09:07 +00:00
MV_NORMALS ,
2014-10-05 20:04:11 +00:00
} mode ;
2015-06-24 17:59:57 +00:00
int surfaceidx ;
2014-03-30 08:55:06 +00:00
int skingroup ;
int framegroup ;
2016-12-19 13:31:05 +00:00
int boneidx ;
2019-02-16 19:09:07 +00:00
int textype ;
2014-03-30 08:55:06 +00:00
double framechangetime ;
double skinchangetime ;
float pitch ;
float yaw ;
float dist ;
char modelname [ MAX_QPATH ] ;
char forceshader [ MAX_QPATH ] ;
2014-10-05 20:04:11 +00:00
2016-07-12 00:40:13 +00:00
char shaderfile [ MAX_QPATH ] ;
2014-10-05 20:04:11 +00:00
char * shadertext ;
2017-01-13 00:39:50 +00:00
# ifdef RAGDOLL
lerpents_t ragent ;
world_t ragworld ;
wedict_t ragworldedict ;
comentvars_t ragworldvars ;
2018-03-24 04:02:09 +00:00
# ifdef VM_Q1
2017-01-13 00:39:50 +00:00
comextentvars_t ragworldextvars ;
2018-03-24 04:02:09 +00:00
# endif
2017-01-13 00:39:50 +00:00
pubprogfuncs_t ragfuncs ;
qboolean flop ; //ragdoll flopping enabled.
float fixedrate ;
# endif
2014-03-30 08:55:06 +00:00
} modelview_t ;
static unsigned int genhsv ( float h_ , float s , float v )
{
float r = 0 , g = 1 , b = 0 ;
float h = h_ - floor ( h_ ) ;
int i = floor ( h * 6 ) ;
float f = h * 6 - i ;
float p = v * ( 1 - s ) ;
float q = v * ( 1 - f * s ) ;
float t = v * ( 1 - ( 1 - f ) * s ) ;
switch ( i )
{
case 0 : r = v , g = t , b = p ; break ;
case 1 : r = q , g = v , b = p ; break ;
case 2 : r = p , g = v , b = t ; break ;
case 3 : r = p , g = q , b = v ; break ;
case 4 : r = t , g = p , b = v ; break ;
case 5 : r = v , g = p , b = q ; break ;
}
return 0xff000000 |
( ( int ) ( r * 255 ) < < 16 ) |
( ( int ) ( g * 255 ) < < 8 ) |
( ( int ) ( b * 255 ) < < 0 ) ;
2015-06-24 17:59:57 +00:00
}
2014-03-30 08:55:06 +00:00
2014-03-31 17:06:41 +00:00
# include "com_mesh.h"
2014-08-24 15:40:33 +00:00
# ifdef SKELETALMODELS
2016-12-19 13:31:05 +00:00
static void M_BoneDisplayLame ( entity_t * e , int * y , int depth , int parent , int first , int last , int sel )
2014-03-31 17:06:41 +00:00
{
int i ;
for ( i = first ; i < last ; i + + )
{
2016-12-13 11:50:15 +00:00
int p = Mod_GetBoneParent ( e - > model , i + 1 ) ;
if ( p = = parent )
2014-03-31 17:06:41 +00:00
{
2016-12-13 11:50:15 +00:00
const char * bname = Mod_GetBoneName ( e - > model , i + 1 ) ;
2014-04-02 00:58:02 +00:00
float result [ 12 ] ;
2016-12-13 11:50:15 +00:00
if ( ! bname )
bname = " NULL " ;
2014-04-02 00:58:02 +00:00
memset ( result , 0 , sizeof ( result ) ) ;
2015-07-14 14:47:00 +00:00
if ( Mod_GetTag ( e - > model , i + 1 , & e - > framestate , result ) )
2016-12-19 13:31:05 +00:00
{
#if 0 //def _DEBUG
2017-01-13 00:39:50 +00:00
Draw_FunString ( depth * 16 , * y , va ( " %s%i: %s (%g %g %g) " , ( i = = sel ) ? " ^1 " : " " , i + 1 , bname , result [ 3 ] , result [ 7 ] , result [ 11 ] ) ) ;
2016-12-19 13:31:05 +00:00
# else
2017-01-13 00:39:50 +00:00
Draw_FunString ( depth * 16 , * y , va ( " %s%i: %s " , ( i = = sel ) ? " ^1 " : " " , i + 1 , bname ) ) ;
2016-12-19 13:31:05 +00:00
# endif
}
2014-04-02 00:58:02 +00:00
else
2016-12-19 13:31:05 +00:00
Draw_FunString ( depth * 16 , * y , va ( " %s%i: %s (err) " , ( i = = sel ) ? " ^1 " : " " , i , bname ) ) ;
2014-03-31 17:06:41 +00:00
* y + = 8 ;
2016-12-19 13:31:05 +00:00
M_BoneDisplayLame ( e , y , depth + 1 , i + 1 , i + 1 , last , sel ) ;
2014-03-31 17:06:41 +00:00
}
}
}
2014-08-24 15:40:33 +00:00
# endif
2017-01-13 00:39:50 +00:00
static unsigned int tobit ( unsigned int bitmask )
{
unsigned int b ;
for ( b = 0 ; b < 32 ; b + + )
{
if ( bitmask & ( 1 < < b ) )
return b ;
}
return 0 ;
}
2014-03-30 08:55:06 +00:00
static void M_ModelViewerDraw ( int x , int y , struct menucustom_s * c , struct menu_s * m )
{
static playerview_t pv ;
entity_t ent ;
vec3_t fwd , rgt , up ;
const char * fname ;
2015-06-24 17:59:57 +00:00
shader_t * shader ;
2015-04-27 06:19:33 +00:00
vec2_t fs = { 8 , 8 } ;
2016-12-13 11:50:15 +00:00
// float bones[12*MAX_BONES];
2018-06-02 08:55:57 +00:00
vec3_t lightpos = { 0 , 1 , 0 } ;
2014-03-30 08:55:06 +00:00
modelview_t * mods = c - > dptr ;
2015-10-27 15:20:15 +00:00
if ( R2D_Flush )
R2D_Flush ( ) ;
2014-03-30 08:55:06 +00:00
memset ( & pv , 0 , sizeof ( pv ) ) ;
CL_DecayLights ( ) ;
CL_ClearEntityLists ( ) ;
V_ClearRefdef ( & pv ) ;
r_refdef . drawsbar = false ;
V_CalcRefdef ( & pv ) ;
r_refdef . grect . width = vid . width ;
r_refdef . grect . height = vid . height ;
r_refdef . grect . x = 0 ;
r_refdef . grect . y = 0 ;
r_refdef . time = realtime ;
2014-03-31 17:06:41 +00:00
r_refdef . flags = RDF_NOWORLDMODEL ;
2014-03-30 08:55:06 +00:00
r_refdef . afov = 60 ;
r_refdef . fov_x = 0 ;
r_refdef . fov_y = 0 ;
r_refdef . dirty | = RDFD_FOV ;
VectorClear ( r_refdef . viewangles ) ;
r_refdef . viewangles [ 0 ] = mods - > pitch ;
r_refdef . viewangles [ 1 ] = mods - > yaw ;
AngleVectors ( r_refdef . viewangles , fwd , rgt , up ) ;
VectorScale ( fwd , - mods - > dist , r_refdef . vieworg ) ;
memset ( & ent , 0 , sizeof ( ent ) ) ;
2017-03-06 15:30:45 +00:00
// ent.angles[1] = realtime*45;//mods->yaw;
// ent.angles[0] = realtime*23.4;//mods->pitch;
2018-06-02 08:55:57 +00:00
ent . angles [ 0 ] * = r_meshpitch . value ;
AngleVectors ( ent . angles , ent . axis [ 0 ] , ent . axis [ 1 ] , ent . axis [ 2 ] ) ;
ent . angles [ 0 ] * = r_meshpitch . value ;
VectorInverse ( ent . axis [ 1 ] ) ;
2014-03-30 08:55:06 +00:00
ent . model = Mod_ForName ( mods - > modelname , MLV_WARN ) ;
if ( ! ent . model )
return ; //panic!
2019-03-12 05:04:27 +00:00
ent . scale = max ( max ( fabs ( ent . model - > maxs [ 0 ] - ent . model - > mins [ 0 ] ) , fabs ( ent . model - > maxs [ 1 ] - ent . model - > mins [ 1 ] ) ) , fabs ( ent . model - > maxs [ 2 ] - ent . model - > mins [ 2 ] ) ) ;
ent . scale = ent . scale ? 64.0 / ent . scale : 1 ;
ent . origin [ 2 ] - = ( ent . model - > maxs [ 2 ] - ent . model - > mins [ 2 ] ) * 0.5 ; // + ent.model->mins[2];
ent . origin [ 2 ] * = ent . scale ;
2014-03-30 08:55:06 +00:00
Vector4Set ( ent . shaderRGBAf , 1 , 1 , 1 , 1 ) ;
2019-03-12 05:04:27 +00:00
VectorSet ( ent . glowmod , 1 , 1 , 1 ) ;
// VectorScale(ent.axis[0], ent.scale, ent.axis[0]);
// VectorScale(ent.axis[1], ent.scale, ent.axis[1]);
// VectorScale(ent.axis[2], ent.scale, ent.axis[2]);
// ent.scale = 1;
2014-03-30 08:55:06 +00:00
if ( strstr ( mods - > modelname , " player " ) )
{
ent . bottomcolour = genhsv ( realtime * 0.1 + 0 , 1 , 1 ) ;
ent . topcolour = genhsv ( realtime * 0.1 + 0.5 , 1 , 1 ) ;
}
else
{
ent . topcolour = TOP_DEFAULT ;
ent . bottomcolour = BOTTOM_DEFAULT ;
}
// ent.fatness = sin(realtime)*5;
ent . playerindex = - 1 ;
ent . skinnum = mods - > skingroup ;
2016-08-25 00:12:14 +00:00
ent . shaderTime = 0 ; //realtime;
2015-02-07 22:34:22 +00:00
ent . framestate . g [ FS_REG ] . lerpweight [ 0 ] = 1 ;
2014-03-30 08:55:06 +00:00
ent . framestate . g [ FS_REG ] . frame [ 0 ] = mods - > framegroup ;
2016-12-07 18:45:25 +00:00
ent . framestate . g [ FS_REG ] . frametime [ 0 ] = ent . framestate . g [ FS_REG ] . frametime [ 1 ] = realtime - mods - > framechangetime ;
2016-12-19 13:31:05 +00:00
ent . framestate . g [ FS_REG ] . endbone = 0x7fffffff ;
2014-03-30 08:55:06 +00:00
ent . customskin = Mod_RegisterSkinFile ( va ( " %s_0.skin " , mods - > modelname ) ) ;
2016-12-07 18:45:25 +00:00
ent . light_avg [ 0 ] = ent . light_avg [ 1 ] = ent . light_avg [ 2 ] = 0.66 ;
ent . light_range [ 0 ] = ent . light_range [ 1 ] = ent . light_range [ 2 ] = 0.33 ;
2018-06-02 08:55:57 +00:00
V_ApplyRefdef ( ) ;
/*
{
trace_t tr ;
vec3_t worldmouse ;
vec3_t mouse = { mousecursor_x / vid . width , 1 - mousecursor_y / vid . height , 0.5 } ;
float d ;
Matrix4x4_CM_UnProject ( mouse , worldmouse , r_refdef . viewangles , r_refdef . vieworg , r_refdef . fov_x , r_refdef . fov_y ) ;
2016-12-19 13:31:05 +00:00
2018-06-02 08:55:57 +00:00
d = DotProduct ( worldmouse , fwd ) ;
VectorMA ( worldmouse , - d , fwd , worldmouse ) ;
if ( ent . model - > funcs . NativeTrace & & ent . model - > funcs . NativeTrace ( ent . model , 0 , & ent . framestate , ent . axis , r_refdef . vieworg , worldmouse , vec3_origin , vec3_origin , false , ~ 0 , & tr ) )
;
else
VectorCopy ( worldmouse , tr . endpos ) ;
VectorCopy ( tr . endpos , lightpos ) ;
}
*/
2019-03-12 05:04:27 +00:00
lightpos [ 0 ] = sin ( realtime * 0.1 ) ;
lightpos [ 1 ] = cos ( realtime * 0.1 ) ;
lightpos [ 2 ] = 0 ;
2018-06-02 08:55:57 +00:00
VectorNormalize ( lightpos ) ;
ent . light_dir [ 0 ] = DotProduct ( lightpos , ent . axis [ 0 ] ) ;
ent . light_dir [ 1 ] = DotProduct ( lightpos , ent . axis [ 1 ] ) ;
ent . light_dir [ 2 ] = DotProduct ( lightpos , ent . axis [ 2 ] ) ;
ent . light_known = 2 ;
2016-12-19 13:31:05 +00:00
if ( ent . model - > type = = mod_dummy )
{
Draw_FunString ( 0 , 0 , va ( " model \" %s \" not loaded " , ent . model - > name ) ) ;
return ;
}
2016-12-13 11:50:15 +00:00
switch ( ent . model - > loadstate )
{
case MLS_LOADED :
break ;
case MLS_NOTLOADED :
2016-12-19 13:31:05 +00:00
Draw_FunString ( 0 , 0 , va ( " \" %s \" not loaded " , ent . model - > name ) ) ;
2016-12-13 11:50:15 +00:00
return ;
case MLS_LOADING :
2016-12-19 13:31:05 +00:00
Draw_FunString ( 0 , 0 , va ( " \" %s \" still loading " , ent . model - > name ) ) ;
2016-12-13 11:50:15 +00:00
return ;
case MLS_FAILED :
2016-12-19 13:31:05 +00:00
Draw_FunString ( 0 , 0 , va ( " Unable to load \" %s \" " , ent . model - > name ) ) ;
2016-12-13 11:50:15 +00:00
return ;
}
2017-01-13 00:39:50 +00:00
# ifdef RAGDOLL
if ( mods - > flop )
ent . framestate . g [ FS_REG ] . frame [ 0 ] | = 0x8000 ;
if ( ent . model - > dollinfo )
{
float rate = 1.0 / 60 ;
rag_doallanimations ( & mods - > ragworld ) ;
mods - > fixedrate + = host_frametime ;
if ( mods - > fixedrate > 1 )
mods - > fixedrate = 1 ;
while ( mods - > fixedrate > = rate )
{
2018-03-24 04:02:09 +00:00
mods - > ragworld . rbe - > RunFrame ( & mods - > ragworld , rate , 800 ) ;
2017-01-13 00:39:50 +00:00
mods - > fixedrate - = rate ;
}
rag_updatedeltaent ( & mods - > ragworld , & ent , & mods - > ragent ) ;
}
2016-12-19 13:31:05 +00:00
# endif
2019-02-16 19:09:07 +00:00
if ( mods - > mode = = MV_NORMALS )
{
shader_t * s ;
if ( 1 )
{
s = R_RegisterShader ( " hitbox_nodepth " , SUF_NONE ,
" { \n "
" polygonoffset \n "
" { \n "
" map $whiteimage \n "
" blendfunc gl_src_alpha gl_one \n "
" rgbgen vertex \n "
" alphagen vertex \n "
" nodepthtest \n "
" } \n "
" } \n " ) ;
Mod_AddSingleSurface ( & ent , mods - > surfaceidx , s , true ) ;
}
}
2016-12-19 13:31:05 +00:00
if ( mods - > mode = = MV_COLLISION )
{
2017-01-13 00:39:50 +00:00
shader_t * s ;
# ifdef HALFLIFEMODELS
if ( ent . model - > type = = mod_halflife )
HLMDL_DrawHitBoxes ( & ent ) ;
else
# endif
if ( 1 )
{
s = R_RegisterShader ( " hitbox_nodepth " , SUF_NONE ,
2016-12-19 13:31:05 +00:00
" { \n "
" polygonoffset \n "
" { \n "
" map $whiteimage \n "
" blendfunc gl_src_alpha gl_one \n "
" rgbgen vertex \n "
" alphagen vertex \n "
" nodepthtest \n "
" } \n "
" } \n " ) ;
2019-02-16 19:09:07 +00:00
Mod_AddSingleSurface ( & ent , mods - > surfaceidx , s , false ) ;
2017-01-13 00:39:50 +00:00
}
2016-12-19 13:31:05 +00:00
else
{
vec3_t mins , maxs ;
VectorAdd ( ent . model - > mins , ent . origin , mins ) ;
VectorAdd ( ent . model - > maxs , ent . origin , maxs ) ;
2017-01-13 00:39:50 +00:00
s = R_RegisterShader ( " bboxshader_nodepth " , SUF_NONE ,
" { \n "
" polygonoffset \n "
" { \n "
" map $whiteimage \n "
" blendfunc gl_src_alpha gl_one \n "
" rgbgen vertex \n "
" alphagen vertex \n "
" nodepthtest \n "
" } \n "
" } \n " ) ;
2016-12-19 13:31:05 +00:00
CLQ1_AddOrientedCube ( s , mins , maxs , NULL , 1 , 1 , 1 , 0.2 ) ;
}
# ifdef _DEBUG
{
trace_t tr ;
vec3_t v1 , v2 ;
VectorSet ( v1 , 1000 * sin ( realtime * 2 * M_PI / 180 ) , 1000 * cos ( realtime * 2 * M_PI / 180 ) , - ent . origin [ 2 ] ) ;
VectorScale ( v1 , - 1 , v2 ) ;
v2 [ 2 ] = v1 [ 2 ] ;
s = R_RegisterShader ( " bboxshader " , SUF_NONE ,
" { \n "
" polygonoffset \n "
" { \n "
" map $whiteimage \n "
" blendfunc gl_src_alpha gl_one \n "
" rgbgen vertex \n "
" alphagen vertex \n "
" } \n "
" } \n " ) ;
2017-03-06 15:30:45 +00:00
if ( ent . model - > funcs . NativeTrace & & ent . model - > funcs . NativeTrace ( ent . model , 0 , & ent . framestate , ent . axis , v1 , v2 , vec3_origin , vec3_origin , false , ~ 0 , & tr ) )
2016-12-19 13:31:05 +00:00
{
vec3_t dir ;
float f ;
2019-07-29 05:28:20 +00:00
VectorMA ( ent . origin , ent . scale , v1 , v1 ) ;
VectorMA ( ent . origin , ent . scale , v2 , v2 ) ;
VectorMA ( ent . origin , ent . scale , tr . endpos , tr . endpos ) ;
2016-12-19 13:31:05 +00:00
VectorSubtract ( tr . endpos , v1 , dir ) ;
f = DotProduct ( dir , tr . plane . normal ) * - 2 ;
VectorMA ( dir , f , tr . plane . normal , v2 ) ;
VectorAdd ( v2 , tr . endpos , v2 ) ;
2019-07-29 05:28:20 +00:00
2016-12-19 13:31:05 +00:00
CLQ1_DrawLine ( s , v1 , tr . endpos , 0 , 1 , 0 , 1 ) ;
CLQ1_DrawLine ( s , tr . endpos , v2 , 1 , 0 , 0 , 1 ) ;
}
else
{
VectorAdd ( v1 , ent . origin , v1 ) ;
VectorAdd ( v2 , ent . origin , v2 ) ;
CLQ1_DrawLine ( s , v1 , v2 , 0 , 1 , 0 , 1 ) ;
}
}
# endif
}
if ( mods - > mode = = MV_BONES )
{
shader_t * lineshader ;
int tags = Mod_GetNumBones ( ent . model , true ) ;
int b ;
//if (ragdoll)
// ent->frame[] |= 0x8000;
//rag_updatedeltaent(&ent, le);
lineshader = R_RegisterShader ( " lineshader_nodepth " , SUF_NONE ,
" { \n "
" polygonoffset \n "
" { \n "
" map $whiteimage \n "
" blendfunc add \n "
" rgbgen vertex \n "
" alphagen vertex \n "
" nodepthtest \n "
" } \n "
" } \n " ) ;
for ( b = 1 ; b < = tags ; b + + )
{
int p = Mod_GetBoneParent ( ent . model , b ) ;
vec3_t start , end ;
float boneinfo [ 12 ] ;
Mod_GetTag ( ent . model , b , & ent . framestate , boneinfo ) ;
2017-03-06 15:30:45 +00:00
//fixme: no axis transform
2016-12-19 13:31:05 +00:00
VectorSet ( start , boneinfo [ 3 ] , boneinfo [ 7 ] , boneinfo [ 11 ] ) ;
2019-07-29 05:28:20 +00:00
VectorMA ( ent . origin , ent . scale , start , start ) ;
2016-12-19 13:31:05 +00:00
if ( p )
{
Mod_GetTag ( ent . model , p , & ent . framestate , boneinfo ) ;
2017-03-06 15:30:45 +00:00
//fixme: no axis transform
2016-12-19 13:31:05 +00:00
VectorSet ( end , boneinfo [ 3 ] , boneinfo [ 7 ] , boneinfo [ 11 ] ) ;
2019-07-29 05:28:20 +00:00
VectorMA ( ent . origin , ent . scale , end , end ) ;
2016-12-19 13:31:05 +00:00
CLQ1_DrawLine ( lineshader , start , end , 1 , ( b - 1 = = mods - > boneidx ) ? 0 : 1 , 1 , 1 ) ;
}
if ( b - 1 = = mods - > boneidx )
{
VectorSet ( end , start [ 0 ] + 1 , start [ 1 ] , start [ 2 ] ) ;
CLQ1_DrawLine ( lineshader , start , end , 1 , 0 , 0 , 1 ) ;
VectorSet ( end , start [ 0 ] , start [ 1 ] + 1 , start [ 2 ] ) ;
CLQ1_DrawLine ( lineshader , start , end , 0 , 1 , 0 , 1 ) ;
VectorSet ( end , start [ 0 ] , start [ 1 ] , start [ 2 ] + 1 ) ;
CLQ1_DrawLine ( lineshader , start , end , 0 , 0 , 1 , 1 ) ;
}
}
}
2019-07-29 05:28:20 +00:00
V_AddAxisEntity ( & ent ) ;
2014-03-30 08:55:06 +00:00
R_RenderView ( ) ;
2014-03-31 17:06:41 +00:00
y = 0 ;
2017-01-13 00:39:50 +00:00
{
fname = Mod_SurfaceNameForNum ( ent . model , mods - > surfaceidx ) ;
if ( ! fname )
fname = " Unknown Surface " ;
Draw_FunString ( 0 , y , va ( " Surf %i: %s " , mods - > surfaceidx , fname ) ) ;
y + = 8 ;
}
{
fname = Mod_SkinNameForNum ( ent . model , mods - > surfaceidx , mods - > skingroup ) ;
if ( ! fname )
{
Draw_FunString ( 0 , y , va ( " Skin %i: <invalid skin> " , mods - > skingroup ) ) ;
}
else
{
shader = Mod_ShaderForSkin ( ent . model , mods - > surfaceidx , mods - > skingroup ) ;
2019-02-16 19:09:07 +00:00
Draw_FunString ( 0 , y , va ( " Skin %i: \" %s \" , material \" %s \" " , mods - > skingroup , fname , shader ? shader - > name : " NO SHADER " ) ) ;
2017-01-13 00:39:50 +00:00
}
y + = 8 ;
}
2015-06-24 17:59:57 +00:00
{
char * fname ;
int numframes = 0 ;
float duration = 0 ;
qboolean loop = false ;
if ( ! Mod_FrameInfoForNum ( ent . model , mods - > surfaceidx , mods - > framegroup , & fname , & numframes , & duration , & loop ) )
fname = " Unknown Frame " ;
2019-02-16 19:09:07 +00:00
Draw_FunString ( 0 , y , va ( " Frame%i: %s (%i poses, %f of %f secs, %s) " , mods - > framegroup , fname , numframes , ent . framestate . g [ FS_REG ] . frametime [ 0 ] , duration , loop ? " looped " : " unlooped " ) ) ;
2015-06-24 17:59:57 +00:00
y + = 8 ;
}
2014-03-31 17:06:41 +00:00
2014-10-05 20:04:11 +00:00
switch ( mods - > mode )
{
case MV_NONE :
R_DrawTextField ( r_refdef . grect . x , r_refdef . grect . y + y , r_refdef . grect . width , r_refdef . grect . height - y ,
2015-08-02 11:36:46 +00:00
va ( " arrows: pitch/rotate \n "
2014-10-05 20:04:11 +00:00
" w: zoom in \n "
" s: zoom out \n "
" m: mode \n "
" r: reset times \n "
2017-01-13 00:39:50 +00:00
" home: skin+=1 \n "
" end: skin-=1 \n "
2014-10-05 20:04:11 +00:00
" pgup: frame+=1 \n "
" pgdn: frame-=1 \n "
2018-11-28 05:41:39 +00:00
" mins: %g %g %g, maxs: %g %g %g \n "
" flags: %#x %#x \n " ,
ent . model - > mins [ 0 ] , ent . model - > mins [ 1 ] , ent . model - > mins [ 2 ] , ent . model - > maxs [ 0 ] , ent . model - > maxs [ 1 ] , ent . model - > maxs [ 2 ] ,
ent . model - > flags , ent . model - > engineflags ) ,
CON_WHITEMASK , CPRINT_TALIGN | CPRINT_LALIGN , font_default , fs ) ;
2014-10-05 20:04:11 +00:00
break ;
2016-12-19 13:31:05 +00:00
case MV_COLLISION :
2017-01-13 00:39:50 +00:00
if ( ! ent . model )
;
else if ( ent . model - > type = = mod_alias )
{
galiasinfo_t * inf = Mod_Extradata ( ent . model ) ;
int surfnum = mods - > surfaceidx ;
while ( inf & & surfnum - - > 0 )
inf = inf - > nextsurf ;
if ( inf )
{
char contents [ 512 ] ;
unsigned int i ;
char * contentnames [ 32 ] = { NULL } ;
contentnames [ tobit ( FTECONTENTS_SOLID ) ] = " solid " ;
contentnames [ tobit ( FTECONTENTS_LAVA ) ] = " lava " ;
contentnames [ tobit ( FTECONTENTS_SLIME ) ] = " slime " ;
contentnames [ tobit ( FTECONTENTS_WATER ) ] = " water " ;
contentnames [ tobit ( FTECONTENTS_LADDER ) ] = " ladder " ;
contentnames [ tobit ( FTECONTENTS_PLAYERCLIP ) ] = " playerclip " ;
contentnames [ tobit ( FTECONTENTS_MONSTERCLIP ) ] = " monsterclip " ;
contentnames [ tobit ( FTECONTENTS_BODY ) ] = " body " ;
contentnames [ tobit ( FTECONTENTS_CORPSE ) ] = " corpse " ;
contentnames [ tobit ( FTECONTENTS_SKY ) ] = " sky " ;
for ( * contents = 0 , i = 0 ; i < 32 ; i + + )
{
if ( inf - > contents & ( 1 < < i ) )
{
if ( * contents )
Q_strncatz ( contents , " | " , sizeof ( contents ) ) ;
if ( contentnames [ i ] )
Q_strncatz ( contents , contentnames [ i ] , sizeof ( contents ) ) ;
else
Q_strncatz ( contents , va ( " %#x " , 1 < < i ) , sizeof ( contents ) ) ;
}
}
if ( ! * contents )
Q_strncatz ( contents , " non-solid " , sizeof ( contents ) ) ;
R_DrawTextField ( r_refdef . grect . x , r_refdef . grect . y + y , r_refdef . grect . width , r_refdef . grect . height - y ,
va ( " mins: %g %g %g, maxs: %g %g %g \n "
" contents: %s \n "
" surfflags: %#x \n "
" body: %i \n "
" geomset: %i %i%s \n "
" numverts: %i \n numtris: %i \n "
2019-05-10 09:31:21 +00:00
# ifdef SKELETALMODELS
2019-03-12 05:04:27 +00:00
" numbones: %i \n "
2019-05-10 09:31:21 +00:00
# endif
2019-07-29 05:28:20 +00:00
" minlod: %g \n "
" maxlod: %g%s \n "
2017-01-13 00:39:50 +00:00
, ent . model - > mins [ 0 ] , ent . model - > mins [ 1 ] , ent . model - > mins [ 2 ] , ent . model - > maxs [ 0 ] , ent . model - > maxs [ 1 ] , ent . model - > maxs [ 2 ] ,
contents ,
inf - > csurface . flags ,
inf - > surfaceid ,
inf - > geomset > = MAX_GEOMSETS ? - 1 : inf - > geomset , inf - > geomid , inf - > geomset > = MAX_GEOMSETS ? " (always) " : " " ,
2019-05-10 09:31:21 +00:00
inf - > numverts , inf - > numindexes / 3
# ifdef SKELETALMODELS
, inf - > numbones
# endif
2019-07-29 05:28:20 +00:00
, inf - > mindist , inf - > maxdist , inf - > maxdist ? " " : " (infinite) "
2017-01-13 00:39:50 +00:00
)
, CON_WHITEMASK , CPRINT_TALIGN | CPRINT_LALIGN , font_default , fs ) ;
}
}
else
2016-12-19 13:31:05 +00:00
{
R_DrawTextField ( r_refdef . grect . x , r_refdef . grect . y + y , r_refdef . grect . width , r_refdef . grect . height - y ,
va ( " mins: %g %g %g, maxs: %g %g %g \n " , ent . model - > mins [ 0 ] , ent . model - > mins [ 1 ] , ent . model - > mins [ 2 ] , ent . model - > maxs [ 0 ] , ent . model - > maxs [ 1 ] , ent . model - > maxs [ 2 ] )
, CON_WHITEMASK , CPRINT_TALIGN | CPRINT_LALIGN , font_default , fs ) ;
}
2017-01-13 00:39:50 +00:00
break ;
2019-02-16 19:09:07 +00:00
case MV_NORMALS :
break ;
2014-10-05 20:04:11 +00:00
case MV_BONES :
2014-08-24 15:40:33 +00:00
# ifdef SKELETALMODELS
2014-03-31 17:06:41 +00:00
{
2016-12-19 13:31:05 +00:00
int bonecount = Mod_GetNumBones ( ent . model , true ) ;
2016-12-13 11:50:15 +00:00
if ( bonecount )
2014-10-05 20:04:11 +00:00
{
Draw_FunString ( 0 , y , va ( " Bones: " ) ) ;
y + = 8 ;
2016-12-19 13:31:05 +00:00
M_BoneDisplayLame ( & ent , & y , 0 , 0 , 0 , bonecount , mods - > boneidx ) ;
2014-10-05 20:04:11 +00:00
}
else
2015-04-27 06:19:33 +00:00
R_DrawTextField ( r_refdef . grect . x , r_refdef . grect . y + y , r_refdef . grect . width , r_refdef . grect . height - y , " No bones in model " , CON_WHITEMASK , CPRINT_TALIGN | CPRINT_LALIGN , font_default , fs ) ;
2014-03-31 17:06:41 +00:00
}
2014-08-24 15:40:33 +00:00
# endif
2014-10-05 20:04:11 +00:00
break ;
2017-01-13 00:39:50 +00:00
case MV_EVENTS :
{
int i ;
float timestamp = 0 ;
int code = 0 ;
char * data = NULL ;
Draw_FunString ( 0 , y , va ( " Events: " ) ) ;
y + = 8 ;
for ( i = 0 ; Mod_GetModelEvent ( ent . model , mods - > framegroup , i , & timestamp , & code , & data ) ; y + = 8 , i + + )
{
Draw_FunString ( 0 , y , va ( " %i %f: %i %s " , i , timestamp , code , data ) ) ;
}
Draw_FunString ( 0 , y , va ( " %f: <end of animation> " , Mod_GetFrameDuration ( ent . model , 0 , mods - > framegroup ) ) ) ;
}
break ;
2014-10-05 20:04:11 +00:00
case MV_SHADER :
{
if ( ! mods - > shadertext )
{
2016-07-12 00:40:13 +00:00
char * body = Shader_GetShaderBody ( Mod_ShaderForSkin ( ent . model , mods - > surfaceidx , mods - > skingroup ) , mods - > shaderfile , sizeof ( mods - > shaderfile ) ) ;
2015-09-01 04:45:15 +00:00
if ( ! body )
break ;
2016-07-12 00:40:13 +00:00
if ( * mods - > shaderfile )
mods - > shadertext = Z_StrDup ( va ( " \n \n Press space to view+edit the shader \n \n %s " , body ) ) ;
else
mods - > shadertext = Z_StrDup ( body ) ;
2014-10-05 20:04:11 +00:00
}
2015-04-27 06:19:33 +00:00
R_DrawTextField ( r_refdef . grect . x , r_refdef . grect . y + 16 , r_refdef . grect . width , r_refdef . grect . height - 16 , mods - > shadertext , CON_WHITEMASK , CPRINT_TALIGN | CPRINT_LALIGN , font_default , fs ) ;
2014-10-05 20:04:11 +00:00
//fixme: draw the shader's textures.
}
break ;
2016-07-12 00:40:13 +00:00
case MV_TEXTURE :
{
shader_t * shader = Mod_ShaderForSkin ( ent . model , mods - > surfaceidx , mods - > skingroup ) ;
if ( shader )
{
2019-02-16 19:09:07 +00:00
char * t ;
2016-07-12 00:40:13 +00:00
texnums_t * skin = shader - > defaulttextures ;
shader = R_RegisterShader ( " modelviewertexturepreview " , SUF_2D , " { \n program default2d \n { \n map $diffuse \n } \n } \n " ) ;
2019-02-16 19:09:07 +00:00
switch ( mods - > textype )
{
case 1 :
t = " Normalmap " ;
shader - > defaulttextures - > base = skin - > bump ;
break ;
case 2 :
t = " SpecularMap " ;
shader - > defaulttextures - > base = skin - > specular ; //specular lighting values.
break ;
case 3 :
t = " UpperMap " ;
shader - > defaulttextures - > base = skin - > upperoverlay ; //diffuse texture for the upper body(shirt colour). no alpha channel. added to base.rgb
break ;
case 4 :
2019-03-12 05:04:27 +00:00
t = " LowerMap " ;
2019-02-16 19:09:07 +00:00
shader - > defaulttextures - > base = skin - > loweroverlay ; //diffuse texture for the lower body(trouser colour). no alpha channel. added to base.rgb
break ;
case 5 :
t = " PalettedMap " ;
shader - > defaulttextures - > base = skin - > paletted ; //8bit paletted data, just because.
break ;
case 6 :
t = " FullbrightMap " ;
shader - > defaulttextures - > base = skin - > fullbright ;
break ;
case 7 :
t = " ReflectCube " ;
shader - > defaulttextures - > base = skin - > reflectcube ;
break ;
case 8 :
t = " ReflectMask " ;
shader - > defaulttextures - > base = skin - > reflectmask ;
break ;
case 9 :
t = " DisplacementMap " ;
shader - > defaulttextures - > base = skin - > displacement ;
break ;
default :
mods - > textype = 0 ;
t = " Diffusemap " ;
shader - > defaulttextures - > base = skin - > base ;
break ;
}
if ( shader - > defaulttextures - > base )
{
Draw_FunString ( 0 , y , va ( " %s: %s (%s) " , t , shader - > defaulttextures - > base - > ident , shader - > defaulttextures - > base - > subpath ) ) ;
y + = 8 ;
R2D_Image ( 0 , y , shader - > defaulttextures - > base - > width , shader - > defaulttextures - > base - > height , 0 , 0 , 1 , 1 , shader ) ;
}
else
Draw_FunString ( 0 , y , va ( " %s: <NO TEXTURE> " , t ) ) ;
2016-07-12 00:40:13 +00:00
}
}
break ;
2014-10-05 20:04:11 +00:00
}
2014-03-30 08:55:06 +00:00
}
2015-06-16 23:53:58 +00:00
static qboolean M_ModelViewerKey ( struct menucustom_s * c , struct menu_s * m , int key , unsigned int unicode )
2014-03-30 08:55:06 +00:00
{
modelview_t * mods = c - > dptr ;
if ( key = = ' w ' )
{
mods - > dist * = 0.9 ;
2018-06-02 08:55:57 +00:00
if ( mods - > dist < 1 )
mods - > dist = 1 ;
2014-03-30 08:55:06 +00:00
}
else if ( key = = ' s ' )
mods - > dist / = 0.9 ;
2014-10-05 20:04:11 +00:00
else if ( key = = ' m ' )
{
Z_Free ( mods - > shadertext ) ;
mods - > shadertext = NULL ;
switch ( mods - > mode )
{
2016-12-19 13:31:05 +00:00
case MV_NONE : mods - > mode = MV_BONES ; break ;
case MV_BONES : mods - > mode = MV_SHADER ; break ;
case MV_SHADER : mods - > mode = MV_TEXTURE ; break ;
case MV_TEXTURE : mods - > mode = MV_COLLISION ; break ;
2017-01-13 00:39:50 +00:00
case MV_COLLISION : mods - > mode = MV_EVENTS ; break ;
2019-02-16 19:09:07 +00:00
case MV_EVENTS : mods - > mode = MV_NORMALS ; break ;
case MV_NORMALS : mods - > mode = MV_NONE ; break ;
2014-10-05 20:04:11 +00:00
}
}
2014-08-24 15:40:33 +00:00
else if ( key = = ' r ' )
{
mods - > framechangetime = realtime ;
mods - > skinchangetime = realtime ;
}
2017-01-13 00:39:50 +00:00
# ifdef RAGDOLL
else if ( key = = ' f ' )
{
mods - > flop ^ = 1 ;
if ( ! mods - > flop )
rag_removedeltaent ( & mods - > ragent ) ;
}
# endif
2016-12-19 13:31:05 +00:00
else if ( key = = ' [ ' )
2019-02-16 19:09:07 +00:00
{
2016-12-19 13:31:05 +00:00
mods - > boneidx - - ;
2019-02-16 19:09:07 +00:00
if ( mods - > boneidx < 0 )
mods - > boneidx = 0 ;
}
2016-12-19 13:31:05 +00:00
else if ( key = = ' ] ' )
mods - > boneidx + + ;
2017-08-16 02:14:07 +00:00
else if ( key = = K_UPARROW | | key = = K_KP_UPARROW | | key = = K_GP_DPAD_UP )
2014-03-30 08:55:06 +00:00
mods - > pitch + = 5 ;
2017-08-16 02:14:07 +00:00
else if ( key = = K_DOWNARROW | | key = = K_KP_DOWNARROW | | key = = K_GP_DPAD_DOWN )
2014-03-30 08:55:06 +00:00
mods - > pitch - = 5 ;
2017-08-16 02:14:07 +00:00
else if ( key = = K_LEFTARROW | | key = = K_KP_LEFTARROW | | key = = K_GP_DPAD_LEFT )
2014-03-30 08:55:06 +00:00
mods - > yaw - = 5 ;
2017-08-16 02:14:07 +00:00
else if ( key = = K_RIGHTARROW | | key = = K_KP_RIGHTARROW | | key = = K_GP_DPAD_RIGHT )
2014-03-30 08:55:06 +00:00
mods - > yaw + = 5 ;
2019-02-16 19:09:07 +00:00
else if ( key = = ' t ' )
{
if ( mods - > mode = = MV_TEXTURE )
mods - > textype + = 1 ;
else
mods - > textype = 0 ;
mods - > mode = MV_TEXTURE ;
}
2017-01-13 00:39:50 +00:00
else if ( key = = K_END )
2014-03-30 08:55:06 +00:00
{
mods - > skingroup = max ( 0 , mods - > skingroup - 1 ) ;
mods - > skinchangetime = realtime ;
2016-07-12 00:40:13 +00:00
Z_Free ( mods - > shadertext ) ;
mods - > shadertext = NULL ;
2014-03-30 08:55:06 +00:00
}
2017-01-13 00:39:50 +00:00
else if ( key = = K_HOME )
2014-03-30 08:55:06 +00:00
{
mods - > skingroup + = 1 ;
mods - > skinchangetime = realtime ;
2015-06-24 17:59:57 +00:00
Z_Free ( mods - > shadertext ) ;
mods - > shadertext = NULL ;
2014-03-30 08:55:06 +00:00
}
else if ( key = = K_PGDN )
{
mods - > framegroup = max ( 0 , mods - > framegroup - 1 ) ;
mods - > framechangetime = realtime ;
2015-06-24 17:59:57 +00:00
Z_Free ( mods - > shadertext ) ;
mods - > shadertext = NULL ;
2014-03-30 08:55:06 +00:00
}
else if ( key = = K_PGUP )
{
mods - > framegroup + = 1 ;
mods - > framechangetime = realtime ;
}
2017-01-13 00:39:50 +00:00
else if ( key = = K_DEL )
2015-06-24 17:59:57 +00:00
{
mods - > surfaceidx = max ( 0 , mods - > surfaceidx - 1 ) ;
Z_Free ( mods - > shadertext ) ;
mods - > shadertext = NULL ;
}
2017-01-13 00:39:50 +00:00
else if ( key = = K_INS )
2015-06-24 17:59:57 +00:00
{
mods - > surfaceidx + = 1 ;
Z_Free ( mods - > shadertext ) ;
mods - > shadertext = NULL ;
}
2016-07-12 00:40:13 +00:00
else if ( key = = K_SPACE )
{
if ( * mods - > shaderfile )
Cbuf_AddText ( va ( " \n edit %s \n " , mods - > shaderfile ) , RESTRICT_LOCAL ) ;
return true ;
}
2014-03-30 08:55:06 +00:00
else
return false ;
return true ;
}
2017-01-13 00:39:50 +00:00
# ifdef RAGDOLL
void M_Modelviewer_Shutdown ( struct menu_s * menu )
{
modelview_t * mv = menu - > data ;
rag_removedeltaent ( & mv - > ragent ) ;
skel_reset ( & mv - > ragworld ) ;
World_RBE_Shutdown ( & mv - > ragworld ) ;
}
//haxors, for skeletal objects+RBE
char * PDECL M_Modelviewer_AddString ( pubprogfuncs_t * prinst , const char * val , int minlength , pbool demarkup )
{
return Z_Malloc ( minlength ) ;
}
struct edict_s * PDECL M_Modelviewer_ProgsToEdict ( pubprogfuncs_t * prinst , int num )
{
return ( struct edict_s * ) prinst - > edicttable [ num ] ;
}
# endif
2014-03-30 08:55:06 +00:00
void M_Menu_ModelViewer_f ( void )
{
modelview_t * mv ;
menucustom_t * c ;
menu_t * menu ;
2017-01-13 00:39:50 +00:00
2015-07-14 14:47:00 +00:00
Key_Dest_Add ( kdm_emenu ) ;
2014-03-30 08:55:06 +00:00
menu = M_CreateMenu ( sizeof ( * mv ) ) ;
mv = menu - > data ;
2019-01-15 14:12:49 +00:00
c = MC_AddCustom ( menu , 64 , 32 , mv , 0 , NULL ) ;
2014-03-30 08:55:06 +00:00
menu - > cursoritem = ( menuoption_t * ) c ;
c - > draw = M_ModelViewerDraw ;
c - > key = M_ModelViewerKey ;
2017-01-13 00:39:50 +00:00
mv - > yaw = 180 ; // + crandom()*45;
2014-03-30 08:55:06 +00:00
mv - > dist = 150 ;
Q_strncpyz ( mv - > modelname , Cmd_Argv ( 1 ) , sizeof ( mv - > modelname ) ) ;
Q_strncpyz ( mv - > forceshader , Cmd_Argv ( 2 ) , sizeof ( mv - > forceshader ) ) ;
2017-01-13 00:39:50 +00:00
# ifdef RAGDOLL
menu - > remove = M_Modelviewer_Shutdown ;
mv - > ragworld . progs = & mv - > ragfuncs ;
mv - > ragfuncs . AddString = M_Modelviewer_AddString ;
mv - > ragfuncs . ProgsToEdict = M_Modelviewer_ProgsToEdict ;
mv - > ragfuncs . edicttable = ( edict_t * * ) & mv - > ragworld . edicts ;
mv - > ragworld . edicts = & mv - > ragworldedict ;
mv - > ragworld . edicts - > v = & mv - > ragworldvars ;
2018-03-24 04:02:09 +00:00
# ifdef VM_Q1
2017-01-13 00:39:50 +00:00
mv - > ragworld . edicts - > xv = & mv - > ragworldextvars ;
2018-03-24 04:02:09 +00:00
# endif
2017-01-13 00:39:50 +00:00
mv - > ragworld . num_edicts = 1 ;
mv - > ragworld . edicts - > v - > solid = SOLID_BBOX ;
VectorSet ( mv - > ragworld . edicts - > v - > mins , - 1000 , - 1000 , - 101 ) ;
VectorSet ( mv - > ragworld . edicts - > v - > maxs , 1000 , 1000 , - 100 ) ;
mv - > ragworld . worldmodel = Mod_ForName ( " " , MLV_SILENT ) ;
World_RBE_Start ( & mv - > ragworld ) ;
# endif
2014-03-30 08:55:06 +00:00
}
2018-10-11 10:31:23 +00:00
static int QDECL CompleteModelViewerList ( const char * name , qofs_t flags , time_t mtime , void * parm , searchpathfuncs_t * spath )
{
struct xcommandargcompletioncb_s * ctx = parm ;
const char * ext = COM_GetFileExtension ( name , NULL ) ;
if ( ! strcmp ( ext , " .mdl " ) | | ! strcmp ( ext , " .md2 " ) | | ! strcmp ( ext , " .md3 " )
| | ! strcmp ( ext , " .iqm " ) | | ! strcmp ( ext , " .dpm " ) | | ! strcmp ( ext , " .zym " )
| | ! strcmp ( ext , " .psk " ) | | ! strcmp ( ext , " .md5mesh " ) | | ! strcmp ( ext , " .md5anim " )
| | ! strcmp ( ext , " .bsp " ) | | ! strcmp ( ext , " .map " ) | | ! strcmp ( ext , " .hmp " )
2019-02-16 19:09:07 +00:00
| | ! strcmp ( ext , " .spr " ) | | ! strcmp ( ext , " .sp2 " ) | | ! strcmp ( ext , " .spr32 " )
| | ! strcmp ( ext , " .gltf " ) | | ! strcmp ( ext , " .glb " ) | | ! strcmp ( ext , " .ase " ) | | ! strcmp ( ext , " .lwo " ) | | ! strcmp ( ext , " .obj " ) )
2018-10-11 10:31:23 +00:00
{
ctx - > cb ( name , NULL , NULL , ctx ) ;
}
return true ;
}
void M_Menu_ModelViewer_c ( int argn , const char * partial , struct xcommandargcompletioncb_s * ctx )
{
if ( argn = = 1 )
{
COM_EnumerateFiles ( va ( " %s* " , partial ) , CompleteModelViewerList , ctx ) ;
COM_EnumerateFiles ( va ( " %s*/* " , partial ) , CompleteModelViewerList , ctx ) ;
COM_EnumerateFiles ( va ( " %s*/* " , partial ) , CompleteModelViewerList , ctx ) ;
COM_EnumerateFiles ( va ( " %s*/*/* " , partial ) , CompleteModelViewerList , ctx ) ;
}
}
2014-03-31 17:06:41 +00:00
# else
void M_Menu_ModelViewer_f ( void )
{
2014-09-14 01:45:11 +00:00
Con_Printf ( " modelviewer: not in this build \n " ) ;
2014-03-31 17:06:41 +00:00
}
# endif
2014-03-30 08:55:06 +00:00
typedef struct
{
2018-05-21 13:47:53 +00:00
struct
{
ftemanifest_t * manifest ;
char * gamedir ;
} * mod ;
size_t nummods ;
2014-03-30 08:55:06 +00:00
int y ;
} modmenu_t ;
static void Mods_Draw ( int x , int y , struct menucustom_s * c , struct menu_s * m )
{
modmenu_t * mods = c - > dptr ;
int i , ym ;
c - > common . height = vid . height - y ;
ym = y + c - > common . height ;
mods - > y = y ;
2018-05-21 13:47:53 +00:00
if ( ! mods - > nummods )
2016-08-25 00:12:14 +00:00
{
2019-04-15 18:43:42 +00:00
float scale [ ] = { 8 , 8 } ;
R_DrawTextField ( 0 , y , vid . width , vid . height - y ,
va (
" No games or mods known. \n "
2017-04-18 11:12:17 +00:00
# if defined(FTE_TARGET_WEB) || defined(NACL)
2019-04-15 18:43:42 +00:00
" Connection issue or bad server config. \n "
2017-04-18 11:12:17 +00:00
# else
2019-04-15 18:43:42 +00:00
# ifndef ANDROID
" You may need to use -basedir $PATHTOGAME on the commandline. \n "
# endif
" \n Expected data path: \n ^a%s " , com_gamepath
2017-04-18 11:12:17 +00:00
# endif
2019-04-15 18:43:42 +00:00
) , CON_WHITEMASK , 0 , font_console , scale ) ;
2016-09-01 14:31:24 +00:00
return ;
2016-08-25 00:12:14 +00:00
}
2014-09-14 01:45:11 +00:00
2018-05-21 13:47:53 +00:00
for ( i = 0 ; y + 8 < = ym & & i < mods - > nummods ; y + = 8 , i + + )
2014-03-30 08:55:06 +00:00
{
2018-05-21 13:47:53 +00:00
if ( mods - > mod [ i ] . manifest )
{
if ( mousecursor_y > = y & & mousecursor_y < y + 8 )
Draw_AltFunString ( x , y , mods - > mod [ i ] . manifest - > formalname ) ;
else
Draw_FunString ( x , y , mods - > mod [ i ] . manifest - > formalname ) ;
}
2014-03-30 08:55:06 +00:00
else
2018-05-21 13:47:53 +00:00
{
if ( mousecursor_y > = y & & mousecursor_y < y + 8 )
Draw_AltFunString ( x , y , mods - > mod [ i ] . gamedir ) ;
else
Draw_FunString ( x , y , mods - > mod [ i ] . gamedir ) ;
}
2014-03-30 08:55:06 +00:00
}
}
2015-06-16 23:53:58 +00:00
static qboolean Mods_Key ( struct menucustom_s * c , struct menu_s * m , int key , unsigned int unicode )
2014-03-30 08:55:06 +00:00
{
modmenu_t * mods = c - > dptr ;
int i ;
ftemanifest_t * man ;
2018-05-21 13:47:53 +00:00
if ( key = = K_MOUSE1 | | key = = K_ENTER | | key = = K_GP_A )
2014-03-30 08:55:06 +00:00
{
2016-09-01 14:31:24 +00:00
qboolean wasgameless = ! * FS_GetGamedir ( false ) ;
2014-03-30 08:55:06 +00:00
i = ( mousecursor_y - mods - > y ) / 8 ;
2018-05-21 13:47:53 +00:00
if ( i < 0 | | i > mods - > nummods )
2014-03-30 08:55:06 +00:00
return false ;
2018-05-21 13:47:53 +00:00
man = mods - > mod [ i ] . manifest ;
mods - > mod [ i ] . manifest = NULL ; //make sure the manifest survives the menu being closed.
2014-03-30 08:55:06 +00:00
M_RemoveMenu ( m ) ;
2015-04-14 23:12:17 +00:00
FS_ChangeGame ( man , true , true ) ;
2014-03-30 08:55:06 +00:00
2016-09-01 14:31:24 +00:00
if ( wasgameless & & ! ! * FS_GetGamedir ( false ) )
{
//starting to a blank state generally means that the current(engine-default) config settings are utterly useless and windowed by default.
//so generally when switching to a *real* game, we want to restart video just so things like fullscreen etc are saved+used properly.
Cbuf_AddText ( " \n vid_restart \n " , RESTRICT_LOCAL ) ;
}
else
{
//if we're already running a game, this should probably just be a vid_reload instead to ensure that the conback etc is reloaded.
//(a full restart is annoying)
Cbuf_AddText ( " \n vid_reload \n " , RESTRICT_LOCAL ) ;
}
2014-03-30 08:55:06 +00:00
return true ;
}
return false ;
}
static void Mods_Remove ( struct menu_s * m )
{
modmenu_t * mods = m - > data ;
int i ;
2018-05-21 13:47:53 +00:00
for ( i = 0 ; i < mods - > nummods ; i + + )
2014-03-30 08:55:06 +00:00
{
2018-05-21 13:47:53 +00:00
if ( mods - > mod [ i ] . manifest )
FS_Manifest_Free ( mods - > mod [ i ] . manifest ) ;
Z_Free ( mods - > mod [ i ] . gamedir ) ;
2014-03-30 08:55:06 +00:00
}
2018-05-21 13:47:53 +00:00
Z_Free ( mods - > mod ) ;
mods - > mod = NULL ;
2014-03-30 08:55:06 +00:00
}
2018-05-21 13:47:53 +00:00
static qboolean Mods_AddManifest ( void * usr , ftemanifest_t * man )
{
modmenu_t * mods = usr ;
int i = mods - > nummods ;
mods - > mod = BZ_Realloc ( mods - > mod , ( i + 1 ) * sizeof ( * mods - > mod ) ) ;
mods - > mod [ i ] . manifest = man ;
mods - > mod [ i ] . gamedir = NULL ;
mods - > nummods = i + 1 ;
return true ;
}
static int QDECL Mods_AddGamedir ( const char * fname , qofs_t fsize , time_t mtime , void * usr , searchpathfuncs_t * spath )
2014-03-30 08:55:06 +00:00
{
modmenu_t * mods = usr ;
2018-05-21 13:47:53 +00:00
size_t l = strlen ( fname ) ;
int i , p ;
char gamedir [ MAX_QPATH ] ;
if ( l & & fname [ l - 1 ] = = ' / ' & & l < countof ( gamedir ) )
{
l - - ;
memcpy ( gamedir , fname , l ) ;
gamedir [ l ] = 0 ;
for ( i = 0 ; i < mods - > nummods ; i + + )
{
//don't add dupes (can happen from gamedir+homedir)
//if the gamedir was already included in one of the manifests, don't bother including it again.
//this generally removes id1.
if ( mods - > mod [ i ] . manifest )
{
for ( p = 0 ; p < countof ( fs_manifest - > gamepath ) ; p + + )
if ( mods - > mod [ i ] . manifest - > gamepath [ p ] . path )
if ( ! Q_strcasecmp ( mods - > mod [ i ] . manifest - > gamepath [ p ] . path , gamedir ) )
return true ;
}
else if ( mods - > mod [ i ] . gamedir )
{
if ( ! Q_strcasecmp ( mods - > mod [ i ] . gamedir , gamedir ) )
return true ;
}
}
mods - > mod = BZ_Realloc ( mods - > mod , ( i + 1 ) * sizeof ( * mods - > mod ) ) ;
mods - > mod [ i ] . manifest = NULL ;
mods - > mod [ i ] . gamedir = Z_StrDup ( gamedir ) ;
mods - > nummods = i + 1 ;
}
2014-03-30 08:55:06 +00:00
return true ;
}
# include "fs.h"
void M_Menu_Mods_f ( void )
{
2014-04-13 04:23:13 +00:00
modmenu_t mods ;
2014-03-30 08:55:06 +00:00
menucustom_t * c ;
menu_t * menu ;
2018-05-21 13:47:53 +00:00
extern qboolean com_homepathenabled ;
2014-03-30 08:55:06 +00:00
2014-04-13 04:23:13 +00:00
memset ( & mods , 0 , sizeof ( mods ) ) ;
2018-05-21 13:47:53 +00:00
FS_EnumerateKnownGames ( Mods_AddManifest , & mods ) ;
if ( com_homepathenabled )
Sys_EnumerateFiles ( com_homepath , " * " , Mods_AddGamedir , & mods , NULL ) ;
Sys_EnumerateFiles ( com_gamepath , " * " , Mods_AddGamedir , & mods , NULL ) ;
//FIXME: sort by mtime?
2014-03-30 08:55:06 +00:00
2016-09-01 14:31:24 +00:00
Key_Dest_Add ( kdm_emenu ) ;
menu = M_CreateMenu ( sizeof ( modmenu_t ) ) ;
* ( modmenu_t * ) menu - > data = mods ;
if ( COM_FCheckExists ( " gfx/p_option.lmp " ) )
2014-04-13 04:23:13 +00:00
{
2016-09-01 14:31:24 +00:00
MC_AddPicture ( menu , 16 , 4 , 32 , 144 , " gfx/qplaque.lmp " ) ;
MC_AddCenterPicture ( menu , 0 , 24 , " gfx/p_option.lmp " ) ;
2014-04-13 04:23:13 +00:00
}
2014-03-30 08:55:06 +00:00
2019-01-15 14:12:49 +00:00
c = MC_AddCustom ( menu , 64 , 32 , menu - > data , 0 , NULL ) ;
2016-09-01 14:31:24 +00:00
menu - > cursoritem = ( menuoption_t * ) c ;
c - > draw = Mods_Draw ;
c - > key = Mods_Key ;
menu - > remove = Mods_Remove ;
2014-09-02 02:44:43 +00:00
}
2015-04-14 23:12:17 +00:00
#if 0
extern ftemanifest_t * fs_manifest ; //currently active manifest.
struct installermenudata
{
menuedit_t * syspath ;
} ;
static void Installer_Remove ( struct menu_s * m )
{
Cbuf_AddText ( " quit force \n " , RESTRICT_LOCAL ) ;
}
void FS_CreateBasedir ( const char * path ) ;
# include <process.h>
static qboolean Installer_Go ( menuoption_t * opt , menu_t * menu , int key )
{
struct installermenudata * md = menu - > data ;
2017-08-16 02:14:07 +00:00
if ( key = = K_MOUSE1 | | key = = K_ENTER | | key = = K_GP_START )
2015-04-14 23:12:17 +00:00
{
extern int startuppending ;
vfsfile_t * f ;
char path [ MAX_OSPATH ] ;
char exepath [ MAX_OSPATH ] ;
char newexepath [ MAX_OSPATH ] ;
Q_snprintfz ( path , sizeof ( path ) , " %s/ " , md - > syspath - > text ) ;
Con_Printf ( " path %s \n " , path ) ;
menu - > remove = NULL ;
M_RemoveMenu ( menu ) ;
FS_CreateBasedir ( path ) ;
# ifdef _WIN32
GetModuleFileName ( NULL , exepath , sizeof ( exepath ) ) ;
FS_NativePath ( va ( " %s.exe " , fs_manifest - > installation ) , FS_ROOT , newexepath , sizeof ( newexepath ) ) ;
CopyFile ( exepath , newexepath , FALSE ) ;
// SetHookState(false);
Host_Shutdown ( ) ;
// CloseHandle (qwclsemaphore);
// SetHookState(false);
// _execv(newexepath, host_parms.argv);
{
PROCESS_INFORMATION childinfo ;
STARTUPINFO startinfo = { sizeof ( startinfo ) } ;
CreateProcess ( newexepath , va ( " \" %s \" +sys_register_file_associations %s " , newexepath , COM_Parse ( GetCommandLineA ( ) ) ) , NULL , NULL , FALSE , 0 , NULL , path , & startinfo , & childinfo ) ;
}
exit ( 1 ) ;
# elif 0
# ifdef __linux__
if ( readlink ( " /proc/self/exe " , exepath , sizeof ( exepath ) - 1 ) < = 0 )
# endif
Q_strncpyz ( exepath , host_parms . argv [ 0 ] , sizeof ( exepath ) ) ;
int fd = creat ( newexepath , S_IRWXU | S_IRGRP | S_IXGRP ) ;
write ( fd ) ;
close ( fd ) ;
# endif
startuppending = 2 ;
return TRUE ;
}
return FALSE ;
}
void M_Menu_Installer ( void )
{
menu_t * menu ;
struct installermenudata * md ;
Key_Dest_Add ( kdm_menu ) ;
menu = M_CreateMenu ( sizeof ( * md ) ) ;
md = menu - > data = ( menu + 1 ) ;
md - > syspath = MC_AddEdit ( menu , 0 , 160 , 64 , " Path " , " C:/Games/AfterQuake/testinstall/base " ) ; //va("c:/%s", fs_manifest->installation));
//FIXME: add path check display
MC_AddCommand ( menu , 0 , 160 , 128 , " Install " , Installer_Go ) ;
MC_AddConsoleCommand ( menu , 0 , 160 , 136 , " Cancel " , " menu_quit \n " ) ;
menu - > selecteditem = ( menuoption_t * ) md - > syspath ;
menu - > cursoritem = ( menuoption_t * ) MC_AddWhiteText ( menu , 250 , 0 , menu - > selecteditem - > common . posy , NULL , false ) ;
menu - > remove = Installer_Remove ;
}
# endif
2018-03-24 04:02:09 +00:00
# endif