DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
view.c File Reference
#include "quakedef.h"
#include "cl_collision.h"
#include "image.h"
#include "csprogs.h"
+ Include dependency graph for view.c:

Go to the source code of this file.

Functions

static vec_t highpass (vec_t value, vec_t frac, vec_t *store)
 
static void highpass3 (vec3_t value, vec_t fracx, vec_t fracy, vec_t fracz, vec3_t store, vec3_t out)
 
static void highpass3_limited (vec3_t value, vec_t fracx, vec_t limitx, vec_t fracy, vec_t limity, vec_t fracz, vec_t limitz, vec3_t store, vec3_t out)
 
static vec_t highpass_limited (vec_t value, vec_t frac, vec_t limit, vec_t *store)
 
static vec_t lowpass (vec_t value, vec_t frac, vec_t *store)
 
static void lowpass3 (vec3_t value, vec_t fracx, vec_t fracy, vec_t fracz, vec3_t store, vec3_t out)
 
static vec_t lowpass_limited (vec_t value, vec_t frac, vec_t limit, vec_t *store)
 
static void V_BonusFlash_f (cmd_state_t *cmd)
 
static void V_CalcIntermissionRefdef (vec3_t vieworg, vec3_t viewangles, const matrix4x4_t *entrendermatrix, float clstatsviewheight)
 
void V_CalcRefdef (void)
 
void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewangles, qbool teleported, qbool clonground, qbool clcmdjump, float clstatsviewheight, qbool cldead, const vec3_t clvelocity)
 
void V_CalcViewBlend (void)
 
static void V_cshift_f (cmd_state_t *cmd)
 
void V_DriftPitch (void)
 
void V_FadeViewFlashs (void)
 
void V_Init (void)
 
void V_MakeViewIsometric (void)
 
void V_ParseDamage (void)
 
void V_StartPitchDrift (void)
 
void V_StartPitchDrift_f (cmd_state_t *cmd)
 
void V_StopPitchDrift (void)
 

Variables

cvar_t chase_active = {CF_CLIENT | CF_ARCHIVE, "chase_active", "0", "enables chase cam"}
 
cvar_t chase_back = {CF_CLIENT | CF_ARCHIVE, "chase_back", "48", "chase cam distance from the player"}
 
cvar_t chase_overhead = {CF_CLIENT | CF_ARCHIVE, "chase_overhead", "0", "chase cam looks straight down if this is not zero"}
 
cvar_t chase_pitchangle = {CF_CLIENT | CF_ARCHIVE, "chase_pitchangle", "55", "chase cam pitch angle"}
 
cvar_t chase_stevie = {CF_CLIENT, "chase_stevie", "0", "(GOODVSBAD2 only) chase cam view from above"}
 
cvar_t chase_up = {CF_CLIENT | CF_ARCHIVE, "chase_up", "24", "chase cam distance from the player"}
 
cvar_t cl_bob = {CF_CLIENT | CF_ARCHIVE, "cl_bob","0.02", "view bobbing amount"}
 
cvar_t cl_bob2 = {CF_CLIENT | CF_ARCHIVE, "cl_bob2","0", "sideways view bobbing amount"}
 
cvar_t cl_bob2cycle = {CF_CLIENT | CF_ARCHIVE, "cl_bob2cycle","0.6", "sideways view bobbing speed"}
 
cvar_t cl_bob2smooth = {CF_CLIENT | CF_ARCHIVE, "cl_bob2smooth","0.05", "how fast the view goes back when you stop touching the ground"}
 
cvar_t cl_bob_limit = {CF_CLIENT | CF_ARCHIVE, "cl_bob_limit", "7", "limits bobbing to this much distance from view_ofs"}
 
cvar_t cl_bob_limit_heightcheck = {CF_CLIENT | CF_ARCHIVE, "cl_bob_limit_heightcheck", "0", "check ceiling and floor height against cl_bob_limit and scale down all view bobbing if could result in camera being in solid"}
 
cvar_t cl_bob_limit_heightcheck_dontcrosswatersurface = {CF_CLIENT | CF_ARCHIVE, "cl_bob_limit_heightcheck_dontcrosswatersurface", "1", "limit cl_bob_limit to not crossing liquid surfaces also"}
 
cvar_t cl_bob_velocity_limit = {CF_CLIENT | CF_ARCHIVE, "cl_bob_velocity_limit", "400", "limits the xyspeed value in the bobbing code"}
 
cvar_t cl_bobcycle = {CF_CLIENT | CF_ARCHIVE, "cl_bobcycle","0.6", "view bobbing speed"}
 
cvar_t cl_bobfall = {CF_CLIENT | CF_ARCHIVE, "cl_bobfall","0", "how much the view swings down when falling (influenced by the speed you hit the ground with)"}
 
cvar_t cl_bobfallcycle = {CF_CLIENT | CF_ARCHIVE, "cl_bobfallcycle","3", "speed of the bobfall swing"}
 
cvar_t cl_bobfallminspeed = {CF_CLIENT | CF_ARCHIVE, "cl_bobfallminspeed","200", "necessary amount of speed for bob-falling to occur"}
 
cvar_t cl_bobmodel = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel", "1", "enables gun bobbing"}
 
cvar_t cl_bobmodel_classic = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_classic", "1", "classic Quake-style forward gun bobbing"}
 
cvar_t cl_bobmodel_forward = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_forward", "0", "gun bobbing forward movement amount"}
 
cvar_t cl_bobmodel_side = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_side", "0.15", "gun bobbing sideways sway amount"}
 
cvar_t cl_bobmodel_speed = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_speed", "7", "gun bobbing speed"}
 
cvar_t cl_bobmodel_up = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_up", "0.06", "gun bobbing upward movement amount"}
 
cvar_t cl_bobup = {CF_CLIENT | CF_ARCHIVE, "cl_bobup","0.5", "view bobbing adjustment that makes the up or down swing of the bob last longer"}
 
cvar_t cl_followmodel = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel", "0", "enables gun following"}
 
cvar_t cl_followmodel_side_highpass = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_highpass", "5", "gun following sideways highpass in 1/s"}
 
cvar_t cl_followmodel_side_highpass1 = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_highpass1", "30", "gun following sideways pre-highpass in 1/s"}
 
cvar_t cl_followmodel_side_limit = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_limit", "6", "gun following sideways limit"}
 
cvar_t cl_followmodel_side_lowpass = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_lowpass", "10", "gun following sideways lowpass in 1/s"}
 
cvar_t cl_followmodel_side_speed = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_speed", "0.25", "gun following sideways speed"}
 
cvar_t cl_followmodel_up_highpass = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_highpass", "2", "gun following upward highpass in 1/s"}
 
cvar_t cl_followmodel_up_highpass1 = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_highpass1", "60", "gun following upward pre-highpass in 1/s"}
 
cvar_t cl_followmodel_up_limit = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_limit", "5", "gun following upward limit"}
 
cvar_t cl_followmodel_up_lowpass = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_lowpass", "10", "gun following upward lowpass in 1/s"}
 
cvar_t cl_followmodel_up_speed = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_speed", "0.5", "gun following upward speed"}
 
cvar_t cl_leanmodel = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel", "0", "enables gun leaning"}
 
cvar_t cl_leanmodel_side_highpass = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_highpass", "3", "gun leaning sideways highpass in 1/s"}
 
cvar_t cl_leanmodel_side_highpass1 = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_highpass1", "30", "gun leaning sideways pre-highpass in 1/s"}
 
cvar_t cl_leanmodel_side_limit = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_limit", "35", "gun leaning sideways limit"}
 
cvar_t cl_leanmodel_side_lowpass = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_lowpass", "20", "gun leaning sideways lowpass in 1/s"}
 
cvar_t cl_leanmodel_side_speed = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_speed", "0.7", "gun leaning sideways speed"}
 
cvar_t cl_leanmodel_up_highpass = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_highpass", "15", "gun leaning upward highpass in 1/s"}
 
cvar_t cl_leanmodel_up_highpass1 = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_highpass1", "5", "gun leaning upward pre-highpass in 1/s"}
 
cvar_t cl_leanmodel_up_limit = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_limit", "50", "gun leaning upward limit"}
 
cvar_t cl_leanmodel_up_lowpass = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_lowpass", "20", "gun leaning upward lowpass in 1/s"}
 
cvar_t cl_leanmodel_up_speed = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_speed", "0.65", "gun leaning upward speed"}
 
int cl_punchangle_applied
 
cvar_t cl_rollangle = {CF_CLIENT | CF_ARCHIVE, "cl_rollangle", "2.0", "how much to tilt the view when strafing"}
 
cvar_t cl_rollspeed = {CF_CLIENT | CF_ARCHIVE, "cl_rollspeed", "200", "how much strafing is necessary to tilt the view"}
 
cvar_t cl_smoothviewheight = {CF_CLIENT | CF_ARCHIVE, "cl_smoothviewheight", "0", "time of the averaging to the viewheight value so that it creates a smooth transition. higher values = longer transition, 0 for instant transition."}
 
cvar_t cl_stairsmoothspeed = {CF_CLIENT | CF_ARCHIVE, "cl_stairsmoothspeed", "160", "how fast your view moves upward/downward when running up/down stairs"}
 
cvar_t cl_viewmodel_scale = {CF_CLIENT, "cl_viewmodel_scale", "1", "changes size of gun model, lower values prevent poking into walls but cause strange artifacts on lighting and especially r_stereo/vid_stereobuffer options where the size of the gun becomes visible"}
 
cvar_t crosshair = {CF_CLIENT | CF_ARCHIVE, "crosshair", "0", "selects crosshair to use (0 is none)"}
 
cvar_t r_viewmodel_quake = {CF_CLIENT | CF_ARCHIVE, "r_viewmodel_quake", "0", "Quake-style weapon viewmodel angle adjustment"}
 
cvar_t v_centermove = {CF_CLIENT, "v_centermove", "0.15", "how long before the view begins to center itself (if freelook/+mlook/+jlook/+klook are off)"}
 
cvar_t v_centerspeed = {CF_CLIENT, "v_centerspeed","500", "how fast the view centers itself"}
 
static cshift_t v_cshift
 
cvar_t v_deathtilt = {CF_CLIENT, "v_deathtilt", "1", "whether to use sideways view when dead"}
 
cvar_t v_deathtiltangle = {CF_CLIENT, "v_deathtiltangle", "80", "what roll angle to use when tilting the view while dead"}
 
float v_dmg_pitch
 
float v_dmg_roll
 
float v_dmg_time
 
cvar_t v_idlescale = {CF_CLIENT, "v_idlescale", "0", "how much of the quake 'drunken view' effect to use"}
 
cvar_t v_ipitch_cycle = {CF_CLIENT, "v_ipitch_cycle", "1", "v_idlescale pitch speed"}
 
cvar_t v_ipitch_level = {CF_CLIENT, "v_ipitch_level", "0.3", "v_idlescale pitch amount"}
 
cvar_t v_iroll_cycle = {CF_CLIENT, "v_iroll_cycle", "0.5", "v_idlescale roll speed"}
 
cvar_t v_iroll_level = {CF_CLIENT, "v_iroll_level", "0.1", "v_idlescale roll amount"}
 
cvar_t v_isometric = {CF_CLIENT, "v_isometric", "0", "changes view to isometric (non-perspective)"}
 
cvar_t v_isometric_flipcullface = {CF_CLIENT, "v_isometric_flipcullface", "0", "flips the backface culling"}
 
cvar_t v_isometric_locked_orientation = {CF_CLIENT, "v_isometric_locked_orientation", "1", "camera rotation is fixed"}
 
cvar_t v_isometric_relx = {CF_CLIENT, "v_isometric_relx", "0", "camera position*forward"}
 
cvar_t v_isometric_rely = {CF_CLIENT, "v_isometric_rely", "0", "camera position*left"}
 
cvar_t v_isometric_relz = {CF_CLIENT, "v_isometric_relz", "0", "camera position*up"}
 
cvar_t v_isometric_rot_pitch = {CF_CLIENT, "v_isometric_rot_pitch", "60", "camera rotation"}
 
cvar_t v_isometric_rot_roll = {CF_CLIENT, "v_isometric_rot_roll", "0", "camera rotation"}
 
cvar_t v_isometric_rot_yaw = {CF_CLIENT, "v_isometric_rot_yaw", "135", "camera rotation"}
 
cvar_t v_isometric_tx = {CF_CLIENT, "v_isometric_tx", "0", "camera position (player-relative)"}
 
cvar_t v_isometric_ty = {CF_CLIENT, "v_isometric_ty", "0", "camera position (player-relative)"}
 
cvar_t v_isometric_tz = {CF_CLIENT, "v_isometric_tz", "0", "camera position (player-relative)"}
 
cvar_t v_isometric_usevieworiginculling = {CF_CLIENT, "v_isometric_usevieworiginculling", "0", "check visibility to the player location (can look pretty weird)"}
 
cvar_t v_isometric_verticalfov = {CF_CLIENT, "v_isometric_verticalfov", "512", "vertical field of view in game units (horizontal is computed using aspect ratio based on this)"}
 
cvar_t v_isometric_xx = {CF_CLIENT, "v_isometric_xx", "1", "camera matrix"}
 
cvar_t v_isometric_xy = {CF_CLIENT, "v_isometric_xy", "0", "camera matrix"}
 
cvar_t v_isometric_xz = {CF_CLIENT, "v_isometric_xz", "0", "camera matrix"}
 
cvar_t v_isometric_yx = {CF_CLIENT, "v_isometric_yx", "0", "camera matrix"}
 
cvar_t v_isometric_yy = {CF_CLIENT, "v_isometric_yy", "1", "camera matrix"}
 
cvar_t v_isometric_yz = {CF_CLIENT, "v_isometric_yz", "0", "camera matrix"}
 
cvar_t v_isometric_zx = {CF_CLIENT, "v_isometric_zx", "0", "camera matrix"}
 
cvar_t v_isometric_zy = {CF_CLIENT, "v_isometric_zy", "0", "camera matrix"}
 
cvar_t v_isometric_zz = {CF_CLIENT, "v_isometric_zz", "1", "camera matrix"}
 
cvar_t v_iyaw_cycle = {CF_CLIENT, "v_iyaw_cycle", "2", "v_idlescale yaw speed"}
 
cvar_t v_iyaw_level = {CF_CLIENT, "v_iyaw_level", "0.3", "v_idlescale yaw amount"}
 
cvar_t v_kickpitch = {CF_CLIENT, "v_kickpitch", "0.6", "how much a view kick from damage pitches your view"}
 
cvar_t v_kickroll = {CF_CLIENT, "v_kickroll", "0.6", "how much a view kick from damage rolls your view"}
 
cvar_t v_kicktime = {CF_CLIENT, "v_kicktime", "0.5", "how long a view kick from damage lasts"}
 
cvar_t v_yshearing = {CF_CLIENT, "v_yshearing", "0", "be all out of gum (set this to the maximum angle to allow Y shearing for - try values like 75)"}
 
matrix4x4_t viewmodelmatrix_nobob
 
matrix4x4_t viewmodelmatrix_withbob
 

Function Documentation

◆ highpass()

static vec_t highpass ( vec_t value,
vec_t frac,
vec_t * store )
static

Definition at line 410 of file view.c.

411{
412 return value - lowpass(value, frac, store);
413}
GLsizei const GLfloat * value
Definition glquake.h:740
static vec_t lowpass(vec_t value, vec_t frac, vec_t *store)
Definition view.c:398

References lowpass(), and value.

Referenced by highpass3().

◆ highpass3()

static void highpass3 ( vec3_t value,
vec_t fracx,
vec_t fracy,
vec_t fracz,
vec3_t store,
vec3_t out )
static

Definition at line 427 of file view.c.

428{
429 out[0] = highpass(value[0], fracx, &store[0]);
430 out[1] = highpass(value[1], fracy, &store[1]);
431 out[2] = highpass(value[2], fracz, &store[2]);
432}
static vec_t highpass(vec_t value, vec_t frac, vec_t *store)
Definition view.c:410

References highpass(), and value.

Referenced by V_CalcRefdefUsing().

◆ highpass3_limited()

static void highpass3_limited ( vec3_t value,
vec_t fracx,
vec_t limitx,
vec_t fracy,
vec_t limity,
vec_t fracz,
vec_t limitz,
vec3_t store,
vec3_t out )
static

Definition at line 434 of file view.c.

435{
436 out[0] = highpass_limited(value[0], fracx, limitx, &store[0]);
437 out[1] = highpass_limited(value[1], fracy, limity, &store[1]);
438 out[2] = highpass_limited(value[2], fracz, limitz, &store[2]);
439}
static vec_t highpass_limited(vec_t value, vec_t frac, vec_t limit, vec_t *store)
Definition view.c:415

References highpass_limited(), and value.

Referenced by V_CalcRefdefUsing().

◆ highpass_limited()

static vec_t highpass_limited ( vec_t value,
vec_t frac,
vec_t limit,
vec_t * store )
static

Definition at line 415 of file view.c.

416{
417 return value - lowpass_limited(value, frac, limit, store);
418}
static vec_t lowpass_limited(vec_t value, vec_t frac, vec_t limit, vec_t *store)
Definition view.c:404

References lowpass_limited(), and value.

Referenced by highpass3_limited().

◆ lowpass()

static vec_t lowpass ( vec_t value,
vec_t frac,
vec_t * store )
static

Definition at line 398 of file view.c.

399{
400 frac = bound(0, frac, 1);
401 return (*store = *store * (1 - frac) + value * frac);
402}
#define bound(min, num, max)
Definition mathlib.h:34

References bound, and value.

Referenced by highpass(), lowpass3(), and lowpass_limited().

◆ lowpass3()

static void lowpass3 ( vec3_t value,
vec_t fracx,
vec_t fracy,
vec_t fracz,
vec3_t store,
vec3_t out )
static

Definition at line 420 of file view.c.

421{
422 out[0] = lowpass(value[0], fracx, &store[0]);
423 out[1] = lowpass(value[1], fracy, &store[1]);
424 out[2] = lowpass(value[2], fracz, &store[2]);
425}

References lowpass(), and value.

Referenced by V_CalcRefdefUsing().

◆ lowpass_limited()

static vec_t lowpass_limited ( vec_t value,
vec_t frac,
vec_t limit,
vec_t * store )
static

Definition at line 404 of file view.c.

405{
406 lowpass(value, frac, store);
407 return (*store = bound(value - limit, *store, value + limit));
408}

References bound, lowpass(), and value.

Referenced by highpass_limited().

◆ V_BonusFlash_f()

static void V_BonusFlash_f ( cmd_state_t * cmd)
static

Definition at line 345 of file view.c.

346{
347 if(Cmd_Argc(cmd) == 1)
348 {
354 }
355 else if(Cmd_Argc(cmd) >= 4 && Cmd_Argc(cmd) <= 6)
356 {
357 cl.cshifts[CSHIFT_BONUS].destcolor[0] = atof(Cmd_Argv(cmd, 1)) * 255;
358 cl.cshifts[CSHIFT_BONUS].destcolor[1] = atof(Cmd_Argv(cmd, 2)) * 255;
359 cl.cshifts[CSHIFT_BONUS].destcolor[2] = atof(Cmd_Argv(cmd, 3)) * 255;
360 if(Cmd_Argc(cmd) >= 5)
361 cl.cshifts[CSHIFT_BONUS].percent = atof(Cmd_Argv(cmd, 4)) * 255; // yes, these are HEXADECIMAL percent ;)
362 else
364 if(Cmd_Argc(cmd) >= 6)
365 cl.cshifts[CSHIFT_BONUS].alphafade = atof(Cmd_Argv(cmd, 5)) * 255;
366 else
368 }
369 else
370 Con_Printf("usage:\nbf, or bf R G B [A [alphafade]]\n");
371}
client_state_t cl
Definition cl_main.c:117
#define CSHIFT_BONUS
Definition client.h:513
static int Cmd_Argc(cmd_state_t *cmd)
Definition cmd.h:249
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
Definition cmd.h:254
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
Definition console.c:1514
void cmd(string command,...)
cshift_t cshifts[NUM_CSHIFTS]
Definition client.h:775
float percent
Definition client.h:507
float destcolor[3]
Definition client.h:506
float alphafade
Definition client.h:508

References cshift_t::alphafade, cl, cmd(), Cmd_Argc(), Cmd_Argv(), Con_Printf(), CSHIFT_BONUS, client_state_t::cshifts, cshift_t::destcolor, and cshift_t::percent.

Referenced by V_Init().

◆ V_CalcIntermissionRefdef()

static void V_CalcIntermissionRefdef ( vec3_t vieworg,
vec3_t viewangles,
const matrix4x4_t * entrendermatrix,
float clstatsviewheight )
static

Definition at line 487 of file view.c.

488{
489 matrix4x4_t tmpmatrix;
490
491 // entity is a fixed camera, just copy the matrix
494 else
495 {
496 r_refdef.view.matrix = *entrendermatrix;
497 Matrix4x4_AdjustOrigin(&r_refdef.view.matrix, 0, 0, clstatsviewheight);
498 }
499 if (v_yshearing.value > 0)
504
507
510}
client_static_t cls
Definition cl_main.c:116
@ PROTOCOL_QUAKEWORLD
quakeworld protocol
Definition common.h:145
r_refdef_t r_refdef
Definition gl_rmain.c:57
#define VectorCopy(in, out)
Definition mathlib.h:101
void Matrix4x4_AdjustOrigin(matrix4x4_t *out, double x, double y, double z)
Definition matrixlib.c:1824
void Matrix4x4_QuakeToDuke3D(const matrix4x4_t *in, matrix4x4_t *out, double maxShearAngle)
Definition matrixlib.c:891
void Matrix4x4_CreateFromQuakeEntity(matrix4x4_t *out, double x, double y, double z, double pitch, double yaw, double roll, double scale)
Definition matrixlib.c:715
void Matrix4x4_ConcatScale(matrix4x4_t *out, double x)
Definition matrixlib.c:1775
void Matrix4x4_CreateScale(matrix4x4_t *out, double x)
Definition matrixlib.c:675
void Matrix4x4_Invert_Simple(matrix4x4_t *out, const matrix4x4_t *in1)
Definition matrixlib.c:422
void Matrix4x4_Copy(matrix4x4_t *out, const matrix4x4_t *in)
Definition matrixlib.c:19
vec3_t csqc_viewanglesfromengine
Definition client.h:1114
vec3_t qw_intermission_origin
Definition client.h:1095
vec3_t csqc_vieworiginfromengine
Definition client.h:1113
matrix4x4_t csqc_viewmodelmatrixfromengine
Definition client.h:1115
vec3_t qw_intermission_angles
Definition client.h:1096
protocolversion_t protocol
Definition client.h:617
float value
Definition cvar.h:74
r_refdef_view_t view
Definition render.h:406
matrix4x4_t matrix
Definition render.h:266
cvar_t cl_viewmodel_scale
Definition view.c:82
matrix4x4_t viewmodelmatrix_withbob
Definition cl_main.c:1056
matrix4x4_t viewmodelmatrix_nobob
Definition cl_main.c:1057
cvar_t v_yshearing
Definition view.c:143

References cl, cl_viewmodel_scale, cls, client_state_t::csqc_viewanglesfromengine, client_state_t::csqc_viewmodelmatrixfromengine, client_state_t::csqc_vieworiginfromengine, r_refdef_view_t::matrix, Matrix4x4_AdjustOrigin(), Matrix4x4_ConcatScale(), Matrix4x4_Copy(), Matrix4x4_CreateFromQuakeEntity(), Matrix4x4_CreateScale(), Matrix4x4_Invert_Simple(), Matrix4x4_QuakeToDuke3D(), client_static_t::protocol, PROTOCOL_QUAKEWORLD, client_state_t::qw_intermission_angles, client_state_t::qw_intermission_origin, r_refdef, v_yshearing, cvar_t::value, VectorCopy, r_refdef_t::view, viewmodelmatrix_nobob, and viewmodelmatrix_withbob.

Referenced by V_CalcRefdefUsing().

◆ V_CalcRefdef()

void V_CalcRefdef ( void )

Definition at line 944 of file view.c.

945{
946 entity_t *ent;
947 qbool cldead;
948
950 {
951 // ent is the view entity (visible when out of body)
952 ent = &cl.entities[cl.viewentity];
953
954 cldead = (cl.stats[STAT_HEALTH] <= 0 && cl.stats[STAT_HEALTH] != -666 && cl.stats[STAT_HEALTH] != -2342);
955 V_CalcRefdefUsing(&ent->render.matrix, cl.viewangles, !ent->persistent.trail_allowed, cl.onground, cl.cmd.jump, cl.stats[STAT_VIEWHEIGHT], cldead, cl.velocity); // FIXME use a better way to detect teleport/warp than trail_allowed
956 }
957 else
958 {
965 }
966}
@ ca_connected
Definition client.h:532
#define SIGNONS
Definition client.h:525
#define VectorClear(a)
Definition mathlib.h:97
const matrix4x4_t identitymatrix
Definition matrixlib.c:9
#define STAT_HEALTH
Definition qstats.h:8
#define STAT_VIEWHEIGHT
FTE, DP.
Definition qstats.h:24
bool qbool
Definition qtypes.h:9
unsigned short csqc_server2csqcentitynumber[MAX_EDICTS]
Definition client.h:1110
vec3_t velocity
Definition client.h:792
qbool onground
Definition client.h:843
vec3_t viewangles
Definition client.h:786
entity_t * entities
Definition client.h:991
int stats[MAX_CL_STATS]
Definition client.h:758
usercmd_t cmd
Definition client.h:752
cactive_t state
Definition client.h:568
matrix4x4_t matrix
Definition client.h:332
entity_persistent_t persistent
Definition client.h:474
entity_render_t render
Definition client.h:477
qbool jump
Definition protocol.h:404
void V_CalcRefdefUsing(const matrix4x4_t *entrendermatrix, const vec3_t clviewangles, qbool teleported, qbool clonground, qbool clcmdjump, float clstatsviewheight, qbool cldead, const vec3_t clvelocity)
Definition view.c:512

References ca_connected, cl, cls, client_state_t::cmd, client_state_t::csqc_server2csqcentitynumber, client_state_t::csqc_viewanglesfromengine, client_state_t::csqc_viewmodelmatrixfromengine, client_state_t::csqc_vieworiginfromengine, client_state_t::entities, identitymatrix, usercmd_t::jump, entity_render_t::matrix, r_refdef_view_t::matrix, client_state_t::onground, entity_t::persistent, r_refdef, entity_t::render, client_static_t::signon, SIGNONS, STAT_HEALTH, STAT_VIEWHEIGHT, client_static_t::state, client_state_t::stats, entity_persistent_t::trail_allowed, V_CalcRefdefUsing(), VectorClear, VectorCopy, client_state_t::velocity, r_refdef_t::view, client_state_t::viewangles, client_state_t::viewentity, viewmodelmatrix_nobob, and viewmodelmatrix_withbob.

Referenced by CL_UpdateWorld().

◆ V_CalcRefdefUsing()

void V_CalcRefdefUsing ( const matrix4x4_t * entrendermatrix,
const vec3_t clviewangles,
qbool teleported,
qbool clonground,
qbool clcmdjump,
float clstatsviewheight,
qbool cldead,
const vec3_t clvelocity )

Definition at line 512 of file view.c.

513{
514 float vieworg[3], viewangles[3], smoothtime;
515 float gunorg[3], gunangles[3];
516 matrix4x4_t tmpmatrix;
517 static float viewheightavg;
518 float viewheight;
519 trace_t trace;
520
521 // react to clonground state changes (for gun bob)
522 if (clonground)
523 {
524 if (!cl.oldonground)
527 }
528 cl.oldonground = clonground;
530
531 VectorClear(gunangles);
532 VectorClear(gunorg);
536
537 // player can look around, so take the origin from the entity,
538 // and the angles from the input system
539 Matrix4x4_OriginFromMatrix(entrendermatrix, vieworg);
540 VectorCopy(clviewangles, viewangles);
541
542 // calculate how much time has passed since the last V_CalcRefdef
543 smoothtime = bound(0, cl.time - cl.stairsmoothtime, 0.1);
545
546 // fade damage flash
547 if (v_dmg_time > 0)
548 v_dmg_time -= bound(0, smoothtime, 0.1);
549
550 if (cl.intermission)
551 V_CalcIntermissionRefdef(vieworg, viewangles, entrendermatrix, clstatsviewheight);
552 else
553 {
554 // smooth stair stepping, but only if clonground and enabled
555 if (!clonground || cl_stairsmoothspeed.value <= 0 || teleported)
556 cl.stairsmoothz = vieworg[2];
557 else
558 {
559 if (cl.stairsmoothz < vieworg[2])
560 vieworg[2] = cl.stairsmoothz = bound(vieworg[2] - cl.movevars_stepheight, cl.stairsmoothz + smoothtime * cl_stairsmoothspeed.value, vieworg[2]);
561 else if (cl.stairsmoothz > vieworg[2])
562 vieworg[2] = cl.stairsmoothz = bound(vieworg[2], cl.stairsmoothz - smoothtime * cl_stairsmoothspeed.value, vieworg[2] + cl.movevars_stepheight);
563 }
564
565 // apply qw weapon recoil effect (this did not work in QW)
566 // TODO: add a cvar to disable this
567 viewangles[PITCH] += cl.qw_weaponkick;
568
569 // apply the viewofs (even if chasecam is used)
570 // Samual: Lets add smoothing for this too so that things like crouching are done with a transition.
571 viewheight = bound(0, (cl.time - cl.calcrefdef_prevtime) / max(0.0001, cl_smoothviewheight.value), 1);
572 viewheightavg = viewheightavg * (1 - viewheight) + clstatsviewheight * viewheight;
573 vieworg[2] += viewheightavg;
574
576 {
577 // observing entity from third person. Added "campitch" by Alexander "motorsep" Zubov
578 vec_t camback, camup, dist, campitch, forward[3], chase_dest[3];
579
580 camback = chase_back.value;
581 camup = chase_up.value;
582 campitch = chase_pitchangle.value;
583
584 AngleVectors(viewangles, forward, NULL, NULL);
585
587 {
589 vec3_t bestvieworg;
590 vec3_t up;
591 viewangles[PITCH] = 0;
592 AngleVectors(viewangles, forward, NULL, up);
593 // trace a little further so it hits a surface more consistently (to avoid 'snapping' on the edge of the range)
594 chase_dest[0] = vieworg[0] - forward[0] * camback + up[0] * camup;
595 chase_dest[1] = vieworg[1] - forward[1] * camback + up[1] * camup;
596 chase_dest[2] = vieworg[2] - forward[2] * camback + up[2] * camup;
597 // trace from first person view location to our chosen third person view location
599 VectorCopy(trace.endpos, bestvieworg);
600 offset[2] = 0;
601 for (offset[0] = -16;offset[0] <= 16;offset[0] += 8)
602 {
603 for (offset[1] = -16;offset[1] <= 16;offset[1] += 8)
604 {
605 AngleVectors(viewangles, NULL, NULL, up);
606 chase_dest[0] = vieworg[0] - forward[0] * camback + up[0] * camup + offset[0];
607 chase_dest[1] = vieworg[1] - forward[1] * camback + up[1] * camup + offset[1];
608 chase_dest[2] = vieworg[2] - forward[2] * camback + up[2] * camup + offset[2];
610 if (bestvieworg[2] > trace.endpos[2])
611 bestvieworg[2] = trace.endpos[2];
612 }
613 }
614 bestvieworg[2] -= 8;
615 VectorCopy(bestvieworg, vieworg);
616 viewangles[PITCH] = campitch;
617 }
618 else
619 {
621 {
622 // look straight down from high above
623 viewangles[PITCH] = 90;
624 camback = 2048;
625 VectorSet(forward, 0, 0, -1);
626 }
627
628 // trace a little further so it hits a surface more consistently (to avoid 'snapping' on the edge of the range)
629 dist = -camback - 8;
630 chase_dest[0] = vieworg[0] + forward[0] * dist;
631 chase_dest[1] = vieworg[1] + forward[1] * dist;
632 chase_dest[2] = vieworg[2] + forward[2] * dist + camup;
634 VectorMAMAM(1, trace.endpos, 8, forward, 4, trace.plane.normal, vieworg);
635 }
636 }
637 else
638 {
639 // first person view from entity
640 // angles
641 if (cldead && v_deathtilt.integer)
642 viewangles[ROLL] = v_deathtiltangle.value;
643
644 // origin
645 VectorAdd(vieworg, cl.punchvector, vieworg);
646 if (!cldead)
647 {
648 double xyspeed = 0, bob = 0, bobfall = 0;
649 double cycle = 0; // double-precision because cl.time can be a very large number, where float would get stuttery at high time values
651
653
655 {
656 // 1. if we teleported, clear the frametime... the lowpass will recover the previous value then
657 if(teleported)
658 {
659 // try to fix the first highpass; result is NOT
660 // perfect! TODO find a better fix
661 VectorCopy(viewangles, cl.gunangles_prev);
662 VectorCopy(vieworg, cl.gunorg_prev);
663 }
664
665 // 2. for the gun origin, only keep the high frequency (non-DC) parts, which is "somewhat like velocity"
668 VectorCopy(vieworg, cl.gunorg_prev);
670
671 // in the highpass, we _store_ the DIFFERENCE to the actual view angles...
673 cl.gunangles_highpass[PITCH] += 360 * floor((viewangles[PITCH] - cl.gunangles_highpass[PITCH]) / 360 + 0.5);
674 cl.gunangles_highpass[YAW] += 360 * floor((viewangles[YAW] - cl.gunangles_highpass[YAW]) / 360 + 0.5);
675 cl.gunangles_highpass[ROLL] += 360 * floor((viewangles[ROLL] - cl.gunangles_highpass[ROLL]) / 360 + 0.5);
677 VectorCopy(viewangles, cl.gunangles_prev);
679
680 // 3. calculate the RAW adjustment vectors
681 gunorg[0] *= -cl_followmodel_side_speed.value;
682 gunorg[1] *= -cl_followmodel_side_speed.value;
683 gunorg[2] *= -cl_followmodel_up_speed.value;
684
685 gunangles[PITCH] *= -cl_leanmodel_up_speed.value;
686 gunangles[YAW] *= -cl_leanmodel_side_speed.value;
687 gunangles[ROLL] = 0;
688
689 // 4. perform highpass/lowpass on the adjustment vectors (turning velocity into acceleration!)
690 // trick: we must do the lowpass LAST, so the lowpass vector IS the final vector!
693 // we assume here: PITCH = 0, YAW = 1, ROLL = 2
696
697 // 5. use the adjusted vectors
698 VectorAdd(vieworg, gunorg, gunorg);
699 VectorAdd(viewangles, gunangles, gunangles);
700 }
701 else
702 {
703 // Just initialize gunorg/gunangles.
704 VectorCopy(vieworg, gunorg);
705 VectorCopy(viewangles, gunangles);
706 }
707
708 // bounded XY speed, used by several effects below
709 xyspeed = bound (0, sqrt(clvelocity[0]*clvelocity[0] + clvelocity[1]*clvelocity[1]), cl_bob_velocity_limit.value);
710
711 // vertical view bobbing code
713 {
714 float bob_limit = cl_bobmodel_classic.integer ? 4 : cl_bob_limit.value;
715
717 {
718 // use traces to determine what range the view can bob in, and scale down the bob as needed
719 float trace1fraction;
720 float trace2fraction;
721 vec3_t bob_height_check_dest;
722
723 // these multipliers are expanded a bit (the actual bob sin range is from -0.4 to 1.0) to reduce nearclip issues, especially on water surfaces
724 bob_height_check_dest[0] = vieworg[0];
725 bob_height_check_dest[1] = vieworg[1];
726 bob_height_check_dest[2] = vieworg[2] + cl_bob_limit.value * 1.1f;
728 trace1fraction = trace.fraction;
729
730 bob_height_check_dest[0] = vieworg[0];
731 bob_height_check_dest[1] = vieworg[1];
732 bob_height_check_dest[2] = vieworg[2] + cl_bob_limit.value * -0.5f;
734 trace2fraction = trace.fraction;
735
736 bob_limit *= min(trace1fraction, trace2fraction);
737 }
738
739 // LadyHavoc: this code is *weird*, but not replacable (I think it
740 // should be done in QC on the server, but oh well, quake is quake)
741 // LadyHavoc: figured out bobup: the time at which the sin is at 180
742 // degrees (which allows lengthening or squishing the peak or valley)
743 cycle = cl.time / cl_bobcycle.value;
744 cycle -= (int) cycle;
745 if (cycle < cl_bobup.value)
746 cycle = M_PI * cycle / cl_bobup.value;
747 else
748 cycle = M_PI + M_PI * (cycle-cl_bobup.value)/(1.0 - cl_bobup.value);
749 // bob is proportional to velocity in the xy plane
750 // (don't count Z, or jumping messes it up)
751 bob = xyspeed * cl_bob.value;
752 bob = bob*0.3 + bob*0.7*sin(cycle);
753 bob = bound(-7, bob, bob_limit);
754
755 vieworg[2] += bob;
756
757 // we also need to adjust gunorg, or this appears like pushing the gun!
758 // In the old code, this was applied to vieworg BEFORE copying to gunorg,
759 // but this is not viable with the new followmodel code as that would mean
760 // that followmodel would work on the munged-by-bob vieworg and do feedback
762 gunorg[2] += bob;
763 }
764
765 // horizontal view bobbing code
767 {
768 vec3_t bob2vel;
770 float side, front;
771
772 cycle = cl.time / cl_bob2cycle.value;
773 cycle -= (int) cycle;
774 if (cycle < 0.5)
775 cycle = cos(M_PI * cycle / 0.5); // cos looks better here with the other view bobbing using sin
776 else
777 cycle = cos(M_PI + M_PI * (cycle-0.5)/0.5);
778 bob = cl_bob2.value * cycle;
779
780 // this value slowly decreases from 1 to 0 when we stop touching the ground.
781 // The cycle is later multiplied with it so the view smooths back to normal
782 if (clonground && !clcmdjump) // also block the effect while the jump button is pressed, to avoid twitches when bunny-hopping
783 cl.bob2_smooth = 1;
784 else
785 {
786 if(cl.bob2_smooth > 0)
788 else
789 cl.bob2_smooth = 0;
790 }
791
792 // calculate the front and side of the player between the X and Y axes
793 AngleVectors(viewangles, forward, right, up);
794 // now get the speed based on those angles. The bounds should match the same value as xyspeed's
798 VectorScale(right, bob, right);
799 // we use side with forward and front with right, so the bobbing goes
800 // to the side when we walk forward and to the front when we strafe
801 VectorMAMAM(side, forward, front, right, 0, up, bob2vel);
802 vieworg[0] += bob2vel[0];
803 vieworg[1] += bob2vel[1];
804 // we also need to adjust gunorg, or this appears like pushing the gun!
805 // In the old code, this was applied to vieworg BEFORE copying to gunorg,
806 // but this is not viable with the new followmodel code as that would mean
807 // that followmodel would work on the munged-by-bob vieworg and do feedback
808 gunorg[0] += bob2vel[0];
809 gunorg[1] += bob2vel[1];
810 }
811
812 // fall bobbing code
813 // causes the view to swing down and back up when touching the ground
815 {
816 if (!clonground)
817 {
818 cl.bobfall_speed = bound(-400, clvelocity[2], 0) * bound(0, cl_bobfall.value, 0.1);
819 if (clvelocity[2] < -cl_bobfallminspeed.value)
820 cl.bobfall_swing = 1;
821 else
822 cl.bobfall_swing = 0; // TODO really?
823 }
824 else
825 {
827
828 bobfall = sin(M_PI * cl.bobfall_swing) * cl.bobfall_speed;
829 vieworg[2] += bobfall;
830 gunorg[2] += bobfall;
831 }
832 }
833 VectorCopy(clviewangles, viewangles);
834
835 // Hanicef: don't apply punchangle twice if the scene is rendered more than once.
837 {
838 VectorAdd(viewangles, cl.punchangle, viewangles);
840 }
841 viewangles[ROLL] += Com_CalcRoll(clviewangles, clvelocity, cl_rollangle.value, cl_rollspeed.value);
842
843 if (v_dmg_time > 0)
844 {
847 }
848
849 // gun model bobbing code
850 if (cl_bobmodel.value)
851 {
853 AngleVectors (gunangles, forward, right, up);
854
856 {
857 // calculate for swinging gun model
858 // the gun bobs when running on the ground, but doesn't bob when you're in the air.
859 // Sajt: I tried to smooth out the transitions between bob and no bob, which works
860 // for the most part, but for some reason when you go through a message trigger or
861 // pick up an item or anything like that it will momentarily jolt the gun.
862 float bspeed;
863 float s;
864 float t;
865
867 if (clonground)
868 {
869 if (cl.time - cl.hitgroundtime < 0.2)
870 {
871 // just hit the ground, speed the bob back up over the next 0.2 seconds
872 t = cl.time - cl.hitgroundtime;
873 t = bound(0, t, 0.2);
874 t *= 5;
875 }
876 else
877 t = 1;
878 }
879 else
880 {
881 // recently left the ground, slow the bob down over the next 0.2 seconds
883 t = 0.2 - bound(0, t, 0.2);
884 t *= 5;
885 }
886
887 bspeed = xyspeed * 0.01f;
888 bob = bspeed * cl_bobmodel_side.value * cl_viewmodel_scale.value * sin (s) * t;
889 VectorMA (gunorg, bob, right, gunorg);
890 bob = bspeed * cl_bobmodel_up.value * cl_viewmodel_scale.value * cos (s * 2) * t;
891 VectorMA (gunorg, bob, up, gunorg);
892 }
893 else
894 {
895 // Classic Quake bobbing
896 for (int i = 0; i < 3; i++)
897 gunorg[i] += forward[i]*bob*0.4;
898 gunorg[2] += bob;
899
901 {
902 if (scr_viewsize.value == 110)
903 gunorg[2] += 1;
904 else if (scr_viewsize.value == 100)
905 gunorg[2] += 2;
906 else if (scr_viewsize.value == 90)
907 gunorg[2] += 1;
908 else if (scr_viewsize.value == 80)
909 gunorg[2] += 0.5;
910 }
911 }
912 }
913 }
914 }
915 // calculate a view matrix for rendering the scene
916 if (v_idlescale.value)
917 {
921 }
922 Matrix4x4_CreateFromQuakeEntity(&r_refdef.view.matrix, vieworg[0], vieworg[1], vieworg[2], viewangles[0], viewangles[1], viewangles[2], 1);
923 if (v_yshearing.value > 0)
925
926 // calculate a viewmodel matrix for use in view-attached entities
929
930 Matrix4x4_CreateFromQuakeEntity(&viewmodelmatrix_withbob, gunorg[0], gunorg[1], gunorg[2], gunangles[0], gunangles[1], gunangles[2], cl_viewmodel_scale.value);
931 if (v_yshearing.value > 0)
933
936
939 }
940
942}
#define SUPERCONTENTS_SKY
Definition bspfile.h:200
#define SUPERCONTENTS_SOLID
Definition bspfile.h:196
#define SUPERCONTENTS_LIQUIDSMASK
Definition bspfile.h:218
trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qbool hitnetworkbrushmodels, qbool hitnetworkplayers, int *hitnetworkentity, qbool hitcsqcentities, qbool hitsurfaces)
cvar_t scr_viewsize
Definition cl_screen.c:19
cvar_t collision_extendmovelength
Definition collision.c:14
gamemode_t gamemode
Definition com_game.c:26
@ GAME_GOODVSBAD2
Definition com_game.h:36
float Com_CalcRoll(const vec3_t angles, const vec3_t velocity, const vec_t angleval, const vec_t velocityval)
Definition common.c:890
float frametime
static int(ZEXPORT *qz_inflate)(z_stream *strm
GLuint GLuint GLintptr offset
Definition glquake.h:632
void AngleVectors(const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition mathlib.c:444
#define max(A, B)
Definition mathlib.h:38
#define min(A, B)
Definition mathlib.h:37
#define VectorMAMAM(scale1, b1, scale2, b2, scale3, b3, out)
Definition mathlib.h:117
#define VectorSet(vec, x, y, z)
Definition mathlib.h:96
#define VectorSubtract(a, b, out)
Definition mathlib.h:99
#define DotProduct(a, b)
Definition mathlib.h:98
#define VectorScale(in, scale, out)
Definition mathlib.h:111
#define VectorAdd(a, b, out)
Definition mathlib.h:100
#define M_PI
Definition mathlib.h:28
#define VectorMA(a, scale, b, out)
Definition mathlib.h:114
void Matrix4x4_Concat(matrix4x4_t *out, const matrix4x4_t *in1, const matrix4x4_t *in2)
Definition matrixlib.c:83
void Matrix4x4_OriginFromMatrix(const matrix4x4_t *in, float *out)
Definition matrixlib.c:1792
float cos(float f)
float sqrt(float f)
float sin(float f)
float floor(float f)
#define MATERIALFLAGMASK_TRANSLUCENT
int i
#define NULL
Definition qtypes.h:12
float vec_t
Definition qtypes.h:68
vec_t vec3_t[3]
Definition qtypes.h:71
#define YAW
Definition qtypes.h:19
#define PITCH
Definition qtypes.h:16
#define ROLL
Definition qtypes.h:22
float movevars_timescale
Definition client.h:1058
double oldtime
Definition client.h:868
double stairsmoothtime
Definition client.h:772
vec3_t gunangles_prev
Definition client.h:815
double hitgroundtime
Definition client.h:849
double calcrefdef_prevtime
Definition client.h:853
vec3_t gunorg_prev
Definition client.h:820
double lastongroundtime
Definition client.h:848
int intermission
Definition client.h:856
double time
Definition client.h:868
vec3_t punchvector
Definition client.h:790
vec3_t punchangle
Definition client.h:788
vec3_t gunangles_highpass
Definition client.h:816
usercmd_t movecmd[CL_MAX_USERCMDS]
Definition client.h:754
qbool oldonground
Definition client.h:847
vec3_t gunangles_adjustment_lowpass
Definition client.h:817
float movevars_stepheight
Definition client.h:1070
float bob2_smooth
Definition client.h:850
vec3_t gunorg_highpass
Definition client.h:821
vec3_t gunorg_adjustment_lowpass
Definition client.h:822
vec3_t gunangles_adjustment_highpass
Definition client.h:818
float bobfall_swing
Definition client.h:852
float stairsmoothz
Definition client.h:771
float bobfall_speed
Definition client.h:851
float qw_weaponkick
Definition client.h:1102
vec3_t gunorg_adjustment_highpass
Definition client.h:823
int integer
Definition cvar.h:73
double fraction
Definition collision.h:40
double endpos[3]
Definition collision.h:42
plane_t plane
Definition collision.h:44
double time
Definition protocol.h:392
static vec3_t forward
Definition sv_user.c:305
static vec3_t right
Definition sv_user.c:305
static vec3_t up
Definition sv_user.c:305
vec3_t normal
Definition collision.h:13
cvar_t cl_bob_velocity_limit
Definition view.c:56
cvar_t cl_followmodel_up_speed
Definition view.c:76
cvar_t cl_leanmodel_up_highpass
Definition view.c:67
cvar_t cl_leanmodel_up_speed
Definition view.c:64
cvar_t cl_bobmodel_speed
Definition view.c:52
cvar_t cl_bob_limit_heightcheck_dontcrosswatersurface
Definition view.c:55
cvar_t cl_followmodel
Definition view.c:70
float v_dmg_time
Definition view.c:147
static void highpass3_limited(vec3_t value, vec_t fracx, vec_t limitx, vec_t fracy, vec_t limity, vec_t fracz, vec_t limitz, vec3_t store, vec3_t out)
Definition view.c:434
cvar_t cl_bob2cycle
Definition view.c:42
int cl_punchangle_applied
Definition view.c:149
cvar_t cl_leanmodel
Definition view.c:58
cvar_t cl_bobcycle
Definition view.c:39
static void highpass3(vec3_t value, vec_t fracx, vec_t fracy, vec_t fracz, vec3_t store, vec3_t out)
Definition view.c:427
cvar_t cl_bob_limit_heightcheck
Definition view.c:54
cvar_t v_iyaw_cycle
Definition view.c:88
cvar_t chase_stevie
Definition view.c:135
cvar_t v_idlescale
Definition view.c:95
cvar_t cl_bobfallminspeed
Definition view.c:46
cvar_t cl_leanmodel_up_highpass1
Definition view.c:66
cvar_t cl_leanmodel_up_lowpass
Definition view.c:68
cvar_t cl_bobfall
Definition view.c:44
cvar_t cl_followmodel_up_highpass1
Definition view.c:78
cvar_t cl_bobup
Definition view.c:40
cvar_t cl_bob2smooth
Definition view.c:43
cvar_t cl_leanmodel_side_limit
Definition view.c:60
cvar_t cl_leanmodel_up_limit
Definition view.c:65
cvar_t v_ipitch_cycle
Definition view.c:90
cvar_t v_deathtiltangle
Definition view.c:138
cvar_t cl_rollangle
Definition view.c:36
cvar_t cl_followmodel_up_lowpass
Definition view.c:80
cvar_t v_ipitch_level
Definition view.c:93
static void V_CalcIntermissionRefdef(vec3_t vieworg, vec3_t viewangles, const matrix4x4_t *entrendermatrix, float clstatsviewheight)
Definition view.c:487
cvar_t v_deathtilt
Definition view.c:137
cvar_t v_iyaw_level
Definition view.c:91
static void lowpass3(vec3_t value, vec_t fracx, vec_t fracy, vec_t fracz, vec3_t store, vec3_t out)
Definition view.c:420
cvar_t cl_bobfallcycle
Definition view.c:45
cvar_t v_iroll_level
Definition view.c:92
cvar_t v_iroll_cycle
Definition view.c:89
cvar_t cl_leanmodel_side_highpass1
Definition view.c:61
cvar_t chase_back
Definition view.c:130
cvar_t chase_active
Definition view.c:132
cvar_t cl_leanmodel_side_speed
Definition view.c:59
cvar_t cl_followmodel_side_speed
Definition view.c:71
cvar_t cl_bob2
Definition view.c:41
cvar_t cl_followmodel_side_lowpass
Definition view.c:75
cvar_t chase_pitchangle
Definition view.c:141
cvar_t cl_bobmodel_up
Definition view.c:49
cvar_t cl_bob_limit
Definition view.c:53
cvar_t cl_bob
Definition view.c:38
cvar_t cl_stairsmoothspeed
Definition view.c:126
cvar_t cl_bobmodel
Definition view.c:47
cvar_t chase_overhead
Definition view.c:133
cvar_t cl_bobmodel_classic
Definition view.c:51
cvar_t cl_rollspeed
Definition view.c:35
cvar_t cl_followmodel_side_limit
Definition view.c:72
cvar_t cl_leanmodel_side_lowpass
Definition view.c:63
cvar_t cl_smoothviewheight
Definition view.c:128
float v_dmg_pitch
Definition view.c:147
cvar_t cl_leanmodel_side_highpass
Definition view.c:62
cvar_t r_viewmodel_quake
Definition view.c:145
cvar_t v_kicktime
Definition view.c:84
float v_dmg_roll
Definition view.c:147
cvar_t cl_followmodel_side_highpass1
Definition view.c:73
cvar_t cl_followmodel_up_highpass
Definition view.c:79
cvar_t cl_bobmodel_side
Definition view.c:48
cvar_t cl_followmodel_up_limit
Definition view.c:77
cvar_t chase_up
Definition view.c:131
cvar_t cl_followmodel_side_highpass
Definition view.c:74
#define MOVE_NOMONSTERS
Definition world.h:29

References AngleVectors(), client_state_t::bob2_smooth, client_state_t::bobfall_speed, client_state_t::bobfall_swing, bound, client_state_t::calcrefdef_prevtime, chase_active, chase_back, chase_overhead, chase_pitchangle, chase_stevie, chase_up, cl, cl_bob, cl_bob2, cl_bob2cycle, cl_bob2smooth, cl_bob_limit, cl_bob_limit_heightcheck, cl_bob_limit_heightcheck_dontcrosswatersurface, cl_bob_velocity_limit, cl_bobcycle, cl_bobfall, cl_bobfallcycle, cl_bobfallminspeed, cl_bobmodel, cl_bobmodel_classic, cl_bobmodel_side, cl_bobmodel_speed, cl_bobmodel_up, cl_bobup, cl_followmodel, cl_followmodel_side_highpass, cl_followmodel_side_highpass1, cl_followmodel_side_limit, cl_followmodel_side_lowpass, cl_followmodel_side_speed, cl_followmodel_up_highpass, cl_followmodel_up_highpass1, cl_followmodel_up_limit, cl_followmodel_up_lowpass, cl_followmodel_up_speed, cl_leanmodel, cl_leanmodel_side_highpass, cl_leanmodel_side_highpass1, cl_leanmodel_side_limit, cl_leanmodel_side_lowpass, cl_leanmodel_side_speed, cl_leanmodel_up_highpass, cl_leanmodel_up_highpass1, cl_leanmodel_up_limit, cl_leanmodel_up_lowpass, cl_leanmodel_up_speed, cl_punchangle_applied, cl_rollangle, cl_rollspeed, cl_smoothviewheight, cl_stairsmoothspeed, CL_TraceLine(), cl_viewmodel_scale, collision_extendmovelength, Com_CalcRoll(), cos(), client_state_t::csqc_viewanglesfromengine, client_state_t::csqc_viewmodelmatrixfromengine, client_state_t::csqc_vieworiginfromengine, DotProduct, trace_t::endpos, floor(), forward, trace_t::fraction, frametime, GAME_GOODVSBAD2, gamemode, client_state_t::gunangles_adjustment_highpass, client_state_t::gunangles_adjustment_lowpass, client_state_t::gunangles_highpass, client_state_t::gunangles_prev, client_state_t::gunorg_adjustment_highpass, client_state_t::gunorg_adjustment_lowpass, client_state_t::gunorg_highpass, client_state_t::gunorg_prev, highpass3(), highpass3_limited(), client_state_t::hitgroundtime, i, identitymatrix, int(), cvar_t::integer, client_state_t::intermission, client_state_t::lastongroundtime, lowpass3(), M_PI, MATERIALFLAGMASK_TRANSLUCENT, r_refdef_view_t::matrix, Matrix4x4_Concat(), Matrix4x4_ConcatScale(), Matrix4x4_Copy(), Matrix4x4_CreateFromQuakeEntity(), Matrix4x4_Invert_Simple(), Matrix4x4_OriginFromMatrix(), Matrix4x4_QuakeToDuke3D(), max, min, MOVE_NOMONSTERS, client_state_t::movecmd, client_state_t::movevars_stepheight, client_state_t::movevars_timescale, plane_t::normal, NULL, offset, client_state_t::oldonground, client_state_t::oldtime, PITCH, trace_t::plane, client_state_t::punchangle, client_state_t::punchvector, client_state_t::qw_weaponkick, r_refdef, r_viewmodel_quake, right, ROLL, scr_viewsize, sin(), sqrt(), client_state_t::stairsmoothtime, client_state_t::stairsmoothz, SUPERCONTENTS_LIQUIDSMASK, SUPERCONTENTS_SKY, SUPERCONTENTS_SOLID, client_state_t::time, usercmd_t::time, up, V_CalcIntermissionRefdef(), v_deathtilt, v_deathtiltangle, v_dmg_pitch, v_dmg_roll, v_dmg_time, v_idlescale, v_ipitch_cycle, v_ipitch_level, v_iroll_cycle, v_iroll_level, v_iyaw_cycle, v_iyaw_level, v_kicktime, v_yshearing, cvar_t::value, VectorAdd, VectorClear, VectorCopy, VectorMA, VectorMAMAM, VectorScale, VectorSet, VectorSubtract, r_refdef_t::view, viewmodelmatrix_nobob, viewmodelmatrix_withbob, and YAW.

Referenced by V_CalcRefdef(), and VM_CL_V_CalcRefdef().

◆ V_CalcViewBlend()

void V_CalcViewBlend ( void )

Definition at line 1043 of file view.c.

1044{
1045 float a2;
1046 int j;
1047 r_refdef.viewblend[0] = 0;
1048 r_refdef.viewblend[1] = 0;
1049 r_refdef.viewblend[2] = 0;
1050 r_refdef.viewblend[3] = 0;
1053 if (cls.state == ca_connected && cls.signon == SIGNONS)
1054 {
1055 // set contents color
1056 int supercontents;
1057 vec3_t vieworigin;
1059 supercontents = CL_PointSuperContents(vieworigin);
1060 if (supercontents & SUPERCONTENTS_LIQUIDSMASK)
1061 {
1062 cl.view_underwater = true;
1063 r_refdef.frustumscale_x *= 1 - (((sin(cl.time * 4.7) + 1) * 0.015) * r_waterwarp.value);
1064 r_refdef.frustumscale_y *= 1 - (((sin(cl.time * 3.0) + 1) * 0.015) * r_waterwarp.value);
1065 if (supercontents & SUPERCONTENTS_LAVA)
1066 {
1070 }
1071 else if (supercontents & SUPERCONTENTS_SLIME)
1072 {
1076 }
1077 else
1078 {
1082 }
1083 cl.cshifts[CSHIFT_CONTENTS].percent = 150 * 0.5;
1084 }
1085 else
1086 {
1087 cl.view_underwater = false;
1092 }
1093
1095 {
1096 if (cl.stats[STAT_ITEMS] & IT_QUAD)
1097 {
1102 }
1103 else if (cl.stats[STAT_ITEMS] & IT_SUIT)
1104 {
1109 }
1110 else if (cl.stats[STAT_ITEMS] & IT_INVISIBILITY)
1111 {
1116 }
1118 {
1123 }
1124 else
1126 }
1127
1132
1133 // LadyHavoc: fixed V_CalcBlend
1134 for (j = 0;j < NUM_CSHIFTS;j++)
1135 {
1136 a2 = bound(0.0f, cl.cshifts[j].percent * (1.0f / 255.0f), 1.0f);
1137 if (a2 > 0)
1138 {
1140 r_refdef.viewblend[3] = (1 - (1 - r_refdef.viewblend[3]) * (1 - a2)); // correct alpha multiply... took a while to find it on the web
1141 }
1142 }
1143 // saturate color (to avoid blending in black)
1144 if (r_refdef.viewblend[3])
1145 {
1146 a2 = 1 / r_refdef.viewblend[3];
1148 }
1149 r_refdef.viewblend[0] = bound(0.0f, r_refdef.viewblend[0], 255.0f);
1150 r_refdef.viewblend[1] = bound(0.0f, r_refdef.viewblend[1], 255.0f);
1151 r_refdef.viewblend[2] = bound(0.0f, r_refdef.viewblend[2], 255.0f);
1153 if (vid.sRGB3D)
1154 {
1158 }
1159 else
1160 {
1161 r_refdef.viewblend[0] *= (1.0f/256.0f);
1162 r_refdef.viewblend[1] *= (1.0f/256.0f);
1163 r_refdef.viewblend[2] *= (1.0f/256.0f);
1164 }
1165
1166 // Samual: Ugly hack, I know. But it's the best we can do since
1167 // there is no way to detect client states from the engine.
1168 if (cl.stats[STAT_HEALTH] <= 0 && cl.stats[STAT_HEALTH] != -666 &&
1169 cl.stats[STAT_HEALTH] != -2342 && cl_deathfade.value > 0)
1170 {
1171 cl.deathfade += cl_deathfade.value * max(0.00001, cl.time - cl.oldtime);
1172 cl.deathfade = bound(0.0f, cl.deathfade, 0.9f);
1173 }
1174 else
1175 cl.deathfade = 0.0f;
1176
1177 if(cl.deathfade > 0)
1178 {
1179 float a;
1180 float deathfadevec[3] = {0.3f, 0.0f, 0.0f};
1182 if(a > 0)
1184 r_refdef.viewblend[3] = a;
1185 }
1186 }
1187}
#define SUPERCONTENTS_LAVA
Definition bspfile.h:199
#define SUPERCONTENTS_SLIME
Definition bspfile.h:198
#define CL_PointSuperContents(point)
cvar_t cl_deathfade
Definition cl_main.c:83
#define CSHIFT_VCSHIFT
Definition client.h:515
#define CSHIFT_CONTENTS
Definition client.h:511
#define CSHIFT_POWERUP
Definition client.h:514
#define NUM_CSHIFTS
Definition client.h:516
@ GAME_TRANSFUSION
Definition com_game.h:35
cvar_t gl_polyblend
Definition gl_backend.c:17
cvar_t r_waterwarp
Definition gl_backend.c:13
#define Image_LinearFloatFromsRGB(c)
Definition image.h:69
#define VectorLerp(v1, lerp, v2, out)
Definition mathlib.h:120
#define VectorMAM(scale1, b1, scale2, b2, out)
Definition mathlib.h:116
#define STAT_ITEMS
FTE, DP.
Definition qstats.h:23
#define IT_SUIT
Definition quakedef.h:59
#define IT_INVISIBILITY
Definition quakedef.h:57
#define IT_INVULNERABILITY
Definition quakedef.h:58
#define IT_QUAD
Definition quakedef.h:60
ret a
float deathfade
Definition client.h:879
qbool view_underwater
Definition client.h:1139
float viewblend[4]
Definition render.h:416
float frustumscale_y
Definition render.h:403
float frustumscale_x
Definition render.h:403
qbool sRGB3D
whether 3D rendering is sRGB corrected (based on sRGBcapable3D)
Definition vid.h:76
viddef_t vid
global video state
Definition vid_shared.c:64
static cshift_t v_cshift
Definition view.c:322

References a, bound, ca_connected, cl, cl_deathfade, CL_PointSuperContents, cls, CSHIFT_CONTENTS, CSHIFT_POWERUP, CSHIFT_VCSHIFT, client_state_t::cshifts, client_state_t::deathfade, cshift_t::destcolor, r_refdef_t::frustumscale_x, r_refdef_t::frustumscale_y, GAME_TRANSFUSION, gamemode, gl_polyblend, Image_LinearFloatFromsRGB, IT_INVISIBILITY, IT_INVULNERABILITY, IT_QUAD, IT_SUIT, r_refdef_view_t::matrix, Matrix4x4_OriginFromMatrix(), max, NUM_CSHIFTS, client_state_t::oldtime, cshift_t::percent, r_refdef, r_waterwarp, client_static_t::signon, SIGNONS, sin(), viddef_t::sRGB3D, STAT_HEALTH, STAT_ITEMS, client_static_t::state, client_state_t::stats, SUPERCONTENTS_LAVA, SUPERCONTENTS_LIQUIDSMASK, SUPERCONTENTS_SLIME, client_state_t::time, v_cshift, cvar_t::value, VectorLerp, VectorMAM, VectorScale, vid, r_refdef_t::view, client_state_t::view_underwater, and r_refdef_t::viewblend.

Referenced by CSQC_RelinkAllEntities().

◆ V_cshift_f()

static void V_cshift_f ( cmd_state_t * cmd)
static

Definition at line 329 of file view.c.

330{
331 v_cshift.destcolor[0] = atof(Cmd_Argv(cmd, 1));
332 v_cshift.destcolor[1] = atof(Cmd_Argv(cmd, 2));
333 v_cshift.destcolor[2] = atof(Cmd_Argv(cmd, 3));
334 v_cshift.percent = atof(Cmd_Argv(cmd, 4));
335}

References cmd(), Cmd_Argv(), cshift_t::destcolor, cshift_t::percent, and v_cshift.

Referenced by V_Init().

◆ V_DriftPitch()

void V_DriftPitch ( void )

Definition at line 189 of file view.c.

190{
191 float delta, move;
192
194 {
195 cl.driftmove = 0;
196 cl.pitchvel = 0;
197 return;
198 }
199
200// don't count small mouse motion
201 if (cl.nodrift)
202 {
204 cl.driftmove = 0;
205 else
207
209 {
211 }
212 return;
213 }
214
215 delta = cl.idealpitch - cl.viewangles[PITCH];
216
217 if (!delta)
218 {
219 cl.pitchvel = 0;
220 return;
221 }
222
223 move = cl.realframetime * cl.pitchvel;
225
226 if (delta > 0)
227 {
228 if (move > delta)
229 {
230 cl.pitchvel = 0;
231 move = delta;
232 }
233 cl.viewangles[PITCH] += move;
234 }
235 else if (delta < 0)
236 {
237 if (move > -delta)
238 {
239 cl.pitchvel = 0;
240 move = -delta;
241 }
242 cl.viewangles[PITCH] -= move;
243 }
244}
cvar_t cl_forwardspeed
Definition cl_input.c:365
float fabs(float f)
qbool noclip_anglehack
Definition sv_ccmds.c:190
float idealpitch
Definition client.h:826
float pitchvel
Definition client.h:827
qbool nodrift
Definition client.h:828
double realframetime
Definition client.h:871
float driftmove
Definition client.h:829
qbool demoplayback
Definition client.h:587
float forwardmove
Definition protocol.h:380
void V_StartPitchDrift(void)
Definition view.c:151
cvar_t v_centerspeed
Definition view.c:124
cvar_t v_centermove
Definition view.c:123

References cl, cl_forwardspeed, cls, client_state_t::cmd, client_static_t::demoplayback, client_state_t::driftmove, fabs(), usercmd_t::forwardmove, client_state_t::idealpitch, noclip_anglehack, client_state_t::nodrift, client_state_t::onground, PITCH, client_state_t::pitchvel, client_state_t::realframetime, v_centermove, v_centerspeed, V_StartPitchDrift(), cvar_t::value, and client_state_t::viewangles.

Referenced by CL_UpdateWorld().

◆ V_FadeViewFlashs()

void V_FadeViewFlashs ( void )

Definition at line 1028 of file view.c.

1029{
1030 // don't flash if time steps backwards
1031 if (cl.time <= cl.oldtime)
1032 return;
1033 // drop the damage value
1035 if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
1037 // drop the bonus value
1039 if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
1041}
#define CSHIFT_DAMAGE
Definition client.h:512

References cshift_t::alphafade, cl, CSHIFT_BONUS, CSHIFT_DAMAGE, client_state_t::cshifts, client_state_t::oldtime, cshift_t::percent, and client_state_t::time.

Referenced by CL_UpdateWorld().

◆ V_Init()

void V_Init ( void )

Definition at line 1196 of file view.c.

1197{
1198 Cmd_AddCommand(CF_CLIENT | CF_CLIENT_FROM_SERVER, "v_cshift", V_cshift_f, "sets tint color of view");
1199 Cmd_AddCommand(CF_CLIENT | CF_CLIENT_FROM_SERVER, "bf", V_BonusFlash_f, "briefly flashes a bright color tint on view (used when items are picked up); optionally takes R G B [A [alphafade]] arguments to specify how the flash looks");
1200 Cmd_AddCommand(CF_CLIENT, "centerview", V_StartPitchDrift_f, "gradually recenter view (stop looking up/down)");
1201
1204
1211
1235
1238
1260
1272
1284
1286
1290
1292
1294
1301
1304
1307}
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
Definition cmd.c:1661
#define CF_CLIENT
cvar/command that only the client can change/execute
Definition cmd.h:48
#define CF_CLIENT_FROM_SERVER
command that the server is allowed to execute on the client
Definition cmd.h:50
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
Definition cvar.c:599
void V_StartPitchDrift_f(cmd_state_t *cmd)
Definition view.c:164
cvar_t v_isometric_xx
Definition view.c:99
cvar_t cl_bobmodel_forward
Definition view.c:50
cvar_t crosshair
Definition view.c:121
cvar_t v_isometric_rot_pitch
Definition view.c:111
cvar_t v_isometric_verticalfov
Definition view.c:98
cvar_t v_isometric_flipcullface
Definition view.c:117
cvar_t v_isometric_zz
Definition view.c:107
cvar_t v_kickroll
Definition view.c:85
cvar_t v_isometric_zx
Definition view.c:105
cvar_t v_isometric_usevieworiginculling
Definition view.c:119
cvar_t v_isometric_relx
Definition view.c:114
static void V_BonusFlash_f(cmd_state_t *cmd)
Definition view.c:345
cvar_t v_isometric_yy
Definition view.c:103
cvar_t v_isometric_relz
Definition view.c:116
static void V_cshift_f(cmd_state_t *cmd)
Definition view.c:329
cvar_t v_isometric
Definition view.c:97
cvar_t v_isometric_rely
Definition view.c:115
cvar_t v_isometric_zy
Definition view.c:106
cvar_t v_isometric_rot_roll
Definition view.c:113
cvar_t v_kickpitch
Definition view.c:86
cvar_t v_isometric_tz
Definition view.c:110
cvar_t v_isometric_ty
Definition view.c:109
cvar_t v_isometric_tx
Definition view.c:108
cvar_t v_isometric_yx
Definition view.c:102
cvar_t v_isometric_rot_yaw
Definition view.c:112
cvar_t v_isometric_xy
Definition view.c:100
cvar_t v_isometric_locked_orientation
Definition view.c:118
cvar_t v_isometric_xz
Definition view.c:101
cvar_t v_isometric_yz
Definition view.c:104

References CF_CLIENT, CF_CLIENT_FROM_SERVER, chase_active, chase_back, chase_overhead, chase_pitchangle, chase_stevie, chase_up, cl_bob, cl_bob2, cl_bob2cycle, cl_bob2smooth, cl_bob_limit, cl_bob_limit_heightcheck, cl_bob_limit_heightcheck_dontcrosswatersurface, cl_bob_velocity_limit, cl_bobcycle, cl_bobfall, cl_bobfallcycle, cl_bobfallminspeed, cl_bobmodel, cl_bobmodel_classic, cl_bobmodel_forward, cl_bobmodel_side, cl_bobmodel_speed, cl_bobmodel_up, cl_bobup, cl_followmodel, cl_followmodel_side_highpass, cl_followmodel_side_highpass1, cl_followmodel_side_limit, cl_followmodel_side_lowpass, cl_followmodel_side_speed, cl_followmodel_up_highpass, cl_followmodel_up_highpass1, cl_followmodel_up_limit, cl_followmodel_up_lowpass, cl_followmodel_up_speed, cl_leanmodel, cl_leanmodel_side_highpass, cl_leanmodel_side_highpass1, cl_leanmodel_side_limit, cl_leanmodel_side_lowpass, cl_leanmodel_side_speed, cl_leanmodel_up_highpass, cl_leanmodel_up_highpass1, cl_leanmodel_up_limit, cl_leanmodel_up_lowpass, cl_leanmodel_up_speed, cl_rollangle, cl_rollspeed, cl_smoothviewheight, cl_stairsmoothspeed, cl_viewmodel_scale, Cmd_AddCommand(), crosshair, Cvar_RegisterVariable(), r_viewmodel_quake, V_BonusFlash_f(), v_centermove, v_centerspeed, V_cshift_f(), v_deathtilt, v_deathtiltangle, v_idlescale, v_ipitch_cycle, v_ipitch_level, v_iroll_cycle, v_iroll_level, v_isometric, v_isometric_flipcullface, v_isometric_locked_orientation, v_isometric_relx, v_isometric_rely, v_isometric_relz, v_isometric_rot_pitch, v_isometric_rot_roll, v_isometric_rot_yaw, v_isometric_tx, v_isometric_ty, v_isometric_tz, v_isometric_usevieworiginculling, v_isometric_verticalfov, v_isometric_xx, v_isometric_xy, v_isometric_xz, v_isometric_yx, v_isometric_yy, v_isometric_yz, v_isometric_zx, v_isometric_zy, v_isometric_zz, v_iyaw_cycle, v_iyaw_level, v_kickpitch, v_kickroll, v_kicktime, V_StartPitchDrift_f(), and v_yshearing.

Referenced by CL_Init().

◆ V_MakeViewIsometric()

void V_MakeViewIsometric ( void )

Definition at line 968 of file view.c.

969{
970 // when using isometric view to play normal games we have to rotate the camera to make the Ortho matrix do the right thing (forward as up the screen, etc)
971 matrix4x4_t relative;
972 matrix4x4_t modifiedview;
973 matrix4x4_t modify;
974 vec3_t forward, left, up, org;
975 float t[16];
976
983 r_refdef.view.ortho_x = r_refdef.view.frustum_x; // used by VM_CL_R_SetView
984 r_refdef.view.ortho_y = r_refdef.view.frustum_y; // used by VM_CL_R_SetView
985
986 t[0] = v_isometric_xx.value;
987 t[1] = v_isometric_xy.value;
988 t[2] = v_isometric_xz.value;
989 t[3] = 0.0f;
990 t[4] = v_isometric_yx.value;
991 t[5] = v_isometric_yy.value;
992 t[6] = v_isometric_yz.value;
993 t[7] = 0.0f;
994 t[8] = v_isometric_zx.value;
995 t[9] = v_isometric_zy.value;
996 t[10] = v_isometric_zz.value;
997 t[11] = 0.0f;
998 t[12] = 0.0f;
999 t[13] = 0.0f;
1000 t[14] = 0.0f;
1001 t[15] = 1.0f;
1002 Matrix4x4_FromArrayFloatGL(&modify, t);
1003
1004 // if the orientation is locked, extract the origin and create just a translate matrix to start with
1006 {
1007 vec3_t vx, vy, vz, origin;
1010 }
1011
1012 Matrix4x4_Concat(&modifiedview, &r_refdef.view.matrix, &modify);
1014 Matrix4x4_Concat(&r_refdef.view.matrix, &modifiedview, &relative);
1018
1020 {
1024 }
1025}
cvar_t vid_pixelheight
Definition cl_screen.c:58
vector origin
#define VectorMAMAMAM(scale1, b1, scale2, b2, scale3, b3, scale4, b4, out)
Definition mathlib.h:118
void Matrix4x4_CreateTranslate(matrix4x4_t *out, double x, double y, double z)
Definition matrixlib.c:584
void Matrix4x4_FromArrayFloatGL(matrix4x4_t *out, const float in[16])
Definition matrixlib.c:1204
void Matrix4x4_FromVectors(matrix4x4_t *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
Definition matrixlib.c:970
void Matrix4x4_ToVectors(const matrix4x4_t *in, float vx[3], float vy[3], float vz[3], float t[3])
Definition matrixlib.c:939
cvar_t r_trippy
Definition model_brush.c:29
precision highp float
Definition shader_glsl.h:53
vec_t viewzoom
Definition client.h:794
float frustum_y
Definition render.h:277
int cullface_back
Definition render.h:318
float frustum_x
Definition render.h:277
int useperspective
if turned off it renders an ortho view
Definition render.h:280
float ortho_x
Definition render.h:287
int cullface_front
Definition render.h:317
float ortho_y
Definition render.h:287
int usevieworiginculling
allows visibility culling based on the view origin (e.g.
Definition render.h:286

References a, cl, r_refdef_view_t::cullface_back, r_refdef_view_t::cullface_front, float, forward, r_refdef_view_t::frustum_x, r_refdef_view_t::frustum_y, r_refdef_t::frustumscale_x, r_refdef_t::frustumscale_y, r_refdef_view_t::height, cvar_t::integer, r_refdef_view_t::matrix, Matrix4x4_Concat(), Matrix4x4_CreateFromQuakeEntity(), Matrix4x4_CreateTranslate(), Matrix4x4_FromArrayFloatGL(), Matrix4x4_FromVectors(), Matrix4x4_ToVectors(), origin, r_refdef_view_t::ortho_x, r_refdef_view_t::ortho_y, r_refdef, r_trippy, up, r_refdef_view_t::useperspective, r_refdef_view_t::usevieworiginculling, v_isometric_flipcullface, v_isometric_locked_orientation, v_isometric_relx, v_isometric_rely, v_isometric_relz, v_isometric_rot_pitch, v_isometric_rot_roll, v_isometric_rot_yaw, v_isometric_tx, v_isometric_ty, v_isometric_tz, v_isometric_usevieworiginculling, v_isometric_verticalfov, v_isometric_xx, v_isometric_xy, v_isometric_xz, v_isometric_yx, v_isometric_yy, v_isometric_yz, v_isometric_zx, v_isometric_zy, v_isometric_zz, cvar_t::value, VectorMAMAMAM, vid_pixelheight, r_refdef_t::view, client_state_t::viewzoom, and r_refdef_view_t::width.

Referenced by R_RenderView().

◆ V_ParseDamage()

void V_ParseDamage ( void )

Definition at line 261 of file view.c.

262{
263 int armor, blood;
264 vec3_t from;
265 //vec3_t forward, right;
266 vec3_t localfrom;
267 entity_t *ent;
268 //float side;
269 float count;
270
271 armor = MSG_ReadByte(&cl_message);
272 blood = MSG_ReadByte(&cl_message);
274
275 // Send the Dmg Globals to CSQC
276 CL_VM_UpdateDmgGlobals(blood, armor, from);
277
278 count = blood*0.5 + armor*0.5;
279 if (count < 10)
280 count = 10;
281
282 cl.faceanimtime = cl.time + 0.2; // put sbar face into pain frame
283
288 if (cl.cshifts[CSHIFT_DAMAGE].percent > 150)
290
291 if (armor > blood)
292 {
296 }
297 else if (armor)
298 {
302 }
303 else
304 {
308 }
309
310 // calculate view angle kicks
312 {
313 ent = &cl.entities[cl.viewentity];
314 Matrix4x4_Transform(&ent->render.inversematrix, from, localfrom);
315 VectorNormalize(localfrom);
316 v_dmg_pitch = count * localfrom[0] * v_kickpitch.value;
317 v_dmg_roll = count * localfrom[1] * v_kickroll.value;
319 }
320}
void MSG_ReadVector(sizebuf_t *sb, vec3_t v, protocolversion_t protocol)
Definition com_msg.c:401
#define MSG_ReadByte(sb)
Definition common.h:188
void CL_VM_UpdateDmgGlobals(int dmg_take, int dmg_save, vec3_t dmg_origin)
Definition csprogs.c:222
GLenum GLenum GLsizei count
Definition glquake.h:656
#define VectorNormalize(v)
Definition mathlib.h:104
void Matrix4x4_Transform(const matrix4x4_t *in, const float v[3], float out[3])
Definition matrixlib.c:1657
sizebuf_t cl_message
Definition netconn.c:71
float faceanimtime
Definition client.h:769
matrix4x4_t inversematrix
Definition client.h:334
unsigned char active
Definition protocol.h:459
entity_state_t state_current
Definition client.h:471

References entity_state_t::active, cshift_t::alphafade, cl, cl_message, CL_VM_UpdateDmgGlobals(), cls, count, CSHIFT_DAMAGE, client_state_t::cshifts, cshift_t::destcolor, client_state_t::entities, client_state_t::faceanimtime, entity_render_t::inversematrix, Matrix4x4_Transform(), MSG_ReadByte, MSG_ReadVector(), cshift_t::percent, client_static_t::protocol, entity_t::render, entity_t::state_current, client_state_t::time, v_dmg_pitch, v_dmg_roll, v_dmg_time, v_kickpitch, v_kickroll, v_kicktime, cvar_t::value, VectorNormalize, and client_state_t::viewentity.

Referenced by CL_ParseServerMessage().

◆ V_StartPitchDrift()

void V_StartPitchDrift ( void )

Definition at line 151 of file view.c.

152{
153 if (cl.laststop == cl.time)
154 return; // something else is keeping it from drifting
155
156 if (cl.nodrift || !cl.pitchvel)
157 {
159 cl.nodrift = false;
160 cl.driftmove = 0;
161 }
162}
double laststop
Definition client.h:830

References cl, client_state_t::driftmove, client_state_t::laststop, client_state_t::nodrift, client_state_t::pitchvel, client_state_t::time, v_centerspeed, and cvar_t::value.

Referenced by V_DriftPitch(), and V_StartPitchDrift_f().

◆ V_StartPitchDrift_f()

void V_StartPitchDrift_f ( cmd_state_t * cmd)

Definition at line 164 of file view.c.

165{
167}

References V_StartPitchDrift().

Referenced by IN_MLookUp(), and V_Init().

◆ V_StopPitchDrift()

void V_StopPitchDrift ( void )

Definition at line 169 of file view.c.

170{
171 cl.laststop = cl.time;
172 cl.nodrift = true;
173 cl.pitchvel = 0;
174}

References cl, client_state_t::laststop, client_state_t::nodrift, client_state_t::pitchvel, and client_state_t::time.

Referenced by CL_AdjustAngles(), and CL_Input().

Variable Documentation

◆ chase_active

cvar_t chase_active = {CF_CLIENT | CF_ARCHIVE, "chase_active", "0", "enables chase cam"}

Definition at line 132 of file view.c.

132{CF_CLIENT | CF_ARCHIVE, "chase_active", "0", "enables chase cam"};
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
Definition cmd.h:53

Referenced by CL_Beam_CalculatePositions(), CL_SelectTraceLine(), CL_UpdatePrydonCursor(), R_View_UpdateEntityVisible(), R_Water_ProcessPlanes(), V_CalcRefdefUsing(), and V_Init().

◆ chase_back

cvar_t chase_back = {CF_CLIENT | CF_ARCHIVE, "chase_back", "48", "chase cam distance from the player"}

Definition at line 130 of file view.c.

130{CF_CLIENT | CF_ARCHIVE, "chase_back", "48", "chase cam distance from the player"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ chase_overhead

cvar_t chase_overhead = {CF_CLIENT | CF_ARCHIVE, "chase_overhead", "0", "chase cam looks straight down if this is not zero"}

Definition at line 133 of file view.c.

133{CF_CLIENT | CF_ARCHIVE, "chase_overhead", "0", "chase cam looks straight down if this is not zero"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ chase_pitchangle

cvar_t chase_pitchangle = {CF_CLIENT | CF_ARCHIVE, "chase_pitchangle", "55", "chase cam pitch angle"}

Definition at line 141 of file view.c.

141{CF_CLIENT | CF_ARCHIVE, "chase_pitchangle", "55", "chase cam pitch angle"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ chase_stevie

cvar_t chase_stevie = {CF_CLIENT, "chase_stevie", "0", "(GOODVSBAD2 only) chase cam view from above"}

Definition at line 135 of file view.c.

135{CF_CLIENT, "chase_stevie", "0", "(GOODVSBAD2 only) chase cam view from above"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ chase_up

cvar_t chase_up = {CF_CLIENT | CF_ARCHIVE, "chase_up", "24", "chase cam distance from the player"}

Definition at line 131 of file view.c.

131{CF_CLIENT | CF_ARCHIVE, "chase_up", "24", "chase cam distance from the player"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bob

cvar_t cl_bob = {CF_CLIENT | CF_ARCHIVE, "cl_bob","0.02", "view bobbing amount"}

Definition at line 38 of file view.c.

38{CF_CLIENT | CF_ARCHIVE, "cl_bob","0.02", "view bobbing amount"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bob2

cvar_t cl_bob2 = {CF_CLIENT | CF_ARCHIVE, "cl_bob2","0", "sideways view bobbing amount"}

Definition at line 41 of file view.c.

41{CF_CLIENT | CF_ARCHIVE, "cl_bob2","0", "sideways view bobbing amount"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bob2cycle

cvar_t cl_bob2cycle = {CF_CLIENT | CF_ARCHIVE, "cl_bob2cycle","0.6", "sideways view bobbing speed"}

Definition at line 42 of file view.c.

42{CF_CLIENT | CF_ARCHIVE, "cl_bob2cycle","0.6", "sideways view bobbing speed"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bob2smooth

cvar_t cl_bob2smooth = {CF_CLIENT | CF_ARCHIVE, "cl_bob2smooth","0.05", "how fast the view goes back when you stop touching the ground"}

Definition at line 43 of file view.c.

43{CF_CLIENT | CF_ARCHIVE, "cl_bob2smooth","0.05", "how fast the view goes back when you stop touching the ground"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bob_limit

cvar_t cl_bob_limit = {CF_CLIENT | CF_ARCHIVE, "cl_bob_limit", "7", "limits bobbing to this much distance from view_ofs"}

Definition at line 53 of file view.c.

53{CF_CLIENT | CF_ARCHIVE, "cl_bob_limit", "7", "limits bobbing to this much distance from view_ofs"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bob_limit_heightcheck

cvar_t cl_bob_limit_heightcheck = {CF_CLIENT | CF_ARCHIVE, "cl_bob_limit_heightcheck", "0", "check ceiling and floor height against cl_bob_limit and scale down all view bobbing if could result in camera being in solid"}

Definition at line 54 of file view.c.

54{CF_CLIENT | CF_ARCHIVE, "cl_bob_limit_heightcheck", "0", "check ceiling and floor height against cl_bob_limit and scale down all view bobbing if could result in camera being in solid"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bob_limit_heightcheck_dontcrosswatersurface

cvar_t cl_bob_limit_heightcheck_dontcrosswatersurface = {CF_CLIENT | CF_ARCHIVE, "cl_bob_limit_heightcheck_dontcrosswatersurface", "1", "limit cl_bob_limit to not crossing liquid surfaces also"}

Definition at line 55 of file view.c.

55{CF_CLIENT | CF_ARCHIVE, "cl_bob_limit_heightcheck_dontcrosswatersurface", "1", "limit cl_bob_limit to not crossing liquid surfaces also"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bob_velocity_limit

cvar_t cl_bob_velocity_limit = {CF_CLIENT | CF_ARCHIVE, "cl_bob_velocity_limit", "400", "limits the xyspeed value in the bobbing code"}

Definition at line 56 of file view.c.

56{CF_CLIENT | CF_ARCHIVE, "cl_bob_velocity_limit", "400", "limits the xyspeed value in the bobbing code"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bobcycle

cvar_t cl_bobcycle = {CF_CLIENT | CF_ARCHIVE, "cl_bobcycle","0.6", "view bobbing speed"}

Definition at line 39 of file view.c.

39{CF_CLIENT | CF_ARCHIVE, "cl_bobcycle","0.6", "view bobbing speed"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bobfall

cvar_t cl_bobfall = {CF_CLIENT | CF_ARCHIVE, "cl_bobfall","0", "how much the view swings down when falling (influenced by the speed you hit the ground with)"}

Definition at line 44 of file view.c.

44{CF_CLIENT | CF_ARCHIVE, "cl_bobfall","0", "how much the view swings down when falling (influenced by the speed you hit the ground with)"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bobfallcycle

cvar_t cl_bobfallcycle = {CF_CLIENT | CF_ARCHIVE, "cl_bobfallcycle","3", "speed of the bobfall swing"}

Definition at line 45 of file view.c.

45{CF_CLIENT | CF_ARCHIVE, "cl_bobfallcycle","3", "speed of the bobfall swing"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bobfallminspeed

cvar_t cl_bobfallminspeed = {CF_CLIENT | CF_ARCHIVE, "cl_bobfallminspeed","200", "necessary amount of speed for bob-falling to occur"}

Definition at line 46 of file view.c.

46{CF_CLIENT | CF_ARCHIVE, "cl_bobfallminspeed","200", "necessary amount of speed for bob-falling to occur"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bobmodel

cvar_t cl_bobmodel = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel", "1", "enables gun bobbing"}

Definition at line 47 of file view.c.

47{CF_CLIENT | CF_ARCHIVE, "cl_bobmodel", "1", "enables gun bobbing"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bobmodel_classic

cvar_t cl_bobmodel_classic = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_classic", "1", "classic Quake-style forward gun bobbing"}

Definition at line 51 of file view.c.

51{CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_classic", "1", "classic Quake-style forward gun bobbing"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bobmodel_forward

cvar_t cl_bobmodel_forward = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_forward", "0", "gun bobbing forward movement amount"}

Definition at line 50 of file view.c.

50{CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_forward", "0", "gun bobbing forward movement amount"};

Referenced by V_Init().

◆ cl_bobmodel_side

cvar_t cl_bobmodel_side = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_side", "0.15", "gun bobbing sideways sway amount"}

Definition at line 48 of file view.c.

48{CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_side", "0.15", "gun bobbing sideways sway amount"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bobmodel_speed

cvar_t cl_bobmodel_speed = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_speed", "7", "gun bobbing speed"}

Definition at line 52 of file view.c.

52{CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_speed", "7", "gun bobbing speed"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bobmodel_up

cvar_t cl_bobmodel_up = {CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_up", "0.06", "gun bobbing upward movement amount"}

Definition at line 49 of file view.c.

49{CF_CLIENT | CF_ARCHIVE, "cl_bobmodel_up", "0.06", "gun bobbing upward movement amount"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_bobup

cvar_t cl_bobup = {CF_CLIENT | CF_ARCHIVE, "cl_bobup","0.5", "view bobbing adjustment that makes the up or down swing of the bob last longer"}

Definition at line 40 of file view.c.

40{CF_CLIENT | CF_ARCHIVE, "cl_bobup","0.5", "view bobbing adjustment that makes the up or down swing of the bob last longer"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_followmodel

cvar_t cl_followmodel = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel", "0", "enables gun following"}

Definition at line 70 of file view.c.

70{CF_CLIENT | CF_ARCHIVE, "cl_followmodel", "0", "enables gun following"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_followmodel_side_highpass

cvar_t cl_followmodel_side_highpass = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_highpass", "5", "gun following sideways highpass in 1/s"}

Definition at line 74 of file view.c.

74{CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_highpass", "5", "gun following sideways highpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_followmodel_side_highpass1

cvar_t cl_followmodel_side_highpass1 = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_highpass1", "30", "gun following sideways pre-highpass in 1/s"}

Definition at line 73 of file view.c.

73{CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_highpass1", "30", "gun following sideways pre-highpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_followmodel_side_limit

cvar_t cl_followmodel_side_limit = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_limit", "6", "gun following sideways limit"}

Definition at line 72 of file view.c.

72{CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_limit", "6", "gun following sideways limit"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_followmodel_side_lowpass

cvar_t cl_followmodel_side_lowpass = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_lowpass", "10", "gun following sideways lowpass in 1/s"}

Definition at line 75 of file view.c.

75{CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_lowpass", "10", "gun following sideways lowpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_followmodel_side_speed

cvar_t cl_followmodel_side_speed = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_speed", "0.25", "gun following sideways speed"}

Definition at line 71 of file view.c.

71{CF_CLIENT | CF_ARCHIVE, "cl_followmodel_side_speed", "0.25", "gun following sideways speed"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_followmodel_up_highpass

cvar_t cl_followmodel_up_highpass = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_highpass", "2", "gun following upward highpass in 1/s"}

Definition at line 79 of file view.c.

79{CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_highpass", "2", "gun following upward highpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_followmodel_up_highpass1

cvar_t cl_followmodel_up_highpass1 = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_highpass1", "60", "gun following upward pre-highpass in 1/s"}

Definition at line 78 of file view.c.

78{CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_highpass1", "60", "gun following upward pre-highpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_followmodel_up_limit

cvar_t cl_followmodel_up_limit = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_limit", "5", "gun following upward limit"}

Definition at line 77 of file view.c.

77{CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_limit", "5", "gun following upward limit"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_followmodel_up_lowpass

cvar_t cl_followmodel_up_lowpass = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_lowpass", "10", "gun following upward lowpass in 1/s"}

Definition at line 80 of file view.c.

80{CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_lowpass", "10", "gun following upward lowpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_followmodel_up_speed

cvar_t cl_followmodel_up_speed = {CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_speed", "0.5", "gun following upward speed"}

Definition at line 76 of file view.c.

76{CF_CLIENT | CF_ARCHIVE, "cl_followmodel_up_speed", "0.5", "gun following upward speed"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_leanmodel

cvar_t cl_leanmodel = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel", "0", "enables gun leaning"}

Definition at line 58 of file view.c.

58{CF_CLIENT | CF_ARCHIVE, "cl_leanmodel", "0", "enables gun leaning"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_leanmodel_side_highpass

cvar_t cl_leanmodel_side_highpass = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_highpass", "3", "gun leaning sideways highpass in 1/s"}

Definition at line 62 of file view.c.

62{CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_highpass", "3", "gun leaning sideways highpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_leanmodel_side_highpass1

cvar_t cl_leanmodel_side_highpass1 = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_highpass1", "30", "gun leaning sideways pre-highpass in 1/s"}

Definition at line 61 of file view.c.

61{CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_highpass1", "30", "gun leaning sideways pre-highpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_leanmodel_side_limit

cvar_t cl_leanmodel_side_limit = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_limit", "35", "gun leaning sideways limit"}

Definition at line 60 of file view.c.

60{CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_limit", "35", "gun leaning sideways limit"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_leanmodel_side_lowpass

cvar_t cl_leanmodel_side_lowpass = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_lowpass", "20", "gun leaning sideways lowpass in 1/s"}

Definition at line 63 of file view.c.

63{CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_lowpass", "20", "gun leaning sideways lowpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_leanmodel_side_speed

cvar_t cl_leanmodel_side_speed = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_speed", "0.7", "gun leaning sideways speed"}

Definition at line 59 of file view.c.

59{CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_side_speed", "0.7", "gun leaning sideways speed"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_leanmodel_up_highpass

cvar_t cl_leanmodel_up_highpass = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_highpass", "15", "gun leaning upward highpass in 1/s"}

Definition at line 67 of file view.c.

67{CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_highpass", "15", "gun leaning upward highpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_leanmodel_up_highpass1

cvar_t cl_leanmodel_up_highpass1 = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_highpass1", "5", "gun leaning upward pre-highpass in 1/s"}

Definition at line 66 of file view.c.

66{CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_highpass1", "5", "gun leaning upward pre-highpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_leanmodel_up_limit

cvar_t cl_leanmodel_up_limit = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_limit", "50", "gun leaning upward limit"}

Definition at line 65 of file view.c.

65{CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_limit", "50", "gun leaning upward limit"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_leanmodel_up_lowpass

cvar_t cl_leanmodel_up_lowpass = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_lowpass", "20", "gun leaning upward lowpass in 1/s"}

Definition at line 68 of file view.c.

68{CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_lowpass", "20", "gun leaning upward lowpass in 1/s"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_leanmodel_up_speed

cvar_t cl_leanmodel_up_speed = {CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_speed", "0.65", "gun leaning upward speed"}

Definition at line 64 of file view.c.

64{CF_CLIENT | CF_ARCHIVE, "cl_leanmodel_up_speed", "0.65", "gun leaning upward speed"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_punchangle_applied

int cl_punchangle_applied

Definition at line 149 of file view.c.

Referenced by CL_UpdateScreen(), and V_CalcRefdefUsing().

◆ cl_rollangle

cvar_t cl_rollangle = {CF_CLIENT | CF_ARCHIVE, "cl_rollangle", "2.0", "how much to tilt the view when strafing"}

Definition at line 36 of file view.c.

36{CF_CLIENT | CF_ARCHIVE, "cl_rollangle", "2.0", "how much to tilt the view when strafing"};

Referenced by EntityStateQW_ReadPlayerUpdate(), V_CalcRefdefUsing(), and V_Init().

◆ cl_rollspeed

cvar_t cl_rollspeed = {CF_CLIENT | CF_ARCHIVE, "cl_rollspeed", "200", "how much strafing is necessary to tilt the view"}

Definition at line 35 of file view.c.

35{CF_CLIENT | CF_ARCHIVE, "cl_rollspeed", "200", "how much strafing is necessary to tilt the view"};

Referenced by EntityStateQW_ReadPlayerUpdate(), V_CalcRefdefUsing(), and V_Init().

◆ cl_smoothviewheight

cvar_t cl_smoothviewheight = {CF_CLIENT | CF_ARCHIVE, "cl_smoothviewheight", "0", "time of the averaging to the viewheight value so that it creates a smooth transition. higher values = longer transition, 0 for instant transition."}

Definition at line 128 of file view.c.

128{CF_CLIENT | CF_ARCHIVE, "cl_smoothviewheight", "0", "time of the averaging to the viewheight value so that it creates a smooth transition. higher values = longer transition, 0 for instant transition."};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_stairsmoothspeed

cvar_t cl_stairsmoothspeed = {CF_CLIENT | CF_ARCHIVE, "cl_stairsmoothspeed", "160", "how fast your view moves upward/downward when running up/down stairs"}

Definition at line 126 of file view.c.

126{CF_CLIENT | CF_ARCHIVE, "cl_stairsmoothspeed", "160", "how fast your view moves upward/downward when running up/down stairs"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ cl_viewmodel_scale

cvar_t cl_viewmodel_scale = {CF_CLIENT, "cl_viewmodel_scale", "1", "changes size of gun model, lower values prevent poking into walls but cause strange artifacts on lighting and especially r_stereo/vid_stereobuffer options where the size of the gun becomes visible"}

Definition at line 82 of file view.c.

82{CF_CLIENT, "cl_viewmodel_scale", "1", "changes size of gun model, lower values prevent poking into walls but cause strange artifacts on lighting and especially r_stereo/vid_stereobuffer options where the size of the gun becomes visible"};

Referenced by CSQC_R_RecalcView(), SV_GetEntityMatrix(), V_CalcIntermissionRefdef(), V_CalcRefdefUsing(), and V_Init().

◆ crosshair

cvar_t crosshair = {CF_CLIENT | CF_ARCHIVE, "crosshair", "0", "selects crosshair to use (0 is none)"}

Definition at line 121 of file view.c.

121{CF_CLIENT | CF_ARCHIVE, "crosshair", "0", "selects crosshair to use (0 is none)"};

Referenced by M_Menu_Options_AdjustSliders(), M_Options_Draw(), Sbar_Draw(), and V_Init().

◆ r_viewmodel_quake

cvar_t r_viewmodel_quake = {CF_CLIENT | CF_ARCHIVE, "r_viewmodel_quake", "0", "Quake-style weapon viewmodel angle adjustment"}

Definition at line 145 of file view.c.

145{CF_CLIENT | CF_ARCHIVE, "r_viewmodel_quake", "0", "Quake-style weapon viewmodel angle adjustment"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ v_centermove

cvar_t v_centermove = {CF_CLIENT, "v_centermove", "0.15", "how long before the view begins to center itself (if freelook/+mlook/+jlook/+klook are off)"}

Definition at line 123 of file view.c.

123{CF_CLIENT, "v_centermove", "0.15", "how long before the view begins to center itself (if freelook/+mlook/+jlook/+klook are off)"};

Referenced by V_DriftPitch(), and V_Init().

◆ v_centerspeed

cvar_t v_centerspeed = {CF_CLIENT, "v_centerspeed","500", "how fast the view centers itself"}

Definition at line 124 of file view.c.

124{CF_CLIENT, "v_centerspeed","500", "how fast the view centers itself"};

Referenced by V_DriftPitch(), V_Init(), and V_StartPitchDrift().

◆ v_cshift

cshift_t v_cshift
static

Definition at line 322 of file view.c.

Referenced by V_CalcViewBlend(), and V_cshift_f().

◆ v_deathtilt

cvar_t v_deathtilt = {CF_CLIENT, "v_deathtilt", "1", "whether to use sideways view when dead"}

Definition at line 137 of file view.c.

137{CF_CLIENT, "v_deathtilt", "1", "whether to use sideways view when dead"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ v_deathtiltangle

cvar_t v_deathtiltangle = {CF_CLIENT, "v_deathtiltangle", "80", "what roll angle to use when tilting the view while dead"}

Definition at line 138 of file view.c.

138{CF_CLIENT, "v_deathtiltangle", "80", "what roll angle to use when tilting the view while dead"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ v_dmg_pitch

float v_dmg_pitch

Definition at line 147 of file view.c.

Referenced by V_CalcRefdefUsing(), and V_ParseDamage().

◆ v_dmg_roll

float v_dmg_roll

Definition at line 147 of file view.c.

Referenced by V_CalcRefdefUsing(), and V_ParseDamage().

◆ v_dmg_time

float v_dmg_time

Definition at line 147 of file view.c.

Referenced by Sbar_Draw(), V_CalcRefdefUsing(), and V_ParseDamage().

◆ v_idlescale

cvar_t v_idlescale = {CF_CLIENT, "v_idlescale", "0", "how much of the quake 'drunken view' effect to use"}

Definition at line 95 of file view.c.

95{CF_CLIENT, "v_idlescale", "0", "how much of the quake 'drunken view' effect to use"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ v_ipitch_cycle

cvar_t v_ipitch_cycle = {CF_CLIENT, "v_ipitch_cycle", "1", "v_idlescale pitch speed"}

Definition at line 90 of file view.c.

90{CF_CLIENT, "v_ipitch_cycle", "1", "v_idlescale pitch speed"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ v_ipitch_level

cvar_t v_ipitch_level = {CF_CLIENT, "v_ipitch_level", "0.3", "v_idlescale pitch amount"}

Definition at line 93 of file view.c.

93{CF_CLIENT, "v_ipitch_level", "0.3", "v_idlescale pitch amount"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ v_iroll_cycle

cvar_t v_iroll_cycle = {CF_CLIENT, "v_iroll_cycle", "0.5", "v_idlescale roll speed"}

Definition at line 89 of file view.c.

89{CF_CLIENT, "v_iroll_cycle", "0.5", "v_idlescale roll speed"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ v_iroll_level

cvar_t v_iroll_level = {CF_CLIENT, "v_iroll_level", "0.1", "v_idlescale roll amount"}

Definition at line 92 of file view.c.

92{CF_CLIENT, "v_iroll_level", "0.1", "v_idlescale roll amount"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ v_isometric

cvar_t v_isometric = {CF_CLIENT, "v_isometric", "0", "changes view to isometric (non-perspective)"}

Definition at line 97 of file view.c.

97{CF_CLIENT, "v_isometric", "0", "changes view to isometric (non-perspective)"};

Referenced by R_RenderView(), and V_Init().

◆ v_isometric_flipcullface

cvar_t v_isometric_flipcullface = {CF_CLIENT, "v_isometric_flipcullface", "0", "flips the backface culling"}

Definition at line 117 of file view.c.

117{CF_CLIENT, "v_isometric_flipcullface", "0", "flips the backface culling"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_locked_orientation

cvar_t v_isometric_locked_orientation = {CF_CLIENT, "v_isometric_locked_orientation", "1", "camera rotation is fixed"}

Definition at line 118 of file view.c.

118{CF_CLIENT, "v_isometric_locked_orientation", "1", "camera rotation is fixed"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_relx

cvar_t v_isometric_relx = {CF_CLIENT, "v_isometric_relx", "0", "camera position*forward"}

Definition at line 114 of file view.c.

114{CF_CLIENT, "v_isometric_relx", "0", "camera position*forward"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_rely

cvar_t v_isometric_rely = {CF_CLIENT, "v_isometric_rely", "0", "camera position*left"}

Definition at line 115 of file view.c.

115{CF_CLIENT, "v_isometric_rely", "0", "camera position*left"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_relz

cvar_t v_isometric_relz = {CF_CLIENT, "v_isometric_relz", "0", "camera position*up"}

Definition at line 116 of file view.c.

116{CF_CLIENT, "v_isometric_relz", "0", "camera position*up"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_rot_pitch

cvar_t v_isometric_rot_pitch = {CF_CLIENT, "v_isometric_rot_pitch", "60", "camera rotation"}

Definition at line 111 of file view.c.

111{CF_CLIENT, "v_isometric_rot_pitch", "60", "camera rotation"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_rot_roll

cvar_t v_isometric_rot_roll = {CF_CLIENT, "v_isometric_rot_roll", "0", "camera rotation"}

Definition at line 113 of file view.c.

113{CF_CLIENT, "v_isometric_rot_roll", "0", "camera rotation"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_rot_yaw

cvar_t v_isometric_rot_yaw = {CF_CLIENT, "v_isometric_rot_yaw", "135", "camera rotation"}

Definition at line 112 of file view.c.

112{CF_CLIENT, "v_isometric_rot_yaw", "135", "camera rotation"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_tx

cvar_t v_isometric_tx = {CF_CLIENT, "v_isometric_tx", "0", "camera position (player-relative)"}

Definition at line 108 of file view.c.

108{CF_CLIENT, "v_isometric_tx", "0", "camera position (player-relative)"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_ty

cvar_t v_isometric_ty = {CF_CLIENT, "v_isometric_ty", "0", "camera position (player-relative)"}

Definition at line 109 of file view.c.

109{CF_CLIENT, "v_isometric_ty", "0", "camera position (player-relative)"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_tz

cvar_t v_isometric_tz = {CF_CLIENT, "v_isometric_tz", "0", "camera position (player-relative)"}

Definition at line 110 of file view.c.

110{CF_CLIENT, "v_isometric_tz", "0", "camera position (player-relative)"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_usevieworiginculling

cvar_t v_isometric_usevieworiginculling = {CF_CLIENT, "v_isometric_usevieworiginculling", "0", "check visibility to the player location (can look pretty weird)"}

Definition at line 119 of file view.c.

119{CF_CLIENT, "v_isometric_usevieworiginculling", "0", "check visibility to the player location (can look pretty weird)"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_verticalfov

cvar_t v_isometric_verticalfov = {CF_CLIENT, "v_isometric_verticalfov", "512", "vertical field of view in game units (horizontal is computed using aspect ratio based on this)"}

Definition at line 98 of file view.c.

98{CF_CLIENT, "v_isometric_verticalfov", "512", "vertical field of view in game units (horizontal is computed using aspect ratio based on this)"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_xx

cvar_t v_isometric_xx = {CF_CLIENT, "v_isometric_xx", "1", "camera matrix"}

Definition at line 99 of file view.c.

99{CF_CLIENT, "v_isometric_xx", "1", "camera matrix"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_xy

cvar_t v_isometric_xy = {CF_CLIENT, "v_isometric_xy", "0", "camera matrix"}

Definition at line 100 of file view.c.

100{CF_CLIENT, "v_isometric_xy", "0", "camera matrix"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_xz

cvar_t v_isometric_xz = {CF_CLIENT, "v_isometric_xz", "0", "camera matrix"}

Definition at line 101 of file view.c.

101{CF_CLIENT, "v_isometric_xz", "0", "camera matrix"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_yx

cvar_t v_isometric_yx = {CF_CLIENT, "v_isometric_yx", "0", "camera matrix"}

Definition at line 102 of file view.c.

102{CF_CLIENT, "v_isometric_yx", "0", "camera matrix"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_yy

cvar_t v_isometric_yy = {CF_CLIENT, "v_isometric_yy", "1", "camera matrix"}

Definition at line 103 of file view.c.

103{CF_CLIENT, "v_isometric_yy", "1", "camera matrix"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_yz

cvar_t v_isometric_yz = {CF_CLIENT, "v_isometric_yz", "0", "camera matrix"}

Definition at line 104 of file view.c.

104{CF_CLIENT, "v_isometric_yz", "0", "camera matrix"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_zx

cvar_t v_isometric_zx = {CF_CLIENT, "v_isometric_zx", "0", "camera matrix"}

Definition at line 105 of file view.c.

105{CF_CLIENT, "v_isometric_zx", "0", "camera matrix"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_zy

cvar_t v_isometric_zy = {CF_CLIENT, "v_isometric_zy", "0", "camera matrix"}

Definition at line 106 of file view.c.

106{CF_CLIENT, "v_isometric_zy", "0", "camera matrix"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_isometric_zz

cvar_t v_isometric_zz = {CF_CLIENT, "v_isometric_zz", "1", "camera matrix"}

Definition at line 107 of file view.c.

107{CF_CLIENT, "v_isometric_zz", "1", "camera matrix"};

Referenced by V_Init(), and V_MakeViewIsometric().

◆ v_iyaw_cycle

cvar_t v_iyaw_cycle = {CF_CLIENT, "v_iyaw_cycle", "2", "v_idlescale yaw speed"}

Definition at line 88 of file view.c.

88{CF_CLIENT, "v_iyaw_cycle", "2", "v_idlescale yaw speed"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ v_iyaw_level

cvar_t v_iyaw_level = {CF_CLIENT, "v_iyaw_level", "0.3", "v_idlescale yaw amount"}

Definition at line 91 of file view.c.

91{CF_CLIENT, "v_iyaw_level", "0.3", "v_idlescale yaw amount"};

Referenced by V_CalcRefdefUsing(), and V_Init().

◆ v_kickpitch

cvar_t v_kickpitch = {CF_CLIENT, "v_kickpitch", "0.6", "how much a view kick from damage pitches your view"}

Definition at line 86 of file view.c.

86{CF_CLIENT, "v_kickpitch", "0.6", "how much a view kick from damage pitches your view"};

Referenced by V_Init(), and V_ParseDamage().

◆ v_kickroll

cvar_t v_kickroll = {CF_CLIENT, "v_kickroll", "0.6", "how much a view kick from damage rolls your view"}

Definition at line 85 of file view.c.

85{CF_CLIENT, "v_kickroll", "0.6", "how much a view kick from damage rolls your view"};

Referenced by V_Init(), and V_ParseDamage().

◆ v_kicktime

cvar_t v_kicktime = {CF_CLIENT, "v_kicktime", "0.5", "how long a view kick from damage lasts"}

Definition at line 84 of file view.c.

84{CF_CLIENT, "v_kicktime", "0.5", "how long a view kick from damage lasts"};

Referenced by Sbar_Draw(), V_CalcRefdefUsing(), V_Init(), and V_ParseDamage().

◆ v_yshearing

cvar_t v_yshearing = {CF_CLIENT, "v_yshearing", "0", "be all out of gum (set this to the maximum angle to allow Y shearing for - try values like 75)"}

Definition at line 143 of file view.c.

143{CF_CLIENT, "v_yshearing", "0", "be all out of gum (set this to the maximum angle to allow Y shearing for - try values like 75)"};

Referenced by CSQC_R_RecalcView(), V_CalcIntermissionRefdef(), V_CalcRefdefUsing(), and V_Init().

◆ viewmodelmatrix_nobob

matrix4x4_t viewmodelmatrix_nobob
extern

◆ viewmodelmatrix_withbob

matrix4x4_t viewmodelmatrix_withbob
extern