From 0aa7cb88f50114ef8b87f7b7e2efc07641ee050f Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 19 Oct 2018 08:41:21 +1000 Subject: [PATCH] Hide some gametype checks so they somewhat match the server --- qcsrc/client/hud/panel/infomessages.qc | 2 +- qcsrc/client/hud/panel/modicons.qc | 6 +++--- qcsrc/client/hud/panel/physics.qc | 2 +- qcsrc/client/hud/panel/racetimer.qc | 2 +- qcsrc/client/hud/panel/radar.qc | 2 +- qcsrc/client/hud/panel/score.qc | 2 +- qcsrc/client/hud/panel/scoreboard.qc | 10 +++++----- qcsrc/client/hud/panel/vote.qc | 2 +- qcsrc/client/main.qh | 2 ++ qcsrc/client/shownames.qc | 2 +- qcsrc/client/view.qc | 4 ++-- qcsrc/common/gamemodes/gamemode/nexball/nexball.qc | 2 +- 12 files changed, 20 insertions(+), 18 deletions(-) diff --git a/qcsrc/client/hud/panel/infomessages.qc b/qcsrc/client/hud/panel/infomessages.qc index 7b7d82b44..f63ffb1de 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -118,7 +118,7 @@ void HUD_InfoMessages() MUTATOR_CALLHOOK(DrawInfoMessages, pos, mySize); - if(!warmup_stage && gametype == MAPINFO_TYPE_LMS) + if(!warmup_stage && ISGAMETYPE(LMS)) { entity sk; sk = playerslots[player_localnum]; diff --git a/qcsrc/client/hud/panel/modicons.qc b/qcsrc/client/hud/panel/modicons.qc index 87e4a7fb2..4d1691a7f 100644 --- a/qcsrc/client/hud/panel/modicons.qc +++ b/qcsrc/client/hud/panel/modicons.qc @@ -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; - if(gametype == MAPINFO_TYPE_CA) + if(ISGAMETYPE(CA)) 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; @@ -528,7 +528,7 @@ void HUD_Mod_Race(vector pos, vector mySize) // clientside personal record string rr; - if(gametype == MAPINFO_TYPE_CTS) + if(ISGAMETYPE(CTS)) rr = CTS_RECORD; else rr = RACE_RECORD; diff --git a/qcsrc/client/hud/panel/physics.qc b/qcsrc/client/hud/panel/physics.qc index a6c65183d..aa77690a6 100644 --- a/qcsrc/client/hud/panel/physics.qc +++ b/qcsrc/client/hud/panel/physics.qc @@ -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 == 3 && !(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return; + if(autocvar_hud_panel_physics == 3 && !(ISGAMETYPE(RACE) || ISGAMETYPE(CTS))) return; } HUD_Panel_LoadCvars(); diff --git a/qcsrc/client/hud/panel/racetimer.qc b/qcsrc/client/hud/panel/racetimer.qc index 6a190f2ca..7d09cf1ff 100644 --- a/qcsrc/client/hud/panel/racetimer.qc +++ b/qcsrc/client/hud/panel/racetimer.qc @@ -98,7 +98,7 @@ void HUD_RaceTimer () 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; } diff --git a/qcsrc/client/hud/panel/radar.qc b/qcsrc/client/hud/panel/radar.qc index 9176aa0ff..cd4551725 100644 --- a/qcsrc/client/hud/panel/radar.qc +++ b/qcsrc/client/hud/panel/radar.qc @@ -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 ) - 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)) diff --git a/qcsrc/client/hud/panel/score.qc b/qcsrc/client/hud/panel/score.qc index 56fa5867c..525bf614b 100644 --- a/qcsrc/client/hud/panel/score.qc +++ b/qcsrc/client/hud/panel/score.qc @@ -140,7 +140,7 @@ void HUD_Score() 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(); diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 3d9e333ba..4989aac50 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -1145,7 +1145,7 @@ bool Scoreboard_WouldDraw() 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; @@ -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; - 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; @@ -1498,7 +1498,7 @@ float scoreboard_time; 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; @@ -1666,7 +1666,7 @@ void Scoreboard_Draw() 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; @@ -1707,7 +1707,7 @@ void Scoreboard_Draw() 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)); diff --git a/qcsrc/client/hud/panel/vote.qc b/qcsrc/client/hud/panel/vote.qc index 57b32039d..0337eccfc 100644 --- a/qcsrc/client/hud/panel/vote.qc +++ b/qcsrc/client/hud/panel/vote.qc @@ -9,7 +9,7 @@ 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 diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index 8a0e78a0d..f0f8f1d4b 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -11,6 +11,8 @@ string minimapname; bool postinit; entity gametype; +// temporary hack +#define ISGAMETYPE(NAME) (gametype == MAPINFO_TYPE_##NAME) float FONT_USER = 8; diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index eac36c1ae..2fc155949 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -128,7 +128,7 @@ void Draw_ShowNames(entity this) // 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) diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index b72998de6..8fba190c6 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1539,7 +1539,7 @@ void HUD_Draw(entity this) 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(); @@ -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"); - /*if(gametype == MAPINFO_TYPE_CTF) + /*if(ISGAMETYPE(CTF)) { ctf_view(); } else */ diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 89c53a82a..65c5bcd8a 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -7,7 +7,7 @@ REGISTER_MUTATOR(cl_nb, true); 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; } -- 2.39.2