diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-12-16 22:34:43 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-12-16 22:34:43 +0000 |
| commit | 138c0c5e2b5de54f141dbbca48da623b8d3616a0 (patch) | |
| tree | f2743faba7520e509268b9652ca469729752775e /src | |
| parent | 41a0f43866985f3efa3356172f41d3a5f3036478 (diff) | |
| download | zcatch-138c0c5e2b5de54f141dbbca48da623b8d3616a0.tar.gz zcatch-138c0c5e2b5de54f141dbbca48da623b8d3616a0.zip | |
fixed the welcome screen
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/client/gc_client.cpp | 3 | ||||
| -rw-r--r-- | src/game/client/gc_menu.cpp | 55 | ||||
| -rw-r--r-- | src/game/g_variables.h | 2 | ||||
| -rw-r--r-- | src/game/server/gs_server.cpp | 1 |
4 files changed, 52 insertions, 9 deletions
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp index a641dcfa..9dac2749 100644 --- a/src/game/client/gc_client.cpp +++ b/src/game/client/gc_client.cpp @@ -31,6 +31,7 @@ enum data_container *data = 0x0; extern void modmenu_render(); +extern void menu_init(); enum { @@ -530,6 +531,8 @@ void render_loading(float percent); extern "C" void modc_init() { + menu_init(); + // setup sound channels snd_set_channel(CHN_GUI, 1.0f, 0.0f); snd_set_channel(CHN_MUSIC, 1.0f, 0.0f); diff --git a/src/game/client/gc_menu.cpp b/src/game/client/gc_menu.cpp index af3747e9..bb5aacc2 100644 --- a/src/game/client/gc_menu.cpp +++ b/src/game/client/gc_menu.cpp @@ -38,6 +38,7 @@ extern bool menu_game_active; enum { POPUP_NONE=0, + POPUP_FIRST_LAUNCH, POPUP_CONNECTING, POPUP_DISCONNECTED, POPUP_PASSWORD, @@ -296,21 +297,21 @@ int ui2_do_button(const void *id, const char *text, int checked, const RECT *r, } -void ui2_do_label(const RECT *r, const char *text, float size, int align) +void ui2_do_label(const RECT *r, const char *text, float size, int align, int max_width = -1) { gfx_blend_normal(); size *= ui2_scale(); if(align == 0) { - float tw = gfx_pretty_text_width(size, text, -1); - gfx_pretty_text(r->x + r->w/2-tw/2, r->y, size, text, -1); + float tw = gfx_pretty_text_width(size, text, max_width); + gfx_pretty_text(r->x + r->w/2-tw/2, r->y, size, text, max_width); } else if(align < 0) - gfx_pretty_text(r->x, r->y, size, text, -1); + gfx_pretty_text(r->x, r->y, size, text, max_width); else if(align > 0) { - float tw = gfx_pretty_text_width(size, text, -1); - gfx_pretty_text(r->x + r->w-tw, r->y, size, text, -1); + float tw = gfx_pretty_text_width(size, text, max_width); + gfx_pretty_text(r->x + r->w-tw, r->y, size, text, max_width); } } @@ -1707,6 +1708,13 @@ void menu_do_connected() popup = POPUP_NONE; } +void menu_init() +{ + if(config.cl_show_welcome) + popup = POPUP_FIRST_LAUNCH; + config.cl_show_welcome = 0; +} + int menu2_render() { if(0) @@ -1826,7 +1834,15 @@ int menu2_render() title = "Quit"; extra_text = "Are you sure that you want to quit?"; } - + else if(popup == POPUP_FIRST_LAUNCH) + { + title = "Welcome to Teewars"; + extra_text = + "As this is the first time you launch Teewars, please enter your nick name below. " + "It's recommended that you check the settings to adjust them to your liking " + "before joining a server."; + button_text = "Ok"; + } RECT box, part; box = screen; @@ -1841,7 +1857,8 @@ int menu2_render() ui2_do_label(&part, title, 24.f, 0); ui2_hsplit_t(&box, 20.f, &part, &box); ui2_hsplit_t(&box, 24.f, &part, &box); - ui2_do_label(&part, extra_text, 20.f, 0); + ui2_vmargin(&part, 20.f, &part); + ui2_do_label(&part, extra_text, 20.f, -1, (int)part.w); if(popup == POPUP_QUIT) { @@ -1896,6 +1913,28 @@ int menu2_render() ui2_do_label(&label, "Password:", 20, -1); ui2_do_edit_box(&config.password, &textbox, config.password, sizeof(config.password), true); } + else if(popup == POPUP_FIRST_LAUNCH) + { + RECT label, textbox; + + ui2_hsplit_b(&box, 20.f, &box, &part); + ui2_hsplit_b(&box, 24.f, &box, &part); + ui2_vmargin(&part, 80.0f, &part); + + static int enter_button = 0; + if(ui2_do_button(&enter_button, "Enter", 0, &part, ui2_draw_menu_button, 0) || inp_key_down(KEY_ENTER)) + popup = POPUP_NONE; + + ui2_hsplit_b(&box, 60.f, &box, &part); + ui2_hsplit_b(&box, 24.f, &box, &part); + + ui2_vsplit_l(&part, 60.0f, 0, &label); + ui2_vsplit_l(&label, 100.0f, 0, &textbox); + ui2_vsplit_l(&textbox, 20.0f, 0, &textbox); + ui2_vsplit_r(&textbox, 60.0f, &textbox, 0); + ui2_do_label(&label, "Nickname:", 20, -1); + ui2_do_edit_box(&config.player_name, &textbox, config.player_name, sizeof(config.player_name)); + } else { ui2_hsplit_b(&box, 20.f, &box, &part); diff --git a/src/game/g_variables.h b/src/game/g_variables.h index 44e52c6f..76dee35c 100644 --- a/src/game/g_variables.h +++ b/src/game/g_variables.h @@ -33,6 +33,8 @@ MACRO_CONFIG_INT(cl_dynamic_camera, 1, 0, 1) MACRO_CONFIG_INT(cl_team, -10, -1, 0) MACRO_CONFIG_INT(cl_autoswitch_weapons, 0, 0, 1) +MACRO_CONFIG_INT(cl_show_welcome, 1, 0, 1) + MACRO_CONFIG_INT(player_use_custom_color, 0, 0, 1) MACRO_CONFIG_INT(player_color_body, 65408, 0, 0) MACRO_CONFIG_INT(player_color_feet, 65408, 0, 0) diff --git a/src/game/server/gs_server.cpp b/src/game/server/gs_server.cpp index 24c36eb6..e581424a 100644 --- a/src/game/server/gs_server.cpp +++ b/src/game/server/gs_server.cpp @@ -1951,7 +1951,6 @@ void mods_init() if(config.dbg_bots) { - for(int i = 0; i < config.dbg_bots ; i++) { mods_connected(MAX_CLIENTS-i-1); |