diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-08-27 15:48:50 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-08-27 15:48:50 +0000 |
| commit | dfe499248f1b1236487156b28e4a535d7963fe35 (patch) | |
| tree | a750b0f28cfd3f3e252602681412ac1adc6d29c7 /src/game/client/components/broadcast.cpp | |
| parent | d711dd190cac809a9bd278fba03ed974812bb863 (diff) | |
| download | zcatch-dfe499248f1b1236487156b28e4a535d7963fe35.tar.gz zcatch-dfe499248f1b1236487156b28e4a535d7963fe35.zip | |
major commit. game client restructure. not complete, loads of stuff not working, but the structure is there
Diffstat (limited to 'src/game/client/components/broadcast.cpp')
| -rw-r--r-- | src/game/client/components/broadcast.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/game/client/components/broadcast.cpp b/src/game/client/components/broadcast.cpp new file mode 100644 index 00000000..31ff6a71 --- /dev/null +++ b/src/game/client/components/broadcast.cpp @@ -0,0 +1,37 @@ +#include <engine/e_client_interface.h> +#include <engine/e_config.h> +#include <game/generated/g_protocol.hpp> +#include <game/generated/gc_data.hpp> + +#include <game/client/gameclient.hpp> +//#include <game/client/gc_anim.hpp> +#include <game/client/gc_client.hpp> + +#include "broadcast.hpp" + +void BROADCAST::on_reset() +{ + broadcast_time = 0; +} + +void BROADCAST::on_render() +{ + gfx_mapscreen(0, 0, 300*gfx_screenaspect(), 300); + + if(time_get() < broadcast_time) + { + float w = gfx_text_width(0, 14, broadcast_text, -1); + gfx_text(0, 150*gfx_screenaspect()-w/2, 35, 14, broadcast_text, -1); + } +} + +void BROADCAST::on_message(int msgtype, void *rawmsg) +{ + if(msgtype == NETMSGTYPE_SV_BROADCAST) + { + NETMSG_SV_BROADCAST *msg = (NETMSG_SV_BROADCAST *)rawmsg; + str_copy(broadcast_text, msg->message, sizeof(broadcast_text)); + broadcast_time = time_get()+time_freq()*10; + } +} + |