]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
some initial code for displaying how fast the nex charges
authorFruitieX <fruitiex@gmail.com>
Fri, 5 Nov 2010 10:40:31 +0000 (12:40 +0200)
committerFruitieX <fruitiex@gmail.com>
Fri, 5 Nov 2010 10:40:31 +0000 (12:40 +0200)
defaultXonotic.cfg
gfx/crosshair_ring_inner.tga [new file with mode: 0644]
qcsrc/client/View.qc

index b340e5ddecb9b2c01c71d120c2dedcd02b48b9e6..636d472556fb46123245c38edc3133c7a73ffa72 100644 (file)
@@ -218,6 +218,12 @@ seta crosshair_fireball_size 1     "crosshair size when wielding the fireball"
 seta crosshair_ring_size 2     "bullet counter ring size for Rifle, velocity ring for Nex"
 seta crosshair_campingrifle_bulletcounter_alpha 0.15
 seta crosshair_nexvelocity_alpha 0.15
+seta crosshair_nexvelocity_scale 30
+seta crosshair_nexvelocity_currentcharge_rate 0.05
+seta crosshair_nexvelocity_currentcharge_alpha 0.15
+seta crosshair_nexvelocity_currentcharge_color_red 0.8
+seta crosshair_nexvelocity_currentcharge_color_green 0
+seta crosshair_nexvelocity_currentcharge_color_blue 0
 seta cl_reticle_stretch 0 "whether to stretch reticles so they fit the screen (brakes image proportions)"
 seta cl_reticle_item_nex 1 "draw aiming recticle for the nex weapon's zoom, 0 disables and values between 0 and 1 change alpha"
 seta cl_reticle_item_normal 1 "draw recticle when zooming with the zoom button, 0 disables and values between 0 and 1 change alpha"
diff --git a/gfx/crosshair_ring_inner.tga b/gfx/crosshair_ring_inner.tga
new file mode 100644 (file)
index 0000000..3d1a570
Binary files /dev/null and b/gfx/crosshair_ring_inner.tga differ
index 074a3be5eec6f8d63eb1e671e48e70ca44189980..510384c1d40541f67137b883dbfbc4809461ada1 100644 (file)
@@ -350,6 +350,7 @@ vector freeze_pmove_org, freeze_input_angles;
 entity nightvision_noise, nightvision_noise2;
 
 float pickup_crosshair_time, pickup_crosshair_size;
+float nex_charge_change, nex_charge_current_avg;
 
 void CSQC_UpdateView(float w, float h)
 {
@@ -869,6 +870,16 @@ void CSQC_UpdateView(float w, float h)
                        }
                        else if (activeweapon == WEP_NEX && nex_charge) // ring around crosshair representing velocity-dependent damage for the nex
                        {
+                               vector rgb;
+                               // indicate how much we're charging right now with an inner circle
+                               a = cvar("crosshair_nexvelocity_currentcharge_alpha");
+                               nex_charge_change = (1 - cvar("crosshair_nexvelocity_currentcharge_rate")) * nex_charge_change + cvar("crosshair_nexvelocity_currentcharge_rate") * nex_charge;
+                               nex_charge_current_avg = cvar("crosshair_nexvelocity_currentcharge_rate") * nex_charge_current_avg + (1 - cvar("crosshair_nexvelocity_currentcharge_rate")) * nex_charge_change;
+
+                               rgb = eX * cvar("crosshair_nexvelocity_currentcharge_color_red") + eY * cvar("crosshair_nexvelocity_currentcharge_color_green") + eZ * cvar("crosshair_nexvelocity_currentcharge_color_blue");
+                               DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring_inner.tga", bound(0, cvar("crosshair_nexvelocity_scale") * (nex_charge - nex_charge_current_avg), 1), rgb, wcross_alpha * a, DRAWFLAG_ADDITIVE);
+
+                               // draw the charge
                                a = cvar("crosshair_nexvelocity_alpha");
                                DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring.tga", nex_charge, wcross_color, wcross_alpha * a, DRAWFLAG_ADDITIVE);
                        }