2004-08-23 00:15:46 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2011-05-15 13:23:13 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2004-08-23 00:15:46 +00:00
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
// view.c -- player eye positioning
# include "quakedef.h"
2004-09-20 23:25:38 +00:00
# include "winquake.h"
2013-06-23 03:59:48 +00:00
# include "glquake.h"
2018-11-19 06:37:25 +00:00
# include "shader.h"
2004-09-20 23:25:38 +00:00
2011-05-15 13:23:13 +00:00
# include <ctype.h> // for isdigit();
2016-02-10 23:23:43 +00:00
cvar_t r_projection = CVARD ( " r_projection " , " 0 " , " 0: regular perspective. \n 1: stereographic (aka: pannini). \n 2: fisheye. \n 3: panoramic. \n 4: lambert azimuthal equal-area. \n 5: Equirectangular " ) ;
2015-07-03 02:07:41 +00:00
cvar_t ffov = CVARFD ( " ffov " , " " , 0 , " Allows you to set a specific field of view for when a custom projection is specified. If empty, will use regular fov cvar, which might get messy. " ) ;
2015-03-05 22:14:21 +00:00
# if defined(_WIN32) && !defined(MINIMAL)
//amusing gimmick / easteregg.
# include "winquake.h"
2019-06-05 20:48:06 +00:00
static cvar_t itburnsitburnsmakeitstop = CVARFD ( " itburnsitburnsmakeitstop " , " 0 " , CVAR_NOTFROMSERVER , " Ouch " ) ;
2015-03-05 22:14:21 +00:00
# endif
2004-08-23 00:15:46 +00:00
/*
The view is allowed to move slightly from it ' s true position for bobbing ,
but if it exceeds 8 pixels linear distance ( spherical , not box ) , the list of
entities sent from the server may not include everything in the pvs , especially
when crossing a water boudnary .
*/
# ifdef SIDEVIEWS
2019-06-05 20:48:06 +00:00
static struct
{
cvar_t enabled ;
cvar_t x ;
cvar_t y ;
cvar_t scalex ;
cvar_t scaley ;
cvar_t yaw ;
} sideview [ SIDEVIEWS ] = {
{ CVAR ( " v2_enabled " , " 2 " ) , CVAR ( " v2_x " , " 0 " ) , CVAR ( " v2_y " , " 0 " ) , CVAR ( " v2_scalex " , " 0.25 " ) , CVAR ( " v2_scaley " , " 0.25 " ) , CVAR ( " v2_yaw " , " 180 " ) } ,
# if SIDEVIEWS > 1
{ CVAR ( " v3_enabled " , " 2 " ) , CVAR ( " v3_x " , " 0.25 " ) , CVAR ( " v3_y " , " 0 " ) , CVAR ( " v3_scalex " , " 0.25 " ) , CVAR ( " v3_scaley " , " 0.25 " ) , CVAR ( " v3_yaw " , " 90 " ) } ,
# endif
# if SIDEVIEWS > 2
{ CVAR ( " v4_enabled " , " 2 " ) , CVAR ( " v4_x " , " 0.5 " ) , CVAR ( " v4_y " , " 0 " ) , CVAR ( " v4_scalex " , " 0.25 " ) , CVAR ( " v4_scaley " , " 0.25 " ) , CVAR ( " v4_yaw " , " 270 " ) } ,
# endif
# if SIDEVIEWS > 3
{ CVAR ( " v5_enabled " , " 2 " ) , CVAR ( " v5_x " , " 0.75 " ) , CVAR ( " v5_y " , " 0 " ) , CVAR ( " v5_scalex " , " 0.25 " ) , CVAR ( " v5_scaley " , " 0.25 " ) , CVAR ( " v5_yaw " , " 0 " ) } ,
# endif
} ;
2004-08-23 00:15:46 +00:00
# endif
2019-03-01 22:39:30 +00:00
cvar_t cl_rollspeed = CVARD ( " cl_rollspeed " , " 200 " , " Controls the speed required to reach cl_rollangle's tilt. " ) ;
2019-06-05 20:48:06 +00:00
static cvar_t cl_rollangle = CVARD ( " cl_rollangle " , " 2.0 " , " Controls the maximum view should tilt while strafing. " ) ;
static cvar_t cl_rollalpha = CVARD ( " cl_rollalpha " , " 20 " , " Controls the speed at which the view rolls according to sideways movement. " ) ;
static cvar_t v_deathtilt = CVARD ( " v_deathtilt " , " 1 " , " Specifies whether to tilt the view when dead. " ) ;
static cvar_t cl_bob = CVARD ( " cl_bob " , " 0.02 " , " Controls how much the camera position should bob up down as the player runs around. " ) ;
static cvar_t cl_bobcycle = CVAR ( " cl_bobcycle " , " 0.6 " ) ;
static cvar_t cl_bobup = CVAR ( " cl_bobup " , " 0.5 " ) ;
static cvar_t cl_bobmodel = CVARD ( " cl_bobmodel " , " 0 " , " Controls whether the viewmodel should bob up and down as the player runs around. " ) ;
static cvar_t cl_bobmodel_side = CVAR ( " cl_bobmodel_side " , " 0.15 " ) ;
static cvar_t cl_bobmodel_up = CVAR ( " cl_bobmodel_up " , " 0.06 " ) ;
static cvar_t cl_bobmodel_speed = CVAR ( " cl_bobmodel_speed " , " 7 " ) ;
static cvar_t v_kicktime = CVARD ( " v_kicktime " , " 0.5 " , " This controls how long viewangle changes from taking damage will last. " ) ;
static cvar_t v_kickroll = CVARD ( " v_kickroll " , " 0.6 " , " This controls part of the strength of viewangle changes from taking damage. " ) ;
static cvar_t v_kickpitch = CVARD ( " v_kickpitch " , " 0.6 " , " This controls part of the strength of viewangle changes from taking damage. " ) ;
static cvar_t v_iyaw_cycle = CVAR ( " v_iyaw_cycle " , " 2 " ) ;
static cvar_t v_iroll_cycle = CVAR ( " v_iroll_cycle " , " 0.5 " ) ;
static cvar_t v_ipitch_cycle = CVAR ( " v_ipitch_cycle " , " 1 " ) ;
static cvar_t v_iyaw_level = CVAR ( " v_iyaw_level " , " 0.3 " ) ;
static cvar_t v_iroll_level = CVAR ( " v_iroll_level " , " 0.1 " ) ;
static cvar_t v_ipitch_level = CVAR ( " v_ipitch_level " , " 0.3 " ) ;
static cvar_t v_idlescale = CVARD ( " v_idlescale " , " 0 " , " Enable swishing of the view (whether idle or otherwise). Often used for concussion effects. " ) ;
2004-08-23 00:15:46 +00:00
2016-09-08 19:04:35 +00:00
cvar_t crosshair = CVARF ( " crosshair " , " 1 " , CVAR_ARCHIVE ) ;
cvar_t crosshaircolor = CVARF ( " crosshaircolor " , " 255 255 255 " , CVAR_ARCHIVE ) ;
cvar_t crosshairsize = CVARF ( " crosshairsize " , " 8 " , CVAR_ARCHIVE ) ;
2004-08-23 00:15:46 +00:00
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
cvar_t cl_crossx = CVARF ( " cl_crossx " , " 0 " , CVAR_ARCHIVE ) ;
cvar_t cl_crossy = CVARF ( " cl_crossy " , " 0 " , CVAR_ARCHIVE ) ;
2019-03-01 22:39:30 +00:00
cvar_t crosshaircorrect = CVARFD ( " crosshaircorrect " , " 0 " , CVAR_SEMICHEAT , " Moves the crosshair around to represent the impact point of a weapon positioned below the actual view position. " ) ;
cvar_t crosshairimage = CVARD ( " crosshairimage " , " " , " Enables the use of an external/custom crosshair image " ) ;
2016-09-08 19:04:35 +00:00
cvar_t crosshairalpha = CVAR ( " crosshairalpha " , " 1 " ) ;
2004-08-23 00:15:46 +00:00
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
static qboolean v_skyroom_set ;
static vec4_t v_skyroom_origin ;
static vec4_t v_skyroom_orientation ;
static void QDECL V_Skyroom_Changed ( struct cvar_s * var , char * oldvalue )
{
char tok [ 64 ] ;
char * line = var - > string ;
if ( * line )
v_skyroom_set = true ;
else
v_skyroom_set = false ;
line = COM_ParseTokenOut ( line , NULL , tok , sizeof ( tok ) , NULL ) ;
v_skyroom_origin [ 0 ] = atof ( tok ) ;
line = COM_ParseTokenOut ( line , NULL , tok , sizeof ( tok ) , NULL ) ;
v_skyroom_origin [ 1 ] = atof ( tok ) ;
line = COM_ParseTokenOut ( line , NULL , tok , sizeof ( tok ) , NULL ) ;
v_skyroom_origin [ 2 ] = atof ( tok ) ;
line = COM_ParseTokenOut ( line , NULL , tok , sizeof ( tok ) , NULL ) ;
v_skyroom_origin [ 3 ] = atof ( tok ) ;
line = COM_ParseTokenOut ( line , NULL , tok , sizeof ( tok ) , NULL ) ;
v_skyroom_orientation [ 3 ] = atof ( tok ) ;
line = COM_ParseTokenOut ( line , NULL , tok , sizeof ( tok ) , NULL ) ;
v_skyroom_orientation [ 0 ] = atof ( tok ) ;
line = COM_ParseTokenOut ( line , NULL , tok , sizeof ( tok ) , NULL ) ;
v_skyroom_orientation [ 1 ] = atof ( tok ) ;
line = COM_ParseTokenOut ( line , NULL , tok , sizeof ( tok ) , NULL ) ;
v_skyroom_orientation [ 2 ] = atof ( tok ) ;
}
cvar_t v_skyroom = CVARFCD ( " skyroom " , " " , CVAR_SEMICHEAT , V_Skyroom_Changed , " Specifies the center position of the skyroom's view. Skyrooms are drawn instead of skyboxes (typically with their own skybox around them). Entities in skyrooms will be drawn only when r_ignoreentpvs is 0. Can also be set with the _skyroom worldspawn key. This is overriden by csqc's VF_SKYROOM_CAMERA. " ) ;
2019-07-02 04:12:20 +00:00
2019-06-05 20:48:06 +00:00
static cvar_t gl_cshiftpercent = CVAR ( " gl_cshiftpercent " , " 100 " ) ;
2018-10-11 10:31:23 +00:00
cvar_t gl_cshiftenabled = CVARFD ( " gl_polyblend " , " 1 " , CVAR_ARCHIVE , " Controls whether temporary whole-screen colour changes should be honoured or not. Change gl_cshiftpercent if you want to adjust the intensity. \n This does not affect v_cshift commands sent from the server. " ) ;
cvar_t gl_cshiftborder = CVARD ( " gl_polyblend_edgesize " , " 128 " , " This constrains colour shifts to the edge of the screen, with the value specifying the size of those borders. " ) ;
2019-06-05 20:48:06 +00:00
static cvar_t v_bonusflash = CVARD ( " v_bonusflash " , " 1 " , " Controls the strength of temporary screen flashes when picking up items (gl_polyblend must be enabled). " ) ;
2018-10-11 10:31:23 +00:00
cvar_t v_contentblend = CVARFD ( " v_contentblend " , " 1 " , CVAR_ARCHIVE , " Controls the strength of underwater colour tints (gl_polyblend must be enabled). " ) ;
2019-06-05 20:48:06 +00:00
static cvar_t v_damagecshift = CVARD ( " v_damagecshift " , " 1 " , " Controls the strength of damage-taken colour tints (gl_polyblend must be enabled). " ) ;
static cvar_t v_quadcshift = CVARD ( " v_quadcshift " , " 1 " , " Controls the strength of quad-damage colour tints (gl_polyblend must be enabled). " ) ;
static cvar_t v_suitcshift = CVARD ( " v_suitcshift " , " 1 " , " Controls the strength of envirosuit colour tints (gl_polyblend must be enabled). " ) ;
static cvar_t v_ringcshift = CVARD ( " v_ringcshift " , " 1 " , " Controls the strength of ring-of-invisibility colour tints (gl_polyblend must be enabled). " ) ;
static cvar_t v_pentcshift = CVARD ( " v_pentcshift " , " 1 " , " Controls the strength of pentagram-of-protection colour tints (gl_polyblend must be enabled). " ) ;
static cvar_t v_gunkick = CVARD ( " v_gunkick " , " 0 " , " Controls the strength of view angle changes when firing weapons. " ) ;
2018-10-11 10:31:23 +00:00
cvar_t v_gunkick_q2 = CVARD ( " v_gunkick_q2 " , " 1 " , " Controls the strength of view angle changes when firing weapons (in Quake2). " ) ;
2019-06-05 20:48:06 +00:00
static cvar_t v_viewmodel_quake = CVARD ( " r_viewmodel_quake " , " 0 " , " Controls whether to use weird viewmodel movements from vanilla quake. " ) ; //name comes from MarkV.
2004-08-23 00:15:46 +00:00
2018-11-19 06:37:25 +00:00
cvar_t v_viewheight = CVARF ( " v_viewheight " , " 0 " , CVAR_ARCHIVE ) ;
2019-06-06 04:32:09 +00:00
//static cvar_t v_projectionmode = CVARF("v_projectionmode", "0", CVAR_ARCHIVE);
2005-01-13 16:29:20 +00:00
2019-06-05 20:48:06 +00:00
static cvar_t v_depthsortentities = CVARAD ( " v_depthsortentities " , " 0 " , " v_reorderentitiesrandomly " , " Reorder entities for transparency such that the furthest entities are drawn first, allowing nearer transparent entities to draw over the top of them. " ) ;
2016-07-12 00:40:13 +00:00
2020-02-11 18:06:10 +00:00
# ifdef QUAKESTATS
2019-06-05 20:48:06 +00:00
static cvar_t scr_autoid = CVARD ( " scr_autoid " , " 1 " , " Display nametags above all players while spectating. " ) ;
2020-09-29 07:09:01 +00:00
static cvar_t scr_autoid_team = CVARD ( " scr_autoid_team " , " 0 " , " Display nametags above team members. 0: off. 1: display with half-alpha if occluded. 2: hide when occluded. " ) ;
2019-06-05 20:48:06 +00:00
static cvar_t scr_autoid_health = CVARD ( " scr_autoid_health " , " 1 " , " Display health as part of nametags (when known). " ) ;
static cvar_t scr_autoid_armour = CVARD ( " scr_autoid_armor " , " 1 " , " Display armour as part of nametags (when known). " ) ;
static cvar_t scr_autoid_weapon = CVARD ( " scr_autoid_weapon " , " 1 " , " Display the player's best weapon as part of their nametag (when known). " ) ;
2020-02-11 18:06:10 +00:00
static cvar_t scr_autoid_weapon_mask = CVARD ( " scr_autoid_weapon_mask " , " 126 " , " Mask of bits for weapon icons to actually show. \n +1: Shotgun. \n +2: Super Shotgun. \n +4: Nail Gun. \n +8: Super Nail Gun. \n +16: Grenade Launcher. \n +32: Rocket Launcher. \n +64: Lightning \n Showing only RL and GL is 96 \n " ) ;
2019-06-05 20:48:06 +00:00
static cvar_t scr_autoid_teamcolour = CVARD ( " scr_autoid_teamcolour " , STRINGIFY ( COLOR_BLUE ) , " The colour for the text on the nametags of team members. " ) ;
static cvar_t scr_autoid_enemycolour = CVARD ( " scr_autoid_enemycolour " , STRINGIFY ( COLOR_WHITE ) , " The colour for the text on the nametags of non-team members. " ) ;
2020-02-11 18:06:10 +00:00
# endif
2005-09-28 23:31:17 +00:00
2016-09-08 19:04:35 +00:00
cvar_t chase_active = CVAR ( " chase_active " , " 0 " ) ;
2019-06-06 04:32:09 +00:00
cvar_t chase_back = CVAR ( " chase_back " , " 48 " ) ;
cvar_t chase_up = CVAR ( " chase_up " , " 24 " ) ;
2014-09-08 23:47:19 +00:00
2005-05-26 12:55:34 +00:00
2004-08-23 00:15:46 +00:00
extern cvar_t cl_chasecam ;
2019-06-05 20:48:06 +00:00
static player_state_t * view_message ;
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = =
V_CalcRoll
= = = = = = = = = = = = = = =
*/
float V_CalcRoll ( vec3_t angles , vec3_t velocity )
{
vec3_t forward , right , up ;
float sign ;
float side ;
float value ;
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
AngleVectors ( angles , forward , right , up ) ;
side = DotProduct ( velocity , right ) ;
sign = side < 0 ? - 1 : 1 ;
side = fabs ( side ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
value = cl_rollangle . value ;
if ( side < cl_rollspeed . value )
side = side * value / cl_rollspeed . value ;
else
side = value ;
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
return side * sign ;
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = =
V_CalcBob
= = = = = = = = = = = = = = =
*/
2013-06-23 02:17:02 +00:00
float V_CalcBob ( playerview_t * pv , qboolean queryold )
2004-08-23 00:15:46 +00:00
{
float cycle ;
2013-12-29 22:48:28 +00:00
float hspeed , bob ;
vec3_t hvel ;
2011-05-15 13:23:13 +00:00
2017-05-28 15:42:32 +00:00
if ( pv - > spectator )
2004-08-23 00:15:46 +00:00
return 0 ;
2015-09-01 04:45:15 +00:00
if ( cl_bobcycle . value < = 0 | | cl . intermissionmode ! = IM_NONE )
2014-02-07 08:38:40 +00:00
return 0 ;
2013-06-23 02:17:02 +00:00
if ( ! pv - > onground | | cl . paused )
{
pv - > bobcltime = cl . time ;
2018-09-30 01:41:25 +00:00
return pv - > bob ; // just use old value. FIXME: diminish over time.
2013-06-23 02:17:02 +00:00
}
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
pv - > bobtime + = cl . time - pv - > bobcltime ;
pv - > bobcltime = cl . time ;
cycle = pv - > bobtime - ( int ) ( pv - > bobtime / cl_bobcycle . value ) * cl_bobcycle . value ;
2004-08-23 00:15:46 +00:00
cycle / = cl_bobcycle . value ;
if ( cycle < cl_bobup . value )
cycle = M_PI * cycle / cl_bobup . value ;
else
cycle = M_PI + M_PI * ( cycle - cl_bobup . value ) / ( 1.0 - cl_bobup . value ) ;
// bob is proportional to simulated velocity in the xy plane
// (don't count Z, or jumping messes it up)
2013-12-29 22:48:28 +00:00
hspeed = DotProduct ( pv - > simvel , pv - > gravitydir ) ;
VectorMA ( pv - > simvel , hspeed , pv - > gravitydir , hvel ) ;
hspeed = VectorLength ( hvel ) ;
hspeed = bound ( 0 , hspeed , 400 ) ;
bob = hspeed * bound ( 0 , cl_bob . value , 0.05 ) ;
pv - > bob = bob * 0.3 + bob * 0.7 * sin ( cycle ) ;
2013-06-23 02:17:02 +00:00
return pv - > bob ;
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
}
//=============================================================================
2019-06-05 20:48:06 +00:00
static cvar_t v_centermove = CVAR ( " v_centermove " , " 0.15 " ) ;
static cvar_t v_centerspeed = CVAR ( " v_centerspeed " , " 500 " ) ;
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
void V_StartPitchDrift ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
# if 1
2013-06-23 02:17:02 +00:00
if ( pv - > laststop = = cl . time )
2004-08-23 00:15:46 +00:00
{
return ; // something else is keeping it from drifting
}
# endif
2013-06-23 02:17:02 +00:00
if ( pv - > nodrift | | ! pv - > pitchvel )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
pv - > pitchvel = v_centerspeed . value ;
pv - > nodrift = false ;
pv - > driftmove = 0 ;
2004-08-23 00:15:46 +00:00
}
}
2013-06-23 02:17:02 +00:00
void V_StopPitchDrift ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
pv - > laststop = cl . time ;
pv - > nodrift = true ;
pv - > pitchvel = 0 ;
2004-08-23 00:15:46 +00:00
}
2018-01-03 04:40:06 +00:00
void V_CenterView_f ( void )
{
int pnum = CL_TargettedSplit ( false ) ;
V_StartPitchDrift ( & cl . playerview [ pnum ] ) ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = =
V_DriftPitch
Moves the client pitch angle towards cl . idealpitch sent by the server .
If the user is adjusting pitch manually , either with lookup / lookdown ,
mlook and mouse , or klook and keyboard , pitch drifting is constantly stopped .
Drifting is enabled when the center view key is hit , mlook is released and
2011-05-15 13:23:13 +00:00
lookspring is non 0 , or when
2004-08-23 00:15:46 +00:00
= = = = = = = = = = = = = = =
*/
2013-06-23 02:17:02 +00:00
void V_DriftPitch ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
float delta , move ;
2013-06-23 02:17:02 +00:00
if ( ! pv - > onground | | cls . demoplayback )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
pv - > driftmove = 0 ;
pv - > pitchvel = 0 ;
2004-08-23 00:15:46 +00:00
return ;
}
// don't count small mouse motion
2013-06-23 02:17:02 +00:00
if ( pv - > nodrift )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
if ( Length ( pv - > simvel ) < 200 )
pv - > driftmove = 0 ;
2004-08-23 00:15:46 +00:00
else
2013-06-23 02:17:02 +00:00
pv - > driftmove + = host_frametime ;
2011-05-15 13:23:13 +00:00
2013-06-23 02:17:02 +00:00
if ( pv - > driftmove > v_centermove . value )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
V_StartPitchDrift ( pv ) ;
2004-08-23 00:15:46 +00:00
}
return ;
}
2011-05-15 13:23:13 +00:00
2021-05-09 13:02:49 +00:00
# ifdef QUAKESTATS
delta = pv - > statsf [ STAT_IDEALPITCH ] - pv - > viewangles [ PITCH ] ;
# else
2013-06-23 02:17:02 +00:00
delta = 0 - pv - > viewangles [ PITCH ] ;
2021-05-09 13:02:49 +00:00
# endif
2004-08-23 00:15:46 +00:00
if ( ! delta )
{
2013-06-23 02:17:02 +00:00
pv - > pitchvel = 0 ;
2004-08-23 00:15:46 +00:00
return ;
}
2013-06-23 02:17:02 +00:00
move = host_frametime * pv - > pitchvel ;
pv - > pitchvel + = host_frametime * v_centerspeed . value ;
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
//Con_Printf ("move: %f (%f)\n", move, host_frametime);
if ( delta > 0 )
{
if ( move > delta )
{
2013-06-23 02:17:02 +00:00
pv - > pitchvel = 0 ;
2004-08-23 00:15:46 +00:00
move = delta ;
}
2013-06-23 02:17:02 +00:00
pv - > viewangles [ PITCH ] + = move ;
2004-08-23 00:15:46 +00:00
}
else if ( delta < 0 )
{
if ( move > - delta )
{
2013-06-23 02:17:02 +00:00
pv - > pitchvel = 0 ;
2004-08-23 00:15:46 +00:00
move = - delta ;
}
2013-06-23 02:17:02 +00:00
pv - > viewangles [ PITCH ] - = move ;
2004-08-23 00:15:46 +00:00
}
}
/*
2011-05-15 13:23:13 +00:00
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
PALETTE FLASHES
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2015-04-21 04:12:00 +00:00
static void QDECL V_Gamma_Callback ( struct cvar_s * var , char * oldvalue ) ;
2011-05-15 13:23:13 +00:00
2020-11-04 10:19:30 +00:00
static cvar_t v_cshift_empty = CVARFD ( " v_cshift_empty " , " 130 80 50 0 " , CVAR_ARCHIVE , " The colour tint to use when in the open air (additionally scaled by v_contentblend. " ) ;
static cvar_t v_cshift_water = CVARFD ( " v_cshift_water " , " 130 80 50 128 " , CVAR_ARCHIVE , " The colour tint to use when underwater (additionally scaled by v_contentblend. " ) ;
static cvar_t v_cshift_slime = CVARFD ( " v_cshift_slime " , " 0 25 5 150 " , CVAR_ARCHIVE , " The colour tint to use when submerged in slime (additionally scaled by v_contentblend. " ) ;
static cvar_t v_cshift_lava = CVARFD ( " v_cshift_lava " , " 255 80 0 150 " , CVAR_ARCHIVE , " The colour tint to use when burried in lava (ouchie!) (additionally scaled by v_contentblend. " ) ;
2004-08-23 00:15:46 +00:00
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
cvar_t v_gamma = CVARAFCD ( " gamma " , " 1.0 " , " v_gamma " , CVAR_ARCHIVE | CVAR_RENDERERCALLBACK , V_Gamma_Callback , " Controls how bright the screen is. Setting this to anything but 1 without hardware gamma requires glsl support and can noticably harm your framerate. " ) ;
2019-04-07 16:41:09 +00:00
cvar_t v_gammainverted = CVARFCD ( " v_gammainverted " , " 0 " , CVAR_ARCHIVE , V_Gamma_Callback , " Boolean that controls whether the gamma should be inverted (like quake) or not. " ) ;
cvar_t v_contrast = CVARAFCD ( " contrast " , " 1.0 " , " v_contrast " , CVAR_ARCHIVE , V_Gamma_Callback , " Scales colour values linearly to make your screen easier to see. Setting this to anything but 1 without hardware gamma will reduce your framerates a little. " ) ;
cvar_t v_contrastboost = CVARFCD ( " v_contrastboost " , " 1.0 " , CVAR_ARCHIVE , V_Gamma_Callback , " Amplifies contrast in dark areas " ) ;
2019-04-15 18:43:42 +00:00
cvar_t v_brightness = CVARAFCD ( " brightness " , " 0.0 " , " v_brightness " , CVAR_ARCHIVE , V_Gamma_Callback , " Brightness is how much 'white' to add to each and every pixel on the screen. " ) ;
2004-08-23 00:15:46 +00:00
qbyte gammatable [ 256 ] ; // palette is sent through this
2016-07-17 18:41:01 +00:00
qboolean gammaworks ;
2010-03-25 22:56:11 +00:00
float hw_blend [ 4 ] ; // rgba 0.0 - 1.0
2004-08-23 00:15:46 +00:00
/*
void BuildGammaTable ( float g )
{
int i , inf ;
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
if ( g = = 1.0 )
{
for ( i = 0 ; i < 256 ; i + + )
gammatable [ i ] = i ;
return ;
}
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < 256 ; i + + )
{
inf = 255 * pow ( ( i + 0.5 ) / 255.5 , g ) + 0.5 ;
if ( inf < 0 )
inf = 0 ;
if ( inf > 255 )
inf = 255 ;
gammatable [ i ] = inf ;
}
} */
2019-04-07 16:41:09 +00:00
void BuildGammaTable ( float gamma , float cscale , float cboost , float brightness )
2004-08-23 00:15:46 +00:00
{
int i , inf ;
2019-04-07 16:41:09 +00:00
float t ;
2004-08-23 00:15:46 +00:00
2019-04-07 16:41:09 +00:00
// gamma = bound (0.1, gamma, 3);
// cscale = bound (1, cscale, 3);
2004-08-23 00:15:46 +00:00
2019-04-07 16:41:09 +00:00
if ( gamma = = 1 & & cscale = = 1 & & cboost = = 1 & & brightness = = 0 )
2006-03-15 20:03:00 +00:00
{
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < 256 ; i + + )
gammatable [ i ] = i ;
return ;
}
2006-03-15 20:03:00 +00:00
for ( i = 0 ; i < 256 ; i + + )
{
2013-05-11 14:02:55 +00:00
//the 0.5s are for rounding.
2019-04-07 16:41:09 +00:00
t = ( i + 0.5 ) / 255.5 ; //scale the lighting
t = cboost * t / ( ( cboost - 1 ) * t + 1 ) ;
inf = 255 * ( pow ( t , gamma ) * cscale + brightness ) + 0.5 ;
gammatable [ i ] = bound ( 0 , inf , 255 ) ;
}
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = =
V_CheckGamma
= = = = = = = = = = = = = = = = =
*/
2015-04-21 04:12:00 +00:00
static void QDECL V_Gamma_Callback ( struct cvar_s * var , char * oldvalue )
2006-05-06 05:50:33 +00:00
{
2019-04-07 16:41:09 +00:00
BuildGammaTable ( v_gammainverted . ival ? v_gamma . value : ( 1 / v_gamma . value ) , v_contrast . value , v_contrastboost . value , v_brightness . value ) ;
2011-12-23 03:12:29 +00:00
V_UpdatePalette ( true ) ;
2006-05-06 05:50:33 +00:00
}
2017-03-26 17:23:53 +00:00
# if defined(_WIN32) && !defined(_XBOX)
2015-03-05 22:14:21 +00:00
void W32_BlowChunk ( vec3_t pos , float radius )
{
vec3_t center ;
if ( Matrix4x4_CM_Project ( pos , center , r_refdef . viewangles , r_refdef . vieworg , r_refdef . fov_x , r_refdef . fov_y ) )
{
int mid_x = center [ 0 ] * r_refdef . vrect . width + r_refdef . vrect . x ;
int mid_y = ( 1 - center [ 1 ] ) * r_refdef . vrect . height + r_refdef . vrect . y ;
HRGN tmp = CreateRectRgn ( 0 , 0 , 0 , 0 ) ;
HRGN newrgn = CreateRectRgn ( 0 , 0 , 0 , 0 ) ;
HRGN oldrgn = CreateRectRgn ( 0 , 0 , 0 , 0 ) ;
HRGN hole = CreateEllipticRgn ( mid_x - radius , mid_y - radius , mid_x + radius , mid_y + radius ) ;
if ( GetWindowRgn ( mainwindow , oldrgn ) < = NULLREGION )
{
RECT rect ;
DeleteObject ( oldrgn ) ;
GetWindowRect ( mainwindow , & rect ) ;
oldrgn = CreateRectRgn ( 0 , 0 , rect . right - rect . left , rect . bottom - rect . top ) ;
}
CombineRgn ( tmp , oldrgn , hole , RGN_XOR ) ;
CombineRgn ( newrgn , oldrgn , tmp , RGN_AND ) ;
DeleteObject ( oldrgn ) ;
DeleteObject ( hole ) ;
DeleteObject ( tmp ) ;
SetWindowRgn ( mainwindow , newrgn , TRUE ) ;
}
}
# endif
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = =
V_ParseDamage
= = = = = = = = = = = = = = =
*/
2013-06-23 02:17:02 +00:00
void V_ParseDamage ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
int armor , blood ;
vec3_t from ;
int i ;
vec3_t forward , right , up ;
float side ;
float count ;
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
armor = MSG_ReadByte ( ) ;
blood = MSG_ReadByte ( ) ;
for ( i = 0 ; i < 3 ; i + + )
from [ i ] = MSG_ReadCoord ( ) ;
2015-03-03 00:14:43 +00:00
pv - > faceanimtime = cl . time + 0.2 ; // but sbar face into pain frame
2017-03-26 17:23:53 +00:00
# if defined(_WIN32) && !defined(MINIMAL) && !defined(_XBOX)
2015-03-05 22:14:21 +00:00
if ( itburnsitburnsmakeitstop . value > 0 )
W32_BlowChunk ( from , ( armor + blood ) * itburnsitburnsmakeitstop . value ) ;
# endif
2015-03-03 00:14:43 +00:00
# ifdef CSQC_DAT
2017-08-14 16:38:44 +00:00
if ( CSQC_Parse_Damage ( pv - cl . playerview , armor , blood , from ) )
2015-03-03 00:14:43 +00:00
return ;
# endif
2004-08-23 00:15:46 +00:00
count = blood * 0.5 + armor * 0.5 ;
if ( count < 10 )
count = 10 ;
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
# ifdef ANDROID
2013-11-21 23:02:28 +00:00
//later versions of android might support strength values, but the simple standard interface is duration only.
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
Sys_Vibrate ( count ) ;
# endif
2004-08-23 00:15:46 +00:00
if ( v_damagecshift . value > = 0 )
2018-10-11 10:31:23 +00:00
pv - > cshifts [ CSHIFT_DAMAGE ] . percent + = 3 * count * v_damagecshift . value ;
else
pv - > cshifts [ CSHIFT_DAMAGE ] . percent + = 3 * count ;
2016-01-18 05:22:07 +00:00
if ( pv - > cshifts [ CSHIFT_DAMAGE ] . percent < 0 )
pv - > cshifts [ CSHIFT_DAMAGE ] . percent = 0 ;
if ( pv - > cshifts [ CSHIFT_DAMAGE ] . percent > 150 )
pv - > cshifts [ CSHIFT_DAMAGE ] . percent = 150 ;
2004-08-23 00:15:46 +00:00
2011-05-15 13:23:13 +00:00
if ( armor > blood )
2004-08-23 00:15:46 +00:00
{
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_DAMAGE ] . destcolor [ 0 ] = 200 ;
pv - > cshifts [ CSHIFT_DAMAGE ] . destcolor [ 1 ] = 100 ;
pv - > cshifts [ CSHIFT_DAMAGE ] . destcolor [ 2 ] = 100 ;
2004-08-23 00:15:46 +00:00
}
else if ( armor )
{
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_DAMAGE ] . destcolor [ 0 ] = 220 ;
pv - > cshifts [ CSHIFT_DAMAGE ] . destcolor [ 1 ] = 50 ;
pv - > cshifts [ CSHIFT_DAMAGE ] . destcolor [ 2 ] = 50 ;
2004-08-23 00:15:46 +00:00
}
else
{
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_DAMAGE ] . destcolor [ 0 ] = 255 ;
pv - > cshifts [ CSHIFT_DAMAGE ] . destcolor [ 1 ] = 0 ;
pv - > cshifts [ CSHIFT_DAMAGE ] . destcolor [ 2 ] = 0 ;
2004-08-23 00:15:46 +00:00
}
//
// calculate view angle kicks
//
2013-06-23 02:17:02 +00:00
VectorSubtract ( from , pv - > simorg , from ) ;
2004-08-23 00:15:46 +00:00
VectorNormalize ( from ) ;
2011-05-15 13:23:13 +00:00
2013-06-23 02:17:02 +00:00
AngleVectors ( pv - > simangles , forward , right , up ) ;
2004-08-23 00:15:46 +00:00
side = DotProduct ( from , right ) ;
2013-06-23 02:17:02 +00:00
pv - > v_dmg_roll = count * side * v_kickroll . value ;
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
side = DotProduct ( from , forward ) ;
2013-06-23 02:17:02 +00:00
pv - > v_dmg_pitch = count * side * v_kickpitch . value ;
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
pv - > v_dmg_time = v_kicktime . value ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = = =
V_cshift_f
= = = = = = = = = = = = = = = = = =
*/
void V_cshift_f ( void )
{
2011-03-31 19:46:26 +00:00
int r , g , b , p ;
2016-01-18 05:22:07 +00:00
playerview_t * pv = & cl . playerview [ CL_TargettedSplit ( true ) ] ;
2011-03-31 19:46:26 +00:00
r = g = b = p = 0 ;
if ( Cmd_Argc ( ) > = 5 )
{
r = atoi ( Cmd_Argv ( 1 ) ) ;
g = atoi ( Cmd_Argv ( 2 ) ) ;
b = atoi ( Cmd_Argv ( 3 ) ) ;
p = atoi ( Cmd_Argv ( 4 ) ) ;
}
if ( Cmd_FromGamecode ( ) )
{
if ( Cmd_Argc ( ) > = 5 )
2005-06-14 04:52:10 +00:00
{
2011-03-31 19:46:26 +00:00
qboolean term = false ;
int i ;
char * c = Cmd_Argv ( 4 ) ;
// malice jumbles commands into a v_cshift so this attempts to fix
2012-09-30 05:52:03 +00:00
while ( isdigit ( * c ) | | * c = = ' . ' )
2011-03-31 19:46:26 +00:00
c + + ;
if ( * c )
{
Cbuf_AddText ( c , RESTRICT_SERVER ) ;
term = true ;
}
for ( i = 5 ; i < Cmd_Argc ( ) ; i + + )
{
Cbuf_AddText ( " " , RESTRICT_SERVER ) ;
Cbuf_AddText ( Cmd_Argv ( i ) , RESTRICT_SERVER ) ;
term = true ;
}
if ( term )
Cbuf_AddText ( " \n " , RESTRICT_SERVER ) ;
2005-06-14 04:52:10 +00:00
}
2011-03-31 19:46:26 +00:00
else if ( Cmd_Argc ( ) > 1 )
Con_DPrintf ( " broken v_cshift from gamecode \n " ) ;
// ensure we always clear out or set for nehahra
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_SERVER ] . destcolor [ 0 ] = r ;
pv - > cshifts [ CSHIFT_SERVER ] . destcolor [ 1 ] = g ;
pv - > cshifts [ CSHIFT_SERVER ] . destcolor [ 2 ] = b ;
pv - > cshifts [ CSHIFT_SERVER ] . percent = p ;
2005-01-24 03:05:39 +00:00
return ;
}
2011-03-31 19:46:26 +00:00
if ( Cmd_Argc ( ) ! = 5 & & Cmd_Argc ( ) ! = 1 )
2004-08-23 00:15:46 +00:00
{
2011-03-31 19:46:26 +00:00
Con_Printf ( " v_cshift: v_cshift <r> <g> <b> <alpha> \n " ) ;
2005-01-23 17:49:42 +00:00
return ;
2004-08-23 00:15:46 +00:00
}
2011-03-31 19:46:26 +00:00
2020-11-04 10:19:30 +00:00
//always empty, to match vanilla.
Cvar_Set ( & v_cshift_empty , va ( " %d %d %d %d " , r , g , b , p ) ) ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = = =
V_BonusFlash_f
When you run over an item , the server sends this command
= = = = = = = = = = = = = = = = = =
*/
void V_BonusFlash_f ( void )
{
2016-01-18 05:22:07 +00:00
playerview_t * pv = & cl . playerview [ CL_TargettedSplit ( true ) ] ;
2015-10-27 15:20:15 +00:00
float frac ;
if ( ! gl_cshiftenabled . ival )
frac = 0 ;
else if ( Cmd_FromGamecode ( ) )
frac = v_bonusflash . value ;
else
frac = 1 ;
{
//still adheres to gl_cshiftpercent even when forced.
float minfrac = atof ( Cmd_Argv ( 5 ) ) ;
if ( frac < minfrac )
frac = minfrac ;
}
frac * = gl_cshiftpercent . value / 100.0 ;
if ( frac )
2004-08-23 00:15:46 +00:00
{
2015-06-04 06:15:14 +00:00
if ( Cmd_Argc ( ) > 1 )
{ //this is how I understand DP expects them.
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 0 ] = atof ( Cmd_Argv ( 1 ) ) * 255 ;
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 1 ] = atof ( Cmd_Argv ( 2 ) ) * 255 ;
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 2 ] = atof ( Cmd_Argv ( 3 ) ) * 255 ;
pv - > cshifts [ CSHIFT_BONUS ] . percent = atof ( Cmd_Argv ( 4 ) ) * 255 * frac ;
2015-06-04 06:15:14 +00:00
}
else
{
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 0 ] = 215 ;
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 1 ] = 186 ;
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 2 ] = 69 ;
pv - > cshifts [ CSHIFT_BONUS ] . percent = 50 * frac ;
2015-06-04 06:15:14 +00:00
}
2004-08-23 00:15:46 +00:00
}
}
2012-01-17 07:57:46 +00:00
void V_DarkFlash_f ( void )
{
2016-01-18 05:22:07 +00:00
playerview_t * pv = & cl . playerview [ CL_TargettedSplit ( true ) ] ;
2015-10-27 15:20:15 +00:00
float frac ;
if ( ! gl_cshiftenabled . ival )
frac = 0 ;
else
frac = 1 ;
frac * = gl_cshiftpercent . value / 100.0 ;
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 0 ] = 0 ;
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 1 ] = 0 ;
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 2 ] = 0 ;
pv - > cshifts [ CSHIFT_BONUS ] . percent = 255 * frac ;
2012-01-17 07:57:46 +00:00
}
void V_WhiteFlash_f ( void )
{
2016-01-18 05:22:07 +00:00
playerview_t * pv = & cl . playerview [ CL_TargettedSplit ( true ) ] ;
2015-10-27 15:20:15 +00:00
float frac ;
if ( ! gl_cshiftenabled . ival )
frac = 0 ;
else
frac = 1 ;
frac * = gl_cshiftpercent . value / 100.0 ;
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 0 ] = 255 ;
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 1 ] = 255 ;
pv - > cshifts [ CSHIFT_BONUS ] . destcolor [ 2 ] = 255 ;
pv - > cshifts [ CSHIFT_BONUS ] . percent = 255 * frac ;
2012-01-17 07:57:46 +00:00
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = =
V_SetContentsColor
Underwater , lava , etc each has a color shift
FIXME : Uses Q1 contents
= = = = = = = = = = = = =
*/
void V_SetContentsColor ( int contents )
{
int i ;
2016-01-18 05:22:07 +00:00
playerview_t * pv = r_refdef . playerview ;
2020-11-04 10:19:30 +00:00
cvar_t * v ;
2016-01-18 05:22:07 +00:00
2012-02-12 05:18:31 +00:00
if ( contents & FTECONTENTS_LAVA )
2020-11-04 10:19:30 +00:00
v = & v_cshift_lava ;
2012-02-12 05:18:31 +00:00
else if ( contents & ( FTECONTENTS_SLIME | FTECONTENTS_SOLID ) )
2020-11-04 10:19:30 +00:00
v = & v_cshift_slime ;
2012-02-12 05:18:31 +00:00
else if ( contents & FTECONTENTS_WATER )
2020-11-04 10:19:30 +00:00
v = & v_cshift_water ;
2012-02-12 05:18:31 +00:00
else
2020-11-04 10:19:30 +00:00
v = & v_cshift_empty ;
2004-08-23 00:15:46 +00:00
2020-11-04 10:19:30 +00:00
pv - > cshifts [ CSHIFT_CONTENTS ] . destcolor [ 0 ] = v - > vec4 [ 0 ] ;
pv - > cshifts [ CSHIFT_CONTENTS ] . destcolor [ 1 ] = v - > vec4 [ 1 ] ;
pv - > cshifts [ CSHIFT_CONTENTS ] . destcolor [ 2 ] = v - > vec4 [ 2 ] ;
pv - > cshifts [ CSHIFT_CONTENTS ] . percent = v - > vec4 [ 3 ] * v_contentblend . value ;
2004-08-23 00:15:46 +00:00
2016-01-18 05:22:07 +00:00
if ( pv - > cshifts [ CSHIFT_CONTENTS ] . percent )
2004-08-23 00:15:46 +00:00
{ //bound contents so it can't go negative
2016-01-18 05:22:07 +00:00
if ( pv - > cshifts [ CSHIFT_CONTENTS ] . percent < 0 )
pv - > cshifts [ CSHIFT_CONTENTS ] . percent = 0 ;
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < 3 ; i + + )
2016-01-18 05:22:07 +00:00
if ( pv - > cshifts [ CSHIFT_CONTENTS ] . destcolor [ 0 ] < 0 )
pv - > cshifts [ CSHIFT_CONTENTS ] . destcolor [ 0 ] = 0 ;
2004-08-23 00:15:46 +00:00
}
}
/*
= = = = = = = = = = = = =
V_CalcPowerupCshift
= = = = = = = = = = = = =
*/
2016-01-18 05:22:07 +00:00
void V_CalcPowerupCshift ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
2015-09-01 04:45:15 +00:00
# ifdef QUAKESTATS
2016-01-18 05:22:07 +00:00
int im = pv - > stats [ STAT_ITEMS ] ;
2004-08-23 00:15:46 +00:00
if ( im & IT_QUAD )
{
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 0 ] = 0 ;
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 1 ] = 0 ;
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 2 ] = 255 ;
pv - > cshifts [ CSHIFT_POWERUP ] . percent = 30 * v_quadcshift . value ;
2004-08-23 00:15:46 +00:00
}
else if ( im & IT_SUIT )
{
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 0 ] = 0 ;
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 1 ] = 255 ;
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 2 ] = 0 ;
pv - > cshifts [ CSHIFT_POWERUP ] . percent = 20 * v_suitcshift . value ;
2004-08-23 00:15:46 +00:00
}
else if ( im & IT_INVISIBILITY )
{
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 0 ] = 100 ;
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 1 ] = 100 ;
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 2 ] = 100 ;
pv - > cshifts [ CSHIFT_POWERUP ] . percent = 100 * v_ringcshift . value ;
2004-08-23 00:15:46 +00:00
}
else if ( im & IT_INVULNERABILITY )
{
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 0 ] = 255 ;
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 1 ] = 255 ;
pv - > cshifts [ CSHIFT_POWERUP ] . destcolor [ 2 ] = 0 ;
pv - > cshifts [ CSHIFT_POWERUP ] . percent = 30 * v_pentcshift . value ;
2004-08-23 00:15:46 +00:00
}
else
2016-01-18 05:22:07 +00:00
pv - > cshifts [ CSHIFT_POWERUP ] . percent = 0 ;
2004-08-23 00:15:46 +00:00
2016-01-18 05:22:07 +00:00
if ( pv - > cshifts [ CSHIFT_POWERUP ] . percent < 0 )
pv - > cshifts [ CSHIFT_POWERUP ] . percent = 0 ;
2015-09-01 04:45:15 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = =
V_CalcBlend
= = = = = = = = = = = = =
*/
2011-12-23 03:12:29 +00:00
void V_CalcBlend ( float * hw_blend )
2005-02-17 03:30:24 +00:00
{
2013-11-21 23:02:28 +00:00
extern qboolean r2d_canhwgamma ;
2010-03-25 22:56:11 +00:00
float a2 ;
2016-01-18 05:22:07 +00:00
int j , seat ;
2010-03-25 22:56:11 +00:00
float * blend ;
2016-01-18 05:22:07 +00:00
playerview_t * pv ;
2004-08-23 00:15:46 +00:00
2010-03-25 22:56:11 +00:00
memset ( hw_blend , 0 , sizeof ( float ) * 4 ) ;
2016-01-18 05:22:07 +00:00
for ( seat = 0 ; seat < cl . splitclients ; seat + + )
2004-08-23 00:15:46 +00:00
{
2016-01-18 05:22:07 +00:00
pv = & cl . playerview [ seat ] ;
memset ( pv - > screentint , 0 , sizeof ( pv - > screentint ) ) ;
2018-10-11 10:31:23 +00:00
memset ( pv - > bordertint , 0 , sizeof ( pv - > bordertint ) ) ;
2004-08-23 00:15:46 +00:00
2016-01-18 05:22:07 +00:00
//don't apply it to the server, we'll blend the two later if the user has no hardware gamma (if they do have it, we use just the server specified value) This way we avoid winnt users having a cheat with flashbangs and stuff.
for ( j = 0 ; j < NUM_CSHIFTS ; j + + )
2010-03-25 22:56:11 +00:00
{
2021-04-14 05:21:04 +00:00
if ( ( j = = CSHIFT_SERVER & & ! cls . demoplayback & & ! pv - > spectator ) | | j = = CSHIFT_BONUS )
2020-12-02 06:38:32 +00:00
{
a2 = pv - > cshifts [ j ] . percent / 255.0 ; //don't allow modification of this one.
}
else
2016-01-18 05:22:07 +00:00
{
if ( ! gl_cshiftpercent . value | | ! gl_cshiftenabled . ival )
continue ;
2004-08-23 00:15:46 +00:00
2016-01-18 05:22:07 +00:00
a2 = ( ( pv - > cshifts [ j ] . percent * gl_cshiftpercent . value ) / 100.0 ) / 255.0 ;
}
2010-03-25 22:56:11 +00:00
2018-05-06 16:09:07 +00:00
if ( a2 < = 0 )
2016-01-18 05:22:07 +00:00
continue ;
if ( j = = CSHIFT_SERVER )
{
2018-10-23 07:09:06 +00:00
/*server blend always goes into sw, ALWAYS. hardware is too unreliable.*/
2016-01-18 05:22:07 +00:00
blend = pv - > screentint ;
}
else
{
/*flashing things should not change hardware gamma ramps - windows is too slow*/
/*splitscreen should only use hw gamma ramps if they're all equal, and they're probably not*/
/*hw blends may also not be supported or may be disabled*/
2018-10-23 07:09:06 +00:00
if ( gl_cshiftenabled . ival = = 2 )
2018-10-11 10:31:23 +00:00
blend = pv - > bordertint ; //show the colours only on the borders so we don't blind ourselves
else if ( j = = CSHIFT_BONUS | | j = = CSHIFT_DAMAGE | | gl_nohwblend . ival | | ! r2d_canhwgamma | | cl . splitclients > 1 )
2016-01-18 05:22:07 +00:00
blend = pv - > screentint ;
else //powerup or contents?
blend = hw_blend ;
}
blend [ 3 ] = blend [ 3 ] + a2 * ( 1 - blend [ 3 ] ) ;
a2 = a2 / blend [ 3 ] ;
blend [ 0 ] = blend [ 0 ] * ( 1 - a2 ) + pv - > cshifts [ j ] . destcolor [ 0 ] * a2 / 255.0 ;
blend [ 1 ] = blend [ 1 ] * ( 1 - a2 ) + pv - > cshifts [ j ] . destcolor [ 1 ] * a2 / 255.0 ;
blend [ 2 ] = blend [ 2 ] * ( 1 - a2 ) + pv - > cshifts [ j ] . destcolor [ 2 ] * a2 / 255.0 ;
2010-03-25 22:56:11 +00:00
}
2016-01-18 05:22:07 +00:00
if ( pv - > screentint [ 3 ] > 1 )
pv - > screentint [ 3 ] = 1 ;
if ( pv - > screentint [ 3 ] < 0 )
pv - > screentint [ 3 ] = 0 ;
}
for ( ; seat < MAX_SPLITS ; seat + + )
{
pv = & cl . playerview [ seat ] ;
memset ( pv - > screentint , 0 , sizeof ( pv - > screentint ) ) ;
2018-10-11 10:31:23 +00:00
memset ( pv - > bordertint , 0 , sizeof ( pv - > bordertint ) ) ;
2004-08-23 00:15:46 +00:00
}
2010-03-25 22:56:11 +00:00
if ( hw_blend [ 3 ] > 1 )
hw_blend [ 3 ] = 1 ;
if ( hw_blend [ 3 ] < 0 )
hw_blend [ 3 ] = 0 ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = =
V_UpdatePalette
= = = = = = = = = = = = =
*/
2011-12-23 03:12:29 +00:00
void V_UpdatePalette ( qboolean force )
2004-08-23 00:15:46 +00:00
{
2013-11-21 23:02:28 +00:00
extern qboolean r2d_canhwgamma ;
2010-04-09 10:51:01 +00:00
int i ;
2010-03-25 22:56:11 +00:00
float newhw_blend [ 4 ] ;
2004-08-23 00:15:46 +00:00
int ir , ig , ib ;
2011-12-23 03:12:29 +00:00
float ftime ;
2013-05-11 14:02:55 +00:00
qboolean applied ;
2012-01-17 07:57:46 +00:00
static double oldtime ;
2004-12-15 19:40:45 +00:00
RSpeedMark ( ) ;
2011-12-23 03:12:29 +00:00
ftime = cl . time - oldtime ;
oldtime = cl . time ;
if ( ftime < 0 )
ftime = 0 ;
2016-01-18 05:22:07 +00:00
for ( i = 0 ; i < MAX_SPLITS ; i + + )
{
playerview_t * pv = & cl . playerview [ i ] ;
V_CalcPowerupCshift ( pv ) ;
// drop the damage value
pv - > cshifts [ CSHIFT_DAMAGE ] . percent - = ftime * 150 ;
if ( pv - > cshifts [ CSHIFT_DAMAGE ] . percent < = 0 )
pv - > cshifts [ CSHIFT_DAMAGE ] . percent = 0 ;
2008-06-12 23:19:47 +00:00
2016-01-18 05:22:07 +00:00
// drop the bonus value
pv - > cshifts [ CSHIFT_BONUS ] . percent - = ftime * 100 ;
if ( pv - > cshifts [ CSHIFT_BONUS ] . percent < = 0 )
pv - > cshifts [ CSHIFT_BONUS ] . percent = 0 ;
}
2008-06-12 23:19:47 +00:00
2011-12-23 03:12:29 +00:00
V_CalcBlend ( newhw_blend ) ;
2010-03-25 22:56:11 +00:00
if ( hw_blend [ 0 ] ! = newhw_blend [ 0 ] | | hw_blend [ 1 ] ! = newhw_blend [ 1 ] | | hw_blend [ 2 ] ! = newhw_blend [ 2 ] | | hw_blend [ 3 ] ! = newhw_blend [ 3 ] | | force )
2004-12-15 19:40:45 +00:00
{
2010-03-25 22:56:11 +00:00
float r , g , b , a ;
2016-07-28 15:57:22 +00:00
static unsigned short allramps [ 3 * 2048 ] ;
unsigned int rampsize = min ( vid . gammarampsize , countof ( allramps ) / 3 ) ;
unsigned short * ramps [ 3 ] = { & allramps [ 0 ] , & allramps [ rampsize ] , & allramps [ rampsize * 2 ] } ;
2010-03-25 22:56:11 +00:00
Vector4Copy ( newhw_blend , hw_blend ) ;
a = hw_blend [ 3 ] ;
r = 255 * hw_blend [ 0 ] * a ;
g = 255 * hw_blend [ 1 ] * a ;
b = 255 * hw_blend [ 2 ] * a ;
2004-08-23 00:15:46 +00:00
2006-05-06 05:50:33 +00:00
a = 1 - a ;
2016-07-28 15:57:22 +00:00
a * = 256.0 / rampsize ;
for ( i = 0 ; i < rampsize ; i + + )
2006-05-06 05:50:33 +00:00
{
ir = i * a + r ;
ig = i * a + g ;
ib = i * a + b ;
if ( ir > 255 )
ir = 255 ;
if ( ig > 255 )
ig = 255 ;
if ( ib > 255 )
ib = 255 ;
2016-07-28 15:57:22 +00:00
//FIXME: shit precision
2006-05-06 05:50:33 +00:00
ramps [ 0 ] [ i ] = gammatable [ ir ] < < 8 ;
ramps [ 1 ] [ i ] = gammatable [ ig ] < < 8 ;
ramps [ 2 ] [ i ] = gammatable [ ib ] < < 8 ;
2018-10-11 10:31:23 +00:00
# ifdef _WIN32
//'In fact, any entry in the ramp must be within 32768 of the identity value'
//so lets try to bound it so that it doesn't randomly fail.
ir = ( i < < 8 ) | i ;
ramps [ 0 ] [ i ] = bound ( ir - 32767 , ramps [ 0 ] [ i ] , ir + 32767 ) ;
ramps [ 1 ] [ i ] = bound ( ir - 32767 , ramps [ 1 ] [ i ] , ir + 32767 ) ;
ramps [ 2 ] [ i ] = bound ( ir - 32767 , ramps [ 2 ] [ i ] , ir + 32767 ) ;
# endif
2006-05-06 05:50:33 +00:00
}
2004-08-23 00:15:46 +00:00
2014-03-30 08:55:06 +00:00
if ( qrenderer )
{
2016-07-28 15:57:22 +00:00
applied = rf - > VID_ApplyGammaRamps ( rampsize , allramps ) ;
2014-03-30 08:55:06 +00:00
if ( ! applied & & r2d_canhwgamma )
2016-07-28 15:57:22 +00:00
rf - > VID_ApplyGammaRamps ( 0 , NULL ) ;
2014-03-30 08:55:06 +00:00
r2d_canhwgamma = applied ;
}
2004-08-23 00:15:46 +00:00
}
2004-12-15 19:40:45 +00:00
RSpeedEnd ( RSPEED_PALETTEFLASHES ) ;
2004-08-23 00:15:46 +00:00
}
2011-12-23 03:12:29 +00:00
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = =
V_UpdatePalette
= = = = = = = = = = = = =
*/
2008-06-12 23:19:47 +00:00
void V_ClearCShifts ( void )
{
2016-01-18 05:22:07 +00:00
int i , seat ;
2008-06-12 23:19:47 +00:00
2016-01-18 05:22:07 +00:00
for ( seat = 0 ; seat < MAX_SPLITS ; seat + + )
for ( i = 0 ; i < NUM_CSHIFTS ; i + + )
cl . playerview [ seat ] . cshifts [ i ] . percent = 0 ;
2008-06-12 23:19:47 +00:00
}
2011-05-15 13:23:13 +00:00
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
VIEW RENDERING
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2004-08-23 00:15:46 +00:00
float angledelta ( float a )
{
a = anglemod ( a ) ;
if ( a > 180 )
a - = 360 ;
return a ;
}
/*
= = = = = = = = = = = = = = = = = =
CalcGunAngle
= = = = = = = = = = = = = = = = = =
*/
2013-06-23 02:17:02 +00:00
void V_CalcGunPositionAngle ( playerview_t * pv , float bob )
2011-05-15 13:23:13 +00:00
{
2004-08-23 00:15:46 +00:00
float yaw , pitch , move ;
static float oldyaw = 0 ;
static float oldpitch = 0 ;
2013-10-08 14:28:11 +00:00
vec3_t vw_angles ;
2012-02-27 12:23:15 +00:00
int i ;
2018-09-30 01:41:25 +00:00
float xyspeed ;
vec3_t xyvel ;
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
yaw = r_refdef . viewangles [ YAW ] ;
pitch = - r_refdef . viewangles [ PITCH ] ;
yaw = angledelta ( yaw - r_refdef . viewangles [ YAW ] ) * 0.4 ;
if ( yaw > 10 )
yaw = 10 ;
if ( yaw < - 10 )
yaw = - 10 ;
pitch = angledelta ( - pitch - r_refdef . viewangles [ PITCH ] ) * 0.4 ;
if ( pitch > 10 )
pitch = 10 ;
if ( pitch < - 10 )
pitch = - 10 ;
move = host_frametime * 20 ;
if ( yaw > oldyaw )
{
if ( oldyaw + move < yaw )
yaw = oldyaw + move ;
}
else
{
if ( oldyaw - move > yaw )
yaw = oldyaw - move ;
}
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
if ( pitch > oldpitch )
{
if ( oldpitch + move < pitch )
pitch = oldpitch + move ;
}
else
{
if ( oldpitch - move > pitch )
pitch = oldpitch - move ;
}
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
oldyaw = yaw ;
oldpitch = pitch ;
2013-10-08 14:28:11 +00:00
vw_angles [ YAW ] = r_refdef . viewangles [ YAW ] + yaw ;
vw_angles [ PITCH ] = r_refdef . viewangles [ PITCH ] + pitch ;
2012-02-27 12:23:15 +00:00
2013-10-08 14:28:11 +00:00
vw_angles [ YAW ] = r_refdef . viewangles [ YAW ] ;
vw_angles [ PITCH ] = r_refdef . viewangles [ PITCH ] ;
vw_angles [ ROLL ] = r_refdef . viewangles [ ROLL ] ;
2004-11-17 18:04:43 +00:00
2013-10-08 14:28:11 +00:00
AngleVectors ( vw_angles , pv - > vw_axis [ 0 ] , pv - > vw_axis [ 1 ] , pv - > vw_axis [ 2 ] ) ;
VectorInverse ( pv - > vw_axis [ 1 ] ) ;
2012-02-27 12:23:15 +00:00
2013-10-08 14:28:11 +00:00
VectorCopy ( r_refdef . vieworg , pv - > vw_origin ) ;
2012-02-27 12:23:15 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
2013-10-08 14:28:11 +00:00
pv - > vw_origin [ i ] + = pv - > vw_axis [ 0 ] [ i ] * bob * 0.4 ;
// pv->vw_origin[i] += pv->vw_axis[1][i]*sin(cl.time*5.5342452354235)*0.1;
// pv->vw_origin[i] += pv->vw_axis[2][i]*bob*0.8;
2012-02-27 12:23:15 +00:00
}
2018-09-30 01:41:25 +00:00
VectorMA ( pv - > simvel , - DotProduct ( pv - > simvel , pv - > gravitydir ) , pv - > gravitydir , xyvel ) ;
xyspeed = VectorLength ( xyvel ) ;
//FIXME: clamp
2018-10-11 10:31:23 +00:00
//FIXME: cl_followmodel should lag the viewmodel's position relative to the view
//FIXME: cl_leanmodel should lag the viewmodel's angles relative to the view
2018-09-30 01:41:25 +00:00
if ( cl_bobmodel . value )
{ //bobmodel causes the viewmodel to bob relative to the view.
float s = pv - > bobtime * cl_bobmodel_speed . value , v ;
v = xyspeed * 0.01 * cl_bobmodel_side . value * /*cl_viewmodel_scale.value * */ sin ( s ) ;
VectorMA ( pv - > vw_origin , v , pv - > vw_axis [ 1 ] , pv - > vw_origin ) ;
v = xyspeed * 0.01 * cl_bobmodel_up . value * /*cl_viewmodel_scale.value * */ cos ( 2 * s ) ;
VectorMA ( pv - > vw_origin , v , pv - > vw_axis [ 2 ] , pv - > vw_origin ) ;
}
2012-02-27 12:23:15 +00:00
// fudge position around to keep amount of weapon visible
// roughly equal with different FOV
2014-05-30 03:57:30 +00:00
//FIXME: should use y fov, not viewsize.
2018-04-27 16:40:50 +00:00
if ( r_refdef . drawsbar & & v_viewmodel_quake . ival ) //no sbar = no viewsize cvar.
2014-05-30 03:57:30 +00:00
{
if ( scr_viewsize . value = = 110 )
pv - > vw_origin [ 2 ] + = 1 ;
else if ( scr_viewsize . value = = 100 )
pv - > vw_origin [ 2 ] + = 2 ;
else if ( scr_viewsize . value = = 90 )
pv - > vw_origin [ 2 ] + = 1 ;
else if ( scr_viewsize . value = = 80 )
pv - > vw_origin [ 2 ] + = 0.5 ;
}
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = =
V_BoundOffsets
= = = = = = = = = = = = = =
*/
void V_BoundOffsets ( int pnum )
{
// absolutely bound refresh reletive to entity clipping hull
// so the view can never be inside a solid wall
2012-07-05 19:42:36 +00:00
if ( r_refdef . vieworg [ 0 ] < cl . playerview [ pnum ] . simorg [ 0 ] - 14 )
r_refdef . vieworg [ 0 ] = cl . playerview [ pnum ] . simorg [ 0 ] - 14 ;
else if ( r_refdef . vieworg [ 0 ] > cl . playerview [ pnum ] . simorg [ 0 ] + 14 )
r_refdef . vieworg [ 0 ] = cl . playerview [ pnum ] . simorg [ 0 ] + 14 ;
if ( r_refdef . vieworg [ 1 ] < cl . playerview [ pnum ] . simorg [ 1 ] - 14 )
r_refdef . vieworg [ 1 ] = cl . playerview [ pnum ] . simorg [ 1 ] - 14 ;
else if ( r_refdef . vieworg [ 1 ] > cl . playerview [ pnum ] . simorg [ 1 ] + 14 )
r_refdef . vieworg [ 1 ] = cl . playerview [ pnum ] . simorg [ 1 ] + 14 ;
if ( r_refdef . vieworg [ 2 ] < cl . playerview [ pnum ] . simorg [ 2 ] - 22 )
r_refdef . vieworg [ 2 ] = cl . playerview [ pnum ] . simorg [ 2 ] - 22 ;
else if ( r_refdef . vieworg [ 2 ] > cl . playerview [ pnum ] . simorg [ 2 ] + 30 )
r_refdef . vieworg [ 2 ] = cl . playerview [ pnum ] . simorg [ 2 ] + 30 ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = =
V_AddIdle
Idle swaying
= = = = = = = = = = = = = =
*/
2013-06-23 02:17:02 +00:00
void V_AddIdle ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
//defaults: for use if idlescale is locked and the var isn't.
float yaw_cycle = 2 ;
float roll_cycle = 0.5 ;
float pitch_cycle = 1 ;
float yaw_level = 0.3 ;
float roll_level = 0.1 ;
float pitch_level = 0.3 ;
if ( v_iyaw_cycle . flags & CVAR_SERVEROVERRIDE | | ! ( v_idlescale . flags & CVAR_SERVEROVERRIDE ) )
yaw_cycle = v_iyaw_cycle . value ;
if ( v_iroll_cycle . flags & CVAR_SERVEROVERRIDE | | ! ( v_idlescale . flags & CVAR_SERVEROVERRIDE ) )
roll_cycle = v_iroll_cycle . value ;
if ( v_ipitch_cycle . flags & CVAR_SERVEROVERRIDE | | ! ( v_idlescale . flags & CVAR_SERVEROVERRIDE ) )
pitch_cycle = v_ipitch_cycle . value ;
if ( v_iyaw_level . flags & CVAR_SERVEROVERRIDE | | ! ( v_idlescale . flags & CVAR_SERVEROVERRIDE ) )
yaw_level = v_iyaw_level . value ;
if ( v_iroll_level . flags & CVAR_SERVEROVERRIDE | | ! ( v_idlescale . flags & CVAR_SERVEROVERRIDE ) )
roll_level = v_iroll_level . value ;
if ( v_ipitch_level . flags & CVAR_SERVEROVERRIDE | | ! ( v_idlescale . flags & CVAR_SERVEROVERRIDE ) )
pitch_level = v_ipitch_level . value ;
r_refdef . viewangles [ ROLL ] + = v_idlescale . value * sin ( cl . time * roll_cycle ) * roll_level ;
r_refdef . viewangles [ PITCH ] + = v_idlescale . value * sin ( cl . time * pitch_cycle ) * pitch_level ;
r_refdef . viewangles [ YAW ] + = v_idlescale . value * sin ( cl . time * yaw_cycle ) * yaw_level ;
2013-10-08 14:28:11 +00:00
// pv->viewent.angles[ROLL] -= v_idlescale.value * sin(cl.time*roll_cycle) * roll_level;
// pv->viewent.angles[PITCH] -= v_idlescale.value * sin(cl.time*pitch_cycle) * pitch_level;
// pv->viewent.angles[YAW] -= v_idlescale.value * sin(cl.time*yaw_cycle) * yaw_level;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = =
V_CalcViewRoll
Roll is induced by movement and damage
= = = = = = = = = = = = = =
*/
2013-06-23 02:17:02 +00:00
void V_CalcViewRoll ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
float side ;
float adjspeed ;
2013-06-23 02:17:02 +00:00
side = V_CalcRoll ( pv - > simangles , pv - > simvel ) ;
2004-08-23 00:15:46 +00:00
2019-03-01 22:39:30 +00:00
adjspeed = cl_rollalpha . value * bound ( 1 , fabs ( cl_rollangle . value ) , 45 ) ;
2013-06-23 02:17:02 +00:00
if ( side > pv - > rollangle )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
pv - > rollangle + = host_frametime * adjspeed ;
if ( pv - > rollangle > side )
pv - > rollangle = side ;
2004-08-23 00:15:46 +00:00
}
2013-06-23 02:17:02 +00:00
else if ( side < pv - > rollangle )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
pv - > rollangle - = host_frametime * adjspeed ;
if ( pv - > rollangle < side )
pv - > rollangle = side ;
2004-08-23 00:15:46 +00:00
}
2013-06-23 02:17:02 +00:00
r_refdef . viewangles [ ROLL ] + = pv - > rollangle ;
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
if ( pv - > v_dmg_time > 0 )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
r_refdef . viewangles [ ROLL ] + = pv - > v_dmg_time / v_kicktime . value * pv - > v_dmg_roll ;
r_refdef . viewangles [ PITCH ] + = pv - > v_dmg_time / v_kicktime . value * pv - > v_dmg_pitch ;
pv - > v_dmg_time - = host_frametime ;
2004-08-23 00:15:46 +00:00
}
}
/*
= = = = = = = = = = = = = = = = = =
V_CalcIntermissionRefdef
= = = = = = = = = = = = = = = = = =
*/
2013-06-23 02:17:02 +00:00
void V_CalcIntermissionRefdef ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
float old ;
2013-06-23 02:17:02 +00:00
VectorCopy ( pv - > simorg , r_refdef . vieworg ) ;
VectorCopy ( pv - > simangles , r_refdef . viewangles ) ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
if ( cl . intermissionmode = = IM_H2FINALE )
VectorMA ( r_refdef . vieworg , - pv - > viewheight , pv - > gravitydir , r_refdef . vieworg ) ;
2005-07-28 15:33:27 +00:00
// always idle in intermission
2004-08-23 00:15:46 +00:00
old = v_idlescale . value ;
v_idlescale . value = 1 ;
2013-06-23 02:17:02 +00:00
V_AddIdle ( pv ) ;
2004-08-23 00:15:46 +00:00
v_idlescale . value = old ;
}
2013-06-29 21:08:09 +00:00
float CalcFov ( float fov_x , float width , float height )
{
2016-07-12 00:40:13 +00:00
float a ;
float x ;
2013-06-29 21:08:09 +00:00
2016-07-12 00:40:13 +00:00
if ( fov_x < = 0 | | fov_x > 179 )
Sys_Error ( " Bad fov: %f " , fov_x ) ;
2013-06-29 21:08:09 +00:00
x = fov_x / 360 * M_PI ;
x = tan ( x ) ;
2016-07-12 00:40:13 +00:00
x = width / x ;
2013-06-29 21:08:09 +00:00
2016-07-12 00:40:13 +00:00
a = atan ( height / x ) ;
2013-06-29 21:08:09 +00:00
2016-07-12 00:40:13 +00:00
a = a * 360 / M_PI ;
2013-06-29 21:08:09 +00:00
2016-07-12 00:40:13 +00:00
return a ;
2013-06-29 21:08:09 +00:00
}
2018-05-21 13:47:53 +00:00
static void V_CalcAFov ( float afov , float * x , float * y , float w , float h )
{
extern cvar_t scr_fov_mode ;
extern cvar_t r_stereo_separation ;
int mode = scr_fov_mode . ival ;
if ( r_refdef . stereomethod = = STEREO_CROSSEYED & & r_stereo_separation . value )
w * = 0.5 ;
afov = bound ( 0.001 , afov , 170 ) ;
restart :
switch ( mode )
{
default :
case 0 : //maj-
if ( h > w )
{ //fov specified is interpreted as the horizontal fov at quake's original res: 640*432 (ie: with the sbar removed)...
// afov = CalcFov(afov, 640, 432);
mode = 3 ; //vertical
}
else
mode = 2 ; //horizontal
goto restart ;
case 1 : //min+
if ( h < w )
mode = 3 ; //vertical
else
mode = 2 ; //horizontal
goto restart ;
case 2 : //horizontal
* x = afov ;
* y = CalcFov ( afov , w , h ) ;
if ( * y > 170 )
{
* y = 170 ;
* x = CalcFov ( 170 , h , w ) ;
}
break ;
case 3 : //vertical
* y = afov ;
* x = CalcFov ( afov , h , w ) ;
if ( * x > 170 )
{ //don't allow screwed fovs.
* x = 170 ;
* y = CalcFov ( afov , w , h ) ;
}
break ;
2019-02-16 19:09:07 +00:00
2019-02-20 17:21:10 +00:00
case 4 : //wide 4:3, to match vanilla more closely.
if ( w / 4 < h / 3 )
{ //don't bug out if they're running on a tall screen
mode = 3 ;
goto restart ;
}
* y = tan ( afov * M_PI / 360.0 ) * ( 3.0 / 4.0 ) ;
* x = * y * w / h ;
2019-02-16 19:09:07 +00:00
* x = atan ( * x ) * ( 360.0 / M_PI ) ;
* y = atan ( * y ) * ( 360.0 / M_PI ) ;
break ;
2018-05-21 13:47:53 +00:00
}
}
2013-12-29 22:48:28 +00:00
void V_ApplyAFov ( playerview_t * pv )
2013-06-29 21:08:09 +00:00
{
//explicit fov overrides aproximate fov.
//aproximate fov is our regular fov value. explicit is settable by gamecode for weird aspect ratios
if ( ! r_refdef . fov_x | | ! r_refdef . fov_y )
{
float afov = r_refdef . afov ;
2021-08-19 06:01:52 +00:00
# ifdef Q2CLIENT
if ( pv - > forcefov > 0 )
afov = pv - > forcefov ;
# endif
2013-06-29 21:08:09 +00:00
if ( ! afov ) //make sure its sensible.
2017-07-12 08:15:27 +00:00
{
2013-06-29 21:08:09 +00:00
afov = scr_fov . value ;
2015-09-01 04:45:15 +00:00
# ifdef QUAKESTATS
2017-07-12 08:15:27 +00:00
if ( pv & & pv - > statsf [ STAT_VIEWZOOM ] ) //match dp - viewzoom only happens when defaulted.
afov * = pv - > statsf [ STAT_VIEWZOOM ] / STAT_VIEWZOOM_SCALE ;
2015-09-01 04:45:15 +00:00
# endif
2017-07-12 08:15:27 +00:00
}
2013-06-29 21:08:09 +00:00
2018-05-21 13:47:53 +00:00
V_CalcAFov ( afov , & r_refdef . fov_x , & r_refdef . fov_y , ( r_refdef . vrect . width * r_refdef . pxrect . width ) / vid . fbvwidth , ( r_refdef . vrect . height * r_refdef . pxrect . height ) / vid . fbvheight ) ;
2013-06-29 21:08:09 +00:00
}
2017-12-15 06:56:40 +00:00
if ( ! r_refdef . fovv_x | | ! r_refdef . fovv_y )
{
float afov = scr_fov_viewmodel . value ;
if ( afov )
2018-05-21 13:47:53 +00:00
V_CalcAFov ( afov , & r_refdef . fovv_x , & r_refdef . fovv_y , ( r_refdef . vrect . width * r_refdef . pxrect . width ) / vid . fbvwidth , ( r_refdef . vrect . height * r_refdef . pxrect . height ) / vid . fbvheight ) ;
2017-12-15 06:56:40 +00:00
else
{
r_refdef . fovv_x = r_refdef . fov_x ;
r_refdef . fovv_y = r_refdef . fov_y ;
}
}
2016-10-22 07:06:51 +00:00
if ( r_refdef . useperspective )
{
if ( r_refdef . mindist < 1 )
r_refdef . mindist = 1 ;
if ( r_refdef . maxdist & & r_refdef . maxdist < 100 )
r_refdef . maxdist = 0 ; //small values should just use infinite.
}
2013-06-29 21:08:09 +00:00
}
2013-06-23 02:17:02 +00:00
/*
= = = = = = = = = = = = = = = = =
v_ApplyRefdef
called to apply any dirty refdef bits and recalculates pending data .
= = = = = = = = = = = = = = = = =
*/
void V_ApplyRefdef ( void )
{
2016-07-15 12:26:24 +00:00
# ifdef QUAKEHUD
2013-06-23 02:17:02 +00:00
float size ;
int h ;
qboolean full = false ;
2016-10-22 07:06:51 +00:00
# endif
2013-06-23 02:17:02 +00:00
// force the status bar to redraw
Sbar_Changed ( ) ;
//========================================
2015-04-27 06:19:33 +00:00
if ( r_refdef . playerview - > gamerectknown ! = cls . framecount )
{
r_refdef . playerview - > gamerectknown = cls . framecount ;
r_refdef . playerview - > gamerect = r_refdef . grect ;
}
2015-09-01 04:45:15 +00:00
# ifndef QUAKEHUD
r_refdef . vrect = r_refdef . grect ;
# else
2013-06-23 02:17:02 +00:00
// intermission is always full screen
2015-09-01 04:45:15 +00:00
if ( cl . intermissionmode ! = IM_NONE | | ! r_refdef . drawsbar )
2013-06-23 02:17:02 +00:00
size = 120 ;
else
size = scr_viewsize . value ;
# ifdef Q2CLIENT
if ( cls . protocol = = CP_QUAKE2 ) //q2 never has a hud.
sb_lines = 0 ;
else
# endif
if ( size > = 120 )
sb_lines = 0 ; // no status bar at all
else if ( size > = 110 )
sb_lines = 24 ; // no inventory
else
sb_lines = 24 + 16 + 8 ;
2018-03-25 09:36:14 +00:00
if ( scr_viewsize . value > = 100.0 )
2013-06-23 02:17:02 +00:00
{
full = true ;
size = 100.0 ;
}
else
size = scr_viewsize . value ;
2015-09-01 04:45:15 +00:00
if ( cl . intermissionmode ! = IM_NONE | | ! r_refdef . drawsbar )
2013-06-23 02:17:02 +00:00
{
full = true ;
size = 100.0 ;
sb_lines = 0 ;
}
size / = 100.0 ;
if ( cl_sbar . value ! = 1 & & full )
h = r_refdef . grect . height ;
else
h = r_refdef . grect . height - sb_lines ;
if ( h < 0 )
h = 0 ;
r_refdef . vrect . width = r_refdef . grect . width * size ;
if ( r_refdef . vrect . width < 96 )
r_refdef . vrect . width = 96 ; // min for icons
r_refdef . vrect . height = r_refdef . grect . height * size ;
if ( cl_sbar . value = = 1 | | ! full )
{
if ( r_refdef . vrect . height > r_refdef . grect . height - sb_lines )
r_refdef . vrect . height = r_refdef . grect . height - sb_lines ;
}
else if ( r_refdef . vrect . height > r_refdef . grect . height )
r_refdef . vrect . height = r_refdef . grect . height ;
if ( r_refdef . vrect . height < 0 )
r_refdef . vrect . height = 0 ;
r_refdef . vrect . x = ( r_refdef . grect . width - r_refdef . vrect . width ) / 2 ;
if ( full )
r_refdef . vrect . y = 0 ;
else
r_refdef . vrect . y = ( h - r_refdef . vrect . height ) / 2 ;
r_refdef . vrect . x + = r_refdef . grect . x ;
r_refdef . vrect . y + = r_refdef . grect . y ;
2015-09-01 04:45:15 +00:00
# endif
2013-06-23 02:17:02 +00:00
if ( r_refdef . dirty & RDFD_FOV )
2013-12-29 22:48:28 +00:00
V_ApplyAFov ( r_refdef . playerview ) ;
2013-06-23 02:17:02 +00:00
r_refdef . dirty = 0 ;
2014-09-17 03:04:08 +00:00
if ( chase_active . ival & & cls . allow_cheats )
2016-07-12 00:40:13 +00:00
V_EditExternalModels ( 0 , NULL , 0 ) ;
if ( v_depthsortentities . ival )
V_DepthSortEntities ( r_refdef . vieworg ) ;
2013-06-23 02:17:02 +00:00
}
//if the view entities differ, removes all externalmodel flags except for adding it to the new entity, and removes weaponmodels.
2014-02-07 08:38:40 +00:00
//returns the number of view entities that were stripped out
2016-07-12 00:40:13 +00:00
int V_EditExternalModels ( int newviewentity , entity_t * viewentities , int maxviewenties )
2013-06-23 02:17:02 +00:00
{
int i ;
2014-02-07 08:38:40 +00:00
int viewents = 0 ;
2013-06-23 02:17:02 +00:00
for ( i = 0 ; i < cl_numvisedicts ; )
{
if ( cl_visedicts [ i ] . keynum = = newviewentity & & newviewentity )
2014-03-31 17:06:41 +00:00
cl_visedicts [ i ] . flags | = RF_EXTERNALMODEL ;
2013-06-23 02:17:02 +00:00
else
2014-03-31 17:06:41 +00:00
cl_visedicts [ i ] . flags & = ~ RF_EXTERNALMODEL ;
2013-06-23 02:17:02 +00:00
2014-03-31 17:06:41 +00:00
if ( cl_visedicts [ i ] . flags & RF_WEAPONMODEL )
2013-06-23 02:17:02 +00:00
{
2014-02-07 08:38:40 +00:00
if ( viewents < maxviewenties )
viewentities [ viewents + + ] = cl_visedicts [ i ] ;
2013-06-23 02:17:02 +00:00
memmove ( & cl_visedicts [ i ] , & cl_visedicts [ i + 1 ] , sizeof ( * cl_visedicts ) * ( cl_numvisedicts - ( i + 1 ) ) ) ;
cl_numvisedicts - - ;
}
else
i + + ;
}
2014-02-07 08:38:40 +00:00
return viewents ;
2013-06-23 02:17:02 +00:00
}
2016-07-12 00:40:13 +00:00
//this is for transparency effects, so we actually want the furthest first
//this is contrary for overdraw performance, but transparency doesn't work like that
//we use angles[0] to hold distance. the renderer shouldn't be using it anyway.
static int QDECL V_DepthSortTwoEntities ( const void * p1 , const void * p2 )
{
const entity_t * a = p1 ;
const entity_t * b = p2 ;
if ( a - > angles [ 0 ] < b - > angles [ 0 ] )
return 1 ;
2021-05-27 11:33:48 +00:00
if ( a - > angles [ 0 ] > b - > angles [ 0 ] )
return - 1 ;
2016-07-12 00:40:13 +00:00
return 0 ;
}
void V_DepthSortEntities ( float * vieworg )
{
int i ;
vec3_t disp ;
for ( i = 0 ; i < cl_numvisedicts ; i + + )
{
if ( cl_visedicts [ i ] . flags & RF_WEAPONMODEL )
{ //weapon models have their own extra matrix thing going on. don't mess up because of it.
cl_visedicts [ i ] . angles [ 0 ] = 0 ;
continue ;
}
if ( cl_visedicts [ i ] . rtype = = RT_MODEL & & cl_visedicts [ i ] . model & & cl_visedicts [ i ] . model - > type = = mod_brush )
{
VectorAdd ( cl_visedicts [ i ] . model - > maxs , cl_visedicts [ i ] . model - > mins , disp ) ;
VectorMA ( cl_visedicts [ i ] . origin , 0.5 , disp , disp ) ;
VectorSubtract ( disp , vieworg , disp ) ;
}
else
{
VectorSubtract ( cl_visedicts [ i ] . origin , vieworg , disp ) ;
}
cl_visedicts [ i ] . angles [ 0 ] = DotProduct ( disp , disp ) ; //don't bother with sqrts
}
qsort ( cl_visedicts , cl_numvisedicts , sizeof ( cl_visedicts [ 0 ] ) , V_DepthSortTwoEntities ) ;
}
2013-06-23 02:17:02 +00:00
/*
clears the refdef to defaults .
*/
void V_ClearRefdef ( playerview_t * pv )
{
r_refdef . playerview = pv ;
r_refdef . dirty = ~ 0 ;
r_refdef . grect . x = 0 ;
r_refdef . grect . y = 0 ;
2015-02-02 08:01:53 +00:00
r_refdef . grect . width = vid . fbvwidth ; //vid.width;
r_refdef . grect . height = vid . fbvheight ; //vid.height;
2013-06-23 02:17:02 +00:00
r_refdef . afov = scr_fov . value ; //will have a better value applied if fov is bad. this allows setting.
r_refdef . fov_x = 0 ;
r_refdef . fov_y = 0 ;
2017-12-15 06:56:40 +00:00
r_refdef . fovv_x = 0 ;
r_refdef . fovv_y = 0 ;
2020-01-13 07:03:28 +00:00
r_refdef . projectionoffset [ 0 ] = r_refdef . projectionoffset [ 1 ] = 0 ;
2013-06-23 02:17:02 +00:00
2018-08-04 07:05:20 +00:00
r_refdef . drawsbar = ( cl . intermissionmode = = IM_NONE ) ;
2013-08-27 13:18:09 +00:00
r_refdef . flags = 0 ;
2014-02-07 08:38:40 +00:00
2019-04-01 10:16:36 +00:00
r_refdef . skyroom_enabled = false ;
2019-07-19 02:13:19 +00:00
r_refdef . firstvisedict = 0 ; //just in case.
2019-04-01 10:16:36 +00:00
2014-06-02 16:50:40 +00:00
r_refdef . areabitsknown = false ;
2014-02-07 08:38:40 +00:00
// memset(r_refdef.postprocshader, 0, sizeof(r_refdef.postprocshader));
// memset(r_refdef.postprocsize, 0, sizeof(r_refdef.postprocsize));
// r_refdef.postproccube = 0;
2013-06-23 02:17:02 +00:00
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = =
V_CalcRefdef
= = = = = = = = = = = = = = = = = =
*/
2013-06-23 02:17:02 +00:00
void V_CalcRefdef ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
float bob ;
2013-03-12 23:17:18 +00:00
float viewheight ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
2013-06-23 02:17:02 +00:00
r_refdef . playerview = pv ;
2005-03-18 06:14:07 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
memset ( & r_refdef . globalfog , 0 , sizeof ( r_refdef . globalfog ) ) ;
2016-07-12 00:40:13 +00:00
r_refdef . time = cl . servertime ;
2004-08-23 00:15:46 +00:00
# ifdef Q2CLIENT
2005-05-26 12:55:34 +00:00
if ( cls . protocol = = CP_QUAKE2 )
2016-01-18 05:22:07 +00:00
{
VectorCopy ( pv - > simorg , r_refdef . vieworg ) ;
VectorCopy ( pv - > simangles , r_refdef . viewangles ) ;
2004-08-23 00:15:46 +00:00
return ;
2016-01-18 05:22:07 +00:00
}
2004-08-23 00:15:46 +00:00
# endif
2005-01-13 16:29:20 +00:00
if ( v_viewheight . value < - 7 )
bob = - 7 ;
else if ( v_viewheight . value > 4 )
bob = 4 ;
else if ( v_viewheight . value )
bob = v_viewheight . value ;
else
2013-06-23 02:17:02 +00:00
bob = V_CalcBob ( pv , false ) ;
2011-05-15 13:23:13 +00:00
2004-08-23 00:15:46 +00:00
// refresh position from simulated origin
2013-06-23 02:17:02 +00:00
VectorCopy ( pv - > simorg , r_refdef . vieworg ) ;
2004-08-23 00:15:46 +00:00
2005-07-14 01:57:34 +00:00
r_refdef . useperspective = true ;
2016-10-22 07:06:51 +00:00
r_refdef . mindist = bound ( 0.1 , gl_mindist . value , 4 ) ;
r_refdef . maxdist = gl_maxdist . value ;
2004-08-23 00:15:46 +00:00
// never let it sit exactly on a node line, because a water plane can
// dissapear when viewed with the eye exactly on it.
// the server protocol only specifies to 1/8 pixel, so add 1/16 in each axis
r_refdef . vieworg [ 0 ] + = 1.0 / 16 ;
r_refdef . vieworg [ 1 ] + = 1.0 / 16 ;
r_refdef . vieworg [ 2 ] + = 1.0 / 16 ;
2013-07-26 17:19:06 +00:00
VectorCopy ( pv - > simangles , r_refdef . viewangles ) ;
2013-06-23 02:17:02 +00:00
V_CalcViewRoll ( pv ) ;
V_AddIdle ( pv ) ;
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
viewheight = pv - > viewheight ;
2015-09-02 03:12:25 +00:00
if ( viewheight = = DEFAULT_VIEWHEIGHT & & cls . protocol = = CP_QUAKEWORLD & & ! ( cls . z_ext & Z_EXT_VIEWHEIGHT ) )
2010-08-14 00:15:07 +00:00
{
if ( view_message & & view_message - > flags & PF_GIB )
2013-03-12 23:17:18 +00:00
viewheight = 8 ; // gib view height
2010-08-14 00:15:07 +00:00
else if ( view_message & & view_message - > flags & PF_DEAD )
2013-03-12 23:17:18 +00:00
viewheight = 16 ; // corpse view height
2010-08-14 00:15:07 +00:00
}
2004-08-23 00:15:46 +00:00
2015-09-02 03:12:25 +00:00
# ifdef QUAKESTATS
2017-05-28 15:42:32 +00:00
if ( pv - > stats [ STAT_HEALTH ] < 0 & & ( ! pv - > spectator | | pv - > cam_state = = CAM_EYECAM ) & & v_deathtilt . value ) // PF_GIB will also set PF_DEAD
2004-08-23 00:15:46 +00:00
{
2017-05-28 15:42:32 +00:00
if ( ! pv - > spectator | | cl_chasecam . ival )
2009-11-04 21:16:50 +00:00
r_refdef . viewangles [ ROLL ] = 80 * v_deathtilt . value ; // dead view angle
2004-08-23 00:15:46 +00:00
}
2008-06-20 21:44:10 +00:00
else
2015-09-01 04:45:15 +00:00
# endif
2008-06-20 21:44:10 +00:00
{
// v_viewheight only affects the view if the player is alive
2013-03-12 23:17:18 +00:00
viewheight + = bob ;
2008-06-20 21:44:10 +00:00
}
2015-09-01 04:45:15 +00:00
viewheight + = pv - > crouch ;
2011-05-15 13:23:13 +00:00
2013-06-23 02:17:02 +00:00
VectorMA ( r_refdef . vieworg , - viewheight , pv - > gravitydir , r_refdef . vieworg ) ;
2013-03-12 23:17:18 +00:00
2004-08-23 00:15:46 +00:00
// set up gun position
2013-06-23 02:17:02 +00:00
V_CalcGunPositionAngle ( pv , bob ) ;
2004-08-23 00:15:46 +00:00
// set up the refresh position
2006-02-26 05:53:06 +00:00
if ( v_gunkick . value )
2017-02-21 20:22:07 +00:00
{
r_refdef . viewangles [ PITCH ] + = pv - > punchangle_cl * v_gunkick . value ;
VectorMA ( r_refdef . viewangles , v_gunkick . value , pv - > punchangle_sv , r_refdef . viewangles ) ;
VectorMA ( r_refdef . vieworg , v_gunkick . value , pv - > punchorigin , r_refdef . vieworg ) ;
}
2004-08-23 00:15:46 +00:00
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( v_skyroom_set )
2019-07-02 04:12:20 +00:00
{
r_refdef . skyroom_enabled = true ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
VectorMA ( v_skyroom_origin , v_skyroom_origin [ 3 ] , r_refdef . vieworg , r_refdef . skyroom_pos ) ;
Vector4Copy ( v_skyroom_orientation , r_refdef . skyroom_spin ) ;
r_refdef . skyroom_spin [ 3 ] * = cl . time ;
2019-07-02 04:12:20 +00:00
}
2014-09-08 23:47:19 +00:00
2014-09-17 03:04:08 +00:00
if ( chase_active . ival & & cls . allow_cheats ) //cheat restriction might be lifted some time when any wallhacks are solved.
2014-09-08 23:47:19 +00:00
{
vec3_t axis [ 3 ] ;
2014-09-17 03:04:08 +00:00
vec3_t camorg , camdir ;
2014-09-08 23:47:19 +00:00
trace_t tr ;
2014-09-17 03:04:08 +00:00
float len ;
2014-10-11 19:39:45 +00:00
//r_refdef.viewangles[0] += chase_pitch.value;
//r_refdef.viewangles[1] += chase_yaw.value;
//r_refdef.viewangles[2] += chase_roll.value;
2015-01-21 18:18:37 +00:00
if ( chase_active . ival > = 2 )
r_refdef . viewangles [ 0 ] = 90 ;
if ( chase_active . ival > = 3 )
r_refdef . viewangles [ 1 ] = 0 ;
2014-09-08 23:47:19 +00:00
AngleVectors ( r_refdef . viewangles , axis [ 0 ] , axis [ 1 ] , axis [ 2 ] ) ;
2014-09-17 03:04:08 +00:00
VectorScale ( axis [ 0 ] , - chase_back . value , camdir ) ;
2015-01-21 18:18:37 +00:00
if ( pv - > pmovetype = = PM_6DOF )
VectorMA ( camdir , chase_up . value , axis [ 2 ] , camdir ) ;
else
VectorMA ( camdir , - chase_up . value , pv - > gravitydir , camdir ) ;
2014-09-17 03:04:08 +00:00
len = VectorLength ( camdir ) ;
VectorMA ( r_refdef . vieworg , ( len + 128 ) / len , camdir , camorg ) ; //push it 128qu further
if ( cl . worldmodel & & cl . worldmodel - > funcs . NativeTrace )
{
cl . worldmodel - > funcs . NativeTrace ( cl . worldmodel , 0 , 0 , NULL , r_refdef . vieworg , camorg , vec3_origin , vec3_origin , true , MASK_WORLDSOLID , & tr ) ;
if ( ! tr . startsolid )
{
if ( tr . fraction < 1 )
{
//we found a plane, bisect it weirdly to push 4qu infront
float d1 , d2 , frac ;
VectorMA ( r_refdef . vieworg , 1 , camdir , camorg ) ;
d1 = DotProduct ( r_refdef . vieworg , tr . plane . normal ) - ( tr . plane . dist + 4 ) ;
d2 = DotProduct ( camorg , tr . plane . normal ) - ( tr . plane . dist + 4 ) ;
frac = d1 / ( d1 - d2 ) ;
frac = bound ( 0 , frac , 1 ) ;
VectorMA ( r_refdef . vieworg , frac , camdir , r_refdef . vieworg ) ;
}
else
VectorMA ( r_refdef . vieworg , 1 , camdir , r_refdef . vieworg ) ;
}
}
2014-09-08 23:47:19 +00:00
}
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = =
DropPunchAngle
= = = = = = = = = = = = =
*/
2013-06-23 02:17:02 +00:00
void DropPunchAngle ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
2017-02-21 20:22:07 +00:00
if ( pv - > punchangle_cl < 0 )
2006-02-26 05:53:06 +00:00
{
2017-02-21 20:22:07 +00:00
pv - > punchangle_cl + = 10 * host_frametime ;
if ( pv - > punchangle_cl > 0 )
pv - > punchangle_cl = 0 ;
2006-02-26 05:53:06 +00:00
}
else
{
2017-02-21 20:22:07 +00:00
pv - > punchangle_cl - = 10 * host_frametime ;
if ( pv - > punchangle_cl < 0 )
pv - > punchangle_cl = 0 ;
2006-02-26 05:53:06 +00:00
}
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = = =
V_RenderView
The player ' s clipping box goes from ( - 16 - 16 - 24 ) to ( 16 16 32 ) from
the entity origin , so any view position inside that will be valid
= = = = = = = = = = = = = = = = = =
*/
qboolean r_secondaryview ;
# ifdef SIDEVIEWS
# ifdef PEXT_VIEW2
entity_t * CL_EntityNum ( int num )
{
int i ;
for ( i = 0 ; i < cl_numvisedicts ; i + + )
{
if ( cl_visedicts [ i ] . keynum = = num )
return & cl_visedicts [ i ] ;
}
return NULL ;
}
# endif
# endif
2018-03-25 09:36:14 +00:00
static qboolean SCR_VRectForPlayer ( vrect_t * vrect , int pnum , unsigned maxseats )
2004-08-23 00:15:46 +00:00
{
2018-03-25 09:36:14 +00:00
int w = 1 , h = 1 ;
while ( w * h < maxseats )
2004-08-23 00:15:46 +00:00
{
2018-03-25 09:36:14 +00:00
//spread them out so they're all fair.
//panorama always stacks vertically, using the full width, because we can.
if ( vid . fbvwidth / ( w * 16.0 ) > vid . fbvheight / ( h * 10.0 ) & & r_projection . ival ! = PROJ_PANORAMA )
w + + ;
2005-11-30 01:20:53 +00:00
else
2018-03-25 09:36:14 +00:00
h + + ;
2004-08-23 00:15:46 +00:00
}
2018-03-25 09:36:14 +00:00
vrect - > width = vid . fbvwidth / ( float ) w ;
vrect - > height = vid . fbvheight / ( float ) h ;
vrect - > x = ( pnum % w ) * vrect - > width ;
vrect - > y = ( pnum / w ) * vrect - > height ;
return pnum < w * h ;
2004-08-23 00:15:46 +00:00
}
2019-01-13 16:51:50 +00:00
void Draw_ExpandedString ( struct font_s * font , float x , float y , conchar_t * str ) ;
2015-06-30 14:05:45 +00:00
2020-02-11 18:06:10 +00:00
# ifdef QUAKESTATS
2015-06-30 14:05:45 +00:00
static void SCR_DrawAutoID ( vec3_t org , player_info_t * pl , qboolean isteam )
2005-06-14 04:52:10 +00:00
{
2009-07-17 22:28:16 +00:00
conchar_t buffer [ 256 ] ;
int len ;
2005-06-14 04:52:10 +00:00
vec3_t center ;
vec3_t tagcenter ;
2015-06-30 14:05:45 +00:00
float alpha ;
qboolean obscured ;
int x , y ;
int r ;
float barwidth ;
qboolean haveinfo ;
unsigned int textflags ;
2015-07-01 23:15:25 +00:00
int h ;
2015-07-09 18:02:49 +00:00
char * pname ;
2015-06-30 14:05:45 +00:00
2016-10-22 07:06:51 +00:00
int health ;
int armour ;
unsigned int items ;
2015-06-30 14:05:45 +00:00
static vec4_t healthcolours [ ] =
{
{ 0.7 , 0.45 , 0.45 , 1 } ,
{ 0.3 , 0 , 0 , 1 } ,
{ 1 , 0 , 0 , 1 } ,
{ 1 , 0.4 , 0 , 1 } ,
{ 1 , 1 , 1 , 1 }
} ;
static vec4_t armourcolours [ ] =
{
{ 25 , 170 , 0 , 0.2 } ,
{ 25 , 170 , 0 , 1 } ,
{ 225 , 220 , 0 , 0.2 } ,
{ 225 , 220 , 0 , 1 } ,
{ 255 , 0 , 0 , 0.2 } ,
{ 255 , 0 , 0 , 1 }
} ;
extern cvar_t tp_name_sg , tp_name_ssg , tp_name_ng , tp_name_sng , tp_name_gl , tp_name_rl , tp_name_lg ;
static cvar_t * wbitnames [ ] =
{
& tp_name_sg ,
& tp_name_ssg ,
& tp_name_ng ,
& tp_name_sng ,
& tp_name_gl ,
& tp_name_rl ,
& tp_name_lg
} ;
2019-01-13 16:51:50 +00:00
struct font_s * font = font_default ;
2015-06-30 14:05:45 +00:00
VectorCopy ( org , tagcenter ) ;
tagcenter [ 2 ] + = 32 ;
if ( ! Matrix4x4_CM_Project ( tagcenter , center , r_refdef . viewangles , r_refdef . vieworg , r_refdef . fov_x , r_refdef . fov_y ) )
2016-01-18 05:22:07 +00:00
return ; //behind the camera
if ( center [ 0 ] < 0 | | center [ 0 ] > 1 | | center [ 1 ] < 0 | | center [ 1 ] > 1 )
return ; //off the side of the screen
2015-06-30 14:05:45 +00:00
obscured = ! TP_IsPlayerVisible ( org ) ;
if ( obscured & & ! isteam )
return ; //only teammembers are drawn when obscured
if ( isteam )
textflags = scr_autoid_teamcolour . ival < < CON_FGSHIFT ;
else
textflags = scr_autoid_enemycolour . ival < < CON_FGSHIFT ;
if ( obscured )
{
2015-12-12 19:25:15 +00:00
if ( scr_autoid_team . ival = = 2 )
return ;
2015-06-30 14:05:45 +00:00
textflags | = CON_HALFALPHA ;
alpha = 0.25 ;
}
else
alpha = 1 ;
x = center [ 0 ] * r_refdef . vrect . width + r_refdef . vrect . x ;
y = ( 1 - center [ 1 ] ) * r_refdef . vrect . height + r_refdef . vrect . y ;
if ( cls . demoplayback = = DPB_MVD | | cls . demoplayback = = DPB_EZTV )
{
health = pl - > statsf [ STAT_HEALTH ] ;
armour = pl - > statsf [ STAT_ARMOR ] ;
items = pl - > stats [ STAT_ITEMS ] ;
2015-07-09 18:02:49 +00:00
pname = pl - > name ;
2015-06-30 14:05:45 +00:00
haveinfo = true ;
}
else
{
health = pl - > tinfo . health ;
armour = pl - > tinfo . armour ;
items = pl - > tinfo . items ;
2015-07-09 18:02:49 +00:00
pname = ( ( * pl - > tinfo . nick ) ? pl - > tinfo . nick : ( cl . teamfortress ? " - " : pl - > name ) ) ;
2015-06-30 14:05:45 +00:00
haveinfo = pl - > tinfo . time > cl . time ;
}
2015-07-09 18:02:49 +00:00
if ( strcmp ( pname , " - " ) ) //a tinfo nick of - hides names. this can be used for TF to hide names for spies.
{
y - = 8 ;
len = COM_ParseFunString ( textflags , pname , buffer , sizeof ( buffer ) , false ) - buffer ;
2019-01-13 16:51:50 +00:00
Draw_ExpandedString ( font , x - len * 4 , y , buffer ) ;
2015-07-09 18:02:49 +00:00
}
2015-06-30 14:05:45 +00:00
if ( ! haveinfo )
return ; //we don't trust the info that we have, so no ids.
2015-07-01 23:15:25 +00:00
h = 0 ;
2015-07-07 02:33:00 +00:00
barwidth = 32 ;
2015-06-30 14:05:45 +00:00
//display health bar
if ( scr_autoid_health . ival )
{
2015-08-14 21:04:00 +00:00
float frac = health / 100.0 ;
2015-08-10 18:28:23 +00:00
if ( frac < 0 )
frac = 0 ;
r = frac ;
frac - = r ;
2015-06-30 14:05:45 +00:00
if ( r > countof ( healthcolours ) - 2 )
{
r = countof ( healthcolours ) - 2 ;
2015-08-10 18:28:23 +00:00
frac = 1 ;
2015-06-30 14:05:45 +00:00
}
2015-07-01 23:15:25 +00:00
h + = 8 ;
2015-06-30 14:05:45 +00:00
y - = 8 ;
R2D_ImageColours ( healthcolours [ r ] [ 0 ] , healthcolours [ r ] [ 1 ] , healthcolours [ r ] [ 2 ] , healthcolours [ r ] [ 3 ] * alpha ) ;
2020-02-11 18:06:10 +00:00
R2D_FillBlock ( x - barwidth * 0.5 + barwidth * frac , y , barwidth * ( 1 - frac ) , 4 ) ;
2015-06-30 14:05:45 +00:00
r + + ;
R2D_ImageColours ( healthcolours [ r ] [ 0 ] , healthcolours [ r ] [ 1 ] , healthcolours [ r ] [ 2 ] , healthcolours [ r ] [ 3 ] * alpha ) ;
2020-02-11 18:06:10 +00:00
R2D_FillBlock ( x - barwidth * 0.5 , y , barwidth * frac , 4 ) ;
2015-06-30 14:05:45 +00:00
}
2015-08-10 18:28:23 +00:00
if ( health < = 0 ) //armour+weapons are not relevant when dead
2020-02-11 18:06:10 +00:00
{
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ;
2015-08-10 18:28:23 +00:00
return ;
2020-02-11 18:06:10 +00:00
}
2015-08-10 18:28:23 +00:00
2015-06-30 14:05:45 +00:00
if ( scr_autoid_armour . ival )
{
//display armour bar above that
if ( items & IT_ARMOR3 )
r = 4 , health = 200 ;
else if ( items & IT_ARMOR2 )
r = 2 , health = 150 ;
else if ( items & IT_ARMOR1 )
r = 0 , health = 100 ;
else r = - 1 ;
if ( r > = 0 )
{
2020-02-11 18:06:10 +00:00
h + = 5 ;
y - = 5 ;
2015-06-30 14:05:45 +00:00
armour = bound ( 0 , armour , health ) ;
barwidth = 32 ;
R2D_ImageColours ( armourcolours [ r ] [ 0 ] , armourcolours [ r ] [ 1 ] , armourcolours [ r ] [ 2 ] , armourcolours [ r ] [ 3 ] * alpha ) ;
2020-02-11 18:06:10 +00:00
R2D_FillBlock ( x - barwidth * 0.5 + barwidth * armour / ( float ) health , y , barwidth * ( health - armour ) / ( float ) health , 4 ) ;
2015-06-30 14:05:45 +00:00
r + + ;
R2D_ImageColours ( armourcolours [ r ] [ 0 ] , armourcolours [ r ] [ 1 ] , armourcolours [ r ] [ 2 ] , armourcolours [ r ] [ 3 ] * alpha ) ;
2020-02-11 18:06:10 +00:00
R2D_FillBlock ( x - barwidth * 0.5 , y , barwidth * armour / ( float ) health , 4 ) ;
2015-06-30 14:05:45 +00:00
}
}
2020-02-11 18:06:10 +00:00
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ;
2015-06-30 14:05:45 +00:00
if ( scr_autoid_weapon . ival )
{
2015-07-08 19:32:16 +00:00
for ( r = countof ( wbitnames ) - 1 ; r > = 0 ; r - - )
2015-06-30 14:05:45 +00:00
if ( items & ( 1 < < r ) )
break ;
2020-02-11 18:06:10 +00:00
if ( r > = 0 & & ( scr_autoid_weapon_mask . ival & ( 1 < < 1 ) ) )
2015-06-30 14:05:45 +00:00
{
2020-02-11 18:06:10 +00:00
if ( scr_autoid_weapon . ival = = 1 )
{
extern apic_t * sb_weapons [ 7 ] [ 8 ] ;
float w = 0 ;
if ( r < 8 & & sb_weapons [ 0 ] [ r ] )
{
if ( h < 16 )
{
y - = 16 - h ;
h = 16 ;
}
y + = ( h - 16 ) / 2 ;
if ( sb_weapons [ 0 ] [ r ] - > width )
w = sb_weapons [ 0 ] [ r ] - > width ;
else
w = sb_weapons [ 0 ] [ r ] - > atlas - > width ;
R2D_ImageAtlas ( x - barwidth * .5 - 24 - 4 , y , 24 , 16 , 0 , 0 , 24 / w , 1 , sb_weapons [ 0 ] [ r ] ) ;
return ;
}
}
if ( h < 8 )
{
y - = 8 - h ;
h = 8 ;
}
y + = ( h - 8 ) / 2 ;
2015-06-30 14:05:45 +00:00
len = COM_ParseFunString ( textflags , wbitnames [ r ] - > string , buffer , sizeof ( buffer ) , false ) - buffer ;
2015-07-01 23:15:25 +00:00
if ( textflags & CON_HALFALPHA )
{
for ( r = 0 ; r < len ; r + + )
if ( ! ( buffer [ r ] & CON_RICHFORECOLOUR ) )
buffer [ r ] | = CON_HALFALPHA ;
}
if ( len & & ( buffer [ 0 ] & CON_CHARMASK ) = = ' { ' & & ( buffer [ len - 1 ] & CON_CHARMASK ) = = ' } ' )
{ //these are often surrounded by {} to make them white in chat messages, and recoloured.
buffer [ len - 1 ] = 0 ;
2020-02-11 18:06:10 +00:00
len = 1 ;
2015-07-01 23:15:25 +00:00
}
else
2020-02-11 18:06:10 +00:00
len = 0 ;
Draw_ExpandedString ( font , x + barwidth * 0.5 + 4 , y , buffer + len ) ;
2015-06-30 14:05:45 +00:00
}
}
}
2020-02-11 18:06:10 +00:00
# endif
2015-06-30 14:05:45 +00:00
# include "pr_common.h"
2017-08-14 16:38:44 +00:00
msurface_t * Mod_GetSurfaceNearPoint ( model_t * model , vec3_t point ) ;
char * Shader_GetShaderBody ( shader_t * s , char * fname , size_t fnamesize ) ;
2015-06-30 14:05:45 +00:00
extern vec3_t nametagorg [ MAX_CLIENTS ] ;
extern qboolean nametagseen [ MAX_CLIENTS ] ;
2017-09-20 11:27:13 +00:00
extern cvar_t r_showshaders , r_showfields , r_projection ;
2015-06-30 14:05:45 +00:00
void R_DrawNameTags ( void )
{
int i ;
2020-02-11 18:06:10 +00:00
# ifdef QUAKESTATS
2015-01-12 12:28:13 +00:00
lerpents_t * le ;
2015-06-30 14:05:45 +00:00
qboolean isteam ;
char * ourteam ;
2015-07-09 18:02:49 +00:00
int ourcolour ;
2020-02-11 18:06:10 +00:00
# endif
2005-06-14 04:52:10 +00:00
2015-07-03 02:07:41 +00:00
if ( r_projection . ival ) //we don't actually know how to transform the points unless the projection is coded in advance. and it isn't.
return ;
2019-01-13 16:51:50 +00:00
# if defined(CSQC_DAT) || !defined(CLIENTONLY)
if ( r_showshaders . ival & & cl . worldmodel & & cl . worldmodel - > loadstate = = MLS_LOADED )
{
2020-10-26 06:30:35 +00:00
# ifdef CSQC_DAT
extern world_t csqc_world ;
# endif
2019-01-13 16:51:50 +00:00
trace_t trace ;
char * str ;
vec3_t targ ;
vec2_t scale = { 12 , 12 } ;
msurface_t * surf ;
VectorMA ( r_refdef . vieworg , 8192 , vpn , targ ) ;
2020-10-26 06:30:35 +00:00
# ifdef CSQC_DAT
if ( csqc_world . progs )
{
int oldhit = csqc_world . edicts - > xv - > hitcontentsmaski ;
csqc_world . edicts - > xv - > hitcontentsmaski = ~ 0 ;
trace = World_Move ( & csqc_world , r_refdef . vieworg , vec3_origin , vec3_origin , targ , MOVE_EVERYTHING , csqc_world . edicts ) ;
csqc_world . edicts - > xv - > hitcontentsmaski = oldhit ;
}
else
# endif
cl . worldmodel - > funcs . NativeTrace ( cl . worldmodel , 0 , PE_FRAMESTATE , NULL , r_refdef . vieworg , targ , vec3_origin , vec3_origin , false , ~ 0 , & trace ) ;
2019-01-13 16:51:50 +00:00
2021-04-14 05:21:04 +00:00
surf = ( trace . fraction = = 1 ) ? NULL : Mod_GetSurfaceNearPoint ( cl . worldmodel , trace . endpos ) ;
2019-01-13 16:51:50 +00:00
if ( surf )
{
shader_t * shader = surf - > texinfo - > texture - > shader ;
char fname [ MAX_QPATH ] ;
char * body = shader ? Shader_GetShaderBody ( shader , fname , countof ( fname ) ) : NULL ;
if ( body )
{
// Q_snprintfz(fname, sizeof(fname), "<default shader>");
2019-03-23 07:06:37 +00:00
str = va ( " ^2%s^7 \n %s%s \n {%s \n " , fname , ruleset_allow_shaders . ival ? " " : CON_ERROR " WARNING: ruleset_allow_shaders disables external shaders " CON_DEFAULT " \n " , surf - > texinfo - > texture - > name , body ) ;
2019-01-13 16:51:50 +00:00
Z_Free ( body ) ;
}
else
str = va ( " hit '%s' " , surf - > texinfo - > texture - > name ) ;
}
else
str = " hit nothing " ;
R_DrawTextField ( r_refdef . vrect . x + r_refdef . vrect . width / 4 , r_refdef . vrect . y , r_refdef . vrect . width / 2 , r_refdef . vrect . height , str , CON_WHITEMASK , CPRINT_LALIGN , font_console , scale ) ;
}
else
# endif
2015-07-03 02:07:41 +00:00
2018-10-11 10:31:23 +00:00
if ( r_showfields . ival )
2015-01-21 18:18:37 +00:00
{
world_t * w = NULL ;
wedict_t * e ;
vec3_t org ;
vec3_t screenspace ;
vec3_t diff ;
2021-10-23 10:05:26 +00:00
int scale = 1 ;
2018-10-11 10:31:23 +00:00
if ( ! cls . allow_cheats )
{
vec2_t scale = { 8 , 8 } ;
float x = 0.5 * r_refdef . vrect . width + r_refdef . vrect . x ;
float y = ( 1 - 0.5 ) * r_refdef . vrect . height + r_refdef . vrect . y ;
R_DrawTextField ( x , y , vid . width - x , vid . height - y , " r_showfields requires sv_cheats 1 " , CON_WHITEMASK , CPRINT_TALIGN | CPRINT_LALIGN , font_console , scale ) ;
w = NULL ;
}
else if ( ( r_showfields . ival & 3 ) = = 1 )
2015-01-21 18:18:37 +00:00
{
# ifndef CLIENTONLY
w = & sv . world ;
# endif
}
2015-06-22 11:49:15 +00:00
else if ( ( r_showfields . ival & 3 ) = = 2 )
2015-01-21 18:18:37 +00:00
{
# ifdef CSQC_DAT
extern world_t csqc_world ;
w = & csqc_world ;
2021-10-23 10:05:26 +00:00
scale = - 1 ;
2015-01-21 18:18:37 +00:00
# endif
}
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
else if ( ( r_showfields . ival & 3 ) = = 3 )
{
inframe_t * frame ;
packet_entities_t * pak ;
entity_state_t * state ;
model_t * mod ;
frame = & cl . inframes [ cl . parsecount & UPDATE_MASK ] ;
pak = & frame - > packet_entities ;
for ( i = 0 ; i < pak - > num_entities ; i + + )
{
state = & pak - > entities [ i ] ;
mod = cl . model_precache [ state - > modelindex ] ;
2015-12-12 19:25:15 +00:00
if ( mod & & mod - > loadstate = = MLS_LOADED )
VectorInterpolate ( mod - > mins , 0.5 , mod - > maxs , org ) ;
else
VectorClear ( org ) ;
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
VectorAdd ( org , state - > origin , org ) ;
if ( Matrix4x4_CM_Project ( org , screenspace , r_refdef . viewangles , r_refdef . vieworg , r_refdef . fov_x , r_refdef . fov_y ) )
{
char * entstr ;
int x , y ;
entstr = va ( " %i " , state - > number ) ;
if ( entstr )
{
vec2_t scale = { 8 , 8 } ;
x = screenspace [ 0 ] * r_refdef . vrect . width + r_refdef . vrect . x ;
y = ( 1 - screenspace [ 1 ] ) * r_refdef . vrect . height + r_refdef . vrect . y ;
R_DrawTextField ( x , y , vid . width - x , vid . height - y , entstr , CON_WHITEMASK , CPRINT_TALIGN | CPRINT_LALIGN , font_default , scale ) ;
}
}
}
}
2019-01-13 16:51:50 +00:00
# ifdef Q2SERVER //not enough fields for it to really be worth it.
if ( w = = & sv . world & & svs . gametype = = GT_QUAKE2 & & ge )
{
struct q2edict_s * e ;
int best = 0 ;
float bestscore = 0 , score = 0 ;
for ( i = 1 ; i < ge - > num_edicts ; i + + )
{
e = & ge - > edicts [ i ] ;
if ( ! e - > inuse )
continue ;
VectorInterpolate ( e - > mins , 0.5 , e - > maxs , org ) ;
VectorAdd ( org , e - > s . origin , org ) ;
VectorSubtract ( org , r_refdef . vieworg , diff ) ;
if ( DotProduct ( diff , diff ) < 16 * 16 )
continue ; //ignore stuff too close(like the player themselves)
VectorNormalize ( diff ) ;
score = DotProduct ( diff , vpn ) ; // r_refdef.viewaxis[0]);
if ( score > bestscore )
{
int hitent ;
vec3_t imp ;
if ( CL_TraceLine ( r_refdef . vieworg , org , imp , NULL , & hitent ) > = 1 | | hitent = = i )
{
best = i ;
bestscore = score ;
}
}
}
if ( best )
{
e = & ge - > edicts [ best ] ;
VectorInterpolate ( e - > mins , 0.5 , e - > maxs , org ) ;
VectorAdd ( org , e - > s . origin , org ) ;
if ( Matrix4x4_CM_Project ( org , screenspace , r_refdef . viewangles , r_refdef . vieworg , r_refdef . fov_x , r_refdef . fov_y ) )
{
char * entstr = va ( " entity %i { \n \t modelindex %i \n \t origin \" %f %f %f \" \n } \n " , e - > s . number , e - > s . modelindex , e - > s . origin [ 0 ] , e - > s . origin [ 1 ] , e - > s . origin [ 2 ] ) ;
if ( entstr )
{
vec2_t scale = { 8 , 8 } ;
int x = screenspace [ 0 ] * r_refdef . vrect . width + r_refdef . vrect . x ;
int y = ( 1 - screenspace [ 1 ] ) * r_refdef . vrect . height + r_refdef . vrect . y ;
R_DrawTextField ( x , y , vid . width - x , vid . height - y , entstr , CON_WHITEMASK , CPRINT_TALIGN | CPRINT_LALIGN , font_console , scale ) ;
}
}
}
}
else
# endif
2015-01-21 18:18:37 +00:00
if ( w & & w - > progs )
{
2015-06-22 11:49:15 +00:00
int best = 0 ;
float bestscore = 0 , score = 0 ;
for ( i = 1 ; i < w - > num_edicts ; i + + )
2015-01-21 18:18:37 +00:00
{
2018-04-06 17:21:15 +00:00
e = WEDICT_NUM_PB ( w - > progs , i ) ;
2016-07-21 19:27:59 +00:00
if ( ED_ISFREE ( e ) )
2015-06-22 11:49:15 +00:00
continue ;
VectorInterpolate ( e - > v - > mins , 0.5 , e - > v - > maxs , org ) ;
VectorAdd ( org , e - > v - > origin , org ) ;
VectorSubtract ( org , r_refdef . vieworg , diff ) ;
if ( DotProduct ( diff , diff ) < 16 * 16 )
continue ; //ignore stuff too close(like the player themselves)
VectorNormalize ( diff ) ;
score = DotProduct ( diff , vpn ) ; // r_refdef.viewaxis[0]);
if ( score > bestscore )
2015-01-21 18:18:37 +00:00
{
2017-08-29 02:29:06 +00:00
int hitent ;
2015-06-22 11:49:15 +00:00
vec3_t imp ;
2021-10-23 10:05:26 +00:00
if ( CL_TraceLine ( r_refdef . vieworg , org , imp , NULL , & hitent ) > = 1 | | hitent * scale = = i )
2015-06-22 11:49:15 +00:00
{
best = i ;
bestscore = score ;
}
2015-01-21 18:18:37 +00:00
}
2015-06-22 11:49:15 +00:00
}
if ( best )
{
2018-04-06 17:21:15 +00:00
e = WEDICT_NUM_PB ( w - > progs , best ) ;
2015-06-22 11:49:15 +00:00
VectorInterpolate ( e - > v - > mins , 0.5 , e - > v - > maxs , org ) ;
VectorAdd ( org , e - > v - > origin , org ) ;
if ( Matrix4x4_CM_Project ( org , screenspace , r_refdef . viewangles , r_refdef . vieworg , r_refdef . fov_x , r_refdef . fov_y ) )
{
char asciibuffer [ 8192 ] ;
2020-03-25 21:29:30 +00:00
const char * entstr ;
2016-02-10 23:23:43 +00:00
size_t buflen ;
2015-06-22 11:49:15 +00:00
int x , y ;
sprintf ( asciibuffer , " entity %i " , e - > entnum ) ;
buflen = strlen ( asciibuffer ) ;
entstr = w - > progs - > saveent ( w - > progs , asciibuffer , & buflen , sizeof ( asciibuffer ) , ( edict_t * ) e ) ; //will save just one entities vars
if ( entstr )
{
vec2_t scale = { 8 , 8 } ;
x = screenspace [ 0 ] * r_refdef . vrect . width + r_refdef . vrect . x ;
y = ( 1 - screenspace [ 1 ] ) * r_refdef . vrect . height + r_refdef . vrect . y ;
2020-03-25 21:29:30 +00:00
y + = scale [ 1 ] * R_DrawTextField ( x , y , vid . width - x , vid . height - y , entstr , CON_WHITEMASK , CPRINT_TALIGN | CPRINT_LALIGN , font_console , scale ) ;
# ifdef CSQC_DAT
{
extern world_t csqc_world ;
if ( w = = & csqc_world )
{
entstr = CSQC_GetExtraFieldInfo ( e , asciibuffer , sizeof ( asciibuffer ) ) ;
if ( entstr )
y + = scale [ 1 ] * R_DrawTextField ( x , y , vid . width - x , vid . height - y , entstr , CON_WHITEMASK , CPRINT_TALIGN | CPRINT_LALIGN , font_console , scale ) ;
}
}
# endif
2015-06-22 11:49:15 +00:00
}
}
2015-01-21 18:18:37 +00:00
}
}
}
2020-02-11 18:06:10 +00:00
# ifdef QUAKESTATS
2019-01-13 16:51:50 +00:00
if ( cls . protocol = = CP_QUAKE2 )
return ; //FIXME: q2 has its own ent logic, which messes stuff up here.
2017-08-14 16:38:44 +00:00
2017-05-28 15:42:32 +00:00
if ( ( ( ! r_refdef . playerview - > spectator & & ! cls . demoplayback ) | | ! scr_autoid . ival ) & & ( ! cl . teamplay | | ! scr_autoid_team . ival ) )
2005-09-28 23:31:17 +00:00
return ;
2015-09-01 04:45:15 +00:00
if ( cls . state ! = ca_active | | ! cl . validsequence | | cl . intermissionmode ! = IM_NONE )
2009-07-17 22:28:16 +00:00
return ;
2005-06-14 04:52:10 +00:00
2015-07-03 02:07:41 +00:00
if ( r_refdef . playerview - > cam_state ! = CAM_FREECAM & & r_refdef . playerview - > cam_spec_track > = 0 )
2015-07-09 18:02:49 +00:00
{
2015-06-30 14:05:45 +00:00
ourteam = cl . players [ r_refdef . playerview - > cam_spec_track ] . team ;
2015-07-09 18:02:49 +00:00
ourcolour = cl . players [ r_refdef . playerview - > cam_spec_track ] . rbottomcolor ;
}
2015-06-30 14:05:45 +00:00
else
2015-07-09 18:02:49 +00:00
{
2015-06-30 14:05:45 +00:00
ourteam = cl . players [ r_refdef . playerview - > playernum ] . team ;
2015-07-09 18:02:49 +00:00
ourcolour = cl . players [ r_refdef . playerview - > playernum ] . rbottomcolor ;
}
2005-06-14 04:52:10 +00:00
2020-02-11 18:06:10 +00:00
pmove . skipent = r_refdef . playerview - > playernum + 1 ;
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < cl . allocated_client_slots ; i + + )
2005-06-14 04:52:10 +00:00
{
2015-06-30 14:05:45 +00:00
if ( ! * cl . players [ i ] . name )
continue ; //slot is empty.
2009-07-17 22:28:16 +00:00
if ( ! nametagseen [ i ] )
2015-01-12 12:28:13 +00:00
{
2015-06-30 14:05:45 +00:00
if ( i + 1 < cl . maxlerpents & & cl . lerpentssequence & & cl . lerpents [ i + 1 ] . sequence = = cl . lerpentssequence )
{
le = & cl . lerpents [ i + 1 ] ;
VectorCopy ( le - > origin , nametagorg [ i ] ) ;
}
else if ( cl . lerpplayers [ i ] . sequence = = cl . lerpentssequence )
{
le = & cl . lerpplayers [ i ] ;
VectorCopy ( le - > origin , nametagorg [ i ] ) ;
}
else if ( cl . players [ i ] . tinfo . time > cl . time )
VectorCopy ( cl . players [ i ] . tinfo . org , nametagorg [ i ] ) ;
else
2015-01-12 12:28:13 +00:00
continue ;
}
2015-06-30 14:05:45 +00:00
2015-01-12 12:28:13 +00:00
//while cl.lerpplayers exists, it tends to not be configured properly.
2013-06-23 02:17:02 +00:00
if ( i = = r_refdef . playerview - > playernum )
2007-08-04 14:13:50 +00:00
continue ; // Don't draw tag for the local player
2012-11-27 03:23:19 +00:00
if ( cl . players [ i ] . spectator )
continue ;
2015-06-30 14:05:45 +00:00
if ( i = = Cam_TrackNum ( r_refdef . playerview ) ) //no tag for the player that you're tracking, either.
2012-11-27 03:23:19 +00:00
continue ;
2009-07-17 22:28:16 +00:00
2015-07-09 18:02:49 +00:00
if ( ! cl . teamplay | | ! scr_autoid_team . ival )
2015-06-30 14:05:45 +00:00
isteam = false ;
2017-05-28 15:42:32 +00:00
else if ( ( cl . teamfortress & & ! r_refdef . playerview - > spectator ) | | cls . protocol = = CP_NETQUAKE ) //teamfortress should go by their colours instead, because spies. primarily this is to allow enemy spies to appear through walls as well as your own team (note that the qc will also need tinfo stuff for tf, to avoid issues with just checking player names).
2015-07-09 18:02:49 +00:00
isteam = cl . players [ i ] . rbottomcolor = = ourcolour ;
2015-06-30 14:05:45 +00:00
else
2015-07-09 18:02:49 +00:00
isteam = ! strcmp ( cl . players [ i ] . team , ourteam ) ;
if ( ! isteam )
2017-05-28 15:42:32 +00:00
if ( ( ! r_refdef . playerview - > spectator & & ! cls . demoplayback ) | | ! scr_autoid . ival )
2015-07-09 18:02:49 +00:00
continue ; //only show our team when playing, too cheaty otherwise.
2015-06-30 14:05:45 +00:00
SCR_DrawAutoID ( nametagorg [ i ] , & cl . players [ i ] , isteam ) ;
2005-06-14 04:52:10 +00:00
}
2020-02-11 18:06:10 +00:00
# endif
2005-06-14 04:52:10 +00:00
}
2012-11-27 03:23:19 +00:00
void R2D_PolyBlend ( void ) ;
2013-06-23 02:17:02 +00:00
void V_RenderPlayerViews ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
2009-05-24 10:11:17 +00:00
int oldnuments ;
------------------------------------------------------------------------
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
int oldstris ;
2007-08-07 14:41:23 +00:00
# ifdef SIDEVIEWS
2004-08-23 00:15:46 +00:00
int viewnum ;
2007-08-07 14:41:23 +00:00
# endif
2012-02-14 15:50:34 +00:00
// cl.simangles[plnum][ROLL] = 0; // FIXME @@@
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
DropPunchAngle ( pv ) ;
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
Cam_SelfTrack ( pv ) ;
2014-09-08 23:47:19 +00:00
oldnuments = cl_numvisedicts ;
oldstris = cl_numstris ;
CL_LinkViewModel ( ) ;
2015-09-01 04:45:15 +00:00
if ( cl . intermissionmode ! = IM_NONE )
2004-11-17 18:04:43 +00:00
{ // intermission / finale rendering
2013-06-23 02:17:02 +00:00
V_CalcIntermissionRefdef ( pv ) ;
2004-11-17 18:04:43 +00:00
}
2004-08-23 00:15:46 +00:00
else
{
2013-06-23 02:17:02 +00:00
V_DriftPitch ( pv ) ;
V_CalcRefdef ( pv ) ;
2004-11-17 18:04:43 +00:00
}
2013-06-23 02:17:02 +00:00
V_ApplyRefdef ( ) ;
2004-08-23 00:15:46 +00:00
2010-08-16 02:03:02 +00:00
R_RenderView ( ) ;
2012-11-27 03:23:19 +00:00
R2D_PolyBlend ( ) ;
2010-08-16 02:03:02 +00:00
R_DrawNameTags ( ) ;
2018-11-19 06:37:25 +00:00
# ifdef RTLIGHTS
R_EditLights_DrawInfo ( ) ;
# endif
2005-04-16 16:21:27 +00:00
2016-01-18 05:22:07 +00:00
if ( cl . intermissionmode = = IM_NONE )
R2D_DrawCrosshair ( ) ;
2009-05-24 10:11:17 +00:00
cl_numvisedicts = oldnuments ;
------------------------------------------------------------------------
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_numstris = oldstris ;
2009-05-24 10:11:17 +00:00
2014-02-07 08:38:40 +00:00
r_secondaryview = true ;
2009-07-17 22:28:16 +00:00
2004-08-23 00:15:46 +00:00
# ifdef SIDEVIEWS
/* //adjust main view height to strip off the rearviews at the top
if ( vsecwidth > = 1 )
2011-05-15 13:23:13 +00:00
{
2004-08-23 00:15:46 +00:00
r_refdef . vrect . y - = vsecheight ;
r_refdef . vrect . height + = vsecheight ;
}
*/
for ( viewnum = 0 ; viewnum < SIDEVIEWS ; viewnum + + )
2019-06-05 20:48:06 +00:00
if ( sideview [ viewnum ] . scalex . value > 0 & & sideview [ viewnum ] . scaley . value > 0
& & ( ( sideview [ viewnum ] . enabled . value & & sideview [ viewnum ] . enabled . value ! = 2 ) //rearview if v2_enabled = 1 and not 2
| | ( sideview [ viewnum ] . enabled . value & & pv - > stats [ STAT_VIEW2 ] & & viewnum = = 0 ) ) ) //v2 enabled if v2_enabled is non-zero
2004-08-23 00:15:46 +00:00
{
vrect_t oldrect ;
vec3_t oldangles ;
vec3_t oldposition ;
// int oldviewent;
struct entity_s * e ;
float ofx ;
float ofy ;
2019-06-05 20:48:06 +00:00
if ( sideview [ viewnum ] . x . value < 0 )
sideview [ viewnum ] . x . value = 0 ;
if ( sideview [ viewnum ] . y . value < 0 )
sideview [ viewnum ] . y . value = 0 ;
2004-08-23 00:15:46 +00:00
2019-06-05 20:48:06 +00:00
if ( sideview [ viewnum ] . scalex . value + sideview [ viewnum ] . x . value > 1 )
2004-08-23 00:15:46 +00:00
continue ;
2019-06-05 20:48:06 +00:00
if ( sideview [ viewnum ] . scaley . value + sideview [ viewnum ] . y . value > 1 )
2004-08-23 00:15:46 +00:00
continue ;
2009-07-17 22:28:16 +00:00
2004-08-23 00:15:46 +00:00
oldrect = r_refdef . vrect ;
memcpy ( oldangles , r_refdef . viewangles , sizeof ( vec3_t ) ) ;
memcpy ( oldposition , r_refdef . vieworg , sizeof ( vec3_t ) ) ;
ofx = r_refdef . fov_x ;
ofy = r_refdef . fov_y ;
2019-06-05 20:48:06 +00:00
r_refdef . vrect . x + = r_refdef . vrect . width * sideview [ viewnum ] . x . value ;
r_refdef . vrect . y + = r_refdef . vrect . height * sideview [ viewnum ] . y . value ;
r_refdef . vrect . width * = sideview [ viewnum ] . scalex . value ;
r_refdef . vrect . height * = sideview [ viewnum ] . scaley . value ;
2014-02-07 08:38:40 +00:00
r_refdef . fov_x = 0 ;
r_refdef . fov_y = 0 ;
V_ApplyAFov ( NULL ) ;
2004-08-23 00:15:46 +00:00
# ifdef PEXT_VIEW2
//secondary view entity.
e = NULL ;
2013-06-23 02:17:02 +00:00
if ( viewnum = = 0 & & pv - > stats [ STAT_VIEW2 ] )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
e = CL_EntityNum ( pv - > stats [ STAT_VIEW2 ] ) ;
2004-08-23 00:15:46 +00:00
}
if ( e )
{
2011-05-15 13:23:13 +00:00
memcpy ( r_refdef . viewangles , e - > angles , sizeof ( vec3_t ) ) ;
memcpy ( r_refdef . vieworg , e - > origin , sizeof ( vec3_t ) ) ;
2013-05-11 05:03:07 +00:00
// cl.viewentity = cl.viewentity2;
2004-08-23 00:15:46 +00:00
r_refdef . vieworg [ 0 ] = r_refdef . vieworg [ 0 ] ; //*s+(1-s)*e->lerporigin[0];
r_refdef . vieworg [ 1 ] = r_refdef . vieworg [ 1 ] ; //*s+(1-s)*e->lerporigin[1];
r_refdef . vieworg [ 2 ] = r_refdef . vieworg [ 2 ] ; //*s+(1-s)*e->lerporigin[2];
2009-07-17 22:28:16 +00:00
2004-08-23 00:15:46 +00:00
r_refdef . viewangles [ 0 ] = e - > angles [ 0 ] ; //*s+(1-s)*e->msg_angles[1][0];
r_refdef . viewangles [ 1 ] = e - > angles [ 1 ] ; //*s+(1-s)*e->msg_angles[1][1];
r_refdef . viewangles [ 2 ] = e - > angles [ 2 ] ; //*s+(1-s)*e->msg_angles[1][2];
2013-06-23 02:17:02 +00:00
if ( e - > keynum > = 1 & & e - > keynum < = cl . allocated_client_slots )
{
r_refdef . viewangles [ PITCH ] * = 3 ;
r_refdef . vieworg [ 2 ] + = pv - > statsf [ STAT_VIEWHEIGHT ] ;
}
2016-07-12 00:40:13 +00:00
V_EditExternalModels ( e - > keynum , NULL , 0 ) ;
2004-08-23 00:15:46 +00:00
R_RenderView ( ) ;
// r_framecount = old_framecount;
}
else
# endif
{
//rotate the view, keeping pitch and roll.
2019-06-05 20:48:06 +00:00
r_refdef . viewangles [ YAW ] + = sideview [ viewnum ] . yaw . value ;
r_refdef . viewangles [ ROLL ] + = sin ( sideview [ viewnum ] . yaw . value / 180 * 3.14 ) * r_refdef . viewangles [ PITCH ] ;
r_refdef . viewangles [ PITCH ] * = - cos ( ( sideview [ viewnum ] . yaw . value / 180 * 3.14 ) + 3.14 ) ;
if ( sideview [ viewnum ] . enabled . value ! = 2 )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
V_EditExternalModels ( pv - > viewentity , NULL , 0 ) ;
2004-08-23 00:15:46 +00:00
R_RenderView ( ) ;
}
}
r_refdef . vrect = oldrect ;
2011-05-15 13:23:13 +00:00
memcpy ( r_refdef . viewangles , oldangles , sizeof ( vec3_t ) ) ;
2004-08-23 00:15:46 +00:00
memcpy ( r_refdef . vieworg , oldposition , sizeof ( vec3_t ) ) ;
r_refdef . fov_x = ofx ;
r_refdef . fov_y = ofy ;
}
# endif
2010-07-11 02:22:39 +00:00
r_refdef . externalview = false ;
2004-11-17 18:04:43 +00:00
}
2018-11-19 06:37:25 +00:00
void V_RenderView ( qboolean no2d )
2004-11-17 18:04:43 +00:00
{
2018-03-25 09:36:14 +00:00
int seatnum ;
int maxseats = cl . splitclients ;
2021-08-04 21:18:20 +00:00
int pl ;
2004-11-17 18:04:43 +00:00
2013-07-14 12:22:51 +00:00
Surf_LessenStains ( ) ;
2004-11-17 18:04:43 +00:00
2021-12-20 10:06:43 +00:00
// if (cls.state != ca_active)
// return;
2004-11-17 18:04:43 +00:00
2015-09-01 04:45:15 +00:00
if ( cl . intermissionmode ! = IM_NONE )
2018-03-25 09:36:14 +00:00
maxseats = 1 ;
2021-08-04 21:18:20 +00:00
else if ( cl_forceseat . ival & & cl_splitscreen . ival > = 4 )
maxseats = 1 ;
2021-12-20 10:06:43 +00:00
else
maxseats = max ( 1 , cl . splitclients ) ;
2015-07-30 16:26:15 +00:00
2013-06-23 02:17:02 +00:00
R_PushDlights ( ) ;
2009-07-17 22:28:16 +00:00
2013-06-23 02:17:02 +00:00
r_secondaryview = 0 ;
2021-12-20 10:06:43 +00:00
for ( seatnum = 0 ; seatnum < maxseats ; seatnum + + )
2013-06-23 02:17:02 +00:00
{
2021-08-04 21:18:20 +00:00
pl = ( maxseats = = 1 & & cl_forceseat . ival > = 1 ) ? ( cl_forceseat . ival - 1 ) % cl . splitclients : seatnum ;
V_ClearRefdef ( & cl . playerview [ pl ] ) ;
2018-11-19 06:37:25 +00:00
if ( no2d )
r_refdef . drawcrosshair = r_refdef . drawsbar = 0 ;
2018-03-25 09:36:14 +00:00
if ( seatnum )
2013-06-23 02:17:02 +00:00
{
//should be enough to just hack a few things.
2018-03-25 09:36:14 +00:00
V_EditExternalModels ( r_refdef . playerview - > viewentity , NULL , 0 ) ;
2013-06-23 02:17:02 +00:00
}
else
{
2014-10-05 20:04:11 +00:00
if ( r_worldentity . model & & r_worldentity . model - > loadstate = = MLS_LOADED )
2013-06-23 02:17:02 +00:00
{
RSpeedMark ( ) ;
2005-02-28 07:16:19 +00:00
2013-06-23 02:17:02 +00:00
CL_AllowIndependantSendCmd ( false ) ;
2011-12-05 15:23:40 +00:00
2014-03-30 08:55:06 +00:00
CL_SetSolidEntities ( ) ;
2013-06-23 02:17:02 +00:00
CL_TransitionEntities ( ) ;
CL_PredictMove ( ) ;
2005-02-28 07:16:19 +00:00
2013-06-23 02:17:02 +00:00
// build a refresh entity list
CL_EmitEntities ( ) ;
2005-04-16 16:21:27 +00:00
2013-06-23 02:17:02 +00:00
CL_AllowIndependantSendCmd ( true ) ;
2005-02-12 18:56:04 +00:00
2013-06-23 02:17:02 +00:00
RSpeedEnd ( RSPEED_LINKENTITIES ) ;
}
}
2015-07-30 16:26:15 +00:00
if ( R2D_Flush )
R2D_Flush ( ) ;
2018-03-25 09:36:14 +00:00
SCR_VRectForPlayer ( & r_refdef . grect , seatnum , maxseats ) ;
2013-06-23 02:17:02 +00:00
V_RenderPlayerViews ( r_refdef . playerview ) ;
2004-11-17 18:04:43 +00:00
2021-12-20 10:06:43 +00:00
if ( ! vrui . enabled )
{
2013-07-31 00:20:16 +00:00
# ifdef PLUGINS
2021-12-20 10:06:43 +00:00
Plug_SBar ( r_refdef . playerview ) ;
2013-07-31 00:20:16 +00:00
# else
2021-12-20 10:06:43 +00:00
if ( Sbar_ShouldDraw ( r_refdef . playerview ) )
{
SCR_TileClear ( sb_lines ) ;
Sbar_Draw ( r_refdef . playerview ) ;
Sbar_DrawScoreboard ( r_refdef . playerview ) ;
}
else
SCR_TileClear ( 0 ) ;
2013-07-31 00:20:16 +00:00
# endif
2021-12-20 10:06:43 +00:00
}
2004-11-17 18:04:43 +00:00
}
2018-03-25 09:36:14 +00:00
if ( seatnum > 1 )
{
int extra = 0 ;
for ( ; ; seatnum + + , extra + + )
{
if ( ! SCR_VRectForPlayer ( & r_refdef . grect , seatnum , maxseats ) )
break ;
switch ( extra )
{
2021-06-23 02:14:13 +00:00
#if 0 //def QUAKEHUD
2018-03-25 09:36:14 +00:00
case 0 : //show a mini-console.
{
2018-11-19 06:37:25 +00:00
console_t * con = Con_GetMain ( ) ;
2018-03-25 09:36:14 +00:00
extern cvar_t gl_conback ;
shader_t * conback ;
if ( * gl_conback . string & & ( conback = R_RegisterPic ( gl_conback . string , NULL ) ) & & R_GetShaderSizes ( conback , NULL , NULL , true ) > 0 )
R2D_Image ( r_refdef . grect . x , r_refdef . grect . y , r_refdef . grect . width , r_refdef . grect . height , 0 , 0 , 1 , 1 , conback ) ;
else if ( ( conback = R_RegisterPic ( " gfx/conback.lmp " , NULL ) ) & & R_GetShaderSizes ( conback , NULL , NULL , true ) > 0 )
R2D_Image ( r_refdef . grect . x , r_refdef . grect . y , r_refdef . grect . width , r_refdef . grect . height , 0 , 0 , 1 , 1 , conback ) ;
else
R2D_TileClear ( r_refdef . grect . x , r_refdef . grect . y , r_refdef . grect . width , r_refdef . grect . height ) ;
2018-11-19 06:37:25 +00:00
if ( ! scr_con_target & & con )
2018-03-25 09:36:14 +00:00
{
int gah ;
Font_BeginString ( font_console , 0 , 0 , & gah , & gah ) ;
Con_DrawOneConsole ( con , con - > flags & CONF_KEYFOCUSED , font_console , r_refdef . grect . x + 8 , r_refdef . grect . y , r_refdef . grect . width - 16 , r_refdef . grect . height - Font_CharHeight ( ) , 0 ) ;
}
}
break ;
case 1 : //show some scores, because we can.
{ //FIXME: show ALL tracked players.
int tmp ;
R2D_TileClear ( r_refdef . grect . x , r_refdef . grect . y , r_refdef . grect . width , r_refdef . grect . height ) ;
r_refdef . playerview = & cl . playerview [ 0 ] ;
tmp = r_refdef . playerview - > sb_showscores ;
r_refdef . playerview - > sb_showscores = true ;
Sbar_DrawScoreboard ( r_refdef . playerview ) ;
r_refdef . playerview - > sb_showscores = tmp ;
}
break ;
case 2 :
{
static playerview_t cam_view ;
vec3_t dir ;
int track = cl . playerview [ 0 ] . cam_spec_track ;
if ( track < 0 )
track = cl . playerview [ 0 ] . playernum ;
if ( cam_view . cam_state = = CAM_FREECAM | | cam_view . cam_spec_track ! = track )
cam_view . cam_state = CAM_PENDING ;
cam_view . playernum = - 1 ; //cl.playerview[0].playernum;
cam_view . cam_spec_track = track ;
cam_view . viewentity = 0 ;
cam_view . nolocalplayer = true ;
cam_view . spectator = true ;
Cam_Track ( & cam_view , NULL ) ;
VectorSubtract ( cl . playerview [ 0 ] . simorg , cam_view . cam_desired_position , dir ) ;
VectorAngles ( dir , NULL , cam_view . simangles , false ) ;
VectorCopy ( cam_view . cam_desired_position , cam_view . simorg ) ;
V_ClearRefdef ( & cam_view ) ;
2021-06-23 02:14:13 +00:00
SCR_VRectForPlayer ( & r_refdef . grect , seatnum , maxseats ) ;
2018-03-25 09:36:14 +00:00
V_EditExternalModels ( 0 , NULL , 0 ) ;
V_RenderPlayerViews ( r_refdef . playerview ) ;
}
break ;
# endif
default : //wow, loads. nothing to show though.
R2D_TileClear ( r_refdef . grect . x , r_refdef . grect . y , r_refdef . grect . width , r_refdef . grect . height ) ;
break ;
}
}
}
2013-06-23 02:17:02 +00:00
r_refdef . playerview = NULL ;
2004-08-23 00:15:46 +00:00
}
//============================================================================
/*
= = = = = = = = = = = = =
V_Init
= = = = = = = = = = = = =
*/
void V_Init ( void )
{
# define VIEWVARS "View variables"
# ifdef SIDEVIEWS
int i ;
# endif
2011-05-15 13:23:13 +00:00
Cmd_AddCommand ( " v_cshift " , V_cshift_f ) ;
2004-08-23 00:15:46 +00:00
Cmd_AddCommand ( " bf " , V_BonusFlash_f ) ;
2012-01-17 07:57:46 +00:00
Cmd_AddCommand ( " df " , V_DarkFlash_f ) ;
Cmd_AddCommand ( " wf " , V_WhiteFlash_f ) ;
2018-01-03 04:40:06 +00:00
Cmd_AddCommand ( " centerview " , V_CenterView_f ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & v_centermove , VIEWVARS ) ;
Cvar_Register ( & v_centerspeed , VIEWVARS ) ;
Cvar_Register ( & v_idlescale , VIEWVARS ) ;
Cvar_Register ( & v_iyaw_cycle , VIEWVARS ) ;
Cvar_Register ( & v_iroll_cycle , VIEWVARS ) ;
Cvar_Register ( & v_ipitch_cycle , VIEWVARS ) ;
Cvar_Register ( & v_iyaw_level , VIEWVARS ) ;
Cvar_Register ( & v_iroll_level , VIEWVARS ) ;
Cvar_Register ( & v_ipitch_level , VIEWVARS ) ;
2020-11-04 10:19:30 +00:00
Cvar_Register ( & v_cshift_empty , VIEWVARS ) ;
Cvar_Register ( & v_cshift_water , VIEWVARS ) ;
Cvar_Register ( & v_cshift_slime , VIEWVARS ) ;
Cvar_Register ( & v_cshift_lava , VIEWVARS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & v_contentblend , VIEWVARS ) ;
Cvar_Register ( & v_damagecshift , VIEWVARS ) ;
Cvar_Register ( & v_quadcshift , VIEWVARS ) ;
Cvar_Register ( & v_suitcshift , VIEWVARS ) ;
Cvar_Register ( & v_ringcshift , VIEWVARS ) ;
Cvar_Register ( & v_pentcshift , VIEWVARS ) ;
2006-02-26 05:53:06 +00:00
Cvar_Register ( & v_gunkick , VIEWVARS ) ;
2011-04-20 03:38:59 +00:00
Cvar_Register ( & v_gunkick_q2 , VIEWVARS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & v_bonusflash , VIEWVARS ) ;
2005-01-13 16:29:20 +00:00
Cvar_Register ( & v_viewheight , VIEWVARS ) ;
2016-07-12 00:40:13 +00:00
Cvar_Register ( & v_depthsortentities , VIEWVARS ) ;
2005-01-13 16:29:20 +00:00
2004-08-23 00:15:46 +00:00
Cvar_Register ( & crosshaircolor , VIEWVARS ) ;
Cvar_Register ( & crosshair , VIEWVARS ) ;
2004-10-10 06:32:29 +00:00
Cvar_Register ( & crosshairsize , VIEWVARS ) ;
Cvar_Register ( & crosshaircorrect , VIEWVARS ) ;
2005-01-13 16:29:20 +00:00
Cvar_Register ( & crosshairimage , VIEWVARS ) ;
Cvar_Register ( & crosshairalpha , VIEWVARS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & cl_crossx , VIEWVARS ) ;
Cvar_Register ( & cl_crossy , VIEWVARS ) ;
Cvar_Register ( & gl_cshiftpercent , VIEWVARS ) ;
2008-07-16 00:19:33 +00:00
Cvar_Register ( & gl_cshiftenabled , VIEWVARS ) ;
2018-10-11 10:31:23 +00:00
Cvar_Register ( & gl_cshiftborder , VIEWVARS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & cl_rollspeed , VIEWVARS ) ;
Cvar_Register ( & cl_rollangle , VIEWVARS ) ;
2019-03-01 22:39:30 +00:00
Cvar_Register ( & cl_rollalpha , VIEWVARS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & cl_bob , VIEWVARS ) ;
Cvar_Register ( & cl_bobcycle , VIEWVARS ) ;
Cvar_Register ( & cl_bobup , VIEWVARS ) ;
2018-09-30 01:41:25 +00:00
Cvar_Register ( & cl_bobmodel , VIEWVARS ) ;
Cvar_Register ( & cl_bobmodel_side , VIEWVARS ) ;
Cvar_Register ( & cl_bobmodel_up , VIEWVARS ) ;
Cvar_Register ( & cl_bobmodel_speed , VIEWVARS ) ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
Cvar_Register ( & v_viewmodel_quake , VIEWVARS ) ;
2018-09-30 01:41:25 +00:00
2004-08-23 00:15:46 +00:00
Cvar_Register ( & v_kicktime , VIEWVARS ) ;
Cvar_Register ( & v_kickroll , VIEWVARS ) ;
Cvar_Register ( & v_kickpitch , VIEWVARS ) ;
2005-06-22 04:02:36 +00:00
Cvar_Register ( & v_deathtilt , VIEWVARS ) ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
Cvar_Register ( & v_skyroom , VIEWVARS ) ;
2004-08-23 00:15:46 +00:00
2020-02-11 18:06:10 +00:00
# ifdef QUAKESTATS
2005-09-28 23:31:17 +00:00
Cvar_Register ( & scr_autoid , VIEWVARS ) ;
2015-06-30 14:05:45 +00:00
Cvar_Register ( & scr_autoid_team , VIEWVARS ) ;
Cvar_Register ( & scr_autoid_health , VIEWVARS ) ;
Cvar_Register ( & scr_autoid_armour , VIEWVARS ) ;
Cvar_Register ( & scr_autoid_weapon , VIEWVARS ) ;
2020-02-11 18:06:10 +00:00
Cvar_Register ( & scr_autoid_weapon_mask , VIEWVARS ) ;
2015-06-30 14:05:45 +00:00
Cvar_Register ( & scr_autoid_teamcolour , VIEWVARS ) ;
Cvar_Register ( & scr_autoid_enemycolour , VIEWVARS ) ;
2020-02-11 18:06:10 +00:00
# endif
2005-09-28 23:31:17 +00:00
2004-08-23 00:15:46 +00:00
# ifdef SIDEVIEWS
# define SECONDARYVIEWVARS "Secondary view vars"
for ( i = 0 ; i < SIDEVIEWS ; i + + )
{
2019-06-05 20:48:06 +00:00
Cvar_Register ( & sideview [ i ] . enabled , SECONDARYVIEWVARS ) ;
Cvar_Register ( & sideview [ i ] . x , SECONDARYVIEWVARS ) ;
Cvar_Register ( & sideview [ i ] . y , SECONDARYVIEWVARS ) ;
Cvar_Register ( & sideview [ i ] . scalex , SECONDARYVIEWVARS ) ;
Cvar_Register ( & sideview [ i ] . scaley , SECONDARYVIEWVARS ) ;
Cvar_Register ( & sideview [ i ] . yaw , SECONDARYVIEWVARS ) ;
2004-08-23 00:15:46 +00:00
}
# endif
Cvar_Register ( & ffov , VIEWVARS ) ;
2015-07-03 02:07:41 +00:00
Cvar_Register ( & r_projection , VIEWVARS ) ;
2004-08-23 00:15:46 +00:00
2019-04-07 16:41:09 +00:00
BuildGammaTable ( 1.0 , 1.0 , 1.0 , 0.0 ) ; // no gamma yet
2021-04-14 05:21:04 +00:00
Cvar_Register ( & v_gammainverted , VIEWVARS ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & v_gamma , VIEWVARS ) ;
Cvar_Register ( & v_contrast , VIEWVARS ) ;
2019-04-07 16:41:09 +00:00
Cvar_Register ( & v_contrastboost , VIEWVARS ) ;
2013-05-11 14:02:55 +00:00
Cvar_Register ( & v_brightness , VIEWVARS ) ;
2014-09-08 23:47:19 +00:00
2014-09-17 03:04:08 +00:00
Cvar_Register ( & chase_active , VIEWVARS ) ;
Cvar_Register ( & chase_back , VIEWVARS ) ;
Cvar_Register ( & chase_up , VIEWVARS ) ;
2015-03-05 22:14:21 +00:00
# if defined(_WIN32) && !defined(MINIMAL)
Cvar_Register ( & itburnsitburnsmakeitstop , VIEWVARS ) ;
# endif
2004-08-23 00:15:46 +00:00
}