From 2e0ea8a4df1c5170b228f7a4ea425d8c4ef5fa8b Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 16 Oct 2018 00:50:58 +1000 Subject: [PATCH] Use the weapon entity as a parameter to ATTACK_FINISHED instead of the slot number, fixes a potential issue when dual wielding different weapons and reduces code redundancy --- .../gamemodes/gamemode/assault/sv_assault.qh | 3 ++ .../common/mutators/mutator/overkill/okhmg.qc | 3 +- .../mutators/mutator/overkill/okmachinegun.qc | 3 +- qcsrc/common/weapons/weapon/arc.qc | 3 +- qcsrc/common/weapons/weapon/devastator.qc | 8 ++--- qcsrc/common/weapons/weapon/hagar.qc | 3 +- qcsrc/common/weapons/weapon/hlac.qc | 3 +- qcsrc/common/weapons/weapon/machinegun.qc | 9 ++---- qcsrc/common/weapons/weapon/minelayer.qc | 9 ++---- qcsrc/common/weapons/weapon/rifle.qc | 7 ++--- qcsrc/server/bot/default/havocbot/havocbot.qc | 2 +- qcsrc/server/bot/default/scripting.qc | 6 ++-- qcsrc/server/defs.qh | 5 +--- qcsrc/server/weapons/weaponsystem.qc | 29 +++++++++---------- 14 files changed, 39 insertions(+), 54 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh index 95b5b8ccf..fcfc78917 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh +++ b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qh @@ -41,5 +41,8 @@ void(entity bot) havocbot_ast_reset_role; void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_items; void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers; +// assault game mode: Which team is attacking in this round? +float assault_attacker_team; + // predefined spawnfuncs void target_objective_decrease_activate(entity this); diff --git a/qcsrc/common/mutators/mutator/overkill/okhmg.qc b/qcsrc/common/mutators/mutator/overkill/okhmg.qc index 003cd3abc..688928ce1 100644 --- a/qcsrc/common/mutators/mutator/overkill/okhmg.qc +++ b/qcsrc/common/mutators/mutator/overkill/okhmg.qc @@ -51,8 +51,7 @@ void W_OverkillHeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor, weaponentity); } - int slot = weaponslot(weaponentity); - ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(okhmg, refire) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(okhmg, refire) * W_WeaponRateFactor(actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okhmg, refire), W_OverkillHeavyMachineGun_Attack_Auto); } diff --git a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc index 27502a759..aa872f154 100644 --- a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc +++ b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc @@ -45,8 +45,7 @@ void W_OverkillMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weap SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor, weaponentity); } - int slot = weaponslot(weaponentity); - ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(okmachinegun, refire) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(okmachinegun, refire) * W_WeaponRateFactor(actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okmachinegun, refire), W_OverkillMachineGun_Attack_Auto); } diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 35bb1e3db..8f28ec83c 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -648,10 +648,9 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i if(actor.(weaponentity).arc_BUTTON_ATCK_prev) { - int slot = weaponslot(weaponentity); sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready); - ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor(actor); } actor.(weaponentity).arc_BUTTON_ATCK_prev = false; diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 1357fc5f2..f8539b14c 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -50,8 +50,7 @@ void W_Devastator_Explode(entity this, entity directhitentity) if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO)) { this.realowner.cnt = thiswep.m_id; - int slot = weaponslot(weaponentity); - ATTACK_FINISHED(this.realowner, slot) = time; + ATTACK_FINISHED(this.realowner, weaponentity) = time; this.realowner.(weaponentity).m_switchweapon = w_getbestweapon(this.realowner, weaponentity); } } @@ -144,8 +143,7 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO)) { this.realowner.cnt = thiswep.m_id; - int slot = weaponslot(weaponentity); - ATTACK_FINISHED(this.realowner, slot) = time; + ATTACK_FINISHED(this.realowner, weaponentity) = time; this.realowner.(weaponentity).m_switchweapon = w_getbestweapon(this.realowner, weaponentity); } } @@ -488,7 +486,7 @@ METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity wea { #if 0 // don't switch while guiding a missile - if(ATTACK_FINISHED(actor, slot) <= time || PS(actor).m_weapon != WEP_DEVASTATOR) + if(ATTACK_FINISHED(actor, weaponentity) <= time || PS(actor).m_weapon != WEP_DEVASTATOR) { ammo_amount = false; if(WEP_CVAR(devastator, reload_ammo)) diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 4d13e9cb7..187ed765f 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -379,8 +379,7 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int W_Hagar_Attack(thiswep, actor, weaponentity); - int slot = weaponslot(weaponentity); - ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor(actor); int theframe = WFRAME_FIRE1; entity this = actor.(weaponentity); if(this) diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index 9449a24f1..816ddae36 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -134,8 +134,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int return; } - int slot = weaponslot(weaponentity); - ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor(actor); W_HLAC_Attack(thiswep, actor, weaponentity); actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1; weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame); diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 190dddd39..607f1fcdd 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -56,9 +56,8 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity we actor.punchangle_x = random() - 0.5; actor.punchangle_y = random() - 0.5; } - int slot = weaponslot(weaponentity); // this attack_finished just enforces a cooldown at the end of a burst - ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor); if(actor.(weaponentity).misc_bulletcounter == 1) fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, EFFECT_BULLET); @@ -152,8 +151,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor, weaponentity); } - int slot = weaponslot(weaponentity); - ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Auto); } @@ -182,8 +180,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1; if(actor.(weaponentity).misc_bulletcounter == 0) { - int slot = weaponslot(weaponentity); - ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, burst_refire2) * W_WeaponRateFactor(actor); + ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR(machinegun, burst_refire2) * W_WeaponRateFactor(actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, burst_animtime), w_ready); } else diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 29192ac58..6063c666e 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -74,8 +74,7 @@ void W_MineLayer_Explode(entity this, entity directhitentity) if(!thiswep.wr_checkammo1(thiswep, own, weaponentity)) { own.cnt = thiswep.m_id; - int slot = weaponslot(weaponentity); - ATTACK_FINISHED(own, slot) = time; + ATTACK_FINISHED(own, weaponentity) = time; own.(weaponentity).m_switchweapon = w_getbestweapon(own, weaponentity); } } @@ -106,8 +105,7 @@ void W_MineLayer_DoRemoteExplode(entity this) if(!thiswep.wr_checkammo1(thiswep, own, weaponentity)) { own.cnt = thiswep.m_id; - int slot = weaponslot(weaponentity); - ATTACK_FINISHED(own, slot) = time; + ATTACK_FINISHED(own, weaponentity) = time; own.(weaponentity).m_switchweapon = w_getbestweapon(own, weaponentity); } } @@ -464,9 +462,8 @@ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponent } METHOD(MineLayer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - //int slot = 0; // TODO: unhardcode // actually do // don't switch while placing a mine - //if(ATTACK_FINISHED(actor, slot) <= time || PS(actor).m_weapon != WEP_MINE_LAYER) + //if(ATTACK_FINISHED(actor, weaponentity) <= time || PS(actor).m_weapon != WEP_MINE_LAYER) //{ float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(minelayer, ammo); ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(minelayer, ammo); diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index bf9900b97..d4d692ec7 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -47,10 +47,9 @@ void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, .entity weaponent float r, af; Weapon sw = actor.(weaponentity).m_switchweapon; // make it not detect weapon changes as reason to abort firing - int slot = weaponslot(weaponentity); - af = ATTACK_FINISHED(actor, slot); + af = ATTACK_FINISHED(actor, weaponentity); actor.(weaponentity).m_switchweapon = actor.(weaponentity).m_weapon; - ATTACK_FINISHED(actor, slot) = time; + ATTACK_FINISHED(actor, weaponentity) = time; r = weapon_prepareattack(thiswep, actor, weaponentity, actor.rifle_bullethail_frame == WFRAME_FIRE2, actor.rifle_bullethail_refire); if(actor.(weaponentity).m_switchweapon == actor.(weaponentity).m_weapon) actor.(weaponentity).m_switchweapon = sw; @@ -61,7 +60,7 @@ void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, .entity weaponent } else { - ATTACK_FINISHED(actor, slot) = af; // reset attack_finished if we didn't fire, so the last shot enforces the refire time + ATTACK_FINISHED(actor, weaponentity) = af; // reset attack_finished if we didn't fire, so the last shot enforces the refire time } } diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index f5ba20c8a..63f1e0179 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -1402,7 +1402,7 @@ void havocbot_chooseweapon(entity this, .entity weaponentity) // Should it do a weapon combo? float af, ct, combo_time, combo; - af = ATTACK_FINISHED(this, 0); + af = ATTACK_FINISHED(this, weaponentity); ct = autocvar_bot_ai_weapon_combo_threshold; // Bots with no skill will be 4 times more slower than "godlike" bots when doing weapon combos diff --git a/qcsrc/server/bot/default/scripting.qc b/qcsrc/server/bot/default/scripting.qc index 48975b836..555f6fc58 100644 --- a/qcsrc/server/bot/default/scripting.qc +++ b/qcsrc/server/bot/default/scripting.qc @@ -1084,12 +1084,12 @@ float bot_cmd_debug_assert_canfire(entity this) LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, inhibited by weaponentity state"); } } - else if(ATTACK_FINISHED(this, slot) > time) + else if(ATTACK_FINISHED(this, weaponentity) > time) { if(f) { this.colormod = '8 0 8'; - LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left)"); + LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(this, weaponentity) - time), " seconds left)"); } } else if(this.(weaponentity).tuba_note) @@ -1105,7 +1105,7 @@ float bot_cmd_debug_assert_canfire(entity this) if(!f) { this.colormod = '8 8 0'; - LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left"); + LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(this, weaponentity) - time), " seconds left"); } } diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 90bc1fb20..e667906f1 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -202,10 +202,7 @@ float bot_waypoints_for_items; #else #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot]) #endif -#define ATTACK_FINISHED(ent, slot) ATTACK_FINISHED_FOR(ent, ent.(weaponentity).m_weapon.m_id, slot) - -// assault game mode: Which team is attacking in this round? -float assault_attacker_team; +#define ATTACK_FINISHED(ent, w) ATTACK_FINISHED_FOR(ent, ent.(w).m_weapon.m_id, weaponslot(w)) // speedrun: when 1, player auto teleports back when capture timeout happens .float speedrunning; diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index c4b91b3b3..4a45b257a 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -292,9 +292,8 @@ bool weapon_prepareattack_check(Weapon thiswep, entity actor, .entity weaponenti if (attacktime >= 0) { - int slot = weaponslot(weaponentity); // don't fire if previous attack is not finished - if (ATTACK_FINISHED(actor, slot) > time + actor.(weaponentity).weapon_frametime * 0.5) return false; + if (ATTACK_FINISHED(actor, weaponentity) > time + actor.(weaponentity).weapon_frametime * 0.5) return false; entity this = actor.(weaponentity); // don't fire while changing weapon if (this.state != WS_READY) return false; @@ -313,17 +312,17 @@ void weapon_prepareattack_do(entity actor, .entity weaponentity, bool secondary, // if the weapon hasn't been firing continuously, reset the timer if (attacktime >= 0) { - int slot = weaponslot(weaponentity); - if (ATTACK_FINISHED(actor, slot) < time - this.weapon_frametime * 1.5) + if (ATTACK_FINISHED(actor, weaponentity) < time - this.weapon_frametime * 1.5) { - ATTACK_FINISHED(actor, slot) = time; + ATTACK_FINISHED(actor, weaponentity) = time; // dprint("resetting attack finished to ", ftos(time), "\n"); } float arate = W_WeaponRateFactor(actor); - ATTACK_FINISHED(actor, slot) = ATTACK_FINISHED(actor, slot) + attacktime * arate; + ATTACK_FINISHED(actor, weaponentity) = ATTACK_FINISHED(actor, weaponentity) + attacktime * arate; if(autocvar_g_weaponswitch_debug_alternate && W_DualWielding(actor)) { + int slot = weaponslot(weaponentity); for(int wepslot = 0; wepslot < MAX_WEAPONSLOTS; ++wepslot) { if(slot == wepslot) @@ -331,17 +330,17 @@ void weapon_prepareattack_do(entity actor, .entity weaponentity, bool secondary, .entity wepent = weaponentities[wepslot]; if(actor.(wepent) && actor.(wepent).m_weapon != WEP_Null) { - if(ATTACK_FINISHED(actor, wepslot) > time + actor.(wepent).weapon_frametime * 0.5) + if(ATTACK_FINISHED(actor, wepent) > time + actor.(wepent).weapon_frametime * 0.5) continue; // still cooling down! - if (ATTACK_FINISHED(actor, wepslot) < time - actor.(wepent).weapon_frametime * 1.5) - ATTACK_FINISHED(actor, wepslot) = time; - ATTACK_FINISHED(actor, wepslot) = ATTACK_FINISHED(actor, wepslot) + (attacktime * arate) / MAX_WEAPONSLOTS; + if (ATTACK_FINISHED(actor, wepent) < time - actor.(wepent).weapon_frametime * 1.5) + ATTACK_FINISHED(actor, wepent) = time; + ATTACK_FINISHED(actor, wepent) = ATTACK_FINISHED(actor, wepent) + (attacktime * arate) / MAX_WEAPONSLOTS; } } } } this.bulletcounter += 1; - // dprint("attack finished ", ftos(ATTACK_FINISHED(actor, slot)), "\n"); + // dprint("attack finished ", ftos(ATTACK_FINISHED(actor, weaponentity)), "\n"); } bool weapon_prepareattack(Weapon thiswep, entity actor, .entity weaponentity, bool secondary, float attacktime) @@ -557,7 +556,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity) entity oldwep = this.m_weapon; // set up weapon switch think in the future, and start drop anim - if (INDEPENDENT_ATTACK_FINISHED || ATTACK_FINISHED(actor, weaponslot(weaponentity)) <= time + this.weapon_frametime * 0.5) + if (INDEPENDENT_ATTACK_FINISHED || ATTACK_FINISHED(actor, weaponentity) <= time + this.weapon_frametime * 0.5) { sound(actor, CH_WEAPON_SINGLE, SND_WEAPON_SWITCH, VOL_BASE, ATTN_NORM); this.state = WS_DROP; @@ -570,7 +569,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity) // LordHavoc: network timing test code // if (actor.button0) - // print(ftos(frametime), " ", ftos(time), " >= ", ftos(ATTACK_FINISHED(actor, slot)), " >= ", ftos(this.weapon_nextthink), "\n"); + // print(ftos(frametime), " ", ftos(time), " >= ", ftos(ATTACK_FINISHED(actor, weaponentity)), " >= ", ftos(this.weapon_nextthink), "\n"); Weapon w = this.m_weapon; @@ -746,7 +745,7 @@ void W_ReloadedAndReady(Weapon thiswep, entity actor, .entity weaponentity, int // then quickly switch to another weapon and back. Reloading is canceled, but the reload delay is still there, // so your weapon is disabled for a few seconds without reason - // ATTACK_FINISHED(actor, slot) -= w_ent.reload_time - 1; + // ATTACK_FINISHED(actor, weaponentity) -= w_ent.reload_time - 1; w_ready(wpn, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1)); } @@ -819,7 +818,7 @@ void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sen // then quickly switch to another weapon and back. Reloading is canceled, but the reload delay is still there, // so your weapon is disabled for a few seconds without reason - // ATTACK_FINISHED(actor, slot) = max(time, ATTACK_FINISHED(actor, slot)) + this.reload_time + 1; + // ATTACK_FINISHED(actor, weaponentity) = max(time, ATTACK_FINISHED(actor, weaponentity)) + this.reload_time + 1; weapon_thinkf(actor, weaponentity, WFRAME_RELOAD, this.reload_time, W_ReloadedAndReady); -- 2.39.2