From e0fcaf1e8099b73d5a3f98891d8eefaecd471225 Mon Sep 17 00:00:00 2001 From: LegendaryGuard Date: Sat, 8 Apr 2023 20:10:33 +0200 Subject: [PATCH] Add legendary akimbo mutator, you can have 2 or 3 weapons holding. Refactor DUAL words, apply MAX_WEAPON_PER_SLOT and change MAX_WEAPONSLOTS into autocvar_g_max_weaponslots. Needs to be polished and some details need to be applied for this mutator, so WIP --- qcsrc/client/hud/crosshair.qc | 2 +- qcsrc/client/view.qc | 10 +++---- qcsrc/client/view.qh | 2 +- .../gamemodes/gamemode/nexball/sv_nexball.qc | 4 +-- qcsrc/common/mapobjects/trigger/magicear.qc | 2 +- qcsrc/common/monsters/sv_monsters.qc | 2 +- qcsrc/common/mutators/mutator/_mod.inc | 1 + qcsrc/common/mutators/mutator/_mod.qh | 1 + .../common/mutators/mutator/buffs/sv_buffs.qc | 6 ++-- .../mutator/legendary_akimbo/_mod.inc | 4 +++ .../mutators/mutator/legendary_akimbo/_mod.qh | 4 +++ .../mutator/legendary_akimbo/akimbo.qc | 29 ++++++++++++++++++ .../mutator/legendary_akimbo/akimbo.qh | 1 + qcsrc/common/mutators/mutator/nix/sv_nix.qc | 6 ++-- .../common/mutators/mutator/overkill/oknex.qc | 4 +-- .../mutators/mutator/overkill/sv_overkill.qc | 8 ++--- .../mutators/mutator/pinata/sv_pinata.qc | 2 +- qcsrc/common/physics/player.qc | 4 +-- qcsrc/common/vehicles/sv_vehicles.qc | 6 ++-- qcsrc/common/vehicles/vehicle/bumblebee.qc | 4 +-- qcsrc/common/vehicles/vehicle/spiderbot.qc | 2 +- qcsrc/common/weapons/calculations.qc | 2 +- qcsrc/common/weapons/weapon.qh | 13 ++++---- qcsrc/common/weapons/weapon/arc.qc | 4 +-- qcsrc/common/weapons/weapon/devastator.qc | 6 ++-- qcsrc/common/weapons/weapon/fireball.qc | 2 +- qcsrc/common/weapons/weapon/fireball.qh | 2 +- qcsrc/common/weapons/weapon/hagar.qc | 2 +- qcsrc/common/weapons/weapon/hook.qc | 4 +-- qcsrc/common/weapons/weapon/minelayer.qc | 2 +- qcsrc/common/weapons/weapon/porto.qc | 2 +- qcsrc/common/weapons/weapon/porto.qh | 2 +- qcsrc/common/weapons/weapon/rifle.qc | 2 +- qcsrc/common/weapons/weapon/tuba.qh | 2 +- qcsrc/common/weapons/weapon/vaporizer.qh | 2 +- qcsrc/common/weapons/weapon/vortex.qc | 4 +-- qcsrc/server/bot/default/havocbot/havocbot.qc | 8 ++--- qcsrc/server/bot/default/scripting.qc | 2 +- qcsrc/server/client.qc | 30 +++++++++---------- qcsrc/server/client.qh | 2 +- qcsrc/server/damage.qc | 8 ++--- qcsrc/server/hook.qc | 2 +- qcsrc/server/impulse.qc | 30 +++++++++---------- qcsrc/server/intermission.qc | 2 +- qcsrc/server/items/items.qc | 14 ++++----- qcsrc/server/main.qc | 2 +- qcsrc/server/player.qc | 6 ++-- qcsrc/server/portals.qc | 2 +- qcsrc/server/weapons/common.qc | 4 +-- qcsrc/server/weapons/common.qh | 2 +- qcsrc/server/weapons/selection.qc | 4 +-- qcsrc/server/weapons/selection.qh | 2 +- qcsrc/server/weapons/tracing.qc | 4 +-- qcsrc/server/weapons/weaponsystem.qc | 14 ++++----- qcsrc/server/weapons/weaponsystem.qh | 6 ++-- 55 files changed, 171 insertions(+), 128 deletions(-) create mode 100644 qcsrc/common/mutators/mutator/legendary_akimbo/_mod.inc create mode 100644 qcsrc/common/mutators/mutator/legendary_akimbo/_mod.qh create mode 100644 qcsrc/common/mutators/mutator/legendary_akimbo/akimbo.qc create mode 100644 qcsrc/common/mutators/mutator/legendary_akimbo/akimbo.qh diff --git a/qcsrc/client/hud/crosshair.qc b/qcsrc/client/hud/crosshair.qc index 229a60240..d35da5fd7 100644 --- a/qcsrc/client/hud/crosshair.qc +++ b/qcsrc/client/hud/crosshair.qc @@ -685,7 +685,7 @@ void DrawReticle(entity this) float is_dead = (STAT(HEALTH) <= 0); string reticle_image = string_null; bool wep_zoomed = false; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { entity wepe = viewmodels[slot]; Weapon wep = wepe.activeweapon; diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index a9ad0a76b..79060ed5d 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -346,7 +346,7 @@ void viewmodel_draw(entity this) } STATIC_INIT(viewmodel) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) viewmodels[slot] = new(viewmodel); } @@ -420,7 +420,7 @@ vector GetCurrentFov(float fov) if(hud == HUD_NORMAL && !spectatee_status) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { entity wepent = viewmodels[slot]; if(wepent.switchweapon != wepent.activeweapon) @@ -784,7 +784,7 @@ void HitSound() // varying sound pitch bool have_arc = false; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { entity wepent = viewmodels[slot]; @@ -1385,7 +1385,7 @@ void View_CheckButtonStatus() minigame_wasactive = false; } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { entity wepent = viewmodels[slot]; @@ -1604,7 +1604,7 @@ void CSQC_UpdateView(entity this, float w, float h) // run viewmodel_draw before updating view_angles to the angles calculated by WarpZone_FixView // viewmodel_draw needs to use the view_angles set by the engine on every CSQC_UpdateView call if(autocvar_r_drawviewmodel) - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) if(viewmodels[slot].activeweapon) viewmodel_draw(viewmodels[slot]); diff --git a/qcsrc/client/view.qh b/qcsrc/client/view.qh index cd33ebfb6..44abaf8d0 100644 --- a/qcsrc/client/view.qh +++ b/qcsrc/client/view.qh @@ -102,7 +102,7 @@ void update_mousepos(); void CSQC_Demo_Camera(); -entity viewmodels[MAX_WEAPONSLOTS]; +entity viewmodels[MAX_WEAPON_PER_SLOT]; vector viewloc_mousepos; diff --git a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc index 5fed894b9..e560c5baa 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc @@ -817,7 +817,7 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPreThink) } else { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; @@ -852,7 +852,7 @@ MUTATOR_HOOKFUNCTION(nb, PlayerSpawn) entity player = M_ARGV(0, entity); STAT(NB_METERSTART, player) = 0; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; STAT(WEAPONS, player.(weaponentity)) = '0 0 0'; diff --git a/qcsrc/common/mapobjects/trigger/magicear.qc b/qcsrc/common/mapobjects/trigger/magicear.qc index 7321fe23f..937144cb5 100644 --- a/qcsrc/common/mapobjects/trigger/magicear.qc +++ b/qcsrc/common/mapobjects/trigger/magicear.qc @@ -22,7 +22,7 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay, if (!(ear.spawnflags & MAGICEAR_TUBA)) return msgin; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(!W_Tuba_HasPlayed(source, weaponentity, ear.message, ear.movedir_x, !(ear.spawnflags & MAGICEAR_TUBA_EXACTPITCH), ear.movedir_y, ear.movedir_z)) diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 1635b5cb0..088e49077 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -838,7 +838,7 @@ void Monster_Remove(entity this) if(!MUTATOR_CALLHOOK(MonsterRemove, this)) Send_Effect(EFFECT_ITEM_PICKUP, this.origin, '0 0 0', 1); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(this.(weaponentity)) diff --git a/qcsrc/common/mutators/mutator/_mod.inc b/qcsrc/common/mutators/mutator/_mod.inc index c463c429f..7b6a96409 100644 --- a/qcsrc/common/mutators/mutator/_mod.inc +++ b/qcsrc/common/mutators/mutator/_mod.inc @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/qcsrc/common/mutators/mutator/_mod.qh b/qcsrc/common/mutators/mutator/_mod.qh index 3b4eba7cb..be56e0408 100644 --- a/qcsrc/common/mutators/mutator/_mod.qh +++ b/qcsrc/common/mutators/mutator/_mod.qh @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 6ce016e56..33d7fbf98 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -557,7 +557,7 @@ METHOD(AmmoBuff, m_apply, void(StatusEffects this, entity actor, float eff_time, { actor.buff_ammo_prev_infitems = (actor.items & IT_UNLIMITED_AMMO); actor.items |= IT_UNLIMITED_AMMO; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(!actor.(weaponentity)) @@ -576,7 +576,7 @@ METHOD(AmmoBuff, m_remove, void(StatusEffects this, entity actor, int removal_ty if(wasactive) { actor.items = BITSET(actor.items, IT_UNLIMITED_AMMO, actor.buff_ammo_prev_infitems); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(!actor.(weaponentity)) @@ -595,7 +595,7 @@ METHOD(AmmoBuff, m_tick, void(StatusEffects this, entity actor)) { if(IS_PLAYER(actor)) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(actor.(weaponentity).clip_size) diff --git a/qcsrc/common/mutators/mutator/legendary_akimbo/_mod.inc b/qcsrc/common/mutators/mutator/legendary_akimbo/_mod.inc new file mode 100644 index 000000000..b456436d7 --- /dev/null +++ b/qcsrc/common/mutators/mutator/legendary_akimbo/_mod.inc @@ -0,0 +1,4 @@ +// generated file; do not modify +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/legendary_akimbo/_mod.qh b/qcsrc/common/mutators/mutator/legendary_akimbo/_mod.qh new file mode 100644 index 000000000..34235edcb --- /dev/null +++ b/qcsrc/common/mutators/mutator/legendary_akimbo/_mod.qh @@ -0,0 +1,4 @@ +// generated file; do not modify +#ifdef SVQC + #include +#endif diff --git a/qcsrc/common/mutators/mutator/legendary_akimbo/akimbo.qc b/qcsrc/common/mutators/mutator/legendary_akimbo/akimbo.qc new file mode 100644 index 000000000..46ddf01e0 --- /dev/null +++ b/qcsrc/common/mutators/mutator/legendary_akimbo/akimbo.qc @@ -0,0 +1,29 @@ +#include "akimbo.qh" + +//FEATURE: Akimbo mutator for all your dual wielding needs + +AUTOCVAR(g_akimbo, bool, false, "Enable Akimbo mutator (requires g_weaponswitch_debug 2)"); +AUTOCVAR(g_akimbo_atspawns, bool, false, "Allow Akimbo items to be collected from item spawnpoints, not just dropped items"); + +REGISTER_MUTATOR(akimbo, autocvar_g_akimbo && !g_nexball && autocvar_g_weaponswitch_debug == 2); + +MUTATOR_HOOKFUNCTION(akimbo, ItemTouch) +{ + if(MUTATOR_RETURNVALUE == MUT_ITEMTOUCH_RETURN) + return false; // already handled, probably didn't pick it up + + entity item = M_ARGV(0, entity); + entity player = M_ARGV(1, entity); + + if((Item_IsLoot(item) || autocvar_g_akimbo_atspawns) && item.weapon && + (STAT(WEAPONS, player) & item.itemdef.m_weapon.m_wepset) && item.owner != player && !(item.itemdef.m_weapon.spawnflags & WEP_FLAG_NOMULTI)) + PS(player).multi_weapons |= item.itemdef.m_weapon.m_wepset; // dual it up! +} + +MUTATOR_HOOKFUNCTION(akimbo, FilterItem) +{ + entity item = M_ARGV(0, entity); + + if((Item_IsLoot(item) || autocvar_g_akimbo_atspawns) && item.weapon && item.owner && IS_PLAYER(item.owner)) + PS(item.owner).multi_weapons &= ~item.itemdef.m_weapon.m_wepset; // no longer akimbo'd (we don't check blacklist here, no need) +} diff --git a/qcsrc/common/mutators/mutator/legendary_akimbo/akimbo.qh b/qcsrc/common/mutators/mutator/legendary_akimbo/akimbo.qh new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/qcsrc/common/mutators/mutator/legendary_akimbo/akimbo.qh @@ -0,0 +1 @@ +#pragma once diff --git a/qcsrc/common/mutators/mutator/nix/sv_nix.qc b/qcsrc/common/mutators/mutator/nix/sv_nix.qc index c53c76eb7..2f9350f4a 100644 --- a/qcsrc/common/mutators/mutator/nix/sv_nix.qc +++ b/qcsrc/common/mutators/mutator/nix/sv_nix.qc @@ -67,7 +67,7 @@ REGISTER_MUTATOR(nix, expr_evaluate(cvar_string("g_nix")) && !MUTATOR_IS_ENABLED SetResource(it, RES_PLASMA, start_ammo_plasma); SetResource(it, RES_FUEL, start_ammo_fuel); STAT(WEAPONS, it) = start_weapons; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(it.(weaponentity).m_weapon == WEP_Null && slot != 0) @@ -180,7 +180,7 @@ void NIX_GiveCurrentWeapon(entity this) // all weapons must be fully loaded when we spawn if (wpn.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars { - for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for (int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; this.(weaponentity).(weapon_load[nix_weapon]) = wpn.reloading_ammo; @@ -217,7 +217,7 @@ void NIX_GiveCurrentWeapon(entity this) STAT(WEAPONS, this) |= WEPSET(BLASTER); STAT(WEAPONS, this) |= wpn.m_wepset; - for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for (int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if (this.(weaponentity).m_weapon == WEP_Null && slot != 0) diff --git a/qcsrc/common/mutators/mutator/overkill/oknex.qc b/qcsrc/common/mutators/mutator/overkill/oknex.qc index b24aac74f..ac1668a68 100644 --- a/qcsrc/common/mutators/mutator/overkill/oknex.qc +++ b/qcsrc/common/mutators/mutator/overkill/oknex.qc @@ -38,7 +38,7 @@ MUTATOR_HOOKFUNCTION(oknex_charge, GetPressedKeys) if(!WEP_CVAR(oknex, charge) || !WEP_CVAR(oknex, charge_velocity_rate)) return; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; @@ -291,7 +291,7 @@ METHOD(OverkillNex, wr_checkammo2, bool(entity thiswep, entity actor, .entity we METHOD(OverkillNex, wr_resetplayer, void(entity thiswep, entity actor)) { if (WEP_CVAR(oknex, charge)) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; actor.(weaponentity).oknex_charge = WEP_CVAR(oknex, charge_start); diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index 009acc355..dc530c3b9 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -8,7 +8,7 @@ bool autocvar_g_overkill_powerups_replace; bool autocvar_g_overkill_itemwaypoints = true; -.Weapon ok_lastwep[MAX_WEAPONSLOTS]; +.Weapon ok_lastwep[MAX_WEAPON_PER_SLOT]; /// \brief Returns a random classname of the overkill item. /// \param[in] prefix Prefix of the cvars that hold probabilities. @@ -94,7 +94,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerDies) ok_DropItem(frag_target, targ); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; @@ -137,7 +137,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink) return; } // Allow secondary blaster during countdown. - for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for (int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; Weapon weapon = player.(weaponentity).m_weapon; @@ -159,7 +159,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerWeaponSelect) { entity player = M_ARGV(0, entity); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; entity thiswep = player.(weaponentity); diff --git a/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc index fa8045101..9886e6023 100644 --- a/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc +++ b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc @@ -8,7 +8,7 @@ MUTATOR_HOOKFUNCTION(pinata, PlayerDies) { entity frag_target = M_ARGV(2, entity); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 8f681ce5f..02df2c7ea 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -128,7 +128,7 @@ void PM_ClientMovement_UpdateStatus(entity this) return; bool have_hook = false; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { #if defined(CSQC) entity wepent = viewmodels[slot]; @@ -631,7 +631,7 @@ void PM_check_hitground(entity this) this.wasFlying = false; if (this.waterlevel >= WATERLEVEL_SWIMMING) return; if (this.ladder_entity) return; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(this.(weaponentity).hook) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 302b39a0d..b0f642aec 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -832,7 +832,7 @@ void vehicles_exit(entity vehic, bool eject) player.view_ofs = STAT(PL_VIEW_OFS, player); player.event_damage = PlayerDamage; STAT(HUD, player) = HUD_NORMAL; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++ slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++ slot) { .entity weaponentity = weaponentities[slot]; player.(weaponentity).m_switchweapon = vehic.(weaponentity).m_switchweapon; @@ -1020,7 +1020,7 @@ void vehicles_enter(entity pl, entity veh) veh.colormap = pl.colormap; if(veh.tur_head) veh.tur_head.colormap = pl.colormap; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; veh.(weaponentity) = new(temp_wepent); @@ -1154,7 +1154,7 @@ void vehicles_spawn(entity this) FOREACH_CLIENT(IS_PLAYER(it), { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(it.(weaponentity).hook.aiment == this) diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 8b34473e3..c1c94e995 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -250,7 +250,7 @@ void bumblebee_gunner_exit(entity this, int _exitflag) player.event_damage = PlayerDamage; STAT(HUD, player) = HUD_NORMAL; player.teleportable = TELEPORT_NORMAL; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; player.(weaponentity).m_switchweapon = gunner.(weaponentity).m_switchweapon; @@ -325,7 +325,7 @@ bool bumblebee_gunner_enter(entity this, entity player) RemoveGrapplingHooks(player); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index d6a371b76..a11edcd4f 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -64,7 +64,7 @@ bool spiderbot_frame(entity this, float dt) PHYS_INPUT_BUTTON_ZOOM(this) = false; PHYS_INPUT_BUTTON_CROUCH(this) = false; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; this.(weaponentity).m_switchweapon = WEP_Null; diff --git a/qcsrc/common/weapons/calculations.qc b/qcsrc/common/weapons/calculations.qc index cd2d925bc..468524b54 100644 --- a/qcsrc/common/weapons/calculations.qc +++ b/qcsrc/common/weapons/calculations.qc @@ -148,7 +148,7 @@ vector findperpendicular(vector v) for(int j = 4; j > 1; --j) // > 1 as 1 is just center again { int taken = 0; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(own.(weaponentity).m_gunalign == j) // we know it can't be ours thanks to the above check diff --git a/qcsrc/common/weapons/weapon.qh b/qcsrc/common/weapons/weapon.qh index cf0f637f0..217da8f92 100644 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@ -10,12 +10,15 @@ USING(WepSet, vector); -const int MAX_WEAPONSLOTS = 2; -.entity weaponentities[MAX_WEAPONSLOTS]; +// TODO: Change this into a multiple weapon slot, it cannot be constant +int autocvar_g_max_weaponslots = 3; + +const int MAX_WEAPON_PER_SLOT = 3; +.entity weaponentities[MAX_WEAPON_PER_SLOT]; int weaponslot(.entity weaponentity) { - for (int i = 0; i < MAX_WEAPONSLOTS; ++i) + for (int i = 0; i < autocvar_g_max_weaponslots; ++i) { if (weaponentities[i] == weaponentity) { @@ -205,8 +208,8 @@ const int WEP_FLAG_SUPERWEAPON = BIT(7); // powerup timer const int WEP_FLAG_MUTATORBLOCKED = BIT(8); // hides from impulse 99 etc. (mutators are allowed to clear this flag) const int WEP_TYPE_MELEE_PRI = BIT(9); // primary attack is melee swing (for animation) const int WEP_TYPE_MELEE_SEC = BIT(10); // secondary attack is melee swing (for animation) -const int WEP_FLAG_DUALWIELD = BIT(11); // weapon can be dual wielded -const int WEP_FLAG_NODUAL = BIT(12); // weapon doesn't work well with dual wielding (fireball etc just explode on fire), doesn't currently prevent anything +const int WEP_FLAG_MULTIWIELD = BIT(11); // weapon can be dual wielded +const int WEP_FLAG_NOMULTI = BIT(12); // weapon doesn't work well with dual wielding (fireball etc just explode on fire), doesn't currently prevent anything const int WEP_FLAG_PENETRATEWALLS = BIT(13); // weapon has high calibur bullets that can penetrate thick walls (WEAPONTODO) const int WEP_FLAG_BLEED = BIT(14); // weapon pierces and causes bleeding (used for damage effects) const int WEP_FLAG_NOTRUEAIM = BIT(15); // weapon doesn't aim directly at targets diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index aa1a637c9..9a3c5d689 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -52,7 +52,7 @@ bool W_Arc_Beam_Send(entity this, entity to, int sf) void Reset_ArcBeam(entity player, vector forward) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(!player.(weaponentity).arc_beam) @@ -772,7 +772,7 @@ METHOD(Arc, wr_resetplayer, void(entity thiswep, entity actor)) { actor.arc_overheat = 0; actor.arc_cooldown = 0; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; actor.(weaponentity).arc_BUTTON_ATCK_prev = false; diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 9ad68db27..37fd536ec 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -6,7 +6,7 @@ void W_Devastator_Unregister(entity this) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(this.realowner.(weaponentity).lastrocket == this) @@ -241,7 +241,7 @@ void W_Devastator_Think(entity this) vector dv = v_right * -vecs.y + v_up * vecs.z; - if(!W_DualWielding(this.realowner)) + if(!W_MultiWielding(this.realowner)) dv = '0 0 0'; // don't override! velspeed = vlen(this.velocity); @@ -558,7 +558,7 @@ METHOD(Devastator, wr_checkammo2, bool(entity thiswep, entity actor, .entity wea } METHOD(Devastator, wr_resetplayer, void(entity thiswep, entity actor)) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; actor.(weaponentity).lastrocket = NULL; // stop rocket guiding, no revenge from the grave! diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index 363b1d694..85e5dfb73 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -387,7 +387,7 @@ METHOD(Fireball, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapo } METHOD(Fireball, wr_resetplayer, void(entity thiswep, entity actor)) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; actor.(weaponentity).fireball_primarytime = time; diff --git a/qcsrc/common/weapons/weapon/fireball.qh b/qcsrc/common/weapons/weapon/fireball.qh index c3dd73a2e..d401f6e2c 100644 --- a/qcsrc/common/weapons/weapon/fireball.qh +++ b/qcsrc/common/weapons/weapon/fireball.qh @@ -4,7 +4,7 @@ CLASS(Fireball, Weapon) /* spawnfunc */ ATTRIB(Fireball, m_canonical_spawnfunc, string, "weapon_fireball"); /* ammotype */ //ATTRIB(Fireball, ammo_type, Resource, RES_NONE); /* impulse */ ATTRIB(Fireball, impulse, int, 9); -/* flags */ ATTRIB(Fireball, spawnflags, int, WEP_FLAG_SUPERWEAPON | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL); +/* flags */ ATTRIB(Fireball, spawnflags, int, WEP_FLAG_SUPERWEAPON | WEP_TYPE_SPLASH | WEP_FLAG_NOMULTI); /* rating */ ATTRIB(Fireball, bot_pickupbasevalue, float, 5000); /* color */ ATTRIB(Fireball, wpcolor, vector, '1 0.5 0'); /* modelname */ ATTRIB(Fireball, mdl, string, "fireball"); diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 82f75f363..d5602e5d7 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -447,7 +447,7 @@ METHOD(Hagar, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponen } METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor)) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; actor.(weaponentity).hagar_load = 0; diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index d9e11dc01..68eab9bea 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -226,7 +226,7 @@ METHOD(Hook, wr_checkammo2, bool(Hook thiswep, entity actor, .entity weaponentit METHOD(Hook, wr_resetplayer, void(entity thiswep, entity actor)) { RemoveGrapplingHooks(actor); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; actor.(weaponentity).hook_time = 0; @@ -425,7 +425,7 @@ void Remove_GrapplingHook(entity this) { sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { entity wep = viewmodels[slot]; if(wep.hook == this) diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 9026521d6..f111296fb 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -470,7 +470,7 @@ METHOD(MineLayer, wr_checkammo2, bool(entity thiswep, entity actor, .entity weap } METHOD(MineLayer, wr_resetplayer, void(entity thiswep, entity actor)) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; actor.(weaponentity).minelayer_mines = 0; diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index 7ee416215..66909d7c1 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -15,7 +15,7 @@ void Porto_Draw(entity this) { if (spectatee_status || intermission == 1 || intermission == 2 || STAT(HEALTH) <= 0 || WEP_CVAR(porto, secondary)) return; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { entity wepent = viewmodels[slot]; diff --git a/qcsrc/common/weapons/weapon/porto.qh b/qcsrc/common/weapons/weapon/porto.qh index 757386b5c..18267c911 100644 --- a/qcsrc/common/weapons/weapon/porto.qh +++ b/qcsrc/common/weapons/weapon/porto.qh @@ -4,7 +4,7 @@ CLASS(PortoLaunch, Weapon) /* spawnfunc */ ATTRIB(PortoLaunch, m_canonical_spawnfunc, string, "weapon_porto"); /* ammotype */ ATTRIB(PortoLaunch, ammo_type, Resource, RES_NONE); /* impulse */ ATTRIB(PortoLaunch, impulse, int, 0); -/* flags */ ATTRIB(PortoLaunch, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_SUPERWEAPON | WEP_FLAG_NODUAL | WEP_FLAG_NOTRUEAIM); +/* flags */ ATTRIB(PortoLaunch, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_SUPERWEAPON | WEP_FLAG_NOMULTI | WEP_FLAG_NOTRUEAIM); /* rating */ ATTRIB(PortoLaunch, bot_pickupbasevalue, float, 0); /* color */ ATTRIB(PortoLaunch, wpcolor, vector, '0.5 0.5 0.5'); /* modelname */ ATTRIB(PortoLaunch, mdl, string, "porto"); diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index aa4a98062..144fe6fdf 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -158,7 +158,7 @@ METHOD(Rifle, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponen } METHOD(Rifle, wr_resetplayer, void(entity thiswep, entity actor)) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; actor.(weaponentity).rifle_accumulator = time - WEP_CVAR(rifle, bursttime); diff --git a/qcsrc/common/weapons/weapon/tuba.qh b/qcsrc/common/weapons/weapon/tuba.qh index 8855fc752..52a9b4d48 100644 --- a/qcsrc/common/weapons/weapon/tuba.qh +++ b/qcsrc/common/weapons/weapon/tuba.qh @@ -3,7 +3,7 @@ CLASS(Tuba, Weapon) /* spawnfunc */ ATTRIB(Tuba, m_canonical_spawnfunc, string, "weapon_tuba"); /* impulse */ ATTRIB(Tuba, impulse, int, 1); -/* flags */ ATTRIB(Tuba, spawnflags, int, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL | WEP_FLAG_NOTRUEAIM); +/* flags */ ATTRIB(Tuba, spawnflags, int, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH | WEP_FLAG_NOMULTI | WEP_FLAG_NOTRUEAIM); /* rating */ ATTRIB(Tuba, bot_pickupbasevalue, float, 2000); /* color */ ATTRIB(Tuba, wpcolor, vector, '0 1 0'); /* modelname */ ATTRIB(Tuba, mdl, string, "tuba"); diff --git a/qcsrc/common/weapons/weapon/vaporizer.qh b/qcsrc/common/weapons/weapon/vaporizer.qh index 87249f736..d5d356f84 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qh +++ b/qcsrc/common/weapons/weapon/vaporizer.qh @@ -4,7 +4,7 @@ CLASS(Vaporizer, Weapon) /* spawnfunc */ ATTRIB(Vaporizer, m_canonical_spawnfunc, string, "weapon_vaporizer"); /* ammotype */ ATTRIB(Vaporizer, ammo_type, Resource, RES_CELLS); /* impulse */ ATTRIB(Vaporizer, impulse, int, 7); -/* flags */ ATTRIB(Vaporizer, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN | WEP_FLAG_NODUAL); +/* flags */ ATTRIB(Vaporizer, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN | WEP_FLAG_NOMULTI); /* rating */ ATTRIB(Vaporizer, bot_pickupbasevalue, float, 10000); /* color */ ATTRIB(Vaporizer, wpcolor, vector, '0.5 1 1'); /* modelname */ ATTRIB(Vaporizer, mdl, string, "minstanex"); diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index 5c9ae23a1..ca09f9560 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -72,7 +72,7 @@ MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys) if(!WEP_CVAR(vortex, charge) || !WEP_CVAR(vortex, charge_velocity_rate)) return; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; @@ -287,7 +287,7 @@ METHOD(Vortex, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapone METHOD(Vortex, wr_resetplayer, void(entity thiswep, entity actor)) { if (WEP_CVAR(vortex, charge)) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; actor.(weaponentity).vortex_charge = WEP_CVAR(vortex, charge_start); diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index 57c18f096..62bf83412 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -120,7 +120,7 @@ void havocbot_ai(entity this) havocbot_chooseenemy(this); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(this.(weaponentity).m_weapon != WEP_Null || slot == 0) @@ -146,7 +146,7 @@ void havocbot_ai(entity this) } else { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; Weapon w = this.(weaponentity).m_weapon; @@ -183,7 +183,7 @@ void havocbot_ai(entity this) // if the bot is not attacking, consider reloading weapons if (!(this.aistatus & AI_STATUS_ATTACKING)) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; @@ -635,7 +635,7 @@ void havocbot_movetogoal(entity this) { if(this.velocity.z < 0) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; diff --git a/qcsrc/server/bot/default/scripting.qc b/qcsrc/server/bot/default/scripting.qc index 5a1333065..ac622b65b 100644 --- a/qcsrc/server/bot/default/scripting.qc +++ b/qcsrc/server/bot/default/scripting.qc @@ -579,7 +579,7 @@ float bot_cmd_select_weapon(entity this) bool success = false; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(this.(weaponentity).m_weapon == WEP_Null && slot != 0) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 5b7509e48..dd6e3605d 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -375,7 +375,7 @@ void PutObserverInServer(entity this, bool is_forced, bool use_spawnpoint) //this.spawnpoint_targ = NULL; // keep it so they can return to where they were? this.weaponmodel = ""; - for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for (int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { this.weaponentities[slot] = NULL; } @@ -612,7 +612,7 @@ void PutPlayerInServer(entity this) } SetSpectatee_status(this, 0); - PS(this).dual_weapons = '0 0 0'; + PS(this).multi_weapons = '0 0 0'; if(STAT(WEAPONS, this) & WEPSET_SUPERWEAPONS) StatusEffects_apply(STATUSEFFECT_Superweapons, this, time + autocvar_g_balance_superweapons_time, 0); @@ -741,7 +741,7 @@ void PutPlayerInServer(entity this) CS(this).startplaytime = time; } - for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for (int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; CL_SpawnWeaponentity(this, weaponentity); @@ -762,7 +762,7 @@ void PutPlayerInServer(entity this) it.wr_resetplayer(it, this); // reload all reloadable weapons if (it.spawnflags & WEP_FLAG_RELOADABLE) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; this.(weaponentity).weapon_load[it.m_id] = it.reloading_ammo; @@ -788,7 +788,7 @@ void PutPlayerInServer(entity this) delete(spot); // usefull for checking if there are spawnpoints, that let drop through the floor } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; entity w_ent = this.(weaponentity); @@ -807,7 +807,7 @@ void PutPlayerInServer(entity this) if (CS(this).impulse) ImpulseCommands(this); W_ResetGunAlign(this, CS_CVAR(this).cvar_cl_gunalign); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_WeaponFrame(this, weaponentity); @@ -1844,7 +1844,7 @@ void SetSpectatee(entity this, entity spectatee) // these are required to fix the spectator bug with arc if(old_spectatee) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(old_spectatee.(weaponentity).arc_beam) @@ -1853,7 +1853,7 @@ void SetSpectatee(entity this, entity spectatee) } if(spectatee) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(spectatee.(weaponentity).arc_beam) @@ -2061,7 +2061,7 @@ bool joinAllowed(entity this) } .string shootfromfixedorigin; -.bool dualwielding_prev; +.bool MULTIWIELDing_prev; bool PlayerThink(entity this) { if (game_stopped || intermission_running) { @@ -2166,17 +2166,17 @@ bool PlayerThink(entity this) // reset gun alignment when dual wielding status changes // to ensure guns are always aligned right and left - bool dualwielding = W_DualWielding(this); - if(this.dualwielding_prev != dualwielding) + bool MULTIWIELDing = W_MultiWielding(this); + if(this.MULTIWIELDing_prev != MULTIWIELDing) { W_ResetGunAlign(this, CS_CVAR(this).cvar_cl_gunalign); - this.dualwielding_prev = dualwielding; + this.MULTIWIELDing_prev = MULTIWIELDing; } // LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers //if(frametime) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(WEP_CVAR(vortex, charge_always)) @@ -2189,7 +2189,7 @@ bool PlayerThink(entity this) { // WEAPONTODO: Add a weapon request for this // rot vortex charge to the charge limit - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .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) @@ -2515,7 +2515,7 @@ void PlayerPreThink (entity this) // WEAPONTODO: Add weapon request for this if (!zoomstate_set) { bool wep_zoomed = false; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; Weapon thiswep = this.(weaponentity).m_weapon; diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 33b9d4511..5f05807ef 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -271,7 +271,7 @@ CLASS(Player, Client) // custom - ATTRIB(Player, dual_weapons, vector, this.dual_weapons); // TODO: actually WepSet! + ATTRIB(Player, multi_weapons, vector, this.multi_weapons); // TODO: actually WepSet! ATTRIB(Player, itemkeys, int, this.itemkeys); ATTRIB(Player, ballistics_density, float, this.ballistics_density); diff --git a/qcsrc/server/damage.qc b/qcsrc/server/damage.qc index f94f25fe6..0361ad2ec 100644 --- a/qcsrc/server/damage.qc +++ b/qcsrc/server/damage.qc @@ -86,7 +86,7 @@ void GiveFrags(entity attacker, entity targ, float f, int deathtype, .entity wea string AppendItemcodes(string s, entity player) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; int w = player.(weaponentity).m_weapon.m_id; @@ -530,7 +530,7 @@ void Freeze(entity targ, float revivespeed, int frozen_type, bool show_waypoint) FOREACH_CLIENT(IS_PLAYER(it), { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(it.(weaponentity).hook.aiment == targ) @@ -564,7 +564,7 @@ void Unfreeze(entity targ, bool reset_health) FOREACH_CLIENT(IS_PLAYER(it), { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(it.(weaponentity).hook.aiment == targ) @@ -709,7 +709,7 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de if(IS_PLAYER(targ) && damage > 0 && attacker) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity went = weaponentities[slot]; if(targ.(went).hook && targ.(went).hook.aiment == attacker) diff --git a/qcsrc/server/hook.qc b/qcsrc/server/hook.qc index a50830348..6927f5d10 100644 --- a/qcsrc/server/hook.qc +++ b/qcsrc/server/hook.qc @@ -80,7 +80,7 @@ void RemoveGrapplingHooks(entity pl) if(pl.move_movetype == MOVETYPE_FLY) set_movetype(pl, MOVETYPE_WALK); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(!pl.(weaponentity)) diff --git a/qcsrc/server/impulse.qc b/qcsrc/server/impulse.qc index be66fe968..f0fa82221 100644 --- a/qcsrc/server/impulse.qc +++ b/qcsrc/server/impulse.qc @@ -58,7 +58,7 @@ void weapon_group_handle(entity this, int number, int imp) this.impulse = imp; return; } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_NextWeaponOnImpulse(this, number, weaponentity); @@ -94,7 +94,7 @@ void weapon_priority_handle(entity this, int dir, int number, int imp) this.impulse = imp; return; } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_CycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriorities[number], dir, weaponentity); @@ -155,7 +155,7 @@ void weapon_byid_handle(entity this, int number, int imp) this.impulse = imp; return; } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_SwitchWeapon_TryOthers(this, REGISTRY_GET(Weapons, WEP_FIRST + number), weaponentity); @@ -203,7 +203,7 @@ IMPULSE(weapon_next_byid) this.impulse = IMP_weapon_next_byid.impulse; return; } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_NextWeapon(this, 0, weaponentity); @@ -221,7 +221,7 @@ IMPULSE(weapon_prev_byid) this.impulse = IMP_weapon_prev_byid.impulse; return; } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_PreviousWeapon(this, 0, weaponentity); @@ -239,7 +239,7 @@ IMPULSE(weapon_next_bygroup) this.impulse = IMP_weapon_next_bygroup.impulse; return; } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_NextWeapon(this, 1, weaponentity); @@ -257,7 +257,7 @@ IMPULSE(weapon_prev_bygroup) this.impulse = IMP_weapon_prev_bygroup.impulse; return; } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_PreviousWeapon(this, 1, weaponentity); @@ -275,7 +275,7 @@ IMPULSE(weapon_next_bypriority) this.impulse = IMP_weapon_next_bypriority.impulse; return; } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_NextWeapon(this, 2, weaponentity); @@ -293,7 +293,7 @@ IMPULSE(weapon_prev_bypriority) this.impulse = IMP_weapon_prev_bypriority.impulse; return; } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_PreviousWeapon(this, 2, weaponentity); @@ -307,7 +307,7 @@ IMPULSE(weapon_last) { if (this.vehicle) return; if (IS_DEAD(this)) return; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_LastWeapon(this, weaponentity); @@ -321,7 +321,7 @@ IMPULSE(weapon_best) { if (this.vehicle) return; if (IS_DEAD(this)) return; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; W_SwitchWeapon(this, w_getbestweapon(this, weaponentity), weaponentity); @@ -335,14 +335,14 @@ IMPULSE(weapon_drop) { if (this.vehicle) return; if (IS_DEAD(this)) return; - bool is_dualwielding = W_DualWielding(this); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + bool is_multiwielding = W_MultiWielding(this); + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; vector md = this.(weaponentity).movedir; vector vecs = ((md.x > 0) ? md : '0 0 0'); vector dv = v_right * -vecs.y; - if(!is_dualwielding) + if(!is_multiwielding) dv = '0 0 0'; // don't override! W_ThrowWeapon(this, weaponentity, W_CalculateProjectileVelocity(this, this.velocity, v_forward * 750, false), dv, true); @@ -357,7 +357,7 @@ IMPULSE(weapon_reload) if (IS_DEAD(this)) return; if (weaponLocked(this)) return; entity actor = this; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; Weapon w = this.(weaponentity).m_weapon; diff --git a/qcsrc/server/intermission.qc b/qcsrc/server/intermission.qc index b2652f7d8..6c631b180 100644 --- a/qcsrc/server/intermission.qc +++ b/qcsrc/server/intermission.qc @@ -457,7 +457,7 @@ void FixIntermissionClient(entity e) { e.autoscreenshot = time + 0.8; // used for autoscreenshot SetResourceExplicit(e, RES_HEALTH, -2342); // health in the first intermission phase - for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for (int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(e.(weaponentity)) diff --git a/qcsrc/server/items/items.qc b/qcsrc/server/items/items.qc index 6b653d9c3..308ea7c90 100644 --- a/qcsrc/server/items/items.qc +++ b/qcsrc/server/items/items.qc @@ -495,7 +495,7 @@ bool Item_GiveTo(entity item, entity player) if(CS_CVAR(player).cvar_cl_autoswitch) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(player.(weaponentity).m_weapon != WEP_Null || slot == 0) @@ -532,7 +532,7 @@ bool Item_GiveTo(entity item, entity player) if(wp & (it.m_wepset)) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(player.(weaponentity).m_weapon != WEP_Null || slot == 0) @@ -617,7 +617,7 @@ bool Item_GiveTo(entity item, entity player) // crude hack to enforce switching weapons if(g_cts && item.itemdef.instanceOfWeaponPickup && !CS_CVAR(player).cvar_cl_cts_noautoswitch) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(player.(weaponentity).m_weapon != WEP_Null || slot == 0) @@ -628,7 +628,7 @@ bool Item_GiveTo(entity item, entity player) if(_switchweapon) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(_switchweapon & BIT(slot)) @@ -1532,7 +1532,7 @@ float GiveItems(entity e, float beginarg, float endarg) if(CS_CVAR(e).cvar_cl_autoswitch) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(e.(weaponentity).m_weapon != WEP_Null || slot == 0) @@ -1727,7 +1727,7 @@ float GiveItems(entity e, float beginarg, float endarg) StatusEffects_update(e); } - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(e.(weaponentity).m_weapon != WEP_Null || slot == 0) @@ -1737,7 +1737,7 @@ float GiveItems(entity e, float beginarg, float endarg) if(_switchweapon) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(_switchweapon & BIT(slot)) diff --git a/qcsrc/server/main.qc b/qcsrc/server/main.qc index 2b29422b8..2883d5a70 100644 --- a/qcsrc/server/main.qc +++ b/qcsrc/server/main.qc @@ -140,7 +140,7 @@ void CreatureFrame_FallDamage(entity this) // check for falling damage bool have_hook = false; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(this.(weaponentity).hook && this.(weaponentity).hook.state) diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index ad3ba94e4..5620ac485 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -490,7 +490,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, excess = max(0, damage - take - save); //Weapon wep = this.(weaponentity).m_weapon; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity went = weaponentities[slot]; if(!this.(went)) @@ -523,7 +523,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, // clear waypoints WaypointSprite_PlayerDead(this); // throw a weapon - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity went = weaponentities[slot]; SpawnThrownWeapon(this, this.origin + (this.mins + this.maxs) * 0.5, this.(went).m_weapon, went); @@ -595,7 +595,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, FOREACH(Weapons, it != WEP_Null, { it.wr_resetplayer(it, this); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0; } diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 2cf8db682..991734961 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -492,7 +492,7 @@ void Portal_Think(entity this) if(it != o || time >= this.portal_activatetime) Portal_Think_TryTeleportPlayer(this, it, g, o); - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(it.(weaponentity).hook) diff --git a/qcsrc/server/weapons/common.qc b/qcsrc/server/weapons/common.qc index a0dd86f51..2bc3b2c70 100644 --- a/qcsrc/server/weapons/common.qc +++ b/qcsrc/server/weapons/common.qc @@ -17,10 +17,10 @@ #include #include -bool W_DualWielding(entity player) +bool W_MultiWielding(entity player) { int held_weapons = 0; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if(player.(weaponentity) && player.(weaponentity).m_switchweapon != WEP_Null) diff --git a/qcsrc/server/weapons/common.qh b/qcsrc/server/weapons/common.qh index 779226be3..228821fcd 100644 --- a/qcsrc/server/weapons/common.qh +++ b/qcsrc/server/weapons/common.qh @@ -5,7 +5,7 @@ bool autocvar_g_projectiles_keep_owner; float autocvar_sv_strengthsound_antispam_refire_threshold; float autocvar_sv_strengthsound_antispam_time; -bool W_DualWielding(entity player); +bool W_MultiWielding(entity player); void W_GiveWeapon (entity e, float wep); void W_PlayStrengthSound(entity player); float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception); diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 0368f7f5f..bcfa0482f 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -66,7 +66,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam sprint(this, "Invalid weapon\n"); return false; } - if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_DUALWIELD) && !(PS(this).dual_weapons & wpn.m_wepset)) + if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_MULTIWIELD) && !(PS(this).multi_weapons & wpn.m_wepset)) return false; // no complaints needed if (STAT(WEAPONS, this) & WepSet_FromWeapon(wpn)) { @@ -349,7 +349,7 @@ void W_LastWeapon(entity this, .entity weaponentity) // fix switchweapon (needed when spectating is disabled, as PutClientInServer comes too early) REPLICATE_APPLYCHANGE("cl_weaponpriority", - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if (this.(weaponentity) && (this.(weaponentity).m_weapon != WEP_Null || slot == 0)) diff --git a/qcsrc/server/weapons/selection.qh b/qcsrc/server/weapons/selection.qh index 093d6612b..ee06f5d95 100644 --- a/qcsrc/server/weapons/selection.qh +++ b/qcsrc/server/weapons/selection.qh @@ -9,7 +9,7 @@ bool autocvar_g_weaponswitch_debug_alternate; .int selectweapon; // last selected weapon of the player -.WepSet dual_weapons; +.WepSet multi_weapons; // switch between weapons void Send_WeaponComplain(entity e, float wpn, float type); diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index 9a36035a7..aa22ecc74 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -97,7 +97,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect tracebox(w_shotorg, mi, ma, w_shotorg + forward * (vecs.x + nudge), MOVE_NORMAL, ent); w_shotorg = trace_endpos - forward * nudge; // calculate the shotdir from the chosen shotorg - if(W_DualWielding(ent)) + if(W_MultiWielding(ent)) w_shotdir = s_forward; else w_shotdir = normalize(w_shotend - w_shotorg); @@ -155,7 +155,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect ent.punchangle_x = recoil * -1; if (snd != SND_Null) { - sound(ent, chan, snd, (W_DualWielding(ent) ? VOL_BASE * 0.7 : VOL_BASE), ATTN_NORM); + sound(ent, chan, snd, (W_MultiWielding(ent) ? VOL_BASE * 0.7 : VOL_BASE), ATTN_NORM); W_PlayStrengthSound(ent); } diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index fc2c3979c..6033cf91b 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -316,10 +316,10 @@ void weapon_prepareattack_do(entity actor, .entity weaponentity, bool secondary, float arate = W_WeaponRateFactor(actor); ATTACK_FINISHED(actor, weaponentity) = ATTACK_FINISHED(actor, weaponentity) + attacktime * arate; - if(autocvar_g_weaponswitch_debug_alternate && W_DualWielding(actor)) + if(autocvar_g_weaponswitch_debug_alternate && W_MultiWielding(actor)) { int slot = weaponslot(weaponentity); - for(int wepslot = 0; wepslot < MAX_WEAPONSLOTS; ++wepslot) + for(int wepslot = 0; wepslot < autocvar_g_max_weaponslots; ++wepslot) { if(slot == wepslot) continue; @@ -330,7 +330,7 @@ void weapon_prepareattack_do(entity actor, .entity weaponentity, bool secondary, continue; // still cooling down! 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; + ATTACK_FINISHED(actor, wepent) = ATTACK_FINISHED(actor, wepent) + (attacktime * arate) / autocvar_g_max_weaponslots; } } } @@ -435,11 +435,11 @@ bool weaponLocked(entity player) void W_ResetGunAlign(entity player, int preferred_alignment) { - if(W_DualWielding(player)) + if(W_MultiWielding(player)) preferred_alignment = 3; // right align, the second gun will default to left // clear current weapon slots' alignments so we can redo the calculations! - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if (player.(weaponentity)) @@ -447,7 +447,7 @@ void W_ResetGunAlign(entity player, int preferred_alignment) } // now set the new values - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + for(int slot = 0; slot < autocvar_g_max_weaponslots; ++slot) { .entity weaponentity = weaponentities[slot]; if (player.(weaponentity)) @@ -488,7 +488,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity) entity wep1 = actor.(wepe1); this.m_switchweapon = wep1.m_switchweapon; entity store = IS_PLAYER(actor) ? PS(actor) : actor; - if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD) && !(store.dual_weapons & wep1.m_switchweapon.m_wepset)) + if(!(this.m_switchweapon.spawnflags & WEP_FLAG_MULTIWIELD) && !(store.multi_weapons & wep1.m_switchweapon.m_wepset)) { this.m_weapon = WEP_Null; this.m_switchingweapon = WEP_Null; diff --git a/qcsrc/server/weapons/weaponsystem.qh b/qcsrc/server/weapons/weaponsystem.qh index c0e0c221f..773f00d17 100644 --- a/qcsrc/server/weapons/weaponsystem.qh +++ b/qcsrc/server/weapons/weaponsystem.qh @@ -32,10 +32,10 @@ entity weapon_dropevent_item; .int old_clip_load; .int clip_size; -.float attack_finished_for[REGISTRY_MAX(Weapons) * MAX_WEAPONSLOTS]; -.float attack_finished_single[MAX_WEAPONSLOTS]; +.float attack_finished_for[REGISTRY_MAX(Weapons) * MAX_WEAPON_PER_SLOT]; +.float attack_finished_single[MAX_WEAPON_PER_SLOT]; #if INDEPENDENT_ATTACK_FINISHED -#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)])) +#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * autocvar_g_max_weaponslots + (slot)])) #else #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot]) #endif -- 2.39.2