]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an option to change crosshair color randomly on a cvar interval
authorMario <mario.mario@y7mail.com>
Sat, 4 May 2013 20:26:35 +0000 (06:26 +1000)
committerMario <mario.mario@y7mail.com>
Sat, 4 May 2013 20:26:35 +0000 (06:26 +1000)
crosshairs.cfg
qcsrc/client/View.qc
qcsrc/client/autocvars.qh

index 5e071a5874416416844c13623393c3dcd5ffb726..655e90a21b7f43c18e3eecf78dbc875906556bd5 100644 (file)
@@ -40,6 +40,11 @@ seta crosshair_hittest_showimpact 0 "move the crosshair to the actual impact loc
 seta crosshair_color_by_health 0 "if enabled, crosshair color will depend on current health"
 seta crosshair_color_per_weapon 1 "when 1, each gun will display the crosshair with a different color"
 
+// change color randomly on a timer
+seta crosshair_rainbow 0
+seta crosshair_rainbow_delay 0.1
+seta crosshair_rainbow_brightness 2 "color brightness of the random crosshair colors"
+
 
 // ===============================
 //  Per weapon crosshair settings
index 547f90268ec14904bf71cda677bf4dc248fcf367..06ee7d94b3f52b30bda8703614f4ee5b14d4fb94 100644 (file)
@@ -381,6 +381,9 @@ vector damage_blurpostprocess, content_blurpostprocess;
 
 float checkfail[16];
 
+float last_flicker;
+vector previous_color;
+
 #define BUTTON_3 4
 #define BUTTON_4 8
 float cl_notice_run();
@@ -1403,6 +1406,16 @@ void CSQC_UpdateView(float w, float h)
                                        if (ring_value)
                                                DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, ring_image, ring_value, ring_rgb, wcross_alpha * ring_alpha, DRAWFLAG_ADDITIVE);
                                }
+                               
+                               if(autocvar_crosshair_rainbow)
+                               {
+                                       if(time >= last_flicker)
+                                       {
+                                               previous_color = randomvec() * autocvar_crosshair_rainbow_brightness;
+                                               last_flicker = time + autocvar_crosshair_rainbow_delay;
+                                       }
+                                       wcross_color = previous_color;
+                               }
 
 #define CROSSHAIR_DO_BLUR(M,sz,wcross_name,wcross_alpha) \
                                do \
index 6243a00ecf5f64761d47ee94f280a8b691be5c58..f94846b0bc48afcf887f29f4e7905805cc5b6995 100644 (file)
@@ -130,6 +130,9 @@ float autocvar_crosshair_ring_reload;
 float autocvar_crosshair_ring_reload_alpha;
 float autocvar_crosshair_ring_reload_size;
 float autocvar_crosshair_size;
+float autocvar_crosshair_rainbow;
+var float autocvar_crosshair_rainbow_brightness = 2;
+var float autocvar_crosshair_rainbow_delay = 0.1;
 float autocvar_ekg;
 float autocvar_fov;
 float autocvar_g_balance_damagepush_speedfactor;