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"
2004-09-20 23:25:38 +00:00
2011-05-15 13:23:13 +00:00
# include <ctype.h> // for isdigit();
2006-02-11 02:09:43 +00:00
cvar_t ffov = SCVAR ( " ffov " , " 0 " ) ;
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
2007-07-25 09:23:14 +00:00
cvar_t vsec_enabled [ SIDEVIEWS ] = { SCVAR ( " v2_enabled " , " 2 " ) , SCVAR ( " v3_enabled " , " 0 " ) , SCVAR ( " v4_enabled " , " 0 " ) , SCVAR ( " v5_enabled " , " 0 " ) } ;
2006-02-11 02:09:43 +00:00
cvar_t vsec_x [ SIDEVIEWS ] = { SCVAR ( " v2_x " , " 0 " ) , SCVAR ( " v3_x " , " 0.25 " ) , SCVAR ( " v4_x " , " 0.5 " ) , SCVAR ( " v5_x " , " 0.75 " ) } ;
cvar_t vsec_y [ SIDEVIEWS ] = { SCVAR ( " v2_y " , " 0 " ) , SCVAR ( " v3_y " , " 0 " ) , SCVAR ( " v4_y " , " 0 " ) , SCVAR ( " v5_y " , " 0 " ) } ;
cvar_t vsec_scalex [ SIDEVIEWS ] = { SCVAR ( " v2_scalex " , " 0.25 " ) , SCVAR ( " v3_scalex " , " 0.25 " ) , SCVAR ( " v4_scalex " , " 0.25 " ) , SCVAR ( " v5_scalex " , " 0.25 " ) } ;
cvar_t vsec_scaley [ SIDEVIEWS ] = { SCVAR ( " v2_scaley " , " 0.25 " ) , SCVAR ( " v3_scaley " , " 0.25 " ) , SCVAR ( " v4_scaley " , " 0.25 " ) , SCVAR ( " v5_scaley " , " 0.25 " ) } ;
cvar_t vsec_yaw [ SIDEVIEWS ] = { SCVAR ( " v2_yaw " , " 180 " ) , SCVAR ( " v3_yaw " , " 90 " ) , SCVAR ( " v4_yaw " , " 270 " ) , SCVAR ( " v5_yaw " , " 0 " ) } ;
2004-08-23 00:15:46 +00:00
# endif
2006-02-11 02:09:43 +00:00
cvar_t cl_rollspeed = SCVAR ( " cl_rollspeed " , " 200 " ) ;
cvar_t cl_rollangle = SCVAR ( " cl_rollangle " , " 2.0 " ) ;
cvar_t v_deathtilt = SCVAR ( " v_deathtilt " , " 1 " ) ;
2004-08-23 00:15:46 +00:00
2006-02-11 02:09:43 +00:00
cvar_t cl_bob = SCVAR ( " cl_bob " , " 0.02 " ) ;
cvar_t cl_bobcycle = SCVAR ( " cl_bobcycle " , " 0.6 " ) ;
cvar_t cl_bobup = SCVAR ( " cl_bobup " , " 0.5 " ) ;
2004-08-23 00:15:46 +00:00
2006-02-11 02:09:43 +00:00
cvar_t v_kicktime = SCVAR ( " v_kicktime " , " 0.5 " ) ;
cvar_t v_kickroll = SCVAR ( " v_kickroll " , " 0.6 " ) ;
cvar_t v_kickpitch = SCVAR ( " v_kickpitch " , " 0.6 " ) ;
2004-08-23 00:15:46 +00:00
2006-02-11 02:09:43 +00:00
cvar_t v_iyaw_cycle = SCVAR ( " v_iyaw_cycle " , " 2 " ) ;
cvar_t v_iroll_cycle = SCVAR ( " v_iroll_cycle " , " 0.5 " ) ;
cvar_t v_ipitch_cycle = SCVAR ( " v_ipitch_cycle " , " 1 " ) ;
cvar_t v_iyaw_level = SCVAR ( " v_iyaw_level " , " 0.3 " ) ;
cvar_t v_iroll_level = SCVAR ( " v_iroll_level " , " 0.1 " ) ;
cvar_t v_ipitch_level = SCVAR ( " v_ipitch_level " , " 0.3 " ) ;
cvar_t v_idlescale = SCVAR ( " v_idlescale " , " 0 " ) ;
2004-08-23 00:15:46 +00:00
2011-12-26 15:19:13 +00:00
cvar_t crosshair = SCVARF ( " crosshair " , " 1 " , CVAR_ARCHIVE ) ;
2011-03-31 19:46:26 +00:00
cvar_t crosshaircolor = SCVARF ( " crosshaircolor " , " 255 255 255 " , CVAR_ARCHIVE ) ;
2006-02-11 02:09:43 +00:00
cvar_t crosshairsize = SCVARF ( " crosshairsize " , " 8 " , CVAR_ARCHIVE ) ;
2004-08-23 00:15:46 +00:00
2006-02-11 02:09:43 +00:00
cvar_t cl_crossx = SCVARF ( " cl_crossx " , " 0 " , CVAR_ARCHIVE ) ;
cvar_t cl_crossy = SCVARF ( " cl_crossy " , " 0 " , CVAR_ARCHIVE ) ;
cvar_t crosshaircorrect = SCVARF ( " crosshaircorrect " , " 0 " , CVAR_SEMICHEAT ) ;
2011-03-31 19:46:26 +00:00
cvar_t crosshairimage = SCVAR ( " crosshairimage " , " " ) ;
2006-02-11 02:09:43 +00:00
cvar_t crosshairalpha = SCVAR ( " crosshairalpha " , " 1 " ) ;
2004-08-23 00:15:46 +00:00
2006-02-11 02:09:43 +00:00
cvar_t gl_cshiftpercent = SCVAR ( " gl_cshiftpercent " , " 100 " ) ;
2011-12-26 15:19:13 +00:00
cvar_t gl_cshiftenabled = CVARF ( " gl_polyblend " , " 1 " , CVAR_ARCHIVE ) ;
2004-08-23 00:15:46 +00:00
2006-05-25 23:08:37 +00:00
cvar_t v_bonusflash = SCVAR ( " v_bonusflash " , " 1 " ) ;
cvar_t v_contentblend = SCVARF ( " v_contentblend " , " 1 " , CVAR_ARCHIVE ) ;
cvar_t v_damagecshift = SCVAR ( " v_damagecshift " , " 1 " ) ;
cvar_t v_quadcshift = SCVAR ( " v_quadcshift " , " 1 " ) ;
cvar_t v_suitcshift = SCVAR ( " v_suitcshift " , " 1 " ) ;
cvar_t v_ringcshift = SCVAR ( " v_ringcshift " , " 1 " ) ;
cvar_t v_pentcshift = SCVAR ( " v_pentcshift " , " 1 " ) ;
2006-02-26 05:53:06 +00:00
cvar_t v_gunkick = SCVAR ( " v_gunkick " , " 0 " ) ;
2011-04-20 03:38:59 +00:00
cvar_t v_gunkick_q2 = SCVAR ( " v_gunkick_q2 " , " 1 " ) ;
2004-08-23 00:15:46 +00:00
2006-02-11 02:09:43 +00:00
cvar_t v_viewheight = SCVAR ( " v_viewheight " , " 0 " ) ;
2011-10-27 15:46:36 +00:00
cvar_t v_projectionmode = SCVAR ( " v_projectionmode " , " 0 " ) ;
2005-01-13 16:29:20 +00:00
2009-07-17 22:28:16 +00:00
cvar_t scr_autoid = SCVAR ( " scr_autoid " , " 1 " ) ;
2005-09-28 23:31:17 +00:00
2005-05-26 12:55:34 +00:00
2004-08-23 00:15:46 +00:00
extern cvar_t cl_chasecam ;
player_state_t * view_message ;
/*
= = = = = = = = = = = = = = =
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
2004-08-23 00:15:46 +00:00
if ( cl . spectator )
return 0 ;
2014-02-07 08:38:40 +00:00
if ( cl_bobcycle . value < = 0 | | cl . intermission )
return 0 ;
2013-06-23 02:17:02 +00:00
if ( ! pv - > onground | | cl . paused )
{
pv - > bobcltime = cl . time ;
return pv - > bob ; // just use old value
}
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
}
//=============================================================================
2006-02-11 02:09:43 +00:00
cvar_t v_centermove = SCVAR ( " v_centermove " , " 0.15 " ) ;
cvar_t v_centerspeed = SCVAR ( " 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
}
/*
= = = = = = = = = = = = = = =
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
2013-06-23 02:17:02 +00:00
delta = 0 - pv - > viewangles [ PITCH ] ;
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
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2004-08-23 00:15:46 +00:00
cshift_t cshift_empty = { { 130 , 80 , 50 } , 0 } ;
cshift_t cshift_water = { { 130 , 80 , 50 } , 128 } ;
cshift_t cshift_slime = { { 0 , 25 , 5 } , 150 } ;
cshift_t cshift_lava = { { 255 , 80 , 0 } , 150 } ;
cshift_t cshift_server = { { 130 , 80 , 50 } , 0 } ;
2013-11-21 23:02:28 +00:00
cvar_t v_gamma = CVARFD ( " gamma " , " 1.0 " , CVAR_ARCHIVE | CVAR_RENDERERCALLBACK , " Controls how bright the screen is. Setting this to anything but 1 without hardware gamma requires glsl support and can noticably harm your framerate. " ) ;
cvar_t v_contrast = CVARFD ( " contrast " , " 1.0 " , CVAR_ARCHIVE , " 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_brightness = CVARFD ( " brightness " , " 0.0 " , CVAR_ARCHIVE , " 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
2004-09-20 23:25:38 +00:00
unsigned short ramps [ 3 ] [ 256 ] ;
2007-08-20 02:23:53 +00:00
//extern qboolean gammaworks;
2010-03-25 22:56:11 +00:00
float sw_blend [ 4 ] ; // rgba 0.0 - 1.0
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 ;
}
} */
2013-05-11 14:02:55 +00:00
void BuildGammaTable ( float g , float c , float b )
2004-08-23 00:15:46 +00:00
{
int i , inf ;
// g = bound (0.1, g, 3);
// c = bound (1, c, 3);
2006-03-15 20:03:00 +00:00
if ( g = = 1 & & c = = 1 )
{
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.
inf = 255 * ( pow ( ( i + 0.5 ) / 255.5 * c , g ) + b ) + 0.5 ;
2004-08-23 00:15:46 +00:00
if ( inf < 0 )
inf = 0 ;
else if ( inf > 255 )
2011-05-15 13:23:13 +00:00
inf = 255 ;
2004-08-23 00:15:46 +00:00
gammatable [ i ] = inf ;
}
}
/*
= = = = = = = = = = = = = = = = =
V_CheckGamma
= = = = = = = = = = = = = = = = =
*/
2009-11-04 21:16:50 +00:00
# if defined(GLQUAKE) || defined(D3DQUAKE)
2006-05-06 05:50:33 +00:00
void GLV_Gamma_Callback ( struct cvar_s * var , char * oldvalue )
{
2013-05-11 14:02:55 +00:00
BuildGammaTable ( v_gamma . value , v_contrast . value , v_brightness . value ) ;
2011-12-23 03:12:29 +00:00
V_UpdatePalette ( true ) ;
2006-05-06 05:50:33 +00:00
}
2006-05-07 07:25:18 +00:00
# endif
2006-05-06 05:50:33 +00:00
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 ( ) ;
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 )
count * = v_damagecshift . value ;
2013-06-23 02:17:02 +00:00
pv - > faceanimtime = cl . time + 0.2 ; // but sbar face into pain frame
2004-08-23 00:15:46 +00:00
cl . cshifts [ CSHIFT_DAMAGE ] . percent + = 3 * count ;
if ( cl . cshifts [ CSHIFT_DAMAGE ] . percent < 0 )
cl . cshifts [ CSHIFT_DAMAGE ] . percent = 0 ;
if ( cl . cshifts [ CSHIFT_DAMAGE ] . percent > 150 )
cl . cshifts [ CSHIFT_DAMAGE ] . percent = 150 ;
2011-05-15 13:23:13 +00:00
if ( armor > blood )
2004-08-23 00:15:46 +00:00
{
cl . cshifts [ CSHIFT_DAMAGE ] . destcolor [ 0 ] = 200 ;
cl . cshifts [ CSHIFT_DAMAGE ] . destcolor [ 1 ] = 100 ;
cl . cshifts [ CSHIFT_DAMAGE ] . destcolor [ 2 ] = 100 ;
}
else if ( armor )
{
cl . cshifts [ CSHIFT_DAMAGE ] . destcolor [ 0 ] = 220 ;
cl . cshifts [ CSHIFT_DAMAGE ] . destcolor [ 1 ] = 50 ;
cl . cshifts [ CSHIFT_DAMAGE ] . destcolor [ 2 ] = 50 ;
}
else
{
cl . cshifts [ CSHIFT_DAMAGE ] . destcolor [ 0 ] = 255 ;
cl . cshifts [ CSHIFT_DAMAGE ] . destcolor [ 1 ] = 0 ;
cl . cshifts [ CSHIFT_DAMAGE ] . destcolor [ 2 ] = 0 ;
}
//
// 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 ;
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
cl . cshifts [ CSHIFT_SERVER ] . destcolor [ 0 ] = r ;
cl . cshifts [ CSHIFT_SERVER ] . destcolor [ 1 ] = g ;
cl . cshifts [ CSHIFT_SERVER ] . destcolor [ 2 ] = b ;
cl . 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
cshift_empty . destcolor [ 0 ] = r ;
cshift_empty . destcolor [ 1 ] = g ;
cshift_empty . destcolor [ 2 ] = b ;
cshift_empty . percent = 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 )
{
2005-04-16 16:21:27 +00:00
if ( v_bonusflash . value | | ! Cmd_FromGamecode ( ) )
2004-08-23 00:15:46 +00:00
{
cl . cshifts [ CSHIFT_BONUS ] . destcolor [ 0 ] = 215 ;
cl . cshifts [ CSHIFT_BONUS ] . destcolor [ 1 ] = 186 ;
cl . cshifts [ CSHIFT_BONUS ] . destcolor [ 2 ] = 69 ;
2005-02-07 15:32:51 +00:00
cl . cshifts [ CSHIFT_BONUS ] . percent = 50 * v_bonusflash . value ;
2004-08-23 00:15:46 +00:00
}
}
2012-01-17 07:57:46 +00:00
void V_DarkFlash_f ( void )
{
cl . cshifts [ CSHIFT_BONUS ] . destcolor [ 0 ] = 0 ;
cl . cshifts [ CSHIFT_BONUS ] . destcolor [ 1 ] = 0 ;
cl . cshifts [ CSHIFT_BONUS ] . destcolor [ 2 ] = 0 ;
cl . cshifts [ CSHIFT_BONUS ] . percent = 255 ;
}
void V_WhiteFlash_f ( void )
{
cl . cshifts [ CSHIFT_BONUS ] . destcolor [ 0 ] = 255 ;
cl . cshifts [ CSHIFT_BONUS ] . destcolor [ 1 ] = 255 ;
cl . cshifts [ CSHIFT_BONUS ] . destcolor [ 2 ] = 255 ;
cl . cshifts [ CSHIFT_BONUS ] . percent = 255 ;
}
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 ;
2012-02-12 05:18:31 +00:00
if ( contents & FTECONTENTS_LAVA )
2004-08-23 00:15:46 +00:00
cl . cshifts [ CSHIFT_CONTENTS ] = cshift_lava ;
2012-02-12 05:18:31 +00:00
else if ( contents & ( FTECONTENTS_SLIME | FTECONTENTS_SOLID ) )
2004-08-23 00:15:46 +00:00
cl . cshifts [ CSHIFT_CONTENTS ] = cshift_slime ;
2012-02-12 05:18:31 +00:00
else if ( contents & FTECONTENTS_WATER )
2004-08-23 00:15:46 +00:00
cl . cshifts [ CSHIFT_CONTENTS ] = cshift_water ;
2012-02-12 05:18:31 +00:00
else
cl . cshifts [ CSHIFT_CONTENTS ] = cshift_empty ;
2004-08-23 00:15:46 +00:00
cl . cshifts [ CSHIFT_CONTENTS ] . percent * = v_contentblend . value ;
2012-11-27 03:23:19 +00:00
if ( cl . cshifts [ CSHIFT_CONTENTS ] . percent )
2004-08-23 00:15:46 +00:00
{ //bound contents so it can't go negative
if ( cl . cshifts [ CSHIFT_CONTENTS ] . percent < 0 )
cl . cshifts [ CSHIFT_CONTENTS ] . percent = 0 ;
for ( i = 0 ; i < 3 ; i + + )
if ( cl . cshifts [ CSHIFT_CONTENTS ] . destcolor [ 0 ] < 0 )
cl . cshifts [ CSHIFT_CONTENTS ] . destcolor [ 0 ] = 0 ;
}
}
/*
= = = = = = = = = = = = =
V_CalcPowerupCshift
= = = = = = = = = = = = =
*/
void V_CalcPowerupCshift ( void )
{
int im = 0 ;
int s ;
//we only have one palette, so combine the mask
for ( s = 0 ; s < cl . splitclients ; s + + )
2012-07-05 19:42:36 +00:00
im | = cl . playerview [ s ] . stats [ STAT_ITEMS ] ;
2004-08-23 00:15:46 +00:00
if ( im & IT_QUAD )
{
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 0 ] = 0 ;
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 1 ] = 0 ;
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 2 ] = 255 ;
cl . cshifts [ CSHIFT_POWERUP ] . percent = 30 * v_quadcshift . value ;
}
else if ( im & IT_SUIT )
{
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 0 ] = 0 ;
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 1 ] = 255 ;
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 2 ] = 0 ;
cl . cshifts [ CSHIFT_POWERUP ] . percent = 20 * v_suitcshift . value ;
}
else if ( im & IT_INVISIBILITY )
{
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 0 ] = 100 ;
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 1 ] = 100 ;
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 2 ] = 100 ;
cl . cshifts [ CSHIFT_POWERUP ] . percent = 100 * v_ringcshift . value ;
}
else if ( im & IT_INVULNERABILITY )
{
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 0 ] = 255 ;
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 1 ] = 255 ;
cl . cshifts [ CSHIFT_POWERUP ] . destcolor [ 2 ] = 0 ;
cl . cshifts [ CSHIFT_POWERUP ] . percent = 30 * v_pentcshift . value ;
}
else
cl . cshifts [ CSHIFT_POWERUP ] . percent = 0 ;
if ( cl . cshifts [ CSHIFT_POWERUP ] . percent < 0 )
cl . cshifts [ CSHIFT_POWERUP ] . percent = 0 ;
}
/*
= = = = = = = = = = = = =
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 ;
2004-08-23 00:15:46 +00:00
int j ;
2010-03-25 22:56:11 +00:00
float * blend ;
2004-08-23 00:15:46 +00:00
2010-03-25 22:56:11 +00:00
memset ( hw_blend , 0 , sizeof ( float ) * 4 ) ;
memset ( sw_blend , 0 , sizeof ( float ) * 4 ) ;
2004-08-23 00:15:46 +00:00
2005-02-17 03:30:24 +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.
2011-05-15 13:23:13 +00:00
for ( j = 0 ; j < NUM_CSHIFTS ; j + + )
2004-08-23 00:15:46 +00:00
{
2010-03-25 22:56:11 +00:00
if ( j ! = CSHIFT_SERVER )
{
2009-11-04 21:16:50 +00:00
if ( ! gl_cshiftpercent . value | | ! gl_cshiftenabled . ival )
2004-08-23 00:15:46 +00:00
continue ;
a2 = ( ( cl . cshifts [ j ] . percent * gl_cshiftpercent . value ) / 100.0 ) / 255.0 ;
2010-03-25 22:56:11 +00:00
}
else
{
a2 = cl . cshifts [ j ] . percent / 255.0 ; //don't allow modification of this one.
}
2004-08-23 00:15:46 +00:00
if ( ! a2 )
continue ;
2010-03-25 22:56:11 +00:00
if ( j = = CSHIFT_SERVER )
{
/*server blend always goes into sw, ALWAYS*/
blend = sw_blend ;
}
else
{
2013-11-21 23:02:28 +00:00
if ( j = = CSHIFT_BONUS | | j = = CSHIFT_DAMAGE | | gl_nohwblend . ival | | ! r2d_canhwgamma )
2010-03-25 22:56:11 +00:00
blend = sw_blend ;
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 ) + cl . cshifts [ j ] . destcolor [ 0 ] * a2 / 255.0 ;
blend [ 1 ] = blend [ 1 ] * ( 1 - a2 ) + cl . cshifts [ j ] . destcolor [ 1 ] * a2 / 255.0 ;
blend [ 2 ] = blend [ 2 ] * ( 1 - a2 ) + cl . cshifts [ j ] . destcolor [ 2 ] * a2 / 255.0 ;
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 ;
if ( sw_blend [ 3 ] > 1 )
sw_blend [ 3 ] = 1 ;
if ( sw_blend [ 3 ] < 0 )
sw_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 ;
2004-08-23 00:15:46 +00:00
V_CalcPowerupCshift ( ) ;
2004-10-03 11:05:31 +00:00
2008-06-12 23:19:47 +00:00
// drop the damage value
cl . cshifts [ CSHIFT_DAMAGE ] . percent - = ftime * 150 ;
if ( cl . cshifts [ CSHIFT_DAMAGE ] . percent < = 0 )
cl . cshifts [ CSHIFT_DAMAGE ] . percent = 0 ;
// drop the bonus value
cl . cshifts [ CSHIFT_BONUS ] . percent - = ftime * 100 ;
if ( cl . cshifts [ CSHIFT_BONUS ] . percent < = 0 )
cl . cshifts [ CSHIFT_BONUS ] . percent = 0 ;
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 ;
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 ;
for ( i = 0 ; i < 256 ; i + + )
{
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 ;
ramps [ 0 ] [ i ] = gammatable [ ir ] < < 8 ;
ramps [ 1 ] [ i ] = gammatable [ ig ] < < 8 ;
ramps [ 2 ] [ i ] = gammatable [ ib ] < < 8 ;
}
2004-08-23 00:15:46 +00:00
2013-05-11 14:02:55 +00:00
applied = rf - > VID_ApplyGammaRamps ( ( unsigned short * ) ramps ) ;
2013-11-21 23:02:28 +00:00
if ( ! applied & & r2d_canhwgamma )
2013-05-11 14:02:55 +00:00
rf - > VID_ApplyGammaRamps ( NULL ) ;
2013-11-21 23:02:28 +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 )
{
int i ;
for ( i = 0 ; i < NUM_CSHIFTS ; i + + )
cl . cshifts [ i ] . percent = 0 ;
}
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 ;
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
}
// fudge position around to keep amount of weapon visible
// roughly equal with different FOV
if ( scr_viewsize . value = = 110 )
2013-10-08 14:28:11 +00:00
pv - > vw_origin [ 2 ] + = 1 ;
2012-02-27 12:23:15 +00:00
else if ( scr_viewsize . value = = 100 )
2013-10-08 14:28:11 +00:00
pv - > vw_origin [ 2 ] + = 2 ;
2012-02-27 12:23:15 +00:00
else if ( scr_viewsize . value = = 90 )
2013-10-08 14:28:11 +00:00
pv - > vw_origin [ 2 ] + = 1 ;
2012-02-27 12:23:15 +00:00
else if ( scr_viewsize . value = = 80 )
2013-10-08 14:28:11 +00:00
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
adjspeed = fabs ( cl_rollangle . value ) ;
if ( adjspeed < 1 )
adjspeed = 1 ;
if ( adjspeed > 45 )
adjspeed = 45 ;
adjspeed * = 20 ;
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
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 )
{
float a ;
float x ;
if ( fov_x < 1 | | fov_x > 179 )
Sys_Error ( " Bad fov: %f " , fov_x ) ;
x = fov_x / 360 * M_PI ;
x = tan ( x ) ;
x = width / x ;
a = atan ( height / x ) ;
a = a * 360 / M_PI ;
return a ;
}
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 )
{
extern cvar_t r_stereo_method , r_stereo_separation ;
float ws ;
float afov = r_refdef . afov ;
if ( ! afov ) //make sure its sensible.
afov = scr_fov . value ;
2013-12-29 22:48:28 +00:00
if ( pv & & pv - > stats [ STAT_VIEWZOOM ] )
afov * = pv - > stats [ STAT_VIEWZOOM ] / 255.0f ;
2013-06-29 21:08:09 +00:00
ws = 1 ;
if ( r_stereo_method . ival = = 5 & & r_stereo_separation . value )
ws = 0.5 ;
//attempt to retain a classic fov
if ( ws * r_refdef . vrect . width < ( r_refdef . vrect . height * 640 ) / 432 )
{
r_refdef . fov_y = CalcFov ( afov , ( ws * r_refdef . vrect . width * vid . pixelwidth ) / vid . width , ( r_refdef . vrect . height * vid . pixelheight ) / vid . height ) ;
r_refdef . fov_x = afov ; //CalcFov(r_refdef.fov_y, 432, 640);
}
else
{
r_refdef . fov_y = CalcFov ( afov , 640 , 432 ) ;
r_refdef . fov_x = CalcFov ( r_refdef . fov_y , r_refdef . vrect . height , r_refdef . vrect . width * ws ) ;
}
}
}
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 )
{
float size ;
int h ;
qboolean full = false ;
// force the status bar to redraw
Sbar_Changed ( ) ;
//========================================
// intermission is always full screen
if ( cl . intermission | | ! r_refdef . drawsbar )
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 ;
if ( scr_viewsize . value > = 100.0 | | scr_chatmode )
{
full = true ;
size = 100.0 ;
}
else
size = scr_viewsize . value ;
if ( cl . intermission | | ! r_refdef . drawsbar )
{
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 ;
if ( scr_chatmode )
{
if ( scr_chatmode ! = 2 )
r_refdef . vrect . height = r_refdef . vrect . y = r_refdef . grect . height / 2 ;
r_refdef . vrect . width = r_refdef . vrect . x = r_refdef . grect . width / 2 ;
if ( r_refdef . vrect . width < 320 | | r_refdef . vrect . height < 200 ) //disable hud if too small
sb_lines = 0 ;
}
r_refdef . vrect . x + = r_refdef . grect . x ;
r_refdef . vrect . y + = r_refdef . grect . y ;
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 ;
}
//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
int CL_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 )
cl_visedicts [ i ] . flags | = Q2RF_EXTERNALMODEL ;
else
cl_visedicts [ i ] . flags & = ~ Q2RF_EXTERNALMODEL ;
if ( cl_visedicts [ i ] . flags & Q2RF_WEAPONMODEL )
{
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
}
/*
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 ;
r_refdef . grect . width = vid . width ;
r_refdef . grect . height = vid . height ;
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 ;
r_refdef . drawsbar = ! cl . intermission ;
2013-08-27 13:18:09 +00:00
r_refdef . flags = 0 ;
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 ;
2013-06-23 02:17:02 +00:00
r_refdef . playerview = pv ;
2005-03-18 06:14:07 +00:00
2004-08-23 00:15:46 +00:00
# ifdef Q2CLIENT
2005-05-26 12:55:34 +00:00
if ( cls . protocol = = CP_QUAKE2 )
2004-08-23 00:15:46 +00:00
return ;
# endif
2011-12-26 15:19:13 +00:00
VectorCopy ( cl . fog_colour , r_refdef . gfog_rgbd ) ;
r_refdef . gfog_rgbd [ 3 ] = cl . fog_density / 64 ;
2011-03-31 02:32:32 +00:00
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 ;
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 ;
2013-03-12 23:17:18 +00:00
if ( viewheight = = DEFAULT_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
2013-06-23 02:17:02 +00:00
viewheight + = pv - > crouch ;
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
if ( pv - > stats [ STAT_HEALTH ] < 0 & & pv - > cam_spec_track > = 0 & & v_deathtilt . value ) // PF_GIB will also set PF_DEAD
2004-08-23 00:15:46 +00:00
{
2009-11-04 21:16:50 +00:00
if ( ! cl . spectator | | ! cl_chasecam . ival )
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
{
// 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
}
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 )
2013-06-23 02:17:02 +00:00
r_refdef . viewangles [ PITCH ] + = pv - > punchangle * v_gunkick . value ;
2004-08-23 00:15:46 +00:00
2014-01-13 02:42:25 +00:00
r_refdef . time = cl . servertime ;
2005-02-09 19:32:09 +00:00
2004-08-23 00:15:46 +00:00
// smooth out stair step ups
{
extern model_t * loadmodel ;
loadmodel = cl . worldmodel ;
}
}
/*
= = = = = = = = = = = = =
DropPunchAngle
= = = = = = = = = = = = =
*/
2013-06-23 02:17:02 +00:00
void DropPunchAngle ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
if ( pv - > punchangle < 0 )
2006-02-26 05:53:06 +00:00
{
2013-06-23 02:17:02 +00:00
pv - > punchangle + = 10 * host_frametime ;
if ( pv - > punchangle > 0 )
pv - > punchangle = 0 ;
2006-02-26 05:53:06 +00:00
}
else
{
2013-06-23 02:17:02 +00:00
pv - > punchangle - = 10 * host_frametime ;
if ( pv - > punchangle < 0 )
pv - > punchangle = 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
= = = = = = = = = = = = = = = = = =
*/
extern vrect_t scr_vrect ;
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
float CalcFov ( float fov_x , float width , float height ) ;
void SCR_VRectForPlayer ( vrect_t * vrect , int pnum )
{
# if MAX_SPLITS > 4
# pragma warning "Please change this function to cope with the new MAX_SPLITS value"
# endif
switch ( cl . splitclients )
{
case 1 :
2013-06-23 02:17:02 +00:00
vrect - > width = vid . width ;
vrect - > height = vid . height ;
vrect - > x = 0 ;
vrect - > y = 0 ;
2005-04-16 16:21:27 +00:00
if ( scr_chatmode = = 2 )
{
vrect - > height / = 2 ;
vrect - > y + = vrect - > height ;
}
2004-08-23 00:15:46 +00:00
break ;
case 2 : //horizontal bands
case 3 :
2005-12-01 02:20:48 +00:00
# ifdef GLQUAKE
2011-02-25 04:22:14 +00:00
if ( qrenderer = = QR_OPENGL & & vid . rotpixelwidth > vid . rotpixelheight * 2
2011-10-27 15:46:36 +00:00
& & ffov . value > = 0 /*panoramic view always stacks player views*/
2010-08-16 09:25:23 +00:00
)
2011-10-27 15:46:36 +00:00
{ //over twice as wide as high, assume dual moniter, horizontal.
2005-11-30 01:20:53 +00:00
vrect - > width = vid . width / cl . splitclients ;
vrect - > height = vid . height ;
vrect - > x = 0 + vrect - > width * pnum ;
vrect - > y = 0 ;
}
else
2005-12-01 02:20:48 +00:00
# endif
2005-11-30 01:20:53 +00:00
{
2011-10-27 15:46:36 +00:00
//stack them vertically
2005-11-30 01:20:53 +00:00
vrect - > width = vid . width ;
vrect - > height = vid . height / cl . splitclients ;
vrect - > x = 0 ;
vrect - > y = 0 + vrect - > height * pnum ;
}
2004-08-23 00:15:46 +00:00
break ;
case 4 : //4 squares
vrect - > width = vid . width / 2 ;
vrect - > height = vid . height / 2 ;
vrect - > x = ( pnum & 1 ) * vrect - > width ;
vrect - > y = ( pnum & 2 ) / 2 * vrect - > height ;
break ;
default :
Sys_Error ( " cl.splitclients is invalid. " ) ;
}
}
2013-08-27 13:18:09 +00:00
void Draw_ExpandedString ( float x , float y , conchar_t * str ) ;
2009-07-17 22:28:16 +00:00
extern vec3_t nametagorg [ MAX_CLIENTS ] ;
extern qboolean nametagseen [ MAX_CLIENTS ] ;
2005-06-14 04:52:10 +00:00
void R_DrawNameTags ( void )
{
2009-07-17 22:28:16 +00:00
conchar_t buffer [ 256 ] ;
2005-06-14 04:52:10 +00:00
int i ;
2009-07-17 22:28:16 +00:00
int len ;
2005-06-14 04:52:10 +00:00
vec3_t center ;
vec3_t tagcenter ;
if ( ! cl . spectator & & ! cls . demoplayback )
return ;
2009-11-04 21:16:50 +00:00
if ( ! scr_autoid . ival )
2005-09-28 23:31:17 +00:00
return ;
2009-07-17 22:28:16 +00:00
if ( cls . state ! = ca_active | | ! cl . validsequence )
return ;
2005-06-14 04:52:10 +00:00
2009-11-04 21:16:50 +00:00
# ifdef GLQUAKE
2005-06-14 04:52:10 +00:00
if ( qrenderer = = QR_OPENGL )
2006-02-11 14:51:36 +00:00
{
2012-01-24 04:24:14 +00:00
GL_Set2D ( false ) ;
2006-02-11 14:51:36 +00:00
}
2005-06-14 04:52:10 +00:00
# endif
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
{
2009-07-17 22:28:16 +00:00
if ( ! nametagseen [ i ] )
continue ;
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 ;
2013-06-23 02:17:02 +00:00
if ( i = = Cam_TrackNum ( r_refdef . playerview ) )
2012-11-27 03:23:19 +00:00
continue ;
2009-07-17 22:28:16 +00:00
if ( TP_IsPlayerVisible ( nametagorg [ i ] ) )
2005-06-14 04:52:10 +00:00
{
2009-07-17 22:28:16 +00:00
VectorCopy ( nametagorg [ i ] , tagcenter ) ;
2005-06-14 04:52:10 +00:00
tagcenter [ 2 ] + = 32 ;
2012-11-27 03:23:19 +00:00
if ( ! Matrix4x4_CM_Project ( tagcenter , center , r_refdef . viewangles , r_refdef . vieworg , r_refdef . fov_x , r_refdef . fov_y ) )
2005-09-14 04:12:48 +00:00
continue ;
2009-07-17 22:28:16 +00:00
len = COM_ParseFunString ( CON_WHITEMASK , cl . players [ i ] . name , buffer , sizeof ( buffer ) , false ) - buffer ;
Draw_ExpandedString ( center [ 0 ] * r_refdef . vrect . width + r_refdef . vrect . x - len * 4 , ( 1 - center [ 1 ] ) * r_refdef . vrect . height + r_refdef . vrect . y , buffer ) ;
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 ) ;
2004-11-17 18:04:43 +00:00
if ( cl . intermission )
{ // 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
2009-05-24 10:11:17 +00:00
oldnuments = cl_numvisedicts ;
------------------------------------------------------------------------
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
oldstris = cl_numstris ;
2009-05-24 10:11:17 +00:00
CL_LinkViewModel ( ) ;
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 ( ) ;
2005-04-16 16:21:27 +00:00
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
2005-04-16 16:21:27 +00:00
if ( scr_chatmode = = 2 )
{
vec3_t dir ;
r_refdef . vrect . y - = r_refdef . vrect . height ;
r_secondaryview = 2 ;
2013-06-23 02:17:02 +00:00
VectorSubtract ( r_refdef . vieworg , pv - > cam_desired_position , dir ) ;
2011-10-27 15:46:36 +00:00
VectorAngles ( dir , NULL , r_refdef . viewangles ) ;
2005-04-16 16:21:27 +00:00
r_refdef . viewangles [ 0 ] = - r_refdef . viewangles [ 0 ] ; //flip the pitch. :(
2013-06-23 02:17:02 +00:00
VectorCopy ( pv - > cam_desired_position , r_refdef . vieworg ) ;
2005-04-16 16:21:27 +00:00
R_RenderView ( ) ;
}
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 + + )
2007-07-25 09:23:14 +00:00
if ( vsec_scalex [ viewnum ] . value > 0 & & vsec_scaley [ viewnum ] . value > 0
& & ( ( vsec_enabled [ viewnum ] . value & & vsec_enabled [ viewnum ] . value ! = 2 & & cls . allow_rearview ) //rearview if v2_enabled = 1 and not 2
2013-06-23 02:17:02 +00:00
| | ( vsec_enabled [ viewnum ] . 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 ;
if ( vsec_x [ viewnum ] . value < 0 )
vsec_x [ viewnum ] . value = 0 ;
if ( vsec_y [ viewnum ] . value < 0 )
vsec_y [ viewnum ] . value = 0 ;
if ( vsec_scalex [ viewnum ] . value + vsec_x [ viewnum ] . value > 1 )
continue ;
if ( vsec_scaley [ viewnum ] . value + vsec_y [ viewnum ] . value > 1 )
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 ;
r_refdef . vrect . x + = r_refdef . vrect . width * vsec_x [ viewnum ] . value ;
r_refdef . vrect . y + = r_refdef . vrect . height * vsec_y [ viewnum ] . value ;
r_refdef . vrect . width * = vsec_scalex [ viewnum ] . value ;
r_refdef . vrect . height * = vsec_scaley [ viewnum ] . 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];
r_refdef . viewangles [ PITCH ] * = - 1 ;
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 ] ;
}
2014-02-07 08:38:40 +00:00
CL_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.
r_refdef . viewangles [ YAW ] + = vsec_yaw [ viewnum ] . value ;
r_refdef . viewangles [ ROLL ] + = sin ( vsec_yaw [ viewnum ] . value / 180 * 3.14 ) * r_refdef . viewangles [ PITCH ] ;
r_refdef . viewangles [ PITCH ] * = - cos ( ( vsec_yaw [ viewnum ] . value / 180 * 3.14 ) + 3.14 ) ;
if ( vsec_enabled [ viewnum ] . value ! = 2 )
{
2014-02-07 08:38:40 +00:00
CL_EditExternalModels ( 0 , 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
}
void V_RenderView ( void )
{
int viewnum ;
2013-07-14 12:22:51 +00:00
Surf_LessenStains ( ) ;
2004-11-17 18:04:43 +00:00
if ( cls . state ! = ca_active )
return ;
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 ;
for ( viewnum = 0 ; viewnum < cl . splitclients ; viewnum + + )
{
V_ClearRefdef ( & cl . playerview [ viewnum ] ) ;
if ( viewnum )
{
//should be enough to just hack a few things.
2014-02-07 08:38:40 +00:00
CL_EditExternalModels ( cl . playerview [ viewnum ] . viewentity , NULL , 0 ) ;
2013-06-23 02:17:02 +00:00
}
else
{
if ( r_worldentity . model )
{
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
2013-06-23 02:17:02 +00:00
CL_TransitionEntities ( ) ;
2005-02-12 18:56:04 +00:00
2013-06-23 02:17:02 +00:00
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 ) ;
}
}
SCR_VRectForPlayer ( & r_refdef . grect , viewnum ) ;
V_RenderPlayerViews ( r_refdef . playerview ) ;
2004-11-17 18:04:43 +00:00
2013-07-31 00:20:16 +00:00
# ifdef PLUGINS
Plug_SBar ( r_refdef . playerview ) ;
# else
if ( Sbar_ShouldDraw ( ) )
{
Sbar_Draw ( r_refdef . playerview ) ;
Sbar_DrawScoreboard ( ) ;
}
# endif
2013-06-23 02:17:02 +00:00
SCR_TileClear ( ) ;
2004-11-17 18:04:43 +00:00
}
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 ) ;
2004-08-23 00:15:46 +00:00
// Cmd_AddCommand ("centerview", V_StartPitchDrift);
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 ) ;
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 ) ;
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 ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & cl_rollspeed , VIEWVARS ) ;
Cvar_Register ( & cl_rollangle , VIEWVARS ) ;
Cvar_Register ( & cl_bob , VIEWVARS ) ;
Cvar_Register ( & cl_bobcycle , VIEWVARS ) ;
Cvar_Register ( & cl_bobup , VIEWVARS ) ;
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 ) ;
2004-08-23 00:15:46 +00:00
2005-09-28 23:31:17 +00:00
Cvar_Register ( & scr_autoid , VIEWVARS ) ;
2004-08-23 00:15:46 +00:00
# ifdef SIDEVIEWS
# define SECONDARYVIEWVARS "Secondary view vars"
for ( i = 0 ; i < SIDEVIEWS ; i + + )
{
Cvar_Register ( & vsec_enabled [ i ] , SECONDARYVIEWVARS ) ;
Cvar_Register ( & vsec_x [ i ] , SECONDARYVIEWVARS ) ;
Cvar_Register ( & vsec_y [ i ] , SECONDARYVIEWVARS ) ;
Cvar_Register ( & vsec_scalex [ i ] , SECONDARYVIEWVARS ) ;
Cvar_Register ( & vsec_scaley [ i ] , SECONDARYVIEWVARS ) ;
Cvar_Register ( & vsec_yaw [ i ] , SECONDARYVIEWVARS ) ;
}
# endif
Cvar_Register ( & ffov , VIEWVARS ) ;
2013-05-11 14:02:55 +00:00
BuildGammaTable ( 1.0 , 1.0 , 0.0 ) ; // no gamma yet
2004-08-23 00:15:46 +00:00
Cvar_Register ( & v_gamma , VIEWVARS ) ;
Cvar_Register ( & v_contrast , VIEWVARS ) ;
2013-05-11 14:02:55 +00:00
Cvar_Register ( & v_brightness , VIEWVARS ) ;
2004-08-23 00:15:46 +00:00
}