]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Hide some gametype checks so they somewhat match the server
authorMario <mario@smbclan.net>
Thu, 18 Oct 2018 22:41:21 +0000 (08:41 +1000)
committerMario <mario@smbclan.net>
Thu, 18 Oct 2018 22:41:21 +0000 (08:41 +1000)
12 files changed:
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/hud/panel/modicons.qc
qcsrc/client/hud/panel/physics.qc
qcsrc/client/hud/panel/racetimer.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/client/hud/panel/score.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/vote.qc
qcsrc/client/main.qh
qcsrc/client/shownames.qc
qcsrc/client/view.qc
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc

index 7b7d82b4445c376ea46a019daf14ee2488b0c5dc..f63ffb1deab223f0c31425248acfbee784399a48 100644 (file)
@@ -118,7 +118,7 @@ void HUD_InfoMessages()
 
                        MUTATOR_CALLHOOK(DrawInfoMessages, pos, mySize);
 
 
                        MUTATOR_CALLHOOK(DrawInfoMessages, pos, mySize);
 
-                       if(!warmup_stage && gametype == MAPINFO_TYPE_LMS)
+                       if(!warmup_stage && ISGAMETYPE(LMS))
                        {
                                entity sk;
                                sk = playerslots[player_localnum];
                        {
                                entity sk;
                                sk = playerslots[player_localnum];
index 87e4a7fb251af875266a9ea72c82cdd6449e1f91..4d1691a7fd57798ac639b7023f6a04f81e476a36 100644 (file)
@@ -54,9 +54,9 @@ void HUD_Mod_CA(vector myPos, vector mySize)
        mod_active = 1; // required in each mod function that always shows something
 
        int layout;
        mod_active = 1; // required in each mod function that always shows something
 
        int layout;
-       if(gametype == MAPINFO_TYPE_CA)
+       if(ISGAMETYPE(CA))
                layout = autocvar_hud_panel_modicons_ca_layout;
                layout = autocvar_hud_panel_modicons_ca_layout;
-       else //if(gametype == MAPINFO_TYPE_FREEZETAG)
+       else //if(ISGAMETYPE(FREEZETAG))
                layout = autocvar_hud_panel_modicons_freezetag_layout;
        int rows, columns;
        float aspect_ratio;
                layout = autocvar_hud_panel_modicons_freezetag_layout;
        int rows, columns;
        float aspect_ratio;
@@ -528,7 +528,7 @@ void HUD_Mod_Race(vector pos, vector mySize)
 
        // clientside personal record
        string rr;
 
        // clientside personal record
        string rr;
-       if(gametype == MAPINFO_TYPE_CTS)
+       if(ISGAMETYPE(CTS))
                rr = CTS_RECORD;
        else
                rr = RACE_RECORD;
                rr = CTS_RECORD;
        else
                rr = RACE_RECORD;
index a6c65183d4541cc0cb23c1cdf133e594fc3c1e0c..aa77690a6a4a23ee36aa39548511289239ab8ad1 100644 (file)
@@ -18,7 +18,7 @@ void HUD_Physics()
        {
                if(!autocvar_hud_panel_physics) return;
                if(spectatee_status == -1 && (autocvar_hud_panel_physics == 1 || autocvar_hud_panel_physics == 3)) return;
        {
                if(!autocvar_hud_panel_physics) return;
                if(spectatee_status == -1 && (autocvar_hud_panel_physics == 1 || autocvar_hud_panel_physics == 3)) return;
-               if(autocvar_hud_panel_physics == 3 && !(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
+               if(autocvar_hud_panel_physics == 3 && !(ISGAMETYPE(RACE) || ISGAMETYPE(CTS))) return;
        }
 
        HUD_Panel_LoadCvars();
        }
 
        HUD_Panel_LoadCvars();
index 6a190f2ca5f7c9b14c90590ed81f5227acc56bf0..7d09cf1ff5430276df551fe95c2025ab33258371 100644 (file)
@@ -98,7 +98,7 @@ void HUD_RaceTimer ()
        if(!autocvar__hud_configure)
        {
                if(!autocvar_hud_panel_racetimer) return;
        if(!autocvar__hud_configure)
        {
                if(!autocvar_hud_panel_racetimer) return;
-               if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
+               if(!(ISGAMETYPE(RACE) || ISGAMETYPE(CTS))) return;
                if(spectatee_status == -1) return;
        }
 
                if(spectatee_status == -1) return;
        }
 
index 9176aa0ff99782b05ed207495bacf5134675ff4c..cd4551725b3f90ba23440ef1db843a2fadd05f34 100644 (file)
@@ -343,7 +343,7 @@ void HUD_Radar()
        IL_EACH(g_radaricons, it.teamradar_icon, {
                if ( hud_panel_radar_mouse )
                if ( GetResourceAmount(it, RESOURCE_HEALTH) >= 0 )
        IL_EACH(g_radaricons, it.teamradar_icon, {
                if ( hud_panel_radar_mouse )
                if ( GetResourceAmount(it, RESOURCE_HEALTH) >= 0 )
-               if ( it.team == myteam + 1 || gametype == MAPINFO_TYPE_RACE || !teamplay )
+               if ( it.team == myteam + 1 || ISGAMETYPE(RACE) || !teamplay )
                {
                        vector coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(it.origin));
                        if(vdist((mousepos - coord), <, 8))
                {
                        vector coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(it.origin));
                        if(vdist((mousepos - coord), <, 8))
index 56fa5867c240f33484f9495d4818bde4b5197e51..525bf614b8be11e0cd01c075ec857b61c2937090 100644 (file)
@@ -140,7 +140,7 @@ void HUD_Score()
        if(!autocvar__hud_configure)
        {
                if(!autocvar_hud_panel_score) return;
        if(!autocvar__hud_configure)
        {
                if(!autocvar_hud_panel_score) return;
-               if(spectatee_status == -1 && (gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
+               if(spectatee_status == -1 && (ISGAMETYPE(RACE) || ISGAMETYPE(CTS))) return;
        }
 
        HUD_Panel_LoadCvars();
        }
 
        HUD_Panel_LoadCvars();
index 3d9e333bab70f949d2e13dc0fac7a8d5b75abc17..4989aac508cdb221238a6593ad28fbfd677e7ccc 100644 (file)
@@ -1145,7 +1145,7 @@ bool Scoreboard_WouldDraw()
                return true;
        else if (intermission == 2)
                return false;
                return true;
        else if (intermission == 2)
                return false;
-       else if (spectatee_status != -1 && STAT(HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS && !active_minigame)
+       else if (spectatee_status != -1 && STAT(HEALTH) <= 0 && autocvar_cl_deathscoreboard && !ISGAMETYPE(CTS) && !active_minigame)
                return true;
        else if (scoreboard_showscores_force)
                return true;
                return true;
        else if (scoreboard_showscores_force)
                return true;
@@ -1404,7 +1404,7 @@ vector Scoreboard_Rankings_Draw(vector pos, entity pl, vector rgb, vector bg_siz
        vector hl_rgb = rgb + '0.5 0.5 0.5';
 
        pos.y += hud_fontsize.y;
        vector hl_rgb = rgb + '0.5 0.5 0.5';
 
        pos.y += hud_fontsize.y;
-       drawstring(pos + eX * panel_bg_padding, ((gametype == MAPINFO_TYPE_CTF) ? _("Capture time rankings") : _("Rankings")), hud_fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawstring(pos + eX * panel_bg_padding, ((ISGAMETYPE(CTF)) ? _("Capture time rankings") : _("Rankings")), hud_fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
        pos.y += 1.25 * hud_fontsize.y;
        if(panel.current_panel_bg != "0")
                pos.y += panel_bg_border;
        pos.y += 1.25 * hud_fontsize.y;
        if(panel.current_panel_bg != "0")
                pos.y += panel_bg_border;
@@ -1498,7 +1498,7 @@ float scoreboard_time;
 bool have_weapon_stats;
 bool Scoreboard_AccuracyStats_WouldDraw(float ypos)
 {
 bool have_weapon_stats;
 bool Scoreboard_AccuracyStats_WouldDraw(float ypos)
 {
-       if (gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_NEXBALL)
+       if (ISGAMETYPE(CTS) || ISGAMETYPE(RACE) || ISGAMETYPE(NEXBALL))
                return false;
        if (!autocvar_hud_panel_scoreboard_accuracy || warmup_stage || ypos > 0.91 * vid_conheight)
                return false;
                return false;
        if (!autocvar_hud_panel_scoreboard_accuracy || warmup_stage || ypos > 0.91 * vid_conheight)
                return false;
@@ -1666,7 +1666,7 @@ void Scoreboard_Draw()
        if (Scoreboard_AccuracyStats_WouldDraw(pos.y))
                pos = Scoreboard_AccuracyStats_Draw(pos, panel_bg_color, bg_size);
 
        if (Scoreboard_AccuracyStats_WouldDraw(pos.y))
                pos = Scoreboard_AccuracyStats_Draw(pos, panel_bg_color, bg_size);
 
-       if(gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE || (autocvar_hud_panel_scoreboard_ctf_leaderboard && gametype == MAPINFO_TYPE_CTF && STAT(CTF_SHOWLEADERBOARD))) {
+       if(ISGAMETYPE(CTS) || ISGAMETYPE(RACE) || (autocvar_hud_panel_scoreboard_ctf_leaderboard && ISGAMETYPE(CTF) && STAT(CTF_SHOWLEADERBOARD))) {
                if(race_speedaward) {
                        drawcolorcodedstring(pos, sprintf(_("Speed award: %d%s ^7(%s^7)"), race_speedaward, race_speedaward_unit, ColorTranslateRGB(race_speedaward_holder)), hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
                        pos.y += 1.25 * hud_fontsize.y;
                if(race_speedaward) {
                        drawcolorcodedstring(pos, sprintf(_("Speed award: %d%s ^7(%s^7)"), race_speedaward, race_speedaward_unit, ColorTranslateRGB(race_speedaward_holder)), hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
                        pos.y += 1.25 * hud_fontsize.y;
@@ -1707,7 +1707,7 @@ void Scoreboard_Draw()
        tl = STAT(TIMELIMIT);
        fl = STAT(FRAGLIMIT);
        ll = STAT(LEADLIMIT);
        tl = STAT(TIMELIMIT);
        fl = STAT(FRAGLIMIT);
        ll = STAT(LEADLIMIT);
-       if(gametype == MAPINFO_TYPE_LMS)
+       if(ISGAMETYPE(LMS))
        {
                if(tl > 0)
                        str = strcat(str, sprintf(_(" for up to ^1%1.0f minutes^7"), tl));
        {
                if(tl > 0)
                        str = strcat(str, sprintf(_(" for up to ^1%1.0f minutes^7"), tl));
index 57b32039dc50fdf401d4da978413c0e4192a800f..0337eccfc215cac966713dd4602018548129b935 100644 (file)
@@ -9,7 +9,7 @@
 
 void HUD_Vote()
 {
 
 void HUD_Vote()
 {
-       if(autocvar_cl_allow_uid2name == -1 && (gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE || (serverflags & SERVERFLAG_PLAYERSTATS)))
+       if(autocvar_cl_allow_uid2name == -1 && (ISGAMETYPE(CTS) || ISGAMETYPE(RACE) || (serverflags & SERVERFLAG_PLAYERSTATS)))
        {
                // this dialog gets overriden by the uid2name menu dialog, if it exists
                // TODO remove this client side uid2name dialog in the next release
        {
                // this dialog gets overriden by the uid2name menu dialog, if it exists
                // TODO remove this client side uid2name dialog in the next release
index 8a0e78a0d8126fa7fa78fcca829a5c2af1b1f411..f0f8f1d4bea5ad62563c20df43bc0ce6ad2c9f29 100644 (file)
@@ -11,6 +11,8 @@ string minimapname;
 
 bool postinit;
 entity gametype;
 
 bool postinit;
 entity gametype;
+// temporary hack
+#define ISGAMETYPE(NAME) (gametype == MAPINFO_TYPE_##NAME)
 
 float FONT_USER = 8;
 
 
 float FONT_USER = 8;
 
index eac36c1ae8e2b6ceda0ef179deec7978d2207787..2fc1559494728343e27fed7b3282f2c37d668a0e 100644 (file)
@@ -128,7 +128,7 @@ void Draw_ShowNames(entity this)
                // FIXME: alpha is negative when dead, breaking death fade
                if (!this.csqcmodel_isdead) a *= f;
        }
                // FIXME: alpha is negative when dead, breaking death fade
                if (!this.csqcmodel_isdead) a *= f;
        }
-       if (a < ALPHA_MIN_VISIBLE && gametype != MAPINFO_TYPE_CTS) return;
+       if (a < ALPHA_MIN_VISIBLE && ISGAMETYPE(CTS)) return;
        if (vdist(this.origin - view_origin, >=, max_shot_distance)) return;
        float dist = vlen(this.origin - view_origin);
        if (autocvar_hud_shownames_maxdistance)
        if (vdist(this.origin - view_origin, >=, max_shot_distance)) return;
        float dist = vlen(this.origin - view_origin);
        if (autocvar_hud_shownames_maxdistance)
index b72998de6c42eb0e9a56372e00ee5f027f92f8b2..8fba190c64bfb32db161be60402cbbda6e8db29b 100644 (file)
@@ -1539,7 +1539,7 @@ void HUD_Draw(entity this)
        if(autocvar_r_letterbox == 0)
                if(autocvar_viewsize < 120)
                {
        if(autocvar_r_letterbox == 0)
                if(autocvar_viewsize < 120)
                {
-                       if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS))
+                       if(!(ISGAMETYPE(RACE) || ISGAMETYPE(CTS)))
                                Accuracy_LoadLevels();
 
                        HUD_Main();
                                Accuracy_LoadLevels();
 
                        HUD_Main();
@@ -2467,7 +2467,7 @@ void CSQC_UpdateView(entity this, float w, float h)
        else if(cvar("r_glsl_postprocess") == 2)
                cvar_set("r_glsl_postprocess", "0");
 
        else if(cvar("r_glsl_postprocess") == 2)
                cvar_set("r_glsl_postprocess", "0");
 
-       /*if(gametype == MAPINFO_TYPE_CTF)
+       /*if(ISGAMETYPE(CTF))
          {
          ctf_view();
          } else */
          {
          ctf_view();
          } else */
index 89c53a82abc22eb1b7b4b8fc1a8784e8f5b6ea23..65c5bcd8a0189530b2baf7eeba38a2ebcacdc272 100644 (file)
@@ -7,7 +7,7 @@ REGISTER_MUTATOR(cl_nb, true);
 
 MUTATOR_HOOKFUNCTION(cl_nb, WantEventchase)
 {
 
 MUTATOR_HOOKFUNCTION(cl_nb, WantEventchase)
 {
-       if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WEPSET(NEXBALL)))
+       if(autocvar_cl_eventchase_nexball && ISGAMETYPE(NEXBALL) && !(WepSet_GetFromStat() & WEPSET(NEXBALL)))
                return true;
        return false;
 }
                return true;
        return false;
 }