From 646a9c1b57226ea31ba2d063b757537e8ee8f971 Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Wed, 30 Oct 2024 17:17:42 -0400 Subject: [PATCH 01/24] Initial save point on player stat bar in GHUD --- inc/shared/gameext.h | 6 +- src/action/g_local.h | 6 ++ src/action/p_hud.c | 167 ++++++++++++++++++++++++++++++++++++++--- src/action/tng_stats.c | 17 +++++ src/action/tng_stats.h | 1 + 5 files changed, 183 insertions(+), 14 deletions(-) diff --git a/inc/shared/gameext.h b/inc/shared/gameext.h index 0658a065c..8def97850 100644 --- a/inc/shared/gameext.h +++ b/inc/shared/gameext.h @@ -68,7 +68,8 @@ typedef struct { game_import_ex_t -These pointer functions exist in the engine (server), and this enables importing them to be available for use by the gamelib +These pointer functions exist in the engine (server), +and this enables importing them to be available for use by the gamelib server->gamedll @@ -91,7 +92,8 @@ typedef struct { game_export_ex_t -These pointer functions exist in the gamedll, and this enables importing them to be available for use by the engine (server) +These pointer functions exist in the gamedll, +and this enables importing them to be available for use by the engine (server) gamedll->server diff --git a/src/action/g_local.h b/src/action/g_local.h index f0fe2a607..24a177f5e 100644 --- a/src/action/g_local.h +++ b/src/action/g_local.h @@ -2955,6 +2955,12 @@ typedef enum { h_team_l_num, h_team_r, h_team_r_num, + h_spectator_stats, + h_spectator_timer, + h_spectator_time_tm, + h_spectator_time_mm, + h_spectator_time_ts, + h_spectator_time_ss, } huditem_t; void HUD_SetType(edict_t *clent, int type); diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 2bf04043d..5b8bb98ed 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -781,7 +781,7 @@ void HUD_SpectatorSetup(edict_t *clent) int i; if (teamplay->value && spectator_hud->value) - { + { // Left-side nameplates for (i = 0; i < 6; i++) { int x, y; @@ -820,6 +820,7 @@ void HUD_SpectatorSetup(edict_t *clent) Ghud_SetAnchor(clent, hud[h], 0, 0); } + // Right side nameplates for (i = 0; i < 6; i++) { int x, y; @@ -858,17 +859,113 @@ void HUD_SpectatorSetup(edict_t *clent) Ghud_SetAnchor(clent, hud[h], 1, 0); } - hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_teamskin[1], 24, 24); - Ghud_SetAnchor(clent, hud[h_team_l], 0, 0); - hud[h_team_l_num] = Ghud_AddNumber(clent, 96, 2, 0); - Ghud_SetSize(clent, hud[h_team_l_num], 2, 0); - Ghud_SetAnchor(clent, hud[h_team_l_num], 0, 0); - - hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_teamskin[2], 24, 24); - Ghud_SetAnchor(clent, hud[h_team_r], 1, 0); - hud[h_team_r_num] = Ghud_AddNumber(clent, -128, 2, 0); - Ghud_SetSize(clent, hud[h_team_r_num], 1, 0); - Ghud_SetAnchor(clent, hud[h_team_r_num], 1, 0); + if (1) { + // GHUD bottom center stat display + int x, y; + int h_base = h_spectator_stats; + int h; + + x = -640; + y = 480; + + h = h_base; // back bar + hud[h] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[h], x, y); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetSize(clent, hud[h], 288, 24); + Ghud_SetColor(clent, hud[h], 30, 60, 110, 255); + + h = h_base + 1; // name bar + hud[h] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[h], x, y - 16); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetSize(clent, hud[h], 20, 12); + Ghud_SetColor(clent, hud[h], 40, 80, 220, 255); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 2; // name print + hud[h] = Ghud_AddText(clent, x + 32, y + 32, ""); + Ghud_SetPosition(clent, hud[h], x, y - 16); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetSize(clent, hud[h], 20, 12); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 3; // stat table bar + hud[h] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[h], x, y + 16); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetSize(clent, hud[h], 0, 24); + Ghud_SetColor(clent, hud[h], 20, 40, 230, 255); + + h = h_base + 4; // stat table text + hud[h] = Ghud_AddText(clent, x, y, ""); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 5; // frags + hud[h] = Ghud_AddText(clent, x + 32, y + 14, ""); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 6; // deaths + hud[h] = Ghud_AddText(clent, x + 96, y + 14, ""); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 7; // damage + hud[h] = Ghud_AddText(clent, x + 120, y + 14, ""); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 8; // accuracy + hud[h] = Ghud_AddText(clent, x + 185, y + 14, ""); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + + + + + + h = h_base + 10; // weapon select + hud[h] = Ghud_AddIcon(clent, x - 680, y + 2, level.pic_items[M4_NUM], 20, 20); + Ghud_SetAnchor(clent, hud[h], 1, 0); + } + + if (timelimit->value) { + // GHUD top middle time display + int x, y; + int h_base = h_spectator_timer; + int h; + + x = -640; + y = 16; + + h = h_base; // timer area + hud[h] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[h], x, y); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetSize(clent, hud[h], 288, 24); + Ghud_SetColor(clent, hud[h], 0, 0, 0, 0); + hud[h_spectator_time_tm] = Ghud_AddNumber(clent, -128, 2, 0); + hud[h_spectator_time_mm] = Ghud_AddNumber(clent, -96, 2, 0); + hud[h_spectator_time_ts] = Ghud_AddNumber(clent, -64, 2, 0); + hud[h_spectator_time_ss] = Ghud_AddNumber(clent, -32, 2, 0); + + // GHUD top corner team icon + + hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_teamskin[1], 24, 24); + Ghud_SetAnchor(clent, hud[h_team_l], 0, 0); + hud[h_team_l_num] = Ghud_AddNumber(clent, 96, 2, 0); + Ghud_SetSize(clent, hud[h_team_l_num], 2, 0); + Ghud_SetAnchor(clent, hud[h_team_l_num], 0, 0); + + hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_teamskin[2], 24, 24); + Ghud_SetAnchor(clent, hud[h_team_r], 1, 0); + hud[h_team_r_num] = Ghud_AddNumber(clent, -128, 2, 0); + Ghud_SetSize(clent, hud[h_team_r_num], 1, 0); + Ghud_SetAnchor(clent, hud[h_team_r_num], 1, 0); + } } } @@ -1092,6 +1189,52 @@ void HUD_SpectatorUpdate(edict_t *clent) else // no weapon, set to mk23 Ghud_SetInt(clent, hud[h + 4], level.pic_items[MK23_NUM]); } + + // If we're chasing a target, display their stats + if (clent->client->chase_target) { + // GHUD bottom center stat display + Ghud_SetFlags(clent, hud[h_spectator_stats], 0); + Ghud_SetFlags(clent, hud[h_spectator_stats + 1], 0); + Ghud_SetFlags(clent, hud[h_spectator_stats + 2], 0); + Ghud_SetFlags(clent, hud[h_spectator_stats + 3], 0); + Ghud_SetFlags(clent, hud[h_spectator_stats + 4], 0); + Ghud_SetFlags(clent, hud[h_spectator_stats + 5], 0); + Ghud_SetFlags(clent, hud[h_spectator_stats + 6], 0); + + char nm_s[17]; + char frags_s[24]; + char deaths_s[24]; + char dmg_s[24]; + char acc_s[10]; + int x, y; + int h = h_spectator_stats; + edict_t *targ = clent->client->chase_target; + memcpy(nm_s, targ->client->pers.netname, 16); + snprintf(frags_s, sizeof(frags_s), "%i", targ->client->resp.kills); + snprintf(deaths_s, sizeof(deaths_s), "%i", targ->client->resp.deaths); + snprintf(dmg_s, sizeof(dmg_s), "%i", targ->client->resp.damage_dealt); + snprintf(acc_s, sizeof(acc_s), "%.2f%%", CalculateAccuracy(targ)); + // update fields + Ghud_SetText(clent, hud[h + 2], nm_s); + Ghud_SetText(clent, hud[h + 4], "Frags Deaths Damage Acc."); + Ghud_SetText(clent, hud[h + 5], frags_s); + Ghud_SetText(clent, hud[h + 6], deaths_s); + Ghud_SetText(clent, hud[h + 7], dmg_s); + Ghud_SetText(clent, hud[h + 8], acc_s); + } + + + + + + // GHUD top middle time display + Ghud_SetFlags(clent, hud[h_spectator_timer], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_tm], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_mm], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_ts], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_ss], 0); + + } } diff --git a/src/action/tng_stats.c b/src/action/tng_stats.c index 45d2c6dc0..c44691f60 100644 --- a/src/action/tng_stats.c +++ b/src/action/tng_stats.c @@ -837,6 +837,23 @@ void G_LoadScores(void) G_FreeFile(f); } +float CalculateAccuracy(edict_t* ent) +{ + int shots; + float accuracy; + + shots = ent->client->resp.shotsTotal; + + if (shots) + accuracy = (float)ent->client->resp.hitsTotal * 100.0f / (float)shots; + else + accuracy = 0.0f; + + // Round the accuracy to two decimal places + accuracy = roundf(accuracy * 100.0f) / 100.0f; + + return accuracy; +} #if USE_AQTION diff --git a/src/action/tng_stats.h b/src/action/tng_stats.h index 98303575d..3b62f7afc 100644 --- a/src/action/tng_stats.h +++ b/src/action/tng_stats.h @@ -3,6 +3,7 @@ void ResetStats(edict_t *ent); void Stats_AddShot(edict_t *ent, int gun); void Stats_AddHit(edict_t *ent, int gun, int hitPart); +float CalculateAccuracy(edict_t* ent); void A_ScoreboardEndLevel (edict_t * ent, edict_t * killer); void Cmd_Stats_f (edict_t *targetent, char *arg); void Cmd_Statmode_f(edict_t *ent); From f973eafbaeaa7ff7bb538eb4af60ed866afa6a05 Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Wed, 30 Oct 2024 20:29:22 -0400 Subject: [PATCH 02/24] Looking a little better --- src/action/g_local.h | 6 +- src/action/p_hud.c | 263 +++++++++++++++++++++++++++---------------- 2 files changed, 169 insertions(+), 100 deletions(-) diff --git a/src/action/g_local.h b/src/action/g_local.h index 24a177f5e..721a941bf 100644 --- a/src/action/g_local.h +++ b/src/action/g_local.h @@ -2955,8 +2955,10 @@ typedef enum { h_team_l_num, h_team_r, h_team_r_num, - h_spectator_stats, - h_spectator_timer, + h_spectator_stats = 66, + h_spectator_stats_bar = 72, + h_spectator_name_bar = 74, + h_spectator_timer = 76, h_spectator_time_tm, h_spectator_time_mm, h_spectator_time_ts, diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 5b8bb98ed..8e9130696 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -771,12 +771,103 @@ void HUD_ClientUpdate(edict_t *clent) } +void HUD_SpectatorStatsSetup(edict_t *clent) +{ + Ghud_ClearForClient(clent); + clent->client->resp.hud_type = 1; + int *hud = clent->client->resp.hud_items; + + // GHUD bottom center stat display + int x, y; + int h_base = h_spectator_stats; + int h_nbar = h_spectator_name_bar; + int h_sbar = h_spectator_stats_bar; + int h, j, k; + + x = -640; + y = 480; + + h = h_base; // back bar + hud[h] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[h], x, y + 12); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetSize(clent, hud[h], 288, 12); + Ghud_SetColor(clent, hud[h], 0, 0, 0, 0); + + h = h_base + 1; // frags + hud[h] = Ghud_AddText(clent, x + 32, y + 14, ""); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 2; // deaths + hud[h] = Ghud_AddText(clent, x + 96, y + 14, ""); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 3; // damage + hud[h] = Ghud_AddText(clent, x + 120, y + 14, ""); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 4; // accuracy + hud[h] = Ghud_AddText(clent, x + 185, y + 14, ""); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 10; // weapon selection + hud[h] = Ghud_AddIcon(clent, x - 680, y + 2, level.pic_items[M4_NUM], 20, 20); + Ghud_SetAnchor(clent, hud[h], 1, 0); + + j = h_nbar; // name bar + hud[j] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[j], x, y - 12); + Ghud_SetAnchor(clent, hud[j], 1, 0); + Ghud_SetSize(clent, hud[j], 288, 12); + Ghud_SetColor(clent, hud[j], 0, 0, 0, 0); + + j = h_nbar + 1; // name print + hud[j] = Ghud_AddText(clent, x, y + 12, ""); + Ghud_SetPosition(clent, hud[j], x + 120, y - 12); + Ghud_SetAnchor(clent, hud[j], 1, 0); + Ghud_SetSize(clent, hud[j], 20, 12); + Ghud_SetTextFlags(clent, hud[j], UI_CENTER); + + k = h_sbar; // stat table bar + hud[k] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[k], x, y); + Ghud_SetAnchor(clent, hud[k], 1, 0); + Ghud_SetSize(clent, hud[k], 0, 12); + Ghud_SetColor(clent, hud[k], 0, 0, 0, 0); + + k = h_sbar + 1; // stat table text + hud[k] = Ghud_AddText(clent, x, y, ""); + Ghud_SetAnchor(clent, hud[k], 1, 0); + Ghud_SetTextFlags(clent, hud[k], UI_LEFT); +} void HUD_SpectatorSetup(edict_t *clent) { Ghud_ClearForClient(clent); clent->client->resp.hud_type = 1; + int nameplate_alpha = 230; + + // Red team colors + int red_team_red = 220; + int red_team_green = 60; + int red_team_blue = 60; + int alt_red_team_red = 110; + int alt_red_team_green = 45; + int alt_red_team_blue = 45; + + // Blue team colors + int blue_team_red = 40; + int blue_team_green = 80; + int blue_team_blue = 220; + int alt_blue_team_red = 30; + int alt_blue_team_green = 60; + int alt_blue_team_blue = 110; + int *hud = clent->client->resp.hud_items; int i; @@ -796,14 +887,14 @@ void HUD_SpectatorSetup(edict_t *clent) Ghud_SetPosition(clent, hud[h], x, y); Ghud_SetAnchor(clent, hud[h], 0, 0); Ghud_SetSize(clent, hud[h], 144, 24); - Ghud_SetColor(clent, hud[h], 110, 45, 45, 230); + Ghud_SetColor(clent, hud[h], alt_red_team_red, alt_red_team_green, alt_red_team_blue, nameplate_alpha); h = h_base + 1; // health bar hud[h] = Ghud_NewElement(clent, GHT_FILL); Ghud_SetPosition(clent, hud[h], x, y); Ghud_SetAnchor(clent, hud[h], 0, 0); Ghud_SetSize(clent, hud[h], 0, 24); - Ghud_SetColor(clent, hud[h], 220, 60, 60, 230); + Ghud_SetColor(clent, hud[h], red_team_red, red_team_green, red_team_blue, nameplate_alpha); h = h_base + 2; // name hud[h] = Ghud_AddText(clent, x + 142, y + 3, ""); @@ -835,14 +926,14 @@ void HUD_SpectatorSetup(edict_t *clent) Ghud_SetPosition(clent, hud[h], x, y); Ghud_SetAnchor(clent, hud[h], 1, 0); Ghud_SetSize(clent, hud[h], 144, 24); - Ghud_SetColor(clent, hud[h], 30, 60, 110, 230); + Ghud_SetColor(clent, hud[h], alt_blue_team_red, alt_blue_team_green, alt_blue_team_blue, nameplate_alpha); h = h_base + 1; // health bar hud[h] = Ghud_NewElement(clent, GHT_FILL); Ghud_SetPosition(clent, hud[h], x, y); Ghud_SetAnchor(clent, hud[h], 1, 0); Ghud_SetSize(clent, hud[h], 0, 24); - Ghud_SetColor(clent, hud[h], 40, 80, 220, 230); + Ghud_SetColor(clent, hud[h], blue_team_red, blue_team_green, blue_team_blue, nameplate_alpha); h = h_base + 2; // name hud[h] = Ghud_AddText(clent, x + 2, y + 3, ""); @@ -859,79 +950,6 @@ void HUD_SpectatorSetup(edict_t *clent) Ghud_SetAnchor(clent, hud[h], 1, 0); } - if (1) { - // GHUD bottom center stat display - int x, y; - int h_base = h_spectator_stats; - int h; - - x = -640; - y = 480; - - h = h_base; // back bar - hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetSize(clent, hud[h], 288, 24); - Ghud_SetColor(clent, hud[h], 30, 60, 110, 255); - - h = h_base + 1; // name bar - hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y - 16); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetSize(clent, hud[h], 20, 12); - Ghud_SetColor(clent, hud[h], 40, 80, 220, 255); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); - - h = h_base + 2; // name print - hud[h] = Ghud_AddText(clent, x + 32, y + 32, ""); - Ghud_SetPosition(clent, hud[h], x, y - 16); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetSize(clent, hud[h], 20, 12); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); - - h = h_base + 3; // stat table bar - hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y + 16); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetSize(clent, hud[h], 0, 24); - Ghud_SetColor(clent, hud[h], 20, 40, 230, 255); - - h = h_base + 4; // stat table text - hud[h] = Ghud_AddText(clent, x, y, ""); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); - - h = h_base + 5; // frags - hud[h] = Ghud_AddText(clent, x + 32, y + 14, ""); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); - - h = h_base + 6; // deaths - hud[h] = Ghud_AddText(clent, x + 96, y + 14, ""); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); - - h = h_base + 7; // damage - hud[h] = Ghud_AddText(clent, x + 120, y + 14, ""); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); - - h = h_base + 8; // accuracy - hud[h] = Ghud_AddText(clent, x + 185, y + 14, ""); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); - - - - - - - h = h_base + 10; // weapon select - hud[h] = Ghud_AddIcon(clent, x - 680, y + 2, level.pic_items[M4_NUM], 20, 20); - Ghud_SetAnchor(clent, hud[h], 1, 0); - } - if (timelimit->value) { // GHUD top middle time display int x, y; @@ -1190,16 +1208,22 @@ void HUD_SpectatorUpdate(edict_t *clent) Ghud_SetInt(clent, hud[h + 4], level.pic_items[MK23_NUM]); } + int h_base = h_spectator_stats; + int h_nbar = h_spectator_name_bar; + int h_sbar = h_spectator_stats_bar; // If we're chasing a target, display their stats if (clent->client->chase_target) { + HUD_SpectatorStatsSetup(clent); // GHUD bottom center stat display Ghud_SetFlags(clent, hud[h_spectator_stats], 0); Ghud_SetFlags(clent, hud[h_spectator_stats + 1], 0); Ghud_SetFlags(clent, hud[h_spectator_stats + 2], 0); Ghud_SetFlags(clent, hud[h_spectator_stats + 3], 0); Ghud_SetFlags(clent, hud[h_spectator_stats + 4], 0); - Ghud_SetFlags(clent, hud[h_spectator_stats + 5], 0); - Ghud_SetFlags(clent, hud[h_spectator_stats + 6], 0); + Ghud_SetFlags(clent, hud[h_spectator_name_bar], 0); + Ghud_SetFlags(clent, hud[h_spectator_name_bar + 1], 0); + Ghud_SetFlags(clent, hud[h_spectator_stats_bar], 0); + Ghud_SetFlags(clent, hud[h_spectator_stats_bar + 1], 0); char nm_s[17]; char frags_s[24]; @@ -1207,7 +1231,6 @@ void HUD_SpectatorUpdate(edict_t *clent) char dmg_s[24]; char acc_s[10]; int x, y; - int h = h_spectator_stats; edict_t *targ = clent->client->chase_target; memcpy(nm_s, targ->client->pers.netname, 16); snprintf(frags_s, sizeof(frags_s), "%i", targ->client->resp.kills); @@ -1215,26 +1238,70 @@ void HUD_SpectatorUpdate(edict_t *clent) snprintf(dmg_s, sizeof(dmg_s), "%i", targ->client->resp.damage_dealt); snprintf(acc_s, sizeof(acc_s), "%.2f%%", CalculateAccuracy(targ)); // update fields - Ghud_SetText(clent, hud[h + 2], nm_s); - Ghud_SetText(clent, hud[h + 4], "Frags Deaths Damage Acc."); - Ghud_SetText(clent, hud[h + 5], frags_s); - Ghud_SetText(clent, hud[h + 6], deaths_s); - Ghud_SetText(clent, hud[h + 7], dmg_s); - Ghud_SetText(clent, hud[h + 8], acc_s); - } - - - - - - // GHUD top middle time display - Ghud_SetFlags(clent, hud[h_spectator_timer], 0); - Ghud_SetFlags(clent, hud[h_spectator_time_tm], 0); - Ghud_SetFlags(clent, hud[h_spectator_time_mm], 0); - Ghud_SetFlags(clent, hud[h_spectator_time_ts], 0); - Ghud_SetFlags(clent, hud[h_spectator_time_ss], 0); + // Change color based on team + int nameplate_alpha = 200; + + // Red team colors + int red_team_red = 220; + int red_team_green = 60; + int red_team_blue = 60; + int alt_red_team_red = 110; + int alt_red_team_green = 45; + int alt_red_team_blue = 45; + + // Blue team colors + int blue_team_red = 40; + int blue_team_green = 80; + int blue_team_blue = 220; + int alt_blue_team_red = 30; + int alt_blue_team_green = 60; + int alt_blue_team_blue = 110; + + // Green team colors + int green_team_red = 40; + int green_team_green = 220; + int green_team_blue = 40; + int alt_green_team_red = 30; + int alt_green_team_green = 140; + int alt_green_team_blue = 30; + + // target name + Ghud_SetText(clent, hud[h_nbar + 1], nm_s); + // target stat bar + Ghud_SetText(clent, hud[h_sbar + 1], "Frags Deaths Damage Acc."); + // target stat values + Ghud_SetText(clent, hud[h_base + 1], frags_s); + Ghud_SetText(clent, hud[h_base + 2], deaths_s); + Ghud_SetText(clent, hud[h_base + 3], dmg_s); + Ghud_SetText(clent, hud[h_base + 4], acc_s); + + // Color per team + if (clent->client->chase_target) { + if (targ->client->resp.team == TEAM1) { + Ghud_SetColor(clent, hud[h_nbar], 150, 150, 150, nameplate_alpha); + Ghud_SetColor(clent, hud[h_sbar], alt_red_team_red, alt_red_team_green, alt_red_team_blue, 255); + Ghud_SetColor(clent, hud[h_base], red_team_red, red_team_green, red_team_blue, 255); + } else if (targ->client->resp.team == TEAM2) { + Ghud_SetColor(clent, hud[h_nbar], 150, 150, 150, nameplate_alpha); + Ghud_SetColor(clent, hud[h_sbar], alt_blue_team_red, alt_blue_team_green, alt_blue_team_blue, 255); + Ghud_SetColor(clent, hud[h_base], blue_team_red, blue_team_green, blue_team_blue, 255); + } else if (targ->client->resp.team == TEAM3) { + Ghud_SetColor(clent, hud[h_nbar], 150, 150, 150, nameplate_alpha); + Ghud_SetColor(clent, hud[h_sbar], alt_green_team_red, alt_green_team_green, alt_green_team_blue, 255); + Ghud_SetColor(clent, hud[h_base], green_team_red, green_team_green, green_team_blue, 255); + } + } + } + if (timelimit->value) { + // GHUD top middle time display + Ghud_SetFlags(clent, hud[h_spectator_timer], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_tm], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_mm], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_ts], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_ss], 0); + } } } From 2a108c65f32dfbae1d30347a3041f83f5b1d9dd6 Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Thu, 31 Oct 2024 15:15:20 -0400 Subject: [PATCH 03/24] Re-colorized, fixed stat bar drawing --- src/action/p_hud.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 8e9130696..3bc04b919 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -836,7 +836,7 @@ void HUD_SpectatorStatsSetup(edict_t *clent) hud[k] = Ghud_NewElement(clent, GHT_FILL); Ghud_SetPosition(clent, hud[k], x, y); Ghud_SetAnchor(clent, hud[k], 1, 0); - Ghud_SetSize(clent, hud[k], 0, 12); + Ghud_SetSize(clent, hud[k], 288, 12); Ghud_SetColor(clent, hud[k], 0, 0, 0, 0); k = h_sbar + 1; // stat table text @@ -1240,7 +1240,7 @@ void HUD_SpectatorUpdate(edict_t *clent) // update fields // Change color based on team - int nameplate_alpha = 200; + int nameplate_alpha = 180; // Red team colors int red_team_red = 220; @@ -1279,17 +1279,17 @@ void HUD_SpectatorUpdate(edict_t *clent) // Color per team if (clent->client->chase_target) { if (targ->client->resp.team == TEAM1) { - Ghud_SetColor(clent, hud[h_nbar], 150, 150, 150, nameplate_alpha); + Ghud_SetColor(clent, hud[h_nbar], red_team_red, red_team_green, red_team_blue, nameplate_alpha); Ghud_SetColor(clent, hud[h_sbar], alt_red_team_red, alt_red_team_green, alt_red_team_blue, 255); - Ghud_SetColor(clent, hud[h_base], red_team_red, red_team_green, red_team_blue, 255); + Ghud_SetColor(clent, hud[h_base], 150, 150, 150, 255); } else if (targ->client->resp.team == TEAM2) { - Ghud_SetColor(clent, hud[h_nbar], 150, 150, 150, nameplate_alpha); + Ghud_SetColor(clent, hud[h_nbar], blue_team_red, blue_team_green, blue_team_blue, nameplate_alpha); Ghud_SetColor(clent, hud[h_sbar], alt_blue_team_red, alt_blue_team_green, alt_blue_team_blue, 255); - Ghud_SetColor(clent, hud[h_base], blue_team_red, blue_team_green, blue_team_blue, 255); + Ghud_SetColor(clent, hud[h_base], 150, 150, 150, 255); } else if (targ->client->resp.team == TEAM3) { - Ghud_SetColor(clent, hud[h_nbar], 150, 150, 150, nameplate_alpha); + Ghud_SetColor(clent, hud[h_nbar], green_team_red, green_team_green, green_team_blue, nameplate_alpha); Ghud_SetColor(clent, hud[h_sbar], alt_green_team_red, alt_green_team_green, alt_green_team_blue, 255); - Ghud_SetColor(clent, hud[h_base], green_team_red, green_team_green, green_team_blue, 255); + Ghud_SetColor(clent, hud[h_base], 150, 150, 150, 255); } } } From a24112dc629defd73b7b0074cb63947956cd3dee Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Thu, 31 Oct 2024 15:46:06 -0400 Subject: [PATCH 04/24] Fixed team 1 bug --- src/action/p_hud.c | 53 ++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 3bc04b919..0ae5a2dd7 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -773,7 +773,6 @@ void HUD_ClientUpdate(edict_t *clent) void HUD_SpectatorStatsSetup(edict_t *clent) { - Ghud_ClearForClient(clent); clent->client->resp.hud_type = 1; int *hud = clent->client->resp.hud_items; @@ -792,7 +791,8 @@ void HUD_SpectatorStatsSetup(edict_t *clent) Ghud_SetPosition(clent, hud[h], x, y + 12); Ghud_SetAnchor(clent, hud[h], 1, 0); Ghud_SetSize(clent, hud[h], 288, 12); - Ghud_SetColor(clent, hud[h], 0, 0, 0, 0); + Ghud_SetFlags(clent, hud[h], GHF_HIDE); + //Ghud_SetColor(clent, hud[h], 0, 0, 0, 0); h = h_base + 1; // frags hud[h] = Ghud_AddText(clent, x + 32, y + 14, ""); @@ -823,7 +823,8 @@ void HUD_SpectatorStatsSetup(edict_t *clent) Ghud_SetPosition(clent, hud[j], x, y - 12); Ghud_SetAnchor(clent, hud[j], 1, 0); Ghud_SetSize(clent, hud[j], 288, 12); - Ghud_SetColor(clent, hud[j], 0, 0, 0, 0); + //Ghud_SetColor(clent, hud[j], 0, 0, 0, 0); + Ghud_SetFlags(clent, hud[j], GHF_HIDE); j = h_nbar + 1; // name print hud[j] = Ghud_AddText(clent, x, y + 12, ""); @@ -837,7 +838,8 @@ void HUD_SpectatorStatsSetup(edict_t *clent) Ghud_SetPosition(clent, hud[k], x, y); Ghud_SetAnchor(clent, hud[k], 1, 0); Ghud_SetSize(clent, hud[k], 288, 12); - Ghud_SetColor(clent, hud[k], 0, 0, 0, 0); + //Ghud_SetColor(clent, hud[k], 0, 0, 0, 0); + Ghud_SetFlags(clent, hud[k], GHF_HIDE); k = h_sbar + 1; // stat table text hud[k] = Ghud_AddText(clent, x, y, ""); @@ -950,6 +952,9 @@ void HUD_SpectatorSetup(edict_t *clent) Ghud_SetAnchor(clent, hud[h], 1, 0); } + // GHUD chase player stats + HUD_SpectatorStatsSetup(clent); + if (timelimit->value) { // GHUD top middle time display int x, y; @@ -969,21 +974,21 @@ void HUD_SpectatorSetup(edict_t *clent) hud[h_spectator_time_mm] = Ghud_AddNumber(clent, -96, 2, 0); hud[h_spectator_time_ts] = Ghud_AddNumber(clent, -64, 2, 0); hud[h_spectator_time_ss] = Ghud_AddNumber(clent, -32, 2, 0); - + } // GHUD top corner team icon - hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_teamskin[1], 24, 24); - Ghud_SetAnchor(clent, hud[h_team_l], 0, 0); - hud[h_team_l_num] = Ghud_AddNumber(clent, 96, 2, 0); - Ghud_SetSize(clent, hud[h_team_l_num], 2, 0); - Ghud_SetAnchor(clent, hud[h_team_l_num], 0, 0); + hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_teamskin[1], 24, 24); + Ghud_SetAnchor(clent, hud[h_team_l], 0, 0); + hud[h_team_l_num] = Ghud_AddNumber(clent, 96, 2, 0); + Ghud_SetSize(clent, hud[h_team_l_num], 2, 0); + Ghud_SetAnchor(clent, hud[h_team_l_num], 0, 0); + + hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_teamskin[2], 24, 24); + Ghud_SetAnchor(clent, hud[h_team_r], 1, 0); + hud[h_team_r_num] = Ghud_AddNumber(clent, -128, 2, 0); + Ghud_SetSize(clent, hud[h_team_r_num], 1, 0); + Ghud_SetAnchor(clent, hud[h_team_r_num], 1, 0); - hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_teamskin[2], 24, 24); - Ghud_SetAnchor(clent, hud[h_team_r], 1, 0); - hud[h_team_r_num] = Ghud_AddNumber(clent, -128, 2, 0); - Ghud_SetSize(clent, hud[h_team_r_num], 1, 0); - Ghud_SetAnchor(clent, hud[h_team_r_num], 1, 0); - } } } @@ -997,7 +1002,7 @@ void HUD_SpectatorUpdate(edict_t *clent) if (!(clent->client->pers.spec_flags & SPECFL_SPECHUD_NEW)) // hide all elements since client doesn't want them { - for (i = 0; i <= h_team_r_num; i++) + for (i = 0; i <= h_spectator_time_ss; i++) { Ghud_SetFlags(clent, hud[i], GHF_HIDE); } @@ -1212,8 +1217,10 @@ void HUD_SpectatorUpdate(edict_t *clent) int h_nbar = h_spectator_name_bar; int h_sbar = h_spectator_stats_bar; // If we're chasing a target, display their stats + + //gi.dprintf("chase target: %s\n", clent->client->chase_target ? clent->client->chase_target->client->pers.netname : "none"); + //gi.dprintf("chase target mode: %i\n", clent->client->chase_mode); if (clent->client->chase_target) { - HUD_SpectatorStatsSetup(clent); // GHUD bottom center stat display Ghud_SetFlags(clent, hud[h_spectator_stats], 0); Ghud_SetFlags(clent, hud[h_spectator_stats + 1], 0); @@ -1292,6 +1299,16 @@ void HUD_SpectatorUpdate(edict_t *clent) Ghud_SetColor(clent, hud[h_base], 150, 150, 150, 255); } } + } else { // Hide the stats if we're not chasing a target + Ghud_SetFlags(clent, hud[h_spectator_stats], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_stats + 1], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_stats + 2], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_stats + 3], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_stats + 4], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_name_bar], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_name_bar + 1], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_stats_bar], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_stats_bar + 1], GHF_HIDE); } if (timelimit->value) { From 7c4cab9c490aa049660c6681c71348e766cacb5d Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Thu, 31 Oct 2024 17:05:27 -0400 Subject: [PATCH 05/24] Added center clock timer --- src/action/g_local.h | 9 +-- src/action/p_hud.c | 130 +++++++++++++++++++++++++++++++++---------- 2 files changed, 105 insertions(+), 34 deletions(-) diff --git a/src/action/g_local.h b/src/action/g_local.h index 721a941bf..bfaaf522c 100644 --- a/src/action/g_local.h +++ b/src/action/g_local.h @@ -2955,14 +2955,15 @@ typedef enum { h_team_l_num, h_team_r, h_team_r_num, - h_spectator_stats = 66, - h_spectator_stats_bar = 72, - h_spectator_name_bar = 74, - h_spectator_timer = 76, + h_spectator_stats = 66, // display up to 5 stats at once + h_spectator_stats_bar = 73, // h_spectator_stats_bar text is 74 + h_spectator_name_bar = 75, // h_spectator_name_bar text is 76 + h_spectator_timer = 77, h_spectator_time_tm, h_spectator_time_mm, h_spectator_time_ts, h_spectator_time_ss, + h_spectator_time_sep, // Time seperator (:) } huditem_t; void HUD_SetType(edict_t *clent, int type); diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 0ae5a2dd7..3ec31f56d 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -770,6 +770,100 @@ void HUD_ClientUpdate(edict_t *clent) { } +typedef enum { + tm = 0, + mm = 1, + ts = 2, + ss = 3 +} hud_time_digits; + +static int GetRemainingTimeDigits(hud_time_digits timeval) +{ + int remaining = 0, rmins = 0, rsecs = 0, gametime = 0; + + gametime = level.matchTime; + + remaining = (timelimit->value * 60) - gametime; + + rmins = remaining / 60; + rsecs = remaining % 60; + + switch (timeval) { + case tm: // Tens of minutes + return (rmins / 10) % 10; + case mm: // Minutes + return rmins % 10; + case ts: // Tens of seconds + return (rsecs / 10) % 10; + case ss: // Seconds + return rsecs % 10; + default: + return -1; // Invalid timeval + } +} + +static void HUD_UpdateSpectatorTimer(edict_t *clent) +{ + int *hud = clent->client->resp.hud_items; + + // Update the HUD elements with the individual digits + Ghud_SetInt(clent, hud[h_spectator_time_tm], GetRemainingTimeDigits(tm)); + Ghud_SetInt(clent, hud[h_spectator_time_mm], GetRemainingTimeDigits(mm)); + Ghud_SetInt(clent, hud[h_spectator_time_ts], GetRemainingTimeDigits(ts)); + Ghud_SetInt(clent, hud[h_spectator_time_ss], GetRemainingTimeDigits(ss)); + + if (GetRemainingTimeDigits(tm) == 0 && GetRemainingTimeDigits(mm) < 1) { + // Change bar color to red + Ghud_SetColor(clent, hud[h_spectator_timer], 255, 0, 0, 120); + } else if (GetRemainingTimeDigits(tm) == 0 && GetRemainingTimeDigits(mm) < 3) + { + // Change bar color to orange + Ghud_SetColor(clent, hud[h_spectator_timer], 255, 165, 0, 120); + } + +} + +void HUD_SpectatorTimerSetup(edict_t *clent) +{ + int h_base = h_spectator_timer; + int h; + h = h_base; // timer area + int *hud = clent->client->resp.hud_items; + + if (timelimit->value) { + // GHUD top middle time display + clent->client->resp.hud_type = 1; + + // GHUD bottom center stat display + int x, y; + + x = 450; + y = 16; + + hud[h] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[h], x, y + 12); + Ghud_SetAnchor(clent, hud[h], 0, 0); + Ghud_SetSize(clent, hud[h], 90, -48); + Ghud_SetColor(clent, hud[h], 50, 130, 50, 120); + + // Add number elements for minutes + hud[h_spectator_time_tm] = Ghud_AddNumber(clent, x, 2, 0); + hud[h_spectator_time_mm] = Ghud_AddNumber(clent, x + 20, 2, 0); + + // Draw timer seperator + hud[h_spectator_time_sep] = Ghud_AddText(clent, x + 40, y - 4 , ":"); + + // Add number elements for seconds + hud[h_spectator_time_ts] = Ghud_AddNumber(clent, x + 50, 2, 0); + hud[h_spectator_time_ss] = Ghud_AddNumber(clent, x + 70, 2, 0); + } else { + Ghud_SetFlags(clent, hud[h_spectator_time_tm], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_mm], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_sep], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_ts], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_ss], GHF_HIDE); + } +} void HUD_SpectatorStatsSetup(edict_t *clent) { @@ -955,28 +1049,10 @@ void HUD_SpectatorSetup(edict_t *clent) // GHUD chase player stats HUD_SpectatorStatsSetup(clent); - if (timelimit->value) { - // GHUD top middle time display - int x, y; - int h_base = h_spectator_timer; - int h; - - x = -640; - y = 16; - - h = h_base; // timer area - hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetSize(clent, hud[h], 288, 24); - Ghud_SetColor(clent, hud[h], 0, 0, 0, 0); - hud[h_spectator_time_tm] = Ghud_AddNumber(clent, -128, 2, 0); - hud[h_spectator_time_mm] = Ghud_AddNumber(clent, -96, 2, 0); - hud[h_spectator_time_ts] = Ghud_AddNumber(clent, -64, 2, 0); - hud[h_spectator_time_ss] = Ghud_AddNumber(clent, -32, 2, 0); - } - // GHUD top corner team icon - + // GHUD top middle time display + HUD_SpectatorTimerSetup(clent); + + // GHUD top corner team icon hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_teamskin[1], 24, 24); Ghud_SetAnchor(clent, hud[h_team_l], 0, 0); hud[h_team_l_num] = Ghud_AddNumber(clent, 96, 2, 0); @@ -1311,14 +1387,8 @@ void HUD_SpectatorUpdate(edict_t *clent) Ghud_SetFlags(clent, hud[h_spectator_stats_bar + 1], GHF_HIDE); } - if (timelimit->value) { - // GHUD top middle time display - Ghud_SetFlags(clent, hud[h_spectator_timer], 0); - Ghud_SetFlags(clent, hud[h_spectator_time_tm], 0); - Ghud_SetFlags(clent, hud[h_spectator_time_mm], 0); - Ghud_SetFlags(clent, hud[h_spectator_time_ts], 0); - Ghud_SetFlags(clent, hud[h_spectator_time_ss], 0); - } + // Update the timer display + HUD_UpdateSpectatorTimer(clent); } } From a51878fd53ff24377bd15bfadd18e411fb0b99bd Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Thu, 31 Oct 2024 17:11:24 -0400 Subject: [PATCH 06/24] Hiding timer if timelimit is 0 --- src/action/p_hud.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 3ec31f56d..5422acd45 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -1313,7 +1313,6 @@ void HUD_SpectatorUpdate(edict_t *clent) char deaths_s[24]; char dmg_s[24]; char acc_s[10]; - int x, y; edict_t *targ = clent->client->chase_target; memcpy(nm_s, targ->client->pers.netname, 16); snprintf(frags_s, sizeof(frags_s), "%i", targ->client->resp.kills); @@ -1388,7 +1387,16 @@ void HUD_SpectatorUpdate(edict_t *clent) } // Update the timer display - HUD_UpdateSpectatorTimer(clent); + if (timelimit->value) { + HUD_UpdateSpectatorTimer(clent); + } else { + Ghud_SetFlags(clent, hud[h_spectator_timer], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_tm], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_mm], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_sep], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_ts], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_ss], GHF_HIDE); + } } } From e2c2c732ebf4aa129cb9edfe65b4b1e1252ff912 Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Thu, 31 Oct 2024 17:50:13 -0400 Subject: [PATCH 07/24] Reduced timer border thickness --- src/action/g_local.h | 1 + src/action/p_hud.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/action/g_local.h b/src/action/g_local.h index bfaaf522c..8386f22d4 100644 --- a/src/action/g_local.h +++ b/src/action/g_local.h @@ -2959,6 +2959,7 @@ typedef enum { h_spectator_stats_bar = 73, // h_spectator_stats_bar text is 74 h_spectator_name_bar = 75, // h_spectator_name_bar text is 76 h_spectator_timer = 77, + h_spectator_timer_border, h_spectator_time_tm, h_spectator_time_mm, h_spectator_time_ts, diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 5422acd45..cee9d3e57 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -814,11 +814,14 @@ static void HUD_UpdateSpectatorTimer(edict_t *clent) if (GetRemainingTimeDigits(tm) == 0 && GetRemainingTimeDigits(mm) < 1) { // Change bar color to red - Ghud_SetColor(clent, hud[h_spectator_timer], 255, 0, 0, 120); + Ghud_SetColor(clent, hud[h_spectator_timer_border], 255, 0, 0, 120); } else if (GetRemainingTimeDigits(tm) == 0 && GetRemainingTimeDigits(mm) < 3) { // Change bar color to orange - Ghud_SetColor(clent, hud[h_spectator_timer], 255, 165, 0, 120); + Ghud_SetColor(clent, hud[h_spectator_timer_border], 255, 165, 0, 120); + } else { + // Change bar color to green + Ghud_SetColor(clent, hud[h_spectator_timer_border], 50, 150, 50, 120); } } @@ -837,18 +840,25 @@ void HUD_SpectatorTimerSetup(edict_t *clent) // GHUD bottom center stat display int x, y; - x = 450; + x = 470; y = 16; + hud[h_spectator_timer_border] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[h_spectator_timer_border], x - 1, y - 18); + Ghud_SetAnchor(clent, hud[h_spectator_timer_border], 0, 0); + Ghud_SetSize(clent, hud[h_spectator_timer_border], 92, 31); + Ghud_SetColor(clent, hud[h_spectator_timer_border], 50, 150, 50, 120); + hud[h] = Ghud_NewElement(clent, GHT_FILL); Ghud_SetPosition(clent, hud[h], x, y + 12); Ghud_SetAnchor(clent, hud[h], 0, 0); Ghud_SetSize(clent, hud[h], 90, -48); - Ghud_SetColor(clent, hud[h], 50, 130, 50, 120); + Ghud_SetColor(clent, hud[h], 50, 50, 50, 255); // Add number elements for minutes hud[h_spectator_time_tm] = Ghud_AddNumber(clent, x, 2, 0); hud[h_spectator_time_mm] = Ghud_AddNumber(clent, x + 20, 2, 0); + // Draw timer seperator hud[h_spectator_time_sep] = Ghud_AddText(clent, x + 40, y - 4 , ":"); @@ -1390,6 +1400,7 @@ void HUD_SpectatorUpdate(edict_t *clent) if (timelimit->value) { HUD_UpdateSpectatorTimer(clent); } else { + Ghud_SetFlags(clent, hud[h_spectator_timer_border], GHF_HIDE); Ghud_SetFlags(clent, hud[h_spectator_timer], GHF_HIDE); Ghud_SetFlags(clent, hud[h_spectator_time_tm], GHF_HIDE); Ghud_SetFlags(clent, hud[h_spectator_time_mm], GHF_HIDE); From 08ce49c585d2d619e83ebc1122c913af34c1b7d6 Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Thu, 31 Oct 2024 20:10:09 -0400 Subject: [PATCH 08/24] SetAnchor'd timer --- src/action/g_ext.c | 5 +++++ src/action/p_hud.c | 48 ++++++++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/action/g_ext.c b/src/action/g_ext.c index ed99a157e..df64bc866 100644 --- a/src/action/g_ext.c +++ b/src/action/g_ext.c @@ -413,6 +413,11 @@ void Ghud_SetSize(edict_t *ent, int i, int x, int y) engine_Ghud_SetSize(ent, i, x, y); } +// anchor is a float from 0 to 1, 0 being left/top, 1 being right/bottom +// for example, 0.5, 0.5 is center +// 0, 0 is top left +// 1, 1 is bottom right + void Ghud_SetAnchor(edict_t *ent, int i, float x, float y) { if (!engine_Ghud_SetAnchor) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index cee9d3e57..5e3262cb2 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -815,22 +815,18 @@ static void HUD_UpdateSpectatorTimer(edict_t *clent) if (GetRemainingTimeDigits(tm) == 0 && GetRemainingTimeDigits(mm) < 1) { // Change bar color to red Ghud_SetColor(clent, hud[h_spectator_timer_border], 255, 0, 0, 120); - } else if (GetRemainingTimeDigits(tm) == 0 && GetRemainingTimeDigits(mm) < 3) - { + } else if (GetRemainingTimeDigits(tm) == 0 && GetRemainingTimeDigits(mm) < 3){ // Change bar color to orange Ghud_SetColor(clent, hud[h_spectator_timer_border], 255, 165, 0, 120); } else { // Change bar color to green - Ghud_SetColor(clent, hud[h_spectator_timer_border], 50, 150, 50, 120); + Ghud_SetColor(clent, hud[h_spectator_timer_border], 20, 20, 20, 255); } } void HUD_SpectatorTimerSetup(edict_t *clent) { - int h_base = h_spectator_timer; - int h; - h = h_base; // timer area int *hud = clent->client->resp.hud_items; if (timelimit->value) { @@ -839,33 +835,39 @@ void HUD_SpectatorTimerSetup(edict_t *clent) // GHUD bottom center stat display int x, y; - - x = 470; - y = 16; + x = 0; + y = 0; hud[h_spectator_timer_border] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h_spectator_timer_border], x - 1, y - 18); - Ghud_SetAnchor(clent, hud[h_spectator_timer_border], 0, 0); - Ghud_SetSize(clent, hud[h_spectator_timer_border], 92, 31); + Ghud_SetAnchor(clent, hud[h_spectator_timer_border], 0.5, 0); + Ghud_SetPosition(clent, hud[h_spectator_timer_border], x - 51, y); + Ghud_SetSize(clent, hud[h_spectator_timer_border], 102, 31); Ghud_SetColor(clent, hud[h_spectator_timer_border], 50, 150, 50, 120); - hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y + 12); - Ghud_SetAnchor(clent, hud[h], 0, 0); - Ghud_SetSize(clent, hud[h], 90, -48); - Ghud_SetColor(clent, hud[h], 50, 50, 50, 255); + hud[h_spectator_timer] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetAnchor(clent, hud[h_spectator_timer], 0.5, 0); + Ghud_SetPosition(clent, hud[h_spectator_timer], x - 50, y); + Ghud_SetSize(clent, hud[h_spectator_timer], 100, 30); + Ghud_SetColor(clent, hud[h_spectator_timer], 50, 50, 50, 255); // Add number elements for minutes - hud[h_spectator_time_tm] = Ghud_AddNumber(clent, x, 2, 0); - hud[h_spectator_time_mm] = Ghud_AddNumber(clent, x + 20, 2, 0); - + hud[h_spectator_time_tm] = Ghud_AddNumber(clent, x - 50, 2, 0); + hud[h_spectator_time_mm] = Ghud_AddNumber(clent, x - 30, 2, 0); // Draw timer seperator - hud[h_spectator_time_sep] = Ghud_AddText(clent, x + 40, y - 4 , ":"); + hud[h_spectator_time_sep] = Ghud_AddText(clent, x - 5, y + 12, ":"); // Add number elements for seconds - hud[h_spectator_time_ts] = Ghud_AddNumber(clent, x + 50, 2, 0); - hud[h_spectator_time_ss] = Ghud_AddNumber(clent, x + 70, 2, 0); + hud[h_spectator_time_ts] = Ghud_AddNumber(clent, x + 10, 2, 0); + hud[h_spectator_time_ss] = Ghud_AddNumber(clent, x + 30, 2, 0); + + // Anchor everything to the top middle + Ghud_SetAnchor(clent, hud[h_spectator_time_tm], 0.5, 0); + Ghud_SetAnchor(clent, hud[h_spectator_time_mm], 0.5, 0); + Ghud_SetAnchor(clent, hud[h_spectator_time_sep], 0.5, 0); + Ghud_SetAnchor(clent, hud[h_spectator_time_ts], 0.5, 0); + Ghud_SetAnchor(clent, hud[h_spectator_time_ss], 0.5, 0); + } else { Ghud_SetFlags(clent, hud[h_spectator_time_tm], GHF_HIDE); Ghud_SetFlags(clent, hud[h_spectator_time_mm], GHF_HIDE); From e1bd23240e189e49cde6303bd47a0b6df47fdaa6 Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Thu, 31 Oct 2024 20:50:52 -0400 Subject: [PATCH 09/24] Using SetAnchor, center stat bar compatible with scr_scale --- src/action/g_ext.c | 10 ++++---- src/action/p_hud.c | 58 ++++++++++++++++++++++++++-------------------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/src/action/g_ext.c b/src/action/g_ext.c index df64bc866..aded396fc 100644 --- a/src/action/g_ext.c +++ b/src/action/g_ext.c @@ -413,11 +413,11 @@ void Ghud_SetSize(edict_t *ent, int i, int x, int y) engine_Ghud_SetSize(ent, i, x, y); } -// anchor is a float from 0 to 1, 0 being left/top, 1 being right/bottom -// for example, 0.5, 0.5 is center -// 0, 0 is top left -// 1, 1 is bottom right - +/* anchor is a float from 0 to 1, 0 being left/top, 1 being right/bottom +for example, 0.5, 0.5 is center +0, 0 is top left +1, 1 is bottom right +*/ void Ghud_SetAnchor(edict_t *ent, int i, float x, float y) { if (!engine_Ghud_SetAnchor) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 5e3262cb2..fe8f22669 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -889,67 +889,75 @@ void HUD_SpectatorStatsSetup(edict_t *clent) int h_sbar = h_spectator_stats_bar; int h, j, k; - x = -640; - y = 480; + // All elements are anchored from the gray bar at the bottom + x = -160; + y = -60; - h = h_base; // back bar + h = h_base; // gray bar hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y + 12); - Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetAnchor(clent, hud[h], 0.5, 1); + Ghud_SetPosition(clent, hud[h], x, y); Ghud_SetSize(clent, hud[h], 288, 12); Ghud_SetFlags(clent, hud[h], GHF_HIDE); //Ghud_SetColor(clent, hud[h], 0, 0, 0, 0); h = h_base + 1; // frags - hud[h] = Ghud_AddText(clent, x + 32, y + 14, ""); - Ghud_SetAnchor(clent, hud[h], 1, 0); + hud[h] = Ghud_AddText(clent, x + 500, y + 200, ""); + Ghud_SetAnchor(clent, hud[h], 0.5, 1); + Ghud_SetPosition(clent, hud[h], x + 33, y); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 2; // deaths - hud[h] = Ghud_AddText(clent, x + 96, y + 14, ""); - Ghud_SetAnchor(clent, hud[h], 1, 0); + hud[h] = Ghud_AddText(clent, x, y, ""); + Ghud_SetAnchor(clent, hud[h], 0.5, 1); + Ghud_SetPosition(clent, hud[h], x + 97, y); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 3; // damage - hud[h] = Ghud_AddText(clent, x + 120, y + 14, ""); - Ghud_SetAnchor(clent, hud[h], 1, 0); + hud[h] = Ghud_AddText(clent, x, y, ""); + Ghud_SetAnchor(clent, hud[h], 0.5, 1); + Ghud_SetPosition(clent, hud[h], x + 160, y); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 4; // accuracy - hud[h] = Ghud_AddText(clent, x + 185, y + 14, ""); - Ghud_SetAnchor(clent, hud[h], 1, 0); + hud[h] = Ghud_AddText(clent, x, y, ""); + Ghud_SetAnchor(clent, hud[h], 0.5, 1); + Ghud_SetPosition(clent, hud[h], x + 192, y); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); - h = h_base + 10; // weapon selection - hud[h] = Ghud_AddIcon(clent, x - 680, y + 2, level.pic_items[M4_NUM], 20, 20); - Ghud_SetAnchor(clent, hud[h], 1, 0); + // h = h_base + 10; // weapon selection + // Ghud_SetAnchor(clent, hud[h], 0.5, 1); + // hud[h] = Ghud_AddIcon(clent, x + 200, y + 200, level.pic_items[M4_NUM], 20, 20); + j = h_nbar; // name bar hud[j] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[j], x, y - 12); - Ghud_SetAnchor(clent, hud[j], 1, 0); + Ghud_SetAnchor(clent, hud[j], 0.5, 1); + Ghud_SetPosition(clent, hud[j], x, y - 24); Ghud_SetSize(clent, hud[j], 288, 12); //Ghud_SetColor(clent, hud[j], 0, 0, 0, 0); Ghud_SetFlags(clent, hud[j], GHF_HIDE); j = h_nbar + 1; // name print - hud[j] = Ghud_AddText(clent, x, y + 12, ""); - Ghud_SetPosition(clent, hud[j], x + 120, y - 12); - Ghud_SetAnchor(clent, hud[j], 1, 0); + hud[j] = Ghud_AddText(clent, x, y + 22, ""); + Ghud_SetAnchor(clent, hud[j], 0.5, 1); + Ghud_SetPosition(clent, hud[j], x + 140, y - 22); Ghud_SetSize(clent, hud[j], 20, 12); Ghud_SetTextFlags(clent, hud[j], UI_CENTER); k = h_sbar; // stat table bar hud[k] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[k], x, y); - Ghud_SetAnchor(clent, hud[k], 1, 0); + Ghud_SetAnchor(clent, hud[k], 0.5, 1); + Ghud_SetPosition(clent, hud[k], x, y - 12); Ghud_SetSize(clent, hud[k], 288, 12); //Ghud_SetColor(clent, hud[k], 0, 0, 0, 0); Ghud_SetFlags(clent, hud[k], GHF_HIDE); k = h_sbar + 1; // stat table text - hud[k] = Ghud_AddText(clent, x, y, ""); - Ghud_SetAnchor(clent, hud[k], 1, 0); + hud[k] = Ghud_AddText(clent, x, y - 10, ""); + Ghud_SetAnchor(clent, hud[k], 0.5, 1); + Ghud_SetPosition(clent, hud[k], x, y - 10); + Ghud_SetSize(clent, hud[k], 20, 12); Ghud_SetTextFlags(clent, hud[k], UI_LEFT); } From d77ffe276bf36e7f4a6e94e98e43816b049dc561 Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Thu, 31 Oct 2024 20:52:38 -0400 Subject: [PATCH 10/24] Using SetAnchor, center stat bar compatible with scr_scale --- src/action/p_hud.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index fe8f22669..6d432c5c8 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -904,7 +904,7 @@ void HUD_SpectatorStatsSetup(edict_t *clent) h = h_base + 1; // frags hud[h] = Ghud_AddText(clent, x + 500, y + 200, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); - Ghud_SetPosition(clent, hud[h], x + 33, y); + Ghud_SetPosition(clent, hud[h], x + 33, y - 2); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 2; // deaths From 3a5500c237ceb168710c48e03bfd384bd51df0e4 Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Thu, 31 Oct 2024 21:00:10 -0400 Subject: [PATCH 11/24] Fixed vertical alignment of stat values --- src/action/p_hud.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 6d432c5c8..79c34d998 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -904,25 +904,25 @@ void HUD_SpectatorStatsSetup(edict_t *clent) h = h_base + 1; // frags hud[h] = Ghud_AddText(clent, x + 500, y + 200, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); - Ghud_SetPosition(clent, hud[h], x + 33, y - 2); + Ghud_SetPosition(clent, hud[h], x + 33, y + 2); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 2; // deaths hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); - Ghud_SetPosition(clent, hud[h], x + 97, y); + Ghud_SetPosition(clent, hud[h], x + 97, y + 2); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 3; // damage hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); - Ghud_SetPosition(clent, hud[h], x + 160, y); + Ghud_SetPosition(clent, hud[h], x + 160, y + 2); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 4; // accuracy hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); - Ghud_SetPosition(clent, hud[h], x + 192, y); + Ghud_SetPosition(clent, hud[h], x + 192, y + 2); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); // h = h_base + 10; // weapon selection From a0baa5d67855b0eb8b405d72fde4e61db4dd5d02 Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Thu, 31 Oct 2024 21:39:48 -0400 Subject: [PATCH 12/24] Moved stats horizontally, added award tallies --- src/action/g_local.h | 6 +++--- src/action/p_hud.c | 51 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/action/g_local.h b/src/action/g_local.h index 8386f22d4..a1303504a 100644 --- a/src/action/g_local.h +++ b/src/action/g_local.h @@ -2956,9 +2956,9 @@ typedef enum { h_team_r, h_team_r_num, h_spectator_stats = 66, // display up to 5 stats at once - h_spectator_stats_bar = 73, // h_spectator_stats_bar text is 74 - h_spectator_name_bar = 75, // h_spectator_name_bar text is 76 - h_spectator_timer = 77, + h_spectator_stats_bar = 74, // h_spectator_stats_bar text is 75 + h_spectator_name_bar = 76, // h_spectator_name_bar text is 77 + h_spectator_timer = 78, h_spectator_timer_border, h_spectator_time_tm, h_spectator_time_mm, diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 79c34d998..ea14ed783 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -892,37 +892,57 @@ void HUD_SpectatorStatsSetup(edict_t *clent) // All elements are anchored from the gray bar at the bottom x = -160; y = -60; + int bar_width = 305; + int bar_height = 12; h = h_base; // gray bar hud[h] = Ghud_NewElement(clent, GHT_FILL); Ghud_SetAnchor(clent, hud[h], 0.5, 1); Ghud_SetPosition(clent, hud[h], x, y); - Ghud_SetSize(clent, hud[h], 288, 12); + Ghud_SetSize(clent, hud[h], bar_width, bar_height); Ghud_SetFlags(clent, hud[h], GHF_HIDE); //Ghud_SetColor(clent, hud[h], 0, 0, 0, 0); h = h_base + 1; // frags hud[h] = Ghud_AddText(clent, x + 500, y + 200, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); - Ghud_SetPosition(clent, hud[h], x + 33, y + 2); + Ghud_SetPosition(clent, hud[h], x + 16, y + 2); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 2; // deaths hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); - Ghud_SetPosition(clent, hud[h], x + 97, y + 2); + Ghud_SetPosition(clent, hud[h], x + 72, y + 2); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 3; // damage hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); - Ghud_SetPosition(clent, hud[h], x + 160, y + 2); + Ghud_SetPosition(clent, hud[h], x + 120, y + 2); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 4; // accuracy hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); - Ghud_SetPosition(clent, hud[h], x + 192, y + 2); + Ghud_SetPosition(clent, hud[h], x + 184, y + 2); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 5; // accuracy awards + hud[h] = Ghud_AddText(clent, x, y, ""); + Ghud_SetAnchor(clent, hud[h], 0.5, 1); + Ghud_SetPosition(clent, hud[h], x + 248, y + 2); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 6; // impressive awards + hud[h] = Ghud_AddText(clent, x, y, ""); + Ghud_SetAnchor(clent, hud[h], 0.5, 1); + Ghud_SetPosition(clent, hud[h], x + 273, y + 2); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 7; // excellent awards + hud[h] = Ghud_AddText(clent, x, y, ""); + Ghud_SetAnchor(clent, hud[h], 0.5, 1); + Ghud_SetPosition(clent, hud[h], x + 296, y + 2); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); // h = h_base + 10; // weapon selection @@ -934,7 +954,7 @@ void HUD_SpectatorStatsSetup(edict_t *clent) hud[j] = Ghud_NewElement(clent, GHT_FILL); Ghud_SetAnchor(clent, hud[j], 0.5, 1); Ghud_SetPosition(clent, hud[j], x, y - 24); - Ghud_SetSize(clent, hud[j], 288, 12); + Ghud_SetSize(clent, hud[j], bar_width, bar_height); //Ghud_SetColor(clent, hud[j], 0, 0, 0, 0); Ghud_SetFlags(clent, hud[j], GHF_HIDE); @@ -949,7 +969,7 @@ void HUD_SpectatorStatsSetup(edict_t *clent) hud[k] = Ghud_NewElement(clent, GHT_FILL); Ghud_SetAnchor(clent, hud[k], 0.5, 1); Ghud_SetPosition(clent, hud[k], x, y - 12); - Ghud_SetSize(clent, hud[k], 288, 12); + Ghud_SetSize(clent, hud[k], bar_width, bar_height); //Ghud_SetColor(clent, hud[k], 0, 0, 0, 0); Ghud_SetFlags(clent, hud[k], GHF_HIDE); @@ -1323,6 +1343,9 @@ void HUD_SpectatorUpdate(edict_t *clent) Ghud_SetFlags(clent, hud[h_spectator_stats + 2], 0); Ghud_SetFlags(clent, hud[h_spectator_stats + 3], 0); Ghud_SetFlags(clent, hud[h_spectator_stats + 4], 0); + Ghud_SetFlags(clent, hud[h_spectator_stats + 5], 0); + Ghud_SetFlags(clent, hud[h_spectator_stats + 6], 0); + Ghud_SetFlags(clent, hud[h_spectator_stats + 7], 0); Ghud_SetFlags(clent, hud[h_spectator_name_bar], 0); Ghud_SetFlags(clent, hud[h_spectator_name_bar + 1], 0); Ghud_SetFlags(clent, hud[h_spectator_stats_bar], 0); @@ -1333,12 +1356,18 @@ void HUD_SpectatorUpdate(edict_t *clent) char deaths_s[24]; char dmg_s[24]; char acc_s[10]; + char a_s[10]; + char i_s[10]; + char e_s[10]; edict_t *targ = clent->client->chase_target; memcpy(nm_s, targ->client->pers.netname, 16); snprintf(frags_s, sizeof(frags_s), "%i", targ->client->resp.kills); snprintf(deaths_s, sizeof(deaths_s), "%i", targ->client->resp.deaths); snprintf(dmg_s, sizeof(dmg_s), "%i", targ->client->resp.damage_dealt); snprintf(acc_s, sizeof(acc_s), "%.2f%%", CalculateAccuracy(targ)); + snprintf(a_s, sizeof(a_s), "%i", targ->client->resp.awardstats[ACCURACY]); + snprintf(i_s, sizeof(i_s), "%i", targ->client->resp.awardstats[IMPRESSIVE]); + snprintf(e_s, sizeof(e_s), "%i", targ->client->resp.awardstats[EXCELLENT]); // update fields // Change color based on team @@ -1371,12 +1400,15 @@ void HUD_SpectatorUpdate(edict_t *clent) // target name Ghud_SetText(clent, hud[h_nbar + 1], nm_s); // target stat bar - Ghud_SetText(clent, hud[h_sbar + 1], "Frags Deaths Damage Acc."); + Ghud_SetText(clent, hud[h_sbar + 1], "Frags Deaths Damage Acc. A I E"); // target stat values Ghud_SetText(clent, hud[h_base + 1], frags_s); Ghud_SetText(clent, hud[h_base + 2], deaths_s); Ghud_SetText(clent, hud[h_base + 3], dmg_s); Ghud_SetText(clent, hud[h_base + 4], acc_s); + Ghud_SetText(clent, hud[h_base + 5], a_s); + Ghud_SetText(clent, hud[h_base + 6], i_s); + Ghud_SetText(clent, hud[h_base + 7], e_s); // Color per team if (clent->client->chase_target) { @@ -1400,6 +1432,9 @@ void HUD_SpectatorUpdate(edict_t *clent) Ghud_SetFlags(clent, hud[h_spectator_stats + 2], GHF_HIDE); Ghud_SetFlags(clent, hud[h_spectator_stats + 3], GHF_HIDE); Ghud_SetFlags(clent, hud[h_spectator_stats + 4], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_stats + 5], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_stats + 6], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_stats + 7], GHF_HIDE); Ghud_SetFlags(clent, hud[h_spectator_name_bar], GHF_HIDE); Ghud_SetFlags(clent, hud[h_spectator_name_bar + 1], GHF_HIDE); Ghud_SetFlags(clent, hud[h_spectator_stats_bar], GHF_HIDE); From d0d8c2e3b3648d98a087cebcdda0ac349ddd5a5a Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Thu, 31 Oct 2024 21:59:55 -0400 Subject: [PATCH 13/24] GHUD Player stat and timer Deathmatch compatible --- src/action/g_combat.c | 16 +- src/action/p_hud.c | 553 +++++++++++++++++++++--------------------- 2 files changed, 289 insertions(+), 280 deletions(-) diff --git a/src/action/g_combat.c b/src/action/g_combat.c index aaea333fa..4e0b8f5de 100644 --- a/src/action/g_combat.c +++ b/src/action/g_combat.c @@ -865,9 +865,11 @@ void T_Damage (edict_t * targ, edict_t * inflictor, edict_t * attacker, const ve if (client && attacker->client) { if (!friendlyFire && !in_warmup) { - attacker->client->resp.damage_dealt += damage; - // Hit markers - attacker->client->damage_dealt += damage; + if (mod != MOD_TELEFRAG) { + attacker->client->resp.damage_dealt += damage; + // Hit markers + attacker->client->damage_dealt += damage; + } if (mod > 0 && mod < MAX_GUNSTAT) { attacker->client->resp.gunstats[mod].damage += damage; } @@ -930,9 +932,11 @@ void T_Damage (edict_t * targ, edict_t * inflictor, edict_t * attacker, const ve if (attacker->client) { if (!friendlyFire && !in_warmup) { - attacker->client->resp.damage_dealt += damage; - // Hit markers - attacker->client->damage_dealt += damage; + if (mod != MOD_TELEFRAG) { + attacker->client->resp.damage_dealt += damage; + // Hit markers + attacker->client->damage_dealt += damage; + } // All normal weapon damage if (mod > 0 && mod < MAX_GUNSTAT) { attacker->client->resp.gunstats[mod].damage += damage; diff --git a/src/action/p_hud.c b/src/action/p_hud.c index ea14ed783..6b36a49a1 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -1007,83 +1007,98 @@ void HUD_SpectatorSetup(edict_t *clent) int *hud = clent->client->resp.hud_items; int i; - if (teamplay->value && spectator_hud->value) - { // Left-side nameplates - for (i = 0; i < 6; i++) - { - int x, y; - int h_base = h_nameplate_l + (i * 5); - int h; - - x = 0; - y = 28 + (28 * i); - - h = h_base; // back bar - hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y); - Ghud_SetAnchor(clent, hud[h], 0, 0); - Ghud_SetSize(clent, hud[h], 144, 24); - Ghud_SetColor(clent, hud[h], alt_red_team_red, alt_red_team_green, alt_red_team_blue, nameplate_alpha); - - h = h_base + 1; // health bar - hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y); - Ghud_SetAnchor(clent, hud[h], 0, 0); - Ghud_SetSize(clent, hud[h], 0, 24); - Ghud_SetColor(clent, hud[h], red_team_red, red_team_green, red_team_blue, nameplate_alpha); - - h = h_base + 2; // name - hud[h] = Ghud_AddText(clent, x + 142, y + 3, ""); - Ghud_SetAnchor(clent, hud[h], 0, 0); - Ghud_SetTextFlags(clent, hud[h], UI_RIGHT); - - h = h_base + 3; // k/d - hud[h] = Ghud_AddText(clent, x + 142, y + 14, ""); - Ghud_SetAnchor(clent, hud[h], 0, 0); - Ghud_SetTextFlags(clent, hud[h], UI_RIGHT); - - h = h_base + 4; // weapon select - hud[h] = Ghud_AddIcon(clent, x + 2, y + 2, level.pic_items[M4_NUM], 20, 20); - Ghud_SetAnchor(clent, hud[h], 0, 0); - } + if (spectator_hud->value) { + // Left-side nameplates + if (teamplay->value) { + for (i = 0; i < 6; i++) + { + int x, y; + int h_base = h_nameplate_l + (i * 5); + int h; + + x = 0; + y = 28 + (28 * i); + + h = h_base; // back bar + hud[h] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[h], x, y); + Ghud_SetAnchor(clent, hud[h], 0, 0); + Ghud_SetSize(clent, hud[h], 144, 24); + Ghud_SetColor(clent, hud[h], alt_red_team_red, alt_red_team_green, alt_red_team_blue, nameplate_alpha); + + h = h_base + 1; // health bar + hud[h] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[h], x, y); + Ghud_SetAnchor(clent, hud[h], 0, 0); + Ghud_SetSize(clent, hud[h], 0, 24); + Ghud_SetColor(clent, hud[h], red_team_red, red_team_green, red_team_blue, nameplate_alpha); + + h = h_base + 2; // name + hud[h] = Ghud_AddText(clent, x + 142, y + 3, ""); + Ghud_SetAnchor(clent, hud[h], 0, 0); + Ghud_SetTextFlags(clent, hud[h], UI_RIGHT); + + h = h_base + 3; // k/d + hud[h] = Ghud_AddText(clent, x + 142, y + 14, ""); + Ghud_SetAnchor(clent, hud[h], 0, 0); + Ghud_SetTextFlags(clent, hud[h], UI_RIGHT); + + h = h_base + 4; // weapon select + hud[h] = Ghud_AddIcon(clent, x + 2, y + 2, level.pic_items[M4_NUM], 20, 20); + Ghud_SetAnchor(clent, hud[h], 0, 0); + } - // Right side nameplates - for (i = 0; i < 6; i++) - { - int x, y; - int h_base = h_nameplate_r + (i * 5); - int h; - - x = -144; - y = 28 + (28 * i); - - h = h_base; // back bar - hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetSize(clent, hud[h], 144, 24); - Ghud_SetColor(clent, hud[h], alt_blue_team_red, alt_blue_team_green, alt_blue_team_blue, nameplate_alpha); - - h = h_base + 1; // health bar - hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetSize(clent, hud[h], 0, 24); - Ghud_SetColor(clent, hud[h], blue_team_red, blue_team_green, blue_team_blue, nameplate_alpha); - - h = h_base + 2; // name - hud[h] = Ghud_AddText(clent, x + 2, y + 3, ""); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); - - h = h_base + 3; // k/d - hud[h] = Ghud_AddText(clent, x + 2, y + 14, ""); - Ghud_SetAnchor(clent, hud[h], 1, 0); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); - - h = h_base + 4; // weapon select - hud[h] = Ghud_AddIcon(clent, x + 122, y + 2, level.pic_items[M4_NUM], 20, 20); - Ghud_SetAnchor(clent, hud[h], 1, 0); + // Right side nameplates + for (i = 0; i < 6; i++) + { + int x, y; + int h_base = h_nameplate_r + (i * 5); + int h; + + x = -144; + y = 28 + (28 * i); + + h = h_base; // back bar + hud[h] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[h], x, y); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetSize(clent, hud[h], 144, 24); + Ghud_SetColor(clent, hud[h], alt_blue_team_red, alt_blue_team_green, alt_blue_team_blue, nameplate_alpha); + + h = h_base + 1; // health bar + hud[h] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetPosition(clent, hud[h], x, y); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetSize(clent, hud[h], 0, 24); + Ghud_SetColor(clent, hud[h], blue_team_red, blue_team_green, blue_team_blue, nameplate_alpha); + + h = h_base + 2; // name + hud[h] = Ghud_AddText(clent, x + 2, y + 3, ""); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 3; // k/d + hud[h] = Ghud_AddText(clent, x + 2, y + 14, ""); + Ghud_SetAnchor(clent, hud[h], 1, 0); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + + h = h_base + 4; // weapon select + hud[h] = Ghud_AddIcon(clent, x + 122, y + 2, level.pic_items[M4_NUM], 20, 20); + Ghud_SetAnchor(clent, hud[h], 1, 0); + } + + // GHUD top corner team icon + hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_teamskin[1], 24, 24); + Ghud_SetAnchor(clent, hud[h_team_l], 0, 0); + hud[h_team_l_num] = Ghud_AddNumber(clent, 96, 2, 0); + Ghud_SetSize(clent, hud[h_team_l_num], 2, 0); + Ghud_SetAnchor(clent, hud[h_team_l_num], 0, 0); + + hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_teamskin[2], 24, 24); + Ghud_SetAnchor(clent, hud[h_team_r], 1, 0); + hud[h_team_r_num] = Ghud_AddNumber(clent, -128, 2, 0); + Ghud_SetSize(clent, hud[h_team_r_num], 1, 0); + Ghud_SetAnchor(clent, hud[h_team_r_num], 1, 0); } // GHUD chase player stats @@ -1091,20 +1106,6 @@ void HUD_SpectatorSetup(edict_t *clent) // GHUD top middle time display HUD_SpectatorTimerSetup(clent); - - // GHUD top corner team icon - hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_teamskin[1], 24, 24); - Ghud_SetAnchor(clent, hud[h_team_l], 0, 0); - hud[h_team_l_num] = Ghud_AddNumber(clent, 96, 2, 0); - Ghud_SetSize(clent, hud[h_team_l_num], 2, 0); - Ghud_SetAnchor(clent, hud[h_team_l_num], 0, 0); - - hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_teamskin[2], 24, 24); - Ghud_SetAnchor(clent, hud[h_team_r], 1, 0); - hud[h_team_r_num] = Ghud_AddNumber(clent, -128, 2, 0); - Ghud_SetSize(clent, hud[h_team_r_num], 1, 0); - Ghud_SetAnchor(clent, hud[h_team_r_num], 1, 0); - } } @@ -1112,221 +1113,221 @@ void HUD_SpectatorUpdate(edict_t *clent) { int i; - if (teamplay->value && spectator_hud->value) - { + if (spectator_hud->value) { int *hud = clent->client->resp.hud_items; - - if (!(clent->client->pers.spec_flags & SPECFL_SPECHUD_NEW)) // hide all elements since client doesn't want them - { - for (i = 0; i <= h_spectator_time_ss; i++) + if (teamplay->value) { + if (!(clent->client->pers.spec_flags & SPECFL_SPECHUD_NEW)) // hide all elements since client doesn't want them { - Ghud_SetFlags(clent, hud[i], GHF_HIDE); + for (i = 0; i <= h_spectator_time_ss; i++) + { + Ghud_SetFlags(clent, hud[i], GHF_HIDE); + } + return; } - return; - } - gclient_t *team1_players[6]; - gclient_t *team2_players[6]; - gclient_t *sortedClients[MAX_CLIENTS]; + gclient_t *team1_players[6]; + gclient_t *team2_players[6]; + gclient_t *sortedClients[MAX_CLIENTS]; - int totalClients, team1Clients, team2Clients; + int totalClients, team1Clients, team2Clients; - memset(team1_players, 0, sizeof(team1_players)); - memset(team2_players, 0, sizeof(team2_players)); + memset(team1_players, 0, sizeof(team1_players)); + memset(team2_players, 0, sizeof(team2_players)); - team1Clients = 0; - team2Clients = 0; - totalClients = G_SortedClients(sortedClients); + team1Clients = 0; + team2Clients = 0; + totalClients = G_SortedClients(sortedClients); - for (i = 0; i < totalClients; i++) - { - gclient_t *cl = sortedClients[i]; - - if (!cl->resp.team) - continue; - - if (cl->resp.subteam) - continue; - - if (cl->resp.team == TEAM1) + for (i = 0; i < totalClients; i++) { - if (team1Clients >= 6) - continue; + gclient_t *cl = sortedClients[i]; - team1_players[team1Clients] = cl; - team1Clients++; - continue; - } - if (cl->resp.team == TEAM2) - { - if (team2Clients >= 6) + if (!cl->resp.team) continue; - team2_players[team2Clients] = cl; - team2Clients++; - continue; - } - } + if (cl->resp.subteam) + continue; - // team 1 (red team) - Ghud_SetFlags(clent, hud[h_team_l], 0); - Ghud_SetFlags(clent, hud[h_team_l_num], 0); - Ghud_SetInt(clent, hud[h_team_l_num], teams[TEAM1].score); + if (cl->resp.team == TEAM1) + { + if (team1Clients >= 6) + continue; - for (i = 0; i < 6; i++) - { - int x, y; - int h = h_nameplate_l + (i * 5); - gclient_t *cl = team1_players[i]; + team1_players[team1Clients] = cl; + team1Clients++; + continue; + } + if (cl->resp.team == TEAM2) + { + if (team2Clients >= 6) + continue; - if (!cl) // if there is no player, hide all the elements for their plate - { - Ghud_SetFlags(clent, hud[h + 0], GHF_HIDE); - Ghud_SetFlags(clent, hud[h + 1], GHF_HIDE); - Ghud_SetFlags(clent, hud[h + 2], GHF_HIDE); - Ghud_SetFlags(clent, hud[h + 3], GHF_HIDE); - Ghud_SetFlags(clent, hud[h + 4], GHF_HIDE); - continue; + team2_players[team2Clients] = cl; + team2Clients++; + continue; + } } - x = 0; - y = 28 + (28 * i); - - // unhide our elements - Ghud_SetFlags(clent, hud[h + 0], 0); - Ghud_SetFlags(clent, hud[h + 1], 0); - Ghud_SetFlags(clent, hud[h + 2], 0); - Ghud_SetFlags(clent, hud[h + 3], 0); - Ghud_SetFlags(clent, hud[h + 4], 0); + // team 1 (red team) + Ghud_SetFlags(clent, hud[h_team_l], 0); + Ghud_SetFlags(clent, hud[h_team_l_num], 0); + Ghud_SetInt(clent, hud[h_team_l_num], teams[TEAM1].score); - // tint for deadness - edict_t *cl_ent = g_edicts + 1 + (cl - game.clients); - if (!IS_ALIVE(cl_ent)) + for (i = 0; i < 6; i++) { - Ghud_SetSize(clent, hud[h + 1], 0, 24); - - Ghud_SetPosition(clent, hud[h + 0], x, y); - Ghud_SetSize(clent, hud[h + 0], 144, 24); - } - else - { - float hp_invfrac; - float hp_frac = bound(0, ((float)cl_ent->health / 100.0f), 1); - hp_invfrac = floorf((1 - hp_frac) * 144) / 144; - hp_frac = ceilf(hp_frac * 144) / 144; // round so we don't get gaps - - Ghud_SetSize(clent, hud[h + 1], 144 * hp_frac, 24); - Ghud_SetSize(clent, hud[h + 0], 144 * hp_invfrac, 24); - Ghud_SetPosition(clent, hud[h + 0], x + (144 * (hp_frac)), y); - } - - // generate strings - char nm_s[17]; - char kdr_s[24]; - memcpy(nm_s, cl->pers.netname, 16); - if (IS_ALIVE(cl_ent)) - snprintf(kdr_s, sizeof(kdr_s), "%i", cl->resp.kills); - else - snprintf(kdr_s, sizeof(kdr_s), "(%i)%c %5i", cl->resp.deaths, 06, cl->resp.kills); - - nm_s[sizeof(nm_s) - 1] = 0; // make sure strings are terminated - kdr_s[23] = 0; - - // update fields - Ghud_SetText(clent, hud[h + 2], nm_s); - Ghud_SetText(clent, hud[h + 3], kdr_s); + int x, y; + int h = h_nameplate_l + (i * 5); + gclient_t *cl = team1_players[i]; + + if (!cl) // if there is no player, hide all the elements for their plate + { + Ghud_SetFlags(clent, hud[h + 0], GHF_HIDE); + Ghud_SetFlags(clent, hud[h + 1], GHF_HIDE); + Ghud_SetFlags(clent, hud[h + 2], GHF_HIDE); + Ghud_SetFlags(clent, hud[h + 3], GHF_HIDE); + Ghud_SetFlags(clent, hud[h + 4], GHF_HIDE); + continue; + } - int weapNum = cl->pers.chosenWeapon ? cl->pers.chosenWeapon->typeNum : 0; + x = 0; + y = 28 + (28 * i); - if (IS_ALIVE(cl_ent) && cl->curr_weap) - Ghud_SetInt(clent, hud[h + 4], level.pic_items[cl->curr_weap]); - else if (cl->resp.team == TEAM1 && weapNum) - Ghud_SetInt(clent, hud[h + 4], level.pic_items[weapNum]); - else // no weapon, set to mk23 - Ghud_SetInt(clent, hud[h + 4], level.pic_items[MK23_NUM]); - } + // unhide our elements + Ghud_SetFlags(clent, hud[h + 0], 0); + Ghud_SetFlags(clent, hud[h + 1], 0); + Ghud_SetFlags(clent, hud[h + 2], 0); + Ghud_SetFlags(clent, hud[h + 3], 0); + Ghud_SetFlags(clent, hud[h + 4], 0); + // tint for deadness + edict_t *cl_ent = g_edicts + 1 + (cl - game.clients); + if (!IS_ALIVE(cl_ent)) + { + Ghud_SetSize(clent, hud[h + 1], 0, 24); - // team 2 (blue team) - Ghud_SetFlags(clent, hud[h_team_r], 0); - Ghud_SetFlags(clent, hud[h_team_r_num], 0); - Ghud_SetInt(clent, hud[h_team_r_num], teams[TEAM2].score); - if (teams[TEAM2].score >= 10) // gotta readjust size for justifying purposes - Ghud_SetSize(clent, hud[h_team_r_num], 2, 0); - else - Ghud_SetSize(clent, hud[h_team_r_num], 1, 0); - - for (i = 0; i < 6; i++) - { - int x, y; - int h = h_nameplate_r + (i * 5); - gclient_t *cl = team2_players[i]; + Ghud_SetPosition(clent, hud[h + 0], x, y); + Ghud_SetSize(clent, hud[h + 0], 144, 24); + } + else + { + float hp_invfrac; + float hp_frac = bound(0, ((float)cl_ent->health / 100.0f), 1); + hp_invfrac = floorf((1 - hp_frac) * 144) / 144; + hp_frac = ceilf(hp_frac * 144) / 144; // round so we don't get gaps + + Ghud_SetSize(clent, hud[h + 1], 144 * hp_frac, 24); + Ghud_SetSize(clent, hud[h + 0], 144 * hp_invfrac, 24); + Ghud_SetPosition(clent, hud[h + 0], x + (144 * (hp_frac)), y); + } - if (!cl) // if there is no player, hide all the elements for their plate - { - Ghud_SetFlags(clent, hud[h + 0], GHF_HIDE); - Ghud_SetFlags(clent, hud[h + 1], GHF_HIDE); - Ghud_SetFlags(clent, hud[h + 2], GHF_HIDE); - Ghud_SetFlags(clent, hud[h + 3], GHF_HIDE); - Ghud_SetFlags(clent, hud[h + 4], GHF_HIDE); - continue; + // generate strings + char nm_s[17]; + char kdr_s[24]; + memcpy(nm_s, cl->pers.netname, 16); + if (IS_ALIVE(cl_ent)) + snprintf(kdr_s, sizeof(kdr_s), "%i", cl->resp.kills); + else + snprintf(kdr_s, sizeof(kdr_s), "(%i)%c %5i", cl->resp.deaths, 06, cl->resp.kills); + + nm_s[sizeof(nm_s) - 1] = 0; // make sure strings are terminated + kdr_s[23] = 0; + + // update fields + Ghud_SetText(clent, hud[h + 2], nm_s); + Ghud_SetText(clent, hud[h + 3], kdr_s); + + int weapNum = cl->pers.chosenWeapon ? cl->pers.chosenWeapon->typeNum : 0; + + if (IS_ALIVE(cl_ent) && cl->curr_weap) + Ghud_SetInt(clent, hud[h + 4], level.pic_items[cl->curr_weap]); + else if (cl->resp.team == TEAM1 && weapNum) + Ghud_SetInt(clent, hud[h + 4], level.pic_items[weapNum]); + else // no weapon, set to mk23 + Ghud_SetInt(clent, hud[h + 4], level.pic_items[MK23_NUM]); } - x = -144; - y = 28 + (28 * i); - - // unhide our elements - Ghud_SetFlags(clent, hud[h + 0], 0); - Ghud_SetFlags(clent, hud[h + 1], 0); - Ghud_SetFlags(clent, hud[h + 2], 0); - Ghud_SetFlags(clent, hud[h + 3], 0); - Ghud_SetFlags(clent, hud[h + 4], 0); - // tint for deadness - edict_t *cl_ent = g_edicts + 1 + (cl - game.clients); - if (!IS_ALIVE(cl_ent)) - { - Ghud_SetSize(clent, hud[h + 1], 0, 24); - Ghud_SetSize(clent, hud[h + 0], 144, 24); - //Ghud_SetPosition(clent, hud[h + 0], x, y); - } - else - { - float hp_invfrac; - float hp_frac = bound(0, ((float)cl_ent->health / 100.0f), 1); - hp_invfrac = floorf((1 - hp_frac) * 144) / 144; - hp_frac = ceilf(hp_frac * 144) / 144; // round so we don't get gaps - - Ghud_SetSize(clent, hud[h + 1], 144 * hp_frac, 24); - Ghud_SetSize(clent, hud[h + 0], 144 * hp_invfrac, 24); - Ghud_SetPosition(clent, hud[h + 1], x + (144 * hp_invfrac), y); - //Ghud_SetPosition(clent, hud[h + 0], x + (144 * (hp_frac)), y); - } - - // generate strings - char nm_s[17]; - char kdr_s[24]; - memcpy(nm_s, cl->pers.netname, 16); - if (IS_ALIVE(cl_ent)) - snprintf(kdr_s, sizeof(kdr_s), "%i", cl->resp.kills); + // team 2 (blue team) + Ghud_SetFlags(clent, hud[h_team_r], 0); + Ghud_SetFlags(clent, hud[h_team_r_num], 0); + Ghud_SetInt(clent, hud[h_team_r_num], teams[TEAM2].score); + if (teams[TEAM2].score >= 10) // gotta readjust size for justifying purposes + Ghud_SetSize(clent, hud[h_team_r_num], 2, 0); else - snprintf(kdr_s, sizeof(kdr_s), "%-5i %c(%i)", cl->resp.kills, 06, cl->resp.deaths); + Ghud_SetSize(clent, hud[h_team_r_num], 1, 0); - nm_s[sizeof(nm_s) - 1] = 0; // make sure strings are terminated - kdr_s[23] = 0; - - // update fields - Ghud_SetText(clent, hud[h + 2], nm_s); - Ghud_SetText(clent, hud[h + 3], kdr_s); + for (i = 0; i < 6; i++) + { + int x, y; + int h = h_nameplate_r + (i * 5); + gclient_t *cl = team2_players[i]; + + if (!cl) // if there is no player, hide all the elements for their plate + { + Ghud_SetFlags(clent, hud[h + 0], GHF_HIDE); + Ghud_SetFlags(clent, hud[h + 1], GHF_HIDE); + Ghud_SetFlags(clent, hud[h + 2], GHF_HIDE); + Ghud_SetFlags(clent, hud[h + 3], GHF_HIDE); + Ghud_SetFlags(clent, hud[h + 4], GHF_HIDE); + continue; + } - int weapNum = cl->pers.chosenWeapon ? cl->pers.chosenWeapon->typeNum : 0; + x = -144; + y = 28 + (28 * i); + + // unhide our elements + Ghud_SetFlags(clent, hud[h + 0], 0); + Ghud_SetFlags(clent, hud[h + 1], 0); + Ghud_SetFlags(clent, hud[h + 2], 0); + Ghud_SetFlags(clent, hud[h + 3], 0); + Ghud_SetFlags(clent, hud[h + 4], 0); + + // tint for deadness + edict_t *cl_ent = g_edicts + 1 + (cl - game.clients); + if (!IS_ALIVE(cl_ent)) + { + Ghud_SetSize(clent, hud[h + 1], 0, 24); + Ghud_SetSize(clent, hud[h + 0], 144, 24); + //Ghud_SetPosition(clent, hud[h + 0], x, y); + } + else + { + float hp_invfrac; + float hp_frac = bound(0, ((float)cl_ent->health / 100.0f), 1); + hp_invfrac = floorf((1 - hp_frac) * 144) / 144; + hp_frac = ceilf(hp_frac * 144) / 144; // round so we don't get gaps + + Ghud_SetSize(clent, hud[h + 1], 144 * hp_frac, 24); + Ghud_SetSize(clent, hud[h + 0], 144 * hp_invfrac, 24); + Ghud_SetPosition(clent, hud[h + 1], x + (144 * hp_invfrac), y); + //Ghud_SetPosition(clent, hud[h + 0], x + (144 * (hp_frac)), y); + } - if (IS_ALIVE(cl_ent) && cl->curr_weap) - Ghud_SetInt(clent, hud[h + 4], level.pic_items[cl->curr_weap]); - else if (cl->resp.team == TEAM2 && weapNum) - Ghud_SetInt(clent, hud[h + 4], level.pic_items[weapNum]); - else // no weapon, set to mk23 - Ghud_SetInt(clent, hud[h + 4], level.pic_items[MK23_NUM]); + // generate strings + char nm_s[17]; + char kdr_s[24]; + memcpy(nm_s, cl->pers.netname, 16); + if (IS_ALIVE(cl_ent)) + snprintf(kdr_s, sizeof(kdr_s), "%i", cl->resp.kills); + else + snprintf(kdr_s, sizeof(kdr_s), "%-5i %c(%i)", cl->resp.kills, 06, cl->resp.deaths); + + nm_s[sizeof(nm_s) - 1] = 0; // make sure strings are terminated + kdr_s[23] = 0; + + // update fields + Ghud_SetText(clent, hud[h + 2], nm_s); + Ghud_SetText(clent, hud[h + 3], kdr_s); + + int weapNum = cl->pers.chosenWeapon ? cl->pers.chosenWeapon->typeNum : 0; + + if (IS_ALIVE(cl_ent) && cl->curr_weap) + Ghud_SetInt(clent, hud[h + 4], level.pic_items[cl->curr_weap]); + else if (cl->resp.team == TEAM2 && weapNum) + Ghud_SetInt(clent, hud[h + 4], level.pic_items[weapNum]); + else // no weapon, set to mk23 + Ghud_SetInt(clent, hud[h + 4], level.pic_items[MK23_NUM]); + } } int h_base = h_spectator_stats; @@ -1424,6 +1425,10 @@ void HUD_SpectatorUpdate(edict_t *clent) Ghud_SetColor(clent, hud[h_nbar], green_team_red, green_team_green, green_team_blue, nameplate_alpha); Ghud_SetColor(clent, hud[h_sbar], alt_green_team_red, alt_green_team_green, alt_green_team_blue, 255); Ghud_SetColor(clent, hud[h_base], 150, 150, 150, 255); + } else if (targ->client->resp.team == 0) { // Deathmatch! + Ghud_SetColor(clent, hud[h_nbar], 220, 220, 220, nameplate_alpha); + Ghud_SetColor(clent, hud[h_sbar], 110, 110, 110, 255); + Ghud_SetColor(clent, hud[h_base], 150, 150, 150, 255); } } } else { // Hide the stats if we're not chasing a target From ccfe259351ec098dda1e2ffddaf73945277a22d4 Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Thu, 31 Oct 2024 22:00:16 -0400 Subject: [PATCH 14/24] Removed MOD_TELEFRAG from recording 100000 damage --- src/action/p_hud.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 6b36a49a1..5e5293344 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -1112,7 +1112,6 @@ void HUD_SpectatorSetup(edict_t *clent) void HUD_SpectatorUpdate(edict_t *clent) { int i; - if (spectator_hud->value) { int *hud = clent->client->resp.hud_items; if (teamplay->value) { From 6eef5141b27cb2e3874e3d7853a05d47bd4cc39d Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Thu, 31 Oct 2024 22:27:15 -0400 Subject: [PATCH 15/24] Set timer values to 0 if negative (overtime) --- src/action/p_hud.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 5e5293344..4c90f69a3 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -788,6 +788,14 @@ static int GetRemainingTimeDigits(hud_time_digits timeval) rmins = remaining / 60; rsecs = remaining % 60; + // Ensure rmins and rsecs are non-negative + if (rmins < 0) { + rmins = 0; + } + if (rsecs < 0) { + rsecs = 0; + } + switch (timeval) { case tm: // Tens of minutes return (rmins / 10) % 10; @@ -798,7 +806,7 @@ static int GetRemainingTimeDigits(hud_time_digits timeval) case ss: // Seconds return rsecs % 10; default: - return -1; // Invalid timeval + return 0; // Invalid timeval } } @@ -931,19 +939,19 @@ void HUD_SpectatorStatsSetup(edict_t *clent) hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); Ghud_SetPosition(clent, hud[h], x + 248, y + 2); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT | UI_ALTCOLOR); h = h_base + 6; // impressive awards hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); Ghud_SetPosition(clent, hud[h], x + 273, y + 2); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT | UI_ALTCOLOR); h = h_base + 7; // excellent awards hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); Ghud_SetPosition(clent, hud[h], x + 296, y + 2); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT | UI_ALTCOLOR); // h = h_base + 10; // weapon selection // Ghud_SetAnchor(clent, hud[h], 0.5, 1); @@ -1445,8 +1453,8 @@ void HUD_SpectatorUpdate(edict_t *clent) Ghud_SetFlags(clent, hud[h_spectator_stats_bar + 1], GHF_HIDE); } - // Update the timer display - if (timelimit->value) { + // Update the timer display if set and we're not in intermission + if (timelimit->value && !level.intermission_framenum) { HUD_UpdateSpectatorTimer(clent); } else { Ghud_SetFlags(clent, hud[h_spectator_timer_border], GHF_HIDE); From 468ae28dde960697a6de6eddff3c39d83291472a Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Thu, 31 Oct 2024 23:20:33 -0400 Subject: [PATCH 16/24] Some cleanup, darkened gray bar --- src/action/p_hud.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 4c90f69a3..9a7ab6845 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -909,7 +909,6 @@ void HUD_SpectatorStatsSetup(edict_t *clent) Ghud_SetPosition(clent, hud[h], x, y); Ghud_SetSize(clent, hud[h], bar_width, bar_height); Ghud_SetFlags(clent, hud[h], GHF_HIDE); - //Ghud_SetColor(clent, hud[h], 0, 0, 0, 0); h = h_base + 1; // frags hud[h] = Ghud_AddText(clent, x + 500, y + 200, ""); @@ -939,19 +938,19 @@ void HUD_SpectatorStatsSetup(edict_t *clent) hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); Ghud_SetPosition(clent, hud[h], x + 248, y + 2); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT | UI_ALTCOLOR); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 6; // impressive awards hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); Ghud_SetPosition(clent, hud[h], x + 273, y + 2); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT | UI_ALTCOLOR); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 7; // excellent awards hud[h] = Ghud_AddText(clent, x, y, ""); Ghud_SetAnchor(clent, hud[h], 0.5, 1); Ghud_SetPosition(clent, hud[h], x + 296, y + 2); - Ghud_SetTextFlags(clent, hud[h], UI_LEFT | UI_ALTCOLOR); + Ghud_SetTextFlags(clent, hud[h], UI_LEFT); // h = h_base + 10; // weapon selection // Ghud_SetAnchor(clent, hud[h], 0.5, 1); @@ -963,7 +962,6 @@ void HUD_SpectatorStatsSetup(edict_t *clent) Ghud_SetAnchor(clent, hud[j], 0.5, 1); Ghud_SetPosition(clent, hud[j], x, y - 24); Ghud_SetSize(clent, hud[j], bar_width, bar_height); - //Ghud_SetColor(clent, hud[j], 0, 0, 0, 0); Ghud_SetFlags(clent, hud[j], GHF_HIDE); j = h_nbar + 1; // name print @@ -978,7 +976,6 @@ void HUD_SpectatorStatsSetup(edict_t *clent) Ghud_SetAnchor(clent, hud[k], 0.5, 1); Ghud_SetPosition(clent, hud[k], x, y - 12); Ghud_SetSize(clent, hud[k], bar_width, bar_height); - //Ghud_SetColor(clent, hud[k], 0, 0, 0, 0); Ghud_SetFlags(clent, hud[k], GHF_HIDE); k = h_sbar + 1; // stat table text @@ -1423,15 +1420,15 @@ void HUD_SpectatorUpdate(edict_t *clent) if (targ->client->resp.team == TEAM1) { Ghud_SetColor(clent, hud[h_nbar], red_team_red, red_team_green, red_team_blue, nameplate_alpha); Ghud_SetColor(clent, hud[h_sbar], alt_red_team_red, alt_red_team_green, alt_red_team_blue, 255); - Ghud_SetColor(clent, hud[h_base], 150, 150, 150, 255); + Ghud_SetColor(clent, hud[h_base], 100, 100, 100, 255); } else if (targ->client->resp.team == TEAM2) { Ghud_SetColor(clent, hud[h_nbar], blue_team_red, blue_team_green, blue_team_blue, nameplate_alpha); Ghud_SetColor(clent, hud[h_sbar], alt_blue_team_red, alt_blue_team_green, alt_blue_team_blue, 255); - Ghud_SetColor(clent, hud[h_base], 150, 150, 150, 255); + Ghud_SetColor(clent, hud[h_base], 100, 100, 100, 255); } else if (targ->client->resp.team == TEAM3) { Ghud_SetColor(clent, hud[h_nbar], green_team_red, green_team_green, green_team_blue, nameplate_alpha); Ghud_SetColor(clent, hud[h_sbar], alt_green_team_red, alt_green_team_green, alt_green_team_blue, 255); - Ghud_SetColor(clent, hud[h_base], 150, 150, 150, 255); + Ghud_SetColor(clent, hud[h_base], 100, 100, 100, 255); } else if (targ->client->resp.team == 0) { // Deathmatch! Ghud_SetColor(clent, hud[h_nbar], 220, 220, 220, nameplate_alpha); Ghud_SetColor(clent, hud[h_sbar], 110, 110, 110, 255); From f5d67a0a075f22356992d4ee915dc2e99ab2377b Mon Sep 17 00:00:00 2001 From: Dino <8dino2@gmail.com> Date: Fri, 1 Nov 2024 00:07:28 -0400 Subject: [PATCH 17/24] A/I/E icons --- src/action/p_hud.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 9a7ab6845..124d17dc2 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -1405,7 +1405,7 @@ void HUD_SpectatorUpdate(edict_t *clent) // target name Ghud_SetText(clent, hud[h_nbar + 1], nm_s); // target stat bar - Ghud_SetText(clent, hud[h_sbar + 1], "Frags Deaths Damage Acc. A I E"); + Ghud_SetText(clent, hud[h_sbar + 1], "Frags Deaths Damage Acc. \x07 \x0E \x0F"); // target stat values Ghud_SetText(clent, hud[h_base + 1], frags_s); Ghud_SetText(clent, hud[h_base + 2], deaths_s); From 577621bf14f2c660c2a86c21f830552db061eff1 Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Fri, 1 Nov 2024 09:01:43 -0400 Subject: [PATCH 18/24] Unhide timer elements --- src/action/p_hud.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 124d17dc2..2b8d39cd7 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -840,6 +840,15 @@ void HUD_SpectatorTimerSetup(edict_t *clent) if (timelimit->value) { // GHUD top middle time display clent->client->resp.hud_type = 1; + + // Unhide the other HUD elements + Ghud_SetFlags(clent, hud[h_spectator_timer_border], 0); + Ghud_SetFlags(clent, hud[h_spectator_timer], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_tm], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_mm], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_sep], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_ts], 0); + Ghud_SetFlags(clent, hud[h_spectator_time_ss], 0); // GHUD bottom center stat display int x, y; From 8cd7596193f6900c53a24c9a8af8347e18bd48d8 Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Fri, 1 Nov 2024 09:15:49 -0400 Subject: [PATCH 19/24] Re-draw the GHUD if going spectator --- src/action/p_client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/action/p_client.c b/src/action/p_client.c index 018c43368..40d811e48 100644 --- a/src/action/p_client.c +++ b/src/action/p_client.c @@ -6275,6 +6275,10 @@ void ClientBeginServerFrame(edict_t * ent) // then Action! EspRespawnPlayer(ent); } + #ifdef AQTION_EXTENSION + // Redraw GHUD + HUD_SetType(ent, 1); + #endif } else { From 0b80b9e08db7c0e794c735ea16e5dc99f8e2032e Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Fri, 1 Nov 2024 09:59:33 -0400 Subject: [PATCH 20/24] Support for CTF scores in GHUD --- src/action/p_hud.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 2b8d39cd7..7bb0f8764 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -1184,7 +1184,10 @@ void HUD_SpectatorUpdate(edict_t *clent) // team 1 (red team) Ghud_SetFlags(clent, hud[h_team_l], 0); Ghud_SetFlags(clent, hud[h_team_l_num], 0); - Ghud_SetInt(clent, hud[h_team_l_num], teams[TEAM1].score); + if (ctf->value) + Ghud_SetInt(clent, hud[h_team_l_num], ctfgame.team1); + else + Ghud_SetInt(clent, hud[h_team_l_num], teams[TEAM1].score); for (i = 0; i < 6; i++) { @@ -1263,7 +1266,11 @@ void HUD_SpectatorUpdate(edict_t *clent) // team 2 (blue team) Ghud_SetFlags(clent, hud[h_team_r], 0); Ghud_SetFlags(clent, hud[h_team_r_num], 0); - Ghud_SetInt(clent, hud[h_team_r_num], teams[TEAM2].score); + if (ctf->value) + Ghud_SetInt(clent, hud[h_team_l_num], ctfgame.team2); + else + Ghud_SetInt(clent, hud[h_team_l_num], teams[TEAM2].score); + if (teams[TEAM2].score >= 10) // gotta readjust size for justifying purposes Ghud_SetSize(clent, hud[h_team_r_num], 2, 0); else From 8b9011e18bd1be414e2a2689f331b80d809c261b Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Fri, 1 Nov 2024 15:33:01 -0400 Subject: [PATCH 21/24] Moved HUD score a bit, CTF/Esp team logos render in GHUD now --- src/action/a_ctf.c | 3 +++ src/action/g_spawn.c | 11 +++++++++-- src/action/p_hud.c | 19 ++++++++++++++++--- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/action/a_ctf.c b/src/action/a_ctf.c index e4ac18d7f..e2c6fd4da 100644 --- a/src/action/a_ctf.c +++ b/src/action/a_ctf.c @@ -1486,6 +1486,9 @@ void CTFCapReward(edict_t * ent) void CTFSetupStatusbar( void ) { + // Frags closer to the team scores + Q_strncatz(level.statusbar, "xr -76 yb -188 num 3 14 ", sizeof(level.statusbar)); + Q_strncatz(level.statusbar, // Red Team "yb -164 " "if 24 " "xr -24 " "pic 24 " "endif " "xr -60 " "num 2 26 " diff --git a/src/action/g_spawn.c b/src/action/g_spawn.c index a7690ae5c..156287163 100644 --- a/src/action/g_spawn.c +++ b/src/action/g_spawn.c @@ -1710,8 +1710,15 @@ void G_SetupStatusbar( void ) { Q_strncpyz(level.statusbar, STATBAR_COMMON, sizeof(level.statusbar)); - if(!((noscore->value || hud_noscore->value) && teamplay->value)) // frags - Q_strncatz(level.statusbar, "xr -50 yt 2 num 3 14 ", sizeof(level.statusbar)); + // if(!((noscore->value || hud_noscore->value) && teamplay->value) && !ctf->value) // frags + // Q_strncatz(level.statusbar, "xr -50 yt 2 num 3 14 ", sizeof(level.statusbar)); + + // Display frags in top-right corner if teamplay, but not in CTF (moved that to CTFSetupStatusbar()) + if (!(noscore->value || hud_noscore->value) || !teamplay->value) { + if (!ctf->value) { + Q_strncatz(level.statusbar, "xr -50 yt 2 num 3 14 ", sizeof(level.statusbar)); + } + } if (ctf->value) CTFSetupStatusbar(); diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 7bb0f8764..5e0be8df7 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -1101,14 +1101,27 @@ void HUD_SpectatorSetup(edict_t *clent) Ghud_SetAnchor(clent, hud[h], 1, 0); } - // GHUD top corner team icon - hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_teamskin[1], 24, 24); + // GHUD top corner team icons + + // Team 1 + if (ctf->value) // CTF + hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_ctf_flagbase[TEAM1], 24, 24); + else if (esp->value) // Espionage + hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_esp_teamicon[TEAM1], 24, 24); + else // Teamplay/Matchmode/Domination + hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_teamskin[TEAM1], 24, 24); Ghud_SetAnchor(clent, hud[h_team_l], 0, 0); hud[h_team_l_num] = Ghud_AddNumber(clent, 96, 2, 0); Ghud_SetSize(clent, hud[h_team_l_num], 2, 0); Ghud_SetAnchor(clent, hud[h_team_l_num], 0, 0); - hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_teamskin[2], 24, 24); + // Team 2 + if (ctf->value) // CTF + hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_ctf_flagbase[TEAM2], 24, 24); + else if (esp->value) // Espionage + hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_esp_teamicon[TEAM2], 24, 24); + else // Teamplay/Matchmode/Domination + hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_teamskin[TEAM2], 24, 24); Ghud_SetAnchor(clent, hud[h_team_r], 1, 0); hud[h_team_r_num] = Ghud_AddNumber(clent, -128, 2, 0); Ghud_SetSize(clent, hud[h_team_r_num], 1, 0); From 12536545bc30f934477077445099320e6d1d135b Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Wed, 6 Nov 2024 16:45:08 -0500 Subject: [PATCH 22/24] Team scores moved to center, matchmode has its own format --- src/action/p_hud.c | 272 ++++++++++++++++++++++++--------------------- 1 file changed, 143 insertions(+), 129 deletions(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 5e0be8df7..1eb8926c3 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -51,6 +51,29 @@ #include "g_local.h" +// Red team colors +int red_team_red = 220; +int red_team_green = 60; +int red_team_blue = 60; +int alt_red_team_red = 110; +int alt_red_team_green = 45; +int alt_red_team_blue = 45; + +// Blue team colors +int blue_team_red = 40; +int blue_team_green = 40; +int blue_team_blue = 220; +int alt_blue_team_red = 30; +int alt_blue_team_green = 60; +int alt_blue_team_blue = 110; + +// Green team colors +int green_team_red = 40; +int green_team_green = 220; +int green_team_blue = 40; +int alt_green_team_red = 30; +int alt_green_team_green = 140; +int alt_green_team_blue = 30; /* ====================================================================== @@ -827,10 +850,29 @@ static void HUD_UpdateSpectatorTimer(edict_t *clent) // Change bar color to orange Ghud_SetColor(clent, hud[h_spectator_timer_border], 255, 165, 0, 120); } else { - // Change bar color to green - Ghud_SetColor(clent, hud[h_spectator_timer_border], 20, 20, 20, 255); + // Change bar color to gray + Ghud_SetColor(clent, hud[h_spectator_timer_border], 20, 20, 20, 120); } - + + // Score bug update + + // team 1 (red team) + Ghud_SetFlags(clent, hud[h_team_l], 0); + Ghud_SetFlags(clent, hud[h_team_l_num], 0); + if (ctf->value) + Ghud_SetInt(clent, hud[h_team_l_num], ctfgame.team1); + else + //Ghud_SetInt(clent, hud[h_team_l_num], 13); + Ghud_SetInt(clent, hud[h_team_l_num], teams[TEAM1].score); + + // team 2 (blue team) + Ghud_SetFlags(clent, hud[h_team_r], 0); + Ghud_SetFlags(clent, hud[h_team_r_num], 0); + if (ctf->value) + Ghud_SetInt(clent, hud[h_team_r_num], ctfgame.team2); + else + //Ghud_SetInt(clent, hud[h_team_r_num], 25); + Ghud_SetInt(clent, hud[h_team_r_num], teams[TEAM2].score); } void HUD_SpectatorTimerSetup(edict_t *clent) @@ -853,30 +895,30 @@ void HUD_SpectatorTimerSetup(edict_t *clent) // GHUD bottom center stat display int x, y; x = 0; - y = 0; + y = 30; hud[h_spectator_timer_border] = Ghud_NewElement(clent, GHT_FILL); Ghud_SetAnchor(clent, hud[h_spectator_timer_border], 0.5, 0); - Ghud_SetPosition(clent, hud[h_spectator_timer_border], x - 51, y); - Ghud_SetSize(clent, hud[h_spectator_timer_border], 102, 31); + Ghud_SetPosition(clent, hud[h_spectator_timer_border], x - 66, y - 1); + Ghud_SetSize(clent, hud[h_spectator_timer_border], 130, 56); Ghud_SetColor(clent, hud[h_spectator_timer_border], 50, 150, 50, 120); hud[h_spectator_timer] = Ghud_NewElement(clent, GHT_FILL); Ghud_SetAnchor(clent, hud[h_spectator_timer], 0.5, 0); - Ghud_SetPosition(clent, hud[h_spectator_timer], x - 50, y); - Ghud_SetSize(clent, hud[h_spectator_timer], 100, 30); - Ghud_SetColor(clent, hud[h_spectator_timer], 50, 50, 50, 255); + Ghud_SetPosition(clent, hud[h_spectator_timer], x - 65, y); + Ghud_SetSize(clent, hud[h_spectator_timer], 128, 54); + Ghud_SetColor(clent, hud[h_spectator_timer], 50, 50, 50, 120); // Add number elements for minutes - hud[h_spectator_time_tm] = Ghud_AddNumber(clent, x - 50, 2, 0); - hud[h_spectator_time_mm] = Ghud_AddNumber(clent, x - 30, 2, 0); + hud[h_spectator_time_tm] = Ghud_AddNumber(clent, x - 50, y, 0); + hud[h_spectator_time_mm] = Ghud_AddNumber(clent, x - 30, y, 0); // Draw timer seperator hud[h_spectator_time_sep] = Ghud_AddText(clent, x - 5, y + 12, ":"); // Add number elements for seconds - hud[h_spectator_time_ts] = Ghud_AddNumber(clent, x + 10, 2, 0); - hud[h_spectator_time_ss] = Ghud_AddNumber(clent, x + 30, 2, 0); + hud[h_spectator_time_ts] = Ghud_AddNumber(clent, x + 10, y, 0); + hud[h_spectator_time_ss] = Ghud_AddNumber(clent, x + 30, y, 0); // Anchor everything to the top middle Ghud_SetAnchor(clent, hud[h_spectator_time_tm], 0.5, 0); @@ -885,12 +927,68 @@ void HUD_SpectatorTimerSetup(edict_t *clent) Ghud_SetAnchor(clent, hud[h_spectator_time_ts], 0.5, 0); Ghud_SetAnchor(clent, hud[h_spectator_time_ss], 0.5, 0); - } else { - Ghud_SetFlags(clent, hud[h_spectator_time_tm], GHF_HIDE); - Ghud_SetFlags(clent, hud[h_spectator_time_mm], GHF_HIDE); - Ghud_SetFlags(clent, hud[h_spectator_time_sep], GHF_HIDE); - Ghud_SetFlags(clent, hud[h_spectator_time_ts], GHF_HIDE); - Ghud_SetFlags(clent, hud[h_spectator_time_ss], GHF_HIDE); + } else { + Ghud_SetFlags(clent, hud[h_spectator_time_tm], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_mm], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_sep], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_ts], GHF_HIDE); + Ghud_SetFlags(clent, hud[h_spectator_time_ss], GHF_HIDE); + } + + // GHUD team icons and scores + + // Team 1 + if (ctf->value) // CTF + hud[h_team_l] = Ghud_AddIcon(clent, 2, 28, level.pic_ctf_flagbase[TEAM1], 24, 24); + else if (esp->value) // Espionage + hud[h_team_l] = Ghud_AddIcon(clent, 2, 28, level.pic_esp_teamicon[TEAM1], 24, 24); + else if (matchmode->value) { // Matchmode + hud[h_team_l] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetAnchor(clent, hud[h_team_l], 0.5, 0); + Ghud_SetPosition(clent, hud[h_team_l], -65, 54); + Ghud_SetSize(clent, hud[h_team_l], 60, 5); + Ghud_SetColor(clent, hud[h_team_l], red_team_red, red_team_green, red_team_blue, 255); + //hud[h_team_l] = Ghud_AddIcon(clent, -70, 28, level.pic_teamskin[TEAM1], 24, 24); + } else // Teamplay/Domination + hud[h_team_l] = Ghud_AddIcon(clent, -30, 60, level.pic_teamskin[TEAM1], 24, 24); + Ghud_SetAnchor(clent, hud[h_team_l], 0.5, 0); + hud[h_team_l_num] = Ghud_AddNumber(clent, -70, 60, 0); + Ghud_SetSize(clent, hud[h_team_l_num], 2, 0); + Ghud_SetAnchor(clent, hud[h_team_l_num], 0.5, 0); + Ghud_SetFlags(clent, hud[h_team_l_num], UI_RIGHT); + + // Team 2 + if (ctf->value) // CTF + hud[h_team_r] = Ghud_AddIcon(clent, -26, 28, level.pic_ctf_flagbase[TEAM2], 24, 24); + else if (esp->value) // Espionage + hud[h_team_r] = Ghud_AddIcon(clent, -26, 28, level.pic_esp_teamicon[TEAM2], 24, 24); + else if (matchmode->value) { // Matchmode + hud[h_team_r] = Ghud_NewElement(clent, GHT_FILL); + Ghud_SetAnchor(clent, hud[h_team_r], 0.5, 0); + Ghud_SetPosition(clent, hud[h_team_r], 2, 54); + Ghud_SetSize(clent, hud[h_team_r], 60, 5); + Ghud_SetColor(clent, hud[h_team_r], blue_team_red, blue_team_green, blue_team_blue, 255); + } else // Teamplay/Domination + hud[h_team_r] = Ghud_AddIcon(clent, 10, 60, level.pic_teamskin[TEAM2], 24, 24); + Ghud_SetAnchor(clent, hud[h_team_r], 0.5, 0); + + if (teams[TEAM2].score >= 10) // gotta readjust size for justifying purposes + hud[h_team_r_num] = Ghud_AddNumber(clent, 35, 60, 0); + else + hud[h_team_r_num] = Ghud_AddNumber(clent, 0, 60, 0); + + Ghud_SetSize(clent, hud[h_team_r_num], 2, 0); + Ghud_SetAnchor(clent, hud[h_team_r_num], 0.5, 0); + Ghud_SetFlags(clent, hud[h_team_r_num], UI_LEFT); + + if (matchmode->value) { // Move the scores closer together slightly + int t2_x = 0; + Ghud_SetPosition(clent, hud[h_team_l_num], -55, 60); + + if (teams[TEAM2].score >= 10) + Ghud_SetPosition(clent, hud[h_team_r_num], (t2_x + 20), 60); + else + Ghud_SetPosition(clent, hud[h_team_r_num], t2_x, 60); } } @@ -1001,22 +1099,6 @@ void HUD_SpectatorSetup(edict_t *clent) clent->client->resp.hud_type = 1; int nameplate_alpha = 230; - - // Red team colors - int red_team_red = 220; - int red_team_green = 60; - int red_team_blue = 60; - int alt_red_team_red = 110; - int alt_red_team_green = 45; - int alt_red_team_blue = 45; - - // Blue team colors - int blue_team_red = 40; - int blue_team_green = 80; - int blue_team_blue = 220; - int alt_blue_team_red = 30; - int alt_blue_team_green = 60; - int alt_blue_team_blue = 110; int *hud = clent->client->resp.hud_items; int i; @@ -1026,108 +1108,83 @@ void HUD_SpectatorSetup(edict_t *clent) if (teamplay->value) { for (i = 0; i < 6; i++) { - int x, y; + int x, y, yy; int h_base = h_nameplate_l + (i * 5); int h; x = 0; - y = 28 + (28 * i); + y = 56; + yy = y + (28 * i); h = h_base; // back bar hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y); + Ghud_SetPosition(clent, hud[h], x, yy); Ghud_SetAnchor(clent, hud[h], 0, 0); Ghud_SetSize(clent, hud[h], 144, 24); Ghud_SetColor(clent, hud[h], alt_red_team_red, alt_red_team_green, alt_red_team_blue, nameplate_alpha); h = h_base + 1; // health bar hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y); + Ghud_SetPosition(clent, hud[h], x, yy); Ghud_SetAnchor(clent, hud[h], 0, 0); Ghud_SetSize(clent, hud[h], 0, 24); Ghud_SetColor(clent, hud[h], red_team_red, red_team_green, red_team_blue, nameplate_alpha); h = h_base + 2; // name - hud[h] = Ghud_AddText(clent, x + 142, y + 3, ""); + hud[h] = Ghud_AddText(clent, x + 142, yy + 3, ""); Ghud_SetAnchor(clent, hud[h], 0, 0); Ghud_SetTextFlags(clent, hud[h], UI_RIGHT); h = h_base + 3; // k/d - hud[h] = Ghud_AddText(clent, x + 142, y + 14, ""); + hud[h] = Ghud_AddText(clent, x + 142, yy + 14, ""); Ghud_SetAnchor(clent, hud[h], 0, 0); Ghud_SetTextFlags(clent, hud[h], UI_RIGHT); h = h_base + 4; // weapon select - hud[h] = Ghud_AddIcon(clent, x + 2, y + 2, level.pic_items[M4_NUM], 20, 20); + hud[h] = Ghud_AddIcon(clent, x + 2, yy + 2, level.pic_items[M4_NUM], 20, 20); Ghud_SetAnchor(clent, hud[h], 0, 0); } // Right side nameplates for (i = 0; i < 6; i++) { - int x, y; + int x, y, yy; int h_base = h_nameplate_r + (i * 5); int h; x = -144; - y = 28 + (28 * i); + y = 56; + yy = y + (28 * i); h = h_base; // back bar hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y); + Ghud_SetPosition(clent, hud[h], x, yy); Ghud_SetAnchor(clent, hud[h], 1, 0); Ghud_SetSize(clent, hud[h], 144, 24); Ghud_SetColor(clent, hud[h], alt_blue_team_red, alt_blue_team_green, alt_blue_team_blue, nameplate_alpha); h = h_base + 1; // health bar hud[h] = Ghud_NewElement(clent, GHT_FILL); - Ghud_SetPosition(clent, hud[h], x, y); + Ghud_SetPosition(clent, hud[h], x, yy); Ghud_SetAnchor(clent, hud[h], 1, 0); Ghud_SetSize(clent, hud[h], 0, 24); Ghud_SetColor(clent, hud[h], blue_team_red, blue_team_green, blue_team_blue, nameplate_alpha); h = h_base + 2; // name - hud[h] = Ghud_AddText(clent, x + 2, y + 3, ""); + hud[h] = Ghud_AddText(clent, x + 2, yy + 3, ""); Ghud_SetAnchor(clent, hud[h], 1, 0); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 3; // k/d - hud[h] = Ghud_AddText(clent, x + 2, y + 14, ""); + hud[h] = Ghud_AddText(clent, x + 2, yy + 14, ""); Ghud_SetAnchor(clent, hud[h], 1, 0); Ghud_SetTextFlags(clent, hud[h], UI_LEFT); h = h_base + 4; // weapon select - hud[h] = Ghud_AddIcon(clent, x + 122, y + 2, level.pic_items[M4_NUM], 20, 20); + hud[h] = Ghud_AddIcon(clent, x + 122, yy + 2, level.pic_items[M4_NUM], 20, 20); Ghud_SetAnchor(clent, hud[h], 1, 0); } - - // GHUD top corner team icons - - // Team 1 - if (ctf->value) // CTF - hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_ctf_flagbase[TEAM1], 24, 24); - else if (esp->value) // Espionage - hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_esp_teamicon[TEAM1], 24, 24); - else // Teamplay/Matchmode/Domination - hud[h_team_l] = Ghud_AddIcon(clent, 2, 2, level.pic_teamskin[TEAM1], 24, 24); - Ghud_SetAnchor(clent, hud[h_team_l], 0, 0); - hud[h_team_l_num] = Ghud_AddNumber(clent, 96, 2, 0); - Ghud_SetSize(clent, hud[h_team_l_num], 2, 0); - Ghud_SetAnchor(clent, hud[h_team_l_num], 0, 0); - - // Team 2 - if (ctf->value) // CTF - hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_ctf_flagbase[TEAM2], 24, 24); - else if (esp->value) // Espionage - hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_esp_teamicon[TEAM2], 24, 24); - else // Teamplay/Matchmode/Domination - hud[h_team_r] = Ghud_AddIcon(clent, -26, 2, level.pic_teamskin[TEAM2], 24, 24); - Ghud_SetAnchor(clent, hud[h_team_r], 1, 0); - hud[h_team_r_num] = Ghud_AddNumber(clent, -128, 2, 0); - Ghud_SetSize(clent, hud[h_team_r_num], 1, 0); - Ghud_SetAnchor(clent, hud[h_team_r_num], 1, 0); } - // GHUD chase player stats HUD_SpectatorStatsSetup(clent); @@ -1194,17 +1251,10 @@ void HUD_SpectatorUpdate(edict_t *clent) } } - // team 1 (red team) - Ghud_SetFlags(clent, hud[h_team_l], 0); - Ghud_SetFlags(clent, hud[h_team_l_num], 0); - if (ctf->value) - Ghud_SetInt(clent, hud[h_team_l_num], ctfgame.team1); - else - Ghud_SetInt(clent, hud[h_team_l_num], teams[TEAM1].score); - + for (i = 0; i < 6; i++) { - int x, y; + int x, y, yy; int h = h_nameplate_l + (i * 5); gclient_t *cl = team1_players[i]; @@ -1219,7 +1269,8 @@ void HUD_SpectatorUpdate(edict_t *clent) } x = 0; - y = 28 + (28 * i); + y = 56; + yy = y + (28 * i); // unhide our elements Ghud_SetFlags(clent, hud[h + 0], 0); @@ -1234,7 +1285,7 @@ void HUD_SpectatorUpdate(edict_t *clent) { Ghud_SetSize(clent, hud[h + 1], 0, 24); - Ghud_SetPosition(clent, hud[h + 0], x, y); + Ghud_SetPosition(clent, hud[h + 0], x, yy); Ghud_SetSize(clent, hud[h + 0], 144, 24); } else @@ -1246,7 +1297,7 @@ void HUD_SpectatorUpdate(edict_t *clent) Ghud_SetSize(clent, hud[h + 1], 144 * hp_frac, 24); Ghud_SetSize(clent, hud[h + 0], 144 * hp_invfrac, 24); - Ghud_SetPosition(clent, hud[h + 0], x + (144 * (hp_frac)), y); + Ghud_SetPosition(clent, hud[h + 0], x + (144 * (hp_frac)), yy); } // generate strings @@ -1275,23 +1326,9 @@ void HUD_SpectatorUpdate(edict_t *clent) Ghud_SetInt(clent, hud[h + 4], level.pic_items[MK23_NUM]); } - - // team 2 (blue team) - Ghud_SetFlags(clent, hud[h_team_r], 0); - Ghud_SetFlags(clent, hud[h_team_r_num], 0); - if (ctf->value) - Ghud_SetInt(clent, hud[h_team_l_num], ctfgame.team2); - else - Ghud_SetInt(clent, hud[h_team_l_num], teams[TEAM2].score); - - if (teams[TEAM2].score >= 10) // gotta readjust size for justifying purposes - Ghud_SetSize(clent, hud[h_team_r_num], 2, 0); - else - Ghud_SetSize(clent, hud[h_team_r_num], 1, 0); - for (i = 0; i < 6; i++) { - int x, y; + int x, y, yy; int h = h_nameplate_r + (i * 5); gclient_t *cl = team2_players[i]; @@ -1306,7 +1343,8 @@ void HUD_SpectatorUpdate(edict_t *clent) } x = -144; - y = 28 + (28 * i); + y = 56; + yy = y + (28 * i); // unhide our elements Ghud_SetFlags(clent, hud[h + 0], 0); @@ -1332,7 +1370,7 @@ void HUD_SpectatorUpdate(edict_t *clent) Ghud_SetSize(clent, hud[h + 1], 144 * hp_frac, 24); Ghud_SetSize(clent, hud[h + 0], 144 * hp_invfrac, 24); - Ghud_SetPosition(clent, hud[h + 1], x + (144 * hp_invfrac), y); + Ghud_SetPosition(clent, hud[h + 1], x + (144 * hp_invfrac), yy); //Ghud_SetPosition(clent, hud[h + 0], x + (144 * (hp_frac)), y); } @@ -1407,30 +1445,6 @@ void HUD_SpectatorUpdate(edict_t *clent) // Change color based on team int nameplate_alpha = 180; - // Red team colors - int red_team_red = 220; - int red_team_green = 60; - int red_team_blue = 60; - int alt_red_team_red = 110; - int alt_red_team_green = 45; - int alt_red_team_blue = 45; - - // Blue team colors - int blue_team_red = 40; - int blue_team_green = 80; - int blue_team_blue = 220; - int alt_blue_team_red = 30; - int alt_blue_team_green = 60; - int alt_blue_team_blue = 110; - - // Green team colors - int green_team_red = 40; - int green_team_green = 220; - int green_team_blue = 40; - int alt_green_team_red = 30; - int alt_green_team_green = 140; - int alt_green_team_blue = 30; - // target name Ghud_SetText(clent, hud[h_nbar + 1], nm_s); // target stat bar From 29c49fbef0d00361c28431dd5cbefdd0b98e94a0 Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Wed, 6 Nov 2024 16:54:24 -0500 Subject: [PATCH 23/24] Save point --- src/action/p_hud.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/action/p_hud.c b/src/action/p_hud.c index 1eb8926c3..389411ca6 100644 --- a/src/action/p_hud.c +++ b/src/action/p_hud.c @@ -862,7 +862,7 @@ static void HUD_UpdateSpectatorTimer(edict_t *clent) if (ctf->value) Ghud_SetInt(clent, hud[h_team_l_num], ctfgame.team1); else - //Ghud_SetInt(clent, hud[h_team_l_num], 13); + //Ghud_SetInt(clent, hud[h_team_l_num], 13); // Testing double digits Ghud_SetInt(clent, hud[h_team_l_num], teams[TEAM1].score); // team 2 (blue team) @@ -871,7 +871,7 @@ static void HUD_UpdateSpectatorTimer(edict_t *clent) if (ctf->value) Ghud_SetInt(clent, hud[h_team_r_num], ctfgame.team2); else - //Ghud_SetInt(clent, hud[h_team_r_num], 25); + //Ghud_SetInt(clent, hud[h_team_r_num], 25); // Testing double digits Ghud_SetInt(clent, hud[h_team_r_num], teams[TEAM2].score); } @@ -975,7 +975,7 @@ void HUD_SpectatorTimerSetup(edict_t *clent) if (teams[TEAM2].score >= 10) // gotta readjust size for justifying purposes hud[h_team_r_num] = Ghud_AddNumber(clent, 35, 60, 0); else - hud[h_team_r_num] = Ghud_AddNumber(clent, 0, 60, 0); + hud[h_team_r_num] = Ghud_AddNumber(clent, 20, 60, 0); Ghud_SetSize(clent, hud[h_team_r_num], 2, 0); Ghud_SetAnchor(clent, hud[h_team_r_num], 0.5, 0); From a22904881273acefc43a8c8495c1534ecf9a4b05 Mon Sep 17 00:00:00 2001 From: Aaron Dean <8dino2@gmail.com> Date: Fri, 8 Nov 2024 12:37:45 -0500 Subject: [PATCH 24/24] Static link libjpeg --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 74d759f7f..70fe4dbf2 100644 --- a/meson.build +++ b/meson.build @@ -407,6 +407,7 @@ game_deps = [zlib] jpeg = dependency('libjpeg', required: get_option('libjpeg'), default_options: fallback_opt + [ 'jpeg-turbo=disabled', 'tests=disabled' ], + static: true ) if jpeg.found()