- if(autocvar_cl_chase_speed && chase_current_distance < autocvar_cl_chase_distance)
- chase_current_distance += autocvar_cl_chase_speed * (autocvar_cl_chase_distance - chase_current_distance) * frametime; // slow down smoothly
- else if(chase_current_distance != autocvar_cl_chase_distance)
- chase_current_distance = autocvar_cl_chase_distance;
-
- if not(intermission > 1) // not during the map voting screen
- {
- makevectors(view_angles);
- chase_target_origin = pmove_org - view_forward * chase_current_distance; // pass 1, used to check where the camera would go and obtain the trace_fraction
-
- // don't allow the camera to go through walls
- traceline(pmove_org, chase_target_origin, MOVE_NORMAL, self);
- chase_target_origin = pmove_org - view_forward * chase_current_distance * trace_fraction; // pass 2, also multiplying view_forward with trace_fraction now, to avoid sticking the camera in solid
- }
- else
- {
- // we need to freeze the angles to avoid the mouse moving the camera during the map voting screen, due to VF_ORIGIN being set (not sure why that happens)
- // use the freeze_input_angles below to do this
- input_angles = view_angles = freeze_input_angles;
- R_SetView(VF_ANGLES, view_angles);
- //R_SetView(VF_CL_VIEWANGLES, input_angles);
- }
-
- R_SetView(VF_ORIGIN, chase_target_origin);
+ if(autocvar_cl_eventchase_speed && eventchase_current_distance < autocvar_cl_eventchase_distance)
+ eventchase_current_distance += autocvar_cl_eventchase_speed * (autocvar_cl_eventchase_distance - eventchase_current_distance) * frametime; // slow down the further we get
+ 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 = pmove_org - v_forward * eventchase_current_distance;
+
+ traceline(pmove_org, 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 = pmove_org - v_forward * eventchase_current_distance * (trace_fraction - 0.1);
+
+ R_SetView(VF_ORIGIN, eventchase_target_origin);
+ R_SetView(VF_ANGLES, view_angles);