diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-23 14:23:07 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-23 14:23:07 +0000 |
| commit | efabdb169d3638713f622f15a447661688ace1ef (patch) | |
| tree | 08f354ccca72fa511469f1ff8583cfcc9378d9e8 /src/game/client | |
| parent | e20e488d3d804972d777ed4cf094a54e5ebc5e7e (diff) | |
| download | zcatch-efabdb169d3638713f622f15a447661688ace1ef.tar.gz zcatch-efabdb169d3638713f622f15a447661688ace1ef.zip | |
fixed better motd
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/gc_client.cpp | 49 | ||||
| -rw-r--r-- | src/game/client/gc_client.h | 5 | ||||
| -rw-r--r-- | src/game/client/gc_hooks.cpp | 14 |
3 files changed, 52 insertions, 16 deletions
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp index eee038b9..f42aa9de 100644 --- a/src/game/client/gc_client.cpp +++ b/src/game/client/gc_client.cpp @@ -1489,11 +1489,50 @@ void render_game() gfx_text(0, 150, 50, 12, buf, -1); } - // render score board - if(scoreboard_active || // user requested - (!spectate && (!netobjects.local_character || netobjects.local_character->health < 0)) || // not spectating and is dead - (netobjects.gameobj && netobjects.gameobj->game_over) // game over - ) + + bool do_scoreboard = false; + + // if we are dead + if(!spectate && (!netobjects.local_character || netobjects.local_character->health < 0)) + do_scoreboard = true; + + // if we the game is over + if(netobjects.gameobj && netobjects.gameobj->game_over) + do_scoreboard = true; + + // showing motd, skip it + if(time_get() < server_motd_time) + do_scoreboard = false; + + // always show if we really want + if(scoreboard_active) + { + server_motd_time = 0; // disables the motd + do_scoreboard = true; + } + + // render motd + if(!do_scoreboard && time_get() < server_motd_time) + { + gfx_mapscreen(0, 0, width, height); + + float h = 800.0f; + float w = 650.0f; + float x = width/2 - w/2; + float y = 150.0f; + + gfx_blend_normal(); + gfx_texture_set(-1); + gfx_quads_begin(); + gfx_setcolor(0,0,0,0.5f); + draw_round_rect(x, y, w, h, 40.0f); + gfx_quads_end(); + + gfx_text(0, x+40.0f, y+40.0f, 32.0f, server_motd, (int)(w-80.0f)); + } + + // render scoreboard + if(do_scoreboard) { gfx_mapscreen(0, 0, width, height); diff --git a/src/game/client/gc_client.h b/src/game/client/gc_client.h index 66d52292..bb684830 100644 --- a/src/game/client/gc_client.h +++ b/src/game/client/gc_client.h @@ -35,7 +35,6 @@ struct snapstate extern snapstate netobjects; -extern char server_motd[900]; // FUGLY /* extern const NETOBJ_PLAYER_CHARACTER *local_character; extern const NETOBJ_PLAYER_CHARACTER *local_prev_character; @@ -86,6 +85,10 @@ bool chat_input_handle(INPUT_EVENT e, void *user_data); extern char broadcast_text[1024]; extern int64 broadcast_time; +// motd +extern int64 server_motd_time; +extern char server_motd[900]; // FUGLY + // line input helter class line_input { diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp index d1882e9e..b02c6ab1 100644 --- a/src/game/client/gc_hooks.cpp +++ b/src/game/client/gc_hooks.cpp @@ -456,6 +456,7 @@ void extraproj_reset() } char server_motd[900] = {0}; +int64 server_motd_time = 0; extern "C" void modc_message(int msgtype) { @@ -554,17 +555,10 @@ extern "C" void modc_message(int msgtype) } } - len = min(len, (int)sizeof(broadcast_text)); - if(len) - { - str_copy(broadcast_text, msg->message, len); - broadcast_time = time_get()+time_freq()*10; - } + if(server_motd[0]) + server_motd_time = time_get()+time_freq()*10; else - { - broadcast_text[0] = 0; - broadcast_time = 0; - } + server_motd_time = 0; } else if(msgtype == NETMSGTYPE_SV_SETINFO) { |