From: Mario Date: Sat, 4 May 2013 20:26:35 +0000 (+1000) Subject: Add an option to change crosshair color randomly on a cvar interval X-Git-Tag: xonotic-v0.7.0~53^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f5685dc712cda2a82063500c6fbe0f6db0c463b9;p=xonotic%2Fxonotic-data.pk3dir.git Add an option to change crosshair color randomly on a cvar interval --- diff --git a/crosshairs.cfg b/crosshairs.cfg index 5e071a587..655e90a21 100644 --- a/crosshairs.cfg +++ b/crosshairs.cfg @@ -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 diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 547f90268..06ee7d94b 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -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 \ diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 6243a00ec..f94846b0b 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -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;