diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-08-04 21:26:20 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-08-04 21:26:20 +0000 |
| commit | 79db096df194008dd3eccff985370417904103fa (patch) | |
| tree | 456f5d35874dfdb0a01f6b12329baba4e3686ddd /src/game/client | |
| parent | 2734ecb6dca76e6f900cf86c42dd15df385d0d4f (diff) | |
| download | zcatch-79db096df194008dd3eccff985370417904103fa.tar.gz zcatch-79db096df194008dd3eccff985370417904103fa.zip | |
fixed so that the music is turned off ingame
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/game_client.cpp | 51 | ||||
| -rw-r--r-- | src/game/client/menu.cpp | 18 |
2 files changed, 17 insertions, 52 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index f5ae23ec..a59c9d97 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -23,6 +23,9 @@ static int menu_team = 0; static int menu_quit = 0; static int menu_resume = 0; +static int music_menu = -1; +static int music_menu_id = -1; + static bool chat_active = false; static bool menu_active = false; @@ -433,6 +436,9 @@ void modc_init() // load the data container data = load_data_from_memory(internal_data); + // TODO: should be removed + music_menu = snd_load_wav("data/audio/Music_Menu.wav"); + // load sounds for(int s = 0; s < data->num_sounds; s++) for(int i = 0; i < data->sounds[s].num_sounds; i++) @@ -1831,54 +1837,31 @@ void render_game() } } + + void modc_render() { // this should be moved around abit if(client_state() == CLIENTSTATE_ONLINE) { + if (music_menu_id != -1) + { + snd_stop(music_menu_id); + music_menu_id = -1; + } + render_game(); } else // if (client_state() != CLIENTSTATE_CONNECTING && client_state() != CLIENTSTATE_LOADING) { + if (music_menu_id == -1) + music_menu_id = snd_play(music_menu, SND_LOOP); + //netaddr4 server_address; if(modmenu_render() == -1) client_quit(); } - /* - else if (client_state() == CLIENTSTATE_CONNECTING || client_state() == CLIENTSTATE_LOADING) - { - static int64 start = time_get(); - static int tee_texture; - static int connecting_texture; - static bool inited = false; - - // TODO: ugly, remove this - if (!inited) - { - tee_texture = gfx_load_texture("data/gui_tee.png"); - connecting_texture = gfx_load_texture("data/gui_connecting.png"); - - inited = true; - } - - gfx_mapscreen(0,0,400.0f,300.0f); - - float t = (time_get() - start) / (double)time_freq(); - - float speed = 2*sin(t); - - speed = 1.0f; - - float x = 208 + sin(t*speed) * 32; - float w = sin(t*speed + 3.149) * 64; - - ui_do_image(tee_texture, x, 95, w, 64); - ui_do_image(connecting_texture, 88, 150, 256, 64); - - if(inp_key_down(input::esc)) - client_disconnect(); - }*/ } diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp index 41ef9307..41ccd828 100644 --- a/src/game/client/menu.cpp +++ b/src/game/client/menu.cpp @@ -196,9 +196,6 @@ void draw_background(float t) gfx_quads_end(); } -static int music_menu; -static int music_menu_id = -1; - void draw_image_button(void *id, const char *text, int checked, float x, float y, float w, float h, void *extra) { ui_do_image(*(int *)id, x, y, w, h); @@ -1292,9 +1289,6 @@ void modmenu_init() // TODO: should be removed current_font->font_texture = gfx_load_texture("data/big_font.png"); - - // TODO: should be removed - music_menu = snd_load_wav("data/audio/Music_Menu.wav"); } void modmenu_shutdown() @@ -1306,12 +1300,6 @@ int modmenu_render() static int mouse_x = 0; static int mouse_y = 0; - if (music_menu_id == -1) - { - dbg_msg("menu", "no music is playing, so let's play some tunes!"); - music_menu_id = snd_play(music_menu, SND_LOOP); - } - // handle mouse movement float mx, my; { @@ -1347,12 +1335,6 @@ int modmenu_render() gfx_quads_drawTL(mx,my,24,24); gfx_quads_end(); - if (r) - { - snd_stop(music_menu_id); - music_menu_id = -1; - } - input::clear_char(); input::clear_key(); |