From d5e16200b8442af1bbb9fc426b22e453035fa2f6 Mon Sep 17 00:00:00 2001 From: TimePath Date: Wed, 28 Oct 2015 15:24:35 +1100 Subject: [PATCH] Weapons: pass weapon index --- .../gamemodes/gamemode/nexball/nexball.qc | 2 +- qcsrc/common/monsters/monster/mage.qc | 6 ++--- qcsrc/common/monsters/monster/spider.qc | 6 ++--- qcsrc/common/monsters/monster/wyvern.qc | 4 ++-- qcsrc/common/turrets/turret.qh | 2 +- qcsrc/common/turrets/turret/ewheel_weapon.qc | 2 +- qcsrc/common/turrets/turret/flac_weapon.qc | 2 +- qcsrc/common/turrets/turret/hellion_weapon.qc | 2 +- qcsrc/common/turrets/turret/hk_weapon.qc | 2 +- .../turrets/turret/machinegun_weapon.qc | 2 +- qcsrc/common/turrets/turret/mlrs_weapon.qc | 2 +- qcsrc/common/turrets/turret/phaser_weapon.qc | 2 +- qcsrc/common/turrets/turret/plasma_weapon.qc | 2 +- qcsrc/common/turrets/turret/tesla_weapon.qc | 2 +- qcsrc/common/turrets/turret/walker_weapon.qc | 2 +- qcsrc/common/vehicles/vehicle/racer.qc | 2 +- qcsrc/common/vehicles/vehicle/racer_weapon.qc | 2 +- qcsrc/common/vehicles/vehicle/raptor.qc | 6 ++--- .../common/vehicles/vehicle/raptor_weapons.qc | 6 ++--- qcsrc/common/weapons/weapon.qh | 2 +- qcsrc/common/weapons/weapon/arc.qc | 2 +- qcsrc/common/weapons/weapon/blaster.qc | 2 +- qcsrc/common/weapons/weapon/crylink.qc | 2 +- qcsrc/common/weapons/weapon/devastator.qc | 2 +- qcsrc/common/weapons/weapon/electro.qc | 6 ++--- qcsrc/common/weapons/weapon/fireball.qc | 14 ++++++------ qcsrc/common/weapons/weapon/hagar.qc | 2 +- qcsrc/common/weapons/weapon/hlac.qc | 8 +++---- qcsrc/common/weapons/weapon/hmg.qc | 10 ++++----- qcsrc/common/weapons/weapon/hook.qc | 4 ++-- qcsrc/common/weapons/weapon/machinegun.qc | 22 +++++++++---------- qcsrc/common/weapons/weapon/minelayer.qc | 2 +- qcsrc/common/weapons/weapon/mortar.qc | 2 +- qcsrc/common/weapons/weapon/porto.qc | 2 +- qcsrc/common/weapons/weapon/rifle.qc | 4 ++-- qcsrc/common/weapons/weapon/rpc.qc | 2 +- qcsrc/common/weapons/weapon/seeker.qc | 2 +- qcsrc/common/weapons/weapon/shockwave.qc | 4 ++-- qcsrc/common/weapons/weapon/shotgun.qc | 12 +++++----- qcsrc/common/weapons/weapon/tuba.qc | 2 +- qcsrc/common/weapons/weapon/vaporizer.qc | 2 +- qcsrc/common/weapons/weapon/vortex.qc | 2 +- qcsrc/server/defs.qh | 6 ++--- .../mutators/mutator/mutator_overkill.qc | 2 +- qcsrc/server/weapons/weaponsystem.qc | 20 ++++++++--------- qcsrc/server/weapons/weaponsystem.qh | 2 +- 46 files changed, 99 insertions(+), 99 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 490951459..5f07c100c 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -854,7 +854,7 @@ float ball_customize() return true; } - METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, int fire)) + METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, int slot, int fire)) { if(fire & 1) if(weapon_prepareattack(thiswep, actor, false, autocvar_g_balance_nexball_primary_refire)) diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 611e3b884..f38bd7912 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -41,7 +41,7 @@ REGISTER_WEAPON(MAGE_SPIKE, NEW(MageSpike)); void M_Mage_Attack_Spike(vector dir); void M_Mage_Attack_Push(); -METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, int fire)) { +METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, int slot, int fire)) { if (fire & 1) if (!IS_PLAYER(actor) || weapon_prepareattack(thiswep, actor, false, 0.2)) { if (!actor.target_range) actor.target_range = autocvar_g_monsters_target_range; @@ -363,7 +363,7 @@ float M_Mage_Attack(float attack_type, entity targ) if(random() <= 0.7) { Weapon wep = WEP_MAGE_SPIKE; - wep.wr_think(wep, self, 2); + wep.wr_think(wep, self, 0, 2); return true; } @@ -385,7 +385,7 @@ float M_Mage_Attack(float attack_type, entity targ) self.attack_finished_single = time + (autocvar_g_monster_mage_attack_spike_delay); self.anim_finished = time + 1; Weapon wep = WEP_MAGE_SPIKE; - wep.wr_think(wep, self, 1); + wep.wr_think(wep, self, 0, 1); return true; } } diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 52bda4ec9..1aa1c6020 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -50,7 +50,7 @@ float autocvar_g_monster_spider_attack_bite_delay; void M_Spider_Attack_Web(); -METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, int fire)) { +METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) if ((!isPlayer && time >= actor.spider_web_delay) || weapon_prepareattack(thiswep, actor, false, autocvar_g_monster_spider_attack_web_delay)) { @@ -160,12 +160,12 @@ bool M_Spider_Attack(int attack_type, entity targ) Weapon wep = WEP_SPIDER_ATTACK; case MONSTER_ATTACK_MELEE: { - wep.wr_think(wep, self, 2); + wep.wr_think(wep, self, 0, 2); return true; } case MONSTER_ATTACK_RANGED: { - wep.wr_think(wep, self, 1); + wep.wr_think(wep, self, 0, 1); return true; } } diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index b3bb5bfe8..e2d9f964c 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -48,7 +48,7 @@ float autocvar_g_monster_wyvern_attack_fireball_speed; void M_Wyvern_Attack_Fireball_Explode(); void M_Wyvern_Attack_Fireball_Touch(); -METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, int fire)) { +METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, int slot, int fire)) { if (fire & 1) if (time > actor.attack_finished_single || weapon_prepareattack(thiswep, actor, false, 1.2)) { if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0); @@ -128,7 +128,7 @@ float M_Wyvern_Attack(float attack_type, entity targ) { w_shotdir = normalize((self.enemy.origin + '0 0 10') - self.origin); Weapon wep = WEP_WYVERN_ATTACK; - wep.wr_think(wep, self, 1); + wep.wr_think(wep, self, 0, 1); return true; } } diff --git a/qcsrc/common/turrets/turret.qh b/qcsrc/common/turrets/turret.qh index 32f92a675..ab8ee0111 100644 --- a/qcsrc/common/turrets/turret.qh +++ b/qcsrc/common/turrets/turret.qh @@ -46,7 +46,7 @@ CLASS(Turret, Object) /** (SERVER) called when turret attacks */ METHOD(Turret, tr_attack, void(Turret this)) { Weapon w = this.m_weapon; - w.wr_think(w, self, 1); + w.wr_think(w, self, 0, 1); } /** (ALL) */ METHOD(Turret, tr_config, void(Turret this)) { diff --git a/qcsrc/common/turrets/turret/ewheel_weapon.qc b/qcsrc/common/turrets/turret/ewheel_weapon.qc index 904260300..eb90e253e 100644 --- a/qcsrc/common/turrets/turret/ewheel_weapon.qc +++ b/qcsrc/common/turrets/turret/ewheel_weapon.qc @@ -16,7 +16,7 @@ REGISTER_WEAPON(EWHEEL, NEW(EWheelAttack)); #ifdef SVQC void turret_initparams(entity); -METHOD(EWheelAttack, wr_think, void(entity thiswep, entity actor, int fire)) { +METHOD(EWheelAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) { diff --git a/qcsrc/common/turrets/turret/flac_weapon.qc b/qcsrc/common/turrets/turret/flac_weapon.qc index afba577f1..5c602e70e 100644 --- a/qcsrc/common/turrets/turret/flac_weapon.qc +++ b/qcsrc/common/turrets/turret/flac_weapon.qc @@ -16,7 +16,7 @@ REGISTER_WEAPON(FLAC, NEW(FlacAttack)); #ifdef SVQC void turret_flac_projectile_think_explode(); -METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, int fire)) { +METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) { diff --git a/qcsrc/common/turrets/turret/hellion_weapon.qc b/qcsrc/common/turrets/turret/hellion_weapon.qc index 94e6d5f41..3f85f85ae 100644 --- a/qcsrc/common/turrets/turret/hellion_weapon.qc +++ b/qcsrc/common/turrets/turret/hellion_weapon.qc @@ -19,7 +19,7 @@ float autocvar_g_turrets_unit_hellion_shot_speed_gain; float autocvar_g_turrets_unit_hellion_shot_speed_max; void turret_hellion_missile_think(); -METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, int fire)) { +METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) { diff --git a/qcsrc/common/turrets/turret/hk_weapon.qc b/qcsrc/common/turrets/turret/hk_weapon.qc index c7c781872..17d807130 100644 --- a/qcsrc/common/turrets/turret/hk_weapon.qc +++ b/qcsrc/common/turrets/turret/hk_weapon.qc @@ -23,7 +23,7 @@ float autocvar_g_turrets_unit_hk_shot_speed_max; float autocvar_g_turrets_unit_hk_shot_speed_turnrate; void turret_hk_missile_think(); -METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, int fire)) +METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) diff --git a/qcsrc/common/turrets/turret/machinegun_weapon.qc b/qcsrc/common/turrets/turret/machinegun_weapon.qc index 9dfff9e43..ac0eae164 100644 --- a/qcsrc/common/turrets/turret/machinegun_weapon.qc +++ b/qcsrc/common/turrets/turret/machinegun_weapon.qc @@ -17,7 +17,7 @@ REGISTER_WEAPON(TUR_MACHINEGUN, NEW(MachineGunTurretAttack)); void W_MachineGun_MuzzleFlash(); -METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, int fire)) +METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) diff --git a/qcsrc/common/turrets/turret/mlrs_weapon.qc b/qcsrc/common/turrets/turret/mlrs_weapon.qc index 45a125438..fa4b1fa6a 100644 --- a/qcsrc/common/turrets/turret/mlrs_weapon.qc +++ b/qcsrc/common/turrets/turret/mlrs_weapon.qc @@ -15,7 +15,7 @@ REGISTER_WEAPON(TUR_MLRS, NEW(MLRSTurretAttack)); #ifdef SVQC -METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, int fire)) +METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) diff --git a/qcsrc/common/turrets/turret/phaser_weapon.qc b/qcsrc/common/turrets/turret/phaser_weapon.qc index d493486f7..8e746049b 100644 --- a/qcsrc/common/turrets/turret/phaser_weapon.qc +++ b/qcsrc/common/turrets/turret/phaser_weapon.qc @@ -18,7 +18,7 @@ void beam_think(); .int fireflag; -METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, int fire)) +METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) diff --git a/qcsrc/common/turrets/turret/plasma_weapon.qc b/qcsrc/common/turrets/turret/plasma_weapon.qc index 3a032f2a7..6b47f4015 100644 --- a/qcsrc/common/turrets/turret/plasma_weapon.qc +++ b/qcsrc/common/turrets/turret/plasma_weapon.qc @@ -15,7 +15,7 @@ REGISTER_WEAPON(PLASMA, NEW(PlasmaAttack)); #ifdef SVQC -METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, int fire)) { +METHOD(PlasmaAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) { diff --git a/qcsrc/common/turrets/turret/tesla_weapon.qc b/qcsrc/common/turrets/turret/tesla_weapon.qc index de3a6d3a8..61d3b0efc 100644 --- a/qcsrc/common/turrets/turret/tesla_weapon.qc +++ b/qcsrc/common/turrets/turret/tesla_weapon.qc @@ -16,7 +16,7 @@ REGISTER_WEAPON(TESLA, NEW(TeslaCoilTurretAttack)); #ifdef SVQC entity toast(entity from, float range, float damage); -METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, int fire)) { +METHOD(TeslaCoilTurretAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) { diff --git a/qcsrc/common/turrets/turret/walker_weapon.qc b/qcsrc/common/turrets/turret/walker_weapon.qc index b4c8a5d9f..266599791 100644 --- a/qcsrc/common/turrets/turret/walker_weapon.qc +++ b/qcsrc/common/turrets/turret/walker_weapon.qc @@ -15,7 +15,7 @@ REGISTER_WEAPON(WALKER, NEW(WalkerTurretAttack)); #ifdef SVQC -METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, int fire)) { +METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); if (fire & 1) if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) { diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index 1c3d33129..6844efa08 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -321,7 +321,7 @@ float racer_frame() // Fix z-aim (for chase mode) crosshair_trace(player); w_shotdir.z = normalize(trace_endpos - org).z * 0.5; - wep1.wr_think(wep1, self, 1); + wep1.wr_think(wep1, self, 0, 1); } if(autocvar_g_vehicle_racer_rocket_locktarget) diff --git a/qcsrc/common/vehicles/vehicle/racer_weapon.qc b/qcsrc/common/vehicles/vehicle/racer_weapon.qc index d58705b59..528078f8d 100644 --- a/qcsrc/common/vehicles/vehicle/racer_weapon.qc +++ b/qcsrc/common/vehicles/vehicle/racer_weapon.qc @@ -42,7 +42,7 @@ float autocvar_g_vehicle_racer_rocket_climbspeed; float autocvar_g_vehicle_racer_rocket_locked_maxangle; void racer_fire_rocket(vector org, vector dir, entity trg); -METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, int fire)) +METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); entity player = isPlayer ? actor : actor.owner; diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 422dd8a64..7d90dd485 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -392,7 +392,7 @@ float raptor_frame() if(player.BUTTON_ATCK) if (wep1.wr_checkammo1(wep1)) { - wep1.wr_think(wep1, self, 1); + wep1.wr_think(wep1, self, 0, 1); } if(self.vehicle_flags & VHF_SHIELDREGEN) @@ -411,7 +411,7 @@ float raptor_frame() if(time > raptor.lip + autocvar_g_vehicle_raptor_bombs_refire) if(player.BUTTON_ATCK2) { - wep2a.wr_think(wep2a, self, 2); + wep2a.wr_think(wep2a, self, 1, 2); raptor.delay = time + autocvar_g_vehicle_raptor_bombs_refire; raptor.lip = time; } @@ -422,7 +422,7 @@ float raptor_frame() if(time > raptor.lip + autocvar_g_vehicle_raptor_flare_refire) if(player.BUTTON_ATCK2) { - wep2b.wr_think(wep2b, self, 2); + wep2b.wr_think(wep2b, self, 1, 2); raptor.delay = time + autocvar_g_vehicle_raptor_flare_refire; raptor.lip = time; } diff --git a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc index 32752c9ce..d1d2dd1cb 100644 --- a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc @@ -51,7 +51,7 @@ float autocvar_g_vehicle_raptor_bomblet_radius; float autocvar_g_vehicle_raptor_bomblet_force; float autocvar_g_vehicle_raptor_bomblet_explode_delay; -METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, int fire)) { +METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); entity player = isPlayer ? actor : actor.owner; entity veh = player.vehicle; @@ -88,7 +88,7 @@ METHOD(RaptorCannon, wr_checkammo1, bool(RacerAttack thiswep)) { float autocvar_g_vehicle_raptor_bombs_refire; void raptor_bombdrop(); -METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, int fire)) { +METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); entity player = isPlayer ? actor : actor.owner; entity veh = player.vehicle; @@ -109,7 +109,7 @@ void raptor_flare_think(); void raptor_flare_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); void raptor_flare_touch(); -METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, int fire)) { +METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { bool isPlayer = IS_PLAYER(actor); entity player = isPlayer ? actor : actor.owner; entity veh = player.vehicle; diff --git a/qcsrc/common/weapons/weapon.qh b/qcsrc/common/weapons/weapon.qh index 61629595d..3643b18f8 100644 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@ -47,7 +47,7 @@ CLASS(Weapon, Object) /** (SERVER) setup weapon data */ METHOD(Weapon, wr_setup, void(Weapon this)) {} /** (SERVER) logic to run every frame */ - METHOD(Weapon, wr_think, void(Weapon this, entity actor, int fire)) {} + METHOD(Weapon, wr_think, void(Weapon this, entity actor, int slot, int fire)) {} /** (SERVER) checks ammo for weapon primary */ METHOD(Weapon, wr_checkammo1, bool(Weapon this)) {return false;} /** (SERVER) checks ammo for weapon second */ diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 08be8f7d2..53359ee98 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -656,7 +656,7 @@ void Arc_Smoke() ); } } - METHOD(Arc, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Arc, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { Arc_Player_SetHeat(actor); Arc_Smoke(); diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index 69b97bf66..36b08287f 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -161,7 +161,7 @@ void W_Blaster_Attack( { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); } } - METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, int fire)) + METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, int slot, int fire)) { if(fire & 1) { diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 8875dac4e..4b5454c12 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -574,7 +574,7 @@ void W_Crylink_Attack2(Weapon thiswep) else self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false); } - METHOD(Crylink, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Crylink, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(autocvar_g_balance_crylink_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload Weapon w = get_weaponinfo(actor.weapon); diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index fc6b8af19..9dd08bb3e 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -520,7 +520,7 @@ void W_Devastator_Attack(Weapon thiswep) } } #endif - METHOD(Devastator, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Devastator, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(WEP_CVAR(devastator, reload_ammo) && actor.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload Weapon w = get_weaponinfo(actor.weapon); diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index a85f43ea3..e353f05f1 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -406,7 +406,7 @@ void W_Electro_Attack_Orb(Weapon thiswep) MUTATOR_CALLHOOK(EditProjectile, self, proj); } -void W_Electro_CheckAttack(Weapon thiswep, entity actor, int fire) +void W_Electro_CheckAttack(Weapon thiswep, entity actor, int slot, int fire) {SELFPARAM(); if(self.electro_count > 1) if(self.BUTTON_ATCK2) @@ -418,7 +418,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, int fire) return; } // WEAPONTODO: when the player releases the button, cut down the length of refire2? - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); } .float bot_secondary_electromooth; @@ -451,7 +451,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, int fire) } } } - METHOD(Electro, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Electro, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO { diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index f56d06857..7a7ff9dee 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -226,31 +226,31 @@ void W_Fireball_AttackEffect(float i, vector f_diff) Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); } -void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor, int fire) +void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor, int slot, int fire) { W_Fireball_Attack1(); weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), w_ready); } -void W_Fireball_Attack1_Frame3(Weapon thiswep, entity actor, int fire) +void W_Fireball_Attack1_Frame3(Weapon thiswep, entity actor, int slot, int fire) { W_Fireball_AttackEffect(0, '+1.25 +3.75 0'); weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame4); } -void W_Fireball_Attack1_Frame2(Weapon thiswep, entity actor, int fire) +void W_Fireball_Attack1_Frame2(Weapon thiswep, entity actor, int slot, int fire) { W_Fireball_AttackEffect(0, '-1.25 +3.75 0'); weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame3); } -void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor, int fire) +void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor, int slot, int fire) { W_Fireball_AttackEffect(1, '+1.25 -3.75 0'); weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame2); } -void W_Fireball_Attack1_Frame0(Weapon thiswep, entity actor, int fire) +void W_Fireball_Attack1_Frame0(Weapon thiswep, entity actor, int slot, int fire) {SELFPARAM(); W_Fireball_AttackEffect(0, '-1.25 -3.75 0'); sound(self, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM); @@ -371,14 +371,14 @@ void W_Fireball_Attack2(void) } } } - METHOD(Fireball, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Fireball, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(fire & 1) { if(time >= actor.fireball_primarytime) if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(fireball, refire))) { - W_Fireball_Attack1_Frame0(thiswep, actor, fire); + W_Fireball_Attack1_Frame0(thiswep, actor, slot, fire); actor.fireball_primarytime = time + WEP_CVAR_PRI(fireball, refire2) * W_WeaponRateFactor(); } } diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index c88c91e7c..e1dcffe83 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -407,7 +407,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep) else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false); } - METHOD(Hagar, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Hagar, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { float loadable_secondary; loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary)); diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index d738c81d3..ec95a988b 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -161,11 +161,11 @@ void W_HLAC_Attack2(void) } // weapon frames -void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, int fire) +void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, int slot, int fire) { if(actor.weapon != actor.switchweapon) // abort immediately if switching { - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); return; } @@ -176,7 +176,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, int fire) if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor)); - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); return; } @@ -211,7 +211,7 @@ void W_HLAC_Attack2_Frame(Weapon thiswep) { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false); } - METHOD(HLAC, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(HLAC, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload Weapon w = get_weaponinfo(actor.weapon); diff --git a/qcsrc/common/weapons/weapon/hmg.qc b/qcsrc/common/weapons/weapon/hmg.qc index fc9811713..3a00de313 100644 --- a/qcsrc/common/weapons/weapon/hmg.qc +++ b/qcsrc/common/weapons/weapon/hmg.qc @@ -45,11 +45,11 @@ HMG_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(WEP_HMG.m_id); } -void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, int fire) +void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, int slot, int fire) { if (!actor.BUTTON_ATCK) { - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); return; } @@ -58,7 +58,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, int fire) if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor)); - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); return; } @@ -96,7 +96,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, int fire) else self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false); } - METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload Weapon w = get_weaponinfo(actor.weapon); @@ -107,7 +107,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, int fire) if (weapon_prepareattack(thiswep, actor, false, 0)) { actor.misc_bulletcounter = 0; - W_HeavyMachineGun_Attack_Auto(thiswep, actor, fire); + W_HeavyMachineGun_Attack_Auto(thiswep, actor, slot, fire); } } } diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 56c280079..93aa633b4 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -22,7 +22,7 @@ CLASS(OffhandHook, OffhandWeapon) METHOD(OffhandHook, offhand_think, void(OffhandHook this, entity actor, bool key_pressed)) { Weapon wep = WEP_HOOK; - wep.wr_think(wep, actor, key_pressed ? 1 : 0); + wep.wr_think(wep, actor, 1, key_pressed ? 1 : 0); } ENDCLASS(OffhandHook) OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); } @@ -174,7 +174,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor) MUTATOR_CALLHOOK(EditProjectile, actor, gren); } - METHOD(Hook, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Hook, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if (fire & 1) { if(!actor.hook) diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 8241d1eca..62287acb2 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -137,11 +137,11 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype) } // weapon frames -void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, int fire) +void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, int slot, int fire) { if(actor.weapon != actor.switchweapon) // abort immediately if switching { - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); return; } if(actor.BUTTON_ATCK) @@ -151,7 +151,7 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, int fire) if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor)); - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); return; } actor.misc_bulletcounter = actor.misc_bulletcounter + 1; @@ -163,13 +163,13 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, int fire) } -void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, int fire) +void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, int slot, int fire) { float machinegun_spread; if(!(fire & 1)) { - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); return; } @@ -178,7 +178,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, int fire) if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor)); - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); return; } @@ -208,7 +208,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, int fire) weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Auto); } -void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, int fire) +void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, int slot, int fire) { W_SetupShot(actor, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage)); if(!autocvar_g_norecoil) @@ -247,7 +247,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, int fire) else self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false); } - METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(WEP_CVAR(machinegun, reload_ammo) && actor.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) { // forced reload Weapon w = get_weaponinfo(actor.weapon); @@ -259,7 +259,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, int fire) if(weapon_prepareattack(thiswep, actor, false, 0)) { actor.misc_bulletcounter = 0; - W_MachineGun_Attack_Auto(thiswep, actor, fire); + W_MachineGun_Attack_Auto(thiswep, actor, slot, fire); } if(fire & 2) @@ -270,14 +270,14 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, int fire) if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor)); - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); return; } W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, burst_ammo)); actor.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1; - W_MachineGun_Attack_Burst(thiswep, actor, fire); + W_MachineGun_Attack_Burst(thiswep, actor, slot, fire); } } else diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index b2f9d161d..abed99b8d 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -499,7 +499,7 @@ float W_MineLayer_PlacedMines(float detonate) if(self.BUTTON_ATCK2 == true) self.BUTTON_ATCK = false; } } - METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload { diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index d788e7b88..043f8f63b 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -334,7 +334,7 @@ void W_Mortar_Attack2(Weapon thiswep) wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime)))); wepinfo_ter_dps = 0; */ - METHOD(Mortar, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Mortar, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(autocvar_g_balance_mortar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload Weapon w = get_weaponinfo(actor.weapon); diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index b02edd055..8761040b3 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -306,7 +306,7 @@ void W_Porto_Attack(float type) { PORTO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS); } - METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(WEP_CVAR(porto, secondary)) { diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index 9ac992669..6b5ed1997 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -90,7 +90,7 @@ void W_Rifle_Attack2(void) .float rifle_bullethail_frame; .float rifle_bullethail_animtime; .float rifle_bullethail_refire; -void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, int fire) +void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, int slot, int fire) { float r, sw, af; @@ -160,7 +160,7 @@ void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animt } } } - METHOD(Rifle, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Rifle, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(autocvar_g_balance_rifle_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload Weapon w = get_weaponinfo(actor.weapon); diff --git a/qcsrc/common/weapons/weapon/rpc.qc b/qcsrc/common/weapons/weapon/rpc.qc index 5d9052363..b87b3371b 100644 --- a/qcsrc/common/weapons/weapon/rpc.qc +++ b/qcsrc/common/weapons/weapon/rpc.qc @@ -153,7 +153,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep) { self.BUTTON_ATCK = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false); } - METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) { Weapon w = get_weaponinfo(actor.weapon); diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 78a65129f..303c563fe 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -608,7 +608,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep) else self.BUTTON_ATCK = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false); } - METHOD(Seeker, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Seeker, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(autocvar_g_balance_seeker_reload_ammo && actor.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload Weapon w = get_weaponinfo(actor.weapon); diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 47f6e36b1..bd220ff7c 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -229,7 +229,7 @@ void W_Shockwave_Melee_Think(void) } } -void W_Shockwave_Melee(Weapon thiswep, entity actor, int fire) +void W_Shockwave_Melee(Weapon thiswep, entity actor, int slot, int fire) { sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM); weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready); @@ -675,7 +675,7 @@ void W_Shockwave_Attack(void) else { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false); } } - METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(fire & 1) { diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index cd1e2ea78..42b99969a 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -181,7 +181,7 @@ void W_Shotgun_Melee_Think(void) } } -void W_Shotgun_Attack2(Weapon thiswep, entity actor, int fire) +void W_Shotgun_Attack2(Weapon thiswep, entity actor, int slot, int fire) { sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTEN_NORM); weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(shotgun, animtime), w_ready); @@ -195,14 +195,14 @@ void W_Shotgun_Attack2(Weapon thiswep, entity actor, int fire) } // alternate secondary weapon frames -void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, int fire) +void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, int slot, int fire) { Weapon w = get_weaponinfo(actor.weapon); if (!w.wr_checkammo2(w)) if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor)); - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); return; } @@ -210,14 +210,14 @@ void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, int fire) W_Shotgun_Attack(WEP_SHOTGUN, true); // actually is secondary, but we trick the last shot into playing full reload sound weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready); } -void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, int fire) +void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, int slot, int fire) { Weapon w = get_weaponinfo(actor.weapon); if (!w.wr_checkammo2(w)) if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor)); - w_ready(thiswep, actor, fire); + w_ready(thiswep, actor, slot, fire); return; } @@ -234,7 +234,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, int fire) else self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false); } - METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(WEP_CVAR(shotgun, reload_ammo) && actor.clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload { diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 46c409511..688152e0a 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -379,7 +379,7 @@ void W_Tuba_NoteOn(float hittype) self.BUTTON_ATCK2 = 1; } } - METHOD(Tuba, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Tuba, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(fire & 1) if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR(tuba, refire))) diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index bbdeb69ac..c7de3881b 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -244,7 +244,7 @@ void W_RocketMinsta_Attack3 (void) else self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars } - METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); // if the laser uses load, we also consider its ammo for reloading diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index f8e33f636..a3843dae1 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -143,7 +143,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary) self.BUTTON_ATCK2 = true; } } - METHOD(Vortex, wr_think, void(entity thiswep, entity actor, int fire)) + METHOD(Vortex, wr_think, void(entity thiswep, entity actor, int slot, int fire)) { if(WEP_CVAR(vortex, charge) && actor.vortex_charge < WEP_CVAR(vortex, charge_limit)) actor.vortex_charge = min(1, actor.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME); diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index a15309274..99814e015 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -163,11 +163,11 @@ const float MAX_DAMAGEEXTRARADIUS = 16; // WEAPONTODO .float autoswitch; float client_hasweapon(entity cl, float wpn, float andammo, float complain); -void w_clear(Weapon thiswep, entity actor, int fire); -void w_ready(Weapon thiswep, entity actor, int fire); +void w_clear(Weapon thiswep, entity actor, int slot, int fire); +void w_ready(Weapon thiswep, entity actor, int slot, int fire); // VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies) .float weapon_nextthink; -.void(Weapon thiswep, entity actor, int fire) weapon_think; +.void(Weapon thiswep, entity actor, int slot, int fire) weapon_think; // weapon states (self.weaponentity.state) diff --git a/qcsrc/server/mutators/mutator/mutator_overkill.qc b/qcsrc/server/mutators/mutator/mutator_overkill.qc index c86626395..a07c18e13 100644 --- a/qcsrc/server/mutators/mutator/mutator_overkill.qc +++ b/qcsrc/server/mutators/mutator/mutator_overkill.qc @@ -208,7 +208,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink) } Weapon wpn = get_weaponinfo(self.weapon); if(self.weaponentity.state != WS_CLEAR) - w_ready(wpn, self, (self.BUTTON_ATCK ? 1 : 0) | (self.BUTTON_ATCK2 ? 2 : 0)); + w_ready(wpn, self, 0, (self.BUTTON_ATCK ? 1 : 0) | (self.BUTTON_ATCK2 ? 2 : 0)); self.weapon_blocked = true; } diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index a29f1b5ec..f47916e1d 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -92,7 +92,7 @@ float W_WeaponSpeedFactor() } -void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, int fire) func); +void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, int slot, int fire) func); bool CL_Weaponentity_CustomizeEntityForClient() { @@ -466,7 +466,7 @@ void CL_SpawnWeaponentity(entity e) } // Weapon subs -void w_clear(Weapon thiswep, entity actor, int fire) +void w_clear(Weapon thiswep, entity actor, int slot, int fire) { if (actor.weapon != -1) { @@ -480,7 +480,7 @@ void w_clear(Weapon thiswep, entity actor, int fire) } } -void w_ready(Weapon thiswep, entity actor, int fire) +void w_ready(Weapon thiswep, entity actor, int slot, int fire) { if (actor.weaponentity) actor.weaponentity.state = WS_READY; weapon_thinkf(actor, WFRAME_IDLE, 1000000, w_ready); @@ -592,7 +592,7 @@ bool weapon_prepareattack(Weapon thiswep, entity actor, bool secondary, float at return false; } -void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, int fire) func) +void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, int slot, int fire) func) { bool restartanim; if (fr == WFRAME_DONTCHANGE) @@ -687,7 +687,7 @@ void W_WeaponFrame(entity actor) if (actor.weaponentity.state != WS_CLEAR) { Weapon wpn = get_weaponinfo(actor.weapon); - w_ready(wpn, actor, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0)); + w_ready(wpn, actor, 0, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0)); return; } } @@ -803,7 +803,7 @@ void W_WeaponFrame(entity actor) actor.hook_switchweapon = key_pressed; Weapon h = WEP_HOOK; block_weapon = (actor.weapon == h.m_id && (actor.BUTTON_ATCK || key_pressed)); - h.wr_think(h, actor, block_weapon ? 1 : 0); + h.wr_think(h, actor, 0, block_weapon ? 1 : 0); } } @@ -812,7 +812,7 @@ void W_WeaponFrame(entity actor) if (w) { Weapon e = get_weaponinfo(actor.weapon); - e.wr_think(e, actor, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0)); + e.wr_think(e, actor, 0, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0)); } else { @@ -829,7 +829,7 @@ void W_WeaponFrame(entity actor) v_right = ri; v_up = up; Weapon wpn = get_weaponinfo(actor.weapon); - actor.weapon_think(wpn, actor, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0)); + actor.weapon_think(wpn, actor, 0, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0)); } else { @@ -909,7 +909,7 @@ void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use) .float reload_complain; .string reload_sound; -void W_ReloadedAndReady(Weapon thiswep, entity actor, int fire) +void W_ReloadedAndReady(Weapon thiswep, entity actor, int slot, int fire) { // finish the reloading process, and do the ammo transfer @@ -936,7 +936,7 @@ void W_ReloadedAndReady(Weapon thiswep, entity actor, int fire) // ATTACK_FINISHED(actor) -= actor.reload_time - 1; Weapon wpn = get_weaponinfo(actor.weapon); - w_ready(wpn, actor, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0)); + w_ready(wpn, actor, slot, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0)); } void W_Reload(entity actor, float sent_ammo_min, string sent_sound) diff --git a/qcsrc/server/weapons/weaponsystem.qh b/qcsrc/server/weapons/weaponsystem.qh index ee84a7c61..28f934406 100644 --- a/qcsrc/server/weapons/weaponsystem.qh +++ b/qcsrc/server/weapons/weaponsystem.qh @@ -44,6 +44,6 @@ bool weapon_prepareattack_check(Weapon thiswep, entity actor, float secondary, f void weapon_prepareattack_do(entity actor, float secondary, float attacktime); -void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, int fire) func); +void weapon_thinkf(entity actor, float fr, float t, void(Weapon thiswep, entity actor, int slot, int fire) func); #endif -- 2.39.2