mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
made better broadcast and motd
This commit is contained in:
parent
7797a65167
commit
3dd090c705
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue