2004-08-23 00:15:46 +00:00
# include "quakedef.h"
# include "winquake.h"
2009-11-04 21:16:50 +00:00
# include "pr_common.h"
2004-08-23 00:15:46 +00:00
# include "gl_draw.h"
2011-09-03 03:49:43 +00:00
# include "shader.h"
2012-01-01 02:26:42 +00:00
# include "glquake.h"
2010-01-15 05:35:27 +00:00
# include <string.h>
2009-11-04 21:16:50 +00:00
refdef_t r_refdef ;
vec3_t r_origin , vpn , vright , vup ;
entity_t r_worldentity ;
2009-11-04 23:20:50 +00:00
entity_t * currententity ; //nnggh
int r_framecount ;
struct texture_s * r_notexture_mip ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
int r_blockvidrestart ; //'block' is a bit of a misnomer. 0=filesystem, configs, cinematics, video are all okay as they are. 1=starting up, waiting for filesystem, will restart after. 2=configs execed, but still need cinematics. 3=video will be restarted without any other init needed
2013-03-12 23:09:25 +00:00
int r_regsequence ;
int rspeeds [ RSPEED_MAX ] ;
int rquant [ RQUANT_MAX ] ;
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
void R_InitParticleTexture ( void ) ;
2004-08-23 00:15:46 +00:00
qboolean vid_isfullscreen ;
# define VIDCOMMANDGROUP "Video config"
# define GRAPHICALNICETIES "Graphical Nicaties" //or eyecandy, which ever you prefer.
# define GLRENDEREROPTIONS "GL Renderer Options"
# define SCREENOPTIONS "Screen Options"
2016-07-12 00:40:13 +00:00
# define VKRENDEREROPTIONS "Vulkan-Specific Renderer Options"
2004-08-23 00:15:46 +00:00
unsigned int d_8to24rgbtable [ 256 ] ;
2014-10-11 19:39:45 +00:00
unsigned int d_8to24bgrtable [ 256 ] ;
2004-08-23 00:15:46 +00:00
2006-01-16 13:47:56 +00:00
extern int gl_anisotropy_factor ;
2006-04-14 05:23:11 +00:00
// callbacks used for cvars
2015-04-21 04:12:00 +00:00
void QDECL SCR_Viewsize_Callback ( struct cvar_s * var , char * oldvalue ) ;
void QDECL SCR_Fov_Callback ( struct cvar_s * var , char * oldvalue ) ;
void QDECL Image_TextureMode_Callback ( struct cvar_s * var , char * oldvalue ) ;
2015-09-06 03:30:28 +00:00
void QDECL R_SkyBox_Changed ( struct cvar_s * var , char * oldvalue )
{
if ( qrenderer ! = QR_NONE & & cl . worldmodel )
{
if ( * var - > string )
R_SetSky ( var - > string ) ;
else
R_SetSky ( cl . skyname ) ;
}
}
2004-08-23 00:15:46 +00:00
2015-08-07 17:49:49 +00:00
# ifdef FTE_TARGET_WEB //webgl sucks too much to get a stable framerate without vsync.
cvar_t vid_vsync = CVARAF ( " vid_wait " , " 1 " ,
" vid_vsync " , CVAR_ARCHIVE ) ;
# else
2014-02-07 08:38:40 +00:00
cvar_t vid_vsync = CVARAF ( " vid_wait " , " 0 " ,
" vid_vsync " , CVAR_ARCHIVE ) ;
2015-08-07 17:49:49 +00:00
# endif
2006-02-11 02:09:43 +00:00
2010-07-11 02:22:39 +00:00
cvar_t _windowed_mouse = CVARF ( " _windowed_mouse " , " 1 " ,
CVAR_ARCHIVE ) ;
2006-02-11 02:09:43 +00:00
2010-07-11 02:22:39 +00:00
cvar_t con_ocranaleds = CVAR ( " con_ocranaleds " , " 2 " ) ;
2006-02-11 02:09:43 +00:00
2010-07-11 02:22:39 +00:00
cvar_t cl_cursor = CVAR ( " cl_cursor " , " " ) ;
2014-09-02 02:44:43 +00:00
cvar_t cl_cursorscale = CVAR ( " cl_cursor_scale " , " 0.2 " ) ;
cvar_t cl_cursorbiasx = CVAR ( " cl_cursor_bias_x " , " 7.5 " ) ;
cvar_t cl_cursorbiasy = CVAR ( " cl_cursor_bias_y " , " 0.8 " ) ;
2004-08-23 00:15:46 +00:00
2011-12-26 15:19:13 +00:00
cvar_t gl_nocolors = CVARF ( " gl_nocolors " , " 0 " , CVAR_ARCHIVE ) ;
cvar_t gl_part_flame = CVARFD ( " gl_part_flame " , " 1 " , CVAR_ARCHIVE , " Enable particle emitting from models. Mainly used for torch and flame effects. " ) ;
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
//opengl library, blank means try default.
2011-01-28 05:39:40 +00:00
static cvar_t gl_driver = CVARF ( " gl_driver " , " " ,
2010-07-11 02:22:39 +00:00
CVAR_ARCHIVE | CVAR_RENDERERLATCH ) ;
2014-02-07 08:38:40 +00:00
cvar_t gl_shadeq1_name = CVARD ( " gl_shadeq1_name " , " * " , " Rename all surfaces from quake1 bsps using this pattern for the purposes of shader names. " ) ;
2004-10-26 15:31:39 +00:00
extern cvar_t r_vertexlight ;
2015-05-03 19:57:46 +00:00
extern cvar_t r_forceprogramify ;
2005-08-06 07:18:29 +00:00
2015-06-15 20:11:27 +00:00
cvar_t mod_md3flags = CVARD ( " mod_md3flags " , " 1 " , " The flags field of md3s was never officially defined. If this is set to 1, the flags will be treated identically to mdl files. Otherwise they will be ignored. Naturally, this is required to provide rotating pickups in quake. " ) ;
2007-08-21 22:41:15 +00:00
2010-07-11 02:22:39 +00:00
cvar_t r_ambient = CVARF ( " r_ambient " , " 0 " ,
2007-08-21 22:41:15 +00:00
CVAR_CHEAT ) ;
2011-12-26 15:19:13 +00:00
cvar_t r_bloodstains = CVARF ( " r_bloodstains " , " 1 " , CVAR_ARCHIVE ) ;
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
cvar_t r_bouncysparks = CVARFD ( " r_bouncysparks " , " 1 " ,
2011-06-07 23:54:58 +00:00
CVAR_ARCHIVE ,
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
" Enables particle interaction with world surfaces, allowing for bouncy particles, stains, and decals. " ) ;
2010-07-11 02:22:39 +00:00
cvar_t r_drawentities = CVAR ( " r_drawentities " , " 1 " ) ;
2015-08-07 17:49:49 +00:00
cvar_t r_drawflat = CVARAF ( " r_drawflat " , " 0 " , " gl_textureless " ,
2011-12-26 15:19:13 +00:00
CVAR_ARCHIVE | CVAR_SEMICHEAT | CVAR_RENDERERCALLBACK | CVAR_SHADERSYSTEM ) ;
2015-06-15 20:11:27 +00:00
cvar_t r_wireframe = CVARFD ( " r_wireframe " , " 0 " ,
CVAR_CHEAT , " Developer feature where everything is drawn with wireframe over the top. Only active where cheats are permitted. " ) ;
2014-09-02 02:44:43 +00:00
cvar_t r_wireframe_smooth = CVAR ( " r_wireframe_smooth " , " 0 " ) ;
2013-10-29 17:38:22 +00:00
cvar_t r_refract_fbo = CVARD ( " r_refract_fbo " , " 1 " , " Use an fbo for refraction. If 0, just renders as a portal and uses a copy of the current framebuffer. " ) ;
2010-07-11 02:22:39 +00:00
cvar_t gl_miptexLevel = CVAR ( " gl_miptexLevel " , " 0 " ) ;
2011-12-26 15:19:13 +00:00
cvar_t r_drawviewmodel = CVARF ( " r_drawviewmodel " , " 1 " , CVAR_ARCHIVE ) ;
2010-07-11 02:22:39 +00:00
cvar_t r_drawviewmodelinvis = CVAR ( " r_drawviewmodelinvis " , " 0 " ) ;
cvar_t r_dynamic = CVARF ( " r_dynamic " , IFMINIMAL ( " 0 " , " 1 " ) ,
2007-08-21 22:41:15 +00:00
CVAR_ARCHIVE ) ;
2010-07-11 02:22:39 +00:00
cvar_t r_fastturb = CVARF ( " r_fastturb " , " 0 " ,
CVAR_SHADERSYSTEM ) ;
cvar_t r_fastsky = CVARF ( " r_fastsky " , " 0 " ,
2011-12-26 15:19:13 +00:00
CVAR_ARCHIVE | CVAR_SHADERSYSTEM ) ;
2010-07-11 02:22:39 +00:00
cvar_t r_fastskycolour = CVARF ( " r_fastskycolour " , " 0 " ,
2009-11-04 21:16:50 +00:00
CVAR_RENDERERCALLBACK | CVAR_SHADERSYSTEM ) ;
2010-11-10 03:32:47 +00:00
cvar_t r_fb_bmodels = CVARAF ( " r_fb_bmodels " , " 1 " ,
" gl_fb_bmodels " , CVAR_SEMICHEAT | CVAR_RENDERERLATCH ) ;
2015-06-15 20:11:27 +00:00
cvar_t r_fb_models = CVARAFD ( " r_fb_models " , " 1 " ,
" gl_fb_models " , CVAR_SEMICHEAT , " Force all non-player models to be fullbright in deathmatch. Because if you don't enable these cheats then you'll go splat because everone else uses them. QuakeWorld players suck. " ) ;
2008-05-25 22:08:29 +00:00
cvar_t r_skin_overlays = SCVARF ( " r_skin_overlays " , " 1 " ,
CVAR_SEMICHEAT | CVAR_RENDERERLATCH ) ;
2014-04-12 03:31:59 +00:00
cvar_t r_globalskin_first = CVARFD ( " r_globalskin_first " , " 100 " , CVAR_RENDERERLATCH , " Specifies the first .skin value that is a global skin. Entities within this range will use the shader/image called 'gfx/skinSKIN.lmp' instead of their regular skin. See also: r_globalskin_count. " ) ;
2014-02-11 17:51:29 +00:00
cvar_t r_globalskin_count = CVARFD ( " r_globalskin_count " , " 10 " , CVAR_RENDERERLATCH , " Specifies how many globalskins there are. " ) ;
2015-09-10 10:16:26 +00:00
cvar_t r_coronas = CVARFD ( " r_coronas " , " 0 " , CVAR_ARCHIVE , " Draw coronas on realtime lights. Overrides glquake-esque flashblends. " ) ;
2015-10-11 11:34:58 +00:00
cvar_t r_coronas_occlusion = CVARFD ( " r_coronas_occlusion " , " " , CVAR_ARCHIVE , " Specifies that coronas should be occluded more carefully. \n 0: No occlusion, at all. \n 1: BSP occlusion only (simple tracelines). \n 2: non-bsp occlusion also (complex tracelines). \n 3: Depthbuffer reads (forces synchronisation). \n 4: occlusion queries. " ) ;
2016-07-12 00:40:13 +00:00
cvar_t r_coronas_mindist = CVARFD ( " r_coronas_mindist " , " 128 " , CVAR_ARCHIVE , " Coronas closer than this will be invisible, preventing near clip plane issues. " ) ;
cvar_t r_coronas_fadedist = CVARFD ( " r_coronas_fadedist " , " 256 " , CVAR_ARCHIVE , " Coronas will fade out over this distance. " ) ;
2007-08-21 22:41:15 +00:00
cvar_t r_flashblend = SCVARF ( " gl_flashblend " , " 0 " ,
CVAR_ARCHIVE ) ;
2011-09-03 03:49:43 +00:00
cvar_t r_flashblendscale = SCVARF ( " gl_flashblendscale " , " 0.35 " ,
CVAR_ARCHIVE ) ;
2012-04-24 07:59:11 +00:00
cvar_t r_floorcolour = CVARAF ( " r_floorcolour " , " 64 64 128 " ,
2011-12-23 03:12:29 +00:00
" r_floorcolor " , CVAR_RENDERERCALLBACK | CVAR_SHADERSYSTEM ) ;
2015-04-14 23:12:17 +00:00
//cvar_t r_floortexture = SCVARF ("r_floortexture", "",
// CVAR_RENDERERCALLBACK|CVAR_SHADERSYSTEM);
2014-02-07 08:38:40 +00:00
cvar_t r_fullbright = CVARFD ( " r_fullbright " , " 0 " ,
CVAR_CHEAT | CVAR_SHADERSYSTEM , " Ignore world lightmaps, drawing everything fully lit. " ) ;
2011-04-25 03:25:22 +00:00
cvar_t r_fullbrightSkins = SCVARF ( " r_fullbrightSkins " , " 0.8 " , /*don't default to 1, as it looks a little ugly (too bright), but don't default to 0 either because then you're handicapped in the dark*/
2009-11-04 21:16:50 +00:00
CVAR_SEMICHEAT | CVAR_SHADERSYSTEM ) ;
2007-08-21 22:41:15 +00:00
cvar_t r_lightmap_saturation = SCVAR ( " r_lightmap_saturation " , " 1 " ) ;
2011-12-26 15:19:13 +00:00
cvar_t r_lightstylesmooth = CVARF ( " r_lightstylesmooth " , " 0 " , CVAR_ARCHIVE ) ;
2011-04-20 23:05:45 +00:00
cvar_t r_lightstylesmooth_limit = SCVAR ( " r_lightstylesmooth_limit " , " 2 " ) ;
2007-08-21 22:41:15 +00:00
cvar_t r_lightstylespeed = SCVAR ( " r_lightstylespeed " , " 10 " ) ;
2015-04-14 23:12:17 +00:00
cvar_t r_lightstylescale = SCVAR ( " r_lightstylescale " , " 1 " ) ;
2015-06-15 20:11:27 +00:00
cvar_t r_hdr_irisadaptation = CVARF ( " r_hdr_irisadaptation " , " 0 " , CVAR_ARCHIVE ) ;
cvar_t r_hdr_irisadaptation_multiplier = CVAR ( " r_hdr_irisadaptation_multiplier " , " 2 " ) ;
cvar_t r_hdr_irisadaptation_minvalue = CVAR ( " r_hdr_irisadaptation_minvalue " , " 0.5 " ) ;
cvar_t r_hdr_irisadaptation_maxvalue = CVAR ( " r_hdr_irisadaptation_maxvalue " , " 4 " ) ;
cvar_t r_hdr_irisadaptation_fade_down = CVAR ( " r_hdr_irisadaptation_fade_down " , " 0.5 " ) ;
cvar_t r_hdr_irisadaptation_fade_up = CVAR ( " r_hdr_irisadaptation_fade_up " , " 0.1 " ) ;
2012-04-24 12:22:50 +00:00
cvar_t r_loadlits = CVARF ( " r_loadlit " , " 1 " , CVAR_ARCHIVE ) ;
2007-08-21 22:41:15 +00:00
cvar_t r_menutint = SCVARF ( " r_menutint " , " 0.68 0.4 0.13 " ,
CVAR_RENDERERCALLBACK ) ;
cvar_t r_netgraph = SCVAR ( " r_netgraph " , " 0 " ) ;
2014-03-30 08:55:06 +00:00
extern cvar_t r_lerpmuzzlehack ;
2011-12-26 15:19:13 +00:00
cvar_t r_nolerp = CVARF ( " r_nolerp " , " 0 " , CVAR_ARCHIVE ) ;
2013-03-12 22:40:16 +00:00
cvar_t r_noframegrouplerp = CVARF ( " r_noframegrouplerp " , " 0 " , CVAR_ARCHIVE ) ;
2011-12-26 15:19:13 +00:00
cvar_t r_nolightdir = CVARF ( " r_nolightdir " , " 0 " , CVAR_ARCHIVE ) ;
cvar_t r_novis = CVARF ( " r_novis " , " 0 " , CVAR_ARCHIVE ) ;
2011-06-07 23:54:58 +00:00
cvar_t r_part_rain = CVARFD ( " r_part_rain " , " 0 " ,
CVAR_ARCHIVE ,
" Enable particle effects to emit off of surfaces. Mainly used for weather or lava/slime effects. " ) ;
2015-09-06 03:30:28 +00:00
cvar_t r_skyboxname = CVARFC ( " r_skybox " , " " ,
CVAR_RENDERERCALLBACK | CVAR_SHADERSYSTEM , R_SkyBox_Changed ) ;
2015-08-07 17:49:49 +00:00
cvar_t r_softwarebanding_cvar = CVARFD ( " r_softwarebanding " , " 0 " , CVAR_SHADERSYSTEM , " Utilise the Quake colormap in order to emulate 8bit software rendering. This results in banding as well as other artifacts that some believe adds character. Also forces nearest sampling on affected surfaces (palette indicies do not interpolate well). " ) ;
qboolean r_softwarebanding ;
2009-11-04 21:16:50 +00:00
cvar_t r_speeds = SCVAR ( " r_speeds " , " 0 " ) ;
2007-08-21 22:41:15 +00:00
cvar_t r_stainfadeammount = SCVAR ( " r_stainfadeammount " , " 1 " ) ;
cvar_t r_stainfadetime = SCVAR ( " r_stainfadetime " , " 1 " ) ;
2010-07-11 02:22:39 +00:00
cvar_t r_stains = CVARFC ( " r_stains " , IFMINIMAL ( " 0 " , " 0.75 " ) ,
2007-08-21 22:41:15 +00:00
CVAR_ARCHIVE ,
Cvar_Limiter_ZeroToOne_Callback ) ;
2015-07-14 14:47:00 +00:00
cvar_t r_fxaa = CVARD ( " r_fxaa " , " 0 " , " Runs a post-procesing pass to strip the jaggies. " ) ;
2015-06-15 20:11:27 +00:00
cvar_t r_postprocshader = CVARD ( " r_postprocshader " , " " , " Specifies a custom shader to use as a post-processing shader " ) ;
2012-04-24 07:59:11 +00:00
cvar_t r_wallcolour = CVARAF ( " r_wallcolour " , " 128 128 128 " ,
2011-12-23 03:12:29 +00:00
" r_wallcolor " , CVAR_RENDERERCALLBACK | CVAR_SHADERSYSTEM ) ; //FIXME: broken
2015-04-14 23:12:17 +00:00
//cvar_t r_walltexture = CVARF ("r_walltexture", "",
// CVAR_RENDERERCALLBACK|CVAR_SHADERSYSTEM); //FIXME: broken
2010-07-11 02:22:39 +00:00
cvar_t r_wateralpha = CVARF ( " r_wateralpha " , " 1 " ,
2011-12-26 15:19:13 +00:00
CVAR_ARCHIVE | CVAR_SHADERSYSTEM ) ;
2014-08-15 02:20:41 +00:00
cvar_t r_lavaalpha = CVARF ( " r_lavaalpha " , " " ,
CVAR_ARCHIVE | CVAR_SHADERSYSTEM ) ;
2014-08-25 07:35:41 +00:00
cvar_t r_slimealpha = CVARF ( " r_slimealpha " , " " ,
CVAR_ARCHIVE | CVAR_SHADERSYSTEM ) ;
cvar_t r_telealpha = CVARF ( " r_telealpha " , " " ,
CVAR_ARCHIVE | CVAR_SHADERSYSTEM ) ;
2015-06-15 20:11:27 +00:00
cvar_t r_waterwarp = CVARFD ( " r_waterwarp " , " 1 " ,
CVAR_ARCHIVE , " Enables fullscreen warp, preferably via glsl. -1 specifies to force the fov warp fallback instead which can give a smidge more performance. " ) ;
2007-08-21 22:41:15 +00:00
2014-02-07 08:38:40 +00:00
cvar_t r_replacemodels = CVARFD ( " r_replacemodels " , IFMINIMAL ( " " , " md3 md2 " ) ,
CVAR_ARCHIVE , " A list of filename extensions to attempt to use instead of mdl. " ) ;
2007-09-13 22:27:56 +00:00
2014-04-03 02:16:21 +00:00
cvar_t gl_lightmap_nearest = CVARFD ( " gl_lightmap_nearest " , " 0 " , CVAR_ARCHIVE , " Use nearest sampling for lightmaps. This will give a more blocky look. Meaningless when gl_lightmap_average is enabled. " ) ;
2014-04-02 00:58:02 +00:00
cvar_t gl_lightmap_average = CVARFD ( " gl_lightmap_average " , " 0 " , CVAR_ARCHIVE , " Determine lightmap values based upon the center of the polygon. This will give a more buggy look, quite probably. " ) ;
2007-08-21 22:41:15 +00:00
//otherwise it would defeat the point.
2010-07-11 02:22:39 +00:00
cvar_t scr_allowsnap = CVARF ( " scr_allowsnap " , " 1 " ,
2007-08-21 22:41:15 +00:00
CVAR_NOTFROMSERVER ) ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
cvar_t scr_centersbar = CVAR ( " scr_centersbar " , " 2 " ) ;
2010-07-11 02:22:39 +00:00
cvar_t scr_centertime = CVAR ( " scr_centertime " , " 2 " ) ;
2016-01-18 05:22:07 +00:00
cvar_t scr_logcenterprint = CVARD ( " con_logcenterprint " , " 1 " , " " ) ;
2010-07-11 02:22:39 +00:00
cvar_t scr_chatmodecvar = CVAR ( " scr_chatmode " , " 0 " ) ;
cvar_t scr_conalpha = CVARC ( " scr_conalpha " , " 0.7 " ,
2007-08-21 22:41:15 +00:00
Cvar_Limiter_ZeroToOne_Callback ) ;
2010-07-11 02:22:39 +00:00
cvar_t scr_consize = CVAR ( " scr_consize " , " 0.5 " ) ;
2014-03-30 08:55:06 +00:00
cvar_t scr_conspeed = CVAR ( " scr_conspeed " , " 2000 " ) ;
2007-08-21 22:41:15 +00:00
// 10 - 170
2014-09-02 02:44:43 +00:00
cvar_t scr_fov = CVARFDC ( " fov " , " 90 " ,
CVAR_ARCHIVE , " field of vision, 1-170 degrees, standard fov is 90, nquake defaults to 108. " ,
2007-08-21 22:41:15 +00:00
SCR_Fov_Callback ) ;
2015-04-14 23:12:17 +00:00
cvar_t scr_printspeed = SCVAR ( " scr_printspeed " , " 16 " ) ;
2007-08-21 22:41:15 +00:00
cvar_t scr_showpause = SCVAR ( " showpause " , " 1 " ) ;
cvar_t scr_showturtle = SCVAR ( " showturtle " , " 0 " ) ;
2009-07-18 20:26:24 +00:00
cvar_t scr_turtlefps = SCVAR ( " scr_turtlefps " , " 10 " ) ;
2007-08-21 22:41:15 +00:00
cvar_t scr_sshot_compression = SCVAR ( " scr_sshot_compression " , " 75 " ) ;
2014-04-12 03:31:59 +00:00
cvar_t scr_sshot_type = SCVAR ( " scr_sshot_type " , " png " ) ;
2016-02-10 23:23:43 +00:00
cvar_t scr_sshot_prefix = SCVAR ( " scr_sshot_prefix " , " screenshots/fte- " ) ;
2010-07-11 02:22:39 +00:00
cvar_t scr_viewsize = CVARFC ( " viewsize " , " 100 " ,
2007-08-21 22:41:15 +00:00
CVAR_ARCHIVE ,
SCR_Viewsize_Callback ) ;
2012-07-20 01:46:05 +00:00
# ifdef ANDROID
cvar_t vid_conautoscale = CVARF ( " vid_conautoscale " , " 2 " ,
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK ) ;
# else
2012-11-27 03:23:19 +00:00
cvar_t vid_conautoscale = CVARFD ( " vid_conautoscale " , " 0 " ,
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK , " Changes the 2d scale, including hud, console, and fonts. To specify an explicit font size, divide the desired 'point' size by 8 to get the scale. High values will be clamped to maintain at least a 320*200 virtual size. " ) ;
2012-07-20 01:46:05 +00:00
# endif
2010-07-11 02:22:39 +00:00
cvar_t vid_conheight = CVARF ( " vid_conheight " , " 0 " ,
2007-08-21 22:41:15 +00:00
CVAR_ARCHIVE ) ;
2010-07-11 02:22:39 +00:00
cvar_t vid_conwidth = CVARF ( " vid_conwidth " , " 0 " ,
2007-08-21 22:41:15 +00:00
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK ) ;
//see R_RestartRenderer_f for the effective default 'if (newr.renderer == -1)'.
2014-02-07 08:38:40 +00:00
cvar_t vid_renderer = CVARFD ( " vid_renderer " , " " ,
2016-07-12 00:40:13 +00:00
CVAR_ARCHIVE | CVAR_RENDERERLATCH , " Specifies which backend is used. Values that might work are: sv (dedicated server), headless (null renderer), vk (vulkan), gl (opengl), egl (opengl es), d3d9 (direct3d 9), d3d11 (direct3d 11, with default hardware rendering), d3d11 warp (direct3d 11, with software rendering). " ) ;
2007-08-21 22:41:15 +00:00
2015-06-04 06:15:14 +00:00
cvar_t vid_bpp = CVARFD ( " vid_bpp " , " 0 " ,
2014-02-07 08:38:40 +00:00
CVAR_ARCHIVE | CVAR_RENDERERLATCH , " The number of colour bits to request from the renedering context " ) ;
cvar_t vid_desktopsettings = CVARFD ( " vid_desktopsettings " , " 0 " ,
CVAR_ARCHIVE | CVAR_RENDERERLATCH , " Ignore the values of vid_width and vid_height, and just use the same settings that are used for the desktop. " ) ;
2013-03-12 23:09:25 +00:00
# ifdef NACL
cvar_t vid_fullscreen = CVARF ( " vid_fullscreen " , " 0 " ,
CVAR_ARCHIVE ) ;
2009-04-01 22:03:56 +00:00
# else
2013-03-12 23:09:25 +00:00
//these cvars will be given their names when they're registered, based upon whether -plugin was used. this means code can always use vid_fullscreen without caring, but gets saved properly.
2014-02-07 08:38:40 +00:00
cvar_t vid_fullscreen = CVARAFD ( NULL , " 1 " , " vid_fullscreen " ,
2015-06-15 20:11:27 +00:00
CVAR_ARCHIVE | CVAR_RENDERERLATCH , " Whether to use fullscreen or not. A value of 2 specifies fullscreen windowed (aka borderless window) mode. " ) ;
2014-02-07 08:38:40 +00:00
cvar_t vid_fullscreen_alternative = CVARFD ( NULL , " 1 " ,
2015-06-15 20:11:27 +00:00
CVAR_ARCHIVE , " Whether to use fullscreen or not. This cvar is saved to your config but not otherwise used in this operating mode. " ) ;
2009-04-01 22:03:56 +00:00
# endif
2014-02-07 08:38:40 +00:00
cvar_t vid_height = CVARFD ( " vid_height " , " 0 " ,
CVAR_ARCHIVE | CVAR_RENDERERLATCH , " The screen height to attempt to use, in physical pixels. 0 means use desktop resolution. " ) ;
2015-06-15 20:11:27 +00:00
cvar_t vid_multisample = CVARFD ( " vid_multisample " , " 0 " ,
CVAR_ARCHIVE | CVAR_RENDERERLATCH , " Set to 4 or so for multisample antialiasing (msaa). " ) ;
2011-06-07 23:54:58 +00:00
cvar_t vid_refreshrate = CVARF ( " vid_displayfrequency " , " 0 " ,
2007-08-21 22:41:15 +00:00
CVAR_ARCHIVE | CVAR_RENDERERLATCH ) ;
2014-11-05 05:39:24 +00:00
cvar_t vid_srgb = CVARFD ( " vid_srgb " , " 0 " ,
CVAR_ARCHIVE , " The framebuffer should use sRGB colourspace. This has the effect of brightening the screen " ) ;
2015-06-15 20:11:27 +00:00
cvar_t vid_wndalpha = CVARD ( " vid_wndalpha " , " 1 " , " When running windowed, specifies the window's transparency level. " ) ;
2007-08-21 22:41:15 +00:00
//more readable defaults to match conwidth/conheight.
2014-02-07 08:38:40 +00:00
cvar_t vid_width = CVARFD ( " vid_width " , " 0 " ,
CVAR_ARCHIVE | CVAR_RENDERERLATCH , " The screen width to attempt to use, in physical pixels. 0 means use desktop resolution. " ) ;
2016-02-10 23:23:43 +00:00
cvar_t vid_dpi_x = CVARFD ( " vid_dpi_x " , " 0 " , CVAR_NOSET , " For mods that need to determine the physical screen size (like with touchscreens). 0 means unknown " ) ;
cvar_t vid_dpi_y = CVARFD ( " vid_dpi_y " , " 0 " , CVAR_NOSET , " For mods that need to determine the physical screen size (like with touchscreens). 0 means unknown " ) ;
2005-05-18 01:40:01 +00:00
2016-02-10 23:23:43 +00:00
cvar_t r_stereo_separation = CVARD ( " r_stereo_separation " , " 4 " , " How far apart your eyes are, in quake units. A non-zero value will enable stereoscoping rendering. You might need some of them retro 3d glasses. Hardware support is recommended, see r_stereo_context. " ) ;
2016-02-15 06:01:17 +00:00
cvar_t r_stereo_convergence = CVARD ( " r_stereo_convergence " , " 0 " , " Nudges the angle of each eye inwards when using stereoscopic rendering. " ) ;
2015-12-12 19:25:15 +00:00
cvar_t r_stereo_method = CVARFD ( " r_stereo_method " , " 0 " , CVAR_ARCHIVE , " Value 0 = Off. \n Value 1 = Attempt hardware acceleration. Requires vid_restart. \n Value 2 = red/cyan. \n Value 3 = red/blue. \n Value 4=red/green. \n Value 5=eye strain. " ) ;
2012-09-30 05:52:03 +00:00
2007-08-21 22:41:15 +00:00
extern cvar_t r_dodgytgafiles ;
extern cvar_t r_dodgypcxfiles ;
2016-07-12 00:40:13 +00:00
extern cvar_t r_dodgymiptex ;
2014-01-13 02:42:25 +00:00
extern char * r_defaultimageextensions ;
extern cvar_t r_imageexensions ;
2016-07-12 00:40:13 +00:00
extern cvar_t r_image_downloadsizelimit ;
2007-08-21 22:41:15 +00:00
extern cvar_t r_drawentities ;
extern cvar_t r_drawviewmodel ;
extern cvar_t r_drawworld ;
extern cvar_t r_fullbright ;
2014-02-07 08:38:40 +00:00
cvar_t r_mirroralpha = CVARFD ( " r_mirroralpha " , " 1 " , CVAR_CHEAT | CVAR_SHADERSYSTEM , " Specifies how the default shader is generated for the 'window02_1' texture. Values less than 1 will turn it into a mirror. " ) ;
2007-08-21 22:41:15 +00:00
extern cvar_t r_netgraph ;
2016-07-12 00:40:13 +00:00
cvar_t r_norefresh = SCVAR ( " r_norefresh " , " 0 " ) ;
2007-08-21 22:41:15 +00:00
extern cvar_t r_novis ;
extern cvar_t r_speeds ;
extern cvar_t r_waterwarp ;
2016-07-15 12:26:24 +00:00
# ifndef NOLEGACY
2015-08-20 03:17:47 +00:00
# if defined(ANDROID)
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
//on android, these numbers seem to be generating major weirdness, so disable these.
2015-08-20 03:17:47 +00:00
cvar_t r_polygonoffset_submodel_factor = CVAR ( " r_polygonoffset_submodel_factor " , " 0 " ) ;
cvar_t r_polygonoffset_submodel_offset = CVAR ( " r_polygonoffset_submodel_offset " , " 0 " ) ;
# elif defined(FTE_TARGET_WEB)
//on firefox (but not chrome or ie), these numbers seem to be generating major weirdness, so tone them down significantly by default.
cvar_t r_polygonoffset_submodel_factor = CVAR ( " r_polygonoffset_submodel_factor " , " 0.05 " ) ;
cvar_t r_polygonoffset_submodel_offset = CVAR ( " r_polygonoffset_submodel_offset " , " 1 " ) ;
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
# else
2015-08-20 03:17:47 +00:00
cvar_t r_polygonoffset_submodel_factor = CVAR ( " r_polygonoffset_submodel_factor " , " 0.05 " ) ;
cvar_t r_polygonoffset_submodel_offset = CVAR ( " r_polygonoffset_submodel_offset " , " 25 " ) ;
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
# endif
2016-07-15 12:26:24 +00:00
# endif
2015-08-20 03:17:47 +00:00
cvar_t r_polygonoffset_shadowmap_offset = CVAR ( " r_polygonoffset_shadowmap_factor " , " 0.05 " ) ;
cvar_t r_polygonoffset_shadowmap_factor = CVAR ( " r_polygonoffset_shadowmap_offset " , " 0 " ) ;
2009-07-19 20:43:07 +00:00
2015-08-20 03:17:47 +00:00
cvar_t r_polygonoffset_stencil_factor = CVAR ( " r_polygonoffset_stencil_factor " , " 0.01 " ) ;
cvar_t r_polygonoffset_stencil_offset = CVAR ( " r_polygonoffset_stencil_offset " , " 1 " ) ;
2012-07-05 19:42:36 +00:00
2004-08-23 00:15:46 +00:00
rendererstate_t currentrendererstate ;
2009-11-04 21:16:50 +00:00
# if defined(GLQUAKE)
2011-12-27 08:35:19 +00:00
cvar_t gl_workaround_ati_shadersource = CVARD ( " gl_workaround_ati_shadersource " , " 1 " , " Work around ATI driver bugs in the glShaderSource function. Can safely be enabled with other drivers too. " ) ;
2014-02-07 08:38:40 +00:00
cvar_t vid_gl_context_version = CVARD ( " vid_gl_context_version " , " " , " Specifies the version of OpenGL to try to create. " ) ;
cvar_t vid_gl_context_forwardcompatible = CVARD ( " vid_gl_context_forwardcompatible " , " 0 " , " Requests an opengl context with no depricated features enabled. " ) ;
cvar_t vid_gl_context_compatibility = CVARD ( " vid_gl_context_compatibility " , " 1 " , " Requests an OpenGL context with fixed-function backwards compat. " ) ;
cvar_t vid_gl_context_debug = CVARD ( " vid_gl_context_debug " , " 0 " , " Requests a debug opengl context. This provides better error oreporting. " ) ; //for my ati drivers, debug 1 only works if version >= 3
cvar_t vid_gl_context_es = CVARD ( " vid_gl_context_es " , " 0 " , " Requests an OpenGLES context. Be sure to set vid_gl_context_version to 2 or so. " ) ; //requires version set correctly, no debug, no compat
2014-10-22 19:41:20 +00:00
cvar_t vid_gl_context_robustness = CVARD ( " vid_gl_context_robustness " , " 1 " , " Attempt to enforce extra buffer protection in the gl driver, but can be slower with pre-gl3 hardware. " ) ;
cvar_t vid_gl_context_selfreset = CVARD ( " vid_gl_context_selfreset " , " 1 " , " Upon hardware failure, have the engine create a new context instead of depending on the drivers to restore everything. This can help to avoid graphics drivers randomly killing your game, and can help reduce memory requirements. " ) ;
2009-11-04 21:16:50 +00:00
# endif
2014-03-30 08:55:06 +00:00
# if 1
2011-04-30 17:21:10 +00:00
cvar_t gl_ati_truform = CVAR ( " gl_ati_truform " , " 0 " ) ;
cvar_t gl_ati_truform_type = CVAR ( " gl_ati_truform_type " , " 1 " ) ;
cvar_t gl_ati_truform_tesselation = CVAR ( " gl_ati_truform_tesselation " , " 3 " ) ;
cvar_t gl_blend2d = CVAR ( " gl_blend2d " , " 1 " ) ;
2014-02-07 08:38:40 +00:00
cvar_t gl_blendsprites = CVARD ( " gl_blendsprites " , " 0 " , " Blend sprites instead of alpha testing them " ) ;
2015-08-07 17:49:49 +00:00
cvar_t r_deluxemapping_cvar = CVARAFD ( " r_deluxemapping " , " 0 " , " r_glsl_deluxemapping " ,
CVAR_ARCHIVE , " Enables bumpmapping based upon precomputed light directions " ) ;
qboolean r_deluxemapping ;
2014-03-30 08:55:06 +00:00
cvar_t r_shaderblobs = CVARD ( " r_shaderblobs " , " 0 " , " If enabled, can massively accelerate vid restarts / loading (especially with the d3d renderer). Can cause issues when upgrading engine versions, so this is disabled by default. " ) ;
2014-02-07 08:38:40 +00:00
cvar_t gl_compress = CVARFD ( " gl_compress " , " 0 " , CVAR_ARCHIVE , " Enable automatic texture compression even for textures which are not pre-compressed. " ) ;
cvar_t gl_conback = CVARFDC ( " gl_conback " , " " ,
CVAR_RENDERERCALLBACK , " Specifies which conback shader/image to use. The Quake fallback is gfx/conback.lmp " , R2D_Conback_Callback ) ;
//cvar_t gl_detail = CVARF ("gl_detail", "0",
// CVAR_ARCHIVE);
//cvar_t gl_detailscale = CVAR ("gl_detailscale", "5");
2012-03-19 06:30:41 +00:00
cvar_t gl_font = CVARFD ( " gl_font " , " " ,
2012-11-27 03:23:19 +00:00
CVAR_RENDERERCALLBACK , ( " Specifies the font file to use. a value such as FONT:ALTFONT specifies an alternative font to be used when ^^a is used. \n "
" When using TTF fonts, you will likely need to scale text to at least 150% - vid_conautoscale 1.5 will do this. \n "
2015-06-15 20:11:27 +00:00
" TTF fonts may be loaded from your windows directory. \' gl_font cour?col=1,1,1:couri?col=0,1,0 \' loads eg: c: \\ windows \\ fonts \\ cour.ttf, and uses the italic version of courier for alternative text, with specific colour tints. "
2012-03-19 06:30:41 +00:00
) ) ;
2011-04-30 17:21:10 +00:00
cvar_t gl_lateswap = CVAR ( " gl_lateswap " , " 0 " ) ;
2014-02-07 08:38:40 +00:00
cvar_t gl_lerpimages = CVARFD ( " gl_lerpimages " , " 1 " , CVAR_ARCHIVE , " Enables smoother resampling for images which are not power-of-two, when the drivers do not support non-power-of-two textures. " ) ;
2007-08-21 22:41:15 +00:00
//cvar_t gl_lightmapmode = SCVARF("gl_lightmapmode", "",
// CVAR_ARCHIVE);
cvar_t gl_load24bit = SCVARF ( " gl_load24bit " , " 1 " ,
CVAR_ARCHIVE ) ;
2010-11-11 18:22:49 +00:00
cvar_t r_clear = CVARAF ( " r_clear " , " 0 " ,
" gl_clear " , 0 ) ;
2014-02-07 08:38:40 +00:00
cvar_t gl_max_size = CVARFD ( " gl_max_size " , " 8192 " , CVAR_RENDERERLATCH , " Specifies the maximum texture size that the engine may use. Textures larger than this will be downsized. Clamped by the value the driver supports. " ) ;
cvar_t gl_menutint_shader = CVARD ( " gl_menutint_shader " , " 1 " , " Controls the use of GLSL to desaturate the background when drawing the menu, like quake's dos software renderer used to do before the ugly dithering of winquake. " ) ;
2007-08-21 22:41:15 +00:00
//by setting to 64 or something, you can use this as a wallhack
2016-07-12 00:40:13 +00:00
cvar_t gl_mindist = CVARAD ( " gl_mindist " , " 1 " , " r_nearclip " ,
" Distance to the near clip plane. Smaller values may damage depth precision, high values can potentialy be used to see through walls... " ) ;
2007-08-21 22:41:15 +00:00
cvar_t gl_motionblur = SCVARF ( " gl_motionblur " , " 0 " ,
CVAR_ARCHIVE ) ;
cvar_t gl_motionblurscale = SCVAR ( " gl_motionblurscale " , " 1 " ) ;
2011-05-27 17:59:31 +00:00
cvar_t gl_overbright = CVARFC ( " gl_overbright " , " 1 " ,
CVAR_ARCHIVE ,
Surf_RebuildLightmap_Callback ) ;
2007-08-21 22:41:15 +00:00
cvar_t gl_overbright_all = SCVARF ( " gl_overbright_all " , " 0 " ,
CVAR_ARCHIVE ) ;
2014-02-07 08:38:40 +00:00
cvar_t gl_picmip = CVARFD ( " gl_picmip " , " 0 " , CVAR_ARCHIVE , " Reduce world/model texture sizes by some exponential factor. " ) ;
cvar_t gl_picmip2d = CVARFD ( " gl_picmip2d " , " 0 " , CVAR_ARCHIVE , " Reduce hud/menu texture sizes by some exponential factor. " ) ;
cvar_t gl_nohwblend = CVARD ( " gl_nohwblend " , " 1 " , " If 1, don't use hardware gamma ramps for transient effects that change each frame (does not affect long-term effects like holding quad or underwater tints). " ) ;
cvar_t gl_savecompressedtex = CVARD ( " gl_savecompressedtex " , " 0 " , " Write out a copy of textures in a compressed format. The driver will do the compression on the fly, thus this setting is likely inferior to software which does not care so much about compression times. " ) ;
//cvar_t gl_schematics = CVARD ("gl_schematics", "0", "Gimmick rendering mode that draws the length of various world edges.");
cvar_t gl_skyboxdist = CVARD ( " gl_skyboxdist " , " 0 " , " The distance of the skybox. If 0, the engine will determine it based upon the far clip plane distance. " ) ; //0 = guess.
2007-08-21 22:41:15 +00:00
cvar_t gl_smoothcrosshair = SCVAR ( " gl_smoothcrosshair " , " 1 " ) ;
2015-01-02 05:20:56 +00:00
cvar_t gl_maxdist = CVARD ( " gl_maxdist " , " 0 " , " The distance of the far clip plane. If set to 0, some fancy maths will be used to place it at an infinite distance. " ) ;
2007-08-21 22:41:15 +00:00
# ifdef SPECULAR
2015-06-05 09:04:05 +00:00
cvar_t gl_specular = CVARF ( " gl_specular " , " 0.3 " , CVAR_ARCHIVE ) ;
2012-12-04 19:37:57 +00:00
cvar_t gl_specular_fallback = CVARF ( " gl_specular_fallback " , " 0.05 " , CVAR_ARCHIVE | CVAR_RENDERERLATCH ) ;
2014-10-05 20:04:11 +00:00
cvar_t gl_specular_fallbackexp = CVARF ( " gl_specular_fallbackexp " , " 1 " , CVAR_ARCHIVE | CVAR_RENDERERLATCH ) ;
2007-08-21 22:41:15 +00:00
# endif
2007-08-22 22:41:41 +00:00
// The callbacks are not in D3D yet (also ugly way of seperating this)
2010-07-11 02:22:39 +00:00
cvar_t gl_texture_anisotropic_filtering = CVARFC ( " gl_texture_anisotropic_filtering " , " 0 " ,
2007-08-21 22:41:15 +00:00
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK ,
2014-10-05 20:04:11 +00:00
Image_TextureMode_Callback ) ;
2015-04-14 23:12:17 +00:00
cvar_t gl_texturemode = CVARFDC ( " gl_texturemode " , " GL_LINEAR_MIPMAP_LINEAR " ,
2014-08-15 02:20:41 +00:00
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK | CVAR_SAVE ,
2014-10-05 20:04:11 +00:00
" Specifies how world/model textures appear. Typically 3 letters eg lln. \n First letter can be l(inear) or n(earest) and says how to sample from the mip (when downsampling). \n The middle letter can . to disable mipmaps, or l or n to describe whether to blend between mipmaps. \n The third letter says what to do when the texture is too low resolution and is thus the most noticable with low resolution textures, a n will make it look like lego, while an l will keep it smooth. " , Image_TextureMode_Callback ) ;
2015-04-14 23:12:17 +00:00
cvar_t gl_mipcap = CVARAFC ( " d_mipcap " , " 0 1000 " , " gl_miptexLevel " ,
2012-01-01 02:26:42 +00:00
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK ,
2014-10-05 20:04:11 +00:00
Image_TextureMode_Callback ) ;
cvar_t gl_texturemode2d = CVARFDC ( " gl_texturemode2d " , " GL_LINEAR " ,
2007-08-21 22:41:15 +00:00
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK ,
2014-10-05 20:04:11 +00:00
" Specifies how 2d images are sampled. format is a 3-tupple " , Image_TextureMode_Callback ) ;
2004-09-13 03:10:50 +00:00
2014-02-07 08:38:40 +00:00
cvar_t vid_triplebuffer = CVARAFD ( " vid_triplebuffer " , " 1 " , " gl_triplebuffer " , CVAR_ARCHIVE , " Specifies whether the hardware is forcing tripplebuffering on us, this is the number of extra page swaps required before old data has been completely overwritten. " ) ;
2007-08-21 22:41:15 +00:00
2013-12-29 22:48:28 +00:00
cvar_t r_portalrecursion = CVARD ( " r_portalrecursion " , " 1 " , " The number of portals the camera is allowed to recurse through. " ) ;
2014-02-14 09:59:32 +00:00
cvar_t r_portaldrawplanes = CVARD ( " r_portaldrawplanes " , " 0 " , " Draw front and back planes in portals. Debug feature. " ) ;
cvar_t r_portalonly = CVARD ( " r_portalonly " , " 0 " , " Don't draw things which are not portals. Debug feature. " ) ;
2011-10-27 15:46:36 +00:00
cvar_t dpcompat_psa_ungroup = SCVAR ( " dpcompat_psa_ungroup " , " 0 " ) ;
2014-02-07 08:38:40 +00:00
cvar_t r_noaliasshadows = SCVARF ( " r_noaliasshadows " , " 0 " , CVAR_ARCHIVE ) ;
cvar_t r_shadows = CVARFD ( " r_shadows " , " 0 " , CVAR_ARCHIVE , " Draw basic blob shadows underneath entities without using realtime lighting. " ) ;
2012-02-12 05:18:31 +00:00
cvar_t r_showbboxes = CVARD ( " r_showbboxes " , " 0 " , " Debugging. Shows bounding boxes. 1=ssqc, 2=csqc. Red=solid, Green=stepping/toss/bounce, Blue=onground. " ) ;
2015-06-22 11:49:15 +00:00
cvar_t r_showfields = CVARD ( " r_showfields " , " 0 " , " Debugging. Shows entity fields boxes (entity closest to crosshair). 1=ssqc, 2=csqc. " ) ;
2011-09-03 03:49:43 +00:00
cvar_t r_lightprepass = CVARFD ( " r_lightprepass " , " 0 " , CVAR_SHADERSYSTEM , " Experimental. Attempt to use a different lighting mechanism. " ) ;
2009-11-04 21:16:50 +00:00
2013-12-08 20:06:55 +00:00
cvar_t r_shadow_bumpscale_basetexture = CVARD ( " r_shadow_bumpscale_basetexture " , " 0 " , " bumpyness scaler for generation of fallback normalmap textures from models " ) ;
cvar_t r_shadow_bumpscale_bumpmap = CVARD ( " r_shadow_bumpscale_bumpmap " , " 4 " , " bumpyness scaler for _bump textures " ) ;
2009-11-04 21:16:50 +00:00
2015-02-02 08:01:53 +00:00
cvar_t r_shadow_heightscale_basetexture = CVARD ( " r_shadow_heightscale_basetexture " , " 0 " , " scaler for generation of height maps from legacy paletted content. " ) ;
cvar_t r_shadow_heightscale_bumpmap = CVARD ( " r_shadow_heightscale_bumpmap " , " 1 " , " height scaler for 8bit _bump textures " ) ;
2014-02-07 08:38:40 +00:00
cvar_t r_glsl_offsetmapping = CVARFD ( " r_glsl_offsetmapping " , " 0 " , CVAR_ARCHIVE | CVAR_SHADERSYSTEM , " Enables the use of paralax mapping, adding fake depth to textures. " ) ;
2011-12-26 15:19:13 +00:00
cvar_t r_glsl_offsetmapping_scale = CVAR ( " r_glsl_offsetmapping_scale " , " 0.04 " ) ;
2016-02-10 23:23:43 +00:00
cvar_t r_glsl_offsetmapping_reliefmapping = CVARFD ( " r_glsl_offsetmapping_reliefmapping " , " 0 " , CVAR_ARCHIVE | CVAR_SHADERSYSTEM , " Changes the paralax sampling mode to be a bit nicer, but noticably more expensive at high resolutions. r_glsl_offsetmapping must be set. " ) ;
2014-02-07 14:57:07 +00:00
cvar_t r_glsl_turbscale = CVARFD ( " r_glsl_turbscale " , " 1 " , CVAR_ARCHIVE , " Controls the strength of water ripples (used by the altwater glsl code). " ) ;
2009-11-04 21:16:50 +00:00
2014-10-23 01:42:05 +00:00
cvar_t r_fastturbcolour = CVARFD ( " r_fastturbcolour " , " 0.1 0.2 0.3 " , CVAR_ARCHIVE , " The colour to use for water surfaces draw with r_waterstyle 0. \n " ) ;
2013-07-13 12:14:32 +00:00
cvar_t r_waterstyle = CVARFD ( " r_waterstyle " , " 1 " , CVAR_ARCHIVE | CVAR_SHADERSYSTEM , " Changes how water, and teleporters are drawn. Possible values are: \n 0: fastturb-style block colour. \n 1: regular q1-style water. \n 2: refraction(ripply and transparent) \n 3: refraction with reflection at an angle \n 4: ripplemapped without reflections (requires particle effects) \n 5: ripples+reflections " ) ;
cvar_t r_slimestyle = CVARFD ( " r_slimestyle " , " " , CVAR_ARCHIVE | CVAR_SHADERSYSTEM , " See r_waterstyle, but affects only slime. If empty, defers to r_waterstyle. " ) ;
cvar_t r_lavastyle = CVARFD ( " r_lavastyle " , " 1 " , CVAR_ARCHIVE | CVAR_SHADERSYSTEM , " See r_waterstyle, but affects only lava. If empty, defers to r_waterstyle. " ) ;
2015-10-11 11:34:58 +00:00
cvar_t r_telestyle = CVARFD ( " r_telestyle " , " 1 " , CVAR_ARCHIVE | CVAR_SHADERSYSTEM , " See r_waterstyle, but affects only teleporters. If empty, defers to r_waterstyle. " ) ;
2009-11-04 21:16:50 +00:00
2014-02-07 08:38:40 +00:00
cvar_t r_vertexdlights = CVARD ( " r_vertexdlights " , " 0 " , " Determine model lighting with respect to nearby dlights. Poor-man's rtlights. " ) ;
2007-08-21 22:41:15 +00:00
2014-02-07 08:38:40 +00:00
cvar_t vid_preservegamma = CVARD ( " vid_preservegamma " , " 0 " , " Restore initial hardware gamma ramps when quitting. " ) ;
2013-05-11 14:02:55 +00:00
cvar_t vid_hardwaregamma = CVARFD ( " vid_hardwaregamma " , " 1 " ,
CVAR_ARCHIVE | CVAR_RENDERERLATCH , " Use hardware gamma ramps. 0=loadtime-gamma, 1=glsl(windowed) or hardware(fullscreen), 2=always glsl, 3=always hardware gamma. " ) ;
2012-11-27 03:23:19 +00:00
cvar_t vid_desktopgamma = CVARFD ( " vid_desktopgamma " , " 0 " ,
CVAR_ARCHIVE | CVAR_RENDERERLATCH , " Apply gamma ramps upon the desktop rather than the window. " ) ;
2007-08-21 22:41:15 +00:00
2014-03-30 08:55:06 +00:00
cvar_t r_fog_exp2 = CVARD ( " r_fog_exp2 " , " 1 " , " Expresses how fog fades with distance. 0 (matching DarkPlaces's default) is typically more realistic, while 1 (matching FitzQuake and others) is more common. " ) ;
2012-04-09 19:12:12 +00:00
2016-07-12 00:40:13 +00:00
# ifdef VKQUAKE
cvar_t vk_submissionthread = CVARD ( " vk_submissionthread " , " 0 " , " Execute submits+presents on a thread dedicated to executing them. This may be a significant speedup on certain drivers. " ) ;
cvar_t vk_debug = CVARD ( " vk_debug " , " 0 " , " Register a debug handler to display driver/layer messages. 2 enables the standard validation layers. " ) ;
# endif
2007-08-21 22:41:15 +00:00
extern cvar_t gl_dither ;
2011-02-25 04:22:14 +00:00
cvar_t gl_screenangle = SCVAR ( " gl_screenangle " , " 0 " ) ;
2007-08-21 22:41:15 +00:00
# endif
2005-10-06 02:32:24 +00:00
2016-07-12 00:40:13 +00:00
# if defined(D3DQUAKE)
2007-05-25 22:16:29 +00:00
void GLD3DRenderer_Init ( void )
{
}
# endif
2009-11-04 21:16:50 +00:00
# if defined(GLQUAKE)
2004-08-23 00:15:46 +00:00
void GLRenderer_Init ( void )
{
2009-11-04 21:16:50 +00:00
//gl-specific video vars
2011-12-27 08:35:19 +00:00
Cvar_Register ( & gl_workaround_ati_shadersource , GLRENDEREROPTIONS ) ;
2009-11-04 21:16:50 +00:00
Cvar_Register ( & vid_gl_context_version , GLRENDEREROPTIONS ) ;
Cvar_Register ( & vid_gl_context_debug , GLRENDEREROPTIONS ) ;
Cvar_Register ( & vid_gl_context_forwardcompatible , GLRENDEREROPTIONS ) ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
Cvar_Register ( & vid_gl_context_compatibility , GLRENDEREROPTIONS ) ;
2014-02-07 08:38:40 +00:00
Cvar_Register ( & vid_gl_context_es , GLRENDEREROPTIONS ) ;
2014-10-22 19:41:20 +00:00
Cvar_Register ( & vid_gl_context_robustness , GLRENDEREROPTIONS ) ;
Cvar_Register ( & vid_gl_context_selfreset , GLRENDEREROPTIONS ) ;
2009-11-04 21:16:50 +00:00
2004-08-23 00:15:46 +00:00
//renderer
Cvar_Register ( & gl_affinemodels , GLRENDEREROPTIONS ) ;
2008-07-16 00:19:33 +00:00
Cvar_Register ( & gl_nohwblend , GLRENDEREROPTIONS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & gl_nocolors , GLRENDEREROPTIONS ) ;
Cvar_Register ( & gl_finish , GLRENDEREROPTIONS ) ;
2004-11-18 17:55:04 +00:00
Cvar_Register ( & gl_lateswap , GLRENDEREROPTIONS ) ;
2005-01-28 04:24:40 +00:00
Cvar_Register ( & gl_lerpimages , GLRENDEREROPTIONS ) ;
2012-05-09 15:30:53 +00:00
Cvar_Register ( & r_postprocshader , GLRENDEREROPTIONS ) ;
2015-07-14 14:47:00 +00:00
Cvar_Register ( & r_fxaa , GLRENDEREROPTIONS ) ;
Cvar_Register ( & r_renderscale , GLRENDEREROPTIONS ) ;
2004-08-23 00:15:46 +00:00
2011-10-27 15:46:36 +00:00
Cvar_Register ( & dpcompat_psa_ungroup , GLRENDEREROPTIONS ) ;
2013-11-21 23:02:28 +00:00
Cvar_Register ( & r_lerpmuzzlehack , GLRENDEREROPTIONS ) ;
2013-03-12 22:40:16 +00:00
Cvar_Register ( & r_noframegrouplerp , GLRENDEREROPTIONS ) ;
2013-12-29 22:48:28 +00:00
Cvar_Register ( & r_portalrecursion , GLRENDEREROPTIONS ) ;
2014-02-14 09:59:32 +00:00
Cvar_Register ( & r_portaldrawplanes , GLRENDEREROPTIONS ) ;
Cvar_Register ( & r_portalonly , GLRENDEREROPTIONS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & r_noaliasshadows , GLRENDEREROPTIONS ) ;
2005-05-27 08:24:31 +00:00
Cvar_Register ( & gl_motionblur , GLRENDEREROPTIONS ) ;
2005-06-04 04:20:20 +00:00
Cvar_Register ( & gl_motionblurscale , GLRENDEREROPTIONS ) ;
2004-08-23 00:15:46 +00:00
2006-04-15 07:10:49 +00:00
Cvar_Register ( & gl_smoothcrosshair , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
2015-08-07 17:49:49 +00:00
Cvar_Register ( & r_deluxemapping_cvar , GRAPHICALNICETIES ) ;
2005-08-03 23:14:59 +00:00
2004-08-23 00:15:46 +00:00
# ifdef R_XFLIP
Cvar_Register ( & r_xflip , GLRENDEREROPTIONS ) ;
# endif
2006-02-26 05:49:15 +00:00
// Cvar_Register (&gl_lightmapmode, GLRENDEREROPTIONS);
2004-08-23 00:15:46 +00:00
Cvar_Register ( & gl_picmip , GLRENDEREROPTIONS ) ;
2004-11-13 17:29:47 +00:00
Cvar_Register ( & gl_picmip2d , GLRENDEREROPTIONS ) ;
2004-08-23 00:15:46 +00:00
2014-03-30 08:55:06 +00:00
Cvar_Register ( & r_shaderblobs , GLRENDEREROPTIONS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & gl_savecompressedtex , GLRENDEREROPTIONS ) ;
Cvar_Register ( & gl_compress , GLRENDEREROPTIONS ) ;
2014-02-07 08:38:40 +00:00
// Cvar_Register (&gl_detail, GRAPHICALNICETIES);
// Cvar_Register (&gl_detailscale, GRAPHICALNICETIES);
2005-05-13 10:42:48 +00:00
Cvar_Register ( & gl_overbright , GRAPHICALNICETIES ) ;
2006-04-16 06:03:58 +00:00
Cvar_Register ( & gl_overbright_all , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & gl_dither , GRAPHICALNICETIES ) ;
2012-04-09 19:12:12 +00:00
Cvar_Register ( & r_fog_exp2 , GLRENDEREROPTIONS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & gl_ati_truform , GRAPHICALNICETIES ) ;
Cvar_Register ( & gl_ati_truform_type , GRAPHICALNICETIES ) ;
Cvar_Register ( & gl_ati_truform_tesselation , GRAPHICALNICETIES ) ;
2004-10-10 06:32:29 +00:00
2011-02-25 04:22:14 +00:00
Cvar_Register ( & gl_screenangle , GLRENDEREROPTIONS ) ;
2004-10-10 06:32:29 +00:00
Cvar_Register ( & gl_skyboxdist , GLRENDEREROPTIONS ) ;
2004-10-26 15:31:39 +00:00
2004-12-11 03:41:12 +00:00
Cvar_Register ( & r_wallcolour , GLRENDEREROPTIONS ) ;
Cvar_Register ( & r_floorcolour , GLRENDEREROPTIONS ) ;
2015-04-14 23:12:17 +00:00
// Cvar_Register (&r_walltexture, GLRENDEREROPTIONS);
// Cvar_Register (&r_floortexture, GLRENDEREROPTIONS);
2006-05-08 04:30:04 +00:00
2004-12-11 03:41:12 +00:00
Cvar_Register ( & r_vertexdlights , GLRENDEREROPTIONS ) ;
2014-02-07 08:38:40 +00:00
// Cvar_Register (&gl_schematics, GLRENDEREROPTIONS);
2009-11-04 21:16:50 +00:00
2004-10-26 15:31:39 +00:00
Cvar_Register ( & r_vertexlight , GLRENDEREROPTIONS ) ;
2005-08-06 07:18:29 +00:00
Cvar_Register ( & gl_blend2d , GLRENDEREROPTIONS ) ;
2009-11-04 21:16:50 +00:00
2006-03-14 09:20:07 +00:00
Cvar_Register ( & gl_menutint_shader , GLRENDEREROPTIONS ) ;
2014-04-02 00:58:02 +00:00
Cvar_Register ( & gl_lightmap_nearest , GLRENDEREROPTIONS ) ;
Cvar_Register ( & gl_lightmap_average , GLRENDEREROPTIONS ) ;
2006-03-03 03:31:19 +00:00
R_BloomRegister ( ) ;
2004-08-23 00:15:46 +00:00
}
2009-11-04 21:16:50 +00:00
# endif
2004-08-23 00:15:46 +00:00
void R_InitTextures ( void )
{
int x , y , m ;
qbyte * dest ;
2015-03-03 00:14:43 +00:00
static char r_notexture_mip_mem [ ( sizeof ( texture_t ) + 16 * 16 ) ] ;
2005-06-15 04:44:39 +00:00
2004-08-23 00:15:46 +00:00
// create a simple checkerboard texture for the default
2012-07-05 19:42:36 +00:00
r_notexture_mip = ( texture_t * ) r_notexture_mip_mem ;
2005-06-15 04:44:39 +00:00
2004-08-23 00:15:46 +00:00
r_notexture_mip - > width = r_notexture_mip - > height = 16 ;
2005-06-15 04:44:39 +00:00
2015-03-03 00:14:43 +00:00
for ( m = 0 ; m < 1 ; m + + )
2004-08-23 00:15:46 +00:00
{
2015-03-03 00:14:43 +00:00
dest = ( qbyte * ) ( r_notexture_mip + 1 ) ;
2004-08-23 00:15:46 +00:00
for ( y = 0 ; y < ( 16 > > m ) ; y + + )
for ( x = 0 ; x < ( 16 > > m ) ; x + + )
{
if ( ( y < ( 8 > > m ) ) ^ ( x < ( 8 > > m ) ) )
* dest + + = 0 ;
else
* dest + + = 0xff ;
}
2005-06-15 04:44:39 +00:00
}
2004-08-23 00:15:46 +00:00
}
2015-07-03 02:07:41 +00:00
static int QDECL ShowFileList ( const char * name , qofs_t flags , time_t mtime , void * parm , searchpathfuncs_t * spath )
{
//ignore non-diffuse texture filenames, because they're annoying as heck.
if ( ! strstr ( name , " _pants. " ) & & ! strstr ( name , " _shirt. " ) & & ! strstr ( name , " _upper. " ) & & ! strstr ( name , " _lower. " ) & & ! strstr ( name , " _bump. " ) & & ! strstr ( name , " _norm. " ) & & ! strstr ( name , " _gloss. " ) & & ! strstr ( name , " _luma. " ) )
{
Con_Printf ( " %s \n " , name ) ;
}
return true ;
}
void R_ListConfigs_f ( void )
{
COM_EnumerateFiles ( " *.cfg " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " configs/*.cfg " , ShowFileList , NULL ) ;
}
void R_ListFonts_f ( void )
{
COM_EnumerateFiles ( " charsets/*.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " textures/charsets/*.* " , ShowFileList , NULL ) ;
}
void R_ListSkins_f ( void )
{
COM_EnumerateFiles ( " skins/*.* " , ShowFileList , NULL ) ;
}
void R_ListSkyBoxes_f ( void )
{
//FIXME: this demonstrates why we need a nicer result printer.
COM_EnumerateFiles ( " env/*rt.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " env/*px.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " env/*posx.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " gfx/env/*rt.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " gfx/env/*px.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " gfx/env/*posx.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " textures/env/*rt.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " textures/env/*px.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " textures/env/*posx.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " textures/gfx/env/*rt.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " textures/gfx/env/*px.* " , ShowFileList , NULL ) ;
COM_EnumerateFiles ( " textures/gfx/env/*posx.* " , ShowFileList , NULL ) ;
}
2004-08-23 00:15:46 +00:00
void R_SetRenderer_f ( void ) ;
2013-08-06 02:19:06 +00:00
void R_ReloadRenderer_f ( void ) ;
2004-08-23 00:15:46 +00:00
void Renderer_Init ( void )
{
2010-11-11 23:54:36 +00:00
# ifdef AVAIL_JPEGLIB
LibJPEG_Init ( ) ;
# endif
# ifdef AVAIL_PNGLIB
LibPNG_Init ( ) ;
# endif
2010-11-11 04:03:16 +00:00
2010-02-06 01:25:04 +00:00
currentrendererstate . renderer = NULL ;
qrenderer = QR_NONE ;
2004-08-23 00:15:46 +00:00
2011-06-17 01:54:54 +00:00
r_blockvidrestart = true ;
2004-08-23 00:15:46 +00:00
Cmd_AddCommand ( " setrenderer " , R_SetRenderer_f ) ;
Cmd_AddCommand ( " vid_restart " , R_RestartRenderer_f ) ;
2013-08-06 02:19:06 +00:00
Cmd_AddCommand ( " vid_reload " , R_ReloadRenderer_f ) ;
2004-08-23 00:15:46 +00:00
2012-01-01 02:26:42 +00:00
# ifdef RTLIGHTS
Cmd_AddCommand ( " r_editlights_reload " , R_ReloadRTLights_f ) ;
Cmd_AddCommand ( " r_editlights_save " , R_SaveRTLights_f ) ;
2012-12-04 19:37:57 +00:00
Cvar_Register ( & r_editlights_import_radius , " Realtime Light editing/importing " ) ;
Cvar_Register ( & r_editlights_import_ambient , " Realtime Light editing/importing " ) ;
Cvar_Register ( & r_editlights_import_diffuse , " Realtime Light editing/importing " ) ;
Cvar_Register ( & r_editlights_import_specular , " Realtime Light editing/importing " ) ;
2012-01-01 02:26:42 +00:00
# endif
2011-09-03 03:49:43 +00:00
Cmd_AddCommand ( " r_dumpshaders " , Shader_WriteOutGenerics_f ) ;
2014-02-13 23:54:57 +00:00
Cmd_AddCommand ( " r_remapshader " , Shader_RemapShader_f ) ;
2014-10-25 02:16:35 +00:00
Cmd_AddCommand ( " r_showshader " , Shader_ShowShader_f ) ;
2011-09-03 03:49:43 +00:00
2016-07-12 00:40:13 +00:00
# if defined(D3DQUAKE)
2007-05-25 22:16:29 +00:00
GLD3DRenderer_Init ( ) ;
# endif
2009-11-04 21:16:50 +00:00
# if defined(GLQUAKE)
2004-08-23 00:15:46 +00:00
GLRenderer_Init ( ) ;
# endif
2012-05-09 15:30:53 +00:00
# ifdef SWQUAKE
{
extern cvar_t sw_interlace ;
2012-09-30 05:52:03 +00:00
extern cvar_t sw_vthread ;
extern cvar_t sw_fthreads ;
2012-05-09 15:30:53 +00:00
Cvar_Register ( & sw_interlace , " Software Rendering Options " ) ;
2012-09-30 05:52:03 +00:00
Cvar_Register ( & sw_vthread , " Software Rendering Options " ) ;
Cvar_Register ( & sw_fthreads , " Software Rendering Options " ) ;
2012-05-09 15:30:53 +00:00
}
# endif
2009-11-04 21:16:50 +00:00
Cvar_Register ( & gl_conback , GRAPHICALNICETIES ) ;
2007-05-25 22:16:29 +00:00
Cvar_Register ( & r_novis , GLRENDEREROPTIONS ) ;
2004-08-23 00:15:46 +00:00
//but register ALL vid_ commands.
2012-05-09 15:30:53 +00:00
Cvar_Register ( & gl_driver , GLRENDEREROPTIONS ) ;
2014-02-07 08:38:40 +00:00
Cvar_Register ( & vid_vsync , VIDCOMMANDGROUP ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & _windowed_mouse , VIDCOMMANDGROUP ) ;
Cvar_Register ( & vid_renderer , VIDCOMMANDGROUP ) ;
2009-04-06 00:34:32 +00:00
Cvar_Register ( & vid_wndalpha , VIDCOMMANDGROUP ) ;
2004-08-23 00:15:46 +00:00
2013-03-12 23:09:25 +00:00
# ifndef NACL
if ( COM_CheckParm ( " -plugin " ) )
{
vid_fullscreen . name = " vid_fullscreen_embedded " ;
vid_fullscreen_alternative . name = " vid_fullscreen_standalone " ;
}
else
{
vid_fullscreen . name = " vid_fullscreen_standalone " ;
vid_fullscreen_alternative . name = " vid_fullscreen_embedded " ;
}
Cvar_Register ( & vid_fullscreen_alternative , VIDCOMMANDGROUP ) ;
2009-04-01 22:03:56 +00:00
# endif
2004-08-23 00:15:46 +00:00
Cvar_Register ( & vid_fullscreen , VIDCOMMANDGROUP ) ;
Cvar_Register ( & vid_bpp , VIDCOMMANDGROUP ) ;
2006-04-02 07:14:25 +00:00
Cvar_Register ( & vid_conwidth , VIDCOMMANDGROUP ) ;
Cvar_Register ( & vid_conheight , VIDCOMMANDGROUP ) ;
Cvar_Register ( & vid_conautoscale , VIDCOMMANDGROUP ) ;
2011-06-17 01:54:54 +00:00
Cvar_Register ( & vid_triplebuffer , VIDCOMMANDGROUP ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & vid_width , VIDCOMMANDGROUP ) ;
Cvar_Register ( & vid_height , VIDCOMMANDGROUP ) ;
Cvar_Register ( & vid_refreshrate , VIDCOMMANDGROUP ) ;
2012-12-04 19:37:57 +00:00
Cvar_Register ( & vid_multisample , GLRENDEREROPTIONS ) ;
2014-03-30 08:55:06 +00:00
Cvar_Register ( & vid_srgb , GLRENDEREROPTIONS ) ;
2016-02-10 23:23:43 +00:00
Cvar_Register ( & vid_dpi_x , GLRENDEREROPTIONS ) ;
Cvar_Register ( & vid_dpi_y , GLRENDEREROPTIONS ) ;
2004-08-23 00:15:46 +00:00
2006-04-15 03:31:23 +00:00
Cvar_Register ( & vid_desktopsettings , VIDCOMMANDGROUP ) ;
2016-07-12 00:40:13 +00:00
Cvar_Register ( & vid_preservegamma , GLRENDEREROPTIONS ) ;
Cvar_Register ( & vid_hardwaregamma , GLRENDEREROPTIONS ) ;
Cvar_Register ( & vid_desktopgamma , GLRENDEREROPTIONS ) ;
2006-04-15 03:31:23 +00:00
2016-07-12 00:40:13 +00:00
Cvar_Register ( & r_norefresh , GLRENDEREROPTIONS ) ;
2011-03-31 02:32:32 +00:00
Cvar_Register ( & r_mirroralpha , GLRENDEREROPTIONS ) ;
2006-04-15 05:28:44 +00:00
Cvar_Register ( & r_skyboxname , GRAPHICALNICETIES ) ;
2010-08-14 03:17:33 +00:00
Cbuf_AddText ( " alias sky r_skybox \n " , RESTRICT_LOCAL ) ; /*alternative name for users*/
2015-08-07 17:49:49 +00:00
Cvar_Register ( & r_softwarebanding_cvar , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
Cvar_Register ( & r_dodgytgafiles , " Hacky bug workarounds " ) ;
Cvar_Register ( & r_dodgypcxfiles , " Hacky bug workarounds " ) ;
Cvar_Register ( & r_dodgymiptex , " Hacky bug workarounds " ) ;
2014-01-13 02:42:25 +00:00
r_imageexensions . enginevalue = r_defaultimageextensions ;
Cvar_Register ( & r_imageexensions , GRAPHICALNICETIES ) ;
r_imageexensions . callback ( & r_imageexensions , NULL ) ;
2016-07-12 00:40:13 +00:00
Cvar_Register ( & r_image_downloadsizelimit , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & r_loadlits , GRAPHICALNICETIES ) ;
2005-06-22 17:10:13 +00:00
Cvar_Register ( & r_lightstylesmooth , GRAPHICALNICETIES ) ;
2011-04-20 23:05:45 +00:00
Cvar_Register ( & r_lightstylesmooth_limit , GRAPHICALNICETIES ) ;
2005-06-22 17:10:13 +00:00
Cvar_Register ( & r_lightstylespeed , GRAPHICALNICETIES ) ;
2015-04-14 23:12:17 +00:00
Cvar_Register ( & r_lightstylescale , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
2015-04-27 12:51:42 +00:00
Cvar_Register ( & r_hdr_irisadaptation , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_hdr_irisadaptation_multiplier , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_hdr_irisadaptation_minvalue , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_hdr_irisadaptation_maxvalue , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_hdr_irisadaptation_fade_down , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_hdr_irisadaptation_fade_up , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & r_stains , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_stainfadetime , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_stainfadeammount , GRAPHICALNICETIES ) ;
2012-01-01 02:26:42 +00:00
Cvar_Register ( & r_lightprepass , GLRENDEREROPTIONS ) ;
Cvar_Register ( & r_coronas , GRAPHICALNICETIES ) ;
2015-09-10 10:16:26 +00:00
Cvar_Register ( & r_coronas_occlusion , GRAPHICALNICETIES ) ;
2016-07-12 00:40:13 +00:00
Cvar_Register ( & r_coronas_mindist , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_coronas_fadedist , GRAPHICALNICETIES ) ;
2012-01-01 02:26:42 +00:00
Cvar_Register ( & r_flashblend , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_flashblendscale , GRAPHICALNICETIES ) ;
2013-11-21 23:02:28 +00:00
Cvar_Register ( & gl_specular , GRAPHICALNICETIES ) ;
Cvar_Register ( & gl_specular_fallback , GRAPHICALNICETIES ) ;
2014-10-05 20:04:11 +00:00
Cvar_Register ( & gl_specular_fallbackexp , GRAPHICALNICETIES ) ;
2012-01-01 02:26:42 +00:00
2013-10-08 14:28:11 +00:00
Sh_RegisterCvars ( ) ;
2014-10-23 01:42:05 +00:00
Cvar_Register ( & r_fastturbcolour , GRAPHICALNICETIES ) ;
2012-05-14 01:41:08 +00:00
Cvar_Register ( & r_waterstyle , GRAPHICALNICETIES ) ;
2012-11-27 03:23:19 +00:00
Cvar_Register ( & r_lavastyle , GRAPHICALNICETIES ) ;
2014-08-25 07:35:41 +00:00
Cvar_Register ( & r_slimestyle , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_telestyle , GRAPHICALNICETIES ) ;
2012-08-04 01:35:52 +00:00
Cvar_Register ( & r_wireframe , GRAPHICALNICETIES ) ;
2014-09-02 02:44:43 +00:00
Cvar_Register ( & r_wireframe_smooth , GRAPHICALNICETIES ) ;
2013-10-29 17:38:22 +00:00
Cvar_Register ( & r_refract_fbo , GRAPHICALNICETIES ) ;
2012-09-30 05:52:03 +00:00
Cvar_Register ( & r_stereo_separation , GRAPHICALNICETIES ) ;
2016-02-15 06:01:17 +00:00
Cvar_Register ( & r_stereo_convergence , GRAPHICALNICETIES ) ;
2012-09-30 05:52:03 +00:00
Cvar_Register ( & r_stereo_method , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
Cvar_Register ( & r_shadow_bumpscale_basetexture , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_shadow_bumpscale_bumpmap , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_shadow_heightscale_basetexture , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_shadow_heightscale_bumpmap , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_glsl_offsetmapping , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_glsl_offsetmapping_scale , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_glsl_offsetmapping_reliefmapping , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_glsl_turbscale , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & scr_viewsize , SCREENOPTIONS ) ;
Cvar_Register ( & scr_fov , SCREENOPTIONS ) ;
2013-06-23 02:17:02 +00:00
// Cvar_Register(&scr_chatmodecvar, SCREENOPTIONS);
2004-08-23 00:15:46 +00:00
Cvar_Register ( & scr_sshot_type , SCREENOPTIONS ) ;
2006-06-17 04:18:52 +00:00
Cvar_Register ( & scr_sshot_compression , SCREENOPTIONS ) ;
2014-04-12 03:31:59 +00:00
Cvar_Register ( & scr_sshot_prefix , SCREENOPTIONS ) ;
2004-08-23 00:15:46 +00:00
2006-01-14 23:47:09 +00:00
Cvar_Register ( & cl_cursor , SCREENOPTIONS ) ;
2014-09-02 02:44:43 +00:00
Cvar_Register ( & cl_cursorscale , SCREENOPTIONS ) ;
Cvar_Register ( & cl_cursorbiasx , SCREENOPTIONS ) ;
Cvar_Register ( & cl_cursorbiasy , SCREENOPTIONS ) ;
2006-01-14 23:47:09 +00:00
2004-08-23 00:15:46 +00:00
//screen
2010-05-01 22:47:47 +00:00
Cvar_Register ( & gl_font , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & scr_conspeed , SCREENOPTIONS ) ;
2006-02-25 21:03:56 +00:00
Cvar_Register ( & scr_conalpha , SCREENOPTIONS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & scr_showturtle , SCREENOPTIONS ) ;
2009-07-18 20:26:24 +00:00
Cvar_Register ( & scr_turtlefps , SCREENOPTIONS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & scr_showpause , SCREENOPTIONS ) ;
Cvar_Register ( & scr_centertime , SCREENOPTIONS ) ;
2016-01-18 05:22:07 +00:00
Cvar_Register ( & scr_logcenterprint , SCREENOPTIONS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & scr_printspeed , SCREENOPTIONS ) ;
Cvar_Register ( & scr_allowsnap , SCREENOPTIONS ) ;
2005-06-14 04:52:10 +00:00
Cvar_Register ( & scr_consize , SCREENOPTIONS ) ;
2005-12-06 02:23:46 +00:00
Cvar_Register ( & scr_centersbar , SCREENOPTIONS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & r_bloodstains , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_fullbrightSkins , GRAPHICALNICETIES ) ;
2005-09-08 02:02:31 +00:00
Cvar_Register ( & mod_md3flags , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
//renderer
Cvar_Register ( & r_fullbright , SCREENOPTIONS ) ;
Cvar_Register ( & r_drawentities , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_drawviewmodel , GRAPHICALNICETIES ) ;
2006-01-09 01:49:06 +00:00
Cvar_Register ( & r_drawviewmodelinvis , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & r_waterwarp , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_speeds , SCREENOPTIONS ) ;
Cvar_Register ( & r_netgraph , SCREENOPTIONS ) ;
Cvar_Register ( & r_dynamic , GRAPHICALNICETIES ) ;
2005-05-18 01:40:01 +00:00
Cvar_Register ( & r_lightmap_saturation , GRAPHICALNICETIES ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & r_nolerp , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_nolightdir , GRAPHICALNICETIES ) ;
2010-07-11 02:22:39 +00:00
Cvar_Register ( & r_fastturb , GRAPHICALNICETIES ) ;
2004-10-10 06:32:29 +00:00
Cvar_Register ( & r_fastsky , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_fastskycolour , GRAPHICALNICETIES ) ;
2006-05-14 21:43:35 +00:00
Cvar_Register ( & r_wateralpha , GRAPHICALNICETIES ) ;
2014-08-15 02:20:41 +00:00
Cvar_Register ( & r_lavaalpha , GRAPHICALNICETIES ) ;
2014-08-25 07:35:41 +00:00
Cvar_Register ( & r_slimealpha , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_telealpha , GRAPHICALNICETIES ) ;
2012-05-09 15:30:53 +00:00
Cvar_Register ( & gl_shadeq1_name , GLRENDEREROPTIONS ) ;
2004-10-10 06:32:29 +00:00
2016-07-12 00:40:13 +00:00
Cvar_Register ( & gl_mindist , GLRENDEREROPTIONS ) ;
Cvar_Register ( & gl_load24bit , GRAPHICALNICETIES ) ;
Cvar_Register ( & gl_blendsprites , GLRENDEREROPTIONS ) ;
2010-11-11 18:22:49 +00:00
Cvar_Register ( & r_clear , GLRENDEREROPTIONS ) ;
2010-11-02 23:17:25 +00:00
Cvar_Register ( & gl_max_size , GLRENDEREROPTIONS ) ;
Cvar_Register ( & gl_maxdist , GLRENDEREROPTIONS ) ;
2009-11-04 21:16:50 +00:00
Cvar_Register ( & gl_miptexLevel , GRAPHICALNICETIES ) ;
2014-10-05 20:04:11 +00:00
Cvar_Register ( & gl_texturemode , GLRENDEREROPTIONS ) ;
Cvar_Register ( & gl_texturemode2d , GLRENDEREROPTIONS ) ;
Cvar_Register ( & gl_mipcap , GLRENDEREROPTIONS ) ;
Cvar_Register ( & gl_texture_anisotropic_filtering , GLRENDEREROPTIONS ) ;
2004-12-11 03:41:12 +00:00
Cvar_Register ( & r_drawflat , GRAPHICALNICETIES ) ;
2005-09-29 23:20:29 +00:00
Cvar_Register ( & r_menutint , GRAPHICALNICETIES ) ;
2004-12-11 03:41:12 +00:00
2010-11-10 03:32:47 +00:00
Cvar_Register ( & r_fb_bmodels , GRAPHICALNICETIES ) ;
2006-05-11 02:30:13 +00:00
Cvar_Register ( & r_fb_models , GRAPHICALNICETIES ) ;
2010-03-14 14:35:56 +00:00
Cvar_Register ( & r_skin_overlays , GRAPHICALNICETIES ) ;
2014-04-12 03:31:59 +00:00
Cvar_Register ( & r_globalskin_first , GRAPHICALNICETIES ) ;
Cvar_Register ( & r_globalskin_count , GRAPHICALNICETIES ) ;
2011-04-30 17:21:10 +00:00
Cvar_Register ( & r_shadows , GRAPHICALNICETIES ) ;
2006-05-11 02:30:13 +00:00
2007-09-13 22:27:56 +00:00
Cvar_Register ( & r_replacemodels , GRAPHICALNICETIES ) ;
2012-02-12 05:18:31 +00:00
Cvar_Register ( & r_showbboxes , GLRENDEREROPTIONS ) ;
2015-06-22 11:49:15 +00:00
Cvar_Register ( & r_showfields , GLRENDEREROPTIONS ) ;
2016-07-15 12:26:24 +00:00
# ifndef NOLEGACY
2011-04-25 13:48:30 +00:00
Cvar_Register ( & r_polygonoffset_submodel_factor , GLRENDEREROPTIONS ) ;
Cvar_Register ( & r_polygonoffset_submodel_offset , GLRENDEREROPTIONS ) ;
2016-07-15 12:26:24 +00:00
# endif
2014-10-23 01:42:05 +00:00
Cvar_Register ( & r_polygonoffset_shadowmap_factor , GLRENDEREROPTIONS ) ;
Cvar_Register ( & r_polygonoffset_shadowmap_offset , GLRENDEREROPTIONS ) ;
2012-07-05 19:42:36 +00:00
Cvar_Register ( & r_polygonoffset_stencil_factor , GLRENDEREROPTIONS ) ;
Cvar_Register ( & r_polygonoffset_stencil_offset , GLRENDEREROPTIONS ) ;
2006-01-14 23:47:09 +00:00
2016-07-12 00:40:13 +00:00
Cvar_Register ( & r_forceprogramify , GLRENDEREROPTIONS ) ;
# ifdef VKQUAKE
Cvar_Register ( & vk_submissionthread , VKRENDEREROPTIONS ) ;
Cvar_Register ( & vk_debug , VKRENDEREROPTIONS ) ;
# endif
2005-06-26 12:31:56 +00:00
// misc
Cvar_Register ( & con_ocranaleds , " Console controls " ) ;
2015-07-03 02:07:41 +00:00
Cmd_AddCommand ( " listfonts " , R_ListFonts_f ) ;
Cmd_AddCommand ( " listskins " , R_ListSkins_f ) ;
Cmd_AddCommand ( " listskyboxes " , R_ListSkyBoxes_f ) ;
Cmd_AddCommand ( " listconfigs " , R_ListConfigs_f ) ;
2008-11-09 22:29:28 +00:00
P_InitParticleSystem ( ) ;
2004-08-23 00:15:46 +00:00
R_InitTextures ( ) ;
}
2010-02-06 01:25:04 +00:00
qboolean Renderer_Started ( void )
{
2016-02-10 23:23:43 +00:00
return ! r_blockvidrestart & & ! ! currentrendererstate . renderer ;
2010-02-06 01:25:04 +00:00
}
void Renderer_Start ( void )
{
2011-06-17 01:54:54 +00:00
r_blockvidrestart = false ;
2010-02-06 01:25:04 +00:00
Cvar_ApplyLatches ( CVAR_RENDERERLATCH ) ;
//renderer = none && currentrendererstate.bpp == -1 means we've never applied any mode at all
//if we currently have none, we do actually need to apply it still
if ( qrenderer = = QR_NONE & & * vid_renderer . string )
{
Cmd_ExecuteString ( " vid_restart \n " , RESTRICT_LOCAL ) ;
}
if ( ! currentrendererstate . renderer )
{ //we still failed. Try again, but use the default renderer.
Cvar_Set ( & vid_renderer , " " ) ;
Cmd_ExecuteString ( " vid_restart \n " , RESTRICT_LOCAL ) ;
}
if ( ! currentrendererstate . renderer )
Sys_Error ( " No renderer was set! \n " ) ;
if ( qrenderer = = QR_NONE )
Con_Printf ( " Use the setrenderer command to use a gui \n " ) ;
}
2004-08-23 00:15:46 +00:00
void ( * Draw_Init ) ( void ) ;
2009-11-04 21:16:50 +00:00
void ( * Draw_Shutdown ) ( void ) ;
2009-06-21 17:45:33 +00:00
2004-08-23 00:15:46 +00:00
void ( * R_Init ) ( void ) ;
void ( * R_DeInit ) ( void ) ;
void ( * R_RenderView ) ( void ) ; // must set r_refdef first
qboolean ( * VID_Init ) ( rendererstate_t * info , unsigned char * palette ) ;
void ( * VID_DeInit ) ( void ) ;
2015-08-14 02:46:38 +00:00
char * ( * VID_GetRGBInfo ) ( int * truevidwidth , int * truevidheight , enum uploadfmt * fmt ) ;
2016-07-12 00:40:13 +00:00
void ( * VID_SetWindowCaption ) ( const char * msg ) ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
qboolean ( * SCR_UpdateScreen ) ( void ) ;
2004-08-23 00:15:46 +00:00
2009-04-01 22:03:56 +00:00
r_qrenderer_t qrenderer ;
2004-08-23 00:15:46 +00:00
char * q_renderername = " Non-Selected renderer " ;
2005-07-03 15:16:20 +00:00
2005-06-22 17:10:13 +00:00
rendererinfo_t dedicatedrendererinfo = {
//ALL builds need a 'none' renderer, as 0.
2010-02-06 01:25:04 +00:00
" No renderer " ,
2005-06-22 17:10:13 +00:00
{
" none " ,
" dedicated " ,
" terminal " ,
" sv "
} ,
QR_NONE ,
NULL , //Draw_Init;
2009-11-04 21:16:50 +00:00
NULL , //Draw_Shutdown;
2005-06-22 17:10:13 +00:00
2014-10-05 20:04:11 +00:00
NULL , //IMG_UpdateFiltering
NULL , //IMG_LoadTextureMips
NULL , //IMG_DestroyTexture
2010-10-02 02:25:39 +00:00
2005-06-22 17:10:13 +00:00
NULL , //R_Init;
NULL , //R_DeInit;
NULL , //R_RenderView;
2005-07-03 15:16:20 +00:00
2005-06-22 17:10:13 +00:00
NULL , //VID_Init,
NULL , //VID_DeInit,
2014-03-30 00:39:37 +00:00
NULL , //VID_SwapBuffers
2013-05-11 14:02:55 +00:00
NULL , //VID_ApplyGammaRamps,
2014-09-02 02:44:43 +00:00
NULL ,
NULL ,
NULL ,
2005-06-22 17:10:13 +00:00
NULL , //set caption
2014-03-30 00:39:37 +00:00
NULL , //VID_GetRGBInfo,
2004-11-23 01:08:59 +00:00
2005-06-22 17:10:13 +00:00
NULL , //SCR_UpdateScreen;
2004-11-23 01:08:59 +00:00
2011-01-04 02:56:16 +00:00
/*backend*/
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
2011-10-27 15:46:36 +00:00
NULL ,
2013-04-06 03:36:00 +00:00
NULL ,
NULL ,
NULL ,
NULL ,
2013-06-23 02:17:02 +00:00
NULL ,
2011-01-04 02:56:16 +00:00
2014-02-07 14:57:07 +00:00
NULL ,
2005-06-22 17:10:13 +00:00
" "
} ;
rendererinfo_t * pdedicatedrendererinfo = & dedicatedrendererinfo ;
2004-11-23 01:08:59 +00:00
2013-03-12 23:09:25 +00:00
# ifdef GLQUAKE
extern rendererinfo_t openglrendererinfo ;
2013-03-12 22:49:04 +00:00
rendererinfo_t eglrendererinfo ;
2014-03-30 00:39:37 +00:00
extern rendererinfo_t rpirendererinfo ;
rendererinfo_t waylandrendererinfo ;
rendererinfo_t fbdevrendererinfo ;
2013-03-12 23:09:25 +00:00
# endif
# ifdef D3DQUAKE
2012-09-30 05:52:03 +00:00
rendererinfo_t d3d9rendererinfo ;
rendererinfo_t d3d11rendererinfo ;
2013-03-12 23:09:25 +00:00
# endif
# ifdef SWQUAKE
2012-05-09 15:30:53 +00:00
rendererinfo_t swrendererinfo ;
2013-03-12 23:09:25 +00:00
# endif
2016-07-12 00:40:13 +00:00
# ifdef VKQUAKE
rendererinfo_t vkrendererinfo ;
# endif
2014-04-24 01:53:01 +00:00
rendererinfo_t headlessrenderer ;
2007-05-25 22:16:29 +00:00
2009-11-04 21:16:50 +00:00
rendererinfo_t * rendererinfo [ ] =
2005-06-22 17:10:13 +00:00
{
2009-11-04 21:16:50 +00:00
# ifdef GLQUAKE
2014-03-30 00:39:37 +00:00
# ifdef FTE_RPI
& rpirendererinfo ,
# endif
2009-11-04 21:16:50 +00:00
& openglrendererinfo ,
2013-03-12 22:49:04 +00:00
& eglrendererinfo ,
2014-03-30 00:39:37 +00:00
& waylandrendererinfo ,
& fbdevrendererinfo ,
2007-05-25 22:16:29 +00:00
# endif
# ifdef D3DQUAKE
2012-09-30 05:52:03 +00:00
& d3d9rendererinfo ,
& d3d11rendererinfo ,
2007-05-25 22:16:29 +00:00
# endif
2012-05-09 15:30:53 +00:00
# ifdef SWQUAKE
& swrendererinfo ,
# endif
2016-07-12 00:40:13 +00:00
# ifdef VKQUAKE
& vkrendererinfo ,
# endif
2014-03-30 08:55:06 +00:00
# ifndef NPQTV
& dedicatedrendererinfo ,
# endif
2014-04-24 01:53:01 +00:00
& headlessrenderer ,
2005-06-22 17:10:13 +00:00
} ;
2004-08-23 00:15:46 +00:00
2010-02-06 01:25:04 +00:00
void R_SetRenderer ( rendererinfo_t * ri )
2004-08-23 00:15:46 +00:00
{
2010-02-06 01:25:04 +00:00
currentrendererstate . renderer = ri ;
if ( ! ri )
ri = & dedicatedrendererinfo ;
2005-06-22 17:10:13 +00:00
2010-02-06 01:25:04 +00:00
qrenderer = ri - > rtype ;
2005-06-22 17:10:13 +00:00
q_renderername = ri - > name [ 0 ] ;
Draw_Init = ri - > Draw_Init ;
2009-11-04 21:16:50 +00:00
Draw_Shutdown = ri - > Draw_Shutdown ;
2005-06-22 17:10:13 +00:00
R_Init = ri - > R_Init ;
R_DeInit = ri - > R_DeInit ;
R_RenderView = ri - > R_RenderView ;
VID_Init = ri - > VID_Init ;
VID_DeInit = ri - > VID_DeInit ;
VID_GetRGBInfo = ri - > VID_GetRGBInfo ;
2005-08-07 18:08:13 +00:00
VID_SetWindowCaption = ri - > VID_SetWindowCaption ;
2005-06-22 17:10:13 +00:00
SCR_UpdateScreen = ri - > SCR_UpdateScreen ;
2004-08-23 00:15:46 +00:00
}
2011-06-29 18:39:11 +00:00
qbyte default_quakepal [ 768 ] =
2005-01-05 08:06:55 +00:00
{
0 , 0 , 0 , 15 , 15 , 15 , 31 , 31 , 31 , 47 , 47 , 47 , 63 , 63 , 63 , 75 , 75 , 75 , 91 , 91 , 91 , 107 , 107 , 107 , 123 , 123 , 123 , 139 , 139 , 139 , 155 , 155 , 155 , 171 , 171 , 171 , 187 , 187 , 187 , 203 , 203 , 203 , 219 , 219 , 219 , 235 , 235 , 235 , 15 , 11 , 7 , 23 , 15 , 11 , 31 , 23 , 11 , 39 , 27 , 15 , 47 , 35 , 19 , 55 , 43 , 23 , 63 , 47 , 23 , 75 , 55 , 27 , 83 , 59 , 27 , 91 , 67 , 31 , 99 , 75 , 31 , 107 , 83 , 31 , 115 , 87 , 31 , 123 , 95 , 35 , 131 , 103 , 35 , 143 , 111 , 35 , 11 , 11 , 15 , 19 , 19 , 27 , 27 , 27 , 39 , 39 , 39 , 51 , 47 , 47 , 63 , 55 , 55 , 75 , 63 , 63 , 87 , 71 , 71 , 103 , 79 , 79 , 115 , 91 , 91 , 127 , 99 , 99 ,
139 , 107 , 107 , 151 , 115 , 115 , 163 , 123 , 123 , 175 , 131 , 131 , 187 , 139 , 139 , 203 , 0 , 0 , 0 , 7 , 7 , 0 , 11 , 11 , 0 , 19 , 19 , 0 , 27 , 27 , 0 , 35 , 35 , 0 , 43 , 43 , 7 , 47 , 47 , 7 , 55 , 55 , 7 , 63 , 63 , 7 , 71 , 71 , 7 , 75 , 75 , 11 , 83 , 83 , 11 , 91 , 91 , 11 , 99 , 99 , 11 , 107 , 107 , 15 , 7 , 0 , 0 , 15 , 0 , 0 , 23 , 0 , 0 , 31 , 0 , 0 , 39 , 0 , 0 , 47 , 0 , 0 , 55 , 0 , 0 , 63 , 0 , 0 , 71 , 0 , 0 , 79 , 0 , 0 , 87 , 0 , 0 , 95 , 0 , 0 , 103 , 0 , 0 , 111 , 0 , 0 , 119 , 0 , 0 , 127 , 0 , 0 , 19 , 19 , 0 , 27 , 27 , 0 , 35 , 35 , 0 , 47 , 43 , 0 , 55 , 47 , 0 , 67 ,
55 , 0 , 75 , 59 , 7 , 87 , 67 , 7 , 95 , 71 , 7 , 107 , 75 , 11 , 119 , 83 , 15 , 131 , 87 , 19 , 139 , 91 , 19 , 151 , 95 , 27 , 163 , 99 , 31 , 175 , 103 , 35 , 35 , 19 , 7 , 47 , 23 , 11 , 59 , 31 , 15 , 75 , 35 , 19 , 87 , 43 , 23 , 99 , 47 , 31 , 115 , 55 , 35 , 127 , 59 , 43 , 143 , 67 , 51 , 159 , 79 , 51 , 175 , 99 , 47 , 191 , 119 , 47 , 207 , 143 , 43 , 223 , 171 , 39 , 239 , 203 , 31 , 255 , 243 , 27 , 11 , 7 , 0 , 27 , 19 , 0 , 43 , 35 , 15 , 55 , 43 , 19 , 71 , 51 , 27 , 83 , 55 , 35 , 99 , 63 , 43 , 111 , 71 , 51 , 127 , 83 , 63 , 139 , 95 , 71 , 155 , 107 , 83 , 167 , 123 , 95 , 183 , 135 , 107 , 195 , 147 , 123 , 211 , 163 , 139 , 227 , 179 , 151 ,
171 , 139 , 163 , 159 , 127 , 151 , 147 , 115 , 135 , 139 , 103 , 123 , 127 , 91 , 111 , 119 , 83 , 99 , 107 , 75 , 87 , 95 , 63 , 75 , 87 , 55 , 67 , 75 , 47 , 55 , 67 , 39 , 47 , 55 , 31 , 35 , 43 , 23 , 27 , 35 , 19 , 19 , 23 , 11 , 11 , 15 , 7 , 7 , 187 , 115 , 159 , 175 , 107 , 143 , 163 , 95 , 131 , 151 , 87 , 119 , 139 , 79 , 107 , 127 , 75 , 95 , 115 , 67 , 83 , 107 , 59 , 75 , 95 , 51 , 63 , 83 , 43 , 55 , 71 , 35 , 43 , 59 , 31 , 35 , 47 , 23 , 27 , 35 , 19 , 19 , 23 , 11 , 11 , 15 , 7 , 7 , 219 , 195 , 187 , 203 , 179 , 167 , 191 , 163 , 155 , 175 , 151 , 139 , 163 , 135 , 123 , 151 , 123 , 111 , 135 , 111 , 95 , 123 , 99 , 83 , 107 , 87 , 71 , 95 , 75 , 59 , 83 , 63 ,
51 , 67 , 51 , 39 , 55 , 43 , 31 , 39 , 31 , 23 , 27 , 19 , 15 , 15 , 11 , 7 , 111 , 131 , 123 , 103 , 123 , 111 , 95 , 115 , 103 , 87 , 107 , 95 , 79 , 99 , 87 , 71 , 91 , 79 , 63 , 83 , 71 , 55 , 75 , 63 , 47 , 67 , 55 , 43 , 59 , 47 , 35 , 51 , 39 , 31 , 43 , 31 , 23 , 35 , 23 , 15 , 27 , 19 , 11 , 19 , 11 , 7 , 11 , 7 , 255 , 243 , 27 , 239 , 223 , 23 , 219 , 203 , 19 , 203 , 183 , 15 , 187 , 167 , 15 , 171 , 151 , 11 , 155 , 131 , 7 , 139 , 115 , 7 , 123 , 99 , 7 , 107 , 83 , 0 , 91 , 71 , 0 , 75 , 55 , 0 , 59 , 43 , 0 , 43 , 31 , 0 , 27 , 15 , 0 , 11 , 7 , 0 , 0 , 0 , 255 , 11 , 11 , 239 , 19 , 19 , 223 , 27 , 27 , 207 , 35 , 35 , 191 , 43 ,
43 , 175 , 47 , 47 , 159 , 47 , 47 , 143 , 47 , 47 , 127 , 47 , 47 , 111 , 47 , 47 , 95 , 43 , 43 , 79 , 35 , 35 , 63 , 27 , 27 , 47 , 19 , 19 , 31 , 11 , 11 , 15 , 43 , 0 , 0 , 59 , 0 , 0 , 75 , 7 , 0 , 95 , 7 , 0 , 111 , 15 , 0 , 127 , 23 , 7 , 147 , 31 , 7 , 163 , 39 , 11 , 183 , 51 , 15 , 195 , 75 , 27 , 207 , 99 , 43 , 219 , 127 , 59 , 227 , 151 , 79 , 231 , 171 , 95 , 239 , 191 , 119 , 247 , 211 , 139 , 167 , 123 , 59 , 183 , 155 , 55 , 199 , 195 , 55 , 231 , 227 , 87 , 127 , 191 , 255 , 171 , 231 , 255 , 215 , 255 , 255 , 103 , 0 , 0 , 139 , 0 , 0 , 179 , 0 , 0 , 215 , 0 , 0 , 255 , 0 , 0 , 255 , 243 , 147 , 255 , 247 , 199 , 255 , 255 , 255 , 159 , 91 , 83
} ;
2004-08-23 00:15:46 +00:00
2007-05-25 22:16:29 +00:00
qboolean R_ApplyRenderer_Load ( rendererstate_t * newr ) ;
void D3DSucks ( void )
{
SCR_DeInit ( ) ;
if ( ! R_ApplyRenderer_Load ( NULL ) ) //¤trendererstate))
Sys_Error ( " Failed to reload content after mode switch \n " ) ;
}
2015-12-28 17:41:39 +00:00
void R_ShutdownRenderer ( qboolean devicetoo )
2004-08-23 00:15:46 +00:00
{
2014-10-05 20:04:11 +00:00
//make sure the worker isn't still loading stuff
COM_WorkerFullSync ( ) ;
2005-02-28 07:16:19 +00:00
CL_AllowIndependantSendCmd ( false ) ; //FIXME: figure out exactly which parts are going to affect the model loading.
2015-02-09 03:37:41 +00:00
Skin_FlushAll ( ) ;
2011-01-30 01:32:30 +00:00
P_Shutdown ( ) ;
2013-10-29 17:38:22 +00:00
Mod_Shutdown ( false ) ;
2011-01-30 01:32:30 +00:00
2004-11-13 17:29:47 +00:00
IN_Shutdown ( ) ;
2004-08-23 00:15:46 +00:00
if ( R_DeInit )
2004-10-10 06:32:29 +00:00
{
TRACE ( ( " dbg: R_ApplyRenderer: R_DeInit \n " ) ) ;
2004-08-23 00:15:46 +00:00
R_DeInit ( ) ;
2004-10-10 06:32:29 +00:00
}
2004-08-23 00:15:46 +00:00
2012-09-30 05:52:03 +00:00
if ( Draw_Shutdown )
Draw_Shutdown ( ) ;
2015-12-28 17:41:39 +00:00
if ( VID_DeInit & & devicetoo )
2004-10-10 06:32:29 +00:00
{
TRACE ( ( " dbg: R_ApplyRenderer: VID_DeInit \n " ) ) ;
2004-08-23 00:15:46 +00:00
VID_DeInit ( ) ;
2004-10-10 06:32:29 +00:00
}
TRACE ( ( " dbg: R_ApplyRenderer: SCR_DeInit \n " ) ) ;
SCR_DeInit ( ) ;
2004-08-23 00:15:46 +00:00
COM_FlushTempoaryPacks ( ) ;
2012-07-05 19:42:36 +00:00
W_Shutdown ( ) ;
2012-11-29 13:37:48 +00:00
if ( h2playertranslations )
BZ_Free ( h2playertranslations ) ;
h2playertranslations = NULL ;
2012-07-05 19:42:36 +00:00
if ( host_basepal )
BZ_Free ( host_basepal ) ;
host_basepal = NULL ;
2012-11-27 03:23:19 +00:00
Surf_ClearLightmaps ( ) ;
2012-07-05 19:42:36 +00:00
2012-09-30 05:52:03 +00:00
RQ_Shutdown ( ) ;
2015-12-28 17:41:39 +00:00
if ( devicetoo )
S_Shutdown ( false ) ;
else
S_StopAllSounds ( true ) ;
2009-04-01 22:03:56 +00:00
}
2012-05-09 15:30:53 +00:00
void R_GenPaletteLookup ( void )
{
int r , g , b , i ;
unsigned char * pal = host_basepal ;
for ( i = 0 ; i < 256 ; i + + )
{
r = pal [ 0 ] ;
g = pal [ 1 ] ;
b = pal [ 2 ] ;
pal + = 3 ;
d_8to24rgbtable [ i ] = ( 255 < < 24 ) + ( r < < 0 ) + ( g < < 8 ) + ( b < < 16 ) ;
2014-10-11 19:39:45 +00:00
d_8to24bgrtable [ i ] = ( 255 < < 24 ) + ( b < < 0 ) + ( g < < 8 ) + ( r < < 16 ) ;
2012-05-09 15:30:53 +00:00
}
d_8to24rgbtable [ 255 ] & = 0xffffff ; // 255 is transparent
2014-10-11 19:39:45 +00:00
d_8to24bgrtable [ 255 ] & = 0xffffff ; // 255 is transparent
2012-05-09 15:30:53 +00:00
}
2009-04-01 22:03:56 +00:00
qboolean R_ApplyRenderer ( rendererstate_t * newr )
{
2014-10-05 20:04:11 +00:00
double time ;
2009-04-01 22:03:56 +00:00
if ( newr - > bpp = = - 1 )
return false ;
2010-02-06 01:25:04 +00:00
if ( ! newr - > renderer )
return false ;
2009-04-01 22:03:56 +00:00
2016-07-12 00:40:13 +00:00
COM_WorkerFullSync ( ) ;
2014-10-05 20:04:11 +00:00
time = Sys_DoubleTime ( ) ;
2015-09-01 04:45:15 +00:00
# ifndef NOBUILTINMENUS
2015-07-30 16:26:15 +00:00
M_RemoveAllMenus ( true ) ;
2015-09-01 04:45:15 +00:00
# endif
2014-10-05 20:04:11 +00:00
Media_CaptureDemoEnd ( ) ;
2014-03-30 08:55:06 +00:00
R_ShutdownRenderer ( true ) ;
2014-10-05 20:04:11 +00:00
Con_DPrintf ( " video shutdown took %f seconds \n " , Sys_DoubleTime ( ) - time ) ;
2005-02-06 02:47:36 +00:00
2010-02-06 01:25:04 +00:00
if ( qrenderer = = QR_NONE )
2004-08-23 00:15:46 +00:00
{
2013-07-13 12:14:32 +00:00
if ( newr - > renderer - > rtype = = qrenderer & & currentrendererstate . renderer )
2004-08-23 00:15:46 +00:00
return true ; //no point
Sys_CloseTerminal ( ) ;
}
2014-10-05 20:04:11 +00:00
time = Sys_DoubleTime ( ) ;
2004-08-23 00:15:46 +00:00
R_SetRenderer ( newr - > renderer ) ;
2014-10-05 20:04:11 +00:00
Con_DPrintf ( " video startup took %f seconds \n " , Sys_DoubleTime ( ) - time ) ;
2004-08-23 00:15:46 +00:00
2008-02-16 03:40:32 +00:00
return R_ApplyRenderer_Load ( newr ) ;
2007-05-25 22:16:29 +00:00
}
qboolean R_ApplyRenderer_Load ( rendererstate_t * newr )
{
int i , j ;
2014-10-05 20:04:11 +00:00
double start = Sys_DoubleTime ( ) ;
2007-05-25 22:16:29 +00:00
2016-07-12 00:40:13 +00:00
COM_WorkerFullSync ( ) ;
2004-08-23 00:15:46 +00:00
Cache_Flush ( ) ;
2014-10-05 20:04:11 +00:00
COM_FlushFSCache ( false , true ) ; //make sure the fs cache is built if needed. there's lots of loading here.
2004-08-23 00:15:46 +00:00
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: old renderer closed \n " ) ) ;
2004-12-15 19:40:06 +00:00
pmove . numphysent = 0 ;
2015-05-03 19:57:46 +00:00
pmove . physents [ 0 ] . model = NULL ;
2004-12-15 19:40:06 +00:00
2015-08-07 17:49:49 +00:00
r_softwarebanding = r_softwarebanding_cvar . ival ;
r_deluxemapping = r_deluxemapping_cvar . ival ;
2016-02-10 23:23:43 +00:00
vid . dpi_x = 0 ;
vid . dpi_y = 0 ;
2010-02-06 01:25:04 +00:00
if ( qrenderer ! = QR_NONE ) //graphics stuff only when not dedicated
2004-08-23 00:15:46 +00:00
{
2014-10-05 20:04:11 +00:00
size_t sz ;
2004-08-23 00:15:46 +00:00
qbyte * data ;
2004-11-29 01:21:00 +00:00
# ifndef CLIENTONLY
2004-08-23 00:15:46 +00:00
isDedicated = false ;
2004-11-29 01:21:00 +00:00
# endif
2007-05-25 22:16:29 +00:00
if ( newr )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Setting mode %i*%i*%i*%i %s \n " , newr - > width , newr - > height , newr - > bpp , newr - > rate , newr - > renderer - > description ) ;
2004-08-23 00:15:46 +00:00
2015-05-03 19:57:46 +00:00
vid . fullbright = 0 ;
2004-08-23 00:15:46 +00:00
if ( host_basepal )
BZ_Free ( host_basepal ) ;
2014-10-05 20:04:11 +00:00
host_basepal = ( qbyte * ) FS_LoadMallocFile ( " gfx/palette.lmp " , & sz ) ;
2004-08-23 00:15:46 +00:00
if ( ! host_basepal )
2014-10-05 20:04:11 +00:00
host_basepal = ( qbyte * ) FS_LoadMallocFile ( " wad/playpal " , & sz ) ;
if ( ! host_basepal | | sz ! = 768 )
2004-08-23 00:15:46 +00:00
{
qbyte * pcx = NULL ;
2014-10-05 20:04:11 +00:00
if ( host_basepal )
Z_Free ( host_basepal ) ;
2004-08-23 00:15:46 +00:00
host_basepal = BZ_Malloc ( 768 ) ;
2014-10-05 20:04:11 +00:00
pcx = COM_LoadTempFile ( " pics/colormap.pcx " , & sz ) ;
if ( ! pcx | | ! ReadPCXPalette ( pcx , sz , host_basepal ) )
2004-11-17 18:06:06 +00:00
{
2005-01-05 08:06:55 +00:00
memcpy ( host_basepal , default_quakepal , 768 ) ;
2004-11-17 18:06:06 +00:00
}
2005-03-23 22:14:08 +00:00
else
{
2011-07-06 05:53:25 +00:00
//if (ReadPCXData(pcx, com_filesize, 256, VID_GRADES, colormap))
goto q2colormap ; //skip the colormap.lmp file as we already read it
2005-03-23 22:14:08 +00:00
}
2004-08-23 00:15:46 +00:00
}
2011-07-06 05:53:25 +00:00
2004-08-23 00:15:46 +00:00
{
2014-10-05 20:04:11 +00:00
qbyte * colormap = ( qbyte * ) FS_LoadMallocFile ( " gfx/colormap.lmp " , NULL ) ;
2015-05-03 19:57:46 +00:00
if ( colormap )
2011-07-06 05:53:25 +00:00
{
j = VID_GRADES - 1 ;
data = colormap + j * 256 ;
vid . fullbright = 0 ;
for ( i = 255 ; i > = 0 ; i - - )
{
if ( colormap [ i ] = = data [ i ] )
vid . fullbright + + ;
else
break ;
}
2004-08-23 00:15:46 +00:00
}
2011-07-06 05:53:25 +00:00
BZ_Free ( colormap ) ;
2004-08-23 00:15:46 +00:00
}
2014-09-17 03:04:08 +00:00
# ifdef HEXEN2
2010-08-28 17:14:38 +00:00
if ( h2playertranslations )
BZ_Free ( h2playertranslations ) ;
2014-10-05 20:04:11 +00:00
h2playertranslations = FS_LoadMallocFile ( " gfx/player.lmp " , NULL ) ;
2014-09-17 03:04:08 +00:00
# endif
2010-08-28 17:14:38 +00:00
2004-08-23 00:15:46 +00:00
if ( vid . fullbright < 2 )
vid . fullbright = 0 ; //transparent colour doesn't count.
2005-03-23 22:14:08 +00:00
q2colormap :
2013-06-23 02:17:02 +00:00
R_GenPaletteLookup ( ) ;
2005-03-23 22:14:08 +00:00
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: Palette loaded \n " ) ) ;
2004-08-23 00:15:46 +00:00
2007-05-25 22:16:29 +00:00
if ( newr )
if ( ! VID_Init ( newr , host_basepal ) )
{
return false ;
}
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: vid applied \n " ) ) ;
2004-08-23 00:15:46 +00:00
W_LoadWadFile ( " gfx.wad " ) ;
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: wad loaded \n " ) ) ;
2014-10-05 20:04:11 +00:00
Image_Init ( ) ;
2004-08-23 00:15:46 +00:00
Draw_Init ( ) ;
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: draw inited \n " ) ) ;
2004-08-23 00:15:46 +00:00
R_Init ( ) ;
2012-11-27 03:23:19 +00:00
RQ_Init ( ) ;
2009-11-04 21:16:50 +00:00
R_InitParticleTexture ( ) ;
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: renderer inited \n " ) ) ;
2004-08-23 00:15:46 +00:00
SCR_Init ( ) ;
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: screen inited \n " ) ) ;
2004-08-23 00:15:46 +00:00
Sbar_Flush ( ) ;
2006-05-10 22:12:20 +00:00
IN_ReInit ( ) ;
2014-03-30 08:55:06 +00:00
Cvar_ForceCallback ( & v_gamma ) ;
2004-08-23 00:15:46 +00:00
}
else
{
2004-11-29 01:21:00 +00:00
# ifdef CLIENTONLY
2005-06-22 17:10:13 +00:00
Sys_Error ( " Tried setting dedicated mode \n " ) ;
//we could support this, but there's no real reason to actually do so.
//fixme: despite the checks in the setrenderer command, we can still get here via a config using vid_renderer.
2004-11-29 01:21:00 +00:00
# else
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: isDedicated = true \n " ) ) ;
2004-08-23 00:15:46 +00:00
isDedicated = true ;
if ( cls . state )
{
int os = sv . state ;
sv . state = ss_dead ; //prevents server from being killed off too.
CL_Disconnect ( ) ;
sv . state = os ;
}
Sys_InitTerminal ( ) ;
Con_PrintToSys ( ) ;
2004-11-29 01:21:00 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: initing mods \n " ) ) ;
2013-10-29 17:38:22 +00:00
Mod_Init ( false ) ;
2004-08-23 00:15:46 +00:00
// host_hunklevel = Hunk_LowMark();
2016-02-10 23:23:43 +00:00
Cvar_ForceSetValue ( & vid_dpi_x , vid . dpi_x ) ;
Cvar_ForceSetValue ( & vid_dpi_y , vid . dpi_y ) ;
2014-10-05 20:04:11 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: R_PreNewMap (how handy) \n " ) ) ;
Surf_PreNewMap ( ) ;
2004-08-23 00:15:46 +00:00
2004-11-29 01:21:00 +00:00
# ifndef CLIENTONLY
2009-11-04 21:16:50 +00:00
if ( sv . world . worldmodel )
2004-08-23 00:15:46 +00:00
{
2009-11-04 21:16:50 +00:00
wedict_t * ent ;
2004-08-23 00:15:46 +00:00
# ifdef Q2SERVER
q2edict_t * q2ent ;
# endif
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: reloading server map \n " ) ) ;
2015-10-27 15:20:15 +00:00
sv . world . worldmodel = Mod_ForName ( sv . modelname , MLV_WARNSYNC ) ;
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: loaded \n " ) ) ;
2014-10-05 20:04:11 +00:00
if ( sv . world . worldmodel - > loadstate = = MLS_LOADING )
COM_WorkerPartialSync ( sv . world . worldmodel , & sv . world . worldmodel - > loadstate , MLS_LOADING ) ;
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: doing that funky phs thang \n " ) ) ;
2004-08-23 00:15:46 +00:00
SV_CalcPHS ( ) ;
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: clearing world \n " ) ) ;
2004-08-23 00:15:46 +00:00
2014-10-05 20:04:11 +00:00
if ( sv . world . worldmodel - > loadstate ! = MLS_LOADED )
2014-08-27 08:41:31 +00:00
SV_UnspawnServer ( ) ;
else if ( svs . gametype = = GT_PROGS )
2004-08-23 00:15:46 +00:00
{
2014-09-17 03:04:08 +00:00
for ( i = 0 ; i < MAX_PRECACHE_MODELS ; i + + )
2005-03-23 22:14:08 +00:00
{
2009-11-04 21:16:50 +00:00
if ( sv . strings . model_precache [ i ] & & * sv . strings . model_precache [ i ] & & ( ! strcmp ( sv . strings . model_precache [ i ] + strlen ( sv . strings . model_precache [ i ] ) - 4 , " .bsp " ) | | i - 1 < sv . world . worldmodel - > numsubmodels ) )
2014-10-05 20:04:11 +00:00
sv . models [ i ] = Mod_FindName ( Mod_FixName ( sv . strings . model_precache [ i ] , sv . strings . model_precache [ 1 ] ) ) ;
2005-03-23 22:14:08 +00:00
else
2009-11-07 13:29:15 +00:00
sv . models [ i ] = NULL ;
2005-03-23 22:14:08 +00:00
}
2014-10-05 20:04:11 +00:00
World_ClearWorld ( & sv . world ) ;
2009-11-04 21:16:50 +00:00
ent = sv . world . edicts ;
2007-03-11 16:51:45 +00:00
// ent->v->model = PR_NewString(svprogfuncs, sv.worldmodel->name); //FIXME: is this a problem for normal ents?
2009-11-04 21:16:50 +00:00
for ( i = 0 ; i < sv . world . num_edicts ; i + + )
2004-08-23 00:15:46 +00:00
{
2009-11-04 21:16:50 +00:00
ent = ( wedict_t * ) EDICT_NUM ( svprogfuncs , i ) ;
2004-08-23 00:15:46 +00:00
if ( ! ent )
continue ;
if ( ent - > isfree )
continue ;
if ( ent - > area . prev )
{
ent - > area . prev = ent - > area . next = NULL ;
2009-11-04 21:16:50 +00:00
World_LinkEdict ( & sv . world , ent , false ) ; // relink ents so touch functions continue to work.
2004-08-23 00:15:46 +00:00
}
}
}
# ifdef Q2SERVER
2005-03-23 22:14:08 +00:00
else if ( svs . gametype = = GT_QUAKE2 )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
for ( i = 0 ; i < Q2MAX_MODELS ; i + + )
2006-02-26 05:49:15 +00:00
{
2009-11-04 21:16:50 +00:00
if ( sv . strings . configstring [ Q2CS_MODELS + i ] & & * sv . strings . configstring [ Q2CS_MODELS + i ] & & ( ! strcmp ( sv . strings . configstring [ Q2CS_MODELS + i ] + strlen ( sv . strings . configstring [ Q2CS_MODELS + i ] ) - 4 , " .bsp " ) | | i - 1 < sv . world . worldmodel - > numsubmodels ) )
2014-10-05 20:04:11 +00:00
sv . models [ i ] = Mod_FindName ( Mod_FixName ( sv . strings . configstring [ Q2CS_MODELS + i ] , sv . modelname ) ) ;
2006-02-26 05:49:15 +00:00
else
2009-11-07 13:29:15 +00:00
sv . models [ i ] = NULL ;
2006-02-26 05:49:15 +00:00
}
2016-07-12 00:40:13 +00:00
for ( ; i < MAX_PRECACHE_MODELS ; i + + )
{
if ( sv . strings . q2_extramodels [ i ] & & * sv . strings . q2_extramodels [ i ] & & ( ! strcmp ( sv . strings . q2_extramodels [ i ] + strlen ( sv . strings . q2_extramodels [ i ] ) - 4 , " .bsp " ) | | i - 1 < sv . world . worldmodel - > numsubmodels ) )
sv . models [ i ] = Mod_FindName ( Mod_FixName ( sv . strings . q2_extramodels [ i ] , sv . modelname ) ) ;
else
sv . models [ i ] = NULL ;
}
2005-06-15 04:44:39 +00:00
2014-10-05 20:04:11 +00:00
World_ClearWorld ( & sv . world ) ;
2006-02-26 05:49:15 +00:00
q2ent = ge - > edicts ;
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < ge - > num_edicts ; i + + , q2ent = ( q2edict_t * ) ( ( char * ) q2ent + ge - > edict_size ) )
{
if ( ! q2ent )
continue ;
if ( ! q2ent - > inuse )
continue ;
if ( q2ent - > area . prev )
{
q2ent - > area . prev = q2ent - > area . next = NULL ;
2009-11-04 21:16:50 +00:00
WorldQ2_LinkEdict ( & sv . world , q2ent ) ; // relink ents so touch functions continue to work.
2004-08-23 00:15:46 +00:00
}
}
}
2014-03-30 08:55:06 +00:00
# endif
# ifdef Q3SERVER
else if ( svs . gametype = = GT_QUAKE3 )
{
2014-10-05 20:04:11 +00:00
memset ( & sv . models , 0 , sizeof ( sv . models ) ) ;
sv . models [ 1 ] = Mod_FindName ( sv . modelname ) ;
2014-03-30 08:55:06 +00:00
//traditionally a q3 server can just keep hold of its world cmodel and nothing is harmed.
//this means we just need to reload the worldmodel and all is fine...
//there are some edge cases however, like lingering pointers refering to entities.
}
2007-09-22 22:10:08 +00:00
# endif
2005-03-23 22:14:08 +00:00
else
SV_UnspawnServer ( ) ;
2004-08-23 00:15:46 +00:00
}
2004-11-29 01:21:00 +00:00
# endif
2004-10-26 23:06:29 +00:00
# ifdef PLUGINS
2004-10-10 06:32:29 +00:00
Plug_ResChanged ( ) ;
2004-10-26 23:06:29 +00:00
# endif
2011-01-29 19:53:38 +00:00
Cvar_ForceCallback ( & r_particlesystem ) ;
2004-08-23 00:15:46 +00:00
2011-04-30 17:21:10 +00:00
CL_InitDlights ( ) ;
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: starting on client state \n " ) ) ;
2014-03-30 08:55:06 +00:00
if ( newr )
memcpy ( & currentrendererstate , newr , sizeof ( currentrendererstate ) ) ;
2014-10-05 20:04:11 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: S_Restart_f \n " ) ) ;
if ( ! isDedicated )
2015-12-28 17:41:39 +00:00
S_DoRestart ( true ) ;
2014-10-05 20:04:11 +00:00
2014-03-30 08:55:06 +00:00
# ifdef Q3SERVER
if ( svs . gametype = = GT_QUAKE3 )
{
2015-09-01 04:45:15 +00:00
cl . worldmodel = NULL ;
2014-03-30 08:55:06 +00:00
CG_Stop ( ) ;
CG_Start ( ) ;
2014-05-04 04:14:52 +00:00
if ( cl . worldmodel )
2014-10-05 20:04:11 +00:00
Surf_NewMap ( ) ;
2014-03-30 08:55:06 +00:00
}
else
# endif
2004-08-23 00:15:46 +00:00
if ( cl . worldmodel )
{
cl . worldmodel = NULL ;
------------------------------------------------------------------------
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
CL_ClearEntityLists ( ) ; //shouldn't really be needed, but we're paranoid
2009-11-04 21:16:50 +00:00
2013-10-08 14:28:11 +00:00
//FIXME: this code should not be here. call CL_LoadModels instead? that does csqc loading etc though. :s
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: reloading ALL models \n " ) ) ;
2014-09-17 03:04:08 +00:00
for ( i = 1 ; i < MAX_PRECACHE_MODELS ; i + + )
2004-08-23 00:15:46 +00:00
{
if ( ! cl . model_name [ i ] [ 0 ] )
break ;
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: reloading model %s \n " , cl . model_name [ i ] ) ) ;
2013-10-08 14:28:11 +00:00
# ifdef Q2CLIENT //skip vweps
if ( cls . protocol = = CP_QUAKE2 & & * cl . model_name [ i ] = = ' # ' )
cl . model_precache [ i ] = NULL ;
else
# endif
2014-10-05 20:04:11 +00:00
if ( i = = 1 )
cl . model_precache [ i ] = Mod_ForName ( cl . model_name [ i ] , MLV_SILENT ) ;
else
cl . model_precache [ i ] = Mod_FindName ( Mod_FixName ( cl . model_name [ i ] , cl . model_name [ 1 ] ) ) ;
2004-08-23 00:15:46 +00:00
}
2009-07-24 20:20:31 +00:00
for ( i = 0 ; i < MAX_VWEP_MODELS ; i + + )
{
if ( * cl . model_name_vwep [ i ] )
2014-03-30 08:55:06 +00:00
cl . model_precache_vwep [ i ] = Mod_ForName ( cl . model_name_vwep [ i ] , MLV_SILENT ) ;
2009-07-24 20:20:31 +00:00
else
cl . model_precache_vwep [ i ] = NULL ;
}
2005-08-03 23:14:59 +00:00
# ifdef CSQC_DAT
2013-03-12 22:44:00 +00:00
for ( i = 1 ; i < MAX_CSMODELS ; i + + )
2005-08-03 23:14:59 +00:00
{
if ( ! cl . model_csqcname [ i ] [ 0 ] )
break ;
cl . model_csqcprecache [ i ] = NULL ;
TRACE ( ( " dbg: R_ApplyRenderer: reloading csqc model %s \n " , cl . model_csqcname [ i ] ) ) ;
2014-10-05 20:04:11 +00:00
cl . model_csqcprecache [ i ] = Mod_ForName ( Mod_FixName ( cl . model_csqcname [ i ] , cl . model_name [ 1 ] ) , MLV_SILENT ) ;
2005-08-03 23:14:59 +00:00
}
# endif
2004-08-23 00:15:46 +00:00
2014-10-29 05:03:03 +00:00
//fixme: worldmodel could be ssqc or csqc.
2014-10-05 20:04:11 +00:00
cl . worldmodel = cl . model_precache [ 1 ] ;
if ( cl . worldmodel & & cl . worldmodel - > loadstate = = MLS_LOADING )
COM_WorkerPartialSync ( cl . worldmodel , & cl . worldmodel - > loadstate , MLS_LOADING ) ;
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: done the models \n " ) ) ;
2014-10-05 20:04:11 +00:00
if ( ! cl . worldmodel | | cl . worldmodel - > loadstate ! = MLS_LOADED )
2004-08-23 00:15:46 +00:00
{
2014-10-29 05:03:03 +00:00
// Con_Printf ("\nThe required model file '%s' could not be found.\n\n", cl.model_name[i]);
// Con_Printf ("You may need to download or purchase a client pack in order to play on this server.\n\n");
2004-08-23 00:15:46 +00:00
CL_Disconnect ( ) ;
2005-09-09 23:40:55 +00:00
# ifdef VM_UI
2004-08-23 00:15:46 +00:00
UI_Reset ( ) ;
2005-09-09 23:40:55 +00:00
# endif
2014-10-05 20:04:11 +00:00
if ( newr )
memcpy ( & currentrendererstate , newr , sizeof ( currentrendererstate ) ) ;
2004-08-23 00:15:46 +00:00
return true ;
}
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: checking any wad textures \n " ) ) ;
2014-10-05 20:04:11 +00:00
Mod_NowLoadExternal ( cl . worldmodel ) ;
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < cl . num_statics ; i + + ) //make the static entities reappear.
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
cl_static_entities [ i ] . ent . model = NULL ;
if ( cl_static_entities [ i ] . mdlidx < 0 )
{
2013-03-12 22:44:00 +00:00
if ( cl_static_entities [ i ] . mdlidx > - MAX_CSMODELS )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
cl_static_entities [ i ] . ent . model = cl . model_csqcprecache [ - cl_static_entities [ i ] . mdlidx ] ;
}
else
{
2014-09-17 03:04:08 +00:00
if ( cl_static_entities [ i ] . mdlidx < MAX_PRECACHE_MODELS )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
cl_static_entities [ i ] . ent . model = cl . model_precache [ cl_static_entities [ i ] . mdlidx ] ;
}
2004-08-23 00:15:46 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
2014-10-05 20:04:11 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: Surf_NewMap \n " ) ) ;
Surf_NewMap ( ) ;
TRACE ( ( " dbg: R_ApplyRenderer: efrags \n " ) ) ;
2015-02-09 03:37:41 +00:00
// Skin_FlushAll();
Skin_FlushPlayers ( ) ;
2012-07-05 19:42:36 +00:00
# ifdef CSQC_DAT
CSQC_RendererRestarted ( ) ;
# endif
2004-08-23 00:15:46 +00:00
}
else
2010-12-05 02:46:07 +00:00
{
# ifdef VM_UI
2004-08-23 00:15:46 +00:00
UI_Reset ( ) ;
2005-09-09 23:40:55 +00:00
# endif
2010-12-05 02:46:07 +00:00
}
2004-08-23 00:15:46 +00:00
2013-08-06 02:19:06 +00:00
if ( newr & & qrenderer ! = QR_NONE )
2004-08-23 00:15:46 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " %s renderer initialized \n " , newr - > renderer - > description ) ;
2004-08-23 00:15:46 +00:00
}
2005-06-15 04:44:39 +00:00
2005-06-04 04:20:20 +00:00
TRACE ( ( " dbg: R_ApplyRenderer: done \n " ) ) ;
2014-10-05 20:04:11 +00:00
Con_DPrintf ( " video restart took %f seconds \n " , Sys_DoubleTime ( ) - start ) ;
2004-08-23 00:15:46 +00:00
return true ;
}
2013-08-06 02:19:06 +00:00
void R_ReloadRenderer_f ( void )
{
2014-10-05 20:04:11 +00:00
float time = Sys_DoubleTime ( ) ;
2014-03-30 08:55:06 +00:00
R_ShutdownRenderer ( false ) ;
2014-10-05 20:04:11 +00:00
Con_DPrintf ( " teardown = %f \n " , Sys_DoubleTime ( ) - time ) ;
2013-08-06 02:19:06 +00:00
//reloads textures without destroying video context.
R_ApplyRenderer_Load ( NULL ) ;
}
2009-07-17 23:11:34 +00:00
# define DEFAULT_WIDTH 640
# define DEFAULT_HEIGHT 480
# define DEFAULT_BPP 32
2013-11-21 23:02:28 +00:00
//use Cvar_ApplyLatches(CVAR_RENDERERLATCH) beforehand.
qboolean R_BuildRenderstate ( rendererstate_t * newr , char * rendererstring )
2004-08-23 00:15:46 +00:00
{
2005-06-22 17:10:13 +00:00
int i , j ;
2011-06-17 01:54:54 +00:00
2013-11-21 23:02:28 +00:00
memset ( newr , 0 , sizeof ( * newr ) ) ;
2004-08-23 00:15:46 +00:00
2013-11-21 23:02:28 +00:00
newr - > width = vid_width . value ;
newr - > height = vid_height . value ;
2004-08-23 00:15:46 +00:00
2013-11-21 23:02:28 +00:00
newr - > triplebuffer = vid_triplebuffer . value ;
newr - > multisample = vid_multisample . value ;
newr - > bpp = vid_bpp . value ;
newr - > fullscreen = vid_fullscreen . value ;
newr - > rate = vid_refreshrate . value ;
newr - > stereo = ( r_stereo_method . ival = = 1 ) ;
2014-03-30 08:55:06 +00:00
newr - > srgb = vid_srgb . ival ;
2006-04-15 03:31:23 +00:00
2015-04-14 23:12:17 +00:00
if ( com_installer )
{
newr - > fullscreen = false ;
newr - > width = 640 ;
newr - > height = 480 ;
}
2014-02-07 08:38:40 +00:00
if ( ! * vid_vsync . string | | vid_vsync . value < 0 )
2013-11-21 23:02:28 +00:00
newr - > wait = - 1 ;
2011-01-28 05:39:40 +00:00
else
2014-02-07 08:38:40 +00:00
newr - > wait = vid_vsync . value ;
2010-11-06 23:05:29 +00:00
2013-11-21 23:02:28 +00:00
newr - > renderer = NULL ;
2005-02-06 02:47:36 +00:00
2013-11-21 23:02:28 +00:00
rendererstring = COM_Parse ( rendererstring ) ;
2014-05-17 15:25:02 +00:00
if ( ! * com_token )
2004-08-23 00:15:46 +00:00
{
2014-05-17 15:25:02 +00:00
for ( i = 0 ; i < sizeof ( rendererinfo ) / sizeof ( rendererinfo [ 0 ] ) ; i + + )
2005-06-22 17:10:13 +00:00
{
2014-05-17 15:25:02 +00:00
if ( rendererinfo [ i ] - > name [ 0 ] & & stricmp ( rendererinfo [ i ] - > name [ 0 ] , " none " ) )
2005-06-22 17:10:13 +00:00
{
2013-11-21 23:02:28 +00:00
newr - > renderer = rendererinfo [ i ] ;
2005-06-22 17:10:13 +00:00
break ;
}
}
}
2015-01-21 18:18:37 +00:00
else if ( ! strcmp ( com_token , " random " ) )
{
int count ;
for ( i = 0 , count = 0 ; i < sizeof ( rendererinfo ) / sizeof ( rendererinfo [ 0 ] ) ; i + + )
{
if ( ! rendererinfo [ i ] - > description )
continue ; //not valid in this build. :(
if ( rendererinfo [ i ] - > rtype = = QR_NONE | | //dedicated servers are not useful
rendererinfo [ i ] - > rtype = = QR_HEADLESS | | //headless appears buggy
rendererinfo [ i ] - > rtype = = QR_SOFTWARE ) //software is just TOO buggy/limited for us to care.
continue ;
count + + ;
}
count = rand ( ) % count ;
for ( i = 0 ; i < sizeof ( rendererinfo ) / sizeof ( rendererinfo [ 0 ] ) ; i + + )
{
if ( ! rendererinfo [ i ] - > description )
continue ; //not valid in this build. :(
if ( rendererinfo [ i ] - > rtype = = QR_NONE | |
rendererinfo [ i ] - > rtype = = QR_HEADLESS | |
rendererinfo [ i ] - > rtype = = QR_SOFTWARE )
continue ;
if ( ! count - - )
{
newr - > renderer = rendererinfo [ i ] ;
Con_Printf ( " randomly selected renderer: %s \n " , rendererinfo [ i ] - > description ) ;
break ;
}
}
}
2014-05-17 15:25:02 +00:00
else
{
for ( i = 0 ; i < sizeof ( rendererinfo ) / sizeof ( rendererinfo [ 0 ] ) ; i + + )
{
if ( ! rendererinfo [ i ] - > description )
continue ; //not valid in this build. :(
for ( j = 4 - 1 ; j > = 0 ; j - - )
{
if ( ! rendererinfo [ i ] - > name [ j ] )
continue ;
if ( ! stricmp ( rendererinfo [ i ] - > name [ j ] , com_token ) )
{
newr - > renderer = rendererinfo [ i ] ;
break ;
}
}
}
}
2012-09-30 05:52:03 +00:00
2013-11-21 23:02:28 +00:00
rendererstring = COM_Parse ( rendererstring ) ;
if ( * com_token )
Q_strncpyz ( newr - > subrenderer , com_token , sizeof ( newr - > subrenderer ) ) ;
else if ( newr - > renderer & & newr - > renderer - > rtype = = QR_OPENGL )
Q_strncpyz ( newr - > subrenderer , gl_driver . string , sizeof ( newr - > subrenderer ) ) ;
2004-08-23 00:15:46 +00:00
2006-04-15 03:31:23 +00:00
// use desktop settings if set to 0 and not dedicated
2013-11-21 23:02:28 +00:00
if ( newr - > renderer & & newr - > renderer - > rtype ! = QR_NONE )
2006-04-15 03:31:23 +00:00
{
2016-07-15 12:26:24 +00:00
extern int isPlugin ;
2006-04-15 03:31:23 +00:00
if ( vid_desktopsettings . value )
{
2015-03-03 00:14:43 +00:00
newr - > width = 0 ;
newr - > height = 0 ;
newr - > bpp = 0 ;
newr - > rate = 0 ;
2006-04-15 03:31:23 +00:00
}
2015-03-03 00:14:43 +00:00
if ( newr - > width < = 0 | | newr - > height < = 0 | | newr - > bpp < = 0 )
2006-04-15 03:31:23 +00:00
{
2015-03-03 00:14:43 +00:00
int dbpp , dheight , dwidth , drate ;
if ( ! newr - > fullscreen | | isPlugin | | ! Sys_GetDesktopParameters ( & dwidth , & dheight , & dbpp , & drate ) )
2006-04-15 03:31:23 +00:00
{
2015-03-03 00:14:43 +00:00
dwidth = DEFAULT_WIDTH ;
dheight = DEFAULT_HEIGHT ;
dbpp = DEFAULT_BPP ;
drate = 0 ;
2006-04-15 03:31:23 +00:00
}
2015-03-03 00:14:43 +00:00
if ( newr - > width < = 0 )
newr - > width = dwidth ;
if ( newr - > height < = 0 )
newr - > height = dheight ;
2013-11-21 23:02:28 +00:00
if ( newr - > bpp < = 0 )
newr - > bpp = dbpp ;
}
}
# ifdef CLIENTONLY
if ( newr - > renderer & & newr - > renderer - > rtype = = QR_NONE )
{
Con_Printf ( " Client-only builds cannot use dedicated modes. \n " ) ;
2013-11-21 23:20:47 +00:00
return false ;
2013-11-21 23:02:28 +00:00
}
# endif
return newr - > renderer ! = NULL ;
}
2014-05-17 15:25:02 +00:00
void R_RestartRenderer ( rendererstate_t * newr )
2013-11-21 23:02:28 +00:00
{
rendererstate_t oldr ;
if ( r_blockvidrestart )
{
Con_Printf ( " Ignoring vid_restart from config \n " ) ;
return ;
}
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_RestartRenderer_f renderer %i \n " , newr . renderer ) ) ;
2004-08-23 00:15:46 +00:00
memcpy ( & oldr , & currentrendererstate , sizeof ( rendererstate_t ) ) ;
2014-05-17 15:25:02 +00:00
if ( ! R_ApplyRenderer ( newr ) )
2004-08-23 00:15:46 +00:00
{
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_RestartRenderer_f failed \n " ) ) ;
2004-08-23 00:15:46 +00:00
if ( R_ApplyRenderer ( & oldr ) )
2004-10-10 06:32:29 +00:00
{
TRACE ( ( " dbg: R_RestartRenderer_f old restored \n " ) ) ;
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_ERROR " Video mode switch failed. Old mode restored. \n " ) ; //go back to the old mode, the new one failed.
2004-10-10 06:32:29 +00:00
}
2004-08-23 00:15:46 +00:00
else
{
2014-03-30 08:55:06 +00:00
int i ;
2006-04-06 22:07:34 +00:00
qboolean failed = true ;
2014-05-17 15:25:02 +00:00
rendererinfo_t * skip = newr - > renderer ;
2006-04-06 22:07:34 +00:00
2014-05-17 15:25:02 +00:00
if ( newr - > rate ! = 0 )
2006-04-06 22:07:34 +00:00
{
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_NOTICE " Trying default refresh rate \n " ) ;
2014-05-17 15:25:02 +00:00
newr - > rate = 0 ;
failed = ! R_ApplyRenderer ( newr ) ;
2006-04-06 22:07:34 +00:00
}
2014-05-17 15:25:02 +00:00
if ( failed & & newr - > width ! = DEFAULT_WIDTH & & newr - > height ! = DEFAULT_HEIGHT )
2008-02-16 03:40:32 +00:00
{
2009-07-17 23:11:34 +00:00
Con_Printf ( CON_NOTICE " Trying %i*%i \n " , DEFAULT_WIDTH , DEFAULT_HEIGHT ) ;
2014-05-17 15:25:02 +00:00
newr - > width = DEFAULT_WIDTH ;
newr - > height = DEFAULT_HEIGHT ;
failed = ! R_ApplyRenderer ( newr ) ;
2008-02-16 03:40:32 +00:00
}
2014-03-30 08:55:06 +00:00
for ( i = 0 ; failed & & i < sizeof ( rendererinfo ) / sizeof ( rendererinfo [ 0 ] ) ; i + + )
2004-10-10 06:32:29 +00:00
{
2014-05-17 15:25:02 +00:00
newr - > renderer = rendererinfo [ i ] ;
2016-07-12 00:40:13 +00:00
if ( newr - > renderer & & newr - > renderer ! = skip & & newr - > renderer - > rtype ! = QR_HEADLESS )
2006-01-16 13:47:56 +00:00
{
2014-05-17 15:25:02 +00:00
Con_Printf ( CON_NOTICE " Trying %s \n " , newr - > renderer - > description ) ;
failed = ! R_ApplyRenderer ( newr ) ;
2006-01-21 05:08:08 +00:00
}
2004-10-10 06:32:29 +00:00
}
2014-03-30 08:55:06 +00:00
//if we ended up resorting to our last choice (dedicated) then print some informative message about it
//fixme: on unixy systems, we should make sure we're actually printing to something (ie: that we're not running via some x11 shortcut with our stdout redirected to /dev/nul
2014-05-17 15:25:02 +00:00
if ( ! failed & & newr - > renderer = = & dedicatedrendererinfo )
2014-03-30 08:55:06 +00:00
{
Con_Printf ( CON_ERROR " Video mode switch failed. Console forced. \n \n Please change the following vars to something useable, and then use the setrenderer command. \n " ) ;
Con_Printf ( " %s: %s \n " , vid_width . name , vid_width . string ) ;
Con_Printf ( " %s: %s \n " , vid_height . name , vid_height . string ) ;
Con_Printf ( " %s: %s \n " , vid_bpp . name , vid_bpp . string ) ;
Con_Printf ( " %s: %s \n " , vid_refreshrate . name , vid_refreshrate . string ) ;
Con_Printf ( " %s: %s \n " , vid_renderer . name , vid_renderer . string ) ;
Con_Printf ( " %s: %s \n " , gl_driver . name , gl_driver . string ) ;
}
if ( failed )
Sys_Error ( " Unable to initialise any video mode \n " ) ;
2004-08-23 00:15:46 +00:00
}
}
2006-04-12 00:17:02 +00:00
Cvar_ApplyCallbacks ( CVAR_RENDERERCALLBACK ) ;
2004-12-15 19:40:06 +00:00
SCR_EndLoadingPlaque ( ) ;
2004-10-10 06:32:29 +00:00
TRACE ( ( " dbg: R_RestartRenderer_f success \n " ) ) ;
2015-07-30 16:26:15 +00:00
// M_Reinit();
2004-08-23 00:15:46 +00:00
}
2014-05-17 15:25:02 +00:00
void R_RestartRenderer_f ( void )
{
2014-10-05 20:04:11 +00:00
double time ;
2014-05-17 15:25:02 +00:00
rendererstate_t newr ;
Cvar_ApplyLatches ( CVAR_RENDERERLATCH ) ;
if ( ! R_BuildRenderstate ( & newr , vid_renderer . string ) )
{
Con_Printf ( " vid_renderer \" %s \" unsupported. Using default. \n " , vid_renderer . string ) ;
//gotta do this after main hunk is saved off.
Cmd_ExecuteString ( " setrenderer \" \" \n " , RESTRICT_LOCAL ) ;
return ;
}
2014-10-05 20:04:11 +00:00
time = Sys_DoubleTime ( ) ;
2014-05-17 15:25:02 +00:00
R_RestartRenderer ( & newr ) ;
2014-10-05 20:04:11 +00:00
Con_DPrintf ( " main thread video restart took %f secs \n " , Sys_DoubleTime ( ) - time ) ;
// COM_WorkerFullSync();
// Con_Printf("full video restart took %f secs\n", Sys_DoubleTime() - time);
2014-05-17 15:25:02 +00:00
}
2004-08-23 00:15:46 +00:00
void R_SetRenderer_f ( void )
{
2013-11-21 23:02:28 +00:00
int i ;
2005-06-22 17:10:13 +00:00
char * param = Cmd_Argv ( 1 ) ;
2013-11-21 23:02:28 +00:00
rendererstate_t newr ;
2005-06-22 17:10:13 +00:00
if ( Cmd_Argc ( ) = = 1 | | ! stricmp ( param , " help " ) )
2004-08-23 00:15:46 +00:00
{
2005-06-22 17:10:13 +00:00
Con_Printf ( " \n Valid setrenderer parameters are: \n " ) ;
for ( i = 0 ; i < sizeof ( rendererinfo ) / sizeof ( rendererinfo [ 0 ] ) ; i + + )
{
2009-11-04 21:16:50 +00:00
if ( rendererinfo [ i ] - > description )
2016-07-12 00:40:13 +00:00
Con_Printf ( " ^1%s^7: %s%s \n " , rendererinfo [ i ] - > name [ 0 ] , rendererinfo [ i ] - > description , ( currentrendererstate . renderer = = rendererinfo [ i ] ) ? " ^2(current) " : " " ) ;
2005-06-22 17:10:13 +00:00
}
2004-08-23 00:15:46 +00:00
return ;
}
2005-06-22 17:10:13 +00:00
2015-03-03 00:14:43 +00:00
Cvar_ApplyLatches ( CVAR_RENDERERLATCH ) ;
2013-11-21 23:02:28 +00:00
if ( ! R_BuildRenderstate ( & newr , param ) )
2004-08-23 00:15:46 +00:00
{
2005-06-22 17:10:13 +00:00
Con_Printf ( " setrenderer: parameter not supported (%s) \n " , param ) ;
2004-08-23 00:15:46 +00:00
return ;
}
else
{
2005-06-22 17:10:13 +00:00
if ( Cmd_Argc ( ) = = 3 )
Cvar_Set ( & vid_bpp , Cmd_Argv ( 2 ) ) ;
2004-08-23 00:15:46 +00:00
}
2005-06-22 17:10:13 +00:00
2014-05-17 15:25:02 +00:00
if ( newr . renderer - > rtype ! = QR_HEADLESS ) //don't save headless in the vid_renderer cvar via the setrenderer command. 'setrenderer headless;vid_restart' can then do what is most sane.
Cvar_Set ( & vid_renderer , param ) ;
2013-06-23 02:17:02 +00:00
if ( ! r_blockvidrestart )
2014-05-17 15:25:02 +00:00
R_RestartRenderer ( & newr ) ;
2004-08-23 00:15:46 +00:00
}
2007-05-25 22:16:29 +00:00
/*
= = = = = = = = = = = = = = = =
R_GetSpriteFrame
= = = = = = = = = = = = = = = =
*/
mspriteframe_t * R_GetSpriteFrame ( entity_t * currententity )
{
msprite_t * psprite ;
mspritegroup_t * pspritegroup ;
mspriteframe_t * pspriteframe ;
int i , numframes , frame ;
float * pintervals , fullinterval , targettime , time ;
2013-07-14 12:22:51 +00:00
psprite = currententity - > model - > meshinfo ;
2008-12-23 02:55:20 +00:00
frame = currententity - > framestate . g [ FS_REG ] . frame [ 0 ] ;
2007-05-25 22:16:29 +00:00
if ( ( frame > = psprite - > numframes ) | | ( frame < 0 ) )
{
Con_DPrintf ( " R_DrawSprite: no such frame %d (%s) \n " , frame , currententity - > model - > name ) ;
frame = 0 ;
}
if ( psprite - > frames [ frame ] . type = = SPR_SINGLE )
{
pspriteframe = psprite - > frames [ frame ] . frameptr ;
}
else if ( psprite - > frames [ frame ] . type = = SPR_ANGLED )
{
pspritegroup = ( mspritegroup_t * ) psprite - > frames [ frame ] . frameptr ;
pspriteframe = pspritegroup - > frames [ ( int ) ( ( r_refdef . viewangles [ 1 ] - currententity - > angles [ 1 ] ) / 360 * 8 + 0.5 - 4 ) & 7 ] ;
}
else
{
pspritegroup = ( mspritegroup_t * ) psprite - > frames [ frame ] . frameptr ;
pintervals = pspritegroup - > intervals ;
numframes = pspritegroup - > numframes ;
fullinterval = pintervals [ numframes - 1 ] ;
2008-12-23 02:55:20 +00:00
time = currententity - > framestate . g [ FS_REG ] . frametime [ 0 ] ;
2007-05-25 22:16:29 +00:00
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
// are positive, so we don't have to worry about division by 0
targettime = time - ( ( int ) ( time / fullinterval ) ) * fullinterval ;
for ( i = 0 ; i < ( numframes - 1 ) ; i + + )
{
if ( pintervals [ i ] > targettime )
break ;
}
pspriteframe = pspritegroup - > frames [ i ] ;
}
return pspriteframe ;
}
2010-07-11 02:22:39 +00:00
/*
2007-05-25 22:16:29 +00:00
void MYgluPerspective ( double fovx , double fovy , double zNear , double zFar )
{
2010-07-11 02:22:39 +00:00
Matrix4_Projection_Far ( r_refdef . m_projection , fovx , fovy , zNear , zFar ) ;
2007-05-25 22:16:29 +00:00
}
void GL_InfinatePerspective ( double fovx , double fovy ,
double zNear )
{
// nudge infinity in just slightly for lsb slop
float nudge = 1 ; // - 1.0 / (1<<23);
double xmin , xmax , ymin , ymax ;
ymax = zNear * tan ( fovy * M_PI / 360.0 ) ;
ymin = - ymax ;
xmax = zNear * tan ( fovx * M_PI / 360.0 ) ;
xmin = - xmax ;
r_projection_matrix [ 0 ] = ( 2 * zNear ) / ( xmax - xmin ) ;
r_projection_matrix [ 4 ] = 0 ;
r_projection_matrix [ 8 ] = ( xmax + xmin ) / ( xmax - xmin ) ;
r_projection_matrix [ 12 ] = 0 ;
r_projection_matrix [ 1 ] = 0 ;
r_projection_matrix [ 5 ] = ( 2 * zNear ) / ( ymax - ymin ) ;
r_projection_matrix [ 9 ] = ( ymax + ymin ) / ( ymax - ymin ) ;
r_projection_matrix [ 13 ] = 0 ;
r_projection_matrix [ 2 ] = 0 ;
r_projection_matrix [ 6 ] = 0 ;
r_projection_matrix [ 10 ] = - 1 * nudge ;
r_projection_matrix [ 14 ] = - 2 * zNear * nudge ;
2009-04-08 08:12:29 +00:00
2007-05-25 22:16:29 +00:00
r_projection_matrix [ 3 ] = 0 ;
r_projection_matrix [ 7 ] = 0 ;
r_projection_matrix [ 11 ] = - 1 ;
r_projection_matrix [ 15 ] = 0 ;
}
void GL_ParallelPerspective ( double xmin , double xmax , double ymax , double ymin ,
double znear , double zfar )
{
r_projection_matrix [ 0 ] = 2 / ( xmax - xmin ) ;
r_projection_matrix [ 4 ] = 0 ;
r_projection_matrix [ 8 ] = 0 ;
r_projection_matrix [ 12 ] = ( xmax + xmin ) / ( xmax - xmin ) ;
r_projection_matrix [ 1 ] = 0 ;
r_projection_matrix [ 5 ] = 2 / ( ymax - ymin ) ;
r_projection_matrix [ 9 ] = 0 ;
r_projection_matrix [ 13 ] = ( ymax + ymin ) / ( ymax - ymin ) ;
r_projection_matrix [ 2 ] = 0 ;
r_projection_matrix [ 6 ] = 0 ;
r_projection_matrix [ 10 ] = - 2 / ( zfar - znear ) ;
r_projection_matrix [ 14 ] = ( zfar + znear ) / ( zfar - znear ) ;
2009-04-08 08:12:29 +00:00
2007-05-25 22:16:29 +00:00
r_projection_matrix [ 3 ] = 0 ;
r_projection_matrix [ 7 ] = 0 ;
r_projection_matrix [ 11 ] = 0 ;
r_projection_matrix [ 15 ] = 1 ;
}
2010-07-11 02:22:39 +00:00
*/
2007-05-25 22:16:29 +00:00
/*
= = = = = = = = = = = = = = =
R_TextureAnimation
Returns the proper texture for a given time and base texture
= = = = = = = = = = = = = = =
*/
2010-08-28 17:14:38 +00:00
texture_t * R_TextureAnimation ( int frame , texture_t * base )
2007-05-25 22:16:29 +00:00
{
int reletive ;
int count ;
2010-08-28 17:14:38 +00:00
if ( frame )
2007-05-25 22:16:29 +00:00
{
if ( base - > alternate_anims )
base = base - > alternate_anims ;
}
2009-04-08 08:12:29 +00:00
2007-05-25 22:16:29 +00:00
if ( ! base - > anim_total )
return base ;
reletive = ( int ) ( cl . time * 10 ) % base - > anim_total ;
2009-04-08 08:12:29 +00:00
count = 0 ;
2007-05-25 22:16:29 +00:00
while ( base - > anim_min > reletive | | base - > anim_max < = reletive )
{
base = base - > anim_next ;
if ( ! base )
Sys_Error ( " R_TextureAnimation: broken cycle " ) ;
if ( + + count > 100 )
Sys_Error ( " R_TextureAnimation: infinite cycle " ) ;
}
return base ;
}
2013-12-08 20:06:55 +00:00
texture_t * R_TextureAnimation_Q2 ( texture_t * base )
{
int reletive ;
int frame ;
if ( ! base - > anim_total )
return base ;
//this is only ever used on world. everything other than rtlights have proper batches.
frame = cl . time * 2 ; //q2 is lame
reletive = frame % base - > anim_total ;
while ( reletive - - > 0 )
{
base = base - > anim_next ;
if ( ! base )
Sys_Error ( " R_TextureAnimation: broken cycle " ) ;
}
return base ;
}
2007-05-25 22:16:29 +00:00
2012-02-12 08:32:39 +00:00
unsigned int r_viewcontents ;
2007-05-25 23:03:49 +00:00
mleaf_t * r_viewleaf , * r_oldviewleaf ;
mleaf_t * r_viewleaf2 , * r_oldviewleaf2 ;
int r_viewcluster , r_viewcluster2 , r_oldviewcluster , r_oldviewcluster2 ;
int r_visframecount ;
mleaf_t * r_vischain ; // linked list of visible leafs
2016-07-12 00:40:13 +00:00
static FTE_ALIGN ( 4 ) qbyte curframevis [ R_MAX_RECURSE ] [ MAX_MAP_LEAFS / 8 ] ;
2007-05-25 22:16:29 +00:00
/*
= = = = = = = = = = = = = = =
R_MarkLeaves
= = = = = = = = = = = = = = =
*/
2009-03-03 01:52:30 +00:00
# ifdef Q3BSPS
2009-11-04 21:16:50 +00:00
qbyte * R_MarkLeaves_Q3 ( void )
2007-05-25 22:16:29 +00:00
{
2014-05-30 16:37:20 +00:00
static qbyte * cvis [ R_MAX_RECURSE ] ;
qbyte * vis ;
2007-05-25 22:16:29 +00:00
int i ;
2009-03-03 01:52:30 +00:00
int cluster ;
mleaf_t * leaf ;
2012-04-24 07:59:11 +00:00
mnode_t * node ;
2014-05-30 16:37:20 +00:00
int portal = r_refdef . recurse ;
2009-03-03 01:52:30 +00:00
2015-09-01 04:45:15 +00:00
if ( ! portal )
{
if ( r_oldviewcluster = = r_viewcluster & & ! r_novis . value & & r_viewcluster ! = - 1 )
return cvis [ portal ] ;
}
2007-05-25 22:16:29 +00:00
2009-03-03 01:52:30 +00:00
// development aid to let you run around and see exactly where
// the pvs ends
2007-05-25 22:16:29 +00:00
// if (r_lockpvs->value)
// return;
2009-03-03 01:52:30 +00:00
r_vischain = NULL ;
r_visframecount + + ;
r_oldviewcluster = r_viewcluster ;
2007-05-25 22:16:29 +00:00
2010-05-01 22:47:47 +00:00
if ( r_novis . ival | | r_viewcluster = = - 1 | | ! cl . worldmodel - > vis )
2009-03-03 01:52:30 +00:00
{
2013-12-10 20:53:31 +00:00
vis = NULL ;
2009-03-03 01:52:30 +00:00
// mark everything
for ( i = 0 , leaf = cl . worldmodel - > leafs ; i < cl . worldmodel - > numleafs ; i + + , leaf + + )
2007-05-25 22:16:29 +00:00
{
2015-02-09 03:37:41 +00:00
// if (!leaf->nummarksurfaces)
// {
// continue;
// }
2007-05-25 22:16:29 +00:00
2012-07-07 05:17:43 +00:00
# if 1
for ( node = ( mnode_t * ) leaf ; node ; node = node - > parent )
{
if ( node - > visframe = = r_visframecount )
break ;
node - > visframe = r_visframecount ;
}
# else
2009-03-03 01:52:30 +00:00
leaf - > visframe = r_visframecount ;
leaf - > vischain = r_vischain ;
r_vischain = leaf ;
2012-07-07 05:17:43 +00:00
# endif
2009-03-03 01:52:30 +00:00
}
}
else
{
2014-05-30 16:37:20 +00:00
vis = CM_ClusterPVS ( cl . worldmodel , r_viewcluster , curframevis [ portal ] , sizeof ( curframevis ) ) ;
2007-05-25 22:16:29 +00:00
for ( i = 0 , leaf = cl . worldmodel - > leafs ; i < cl . worldmodel - > numleafs ; i + + , leaf + + )
{
cluster = leaf - > cluster ;
2015-02-09 03:37:41 +00:00
if ( cluster = = - 1 ) // || !leaf->nummarksurfaces)
2009-03-03 01:52:30 +00:00
{
2007-05-25 22:16:29 +00:00
continue ;
}
2009-03-03 01:52:30 +00:00
if ( vis [ cluster > > 3 ] & ( 1 < < ( cluster & 7 ) ) )
{
2012-04-24 07:59:11 +00:00
# if 1
for ( node = ( mnode_t * ) leaf ; node ; node = node - > parent )
{
if ( node - > visframe = = r_visframecount )
break ;
node - > visframe = r_visframecount ;
}
# else
2007-05-25 22:16:29 +00:00
leaf - > visframe = r_visframecount ;
leaf - > vischain = r_vischain ;
r_vischain = leaf ;
2012-04-24 07:59:11 +00:00
# endif
2007-05-25 22:16:29 +00:00
}
}
2014-05-30 16:37:20 +00:00
cvis [ portal ] = vis ;
2007-05-25 22:16:29 +00:00
}
2009-11-04 21:16:50 +00:00
return vis ;
2009-03-03 01:52:30 +00:00
}
2007-05-25 22:16:29 +00:00
# endif
# ifdef Q2BSPS
2009-11-04 21:16:50 +00:00
qbyte * R_MarkLeaves_Q2 ( void )
2009-03-03 01:52:30 +00:00
{
2014-05-30 16:37:20 +00:00
static qbyte * cvis [ R_MAX_RECURSE ] ;
2009-03-03 01:52:30 +00:00
mnode_t * node ;
int i ;
int cluster ;
mleaf_t * leaf ;
2014-05-30 16:37:20 +00:00
qbyte * vis ;
2009-03-03 01:52:30 +00:00
2009-11-04 21:16:50 +00:00
int c ;
2014-05-30 16:37:20 +00:00
int portal = r_refdef . recurse ;
2007-05-25 22:16:29 +00:00
2012-07-05 19:42:36 +00:00
if ( r_refdef . forcevis )
2009-11-04 21:16:50 +00:00
{
2014-05-30 16:37:20 +00:00
vis = cvis [ portal ] = r_refdef . forcedvis ;
2009-11-04 21:16:50 +00:00
2014-05-30 16:37:20 +00:00
r_oldviewcluster = - 1 ;
r_oldviewcluster2 = - 1 ;
2012-07-05 19:42:36 +00:00
}
else
2009-11-04 21:16:50 +00:00
{
2014-05-30 16:37:20 +00:00
vis = cvis [ portal ] ;
if ( ! portal )
{
if ( r_oldviewcluster = = r_viewcluster & & r_oldviewcluster2 = = r_viewcluster2 )
return vis ;
2012-07-05 19:42:36 +00:00
2014-05-30 16:37:20 +00:00
r_oldviewcluster = r_viewcluster ;
r_oldviewcluster2 = r_viewcluster2 ;
}
else
{
r_oldviewcluster = - 1 ;
r_oldviewcluster2 = - 1 ;
}
2012-07-05 19:42:36 +00:00
if ( r_novis . ival = = 2 )
return vis ;
if ( r_novis . ival | | r_viewcluster = = - 1 | | ! cl . worldmodel - > vis )
{
// mark everything
for ( i = 0 ; i < cl . worldmodel - > numleafs ; i + + )
cl . worldmodel - > leafs [ i ] . visframe = r_visframecount ;
for ( i = 0 ; i < cl . worldmodel - > numnodes ; i + + )
cl . worldmodel - > nodes [ i ] . visframe = r_visframecount ;
return vis ;
}
2014-05-30 16:37:20 +00:00
vis = CM_ClusterPVS ( cl . worldmodel , r_viewcluster , curframevis [ portal ] , sizeof ( curframevis ) ) ;
2012-07-05 19:42:36 +00:00
// may have to combine two clusters because of solid water boundaries
if ( r_viewcluster2 ! = r_viewcluster )
{
vis = CM_ClusterPVS ( cl . worldmodel , r_viewcluster2 , NULL , sizeof ( curframevis ) ) ;
2015-09-01 04:45:15 +00:00
c = ( cl . worldmodel - > numclusters + 31 ) / 32 ;
2012-07-05 19:42:36 +00:00
for ( i = 0 ; i < c ; i + + )
2014-05-30 16:37:20 +00:00
( ( int * ) curframevis [ portal ] ) [ i ] | = ( ( int * ) vis ) [ i ] ;
vis = curframevis [ portal ] ;
2012-07-05 19:42:36 +00:00
}
2014-05-30 16:37:20 +00:00
cvis [ portal ] = vis ;
2009-11-04 21:16:50 +00:00
}
2012-07-05 19:42:36 +00:00
r_visframecount + + ;
2009-11-04 21:16:50 +00:00
for ( i = 0 , leaf = cl . worldmodel - > leafs ; i < cl . worldmodel - > numleafs ; i + + , leaf + + )
{
cluster = leaf - > cluster ;
if ( cluster = = - 1 )
continue ;
if ( vis [ cluster > > 3 ] & ( 1 < < ( cluster & 7 ) ) )
2007-05-25 22:16:29 +00:00
{
2009-11-04 21:16:50 +00:00
node = ( mnode_t * ) leaf ;
do
{
if ( node - > visframe = = r_visframecount )
break ;
node - > visframe = r_visframecount ;
node = node - > parent ;
} while ( node ) ;
2007-05-25 22:16:29 +00:00
}
2009-11-04 21:16:50 +00:00
}
return vis ;
}
# endif
2014-05-30 16:37:20 +00:00
#if 0
2009-11-04 21:16:50 +00:00
qbyte * R_CalcVis_Q1 ( void )
{
unsigned int i ;
static qbyte * vis ;
r_visframecount + + ;
if ( r_oldviewleaf = = r_viewleaf & & r_oldviewleaf2 = = r_viewleaf2 )
{
}
else
{
r_oldviewleaf = r_viewleaf ;
r_oldviewleaf2 = r_viewleaf2 ;
2007-05-25 22:16:29 +00:00
2010-05-01 22:47:47 +00:00
if ( r_novis . ival & 1 )
2007-05-25 22:16:29 +00:00
{
2009-11-04 21:16:50 +00:00
vis = curframevis ;
memset ( vis , 0xff , ( cl . worldmodel - > numleafs + 7 ) > > 3 ) ;
2007-05-25 22:16:29 +00:00
}
2009-11-04 21:16:50 +00:00
else if ( r_viewleaf2 & & r_viewleaf2 ! = r_viewleaf )
2007-05-25 22:16:29 +00:00
{
2009-11-04 21:16:50 +00:00
int c ;
Q1BSP_LeafPVS ( cl . worldmodel , r_viewleaf2 , curframevis , sizeof ( curframevis ) ) ;
vis = Q1BSP_LeafPVS ( cl . worldmodel , r_viewleaf , NULL , sizeof ( curframevis ) ) ;
2014-05-23 02:02:51 +00:00
c = ( cl . worldmodel - > numclusters + 31 ) / 32 ;
2009-11-04 21:16:50 +00:00
for ( i = 0 ; i < c ; i + + )
( ( int * ) curframevis ) [ i ] | = ( ( int * ) vis ) [ i ] ;
vis = curframevis ;
2007-05-25 22:16:29 +00:00
}
2009-11-04 21:16:50 +00:00
else
vis = Q1BSP_LeafPVS ( cl . worldmodel , r_viewleaf , curframevis , sizeof ( curframevis ) ) ;
2007-05-25 22:16:29 +00:00
}
2009-11-04 21:16:50 +00:00
return vis ;
}
2014-05-30 16:37:20 +00:00
# endif
2007-05-25 22:16:29 +00:00
2015-10-11 11:34:58 +00:00
qbyte * R_MarkLeaves_Q1 ( qboolean getvisonly )
2009-03-03 01:52:30 +00:00
{
2013-12-29 22:48:28 +00:00
static qbyte * cvis [ R_MAX_RECURSE ] ;
2012-09-30 05:52:03 +00:00
qbyte * vis ;
2009-03-03 01:52:30 +00:00
mnode_t * node ;
int i ;
2013-12-29 22:48:28 +00:00
int portal = r_refdef . recurse ;
2012-09-30 05:52:03 +00:00
//for portals to work, we need two sets of any pvs caches
//this means lights can still check pvs at the end of the frame despite recursing in the mean time
//however, we still need to invalidate the cache because we only have one 'visframe' field in nodes.
2009-03-03 01:52:30 +00:00
2012-07-05 19:42:36 +00:00
if ( r_refdef . forcevis )
2007-05-25 22:16:29 +00:00
{
2012-09-30 05:52:03 +00:00
vis = cvis [ portal ] = r_refdef . forcedvis ;
2012-07-05 19:42:36 +00:00
r_oldviewleaf = NULL ;
r_oldviewleaf2 = NULL ;
2007-05-25 22:16:29 +00:00
}
else
2011-04-30 17:21:10 +00:00
{
2012-09-30 05:52:03 +00:00
if ( ! portal )
{
if ( ( ( r_oldviewleaf = = r_viewleaf & & r_oldviewleaf2 = = r_viewleaf2 ) & & ! r_novis . ival ) | | r_novis . ival & 2 )
return cvis [ portal ] ;
2012-07-05 19:42:36 +00:00
2012-09-30 05:52:03 +00:00
r_oldviewleaf = r_viewleaf ;
r_oldviewleaf2 = r_viewleaf2 ;
}
else
{
r_oldviewleaf = NULL ;
r_oldviewleaf2 = NULL ;
}
2012-07-05 19:42:36 +00:00
if ( r_novis . ival )
{
2014-05-30 16:37:20 +00:00
vis = cvis [ portal ] = curframevis [ portal ] ;
memset ( curframevis [ portal ] , 0xff , ( cl . worldmodel - > numclusters + 7 ) > > 3 ) ;
2012-09-30 05:52:03 +00:00
r_oldviewleaf = NULL ;
r_oldviewleaf2 = NULL ;
2012-07-05 19:42:36 +00:00
}
else if ( r_viewleaf2 & & r_viewleaf2 ! = r_viewleaf )
{
int c ;
2014-05-30 16:37:20 +00:00
Q1BSP_LeafPVS ( cl . worldmodel , r_viewleaf2 , curframevis [ portal ] , sizeof ( curframevis [ portal ] ) ) ;
2012-09-30 05:52:03 +00:00
vis = cvis [ portal ] = Q1BSP_LeafPVS ( cl . worldmodel , r_viewleaf , NULL , 0 ) ;
2014-05-23 02:02:51 +00:00
c = ( cl . worldmodel - > numclusters + 31 ) / 32 ;
2012-07-05 19:42:36 +00:00
for ( i = 0 ; i < c ; i + + )
2014-05-30 16:37:20 +00:00
( ( int * ) curframevis [ portal ] ) [ i ] | = ( ( int * ) vis ) [ i ] ;
2012-07-05 19:42:36 +00:00
2014-05-30 16:37:20 +00:00
vis = cvis [ portal ] = curframevis [ portal ] ;
2012-07-05 19:42:36 +00:00
}
else
{
2014-05-30 16:37:20 +00:00
vis = cvis [ portal ] = Q1BSP_LeafPVS ( cl . worldmodel , r_viewleaf , curframevis [ portal ] , sizeof ( curframevis [ portal ] ) ) ;
2012-07-05 19:42:36 +00:00
}
2011-04-30 17:21:10 +00:00
}
2009-04-08 08:12:29 +00:00
2012-07-05 19:42:36 +00:00
r_visframecount + + ;
2015-10-11 11:34:58 +00:00
if ( getvisonly )
return vis ;
else if ( r_viewleaf & & r_viewleaf - > contents = = Q1CONTENTS_SOLID )
2007-05-25 22:16:29 +00:00
{
2015-01-09 06:32:48 +00:00
//to improve spectating, when the camera is in a wall, we ignore any sky leafs.
//this prevents seeing the upwards-facing sky surfaces within the sky volumes.
//this will not affect inwards facing sky, so sky will basically appear as though it is identical to solid brushes.
for ( i = 0 ; i < cl . worldmodel - > numclusters ; i + + )
2007-05-25 22:16:29 +00:00
{
2015-01-09 06:32:48 +00:00
if ( vis [ i > > 3 ] & ( 1 < < ( i & 7 ) ) )
2007-05-25 22:16:29 +00:00
{
2015-01-09 06:32:48 +00:00
if ( cl . worldmodel - > leafs [ i + 1 ] . contents = = Q1CONTENTS_SKY )
continue ;
node = ( mnode_t * ) & cl . worldmodel - > leafs [ i + 1 ] ;
do
{
if ( node - > visframe = = r_visframecount )
break ;
node - > visframe = r_visframecount ;
node = node - > parent ;
} while ( node ) ;
}
}
}
else
{
for ( i = 0 ; i < cl . worldmodel - > numclusters ; i + + )
{
if ( vis [ i > > 3 ] & ( 1 < < ( i & 7 ) ) )
{
node = ( mnode_t * ) & cl . worldmodel - > leafs [ i + 1 ] ;
do
{
if ( node - > visframe = = r_visframecount )
break ;
node - > visframe = r_visframecount ;
node = node - > parent ;
} while ( node ) ;
}
2007-05-25 22:16:29 +00:00
}
}
2009-11-04 21:16:50 +00:00
return vis ;
2007-05-25 22:16:29 +00:00
}
/*
= = = = = = = = = = = = = = = = =
R_CullBox
Returns true if the box is completely outside the frustom
= = = = = = = = = = = = = = = = =
*/
qboolean R_CullBox ( vec3_t mins , vec3_t maxs )
{
2013-10-29 17:38:22 +00:00
//this isn't very precise.
//checking each plane individually can be problematic
//if you have a large object behind the view, it can cross multiple planes, and be infront of each one at some point, yet should still be outside the view.
//this is quite noticable with terrain where the potential height of a section is essentually infinite.
//note that this is not a concern for spheres, just boxes.
2007-05-25 22:16:29 +00:00
int i ;
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < r_refdef . frustum_numplanes ; i + + )
if ( BOX_ON_PLANE_SIDE ( mins , maxs , & r_refdef . frustum [ i ] ) = = 2 )
2007-05-25 22:16:29 +00:00
return true ;
return false ;
}
qboolean R_CullSphere ( vec3_t org , float radius )
{
//four frustrum planes all point inwards in an expanding 'cone'.
int i ;
float d ;
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < r_refdef . frustum_numplanes ; i + + )
2007-05-25 22:16:29 +00:00
{
2013-10-29 17:38:22 +00:00
d = DotProduct ( r_refdef . frustum [ i ] . normal , org ) - r_refdef . frustum [ i ] . dist ;
2007-05-25 22:16:29 +00:00
if ( d < = - radius )
return true ;
}
return false ;
}
qboolean R_CullEntityBox ( entity_t * e , vec3_t modmins , vec3_t modmaxs )
{
int i ;
vec3_t wmin , wmax ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
# if 1
float mrad = 0 , v ;
2011-11-09 04:14:38 +00:00
2012-07-20 01:46:05 +00:00
if ( e - > axis [ 0 ] [ 0 ] = = 1 & & e - > axis [ 0 ] [ 1 ] = = 0 & & e - > axis [ 0 ] [ 2 ] = = 0 & &
e - > axis [ 1 ] [ 0 ] = = 0 & & e - > axis [ 1 ] [ 1 ] = = 1 & & e - > axis [ 1 ] [ 2 ] = = 0 & &
e - > axis [ 2 ] [ 0 ] = = 0 & & e - > axis [ 2 ] [ 1 ] = = 0 & & e - > axis [ 2 ] [ 2 ] = = 1 )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
2011-11-09 04:14:38 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
2012-07-20 01:46:05 +00:00
wmin [ i ] = e - > origin [ i ] + modmins [ i ] * e - > scale ;
wmax [ i ] = e - > origin [ i ] + modmaxs [ i ] * e - > scale ;
2011-11-09 04:14:38 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
2011-11-09 04:14:38 +00:00
else
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
2011-11-09 04:14:38 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
v = fabs ( modmins [ i ] ) ;
if ( mrad < v )
mrad = v ;
v = fabs ( modmaxs [ i ] ) ;
if ( mrad < v )
mrad = v ;
}
2012-07-20 01:46:05 +00:00
mrad * = e - > scale ;
2011-11-09 04:14:38 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
wmin [ i ] = e - > origin [ i ] - mrad ;
wmax [ i ] = e - > origin [ i ] + mrad ;
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
# else
2007-05-25 22:16:29 +00:00
float fmin , fmax ;
//convert the model's bbox to the expanded maximum size of the entity, as drawn with this model.
//The result is an axial box, which we pass to R_CullBox
for ( i = 0 ; i < 3 ; i + + )
{
fmin = DotProduct ( modmins , e - > axis [ i ] ) ;
fmax = DotProduct ( modmaxs , e - > axis [ i ] ) ;
if ( fmin > - 16 )
fmin = - 16 ;
if ( fmax < 16 )
fmax = 16 ;
if ( fmin < fmax )
{
wmin [ i ] = e - > origin [ i ] + fmin ;
wmax [ i ] = e - > origin [ i ] + fmax ;
}
else
{ //box went inside out
wmin [ i ] = e - > origin [ i ] + fmax ;
wmax [ i ] = e - > origin [ i ] + fmin ;
}
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
# endif
2007-05-25 22:16:29 +00:00
return R_CullBox ( wmin , wmax ) ;
}
int SignbitsForPlane ( mplane_t * out )
{
int bits , j ;
// for fast box on planeside test
bits = 0 ;
for ( j = 0 ; j < 3 ; j + + )
{
if ( out - > normal [ j ] < 0 )
bits | = 1 < < j ;
}
return bits ;
}
# if 1
2009-11-04 21:16:50 +00:00
void R_SetFrustum ( float projmat [ 16 ] , float viewmat [ 16 ] )
2007-05-25 22:16:29 +00:00
{
float scale ;
int i ;
float mvp [ 16 ] ;
2010-05-01 22:47:47 +00:00
if ( r_novis . ival & 4 )
2007-05-25 22:16:29 +00:00
return ;
2009-11-04 21:16:50 +00:00
Matrix4_Multiply ( projmat , viewmat , mvp ) ;
2007-05-25 22:16:29 +00:00
for ( i = 0 ; i < 4 ; i + + )
{
if ( i & 1 )
{
2013-10-29 17:38:22 +00:00
r_refdef . frustum [ i ] . normal [ 0 ] = mvp [ 3 ] + mvp [ 0 + i / 2 ] ;
r_refdef . frustum [ i ] . normal [ 1 ] = mvp [ 7 ] + mvp [ 4 + i / 2 ] ;
r_refdef . frustum [ i ] . normal [ 2 ] = mvp [ 11 ] + mvp [ 8 + i / 2 ] ;
r_refdef . frustum [ i ] . dist = mvp [ 15 ] + mvp [ 12 + i / 2 ] ;
2007-05-25 22:16:29 +00:00
}
else
{
2013-10-29 17:38:22 +00:00
r_refdef . frustum [ i ] . normal [ 0 ] = mvp [ 3 ] - mvp [ 0 + i / 2 ] ;
r_refdef . frustum [ i ] . normal [ 1 ] = mvp [ 7 ] - mvp [ 4 + i / 2 ] ;
r_refdef . frustum [ i ] . normal [ 2 ] = mvp [ 11 ] - mvp [ 8 + i / 2 ] ;
r_refdef . frustum [ i ] . dist = mvp [ 15 ] - mvp [ 12 + i / 2 ] ;
2007-05-25 22:16:29 +00:00
}
2013-10-29 17:38:22 +00:00
scale = 1 / sqrt ( DotProduct ( r_refdef . frustum [ i ] . normal , r_refdef . frustum [ i ] . normal ) ) ;
r_refdef . frustum [ i ] . normal [ 0 ] * = scale ;
r_refdef . frustum [ i ] . normal [ 1 ] * = scale ;
r_refdef . frustum [ i ] . normal [ 2 ] * = scale ;
r_refdef . frustum [ i ] . dist * = - scale ;
2007-05-25 22:16:29 +00:00
2013-10-29 17:38:22 +00:00
r_refdef . frustum [ i ] . type = PLANE_ANYZ ;
r_refdef . frustum [ i ] . signbits = SignbitsForPlane ( & r_refdef . frustum [ i ] ) ;
2007-05-25 22:16:29 +00:00
}
2012-04-09 19:12:12 +00:00
2013-10-29 17:38:22 +00:00
r_refdef . frustum_numplanes = 4 ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 0 ] = mvp [ 3 ] - mvp [ 2 ] ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 1 ] = mvp [ 7 ] - mvp [ 6 ] ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 2 ] = mvp [ 11 ] - mvp [ 10 ] ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . dist = mvp [ 15 ] - mvp [ 14 ] ;
scale = 1 / sqrt ( DotProduct ( r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal , r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal ) ) ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 0 ] * = scale ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 1 ] * = scale ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 2 ] * = scale ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . dist * = - scale ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . type = PLANE_ANYZ ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . signbits = SignbitsForPlane ( & r_refdef . frustum [ 4 ] ) ;
r_refdef . frustum_numplanes + + ;
2015-11-18 07:37:39 +00:00
r_refdef . frustum_numworldplanes = r_refdef . frustum_numplanes ;
2012-04-09 19:12:12 +00:00
//do far plane
2014-03-30 08:55:06 +00:00
//fog will logically not actually reach 0, though precision issues will force it. we cut off at an exponant of -500
2015-11-18 07:37:39 +00:00
if ( r_refdef . globalfog . density )
2012-04-09 19:12:12 +00:00
{
float culldist ;
float fog ;
extern cvar_t r_fog_exp2 ;
/*Documentation: the GLSL/GL will do this maths:
float dist = 1024 ;
if ( r_fog_exp2 . ival )
2014-03-30 08:55:06 +00:00
fog = pow ( 2 , - r_refdef . globalfog . density * r_refdef . globalfog . density * dist * dist * 1.442695 ) ;
2012-04-09 19:12:12 +00:00
else
2014-03-30 08:55:06 +00:00
fog = pow ( 2 , - r_refdef . globalfog . density * dist * 1.442695 ) ;
2012-04-09 19:12:12 +00:00
*/
//the fog factor cut-off where its pointless to allow it to get closer to 0 (0 is technically infinite)
fog = 2 / 255.0f ;
//figure out the eyespace distance required to reach that fog value
culldist = log ( fog ) ;
if ( r_fog_exp2 . ival )
2014-03-30 08:55:06 +00:00
culldist = sqrt ( culldist / ( - r_refdef . globalfog . density * r_refdef . globalfog . density ) ) ;
2012-04-09 19:12:12 +00:00
else
2014-03-30 08:55:06 +00:00
culldist = culldist / ( - r_refdef . globalfog . density ) ;
2012-04-09 19:12:12 +00:00
//anything drawn beyond this point is fully obscured by fog
2013-10-29 17:38:22 +00:00
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 0 ] = mvp [ 3 ] - mvp [ 2 ] ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 1 ] = mvp [ 7 ] - mvp [ 6 ] ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 2 ] = mvp [ 11 ] - mvp [ 10 ] ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . dist = mvp [ 15 ] - mvp [ 14 ] ;
scale = 1 / sqrt ( DotProduct ( r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal , r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal ) ) ;
2015-11-18 07:37:39 +00:00
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 0 ] * = - scale ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 1 ] * = - scale ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal [ 2 ] * = - scale ;
2013-10-29 17:38:22 +00:00
// r_refdef.frustum[r_refdef.frustum_numplanes].dist *= scale;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . dist = DotProduct ( r_origin , r_refdef . frustum [ r_refdef . frustum_numplanes ] . normal ) - culldist ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . type = PLANE_ANYZ ;
r_refdef . frustum [ r_refdef . frustum_numplanes ] . signbits = SignbitsForPlane ( & r_refdef . frustum [ r_refdef . frustum_numplanes ] ) ;
r_refdef . frustum_numplanes + + ;
2012-04-09 19:12:12 +00:00
}
2007-05-25 22:16:29 +00:00
}
# else
void R_SetFrustum ( void )
{
int i ;
2010-05-01 22:47:47 +00:00
if ( r_novis . ival & 4 )
2007-05-25 22:16:29 +00:00
return ;
/* removed - assumes fov_x == fov_y
2009-04-08 08:12:29 +00:00
if ( r_refdef . fov_x = = 90 )
2007-05-25 22:16:29 +00:00
{
// front side is visible
VectorAdd ( vpn , vright , frustum [ 0 ] . normal ) ;
VectorSubtract ( vpn , vright , frustum [ 1 ] . normal ) ;
VectorAdd ( vpn , vup , frustum [ 2 ] . normal ) ;
VectorSubtract ( vpn , vup , frustum [ 3 ] . normal ) ;
}
else
*/
{
// rotate VPN right by FOV_X/2 degrees
RotatePointAroundVector ( frustum [ 0 ] . normal , vup , vpn , - ( 90 - r_refdef . fov_x / 2 ) ) ;
// rotate VPN left by FOV_X/2 degrees
RotatePointAroundVector ( frustum [ 1 ] . normal , vup , vpn , 90 - r_refdef . fov_x / 2 ) ;
// rotate VPN up by FOV_X/2 degrees
RotatePointAroundVector ( frustum [ 2 ] . normal , vright , vpn , 90 - r_refdef . fov_y / 2 ) ;
// rotate VPN down by FOV_X/2 degrees
RotatePointAroundVector ( frustum [ 3 ] . normal , vright , vpn , - ( 90 - r_refdef . fov_y / 2 ) ) ;
}
for ( i = 0 ; i < 4 ; i + + )
{
frustum [ i ] . type = PLANE_ANYZ ;
frustum [ i ] . dist = DotProduct ( r_origin , frustum [ i ] . normal ) ;
frustum [ i ] . signbits = SignbitsForPlane ( & frustum [ i ] ) ;
}
}
# endif
2009-11-04 21:16:50 +00:00
# include "glquake.h"
//we could go for nice smooth round particles... but then we would loose a little bit of the chaotic nature of the particles.
static qbyte dottexture [ 8 ] [ 8 ] =
{
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 } ,
{ 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 } ,
{ 0 , 1 , 1 , 1 , 1 , 1 , 1 , 0 } ,
{ 0 , 1 , 1 , 1 , 1 , 1 , 1 , 0 } ,
{ 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 } ,
{ 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ,
} ;
static qbyte exptexture [ 16 ] [ 16 ] =
{
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 3 , 1 , 1 , 2 , 1 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 1 , 1 , 1 , 1 , 4 , 4 , 4 , 5 , 4 , 2 , 1 , 1 , 0 } ,
{ 0 , 0 , 1 , 1 , 6 , 5 , 5 , 8 , 6 , 8 , 3 , 6 , 3 , 2 , 1 , 0 } ,
{ 0 , 0 , 1 , 5 , 6 , 7 , 5 , 6 , 8 , 8 , 8 , 3 , 3 , 1 , 0 , 0 } ,
{ 0 , 0 , 0 , 1 , 6 , 8 , 9 , 9 , 9 , 9 , 4 , 6 , 3 , 1 , 0 , 0 } ,
{ 0 , 0 , 2 , 1 , 7 , 7 , 9 , 9 , 9 , 9 , 5 , 3 , 1 , 0 , 0 , 0 } ,
{ 0 , 0 , 2 , 4 , 6 , 8 , 9 , 9 , 9 , 9 , 8 , 6 , 1 , 0 , 0 , 0 } ,
{ 0 , 0 , 2 , 2 , 3 , 5 , 6 , 8 , 9 , 8 , 8 , 4 , 4 , 1 , 0 , 0 } ,
{ 0 , 0 , 1 , 2 , 4 , 1 , 8 , 7 , 8 , 8 , 6 , 5 , 4 , 1 , 0 , 0 } ,
{ 0 , 1 , 1 , 1 , 7 , 8 , 1 , 6 , 7 , 5 , 4 , 7 , 1 , 0 , 0 , 0 } ,
{ 0 , 1 , 2 , 1 , 1 , 5 , 1 , 3 , 4 , 3 , 1 , 1 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ,
} ;
texid_t particletexture ; // little dot for particles
texid_t particlecqtexture ; // little dot for particles
texid_t explosiontexture ;
texid_t balltexture ;
texid_t beamtexture ;
texid_t ptritexture ;
void R_InitParticleTexture ( void )
{
# define PARTICLETEXTURESIZE 64
int x , y ;
float dx , dy , d ;
qbyte data [ PARTICLETEXTURESIZE * PARTICLETEXTURESIZE ] [ 4 ] ;
//
// particle texture
//
for ( x = 0 ; x < 8 ; x + + )
{
for ( y = 0 ; y < 8 ; y + + )
{
data [ y * 8 + x ] [ 0 ] = 255 ;
data [ y * 8 + x ] [ 1 ] = 255 ;
data [ y * 8 + x ] [ 2 ] = 255 ;
data [ y * 8 + x ] [ 3 ] = dottexture [ x ] [ y ] * 255 ;
}
}
2014-10-05 20:04:11 +00:00
TEXASSIGN ( particletexture , R_LoadTexture32 ( " dotparticle " , 8 , 8 , data , IF_NOMIPMAP | IF_NOPICMIP ) ) ;
2009-11-04 21:16:50 +00:00
//
// particle triangle texture
//
// clear to transparent white
for ( x = 0 ; x < 32 * 32 ; x + + )
{
data [ x ] [ 0 ] = 255 ;
data [ x ] [ 1 ] = 255 ;
data [ x ] [ 2 ] = 255 ;
data [ x ] [ 3 ] = 0 ;
}
//draw a circle in the top left.
for ( x = 0 ; x < 16 ; x + + )
{
for ( y = 0 ; y < 16 ; y + + )
{
if ( ( x - 7.5 ) * ( x - 7.5 ) + ( y - 7.5 ) * ( y - 7.5 ) < = 8 * 8 )
data [ y * 32 + x ] [ 3 ] = 255 ;
}
}
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
particlecqtexture = Image_GetTexture ( " classicparticle " , " particles " , IF_NOMIPMAP | IF_NOPICMIP , data , NULL , 32 , 32 , TF_RGBA32 ) ;
2009-11-04 21:16:50 +00:00
2014-08-15 02:20:41 +00:00
//draw a square in the top left. still a triangle.
for ( x = 0 ; x < 16 ; x + + )
{
for ( y = 0 ; y < 16 ; y + + )
{
data [ y * 32 + x ] [ 3 ] = 255 ;
}
}
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
Image_GetTexture ( " classicparticle_square " , " particles " , IF_NOMIPMAP | IF_NOPICMIP , data , NULL , 32 , 32 , TF_RGBA32 ) ;
2009-11-04 21:16:50 +00:00
for ( x = 0 ; x < 16 ; x + + )
{
for ( y = 0 ; y < 16 ; y + + )
{
data [ y * 16 + x ] [ 0 ] = 255 ;
data [ y * 16 + x ] [ 1 ] = 255 ;
data [ y * 16 + x ] [ 2 ] = 255 ;
data [ y * 16 + x ] [ 3 ] = exptexture [ x ] [ y ] * 255 / 9.0 ;
}
}
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
explosiontexture = Image_GetTexture ( " fte_fuzzyparticle " , " particles " , IF_NOMIPMAP | IF_NOPICMIP , data , NULL , 16 , 16 , TF_RGBA32 ) ;
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
for ( x = 0 ; x < 16 ; x + + )
{
for ( y = 0 ; y < 16 ; y + + )
{
data [ y * 16 + x ] [ 0 ] = exptexture [ x ] [ y ] * 255 / 9.0 ;
data [ y * 16 + x ] [ 1 ] = exptexture [ x ] [ y ] * 255 / 9.0 ;
data [ y * 16 + x ] [ 2 ] = exptexture [ x ] [ y ] * 255 / 9.0 ;
data [ y * 16 + x ] [ 3 ] = exptexture [ x ] [ y ] * 255 / 9.0 ;
}
}
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
Image_GetTexture ( " fte_bloodparticle " , " particles " , IF_NOMIPMAP | IF_NOPICMIP , data , NULL , 16 , 16 , TF_RGBA32 ) ;
for ( x = 0 ; x < 16 ; x + + )
{
for ( y = 0 ; y < 16 ; y + + )
{
data [ y * 16 + x ] [ 0 ] = min ( 255 , exptexture [ x ] [ y ] * 255 / 9.0 ) ;
data [ y * 16 + x ] [ 1 ] = min ( 255 , exptexture [ x ] [ y ] * 255 / 5.0 ) ;
data [ y * 16 + x ] [ 2 ] = min ( 255 , exptexture [ x ] [ y ] * 255 / 5.0 ) ;
data [ y * 16 + x ] [ 3 ] = 255 ;
}
}
Image_GetTexture ( " fte_blooddecal " , " particles " , IF_NOMIPMAP | IF_NOPICMIP , data , NULL , 16 , 16 , TF_RGBA32 ) ;
2009-11-04 21:16:50 +00:00
memset ( data , 255 , sizeof ( data ) ) ;
for ( y = 0 ; y < PARTICLETEXTURESIZE ; y + + )
{
dy = ( y - 0.5f * PARTICLETEXTURESIZE ) / ( PARTICLETEXTURESIZE * 0.5f - 1 ) ;
for ( x = 0 ; x < PARTICLETEXTURESIZE ; x + + )
{
dx = ( x - 0.5f * PARTICLETEXTURESIZE ) / ( PARTICLETEXTURESIZE * 0.5f - 1 ) ;
d = 256 * ( 1 - ( dx * dx + dy * dy ) ) ;
d = bound ( 0 , d , 255 ) ;
data [ y * PARTICLETEXTURESIZE + x ] [ 3 ] = ( qbyte ) d ;
}
}
------------------------------------------------------------------------
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
balltexture = R_LoadTexture32 ( " balltexture " , PARTICLETEXTURESIZE , PARTICLETEXTURESIZE , data , IF_NOMIPMAP | IF_NOPICMIP ) ;
2009-11-04 21:16:50 +00:00
memset ( data , 255 , sizeof ( data ) ) ;
for ( y = 0 ; y < PARTICLETEXTURESIZE ; y + + )
{
dy = ( y - 0.5f * PARTICLETEXTURESIZE ) / ( PARTICLETEXTURESIZE * 0.5f - 1 ) ;
d = 256 * ( 1 - ( dy * dy ) ) ;
d = bound ( 0 , d , 255 ) ;
for ( x = 0 ; x < PARTICLETEXTURESIZE ; x + + )
{
data [ y * PARTICLETEXTURESIZE + x ] [ 3 ] = ( qbyte ) d ;
}
}
2014-10-05 20:04:11 +00:00
beamtexture = R_LoadTexture32 ( " beamparticle " , PARTICLETEXTURESIZE , PARTICLETEXTURESIZE , data , IF_NOMIPMAP | IF_NOPICMIP ) ;
2009-11-04 21:16:50 +00:00
for ( y = 0 ; y < PARTICLETEXTURESIZE ; y + + )
{
dy = y / ( PARTICLETEXTURESIZE * 0.5f - 1 ) ;
d = 256 * ( 1 - ( dy * dy ) ) ;
d = bound ( 0 , d , 255 ) ;
for ( x = 0 ; x < PARTICLETEXTURESIZE ; x + + )
{
dx = x / ( PARTICLETEXTURESIZE * 0.5f - 1 ) ;
d = 256 * ( 1 - ( dx + dy ) ) ;
d = bound ( 0 , d , 255 ) ;
data [ y * PARTICLETEXTURESIZE + x ] [ 0 ] = ( qbyte ) d ;
data [ y * PARTICLETEXTURESIZE + x ] [ 1 ] = ( qbyte ) d ;
data [ y * PARTICLETEXTURESIZE + x ] [ 2 ] = ( qbyte ) d ;
data [ y * PARTICLETEXTURESIZE + x ] [ 3 ] = ( qbyte ) d / 2 ;
}
}
2014-10-05 20:04:11 +00:00
ptritexture = R_LoadTexture32 ( " ptritexture " , PARTICLETEXTURESIZE , PARTICLETEXTURESIZE , data , IF_NOMIPMAP | IF_NOPICMIP ) ;
2009-11-04 21:16:50 +00:00
}