From d352f333426d264f291a091a7b70e9f2babb2428 Mon Sep 17 00:00:00 2001 From: z411 Date: Sat, 7 Nov 2020 18:48:17 -0300 Subject: [PATCH] Showing alive players in CA/FT in scores panel instead --- qcsrc/client/autocvars.qh | 4 +-- qcsrc/client/hud/panel/modicons.qc | 2 -- qcsrc/client/hud/panel/score.qc | 30 +++++++++++++++++-- .../gamemode/clanarena/cl_clanarena.qc | 17 ++++++++++- .../gamemode/clanarena/cl_clanarena.qh | 7 +++-- .../gamemodes/gamemode/clanarena/clanarena.qh | 10 ++++--- .../gamemode/freezetag/cl_freezetag.qc | 7 +++-- .../gamemode/freezetag/cl_freezetag.qh | 2 +- .../gamemodes/gamemode/freezetag/freezetag.qh | 13 ++++---- qcsrc/common/mapinfo.qh | 7 +++-- 10 files changed, 71 insertions(+), 28 deletions(-) diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 2568cd4b6..2dc4686b6 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -271,8 +271,8 @@ bool autocvar_hud_panel_infomessages; bool autocvar_hud_panel_infomessages_flip; float autocvar_hud_panel_mapvote_highlight_border = 1; bool autocvar_hud_panel_modicons; -int autocvar_hud_panel_modicons_ca_layout; -int autocvar_hud_panel_modicons_freezetag_layout; +//int autocvar_hud_panel_modicons_ca_layout; +//int autocvar_hud_panel_modicons_freezetag_layout; bool autocvar_hud_panel_notify; float autocvar_hud_panel_notify_fadetime; float autocvar_hud_panel_notify_flip; diff --git a/qcsrc/client/hud/panel/modicons.qc b/qcsrc/client/hud/panel/modicons.qc index ff8f5bf65..29c4bfcaa 100644 --- a/qcsrc/client/hud/panel/modicons.qc +++ b/qcsrc/client/hud/panel/modicons.qc @@ -32,8 +32,6 @@ void HUD_ModIcons() if(!HUD_ModIcons_GameType) return; } - if(spectatee_status && teamplay) return; // z411 - if(mod_active || autocvar__hud_configure) mod_alpha = min(mod_alpha + frametime * 2, 1); else diff --git a/qcsrc/client/hud/panel/score.qc b/qcsrc/client/hud/panel/score.qc index 4dbb69cee..b4d6095e8 100644 --- a/qcsrc/client/hud/panel/score.qc +++ b/qcsrc/client/hud/panel/score.qc @@ -100,7 +100,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me) }*/ - // Basic team stats + // z411 Basic team stats if (team_count) { i = 0; @@ -123,10 +123,34 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me) drawfill(pos, eX * mySize.x + eY * fontsize.y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } - s = Team_CustomName(tm.team); - //s = textShortenToWidth(Team_ColorName(tm.team), name_size, fontsize, stringwidth_colors); score_color = Team_ColorRGB(tm.team) * 0.8; + // TODO secondary scores test, remove + if(gametype.m_modscores) + { + string icon; + if(tm.team == NUM_TEAM_1) + icon = "gfx/hud/luma/player_red"; + else if(tm.team == NUM_TEAM_2) + icon = "gfx/hud/luma/player_blue"; + else + icon = "gfx/hud/luma/player_neutral"; + + vector icon_sz = draw_getimagesize(icon); + vector icon_sz_new = vec2(fontsize.y*(icon_sz.x/icon_sz.y), fontsize.y); + + s = ftos(gametype.m_modscores(tm.team)); + float s_width = stringwidth(s, false, fontsize) + icon_sz_new.x; + + //drawfill(pos, eX * s_width + eY * fontsize.y, score_color, panel_fg_alpha * 0.3, DRAWFLAG_NORMAL); + drawpic(pos, icon, icon_sz_new, '1 1 1', panel_fg_alpha * 0.7, DRAWFLAG_NORMAL); + drawstring(pos + eX * icon_sz_new.x, s, fontsize, '1 1 1', panel_fg_alpha * 0.7, DRAWFLAG_NORMAL); + + s = textShortenToWidth(Team_CustomName(tm.team), name_size - s_width, fontsize, stringwidth_colors); + } else + s = textShortenToWidth(Team_CustomName(tm.team), name_size, fontsize, stringwidth_colors); + // TODO end + drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, true, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); draw_beginBoldFont(); diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/cl_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/cl_clanarena.qc index 65f21fdd2..771f4ebcd 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/cl_clanarena.qc +++ b/qcsrc/common/gamemodes/gamemode/clanarena/cl_clanarena.qc @@ -1,6 +1,6 @@ #include "cl_clanarena.qh" -#include +/*#include void HUD_Mod_CA_Export(int fh) { @@ -79,3 +79,18 @@ void HUD_Mod_CA(vector myPos, vector mySize) HUD_Mod_CA_Draw(myPos, mySize, autocvar_hud_panel_modicons_ca_layout); } +*/ +// Clan Arena and Freeze Tag scores +int HUD_Scores_CA(int team) +{ + switch(team) + { + case NUM_TEAM_1: return STAT(REDALIVE); + case NUM_TEAM_2: return STAT(BLUEALIVE); + case NUM_TEAM_3: return STAT(YELLOWALIVE); + default: + case NUM_TEAM_4: return STAT(PINKALIVE); + } + + return 0; +} \ No newline at end of file diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/cl_clanarena.qh b/qcsrc/common/gamemodes/gamemode/clanarena/cl_clanarena.qh index 7ccd5bbb2..6e7027de7 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/cl_clanarena.qh +++ b/qcsrc/common/gamemodes/gamemode/clanarena/cl_clanarena.qh @@ -1,5 +1,6 @@ #pragma once -void HUD_Mod_CA(vector myPos, vector mySize); -void HUD_Mod_CA_Draw(vector myPos, vector mySize, int layout); -void HUD_Mod_CA_Export(int fh); +//void HUD_Mod_CA(vector myPos, vector mySize); +//void HUD_Mod_CA_Draw(vector myPos, vector mySize, int layout); +//void HUD_Mod_CA_Export(int fh); +int HUD_Scores_CA(int team); diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh b/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh index 3b3dace64..27846b3ca 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh +++ b/qcsrc/common/gamemodes/gamemode/clanarena/clanarena.qh @@ -3,8 +3,9 @@ #include #ifdef CSQC -void HUD_Mod_CA(vector pos, vector mySize); -void HUD_Mod_CA_Export(int fh); +//void HUD_Mod_CA(vector pos, vector mySize); +//void HUD_Mod_CA_Export(int fh); +int HUD_Scores_CA(int team); #endif CLASS(ClanArena, Gametype) INIT(ClanArena) @@ -40,8 +41,9 @@ CLASS(ClanArena, Gametype) returns(menu, _("Frag limit:"), 5, 100, 5, "fraglimit_override", "g_ca_teams_override", _("The amount of frags needed before the match will end")); } #ifdef CSQC - ATTRIB(ClanArena, m_modicons, void(vector pos, vector mySize), HUD_Mod_CA); - ATTRIB(ClanArena, m_modicons_export, void(int fh), HUD_Mod_CA_Export); + //ATTRIB(ClanArena, m_modicons, void(vector pos, vector mySize), HUD_Mod_CA); + //ATTRIB(ClanArena, m_modicons_export, void(int fh), HUD_Mod_CA_Export); + ATTRIB(ClanArena, m_modscores, int(int team), HUD_Scores_CA); #endif ATTRIB(ClanArena, m_legacydefaults, string, "10 20 0"); ENDCLASS(ClanArena) diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/cl_freezetag.qc b/qcsrc/common/gamemodes/gamemode/freezetag/cl_freezetag.qc index df4931a37..85dbd4634 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/cl_freezetag.qc +++ b/qcsrc/common/gamemodes/gamemode/freezetag/cl_freezetag.qc @@ -1,8 +1,8 @@ #include "cl_freezetag.qh" -#include +//#include -void HUD_Mod_FreezeTag_Export(int fh) +/*void HUD_Mod_FreezeTag_Export(int fh) { HUD_Write_Cvar("hud_panel_modicons_freezetag_layout"); } @@ -12,4 +12,5 @@ void HUD_Mod_FreezeTag(vector myPos, vector mySize) mod_active = 1; // required in each mod function that always shows something HUD_Mod_CA_Draw(myPos, mySize, autocvar_hud_panel_modicons_freezetag_layout); -} +}*/ + diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/cl_freezetag.qh b/qcsrc/common/gamemodes/gamemode/freezetag/cl_freezetag.qh index 0d2f4407b..b464e5057 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/cl_freezetag.qh +++ b/qcsrc/common/gamemodes/gamemode/freezetag/cl_freezetag.qh @@ -1,3 +1,3 @@ #pragma once -void HUD_Mod_FreezeTag_Export(int fh); +//void HUD_Mod_FreezeTag_Export(int fh); diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/freezetag.qh b/qcsrc/common/gamemodes/gamemode/freezetag/freezetag.qh index 61d3b91e9..f9270bdec 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/freezetag.qh +++ b/qcsrc/common/gamemodes/gamemode/freezetag/freezetag.qh @@ -5,10 +5,10 @@ #include #endif -#ifdef CSQC -void HUD_Mod_FreezeTag(vector myPos, vector mySize); -void HUD_Mod_FreezeTag_Export(int fh); -#endif +//#ifdef CSQC +//void HUD_Mod_FreezeTag(vector myPos, vector mySize); +//void HUD_Mod_FreezeTag_Export(int fh); +//#endif CLASS(FreezeTag, Gametype) INIT(FreezeTag) { @@ -43,8 +43,9 @@ CLASS(FreezeTag, Gametype) returns(menu, _("Frag limit:"), 5, 100, 5, "fraglimit_override", "g_freezetag_teams_override", _("The amount of frags needed before the match will end")); } #ifdef CSQC - ATTRIB(FreezeTag, m_modicons, void(vector pos, vector mySize), HUD_Mod_FreezeTag); - ATTRIB(FreezeTag, m_modicons_export, void(int fh), HUD_Mod_FreezeTag_Export); + //ATTRIB(FreezeTag, m_modicons, void(vector pos, vector mySize), HUD_Mod_FreezeTag); + //ATTRIB(FreezeTag, m_modicons_export, void(int fh), HUD_Mod_FreezeTag_Export); + ATTRIB(FreezeTag, m_modscores, int(int team), HUD_Scores_CA); #endif ATTRIB(FreezeTag, m_legacydefaults, string, "10 20 0"); ENDCLASS(FreezeTag) diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index 2d350b2fe..2f0fc1be0 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -48,9 +48,10 @@ CLASS(Gametype, Object) /** game type priority in random selections */ ATTRIB(Gametype, m_priority, int, 0); #ifdef CSQC - ATTRIB(Gametype, m_modicons, void(vector pos, vector mySize)); - ATTRIB(Gametype, m_modicons_reset, void()); - ATTRIB(Gametype, m_modicons_export, void(int fh)); + //ATTRIB(Gametype, m_modicons, void(vector pos, vector mySize)); + //ATTRIB(Gametype, m_modicons_reset, void()); + //ATTRIB(Gametype, m_modicons_export, void(int fh)); + ATTRIB(Gametype, m_modscores, int(int team)); #endif /** DO NOT USE, this is compatibility for legacy maps! */ -- 2.39.2