]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into samual/notification_rewrite
authorSamual Lenks <samual@xonotic.org>
Tue, 5 Feb 2013 17:04:19 +0000 (12:04 -0500)
committerSamual Lenks <samual@xonotic.org>
Tue, 5 Feb 2013 17:04:19 +0000 (12:04 -0500)
defaultXonotic.cfg
qcsrc/client/View.qc
qcsrc/client/autocvars.qh

index df0d3541ca784d499c4481cf41dc527fdcf35dd0..8feb961646c2c226ff945725c3f70435c75f67ab 100644 (file)
@@ -176,6 +176,9 @@ set cl_hitsound_antispam_time 0.05 "don't play the hitsound more often than this
 seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead"
 seta cl_eventchase_distance 140 "final camera distance"
 seta cl_eventchase_speed 1.3 "how fast the camera slides back, 0 is instant"
+seta cl_eventchase_maxs "12 12 8" "max size of eventchase camera bbox"
+seta cl_eventchase_mins "-12 -12 -8" "min size of eventchase camera bbox"
+seta cl_eventchase_viewoffset "0 0 20" "viewoffset of eventchase camera"
 
 //nifreks lockonrestart feature, used in team-based game modes, if set to 1 and all players readied up no other player can then join the game anymore, useful to block spectators from joining
 set teamplay_lockonrestart 0 "it set to 1 in a team-based game, the teams are locked once all players readied up and the game restarted (no new players can join after restart unless using the server-command unlockteams)"
index 29bf68e2594b724d4d20b5b36f105c9fb0616944..71c29147e99c4002697f1c79fb26b7314b77aefe 100644 (file)
@@ -450,12 +450,12 @@ void CSQC_UpdateView(float w, float h)
                if(spectatee_status >= 0 && (autocvar_cl_eventchase_death && getstati(STAT_HEALTH) <= 0 && !intermission) || intermission)
                {
                        // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
-                       vector current_view_origin = getpropertyvec(VF_ORIGIN);
+                       vector current_view_origin = ((csqcplayer ? csqcplayer.origin : pmove_org) + autocvar_cl_eventchase_viewoffset);
 
                        // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).
                        // Ideally, there should be another way to enable third person cameras, such as through setproperty()
-                       if(!autocvar_chase_active)
-                               cvar_set("chase_active", "-1"); // -1 enables chase_active while marking it as set by this code, and not by the user (which would be 1)
+                       // -1 enables chase_active while marking it as set by this code, and not by the user (which would be 1)
+                       if(!autocvar_chase_active) { cvar_set("chase_active", "-1"); }
 
                        // make the camera smooth back
                        if(autocvar_cl_eventchase_speed && eventchase_current_distance < autocvar_cl_eventchase_distance)
@@ -463,17 +463,20 @@ void CSQC_UpdateView(float w, float h)
                        else if(eventchase_current_distance != autocvar_cl_eventchase_distance)
                                eventchase_current_distance = autocvar_cl_eventchase_distance;
 
-                       vector eventchase_target_origin;
                        makevectors(view_angles);
-                       // pass 1, used to check where the camera would go and obtain the trace_fraction
-                       eventchase_target_origin = current_view_origin - v_forward * eventchase_current_distance;
-                       WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);
-                       // pass 2, also multiplying view_forward with trace_fraction, to prevent the camera from going through walls
-                       // The 0.1 subtraction is to not limit the camera precisely at the wall surface, as that allows the view to poke through
-                       eventchase_target_origin = current_view_origin - v_forward * eventchase_current_distance * (trace_fraction - 0.1);
-                       WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);
-
-                       setproperty(VF_ORIGIN, trace_endpos);
+
+                       vector eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
+                       WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, self);
+
+                       // If the boxtrace fails, revert back to line tracing.
+                       if(trace_startsolid)
+                       {
+                               eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
+                               WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);
+                               setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins_z)));
+                       }
+                       else { setproperty(VF_ORIGIN, trace_endpos); }
+
                        setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));
                }
                else if(autocvar_chase_active < 0) // time to disable chase_active if it was set by this code
index 07f2b8f787375bb1669d9fbfce672c85a14944c2..a7f0c29396e89f5fbb80b67ebab08f06397464ab 100644 (file)
@@ -383,6 +383,9 @@ float autocvar_cl_hitsound_antispam_time;
 var float autocvar_cl_eventchase_death = 1;
 var float autocvar_cl_eventchase_distance = 140;
 var float autocvar_cl_eventchase_speed = 1.3;
+var vector autocvar_cl_eventchase_maxs = '12 12 8';
+var vector autocvar_cl_eventchase_mins = '-12 -12 -8';
+var vector autocvar_cl_eventchase_viewoffset = '0 0 20';
 float autocvar_cl_lerpexcess;
 string autocvar__togglezoom;
 float autocvar_cl_damageeffect;