diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-22 11:55:56 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-22 11:55:56 +0000 |
| commit | 3dd090c705678277cc0f88d9b5dce663ae67e80c (patch) | |
| tree | f107d4a5364401ce1eed6ffa35f562d2e050e2e8 /src/game/client | |
| parent | 7797a651676ec47ab79222210f50c5aa4da80d7f (diff) | |
| download | zcatch-3dd090c705678277cc0f88d9b5dce663ae67e80c.tar.gz zcatch-3dd090c705678277cc0f88d9b5dce663ae67e80c.zip | |
made better broadcast and motd
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/gc_client.cpp | 6 | ||||
| -rw-r--r-- | src/game/client/gc_hooks.cpp | 19 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp index 69ddc7c9..eee038b9 100644 --- a/src/game/client/gc_client.cpp +++ b/src/game/client/gc_client.cpp @@ -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; diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp index 54b8715d..287d8d21 100644 --- a/src/game/client/gc_hooks.cpp +++ b/src/game/client/gc_hooks.cpp @@ -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) { |