]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/View.qc
add a slow rot to 50% nex charge (even when not holding the gun), improve the current...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / View.qc
index 00c395893c596f4d142d0db66d70f4a4241faebf..211bb9e9864586ed08aa23d07621a82aa6331603 100644 (file)
@@ -349,6 +349,9 @@ void CSQC_RAPTOR_HUD();
 vector freeze_pmove_org, freeze_input_angles;
 entity nightvision_noise, nightvision_noise2;
 
+float pickup_crosshair_time, pickup_crosshair_size;
+float nex_charge_movingavg, nex_charge_current_avg;
+
 void CSQC_UpdateView(float w, float h)
 {
        entity e;
@@ -356,6 +359,7 @@ void CSQC_UpdateView(float w, float h)
        float f, i, j;
        vector v, vo;
        vector vf_size, vf_min;
+       float a;
 
        vf_size = R_SetView3fv(VF_SIZE);
        vf_min = R_SetView3fv(VF_MIN);
@@ -567,7 +571,6 @@ void CSQC_UpdateView(float w, float h)
        {
                // apply night vision effect
                vector rgb, tc_00, tc_01, tc_10, tc_11;
-               float a;
 
                if(!nightvision_noise)
                {
@@ -779,9 +782,25 @@ void CSQC_UpdateView(float w, float h)
                                wcross_scale = 1;
                        }
 
+                       if(cvar("crosshair_pickup"))
+                       {
+                               if(pickup_crosshair_time < getstatf(STAT_LAST_PICKUP))
+                               {
+                                       pickup_crosshair_size = 1;
+                                       pickup_crosshair_time = getstatf(STAT_LAST_PICKUP);
+                               }
+
+                               if(pickup_crosshair_size > 0)
+                                       pickup_crosshair_size -= cvar("crosshair_pickup_speed") * frametime;
+                               else
+                                       pickup_crosshair_size = 0;
+
+                               wcross_scale += sin(pickup_crosshair_size) * cvar("crosshair_pickup");
+                       }
+
                        if(shottype == SHOTTYPE_HITENEMY)
                                wcross_scale *= cvar("crosshair_hittest"); // is not queried if hittest is 0
-                       else if(shottype == SHOTTYPE_HITTEAM)
+                       if(shottype == SHOTTYPE_HITTEAM)
                                wcross_scale /= cvar("crosshair_hittest"); // is not queried if hittest is 0
 
                        f = cvar("crosshair_effect_speed");
@@ -851,6 +870,15 @@ 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_movingavg = (1 - cvar("crosshair_nexvelocity_currentcharge_movingavg_rate")) * nex_charge_movingavg + cvar("crosshair_nexvelocity_currentcharge_movingavg_rate") * nex_charge;
+
+                               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_currentcharge_scale") * (nex_charge - nex_charge_movingavg), 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);
                        }
@@ -1083,7 +1111,7 @@ void CSQC_SPIDER_HUD()
 
 void CSQC_RAPTOR_HUD()
 {
-       float rockets, reload, heat, hp, shield, energy;
+       float reload, hp, shield, energy;
        vector picsize, hudloc;
 
     // Fetch health & ammo stats