[nexuiz-commits] r7253 - in trunk/data: . qcsrc/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Jul 23 04:08:21 EDT 2009


Author: div0
Date: 2009-07-23 04:08:09 -0400 (Thu, 23 Jul 2009)
New Revision: 7253

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/client/View.qc
Log:
crosshair_hittest_showimpact


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-07-23 06:08:04 UTC (rev 7252)
+++ trunk/data/defaultNexuiz.cfg	2009-07-23 08:08:09 UTC (rev 7253)
@@ -96,6 +96,7 @@
 seta crosshair_per_weapon 0	"when 1, each gun will display a different crosshair"
 seta crosshair_color_override 0	"when 1, crosshair_color_* overrides the per-weapon color"
 seta crosshair_hittest 1 "when not 0, the crosshair is blurred if the shot wouldn't hit the crosshair because of obstructions; also, the crosshair is scaled by the given number when aiming at an enemy"
+seta crosshair_hittest_showimpact 0 "move the crosshair to the actual impact location if obstructed"
 seta crosshair_laser ""	"crosshair to display when wielding the laser"
 seta crosshair_laser_color_red 1	"crosshair color red component to display when wielding the laser"
 seta crosshair_laser_color_green 0.35	"crosshair color green component to display when wielding the laser"

Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc	2009-07-23 06:08:04 UTC (rev 7252)
+++ trunk/data/qcsrc/client/View.qc	2009-07-23 08:08:09 UTC (rev 7253)
@@ -206,6 +206,8 @@
 
 // this function must match W_SetupShot!
 float zoomscript_caught;
+
+vector wcross_origin;
 entity trueaim;
 
 #define SHOTTYPE_HITTEAM 1
@@ -224,6 +226,8 @@
 {
 	float t;
 	tracebox(start, mi, ma, end, MOVE_NORMAL, trueaim);
+	if(cvar("crosshair_hittest_showimpact"))
+		wcross_origin = project_3d_to_2d(trace_endpos);
 	if(trace_networkentity < 1)
 		return SHOTTYPE_HITWORLD;
 	if(trace_networkentity > maxclients)
@@ -557,10 +561,10 @@
 
         // crosshair goes VERY LAST
         if(!scoreboard_active && !ons_showmap && !camera_active) {
-            // TrueAim check
-            float shottype;
+			// TrueAim check
+			float shottype;
 			float bullets, ring_scale;
-
+			wcrosss_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
             if(cvar("crosshair_hittest"))
                 shottype = TrueAimCheck();
             else
@@ -623,8 +627,8 @@
                 if(shottype == SHOTTYPE_HITENEMY || shottype == SHOTTYPE_HITWORLD)
                 {
 					if (bullets)
-						drawpic('0.5 0 0' * (vid_conwidth - wcross_size_x * ring_scale) + '0 0.5 0' * (vid_conheight - wcross_size_y * ring_scale), strcat("gfx/hud/rifle_ring_", ftos(bullets)), wcross_size * ring_scale, wcross_color, wcross_alpha, DRAWFLAG_NORMAL);
-                    drawpic('0.5 0 0' * (vid_conwidth - wcross_size_x) + '0 0.5 0' * (vid_conheight - wcross_size_y), wcross_name, wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL);
+						drawpic(wcross_origin - '0.5 0 0' * (wcross_size_x * ring_scale) - '0 0.5 0' * (wcross_size_y * ring_scale), strcat("gfx/hud/rifle_ring_", ftos(bullets)), wcross_size * ring_scale, wcross_color, wcross_alpha, DRAWFLAG_NORMAL);
+                    drawpic(wcross_origin - '0.5 0 0' * (wcross_size_x) - '0 0.5 0' * ( wcross_size_y), wcross_name, wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL);
                 }
                 else
                 {
@@ -633,8 +637,8 @@
                         for(j = -2; j <= 2; ++j)
 						{
 							if (bullets)
-								drawpic('0.5 0 0' * (vid_conwidth - wcross_size_x * ring_scale + i) + '0 0.5 0' * (vid_conheight - wcross_size_y * ring_scale + j), strcat("gfx/hud/rifle_ring_", ftos(bullets)), wcross_size * ring_scale, wcross_color, wcross_alpha, DRAWFLAG_NORMAL);
-                            drawpic('0.5 0 0' * (vid_conwidth - wcross_size_x + i) + '0 0.5 0' * (vid_conheight - wcross_size_y + j), wcross_name, wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL);
+								drawpic(wcross_origin - '0.5 0 0' * (wcross_size_x * ring_scale + i) - '0 0.5 0' * (wcross_size_y * ring_scale + j), strcat("gfx/hud/rifle_ring_", ftos(bullets)), wcross_size * ring_scale, wcross_color, wcross_alpha, DRAWFLAG_NORMAL);
+                            drawpic(wcross_origin - '0.5 0 0' * (wcross_size_x + i) - '0 0.5 0' * (wcross_size_y + j), wcross_name, wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL);
 						}
                 }
             }



More information about the nexuiz-commits mailing list