#include <client/mutators/_mod.qh>
#include <common/notifications/all.qh>
#include <common/stats.qh>
+#include <common/mapinfo.qh>
bool announcer_1min;
bool announcer_5min;
Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTOP);
delete(this);
announcer_countdown = NULL;
+ centerprint_ClearTitle();
return;
}
if(starttime <= time && roundstarttime != starttime) // game start time has passed
float countdown = (inround ? roundstarttime - time : starttime - time);
float countdown_rounded = floor(0.5 + countdown);
+ if(time >= starttime) centerprint_ClearTitle();
+
if(countdown <= 0) // countdown has finished, starttime is now
{
Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_BEGIN);
Local_Notification(MSG_MULTI, MULTI_COUNTDOWN_BEGIN);
delete(this);
announcer_countdown = NULL;
+ centerprint_ClearTitle();
return;
}
else // countdown is still going
setthink(announcer_countdown, Announcer_Countdown);
}
+ // Set centerprint title
+ if(time < STAT(GAMESTARTTIME) && !warmup_stage)
+ centerprint_SetTitle(MapInfo_Type_ToText(gametype));
+
if(time + 5.0 < startTime) // if connecting to server while restart was active don't always play prepareforbattle
if(time > announcer_countdown.nextthink) // don't play it again if countdown was already going
Local_Notification(MSG_ANNCE, ANNCE_PREPARE);
const int CENTERPRINT_MAX_MSGS = 10;
const int CENTERPRINT_MAX_ENTRIES = 50;
const float CENTERPRINT_SPACING = 0.5;
+const float CENTERPRINT_TITLE_SPACING = 1;
int cpm_index;
string centerprint_messages[CENTERPRINT_MAX_MSGS];
int centerprint_msgID[CENTERPRINT_MAX_MSGS];
int centerprint_countdown_num[CENTERPRINT_MAX_MSGS];
bool centerprint_showing;
+bool centerprint_title_show;
+string centerprint_title;
+
void centerprint_Add(int new_id, string strMessage, float duration, int countdown_num)
{
TC(int, new_id); TC(int, countdown_num);
}
}
+void centerprint_ClearTitle()
+{
+ strfree(centerprint_title);
+ centerprint_title_show = false;
+}
+
+void centerprint_SetTitle(string title)
+{
+ if(title != centerprint_title) {
+ if(centerprint_title)
+ strfree(centerprint_title);
+
+ centerprint_title = strzone(title);
+ centerprint_title_show = true;
+ }
+}
+
float hud_configure_cp_generation_time;
void HUD_CenterPrint()
{
{
if(!autocvar_hud_panel_centerprint) return;
- if(hud_configure_prev)
+ if(hud_configure_prev) {
+ centerprint_ClearTitle();
centerprint_KillAll();
+ }
}
else
{
{
if(highlightedPanel == HUD_PANEL(CENTERPRINT))
{
+ centerprint_SetTitle(strcat("test", ftos(hud_configure_cp_generation_time)));
+
float r;
r = random();
if (r > 0.8)
}
int i, j, k, n, g;
- float a, sz, align, current_msg_posY = 0, msg_size;
+ float a = 1, sz, align, current_msg_posY = 0, msg_size;
vector pos;
string ts = "";
bool all_messages_expired = true;
if (autocvar_hud_panel_centerprint_flip)
pos.y += panel_size.y;
align = bound(0, autocvar_hud_panel_centerprint_align, 1);
+
+ // Show title if available
+ if(centerprint_title_show) {
+ vector fontsize = hud_fontsize * autocvar_hud_panel_centerprint_fontscale_title;
+
+ pos.x = panel_pos.x + (panel_size.x - stringwidth(centerprint_title, true, fontsize)) * align;
+ drawcolorcodedstring(pos, centerprint_title, fontsize, 1, DRAWFLAG_NORMAL);
+
+ if (autocvar_hud_panel_centerprint_flip)
+ pos.y -= fontsize.y + CENTERPRINT_TITLE_SPACING;
+ else
+ pos.y += fontsize.y + CENTERPRINT_TITLE_SPACING;
+
+ all_messages_expired = false;
+ }
+
for (g=0, i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
{
if (j == CENTERPRINT_MAX_MSGS)
}
// fade
- a = 1;
if(fade_in_time && centerprint_start_time[j] && time < centerprint_start_time[j] + fade_in_time) // Fade in
a = (time - centerprint_start_time[j]) / fade_in_time;
else if(time < centerprint_expire_time[j] - fade_out_time || centerprint_time[j] < 0) // Regularily printed or forced
float autocvar_hud_panel_centerprint_fade_subsequent_passtwo = 10;
float autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha = 0.5;
float autocvar_hud_panel_centerprint_fade_subsequent_minfontsize = 0.75;
-float autocvar_hud_panel_centerprint_fade_minfontsize = 0;
+float autocvar_hud_panel_centerprint_fade_minfontsize = 1;
bool autocvar_hud_panel_centerprint_flip;
float autocvar_hud_panel_centerprint_fontscale;
float autocvar_hud_panel_centerprint_fontscale_bold = 1.4;
-bool autocvar_hud_panel_centerprint_dynamichud = true;
+float autocvar_hud_panel_centerprint_fontscale_title = 2;
+bool autocvar_hud_panel_centerprint_dynamichud = true;
float autocvar_hud_panel_centerprint_time;
void centerprint_Add(int new_id, string strMessage, float duration, int countdown_num);
void centerprint_AddStandard(string strMessage);
void centerprint_Kill(int id);
void centerprint_KillAll();
+
+void centerprint_ClearTitle();
+void centerprint_SetTitle(string title);