From: FruitieX Date: Fri, 5 Nov 2010 10:40:31 +0000 (+0200) Subject: some initial code for displaying how fast the nex charges X-Git-Tag: xonotic-v0.1.0preview~183^2~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=76391ac91fb339d2f39c30869b209c3cff11b5b5;p=xonotic%2Fxonotic-data.pk3dir.git some initial code for displaying how fast the nex charges --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index b340e5dde..636d47255 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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 index 000000000..3d1a570b4 Binary files /dev/null and b/gfx/crosshair_ring_inner.tga differ diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 074a3be5e..510384c1d 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -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); }