]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fixed vortex charge.
authorLyberta <lyberta@lyberta.net>
Mon, 13 Mar 2017 12:30:31 +0000 (15:30 +0300)
committerLyberta <lyberta@lyberta.net>
Mon, 13 Mar 2017 12:30:31 +0000 (15:30 +0300)
qcsrc/client/view.qc
qcsrc/common/mutators/mutator/overkill/okvortex.qc
qcsrc/common/stats.qh
qcsrc/common/wepent.qc
qcsrc/common/wepent.qh
qcsrc/server/client.qc
qcsrc/server/defs.qh

index 7b01b5c67b014fab6c2f98e50bd957a01612c85b..4297bacf4142bd5f3f06f25c68f4e8cc40107233 100644 (file)
@@ -1182,6 +1182,10 @@ void HUD_Crosshair(entity this)
                                vortex_charge = STAT(VORTEX_CHARGE);
                                vortex_chargepool = STAT(VORTEX_CHARGEPOOL);
 
+                               float okvortex_charge, okvortex_chargepool;
+                               okvortex_charge = STAT(OVERKILL_VORTEX_CHARGE);
+                               okvortex_chargepool = STAT(OVERKILL_VORTEX_CHARGEPOOL);
+
                                float arc_heat = STAT(ARC_HEAT);
 
                                if(vortex_charge_movingavg == 0) // this should only happen if we have just loaded up the game
@@ -1190,7 +1194,7 @@ void HUD_Crosshair(entity this)
                                entity wepent = viewmodels[0]; // TODO: unhardcode
 
                                // handle the values
-                               if (autocvar_crosshair_ring && (wepent.activeweapon == WEP_VORTEX || wepent.activeweapon == WEP_OVERKILL_VORTEX) && vortex_charge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
+                               if (autocvar_crosshair_ring && wepent.activeweapon == WEP_VORTEX && vortex_charge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
                                {
                                        if (vortex_chargepool || use_vortex_chargepool) {
                                                use_vortex_chargepool = 1;
@@ -1210,6 +1214,26 @@ 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_VORTEX) && okvortex_charge && autocvar_crosshair_ring_vortex)
+                               {
+                                       if (okvortex_chargepool || use_vortex_chargepool) {
+                                               use_vortex_chargepool = 1;
+                                               ring_inner_value = okvortex_chargepool;
+                                       } else {
+                                               vortex_charge_movingavg = (1 - autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate) * vortex_charge_movingavg + autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate * okvortex_charge;
+                                               ring_inner_value = bound(0, autocvar_crosshair_ring_vortex_currentcharge_scale * (okvortex_charge - vortex_charge_movingavg), 1);
+                                       }
+
+                                       ring_inner_alpha = autocvar_crosshair_ring_vortex_inner_alpha;
+                                       ring_inner_rgb = eX * autocvar_crosshair_ring_vortex_inner_color_red + eY * autocvar_crosshair_ring_vortex_inner_color_green + eZ * autocvar_crosshair_ring_vortex_inner_color_blue;
+                                       ring_inner_image = "gfx/crosshair_ring_inner.tga";
+
+                                       // draw the outer ring to show the current charge of the weapon
+                                       ring_value = okvortex_charge;
+                                       ring_alpha = autocvar_crosshair_ring_vortex_alpha;
+                                       ring_rgb = wcross_color;
+                                       ring_image = "gfx/crosshair_ring_nexgun.tga";
+                               }
                                else if (autocvar_crosshair_ring && wepent.activeweapon == WEP_MINE_LAYER && WEP_CVAR(minelayer, limit) && autocvar_crosshair_ring_minelayer)
                                {
                                        ring_value = bound(0, STAT(LAYED_MINES) / WEP_CVAR(minelayer, limit), 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
index 1053a46312b98c41f0f22661d76cd5d0ce85150a..53a893460716898084d2e0efe763bbbcaa4ad385 100644 (file)
@@ -10,7 +10,7 @@
 METHOD(OverkillVortex, wr_glow, vector(OverkillVortex this, entity actor, entity wepent))
 {
        if (!WEP_CVAR(okvortex, charge)) return '0 0 0';
-       float charge = wepent.vortex_charge;
+       float charge = wepent.okvortex_charge;
        float animlimit = WEP_CVAR(okvortex, charge_animlimit);
        vector g;
        g.x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, charge / animlimit);
@@ -50,7 +50,7 @@ MUTATOR_HOOKFUNCTION(okvortex_charge, GetPressedKeys)
                                xyspeed = min(xyspeed, WEP_CVAR(okvortex, charge_maxspeed));
                        float f = (xyspeed - WEP_CVAR(okvortex, charge_minspeed)) / (WEP_CVAR(okvortex, charge_maxspeed) - WEP_CVAR(okvortex, charge_minspeed));
                        // add the extra charge
-                       player.(weaponentity).vortex_charge = min(1, player.(weaponentity).vortex_charge + WEP_CVAR(okvortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
+                       player.(weaponentity).okvortex_charge = min(1, player.(weaponentity).okvortex_charge + WEP_CVAR(okvortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
                }
        }
 }
@@ -72,8 +72,8 @@ void W_OverkillVortex_Attack(Weapon thiswep, entity actor, .entity weaponentity,
 
        if(WEP_CVAR(okvortex, charge))
        {
-               charge = WEP_CVAR(okvortex, charge_mindmg) / mydmg + (1 - WEP_CVAR(okvortex, charge_mindmg) / mydmg) * actor.(weaponentity).vortex_charge;
-               actor.(weaponentity).vortex_charge *= WEP_CVAR(okvortex, charge_shot_multiplier); // do this AFTER setting mydmg/myforce
+               charge = WEP_CVAR(okvortex, charge_mindmg) / mydmg + (1 - WEP_CVAR(okvortex, charge_mindmg) / mydmg) * actor.(weaponentity).okvortex_charge;
+               actor.(weaponentity).okvortex_charge *= WEP_CVAR(okvortex, charge_shot_multiplier); // do this AFTER setting mydmg/myforce
                // O RLY? -- divVerent
                // YA RLY -- FruitieX
        }
@@ -123,22 +123,22 @@ METHOD(OverkillVortex, wr_aim, void(entity thiswep, entity actor, .entity weapon
 
 METHOD(OverkillVortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
-       if(WEP_CVAR(okvortex, charge) && actor.(weaponentity).vortex_charge < WEP_CVAR(okvortex, charge_limit))
-               actor.(weaponentity).vortex_charge = min(1, actor.(weaponentity).vortex_charge + WEP_CVAR(okvortex, charge_rate) * frametime / W_TICSPERFRAME);
+       if(WEP_CVAR(okvortex, charge) && actor.(weaponentity).okvortex_charge < WEP_CVAR(okvortex, charge_limit))
+               actor.(weaponentity).okvortex_charge = min(1, actor.(weaponentity).okvortex_charge + WEP_CVAR(okvortex, charge_rate) * frametime / W_TICSPERFRAME);
 
        if(weaponslot(weaponentity) == 0)
-               actor.vortex_charge = actor.(weaponentity).vortex_charge;
+               actor.okvortex_charge = actor.(weaponentity).okvortex_charge;
 
        if(WEP_CVAR_SEC(okvortex, chargepool))
-               if(actor.(weaponentity).vortex_chargepool_ammo < 1)
+               if(actor.(weaponentity).okvortex_chargepool_ammo < 1)
                {
                        if(actor.okvortex_chargepool_pauseregen_finished < time)
-                               actor.(weaponentity).vortex_chargepool_ammo = min(1, actor.(weaponentity).vortex_chargepool_ammo + WEP_CVAR_SEC(okvortex, chargepool_regen) * frametime / W_TICSPERFRAME);
+                               actor.(weaponentity).okvortex_chargepool_ammo = min(1, actor.(weaponentity).okvortex_chargepool_ammo + WEP_CVAR_SEC(okvortex, chargepool_regen) * frametime / W_TICSPERFRAME);
                        actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(okvortex, chargepool_pause_regen));
                }
 
        if(weaponslot(weaponentity) == 0)
-               actor.vortex_chargepool_ammo = actor.(weaponentity).vortex_chargepool_ammo;
+               actor.okvortex_chargepool_ammo = actor.(weaponentity).okvortex_chargepool_ammo;
 
        if(autocvar_g_balance_vortex_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(okvortex, ammo), WEP_CVAR_SEC(okvortex, ammo))) { // forced reload
                thiswep.wr_reload(thiswep, actor, weaponentity);
@@ -184,24 +184,24 @@ METHOD(OverkillVortex, wr_think, void(entity thiswep, entity actor, .entity weap
                {
                        if(WEP_CVAR(okvortex, charge))
                        {
-                               actor.(weaponentity).vortex_charge_rottime = time + WEP_CVAR(okvortex, charge_rot_pause);
+                               actor.(weaponentity).okvortex_charge_rottime = time + WEP_CVAR(okvortex, charge_rot_pause);
                                float dt = frametime / W_TICSPERFRAME;
 
-                               if(actor.(weaponentity).vortex_charge < 1)
+                               if(actor.(weaponentity).okvortex_charge < 1)
                                {
                                        if(WEP_CVAR_SEC(okvortex, chargepool))
                                        {
                                                if(WEP_CVAR_SEC(okvortex, ammo))
                                                {
                                                        // always deplete if secondary is held
-                                                       actor.vortex_chargepool_ammo = max(0, actor.vortex_chargepool_ammo - WEP_CVAR_SEC(okvortex, ammo) * dt);
+                                                       actor.okvortex_chargepool_ammo = max(0, actor.okvortex_chargepool_ammo - WEP_CVAR_SEC(okvortex, ammo) * dt);
 
-                                                       dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(okvortex, charge_rate));
+                                                       dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate));
                                                        actor.okvortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(okvortex, chargepool_pause_regen);
-                                                       dt = min(dt, actor.vortex_chargepool_ammo);
+                                                       dt = min(dt, actor.okvortex_chargepool_ammo);
                                                        dt = max(0, dt);
 
-                                                       actor.(weaponentity).vortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
+                                                       actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
                                                }
                                        }
 
@@ -209,7 +209,7 @@ METHOD(OverkillVortex, wr_think, void(entity thiswep, entity actor, .entity weap
                                        {
                                                if(fire & 2) // only eat ammo when the button is pressed
                                                {
-                                                       dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(okvortex, charge_rate));
+                                                       dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate));
                                                        if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                                                        {
                                                                // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
@@ -233,14 +233,14 @@ METHOD(OverkillVortex, wr_think, void(entity thiswep, entity actor, .entity weap
                                                                        }
                                                                }
                                                        }
-                                                       actor.(weaponentity).vortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
+                                                       actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
                                                }
                                        }
 
                                        else
                                        {
-                                               dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(okvortex, charge_rate));
-                                               actor.(weaponentity).vortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
+                                               dt = min(dt, (1 - actor.(weaponentity).okvortex_charge) / WEP_CVAR(okvortex, charge_rate));
+                                               actor.(weaponentity).okvortex_charge += dt * WEP_CVAR(okvortex, charge_rate);
                                        }
                                }
                        }
@@ -283,16 +283,16 @@ METHOD(OverkillVortex, wr_resetplayer, void(entity thiswep, entity actor))
 {
        if (WEP_CVAR(okvortex, charge)) {
                if (WEP_CVAR_SEC(okvortex, chargepool)) {
-                       actor.vortex_chargepool_ammo = 1;
+                       actor.okvortex_chargepool_ammo = 1;
                }
-               actor.vortex_charge = WEP_CVAR(okvortex, charge_start);
+               actor.okvortex_charge = WEP_CVAR(okvortex, charge_start);
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
                        .entity weaponentity = weaponentities[slot];
-                       actor.(weaponentity).vortex_charge = WEP_CVAR(okvortex, charge_start);
+                       actor.(weaponentity).okvortex_charge = WEP_CVAR(okvortex, charge_start);
 
                        if (WEP_CVAR_SEC(okvortex, chargepool))
-                               actor.(weaponentity).vortex_chargepool_ammo = 1;
+                               actor.(weaponentity).okvortex_chargepool_ammo = 1;
                }
        }
        actor.okvortex_lasthit = 0;
index 44efee885ee2912487a68d1708e8cc3ddc623d88..095635dda7846b3dc947d2f34bb1bbe7815edf66 100644 (file)
@@ -78,9 +78,11 @@ REGISTER_STAT(WEAPON_CLIPLOAD, int)
 REGISTER_STAT(WEAPON_CLIPSIZE, int)
 
 REGISTER_STAT(VORTEX_CHARGE, float)
+REGISTER_STAT(OVERKILL_VORTEX_CHARGE, float)
 REGISTER_STAT(LAST_PICKUP, float)
 REGISTER_STAT(HUD, int)
 REGISTER_STAT(VORTEX_CHARGEPOOL, float)
+REGISTER_STAT(OVERKILL_VORTEX_CHARGEPOOL, float)
 REGISTER_STAT(HIT_TIME, float)
 REGISTER_STAT(DAMAGE_DEALT_TOTAL, int)
 REGISTER_STAT(TYPEHIT_TIME, float)
index 8d74a7b3272ffc2da3ef3650fff42a223357cf16..43ca6e77ef03f8c77659d0d02bf20103ea15cab5 100644 (file)
@@ -26,6 +26,10 @@ MACRO_END
        { WriteByte(chan, this.vortex_charge * 16); }, \
        { (viewmodels[this.m_wepent_slot]).vortex_charge = ReadByte() / 16; }) \
     \
+    PROP(false, okvortex_charge, WEPENT_SET_NORMAL, \
+       { WriteByte(chan, this.okvortex_charge * 16); }, \
+       { (viewmodels[this.m_wepent_slot]).okvortex_charge = ReadByte() / 16; }) \
+    \
     PROP(false, m_gunalign, WEPENT_SET_NORMAL, \
        { WriteByte(chan, this.m_gunalign); }, \
        { (viewmodels[this.m_wepent_slot]).m_gunalign = ReadByte(); }) \
index 46180d7c0b4e2c82fe02ee5fb6f6e1e8b8234c0d..25f3993cd2548d19dbea4299d6c8544394d8c40c 100644 (file)
@@ -4,6 +4,7 @@ REGISTER_NET_LINKED(ENT_CLIENT_WEPENT)
 REGISTER_NET_TEMP(CLIENT_WEPENT)
 
 .float vortex_charge;
+.float okvortex_charge;
 .int tuba_instrument;
 
 #ifdef SVQC
index ddbf0fd1c76d089a6b881c10011d344de7b3c3bc..51f0a39530647c4ccf27212ea6fd56faf0de79b5 100644 (file)
@@ -56,6 +56,8 @@
 
 #include "../lib/warpzone/server.qh"
 
+#include <common/mutators/mutator/overkill/okvortex.qh>
+
 STATIC_METHOD(Client, Add, void(Client this, int _team))
 {
     ClientConnect(this);
@@ -1694,6 +1696,8 @@ void SpectateCopy(entity this, entity spectatee)
        this.weapons = spectatee.weapons;
        this.vortex_charge = spectatee.vortex_charge;
        this.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
+       this.okvortex_charge = spectatee.okvortex_charge;
+       this.okvortex_chargepool_ammo = spectatee.okvortex_chargepool_ammo;
        this.hagar_load = spectatee.hagar_load;
        this.arc_heat_percent = spectatee.arc_heat_percent;
        this.minelayer_mines = spectatee.minelayer_mines;
@@ -2512,7 +2516,13 @@ void PlayerPreThink (entity this)
                {
                        .entity weaponentity = weaponentities[slot];
                        if (WEP_CVAR(vortex, charge_rot_rate) && this.(weaponentity).vortex_charge > WEP_CVAR(vortex, charge_limit) && this.(weaponentity).vortex_charge_rottime < time)
+                       {
                                this.(weaponentity).vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.(weaponentity).vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
+                       }
+                       if (WEP_CVAR(okvortex, charge_rot_rate) && this.(weaponentity).okvortex_charge > WEP_CVAR(okvortex, charge_limit) && this.(weaponentity).okvortex_charge_rottime < time)
+                       {
+                               this.(weaponentity).okvortex_charge = bound(WEP_CVAR(okvortex, charge_limit), this.(weaponentity).okvortex_charge - WEP_CVAR(okvortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
+                       }
                }
 
                if (frametime) player_anim(this);
index ccb361ea6908d573a09c173dac06098d0341cefa..533639f46c61c65e3cc30ee469dac7efb74a5411 100644 (file)
@@ -338,6 +338,9 @@ float client_cefc_accumulatortime;
 .float vortex_charge = _STAT(VORTEX_CHARGE);
 .float vortex_charge_rottime;
 .float vortex_chargepool_ammo = _STAT(VORTEX_CHARGEPOOL);
+.float okvortex_charge = _STAT(OVERKILL_VORTEX_CHARGE);
+.float okvortex_charge_rottime;
+.float okvortex_chargepool_ammo = _STAT(OVERKILL_VORTEX_CHARGEPOOL);
 .float hagar_load = _STAT(HAGAR_LOAD);
 
 .int grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab