if (type == DEATH_TEAMCHANGE) {
centerprint(strcat(sprintf(_("You are now on: %s"), s1)));
} else if (type == DEATH_AUTOTEAMCHANGE) {
- centerprint(strcat(sprintf(_("You have been moved into a different team to improve team balance\nYou are now on: %s"), s1)));
+ centerprint(sprintf(_("You have been moved into a different team to improve team balance\nYou are now on: %s"), s1));
} else if (type == DEATH_CAMP) {
if(gentle)
- centerprint(strcat(_("^1Reconsider your tactics, camper!")));
+ centerprint(_("^1Reconsider your tactics, camper!"));
else
- centerprint(strcat(_("^1Die camper!")));
+ centerprint(_("^1Die camper!"));
} else if (type == DEATH_NOAMMO) {
if(gentle)
- centerprint(strcat(_("^1You are reinserted into the game for running out of ammo...")));
+ centerprint(_("^1You are reinserted into the game for running out of ammo..."));
else
- centerprint(strcat(_("^1You were killed for running out of ammo...")));
+ centerprint(_("^1You were killed for running out of ammo..."));
} else if (type == DEATH_ROT) {
if(gentle)
- centerprint(strcat(_("^1You need to preserve your health")));
+ centerprint(_("^1You need to preserve your health"));
else
- centerprint(strcat(_("^1You grew too old without taking your medicine")));
+ centerprint(_("^1You grew too old without taking your medicine"));
} else if (type == KILL_TEAM_RED || type == KILL_TEAM_BLUE) {
if(gentle)
- centerprint(strcat(_("^1Don't go against team mates!")));
+ centerprint(_("^1Don't go against team mates!"));
else
- centerprint(strcat(_("^1Don't shoot your team mates!")));
+ centerprint(_("^1Don't shoot your team mates!"));
} else if (type == DEATH_QUIET) {
// do nothing
} else { // generic message
if(gentle)
- centerprint(strcat(_("^1You need to be more careful!")));
+ centerprint(_("^1You need to be more careful!"));
else
- centerprint(strcat(_("^1You killed your own dumb self!")));
+ centerprint(_("^1You killed your own dumb self!"));
}
} else if(msg == MSG_KILL) {
if (type == KILL_TEAM_RED || type == KILL_TEAM_BLUE) {
}
} else if (type == KILL_FIRST_BLOOD) {
if(gentle) {
- centerprint(strcat(_("^1First score")));
+ centerprint(_("^1First score"));
} else {
- centerprint(strcat(_("^1First blood")));
+ centerprint(_("^1First blood"));
}
} else if (type == KILL_FIRST_VICTIM) {
if(gentle) {
- centerprint(strcat(_("^1First casualty")));
+ centerprint(_("^1First casualty"));
} else {
- centerprint(strcat(_("^1First victim")));
+ centerprint(_("^1First victim"));
}
} else if (type == KILL_TYPEFRAG) { // s2 contains "advanced kill messages" such as ping, handicap...
if(gentle) {
}
} else if(msg == MSG_KILL_ACTION) {
// TODO: invent more centerprints here?
- centerprint(strcat(_("^1Watch your step!")));
+ centerprint(_("^1Watch your step!"));
}
}
return;
if(duration == 0)
- duration = autocvar_hud_panel_centerprint_time;
+ duration = max(1, autocvar_hud_panel_centerprint_time);
for (i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
{
// CenterPrint (#16)
//
+float hud_configure_cp_generation_time;
+void reset_centerprint_messages(void)
+{
+ float i;
+ for (i=0; i<CENTERPRINT_MAX_MSGS; ++i)
+ {
+ centerprint_expire_time[i] = 0;
+ centerprint_time[i] = 1;
+ centerprint_msgID[i] = 0;
+ if(centerprint_messages[i])
+ strunzone(centerprint_messages[i]);
+ centerprint_messages[i] = strzone("");
+ }
+}
void HUD_CenterPrint (void)
{
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_centerprint) return;
+
+ if (hud_configure_prev)
+ reset_centerprint_messages();
}
else
+ {
hud_configure_active_panel = HUD_PANEL_CENTERPRINT;
+ if (!hud_configure_prev)
+ reset_centerprint_messages();
+ if (time > hud_configure_cp_generation_time)
+ {
+ float r;
+ r = random();
+ if (r > 0.9)
+ centerprint_generic(floor(r*1000), strcat(sprintf("^3Countdown message at time %s", seconds_tostring(time)), ", seconds left: %d"), 1, 10);
+ else if (r > 0.8)
+ centerprint_generic(0, sprintf("^1Multiline message at time %s that\n^1lasts longer than normal", seconds_tostring(time)), 20, 0);
+ else
+ centerprint(sprintf("Message at time %s", seconds_tostring(time)));
+ hud_configure_cp_generation_time = time + 1 + random()*4;
+ }
+ }
+
HUD_Panel_UpdateCvars(centerprint);
// this panel doesn't fade when showing the scoreboard
entries = bound(1, floor(panel_size_y/height), CENTERPRINT_MAX_ENTRIES);
float i, j, k, n;
- float a, sz, fade, align, next_msg_pos_y;
+ float a, sz, fade, align, current_msg_pos_y;
vector pos;
string ts;
pos = panel_pos;
if (autocvar_hud_panel_centerprint_flip)
- pos_y += panel_size_y - fontsize_y;
+ pos_y += panel_size_y;
fade = min(autocvar_hud_panel_centerprint_time/8, 0.25);
align = bound(0, autocvar_hud_panel_centerprint_align, 1);
- float alpha_factor;
- alpha_factor = panel_fg_alpha;
- if (autocvar__menu_alpha)
- alpha_factor *= hud_fade_alpha;
for (i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
{
if (j == CENTERPRINT_MAX_MSGS)
}
if (centerprint_time[j] < 0 || centerprint_expire_time[j] - fade > time)
{
- a = 1 * alpha_factor;
+ a = 1;
sz = 1;
}
else if (centerprint_expire_time[j] > time)
{
- a = (centerprint_expire_time[j] - time) / fade * alpha_factor;
+ a = (centerprint_expire_time[j] - time) / fade;
sz = 0.8 + a * (1 - 0.8);
}
getWrappedLine_remaining = argv(k);
ts = getWrappedLine(panel_size_x, fontsize, stringwidth_colors);
if (ts != "")
- pos_y -= fontsize_y * 1.5;
- else
pos_y -= fontsize_y;
+ else
+ pos_y -= fontsize_y * 0.35;
if (pos_y < panel_pos_y) // check if the next line can be shown
return;
}
- next_msg_pos_y = pos_y; // save pos of the next message
+ current_msg_pos_y = pos_y; // save starting pos (first line) of the current message
}
for(k = 0; k < n; ++k)
{
if (align)
pos_x = panel_pos_x + (panel_size_x - stringwidth(ts, TRUE, fontsize)) * align;
- drawcolorcodedstring(pos + '0 1 0' * 1.5 * (1 - sz) * fontsize_y, ts, fontsize, a, DRAWFLAG_NORMAL);
- pos_y += fontsize_y * 1.5;
+ drawcolorcodedstring(pos + '0 1 0' * 1.5 * (1 - sz) * fontsize_y, ts, fontsize, a * panel_fg_alpha, DRAWFLAG_NORMAL);
+ pos_y += fontsize_y;
}
else
- pos_y += fontsize_y;
- if (pos_y > panel_pos_y + panel_size_y - fontsize_y) // check if the next line can be shown
+ pos_y += fontsize_y * 0.35;
+ if (!autocvar_hud_panel_centerprint_flip && pos_y > panel_pos_y + panel_size_y - fontsize_y) // check if the next line can be shown
{
drawfontscale = '1 1 0';
return;
}
if (autocvar_hud_panel_centerprint_flip)
{
- pos_y = next_msg_pos_y;
+ pos_y = current_msg_pos_y - 0.7 * 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 += 1.5 * fontsize_y * (1 - a*a);
}
else
{
+ pos_y += 0.7 * 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 -= 1.5 * fontsize_y * (1 - a*a);
}
if(autocvar__con_chat_maximized)
HUD_Chat(); // HUD_DrawPanel(HUD_PANEL_CHAT);
- if (autocvar__hud_configure && spectatee_status && hud_configure_prev == -1) // try to join if we are in hud_configure mode, but still spectating, and in the first frame (in order to get rid of motd when launching a server via the menu "HUD Setup" button)
- localcmd("cmd selectteam auto; cmd join\n");
-
if(autocvar__hud_configure && tab_panel != -1)
{
HUD_Panel_UpdatePosSizeForId(tab_panel)