]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Many code comments
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 31 Mar 2011 22:38:22 +0000 (01:38 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 31 Mar 2011 22:38:22 +0000 (01:38 +0300)
qcsrc/client/View.qc

index 4c6ac91729ef32c3b31aba2aecc96a30885f4a39..2571b43d3cab23f0193820961f3edd26113f7194 100644 (file)
@@ -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
                }
        }