]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/View.qc
Always ensure pixel accuracy instead of manually setting it
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / View.qc
index d58704803a78808625a1795f8f92ad6137fc0dca..41cec30bf011b78d3c8968f714c3b206523070a3 100644 (file)
@@ -318,13 +318,15 @@ float TrueAimCheck()
                        break;
        }
 
+       vector traceorigin = getplayerorigin(player_localentnum-1) + (eZ * getstati(STAT_VIEWHEIGHT));
+
        vecs = decompressShotOrigin(getstati(STAT_SHOTORG));
 
-       traceline(view_origin, view_origin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
+       traceline(traceorigin, traceorigin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
        trueaimpoint = trace_endpos;
 
-       if(vlen(trueaimpoint - view_origin) < g_trueaim_minrange)
-               trueaimpoint = view_origin + view_forward * g_trueaim_minrange;
+       if(vlen(trueaimpoint - traceorigin) < g_trueaim_minrange)
+               trueaimpoint = traceorigin + view_forward * g_trueaim_minrange;
 
        if(vecs_x > 0)
                vecs_y = -vecs_y;
@@ -332,7 +334,7 @@ float TrueAimCheck()
                vecs = '0 0 0';
 
        dv = view_right * vecs_y + view_up * vecs_z;
-       w_shotorg = view_origin + dv;
+       w_shotorg = traceorigin + dv;
 
        // now move the vecs forward as much as requested if possible
        tracebox(w_shotorg, mi, ma, w_shotorg + view_forward * (vecs_x + nudge), MOVE_NORMAL, ta); // FIXME this MOVE_NORMAL part will misbehave a little in csqc
@@ -570,7 +572,7 @@ void CSQC_UpdateView(float w, float h)
 
                float ov_width = (ov_worldmax_x - ov_worldmin_x);
                float ov_height = (ov_worldmax_y - ov_worldmin_y);
-               float ov_distance = (autocvar_cl_orthoview_resolution * max(ov_width, ov_height));
+               float ov_distance = (max(vid_width, vid_height) * max(ov_width, ov_height));
 
                ov_mid = ((ov_worldmax + ov_worldmin) * 0.5);
                ov_org = vec3(ov_mid_x, ov_mid_y, (ov_mid_z + ov_distance));
@@ -593,23 +595,23 @@ void CSQC_UpdateView(float w, float h)
                if((dist = vlen(vec3(ov_worldmax_x, ov_worldmin_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
                if((dist = vlen(vec3(ov_worldmax_x, ov_worldmax_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
 
-               cvar_set("r_nearclip", ftos(ov_nearest));
-               cvar_set("r_farclip_base", ftos(ov_furthest));
-               cvar_set("r_farclip_world", "0");
-               cvar_set("r_novis", "1");
-               cvar_set("r_useportalculling", "0");
-               cvar_set("r_useinfinitefarclip", "0");
+               cvar_settemp("r_nearclip", ftos(ov_nearest));
+               cvar_settemp("r_farclip_base", ftos(ov_furthest));
+               cvar_settemp("r_farclip_world", "0");
+               cvar_settemp("r_novis", "1");
+               cvar_settemp("r_useportalculling", "0");
+               cvar_settemp("r_useinfinitefarclip", "0");
 
                setproperty(VF_ORIGIN, ov_org);
                setproperty(VF_ANGLES, '90 0 0');
 
                #if 0
-               print(sprintf("OrthoView: org = %s, angles = %s, distance = %f, nearest = %f, furthest = %f\n",
+               printf("OrthoView: org = %s, angles = %s, distance = %f, nearest = %f, furthest = %f\n",
                        vtos(ov_org),
                        vtos(getpropertyvec(VF_ANGLES)),
                        ov_distance,
                        ov_nearest,
-                       ov_furthest));
+                       ov_furthest);
                #endif
        }
 
@@ -1236,7 +1238,7 @@ void CSQC_UpdateView(float w, float h)
                                }
                        }
 
-                       //print(sprintf("crosshair style: %s\n", wcross_style));
+                       //printf("crosshair style: %s\n", wcross_style);
                        wcross_name = strcat("gfx/crosshair", wcross_style);
 
                        // MAIN CROSSHAIR COLOR DECISION