From: Mario Date: Sun, 1 Nov 2020 10:58:46 +0000 (+1000) Subject: Add a gametype flag to signify that the mode forces its own weapon arena (allows... X-Git-Tag: xonotic-v0.8.5~703 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=39c2a9d41219005fb66d36b660ef24bbd4358f31;p=xonotic%2Fxonotic-data.pk3dir.git Add a gametype flag to signify that the mode forces its own weapon arena (allows mutators to check against it to disable themselves without needing to check for a specific gamemode) --- diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh index 9a8fca3ab..a8fdaa4ef 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qh @@ -8,7 +8,7 @@ void HUD_Mod_NexBall(vector pos, vector mySize); CLASS(NexBall, Gametype) INIT(NexBall) { - this.gametype_init(this, _("Nexball"),"nb","g_nexball",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=20 pointlimit=5 leadlimit=0",_("Shoot and kick the ball into the enemies goal, keep your goal clean")); + this.gametype_init(this, _("Nexball"),"nb","g_nexball",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_WEAPONARENA,"","timelimit=20 pointlimit=5 leadlimit=0",_("Shoot and kick the ball into the enemies goal, keep your goal clean")); } METHOD(NexBall, m_generate_mapinfo, void(Gametype this, string v)) { diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index 2d350b2fe..be1a4ef7c 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -21,6 +21,7 @@ const int GAMETYPE_FLAG_USEPOINTS = BIT(1); // gametype has point-based sc const int GAMETYPE_FLAG_PREFERRED = BIT(2); // preferred (when available) in random selections const int GAMETYPE_FLAG_PRIORITY = BIT(3); // priority selection when preferred gametype isn't available in random selections const int GAMETYPE_FLAG_HIDELIMITS = BIT(4); // don't display a score limit needed for winning the match in the scoreboard +const int GAMETYPE_FLAG_WEAPONARENA = BIT(5); // gametype has a forced weapon arena, weapon arena mutators should disable themselves when this is set int MAPINFO_TYPE_ALL; .int m_flags; @@ -41,6 +42,8 @@ CLASS(Gametype, Object) ATTRIB(Gametype, frags, bool, true); /** should this gametype display a score limit in the scoreboard? */ ATTRIB(Gametype, m_hidelimits, bool, false); + /** does this gametype enforce its own weapon arena? */ + ATTRIB(Gametype, m_weaponarena, bool, false); /** game type defaults */ ATTRIB(Gametype, model2, string); /** game type description */ @@ -107,6 +110,7 @@ CLASS(Gametype, Object) this.frags = (gflags & GAMETYPE_FLAG_USEPOINTS); this.m_priority = ((gflags & GAMETYPE_FLAG_PREFERRED) ? 2 : ((gflags & GAMETYPE_FLAG_PRIORITY) ? 1 : 0)); this.m_hidelimits = (gflags & GAMETYPE_FLAG_HIDELIMITS); + this.m_weaponarena = (gflags & GAMETYPE_FLAG_WEAPONARENA); // same as `1 << m_id` MAPINFO_TYPE_ALL |= this.items = this.m_flags = (MAPINFO_TYPE_ALL + 1); diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh index b3216cdcc..f50f0f947 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qh @@ -31,7 +31,7 @@ void instagib_invisibility(entity this); void instagib_extralife(entity this); void instagib_speed(entity this); -REGISTER_MUTATOR(mutator_instagib, autocvar_g_instagib && !g_nexball) +REGISTER_MUTATOR(mutator_instagib, autocvar_g_instagib && !MapInfo_LoadedGametype.m_weaponarena) { MUTATOR_ONADD { diff --git a/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc b/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc index a56efaf83..2596770da 100644 --- a/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc +++ b/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc @@ -3,7 +3,7 @@ #include "../overkill/sv_overkill.qh" string autocvar_g_melee_only; -REGISTER_MUTATOR(melee_only, expr_evaluate(autocvar_g_melee_only) && !MUTATOR_IS_ENABLED(mutator_instagib) && !MUTATOR_IS_ENABLED(ok) && !g_nexball); +REGISTER_MUTATOR(melee_only, expr_evaluate(autocvar_g_melee_only) && !MUTATOR_IS_ENABLED(mutator_instagib) && !MUTATOR_IS_ENABLED(ok) && !MapInfo_LoadedGametype.m_weaponarena); MUTATOR_HOOKFUNCTION(melee_only, SetStartItems, CBC_ORDER_LAST) { diff --git a/qcsrc/common/mutators/mutator/nix/sv_nix.qc b/qcsrc/common/mutators/mutator/nix/sv_nix.qc index 0ec051a8c..e23d533ed 100644 --- a/qcsrc/common/mutators/mutator/nix/sv_nix.qc +++ b/qcsrc/common/mutators/mutator/nix/sv_nix.qc @@ -39,7 +39,7 @@ float nix_nextweapon; bool NIX_CanChooseWeapon(int wpn); -REGISTER_MUTATOR(nix, expr_evaluate(cvar_string("g_nix")) && !MUTATOR_IS_ENABLED(mutator_instagib) && !MUTATOR_IS_ENABLED(ok)) +REGISTER_MUTATOR(nix, expr_evaluate(cvar_string("g_nix")) && !MUTATOR_IS_ENABLED(mutator_instagib) && !MUTATOR_IS_ENABLED(ok) && !MapInfo_LoadedGametype.m_weaponarena) { MUTATOR_ONADD { diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh index 63e3c19ef..4712ec2fa 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh @@ -8,7 +8,7 @@ bool autocvar_g_overkill_filter_armormega; .float ok_item; -REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !MUTATOR_IS_ENABLED(mutator_instagib) && !g_nexball && cvar_string("g_mod_balance") == "Overkill") +REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !MUTATOR_IS_ENABLED(mutator_instagib) && !MapInfo_LoadedGametype.m_weaponarena && cvar_string("g_mod_balance") == "Overkill") { MUTATOR_ONADD {