- if(!WEP_CVAR(vortex, charge_always))
- W_Vortex_Charge(actor, weaponentity, frametime / W_TICSPERFRAME);
-
- if(WEP_CVAR_SEC(vortex, chargepool))
- if(actor.(weaponentity).vortex_chargepool_ammo < 1)
- {
- if(actor.vortex_chargepool_pauseregen_finished < time)
- actor.(weaponentity).vortex_chargepool_ammo = min(1, actor.(weaponentity).vortex_chargepool_ammo + WEP_CVAR_SEC(vortex, chargepool_regen) * frametime / W_TICSPERFRAME);
- actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
- }
-
- if(autocvar_g_balance_vortex_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
- thiswep.wr_reload(thiswep, actor, weaponentity);
- } else
- {
- if(fire & 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire)))
- {
- W_Vortex_Attack(thiswep, actor, weaponentity, 0);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
- }
- }
- if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2))
- {
- if(WEP_CVAR(vortex, charge))
- {
- actor.(weaponentity).vortex_charge_rottime = time + WEP_CVAR(vortex, charge_rot_pause);
- float dt = frametime / W_TICSPERFRAME;
-
- if(actor.(weaponentity).vortex_charge < 1)
- {
- if(WEP_CVAR_SEC(vortex, chargepool))
- {
- if(WEP_CVAR_SEC(vortex, ammo))
- {
- // always deplete if secondary is held
- actor.(weaponentity).vortex_chargepool_ammo = max(0, actor.(weaponentity).vortex_chargepool_ammo - WEP_CVAR_SEC(vortex, ammo) * dt);
-
- dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(vortex, charge_rate));
- actor.vortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(vortex, chargepool_pause_regen);
- dt = min(dt, actor.(weaponentity).vortex_chargepool_ammo);
- dt = max(0, dt);
-
- actor.(weaponentity).vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
- }
- }
-
- else if(WEP_CVAR_SEC(vortex, ammo))
- {
- if(fire & 2) // only eat ammo when the button is pressed
- {
- dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(vortex, charge_rate));
- if(!(actor.items & IT_UNLIMITED_AMMO))
- {
- // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
- if(autocvar_g_balance_vortex_reload_ammo)
- {
- dt = min(dt, (actor.(weaponentity).clip_load - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
- dt = max(0, dt);
- if(dt > 0)
- {
- actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(vortex, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(vortex, ammo) * dt);
- }
- actor.(weaponentity).(weapon_load[thiswep.m_id]) = actor.(weaponentity).clip_load;
- }
- else
- {
- dt = min(dt, (GetResource(actor, thiswep.ammo_type) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
- dt = max(0, dt);
- if(dt > 0)
- {
- SetResource(actor, thiswep.ammo_type, max(WEP_CVAR_SEC(vortex, ammo), GetResource(actor, thiswep.ammo_type) - WEP_CVAR_SEC(vortex, ammo) * dt));
- }
- }
- }
- actor.(weaponentity).vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
- }
- }
-
- else
- {
- dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(vortex, charge_rate));
- actor.(weaponentity).vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
- }
- }
- }
- else if(WEP_CVAR(vortex, secondary))
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire)))
- {
- W_Vortex_Attack(thiswep, actor, weaponentity, 1);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
- }
- }
- }
- }
+ if(!WEP_CVAR(vortex, charge_always))
+ W_Vortex_Charge(actor, weaponentity, frametime / W_TICSPERFRAME);
+
+ if(WEP_CVAR_SEC(vortex, chargepool))
+ if(actor.(weaponentity).vortex_chargepool_ammo < 1)
+ {
+ if(actor.vortex_chargepool_pauseregen_finished < time)
+ actor.(weaponentity).vortex_chargepool_ammo = min(1, actor.(weaponentity).vortex_chargepool_ammo + WEP_CVAR_SEC(vortex, chargepool_regen) * frametime / W_TICSPERFRAME);
+ actor.pauseregen_finished = max(actor.pauseregen_finished, time + WEP_CVAR_SEC(vortex, chargepool_pause_regen));
+ }
+
+ if(autocvar_g_balance_vortex_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else
+ {
+ if(fire & 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire)))
+ {
+ W_Vortex_Attack(thiswep, actor, weaponentity, 0);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
+ }
+ }
+ if((WEP_CVAR(vortex, charge) && !WEP_CVAR(vortex, secondary)) ? (PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) : (fire & 2))
+ {
+ if(WEP_CVAR(vortex, charge))
+ {
+ actor.(weaponentity).vortex_charge_rottime = time + WEP_CVAR(vortex, charge_rot_pause);
+ float dt = frametime / W_TICSPERFRAME;
+
+ if(actor.(weaponentity).vortex_charge < 1)
+ {
+ if(WEP_CVAR_SEC(vortex, chargepool))
+ {
+ if(WEP_CVAR_SEC(vortex, ammo))
+ {
+ // always deplete if secondary is held
+ actor.(weaponentity).vortex_chargepool_ammo = max(0, actor.(weaponentity).vortex_chargepool_ammo - WEP_CVAR_SEC(vortex, ammo) * dt);
+
+ dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(vortex, charge_rate));
+ actor.vortex_chargepool_pauseregen_finished = time + WEP_CVAR_SEC(vortex, chargepool_pause_regen);
+ dt = min(dt, actor.(weaponentity).vortex_chargepool_ammo);
+ dt = max(0, dt);
+
+ actor.(weaponentity).vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+ }
+ }
+
+ else if(WEP_CVAR_SEC(vortex, ammo))
+ {
+ if(fire & 2) // only eat ammo when the button is pressed
+ {
+ dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(vortex, charge_rate));
+ if(!(actor.items & IT_UNLIMITED_AMMO))
+ {
+ // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
+ if(autocvar_g_balance_vortex_reload_ammo)
+ {
+ dt = min(dt, (actor.(weaponentity).clip_load - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+ dt = max(0, dt);
+ if(dt > 0)
+ {
+ actor.(weaponentity).clip_load = max(WEP_CVAR_SEC(vortex, ammo), actor.(weaponentity).clip_load - WEP_CVAR_SEC(vortex, ammo) * dt);
+ }
+ actor.(weaponentity).(weapon_load[thiswep.m_id]) = actor.(weaponentity).clip_load;
+ }
+ else
+ {
+ dt = min(dt, (GetResource(actor, thiswep.ammo_type) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+ dt = max(0, dt);
+ if(dt > 0)
+ {
+ SetResource(actor, thiswep.ammo_type, max(WEP_CVAR_SEC(vortex, ammo), GetResource(actor, thiswep.ammo_type) - WEP_CVAR_SEC(vortex, ammo) * dt));
+ }
+ }
+ }
+ actor.(weaponentity).vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+ }
+ }
+
+ else
+ {
+ dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(vortex, charge_rate));
+ actor.(weaponentity).vortex_charge += dt * WEP_CVAR(vortex, charge_rate);
+ }
+ }
+ }
+ else if(WEP_CVAR(vortex, secondary))
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire)))
+ {
+ W_Vortex_Attack(thiswep, actor, weaponentity, 1);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
+ }
+ }
+ }
+ }