From: terencehill Date: Sun, 20 Mar 2022 03:10:15 +0000 (+0100) Subject: Get rid of Duel gametype checks in client code X-Git-Tag: xonotic-v0.8.5~149 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3bb5350b3429651a228502ae9d75fc56b22ff486;p=xonotic%2Fxonotic-data.pk3dir.git Get rid of Duel gametype checks in client code --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 252c5032d..7c9234fae 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -236,7 +236,7 @@ void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer) bool forceplayercolors_enabled = false; #define fpc autocvar_cl_forceplayercolors - if (ISGAMETYPE(DUEL)) + if (gametype.m_1v1) { if ((myteam != NUM_SPECTATOR) && (fpc == 1 || fpc == 2 || fpc == 3 || fpc == 5)) forceplayercolors_enabled = true; @@ -301,7 +301,7 @@ void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer) { if(autocvar_cl_forcemyplayercolors && islocalplayer) this.colormap = 1024 + autocvar_cl_forcemyplayercolors; - else if (autocvar_cl_forceuniqueplayercolors && !islocalplayer && !ISGAMETYPE(DUEL)) + else if (autocvar_cl_forceuniqueplayercolors && !islocalplayer && !gametype.m_1v1) { // Assign each enemy unique colors // pick colors from 0 to 14 since 15 is the rainbow color diff --git a/qcsrc/common/gamemodes/gamemode/duel/duel.qh b/qcsrc/common/gamemodes/gamemode/duel/duel.qh index 298e62e00..cacf13fa5 100644 --- a/qcsrc/common/gamemodes/gamemode/duel/duel.qh +++ b/qcsrc/common/gamemodes/gamemode/duel/duel.qh @@ -6,7 +6,7 @@ CLASS(Duel, Gametype) INIT(Duel) { - this.gametype_init(this, _("Duel"),"duel","g_duel",GAMETYPE_FLAG_USEPOINTS,"","timelimit=10 pointlimit=0 leadlimit=0",_("Fight in a one versus one arena battle to decide the winner")); + this.gametype_init(this, _("Duel"),"duel","g_duel",GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_1V1,"","timelimit=10 pointlimit=0 leadlimit=0",_("Fight in a one versus one arena battle to decide the winner")); } METHOD(Duel, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) { diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index 0ac0c6230..a7bf6ce0a 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -22,6 +22,7 @@ const int GAMETYPE_FLAG_PREFERRED = BIT(2); // preferred (when available) 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 +const int GAMETYPE_FLAG_1V1 = BIT(6); // 1v1 gameplay int MAPINFO_TYPE_ALL; .int m_flags; @@ -44,6 +45,8 @@ CLASS(Gametype, Object) ATTRIB(Gametype, m_hidelimits, bool, false); /** does this gametype enforce its own weapon arena? */ ATTRIB(Gametype, m_weaponarena, bool, false); + /** 1v1 gameplay? */ + ATTRIB(Gametype, m_1v1, bool, false); /** game type defaults */ ATTRIB(Gametype, model2, string); /** game type description */ @@ -111,6 +114,7 @@ CLASS(Gametype, Object) 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); + this.m_1v1 = (gflags & GAMETYPE_FLAG_1V1); // same as `1 << m_id` MAPINFO_TYPE_ALL |= this.items = this.m_flags = (MAPINFO_TYPE_ALL + 1);