From c600d8aad221bd7c2a39c2433c2e85ed5c804d73 Mon Sep 17 00:00:00 2001 From: z411 Date: Tue, 8 Mar 2022 01:04:54 -0300 Subject: [PATCH] Experiment: Changing bold to each centerprint line --- qcsrc/client/hud/panel/centerprint.qc | 45 ++++++++++++++------------- qcsrc/common/notifications/all.inc | 4 +-- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index 6e8667d2f..08fe3e65c 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -37,7 +37,6 @@ const float CENTERPRINT_SPACING = 0.7; int cpm_index; string centerprint_messages[CENTERPRINT_MAX_MSGS]; int centerprint_msgID[CENTERPRINT_MAX_MSGS]; -bool centerprint_bold[CENTERPRINT_MAX_MSGS]; float centerprint_time[CENTERPRINT_MAX_MSGS]; float centerprint_start_time[CENTERPRINT_MAX_MSGS]; float centerprint_expire_time[CENTERPRINT_MAX_MSGS]; @@ -53,11 +52,6 @@ void centerprint_Add(int new_id, string strMessage, float duration, int countdow if(strMessage == "" && new_id == 0) return; - // strip BOLD_OPERATOR - bool is_bold = (substring(strMessage, 0, 5) == BOLD_OPERATOR); - if (is_bold) - strMessage = substring(strMessage, 5, -1); - // strip trailing newlines j = strlen(strMessage) - 1; while(substring(strMessage, j, 1) == "\n" && j >= 0) @@ -108,7 +102,6 @@ void centerprint_Add(int new_id, string strMessage, float duration, int countdow } strcpy(centerprint_messages[j], strMessage); centerprint_start_time[j] = time; - centerprint_bold[j] = is_bold; centerprint_msgID[j] = new_id; if (duration < 0) { @@ -140,10 +133,10 @@ void centerprint_KillAll() { for (int i=0; i 0.5/255.0) // Otherwise guaranteed invisible - don't show. This is checked a second time after some multiplications with other factors were done so temporary changes of these cannot cause flicker. @@ -355,14 +352,18 @@ void HUD_CenterPrint() } } + float height_used = pos.y - msg_size; + ++g; // move next position number up msg_size = pos.y - msg_size; if (autocvar_hud_panel_centerprint_flip) { - pos.y = current_msg_posY - CENTERPRINT_SPACING * fontsize.y; + pos.y += height_used; + //pos.y = current_msg_posY - CENTERPRINT_SPACING * fontsize.y; if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages - pos.y += (msg_size + CENTERPRINT_SPACING * fontsize.y) * (1 - sqrt(sz)); + //pos.y += (msg_size + CENTERPRINT_SPACING * fontsize.y) * (1 - sqrt(sz)); + pos.y += height_used * (1 - sqrt(sz)); if (pos.y < panel_pos.y) // check if the next message can be shown { @@ -372,11 +373,13 @@ void HUD_CenterPrint() } else { - pos.y += CENTERPRINT_SPACING * fontsize.y; + //pos.y += CENTERPRINT_SPACING * fontsize.y; + pos.y += height_used; if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages - pos.y -= (msg_size + CENTERPRINT_SPACING * fontsize.y) * (1 - sqrt(sz)); + //pos.y -= (msg_size + CENTERPRINT_SPACING * fontsize.y) * (1 - sqrt(sz)); + pos.y -= height_used * (1 - sqrt(sz)); - if(pos.y > panel_pos.y + panel_size.y - fontsize.y) // check if the next message can be shown + if(pos.y > panel_pos.y + panel_size.y - hud_fontsize.y) // check if the next message can be shown { drawfontscale = hud_scale; return; diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index f1b2af8e6..33fbee3bd 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -527,8 +527,8 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != MSG_CENTER_NOTIF(ASSAULT_OBJ_DESTROYED, N_ENABLE, 0, 1, "f1time", CPID_ASSAULT_ROLE, "0 0", _("^BGObjective destroyed in ^F4%s^BG!"), "") MSG_CENTER_NOTIF(COUNTDOWN_BEGIN, N_ENABLE, 0, 0, "", CPID_ROUND, "2 0", _("^F4Begin!"), "") - MSG_CENTER_NOTIF(COUNTDOWN_GAMESTART, N_ENABLE, 0, 1, "", CPID_ROUND, "1 f1", _("^F4Game starts in ^COUNT"), "") - MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTART, N_ENABLE, 0, 1, "", CPID_ROUND, "1 f1", _("^F4Round starts in ^COUNT"), "") + MSG_CENTER_NOTIF(COUNTDOWN_GAMESTART, N_ENABLE, 0, 1, "", CPID_ROUND, "1 f1", _("^BGGame starts in\n^BOLD^COUNT"), "") + MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTART, N_ENABLE, 0, 1, "", CPID_ROUND, "1 f1", _("^BGRound starts in\n^BOLD^COUNT"), "") MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTOP, N_ENABLE, 0, 0, "", CPID_ROUND, "2 0", _("^F4Round cannot start"), "") MSG_CENTER_NOTIF(ROUND_TIED, N_ENABLE, 0, 0, "", CPID_ROUND, "0 0", _("^BGRound tied"), "") -- 2.39.2