//-prefixed lines are effectively inserted before the default.cfg
//+prefixed lines are inserted AFTER default.cfg and will thus conflict/override the mod's own settings

game xonotic
name "FTE Xonotic (0.8.5)"
protocolname "Xonotic"
basegame data
basegame *ftedata	//so stuff gets written here instead.

//xonotic 0.8.5 packages.
package "data/font-unifont-20220627.pk3"			crc 0xa39ce3ad mirror "unzip:Xonotic/data/font-unifont-20220627.pk3,https://github.com/garymoon/xonotic/releases/download/xonotic-v0.8.5/xonotic-0.8.5.zip"
package "data/font-xolonium-20220627.pk3"			crc 0x9553d8a4 mirror "unzip:Xonotic/data/font-xolonium-20220627.pk3,https://github.com/garymoon/xonotic/releases/download/xonotic-v0.8.5/xonotic-0.8.5.zip"
package "data/xonotic-20220627-data.pk3"			crc 0x57a1ba9c mirror "unzip:Xonotic/data/xonotic-20220627-data.pk3,https://github.com/garymoon/xonotic/releases/download/xonotic-v0.8.5/xonotic-0.8.5.zip"
package "data/xonotic-20220627-maps.pk3"			crc 0x1d3d7cf1 mirror "unzip:Xonotic/data/xonotic-20220627-maps.pk3,https://github.com/garymoon/xonotic/releases/download/xonotic-v0.8.5/xonotic-0.8.5.zip"
package "data/xonotic-20220627-music.pk3"			crc 0x5d1dd373 mirror "unzip:Xonotic/data/xonotic-20220627-music.pk3,https://github.com/garymoon/xonotic/releases/download/xonotic-v0.8.5/xonotic-0.8.5.zip"
package "data/xonotic-20220627-nexcompat.pk3"		crc 0x83f613b9 mirror "unzip:Xonotic/data/xonotic-20220627-nexcompat.pk3,https://github.com/garymoon/xonotic/releases/download/xonotic-v0.8.5/xonotic-0.8.5.zip"

//This sucks. overrides the *.dat files to work around gmqcc bugs (also smaller dat files at runtime, but still stupid and annoying and means compat hits the fan when using the standard csprogs on dp servers)
package "data/xonotic-fixups-0.8.5.zip"	crc 0xe27b8ad3 mirror "xonotic-fixups-0.8.5.pk3"
//-set pr_fixbrokenqccarrays 2	//this can be used instead, but can cause its own problems.



-set dpcompat_set 1		//gah
-set dpcompat_console 1	//DP's $ stuff works differently from quakeworld. definitely more annoying, but xonotic's configs expect dp behaviour
-set dpcompat_smallerfonts 1 //in case its needed.
-set dpcompat_strcat_limit 16383	//work around xonotic network compatibility issue.

-set v_gammainverted 1
-set con_stayhidden 0
-set allow_download_pakcontents 1
-set allow_download_refpackages 0
-set sv_bigcoords ""
-set map_autoopenportals 1
-set sv_port 26000
-set cl_defaultport 26000
-set r_particlesdesc effectinfo

-if ($dedicated < 1) then set qport 654		//xonotic expects this cvar to exist only in clients (and uses it to detect client vs dedicated server). this entirely ignores 'setrenderer sv' of course. good luck with that one.

-set gl_info_extensions "GL_EXT_texture_compression_s3tc GL_ARB_texture_compression" //fte doesn't have a cvar that contains opengl extensions, in part because they don't apply to other renderers, thus making it kinda useless. and xonotic likes spamming warning messages, even though they're invalid half the time, and impossible for a user to work around the rest of the time.

-set cl_movement 1		//xonotic's physics are inconsistent with itself, but it judders even without prediction so we might as well enable it
-set cl_movement_replay ""	//just to silence spam. actual value doesn't change anything in fte, and xonotic keeps changing it randomly anyway.
-set sv_nqplayerphysics 0	//xonotic runs async player physics. we've no need to force anything.
-set pr_enable_uriget 0 //enabling this causes xonotic's menu to get pissy about updates, which probably won't work very well with fte, so best to block all that crap. sadly this also breaks the stats stuff.
-set cl_lerp_smooth 0	//don't run in the past. DP has nothing like that the whole servertime/serverprevtime stuff will just get confused like hell.
-set r_shadow_realtime_nonworld_lightmaps 2 //DP's q3bsp lighting is doubled relative to q3, for some reason.

-set con_chatsize 8 	//doesn't exist in FTE, resulting in qc division by 0 if not set.
-set con_textsize 12	//keep the console sized at a fixed 12pt point, regardless of actual res.
//con_stayhidden 1	//don't pop up the console randomly.
-set dpcompat_makeshitup 2 //ignore most of what the shaders are saying and just make shit up, adding deluxe+specular+fullbrights+reflectcube etc.
-set dpcompat_findradiusarealinks 1 //matches dp. should help performance.
-set sv_gameplayfix_spawnbeforethinks 1 //some nq mods actually break without this glitch. DP forces a fix, so match that behaviour because xonotic needs it.

//I copied this list out of the dp sourcecode. I don't know if xonotic needs them, but it normally has them anyway.
//fte doesn't even implement them all either, so that's fun. still, if it ever does then they'll at least get their expected values.
-set sv_gameplayfix_blowupfallenzombies 1
-set sv_gameplayfix_findradiusdistancetobox 1
-set sv_gameplayfix_grenadebouncedownslopes 1
-set sv_gameplayfix_slidemoveprojectiles 1
-set sv_gameplayfix_upwardvelocityclearsongroundflag 1
-set sv_gameplayfix_setmodelrealbox 1
-set sv_gameplayfix_droptofloorstartsolid 1
-set sv_gameplayfix_droptofloorstartsolid_nudgetocorrect 1
-set sv_gameplayfix_noairborncorpse 1
-set sv_gameplayfix_noairborncorpse_allowsuspendeditems 1
-set sv_gameplayfix_easierwaterjump 1
-set sv_gameplayfix_delayprojectiles 1
-set sv_gameplayfix_multiplethinksperframe 1
-set sv_gameplayfix_fixedcheckwatertransition 1
-set sv_gameplayfix_q1bsptracelinereportstexture 1
-set sv_gameplayfix_swiminbmodels 1
-set sv_gameplayfix_downtracesupportsongroundflag 1
-set sv_gameplayfix_q2airaccelerate 0

//most of these cvars are not defined by FTE, but xonotic expects them anyway. so make sure they're there for the pmove code.
-set sv_jumpvelocity 270
-set sv_maxairspeed 30
-set sv_nostep 0
-set sv_jumpstep 1
-set sv_wateraccelerate -1
-set sv_waterfriction -1
-set sv_airaccel_sideways_friction 0
-set sv_airaccel_qw 1
-set sv_airaccel_qw_stretchfactor 0
-set sv_airstopaccelerate 0
-set sv_airstrafeaccelerate 0
-set sv_maxairstrafespeed 0
-set sv_airstrafeaccel_qw 0
-set sv_aircontrol 0
-set sv_aircontrol_penalty 0
-set sv_aircontrol_power 2
-set sv_aircontrol_backwards 0
-set sv_airspeedlimit_nonqw 0
-set sv_warsowbunny_turnaccel 0
-set sv_warsowbunny_accel 0.1585
-set sv_warsowbunny_topspeed 925
-set sv_warsowbunny_backtosideratio 0.8
-set sv_airaccelerate -1	//dp's default... to mean defer to sv_accelerate.

//all these cvars are implemented using a custom conback shader.
-set scr_conalphafactor 1
-set scr_conalpha2factor 0
-set scr_conalpha3factor 0
-set scr_conbrightness 1
-set scr_conscroll_x 0
-set scr_conscroll_y 0
-set scr_conscroll2_x 0
-set scr_conscroll2_y 0
-set scr_conscroll3_x 0
-set scr_conscroll3_y 0
-set r_textcontrast 1 //fixes colourpicker widget

-set com_parseutf8 1	//fte's name. interpret text as utf-8 when printing.
-set utf8_enable 1	//not fte's cvar name. have the qc builtins operate on codepoints rather than bytes (slower, still unaware of emoji, accents, etc).

-alias playermodel model	//FTE uses userinfo stuff for this stuff
-alias playerskin skin		//FTE uses userinfo stuff for this stuff

-set pr_csqc_memsize "64m" //xonotic is shit and inefficient. it really does need FAR too much memory.
-set pr_ssqc_memsize "96m" //xonotic is shit and inefficient. it really does need FAR too much memory.

-set r_deluxemapping 1 //load deluxemaps, cos they're a little prettier
-set dpcompat_nopremulpics 1 //0 has problems with dds files etc, which is frankly a shame.

//this won't force the menu to use a less laggy cursor, but should at least give the console a little more personality.
-set cl_cursor "gfx/menu/luma/cursor.jpg"
-set cl_cursor_scale 0.333
-set cl_cursor_bias_x 10
-set cl_cursor_bias_y 3.33

-set vid_gl20 1	//make sure various menu options are not greyed out

-set gl_specular 1			//DP's default, that makes things too shiny (because if you're going to make a texture then sadly most people want it to be seen)
-set dpcompat_corruptglobals 1 //stomp on random qc globals that were meant to be cachable from one frame to the next.
-set vid_pixelheight 1		//DP mods have a nasty tendancy to get confused when this cvar doesn't exist.

-set s_al_disable 1			//xonotic seems to clog ALL the openal audio buffers with useless sounds, so disable openal to prevent that from happening.

-set dpcompat_nopreparse 1 	//No unicasts and stuff split over packets mean lengths of custom stuff cannot be determined, resulting in translation of other things failing to translate.
-set cl_loopbackprotocol dpp7	//needs to be some sort of nq protocol due to nopreparse. might as well match dp and network player velocity entirely separately from its position...
-set sv_listen_dp 1		//listen for dp-protocol client connections
-set sv_listen_qw 0		//ignore standard QW clients (they'll just get dp responses which they'll ignore)
-set sv_listen_nq 0		//nq-protocol clients will just be ignored.
-set sv_bigcoords 1		//kinda required for dpp7 to function correctly.

-set r_particlesdesc effectinfo
-set sv_mintic 0.0333		//should match dp's rate.
-set sv_maxtic 0 //fixed tick rates
-set cl_nolerp 0

-set sv_cullentities_trace 0 //still needs work. fte still has performance issues with tracing through patches


-set sv_curl_serverpackages ""	//not in FTE, but xonotic warns when missing.


-set _cl_name "Stalking is illegal"
-set pr_autocreatecvars 0 //so we're more likely to notice unknown cvars.

//misc cvars that the gamecode checks for for unknowable reasons
//set r_texture_dds_load 1
//set vid_desktopfullscreen ${vid_fullscreen==2}
//set hud_panel_notify_print
//set con_chattime
//set con_chatsound
//set net_slist_pause
//set r_viewfbo ${r_hdr_framebuffer}
//set r_depthfirst
//set gl_vbo	//removed from dp too
//set v_glslgamma
//set r_glsl_saturation
//set r_hdr_scenebrightness
//set sys_memsize_virtual
//set sys_memsize_physical
//set mod_q3bsp_nolightmaps
//set r_shadow_gloss ${gl_specular}
//set r_water ${r_portalrecursion>0}
//set r_water_resolutionmultiplier ${r_reflectrefract_scale}
//set cl_decals
//set cl_decals_models
//set r_drawdecals_drawdistance
//set cl_decals_fadetime
//set r_shadow_usenormalmap
//set r_coronas_occlusionquery
//set r_motionblur
//set cl_particles
//set r_drawparticles_drawdistance
//set snd_staticvolume
//set snd_channel0volume
//set snd_channel3volume
//set snd_channel6volume
//set snd_channel7volume
//set snd_channel4volume
//set snd_channel2volume
//set snd_channel1volume
//set snd_mutewhenidle ${snd_inactive==0}
//set snd_speed ${snd_khz}
//set snd_channels ${snd_numspeakers}
//set snd_swapstereo ${snd_leftisright}
//set snd_spatialization_control
//set m_accelerate
//set con_closeontoggleconsole
//set cl_movement_track_canjump
//set _cl_rate ${rate}
//set cl_curl_maxdownloads
//set cl_curl_maxspeed
//set shownetgraph ${r_netgraph}
//set cl_minfps
//set cl_maxidlefps ${cl_idlefps}
//set showtime
//set cl_capturevideo
//set g_campaignxonoticbeta_won
//set r_glsl_postprocess
//set joy_active
//set con_chatrect_x
//set con_chatrect_y
//set con_chatwidth
//set net_slist_favorites
//set cl_bobfall
//set cl_smoothviewheight

-maxplayers 16							//xonotic doesn't like empty to mean ((deathmatch||coop)?32:1), so be explicit.
-deathmatch 1							//normally gets set to 1 in dp when maxplayers is forced (coop be damned).

-pr_precachepic_slow 1					//xonotic sucks for this. its abuse of drawgetimagesize slows stuff down too.
-set mod_precache 2						//disabling this slashes ram usage. there might be some stutter from loading textures, but no outright stalls at least. the prediction misses are worse.
-set mod_precache 0						//FIXME: override sv_precacheplayermodels instead.
//FIXME: -set _q3bsp_bihtraces 1		//work around q3map2 being so defective and throwing 5000 brushes into a single leaf.
-set sv_gameplayfix_setmodelrealbox 0	//setting this to 0 prevents the server from stalling waiting for the thing to load.
+set sv_precacheplayermodels 0			//fte has loader threads, and the extra upfront load time is just annoying (override the mod's default). 
-set s_precache 0						//mneh, sounds are overrated anyway.

