From: terencehill Date: Tue, 24 Mar 2020 14:58:27 +0000 (+0100) Subject: Add new cvar crosshair_offset: "add an offset to crosshair position to align misalign... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fterencehill%2Fcrosshair;p=xonotic%2Fxonotic-data.pk3dir.git Add new cvar crosshair_offset: "add an offset to crosshair position to align misaligned crosshair images. Warning: it may make the crosshair slightly more blurry. Try \"-0.5 -0.5\" with 1 pixel-wide crosshair images" --- diff --git a/crosshairs.cfg b/crosshairs.cfg index ae3fec080..23da9e1c5 100644 --- a/crosshairs.cfg +++ b/crosshairs.cfg @@ -8,6 +8,7 @@ seta crosshair_enabled 1 // main toggle for enabling/disabling crosshair renderi seta crosshair_color "0.6 0.8 1" seta crosshair_alpha 0.8 seta crosshair_size 0.4 +seta crosshair_offset "0 0" "add an offset to crosshair position to align misaligned crosshair images. Warning: it may make the crosshair slightly more blurry. Try \"-0.5 -0.5\" with 1 pixel-wide crosshair images" // crosshair dot settings seta crosshair_dot 0 diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 6759c8078..32352fd73 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -124,6 +124,7 @@ bool autocvar_crosshair_hittest; bool autocvar_crosshair_hittest_blur; //float autocvar_crosshair_hittest_scale = 1.25; bool autocvar_crosshair_hittest_showimpact; +vector autocvar_crosshair_offset; bool autocvar_crosshair_per_weapon; float autocvar_crosshair_pickup; float autocvar_crosshair_pickup_speed; diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 1b448b8eb..c1c3eb1cf 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1447,6 +1447,8 @@ void HUD_Crosshair(entity this) #define CROSSHAIR_DRAW(sz,wcross_name,wcross_alpha) \ CROSSHAIR_DO_BLUR(CROSSHAIR_DRAW_SINGLE,sz,wcross_name,wcross_alpha) + vector wcross_origin_save = wcross_origin; + wcross_origin += autocvar_crosshair_offset * wcross_scale; if(time < wcross_name_changedonetime && wcross_name != wcross_name_goal_prev_prev && wcross_name_goal_prev_prev) { f = (wcross_name_changedonetime - time) / (wcross_name_changedonetime - wcross_name_changestarttime); @@ -1463,6 +1465,7 @@ void HUD_Crosshair(entity this) wcross_name_alpha_goal_prev = f; CROSSHAIR_DRAW(wcross_resolution, wcross_name, wcross_alpha * f); + wcross_origin = wcross_origin_save; if(autocvar_crosshair_dot) {