From 183a81ae4a0a84fb6f6805a1958d6aeba9bfa4f4 Mon Sep 17 00:00:00 2001 From: div0 Date: Thu, 23 Jul 2009 08:08:09 +0000 Subject: [PATCH] crosshair_hittest_showimpact git-svn-id: svn://svn.icculus.org/nexuiz/trunk@7253 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/defaultNexuiz.cfg | 1 + data/qcsrc/client/View.qc | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/data/defaultNexuiz.cfg b/data/defaultNexuiz.cfg index 35a547d83..1e01b804f 100644 --- a/data/defaultNexuiz.cfg +++ b/data/defaultNexuiz.cfg @@ -96,6 +96,7 @@ crosshair 5 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" diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index 5ff7633fd..769f7a748 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -206,6 +206,8 @@ vector GetCurrentFov(float fov) // this function must match W_SetupShot! float zoomscript_caught; + +vector wcross_origin; entity trueaim; #define SHOTTYPE_HITTEAM 1 @@ -224,6 +226,8 @@ float EnemyHitCheck(vector start, vector mi, vector ma, vector end) { 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 @@ void CSQC_UpdateView(float w, float h) // 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 @@ void CSQC_UpdateView(float w, float h) 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 @@ void CSQC_UpdateView(float w, float h) 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); } } } -- 2.39.2