]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Crosshair coloring by health, moar Xonotic code
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 28 Feb 2011 22:55:43 +0000 (00:55 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 28 Feb 2011 22:55:43 +0000 (00:55 +0200)
data/defaultVoretournament.cfg
data/qcsrc/client/View.qc

index c40476e3b524ad10bb7fb2ed9aa92cec07a2dea2..e1ff01e532013a997eabaa0a5428f85b3ef5366c 100644 (file)
@@ -109,6 +109,7 @@ _cl_playermodel models/player/vixen.zym
 _cl_playerskin 0\r
 crosshair 1\r
 seta crosshair_pickup 1 "crosshair grows then shrinks back when picking up an item"\r
+seta crosshair_color_by_health 0 "if enabled, crosshair color will depend on current health"\r
 seta crosshair_pickup_speed 4 "speed of the crosshair pickup effect"\r
 seta crosshair_ring_alpha 0.5 "alpha of the crosshair ammo ring"\r
 seta crosshair_ring_size 3 "size of the crosshair ammo ring"\r
index 9a1b97ab6d89b078e5ccbb9006f1801010c34759..4d445a3500c329ea92fe67baeef9a78fb1f5fb19 100644 (file)
@@ -998,6 +998,50 @@ void CSQC_UpdateView(float w, float h)
                                        wcross_color_y = cvar("crosshair_swallowindicator_color_green");\r
                                        wcross_color_z = cvar("crosshair_swallowindicator_color_blue");\r
                                }\r
+                               else if(cvar("crosshair_color_by_health"))\r
+                               {\r
+                                       local float x = getstati(STAT_HEALTH);\r
+                                       \r
+                                       //x = red\r
+                                       //y = green\r
+                                       //z = blue\r
+                                       \r
+                                       wcross_color_z = 0;\r
+                                       \r
+                                       if(x > 200)\r
+                                       {\r
+                                               wcross_color_x = 0;\r
+                                               wcross_color_y = 1;\r
+                                       }\r
+                                       else if(x > 150)\r
+                                       {\r
+                                               wcross_color_x = 0.4 - (x-150)*0.02 * 0.4;\r
+                                               wcross_color_y = 0.9 + (x-150)*0.02 * 0.1;\r
+                                       }\r
+                                       else if(x > 100)\r
+                                       {\r
+                                               wcross_color_x = 1 - (x-100)*0.02 * 0.6;\r
+                                               wcross_color_y = 1 - (x-100)*0.02 * 0.1;\r
+                                               wcross_color_z = 1 - (x-100)*0.02;\r
+                                       }\r
+                                       else if(x > 50)\r
+                                       {\r
+                                               wcross_color_x = 1;\r
+                                               wcross_color_y = 1;\r
+                                               wcross_color_z = 0.2 + (x-50)*0.02 * 0.8;  \r
+                                       }\r
+                                       else if(x > 20)\r
+                                       {\r
+                                               wcross_color_x = 1;\r
+                                               wcross_color_y = (x-20)*90/27/100;\r
+                                               wcross_color_z = (x-20)*90/27/100 * 0.2;\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               wcross_color_x = 1;\r
+                                               wcross_color_y = 0;\r
+                                       }\r
+                               }\r
                                else\r
                                {\r
                                        wcross_color_x = cvar("crosshair_color_red");\r