]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/View.qc
Add an option to change crosshair color randomly on a cvar interval
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / View.qc
index 4f00c55341639fbce6fd13122c29384a1db910b6..06ee7d94b3f52b30bda8703614f4ee5b14d4fb94 100644 (file)
@@ -381,9 +381,13 @@ 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();
+float prev_myteam;
 void CSQC_UpdateView(float w, float h)
 {
        entity e;
@@ -442,6 +446,14 @@ void CSQC_UpdateView(float w, float h)
 #endif
                myteam = GetPlayerColor(player_localentnum - 1);
 
+       if(myteam != prev_myteam)
+       {
+               myteamcolors = colormapPaletteColor(myteam, 1);
+               for(i = 0; i < HUD_PANEL_NUM; ++i)
+                       hud_panel[i].update_time = time;
+               prev_myteam = myteam;
+       }
+
        ticrate = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
 
        float is_dead = (getstati(STAT_HEALTH) <= 0);
@@ -1394,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 \