* Does this by implementing a new operator in `HUD_CenterPrint` - "`^BOLD`." Put `^BOLD` at the beginning of a centerprint notification to make it bold.
seta hud_panel_centerprint_align "" "text alignment: 0 left, 0.5 center, 1 right"
seta hud_panel_centerprint_flip "" "invert messages order"
seta hud_panel_centerprint_fontscale "" "scale the text font by this amount"
+seta hud_panel_centerprint_fontscale_bold "" "scale the bold text font by this amount"
seta hud_panel_centerprint_time "" "message duration (NOTE: certain messages have a fixed duration)"
seta hud_panel_centerprint_fade_in "" "how long a message takes to fade in"
seta hud_panel_centerprint_fade_out "" "how long a message takes to fade out (this time is included in the message duration and can't be > 5)"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
float autocvar_hud_panel_centerprint_fade_minfontsize = 0;
bool autocvar_hud_panel_centerprint_flip;
float autocvar_hud_panel_centerprint_fontscale;
+float autocvar_hud_panel_centerprint_fontscale_bold;
float autocvar_hud_panel_centerprint_time;
bool autocvar_hud_panel_chat;
bool autocvar_hud_panel_engineinfo;
HUD_Write_Cvar("hud_panel_centerprint_align");
HUD_Write_Cvar("hud_panel_centerprint_flip");
HUD_Write_Cvar("hud_panel_centerprint_fontscale");
+ HUD_Write_Cvar("hud_panel_centerprint_fontscale_bold");
HUD_Write_Cvar("hud_panel_centerprint_time");
HUD_Write_Cvar("hud_panel_centerprint_fade_in");
HUD_Write_Cvar("hud_panel_centerprint_fade_out");
#include <client/miscfunctions.qh>
// CenterPrint (#16)
+// These are the functions that draw the text at the center of the screen (e.g. frag messages and server MOTDs).
+// Usually local_notification_centerprint_generic() is called, which in turn calls centerprint_generic(), which
+// uses some kind of macro magic to call HUD_CenterPrint, which draws them on screen using drawcolorcodedstring().
const int CENTERPRINT_MAX_MSGS = 10;
const int CENTERPRINT_MAX_ENTRIES = 50;
strfree(centerprint_messages[i]);
}
}
+
float hud_configure_cp_generation_time;
void HUD_CenterPrint ()
{
panel_size -= '2 2 0' * panel_bg_padding;
}
+ bool is_bold;
+ string centerprint_message;
int entries;
float height;
vector fontsize;
- // entries = bound(1, floor(CENTERPRINT_MAX_ENTRIES * 4 * panel_size_y/panel_size_x), CENTERPRINT_MAX_ENTRIES);
- // height = panel_size_y/entries;
- // fontsize = '1 1 0' * height;
- height = vid_conheight/50 * autocvar_hud_panel_centerprint_fontscale;
- fontsize = '1 1 0' * height;
- entries = bound(1, floor(panel_size.y/height), CENTERPRINT_MAX_ENTRIES);
int i, j, k, n, g;
float a, sz, align, current_msg_posY = 0, msg_size;
align = bound(0, autocvar_hud_panel_centerprint_align, 1);
for (g=0, i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
{
+ // if the notification starts with ^BOLD make it bold (e.g. frag messages);
+ is_bold = (substring(centerprint_messages[j], 0, 5) == BOLD_OPERATOR);
+ // remove ^BOLD so it doesn't get printed onscreen
+ centerprint_message = is_bold ? strzone(substring(centerprint_messages[j], 5, -1)) : strzone(centerprint_messages[j]);
+
+ // entries = bound(1, floor(CENTERPRINT_MAX_ENTRIES * 4 * panel_size_y/panel_size_x), CENTERPRINT_MAX_ENTRIES);
+ // height = panel_size_y/entries;
+ // fontsize = '1 1 0' * height;
+ height = (is_bold) ? vid_conheight/50 * autocvar_hud_panel_centerprint_fontscale_bold : vid_conheight/50 * autocvar_hud_panel_centerprint_fontscale;
+ fontsize = '1 1 0' * height;
+ entries = bound(1, floor(panel_size.y/height), CENTERPRINT_MAX_ENTRIES);
+
if (j == CENTERPRINT_MAX_MSGS)
j = 0;
if (centerprint_expire_time[j] == -1)
drawfontscale = hud_scale * sz;
if (centerprint_countdown_num[j])
- n = tokenizebyseparator(strreplace("^COUNT", count_seconds(centerprint_countdown_num[j]), centerprint_messages[j]), "\n");
+ n = tokenizebyseparator(strreplace("^COUNT", count_seconds(centerprint_countdown_num[j]), centerprint_message), "\n");
else
- n = tokenizebyseparator(centerprint_messages[j], "\n");
+ n = tokenizebyseparator(centerprint_message, "\n");
if (autocvar_hud_panel_centerprint_flip)
{
if (align)
pos.x = panel_pos.x + (panel_size.x - stringwidth(ts, true, fontsize) * sz) * align;
if (a > 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.
+ if (is_bold) draw_beginBoldFont();
drawcolorcodedstring(pos + eY * 0.5 * (1 - sz * hud_scale.x) * fontsize.y, ts, fontsize, a, DRAWFLAG_NORMAL);
+ if (is_bold) draw_endBoldFont();
pos.y += fontsize.y;
}
else
return;
}
}
+
+ // free up memory
+ strunzone(centerprint_message);
}
drawfontscale = hud_scale;
if (all_messages_expired)
#define VERBOSE_MURDER(type) strcat(MURDER_##type, "^BG%s")
- #define MURDER_FRAG _("^K3%sYou fragged ^BG%s")
- #define MURDER_FRAG2 _("^K3%sYou scored against ^BG%s")
+ #define MURDER_FRAG strcat(BOLD_OPERATOR, _("^K3%sYou fragged ^BG%s"))
+ #define MURDER_FRAG2 strcat(BOLD_OPERATOR, _("^K3%sYou scored against ^BG%s"))
#define MURDER_FRAGGED _("^K1%sYou were fragged by ^BG%s")
#define MURDER_FRAGGED2 _("^K1%sYou were scored against by ^BG%s")
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG, N_ENABLE, 1, 1, "spree_cen s1", CPID_Null, "0 0", MURDER_FRAG, MURDER_FRAG2 )
MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_VERBOSE, N_ENABLE, 1, 4, "spree_cen s1 frag_stats", CPID_Null, "0 0", VERBOSE_MURDER(FRAGGED), VERBOSE_MURDER(FRAGGED2) )
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_VERBOSE, N_ENABLE, 1, 2, "spree_cen s1 frag_ping", CPID_Null, "0 0", VERBOSE_MURDER(FRAG), VERBOSE_MURDER(FRAG2) )
- #define MURDER_FRAG_FIRE _("^K3%sYou burned ^BG%s")
- #define MURDER_FRAG_FIRE2 _("^K3%sYou scored against ^BG%s")
+ #define MURDER_FRAG_FIRE strcat(BOLD_OPERATOR, _("^K3%sYou burned ^BG%s"))
+ #define MURDER_FRAG_FIRE2 strcat(BOLD_OPERATOR, _("^K3%sYou scored against ^BG%s"))
#define MURDER_FRAGGED_FIRE _("^K1%sYou were burned by ^BG%s")
#define MURDER_FRAGGED_FIRE2 _("^K1%sYou were scored against by ^BG%s")
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FIRE, N_ENABLE, 1, 1, "spree_cen s1", CPID_Null, "0 0", MURDER_FRAG_FIRE, MURDER_FRAG_FIRE2 )
MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_FIRE_VERBOSE, N_ENABLE, 1, 4, "spree_cen s1 frag_stats", CPID_Null, "0 0", VERBOSE_MURDER(FRAGGED_FIRE), VERBOSE_MURDER(FRAGGED_FIRE2) )
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FIRE_VERBOSE, N_ENABLE, 1, 2, "spree_cen s1 frag_ping", CPID_Null, "0 0", VERBOSE_MURDER(FRAG_FIRE), VERBOSE_MURDER(FRAG_FIRE2) )
- #define MURDER_FRAG_FREEZE _("^K3%sYou froze ^BG%s")
- #define MURDER_FRAG_FREEZE2 _("^K3%sYou scored against ^BG%s")
+ #define MURDER_FRAG_FREEZE strcat(BOLD_OPERATOR, _("^K3%sYou froze ^BG%s"))
+ #define MURDER_FRAG_FREEZE2 strcat(BOLD_OPERATOR, _("^K3%sYou scored against ^BG%s"))
#define MURDER_FRAGGED_FREEZE _("^K1%sYou were frozen by ^BG%s")
#define MURDER_FRAGGED_FREEZE2 _("^K1%sYou were scored against by ^BG%s")
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FREEZE, N_ENABLE, 1, 1, "spree_cen s1", CPID_Null, "0 0", MURDER_FRAG_FREEZE, MURDER_FRAG_FREEZE2 )
MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_FREEZE_VERBOSE, N_ENABLE, 1, 4, "spree_cen s1 frag_stats", CPID_Null, "0 0", VERBOSE_MURDER(FRAGGED_FREEZE), VERBOSE_MURDER(FRAGGED_FREEZE2))
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FREEZE_VERBOSE, N_ENABLE, 1, 2, "spree_cen s1 frag_ping", CPID_Null, "0 0", VERBOSE_MURDER(FRAG_FREEZE), VERBOSE_MURDER(FRAG_FREEZE2) )
- #define MURDER_TYPEFRAG _("^K1%sYou typefragged ^BG%s")
- #define MURDER_TYPEFRAG2 _("^K1%sYou scored against ^BG%s^K1 while they were typing")
+ #define MURDER_TYPEFRAG strcat(BOLD_OPERATOR, _("^K1%sYou typefragged ^BG%s"))
+ #define MURDER_TYPEFRAG2 strcat(BOLD_OPERATOR, _("^K1%sYou scored against ^BG%s^K1 while they were typing"))
#define MURDER_TYPEFRAGGED _("^K1%sYou were typefragged by ^BG%s")
#define MURDER_TYPEFRAGGED2 _("^K1%sYou were scored against by ^BG%s^K1 while typing")
MSG_CENTER_NOTIF(DEATH_MURDER_TYPEFRAG, N_ENABLE, 1, 1, "spree_cen s1", CPID_Null, "0 0", MURDER_TYPEFRAG, MURDER_TYPEFRAG2 )
#include <client/autocvars.qh>
#endif
+// Operator for bold notifications
+#define BOLD_OPERATOR "^BOLD"
+
/** main types/groups of notifications */
ENUMCLASS(MSG)
/** "Global" AND "personal" announcer messages */