made better broadcast and motd

This commit is contained in:
Magnus Auvinen 2008-03-22 11:55:56 +00:00
parent 7797a65167
commit 3dd090c705
2 changed files with 20 additions and 5 deletions

View file

@ -1537,10 +1537,10 @@ void render_game()
gfx_text(0, 150*gfx_screenaspect()-w/2, 50, 24, text, -1);
}
if(time_get() < broadcast_time+time_freq()*5)
if(time_get() < broadcast_time)
{
float w = gfx_text_width(0, 16, broadcast_text, -1);
gfx_text(0, 150*gfx_screenaspect()-w/2, 50, 16, broadcast_text, -1);
float w = gfx_text_width(0, 14, broadcast_text, -1);
gfx_text(0, 150*gfx_screenaspect()-w/2, 35, 14, broadcast_text, -1);
}
tuning_params standard_tuning;

View file

@ -528,7 +528,7 @@ extern "C" void modc_message(int msgtype)
{
NETMSG_SV_BROADCAST *msg = (NETMSG_SV_BROADCAST *)rawmsg;
str_copy(broadcast_text, msg->message, sizeof(broadcast_text));
broadcast_time = time_get();
broadcast_time = time_get()+time_freq()*10;
}
else if(msgtype == NETMSGTYPE_SV_MOTD)
{
@ -548,8 +548,23 @@ extern "C" void modc_message(int msgtype)
}
}
}
dbg_msg("game", "MOTD: %s", server_motd);
// take the first line as a center text
int len = 0;
for(int i = 0; server_motd[i]; i++)
{
if(server_motd[i] == '\n')
{
len = i;
break;
}
}
len = min(len, (int)sizeof(broadcast_text));
str_copy(broadcast_text, msg->message, len);
broadcast_time = time_get()+time_freq()*10;
}
else if(msgtype == NETMSGTYPE_SV_SETINFO)
{