]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
OK weapons: Ported oknex to new wepent fields.
authorLyberta <lyberta@lyberta.net>
Fri, 16 Feb 2018 08:58:43 +0000 (11:58 +0300)
committerLyberta <lyberta@lyberta.net>
Fri, 16 Feb 2018 08:58:43 +0000 (11:58 +0300)
qcsrc/client/view.qc
qcsrc/common/mutators/mutator/overkill/oknex.qc
qcsrc/common/wepent.qc

index 0bde0788d303b6ec276559a8777cb6bd9be9d540..e0e3a569b6b0de4237854662b444f01194e6a91b 100644 (file)
@@ -1228,14 +1228,14 @@ void HUD_Crosshair(entity this)
                                        ring_rgb = wcross_color;
                                        ring_image = "gfx/crosshair_ring_nexgun.tga";
                                }
-                               else if (autocvar_crosshair_ring && (wepent.activeweapon == WEP_OVERKILL_NEX) && oknex_charge && autocvar_crosshair_ring_vortex)
+                               else if (autocvar_crosshair_ring && (wepent.activeweapon == WEP_OVERKILL_NEX) && oknex_charge_ && autocvar_crosshair_ring_vortex)
                                {
-                                       if (oknex_chargepool || use_vortex_chargepool) {
+                                       if (oknex_chargepool_ || use_vortex_chargepool) {
                                                use_vortex_chargepool = 1;
-                                               ring_inner_value = oknex_chargepool;
+                                               ring_inner_value = oknex_chargepool_;
                                        } else {
-                                               vortex_charge_movingavg = (1 - autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate) * vortex_charge_movingavg + autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate * oknex_charge;
-                                               ring_inner_value = bound(0, autocvar_crosshair_ring_vortex_currentcharge_scale * (oknex_charge - vortex_charge_movingavg), 1);
+                                               vortex_charge_movingavg = (1 - autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate) * vortex_charge_movingavg + autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate * oknex_charge_;
+                                               ring_inner_value = bound(0, autocvar_crosshair_ring_vortex_currentcharge_scale * (oknex_charge_ - vortex_charge_movingavg), 1);
                                        }
 
                                        ring_inner_alpha = autocvar_crosshair_ring_vortex_inner_alpha;
@@ -1243,7 +1243,7 @@ void HUD_Crosshair(entity this)
                                        ring_inner_image = "gfx/crosshair_ring_inner.tga";
 
                                        // draw the outer ring to show the current charge of the weapon
-                                       ring_value = oknex_charge;
+                                       ring_value = oknex_charge_;
                                        ring_alpha = autocvar_crosshair_ring_vortex_alpha;
                                        ring_rgb = wcross_color;
                                        ring_image = "gfx/crosshair_ring_nexgun.tga";
index 31f1052fbed3c8dbf92db51a4135aaa0f0ed69aa..c4326a7b693a32e1702331d45630271513cc1cf9 100644 (file)
@@ -128,11 +128,6 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone
                actor.(weaponentity).oknex_charge = min(1, actor.(weaponentity).oknex_charge + WEP_CVAR(oknex, charge_rate) * frametime / W_TICSPERFRAME);
        }
 
-       if (weaponslot(weaponentity) == 0)
-       {
-               actor.oknex_charge = actor.(weaponentity).oknex_charge;
-       }
-
        if (WEP_CVAR_SEC(oknex, chargepool))
                if (actor.(weaponentity).oknex_chargepool_ammo < 1)
                {
@@ -141,9 +136,6 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone
                        actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(oknex, chargepool_pause_regen));
                }
 
-       if(weaponslot(weaponentity) == 0)
-               actor.oknex_chargepool_ammo = actor.(weaponentity).oknex_chargepool_ammo;
-
        if ((WEP_CVAR_SEC(oknex, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval))
        {
                // Secondary uses it's own refire timer if refire_type is 1.
@@ -343,9 +335,6 @@ METHOD(OverkillNex, wr_resetplayer, void(entity thiswep, entity actor))
                {
                        .entity weaponentity = weaponentities[slot];
                        actor.(weaponentity).oknex_charge = WEP_CVAR(oknex, charge_start);
-
-                       if (WEP_CVAR_SEC(oknex, chargepool))
-                               actor.(weaponentity).oknex_chargepool_ammo = 1;
                }
        }
        actor.oknex_lasthit = 0;
index bd87abdfc01f65fa22ca1aa298e97c542a34e787..07511e0be2699868f87baa042f4839d223fc3fe7 100644 (file)
@@ -61,6 +61,10 @@ MACRO_END
     PROP(false, vortex_chargepool_ammo, WEPENT_SET_NORMAL, \
        { WriteByte(chan, this.vortex_chargepool_ammo * 16); }, \
        { (viewmodels[this.m_wepent_slot]).vortex_chargepool_ammo = ReadByte() / 16; }) \
+    \
+       PROP(false, oknex_chargepool_ammo, WEPENT_SET_NORMAL, \
+       { WriteByte(chan, this.oknex_chargepool_ammo * 16); }, \
+       { (viewmodels[this.m_wepent_slot]).oknex_chargepool_ammo = ReadByte() / 16; }) \
     \
     PROP(false, clip_load, WEPENT_SET_NORMAL, \
        { WriteShort(chan, this.clip_load); }, \