Fix weaponarena available including hidden weapons, also fix available weapons not...
authorMario <mario@smbclan.net>
Sat, 24 Aug 2019 18:07:29 +0000 (04:07 +1000)
committerMario <mario@smbclan.net>
Sat, 24 Aug 2019 18:07:29 +0000 (04:07 +1000)
qcsrc/common/t_items.qc
qcsrc/server/defs.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/weapons/spawning.qc

index 8573e4a..429a013 100644 (file)
@@ -1249,8 +1249,6 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
        {
                if(!have_pickup_item(this))
                {
-                       if(g_weaponarena == 2 && weaponid)
-                               weaponsInMap |= WepSet_FromWeapon(Weapons_from(weaponid));
                        startitem_failed = true;
                        delete(this);
                        return;
index b52649a..6e1020c 100644 (file)
@@ -191,7 +191,8 @@ void FixIntermissionClient(entity e);
 void FixClientCvars(entity e);
 
 // WEAPONTODO: remove this
-//WepSet weaponsInMap;
+//WepSet weaponsInMap; // lists all the weapons actually spawned in the map, does not include filtered items
+vector weaponsInMapAll; // holds a list of all the weapons that have been placed by the mapper (weaponreplace applied), ignores most filters
 
 .float respawn_countdown; // next number to count
 
index cdf3371..273b854 100644 (file)
@@ -524,18 +524,15 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne
 
 void weaponarena_available_update(entity this)
 {
-       if(!weaponsInMap)
-       {
-               // if no weapons are available, just fall back to most weapons arena
-               FOREACH(Weapons, it != WEP_Null, {
-                       if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && (it.spawnflags & WEP_FLAG_NORMAL) && !(it.spawnflags & WEP_FLAG_HIDDEN))
-                               g_weaponarena_weapons |= (it.m_wepset);
-               });
-               start_weapons = g_weaponarena_weapons;
-               return;
-       }
-       g_weaponarena_weapons |= weaponsInMap;
+       FOREACH(Weapons, it != WEP_Null, {
+               // if no weapons are available, just fall back to normal weapons (most weapons arena)
+               bool wep_available = ((weaponsInMapAll) ? !!(weaponsInMapAll & WepSet_FromWeapon(it)) : (it.spawnflags & WEP_FLAG_NORMAL));
+               if(wep_available && !(it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && !(it.spawnflags & WEP_FLAG_HIDDEN))
+                       g_weaponarena_weapons |= WepSet_FromWeapon(it);
+       });
        start_weapons = g_weaponarena_weapons;
+       if(warmup_stage)
+               warmup_start_weapons = start_weapons;
 }
 
 void readplayerstartcvars()
index ba17d3f..d5c79d0 100644 (file)
@@ -79,6 +79,9 @@ void weapon_defaultspawnfunc(entity this, Weapon e)
                }
        }
 
+       if(!Item_IsLoot(this))
+               weaponsInMapAll |= WepSet_FromWeapon(wpn);
+
        if (!Item_IsDefinitionAllowed(wpn.m_pickup))
        {
                delete(this);