From 525aa9731df8e7a35ac766a91d46e169550b4603 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Fri, 1 Apr 2011 01:38:22 +0300 Subject: [PATCH] Many code comments --- qcsrc/client/View.qc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 4c6ac9172..2571b43d3 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -421,34 +421,35 @@ void CSQC_UpdateView(float w, float h) { if((autocvar_cl_chase_death && getstati(STAT_HEALTH) <= 0 && !intermission) || (autocvar_cl_chase_intermission && intermission)) { - // We must set chase_active in order to get a third person view (1st person weapon model hidden and own player model showing). - // Ideally, there should be another way to enable third person mode, such as an R_SetView() function specifically for this purpose. - + // We must enable chase_active to get a third person view (weapon view model hidden and own player model showing). + // Ideally, there should be another way to enable third person cameras, such as an R_SetView() function. if(!autocvar_chase_active) - cvar_set("chase_active", "-1"); // -1 enables chase_active as well as marking it as set by this code, and not by the user (which would be 1) + cvar_set("chase_active", "-1"); // -1 enables chase_active while marking it as set by this code, not by the user (which would be 1) // make the camera smooth back 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 + chase_current_distance += autocvar_cl_chase_speed * (autocvar_cl_chase_distance - chase_current_distance) * frametime; // slow down the further we get else if(chase_current_distance != autocvar_cl_chase_distance) chase_current_distance = autocvar_cl_chase_distance; if not(intermission > 1) // don't update view origin 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 + // pass 1, used to check where the camera would go and obtain the trace_fraction + chase_target_origin = pmove_org - view_forward * chase_current_distance; - // 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 - 0.1); // pass 2, also multiplying view_forward with trace_fraction, to avoid sticking the camera in solid + // pass 2, also multiplying view_forward with trace_fraction, to prevent the camera 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 + chase_target_origin = pmove_org - view_forward * chase_current_distance * (trace_fraction - 0.1); } R_SetView(VF_ORIGIN, chase_target_origin); } - else if(autocvar_chase_active < 0) + else if(autocvar_chase_active < 0) // time to disable chase_active if it was set by this code { cvar_set("chase_active", "0"); - chase_current_distance = 0; // start from 0 + chase_current_distance = 0; // start from 0 next time } } -- 2.39.2