From: Mario Date: Sat, 24 Aug 2019 18:07:29 +0000 (+1000) Subject: Fix weaponarena available including hidden weapons, also fix available weapons not... X-Git-Tag: xonotic-v0.8.5~1360^2~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2649e8e8c7377825bebcab773696955107d8995f;p=xonotic%2Fxonotic-data.pk3dir.git Fix weaponarena available including hidden weapons, also fix available weapons not being included in the warmup weapons list --- diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 8573e4af0..429a013b1 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -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; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index b52649a34..6e1020c43 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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 diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index cdf3371ae..273b854ce 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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() diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index ba17d3f1f..d5c79d085 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -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);