]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add new cvar crosshair_offset: "add an offset to crosshair position to align misalign... terencehill/crosshair
authorterencehill <piuntn@gmail.com>
Tue, 24 Mar 2020 14:58:27 +0000 (15:58 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 30 Mar 2020 14:41:10 +0000 (16:41 +0200)
crosshairs.cfg
qcsrc/client/autocvars.qh
qcsrc/client/view.qc

index ae3fec0805b9dfbeeccec68a43bc63d8df6c639f..23da9e1c507521d17d4456d9bd9a6c2b253f61c8 100644 (file)
@@ -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
index 6759c80782484fbd786c0e1e6b070231541ea88b..32352fd73577ea35b454463be83b998ea14bb62a 100644 (file)
@@ -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;
index 1b448b8ebb5ba2b00975bc47691a5c599a42d28d..c1c3eb1cf29fa3d720f6fc5e322e26f3415ef9f7 100644 (file)
@@ -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)
                        {