82cvar_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"};
123cvar_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)"};
128cvar_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."};
143cvar_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)"};
153 if (
cl.laststop ==
cl.time)
156 if (
cl.nodrift || !
cl.pitchvel)
171 cl.laststop =
cl.time;
206 cl.driftmove +=
cl.realframetime;
215 delta =
cl.idealpitch -
cl.viewangles[
PITCH];
223 move =
cl.realframetime *
cl.pitchvel;
278 count = blood*0.5 + armor*0.5;
282 cl.faceanimtime =
cl.time + 0.2;
311 if (
cl.entities[
cl.viewentity].state_current.active)
313 ent = &
cl.entities[
cl.viewentity];
370 Con_Printf(
"usage:\nbf, or bf R G B [A [alphafade]]\n");
394static vec3_t eyeboxmins = {-16, -16, -24};
395static vec3_t eyeboxmaxs = { 16, 16, 32};
400 frac =
bound(0, frac, 1);
401 return (*store = *store * (1 - frac) +
value * frac);
496 r_refdef.view.matrix = *entrendermatrix;
514 float vieworg[3], viewangles[3], smoothtime;
515 float gunorg[3], gunangles[3];
517 static float viewheightavg;
525 cl.hitgroundtime =
cl.movecmd[0].time;
526 cl.lastongroundtime =
cl.movecmd[0].time;
528 cl.oldonground = clonground;
529 cl.calcrefdef_prevtime =
max(
cl.calcrefdef_prevtime,
cl.oldtime);
543 smoothtime =
bound(0,
cl.time -
cl.stairsmoothtime, 0.1);
544 cl.stairsmoothtime =
cl.time;
556 cl.stairsmoothz = vieworg[2];
559 if (
cl.stairsmoothz < vieworg[2])
561 else if (
cl.stairsmoothz > vieworg[2])
567 viewangles[
PITCH] +=
cl.qw_weaponkick;
572 viewheightavg = viewheightavg * (1 - viewheight) + clstatsviewheight * viewheight;
573 vieworg[2] += viewheightavg;
578 vec_t camback, camup, dist, campitch,
forward[3], chase_dest[3];
591 viewangles[
PITCH] = 0;
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;
598 trace =
CL_TraceLine(vieworg, chase_dest,
MOVE_NOMONSTERS,
NULL,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_SKY, 0,
MATERIALFLAGMASK_TRANSLUCENT,
collision_extendmovelength.value,
true,
false,
NULL,
false,
true);
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];
609 trace =
CL_TraceLine(vieworg, chase_dest,
MOVE_NOMONSTERS,
NULL,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_SKY, 0,
MATERIALFLAGMASK_TRANSLUCENT,
collision_extendmovelength.value,
true,
false,
NULL,
false,
true);
610 if (bestvieworg[2] > trace.
endpos[2])
611 bestvieworg[2] = trace.
endpos[2];
616 viewangles[
PITCH] = campitch;
623 viewangles[
PITCH] = 90;
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;
633 trace =
CL_TraceLine(vieworg, chase_dest,
MOVE_NOMONSTERS,
NULL,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_SKY, 0,
MATERIALFLAGMASK_TRANSLUCENT,
collision_extendmovelength.value,
true,
false,
NULL,
false,
true);
648 double xyspeed = 0, bob = 0, bobfall = 0;
652 frametime = (
cl.time -
cl.calcrefdef_prevtime) *
cl.movevars_timescale;
672 VectorAdd(
cl.gunangles_highpass,
cl.gunangles_prev,
cl.gunangles_highpass);
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);
699 VectorAdd(viewangles, gunangles, gunangles);
719 float trace1fraction;
720 float trace2fraction;
721 vec3_t bob_height_check_dest;
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;
727 trace =
CL_TraceLine(vieworg, bob_height_check_dest,
MOVE_NOMONSTERS,
NULL,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_SKY | (
cl_bob_limit_heightcheck_dontcrosswatersurface.integer ?
SUPERCONTENTS_LIQUIDSMASK : 0), 0,
MATERIALFLAGMASK_TRANSLUCENT,
collision_extendmovelength.value,
true,
false,
NULL,
false,
true);
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;
733 trace =
CL_TraceLine(vieworg, bob_height_check_dest,
MOVE_NOMONSTERS,
NULL,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_SKY | (
cl_bob_limit_heightcheck_dontcrosswatersurface.integer ?
SUPERCONTENTS_LIQUIDSMASK : 0), 0,
MATERIALFLAGMASK_TRANSLUCENT,
collision_extendmovelength.value,
true,
false,
NULL,
false,
true);
736 bob_limit *=
min(trace1fraction, trace2fraction);
744 cycle -= (
int) cycle;
751 bob = xyspeed *
cl_bob.value;
752 bob = bob*0.3 + bob*0.7*
sin(cycle);
753 bob =
bound(-7, bob, bob_limit);
773 cycle -= (
int) cycle;
775 cycle =
cos(
M_PI * cycle / 0.5);
782 if (clonground && !clcmdjump)
786 if(
cl.bob2_smooth > 0)
802 vieworg[0] += bob2vel[0];
803 vieworg[1] += bob2vel[1];
808 gunorg[0] += bob2vel[0];
809 gunorg[1] += bob2vel[1];
820 cl.bobfall_swing = 1;
822 cl.bobfall_swing = 0;
828 bobfall =
sin(
M_PI *
cl.bobfall_swing) *
cl.bobfall_speed;
829 vieworg[2] += bobfall;
830 gunorg[2] += bobfall;
869 if (
cl.time -
cl.hitgroundtime < 0.2)
872 t =
cl.time -
cl.hitgroundtime;
873 t =
bound(0, t, 0.2);
882 t =
cl.time -
cl.lastongroundtime;
883 t = 0.2 -
bound(0, t, 0.2);
887 bspeed = xyspeed * 0.01f;
896 for (
int i = 0; i < 3; i++)
897 gunorg[i] +=
forward[i]*bob*0.4;
941 cl.calcrefdef_prevtime =
cl.time;
952 ent = &
cl.entities[
cl.viewentity];
977 r_refdef.view.useperspective =
false;
1031 if (
cl.time <=
cl.oldtime)
1062 cl.view_underwater =
true;
1087 cl.view_underwater =
false;
1136 a2 =
bound(0.0f,
cl.cshifts[j].percent * (1.0f / 255.0f), 1.0f);
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);
1172 cl.deathfade =
bound(0.0f,
cl.deathfade, 0.9f);
1175 cl.deathfade = 0.0f;
1177 if(
cl.deathfade > 0)
1180 float deathfadevec[3] = {0.3f, 0.0f, 0.0f};
#define SUPERCONTENTS_SKY
#define SUPERCONTENTS_LAVA
#define SUPERCONTENTS_SLIME
#define SUPERCONTENTS_SOLID
#define SUPERCONTENTS_LIQUIDSMASK
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)
#define CL_PointSuperContents(point)
matrix4x4_t viewmodelmatrix_withbob
matrix4x4_t viewmodelmatrix_nobob
int cl_punchangle_applied
cvar_t v_isometric_verticalfov
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...
static int Cmd_Argc(cmd_state_t *cmd)
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...
#define CF_CLIENT
cvar/command that only the client can change/execute
#define CF_CLIENT_FROM_SERVER
command that the server is allowed to execute on the client
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
cvar_t collision_extendmovelength
void MSG_ReadVector(sizebuf_t *sb, vec3_t v, protocolversion_t protocol)
float Com_CalcRoll(const vec3_t angles, const vec3_t velocity, const vec_t angleval, const vec_t velocityval)
@ PROTOCOL_QUAKEWORLD
quakeworld protocol
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
void CL_VM_UpdateDmgGlobals(int dmg_take, int dmg_save, vec3_t dmg_origin)
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
static int(ZEXPORT *qz_inflate)(z_stream *strm
GLsizei const GLfloat * value
GLenum GLenum GLsizei count
GLuint GLuint GLintptr offset
#define Image_LinearFloatFromsRGB(c)
void AngleVectors(const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
#define VectorLerp(v1, lerp, v2, out)
#define VectorNormalize(v)
#define bound(min, num, max)
#define VectorMAMAM(scale1, b1, scale2, b2, scale3, b3, out)
#define VectorSet(vec, x, y, z)
#define VectorSubtract(a, b, out)
#define VectorCopy(in, out)
#define VectorScale(in, scale, out)
#define VectorMAM(scale1, b1, scale2, b2, out)
#define VectorAdd(a, b, out)
#define VectorMA(a, scale, b, out)
#define VectorMAMAMAM(scale1, b1, scale2, b2, scale3, b3, scale4, b4, out)
void Matrix4x4_AdjustOrigin(matrix4x4_t *out, double x, double y, double z)
void Matrix4x4_Concat(matrix4x4_t *out, const matrix4x4_t *in1, const matrix4x4_t *in2)
void Matrix4x4_Transform(const matrix4x4_t *in, const float v[3], float out[3])
void Matrix4x4_QuakeToDuke3D(const matrix4x4_t *in, matrix4x4_t *out, double maxShearAngle)
void Matrix4x4_CreateTranslate(matrix4x4_t *out, double x, double y, double z)
void Matrix4x4_FromArrayFloatGL(matrix4x4_t *out, const float in[16])
void Matrix4x4_CreateFromQuakeEntity(matrix4x4_t *out, double x, double y, double z, double pitch, double yaw, double roll, double scale)
void Matrix4x4_ConcatScale(matrix4x4_t *out, double x)
void Matrix4x4_CreateScale(matrix4x4_t *out, double x)
void Matrix4x4_Invert_Simple(matrix4x4_t *out, const matrix4x4_t *in1)
void Matrix4x4_FromVectors(matrix4x4_t *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
void Matrix4x4_ToVectors(const matrix4x4_t *in, float vx[3], float vy[3], float vz[3], float t[3])
const matrix4x4_t identitymatrix
void Matrix4x4_Copy(matrix4x4_t *out, const matrix4x4_t *in)
void Matrix4x4_OriginFromMatrix(const matrix4x4_t *in, float *out)
#define MATERIALFLAGMASK_TRANSLUCENT
#define STAT_ITEMS
FTE, DP.
#define STAT_VIEWHEIGHT
FTE, DP.
cvar_t cl_viewmodel_scale
#define IT_INVULNERABILITY
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
matrix4x4_t inversematrix
entity_persistent_t persistent
viddef_t vid
global video state
void V_StartPitchDrift_f(cmd_state_t *cmd)
cvar_t cl_bob_velocity_limit
cvar_t cl_followmodel_up_speed
cvar_t cl_leanmodel_up_highpass
cvar_t cl_leanmodel_up_speed
cvar_t cl_bob_limit_heightcheck_dontcrosswatersurface
static vec_t lowpass_limited(vec_t value, vec_t frac, vec_t limit, vec_t *store)
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)
cvar_t cl_bobmodel_forward
cvar_t v_isometric_rot_pitch
static void highpass3(vec3_t value, vec_t fracx, vec_t fracy, vec_t fracz, vec3_t store, vec3_t out)
cvar_t cl_bob_limit_heightcheck
cvar_t cl_bobfallminspeed
cvar_t cl_leanmodel_up_highpass1
cvar_t cl_leanmodel_up_lowpass
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)
cvar_t v_isometric_flipcullface
cvar_t cl_followmodel_up_highpass1
cvar_t cl_leanmodel_side_limit
void V_StartPitchDrift(void)
cvar_t cl_leanmodel_up_limit
cvar_t v_isometric_usevieworiginculling
cvar_t cl_followmodel_up_lowpass
void V_FadeViewFlashs(void)
static void V_CalcIntermissionRefdef(vec3_t vieworg, vec3_t viewangles, const matrix4x4_t *entrendermatrix, float clstatsviewheight)
static void V_BonusFlash_f(cmd_state_t *cmd)
void V_MakeViewIsometric(void)
static void V_cshift_f(cmd_state_t *cmd)
static void lowpass3(vec3_t value, vec_t fracx, vec_t fracy, vec_t fracz, vec3_t store, vec3_t out)
cvar_t cl_leanmodel_side_highpass1
void V_StopPitchDrift(void)
cvar_t cl_leanmodel_side_speed
cvar_t cl_followmodel_side_speed
cvar_t v_isometric_rot_roll
cvar_t cl_followmodel_side_lowpass
cvar_t cl_stairsmoothspeed
static vec_t highpass_limited(vec_t value, vec_t frac, vec_t limit, vec_t *store)
cvar_t cl_bobmodel_classic
cvar_t cl_followmodel_side_limit
cvar_t cl_leanmodel_side_lowpass
cvar_t cl_smoothviewheight
cvar_t cl_leanmodel_side_highpass
static vec_t highpass(vec_t value, vec_t frac, vec_t *store)
cvar_t v_isometric_rot_yaw
static vec_t lowpass(vec_t value, vec_t frac, vec_t *store)
cvar_t v_isometric_locked_orientation
cvar_t cl_followmodel_side_highpass1
cvar_t cl_followmodel_up_highpass
cvar_t cl_followmodel_up_limit
void V_CalcViewBlend(void)
cvar_t cl_followmodel_side_highpass