From: Lyberta Date: Mon, 13 Mar 2017 12:30:31 +0000 (+0300) Subject: Fixed vortex charge. X-Git-Tag: xonotic-v0.8.5~2119^2~84 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dd6465ad2648cd459a68cba3ac1123be9b0910d9;p=xonotic%2Fxonotic-data.pk3dir.git Fixed vortex charge. --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 7b01b5c67..4297bacf4 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -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. diff --git a/qcsrc/common/mutators/mutator/overkill/okvortex.qc b/qcsrc/common/mutators/mutator/overkill/okvortex.qc index 1053a4631..53a893460 100644 --- a/qcsrc/common/mutators/mutator/overkill/okvortex.qc +++ b/qcsrc/common/mutators/mutator/overkill/okvortex.qc @@ -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; diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 44efee885..095635dda 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -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) diff --git a/qcsrc/common/wepent.qc b/qcsrc/common/wepent.qc index 8d74a7b32..43ca6e77e 100644 --- a/qcsrc/common/wepent.qc +++ b/qcsrc/common/wepent.qc @@ -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(); }) \ diff --git a/qcsrc/common/wepent.qh b/qcsrc/common/wepent.qh index 46180d7c0..25f3993cd 100644 --- a/qcsrc/common/wepent.qh +++ b/qcsrc/common/wepent.qh @@ -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 diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index ddbf0fd1c..51f0a3953 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -56,6 +56,8 @@ #include "../lib/warpzone/server.qh" +#include + 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); diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index ccb361ea6..533639f46 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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