DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
view.h File Reference
#include "qtypes.h"
#include "matrixlib.h"
+ Include dependency graph for view.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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)
 
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 (struct cmd_state_s *cmd)
 
void V_StopPitchDrift (void)
 
void V_UpdateBlends (void)
 

Function Documentation

◆ 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}
client_state_t cl
Definition cl_main.c:117
client_static_t cls
Definition cl_main.c:116
@ ca_connected
Definition client.h:532
#define SIGNONS
Definition client.h:525
r_refdef_t r_refdef
Definition gl_rmain.c:57
#define VectorClear(a)
Definition mathlib.h:97
#define VectorCopy(in, out)
Definition mathlib.h:101
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
vec3_t csqc_viewanglesfromengine
Definition client.h:1114
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 csqc_vieworiginfromengine
Definition client.h:1113
vec3_t viewangles
Definition client.h:786
entity_t * entities
Definition client.h:991
matrix4x4_t csqc_viewmodelmatrixfromengine
Definition client.h:1115
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
r_refdef_view_t view
Definition render.h:406
matrix4x4_t matrix
Definition render.h:266
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
matrix4x4_t viewmodelmatrix_withbob
Definition cl_main.c:1056
matrix4x4_t viewmodelmatrix_nobob
Definition cl_main.c:1057

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 bound(min, num, max)
Definition mathlib.h:34
#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_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_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
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
float value
Definition cvar.h:74
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_viewmodel_scale
Definition view.c:82
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_yshearing
Definition view.c:143
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
cshift_t cshifts[NUM_CSHIFTS]
Definition client.h:775
qbool view_underwater
Definition client.h:1139
float percent
Definition client.h:507
float destcolor[3]
Definition client.h:506
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_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_BONUS
Definition client.h:513
#define CSHIFT_DAMAGE
Definition client.h:512
float alphafade
Definition client.h:508

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

◆ 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
protocolversion_t protocol
Definition client.h:617
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 ( struct cmd_state_s * cmd)

◆ 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().

◆ V_UpdateBlends()

void V_UpdateBlends ( void )