From ffa7735e0d9c509805e5383725d15541b87a7565 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sat, 22 Mar 2008 14:26:17 +0000 Subject: [PATCH] added compatible version filter. cleaned up the server browser a bit. increased rifle ammo to 10 --- datasrc/teewars.ds | 2 +- src/engine/client/ec_srvbrowse.c | 5 ++- src/engine/e_config_variables.h | 1 + src/game/client/gc_menu.cpp | 58 ++++++++++++++++---------------- 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/datasrc/teewars.ds b/datasrc/teewars.ds index c8bbabd6b..897a440e9 100644 --- a/datasrc/teewars.ds +++ b/datasrc/teewars.ds @@ -404,7 +404,7 @@ weapons { nummuzzlesprites 3 muzzleoffsetx 0.0 muzzleoffsety 0.0 - maxammo 5 + maxammo 10 recoil 10 firedelay 800 muzzleduration 0 diff --git a/src/engine/client/ec_srvbrowse.c b/src/engine/client/ec_srvbrowse.c index e7d42cc1a..c4fe30808 100644 --- a/src/engine/client/ec_srvbrowse.c +++ b/src/engine/client/ec_srvbrowse.c @@ -155,6 +155,8 @@ static void client_serverbrowse_filter() filtered = 1; else if(!(config.b_filter_gametype&(1<info.game_type))) filtered = 1; + else if(config.b_filter_compatversion && strncmp(serverlist[i]->info.version, modc_net_version(), 3) != 0) + filtered = 1; else if(config.b_filter_string[0] != 0) { if(strstr(serverlist[i]->info.name, config.b_filter_string) == 0) @@ -173,7 +175,8 @@ static int client_serverbrowse_sorthash() i |= config.b_filter_full<<5; i |= config.b_filter_pw<<6; i |= config.b_sort_order<<7; - i |= config.b_filter_gametype<<8; + i |= config.b_filter_compatversion<<8; + i |= config.b_filter_gametype<<9; i |= config.b_filter_ping<<16; return i; } diff --git a/src/engine/e_config_variables.h b/src/engine/e_config_variables.h index b7b572d1d..773093dc1 100644 --- a/src/engine/e_config_variables.h +++ b/src/engine/e_config_variables.h @@ -17,6 +17,7 @@ MACRO_CONFIG_INT(b_filter_empty, 0, 0, 1) MACRO_CONFIG_INT(b_filter_pw, 0, 0, 1) MACRO_CONFIG_INT(b_filter_ping, 999, 0, 999) MACRO_CONFIG_INT(b_filter_gametype, 0xf, 0, 0xf) +MACRO_CONFIG_INT(b_filter_compatversion, 1, 0, 1) MACRO_CONFIG_INT(b_sort, 0, 0, 256) MACRO_CONFIG_INT(b_sort_order, 0, 0, 1) diff --git a/src/game/client/gc_menu.cpp b/src/game/client/gc_menu.cpp index 90a39491e..2708c3746 100644 --- a/src/game/client/gc_menu.cpp +++ b/src/game/client/gc_menu.cpp @@ -971,11 +971,12 @@ static void menu2_render_serverbrowser(RECT main_view) ui_hsplit_b(&server_details, 10.0f, &server_details, 0x0); // server details + const float font_size = 12.0f; ui_hsplit_t(&server_details, 20.0f, &server_header, &server_details); ui_draw_rect(&server_header, vec4(1,1,1,0.25f), CORNER_T, 4.0f); ui_draw_rect(&server_details, vec4(0,0,0,0.15f), CORNER_B, 4.0f); ui_vsplit_l(&server_header, 8.0f, 0x0, &server_header); - ui_do_label(&server_header, "Server Details: ", 14.0f, -1); + ui_do_label(&server_header, "Server Details: ", font_size+2.0f, -1); ui_vsplit_l(&server_details, 5.0f, 0x0, &server_details); @@ -983,17 +984,9 @@ static void menu2_render_serverbrowser(RECT main_view) if (selected_server) { - const float row_height = 18.0f; RECT row; static char *labels[] = { "Version:", "Game Type:", "Progression:", "Ping:" }; - ui_hsplit_t(&server_details, row_height, &row, &server_details); - ui_do_label(&row, selected_server->name, 15.0f, -1); - - ui_hsplit_t(&server_details, row_height, &row, &server_details); - ui_vsplit_l(&row, 1.0f, 0x0, &row); - ui_do_label(&row, selected_server->address, 14.0f, -1); - RECT left_column; RECT right_column; @@ -1003,16 +996,16 @@ static void menu2_render_serverbrowser(RECT main_view) for (int i = 0; i < 4; i++) { ui_hsplit_t(&left_column, 15.0f, &row, &left_column); - ui_do_label(&row, labels[i], 13.0f, -1); + ui_do_label(&row, labels[i], font_size, -1); } ui_hsplit_t(&right_column, 15.0f, &row, &right_column); - ui_do_label(&row, selected_server->version, 13.0f, -1); + ui_do_label(&row, selected_server->version, font_size, -1); ui_hsplit_t(&right_column, 15.0f, &row, &right_column); static char *game_types[] = { "DM", "TDM", "CTF" }; if (selected_server->game_type >= 0 && selected_server->game_type < (int)(sizeof(game_types)/sizeof(*game_types))) - ui_do_label(&row, game_types[selected_server->game_type], 13.0f, -1); + ui_do_label(&row, game_types[selected_server->game_type], font_size, -1); char temp[16]; @@ -1021,11 +1014,11 @@ static void menu2_render_serverbrowser(RECT main_view) else str_format(temp, sizeof(temp), "%d%%", selected_server->progression); ui_hsplit_t(&right_column, 15.0f, &row, &right_column); - ui_do_label(&row, temp, 13.0f, -1); + ui_do_label(&row, temp, font_size, -1); str_format(temp, sizeof(temp), "%d", selected_server->latency); ui_hsplit_t(&right_column, 15.0f, &row, &right_column); - ui_do_label(&row, temp, 13.0f, -1); + ui_do_label(&row, temp, font_size, -1); } // server scoreboard @@ -1034,7 +1027,7 @@ static void menu2_render_serverbrowser(RECT main_view) ui_draw_rect(&server_header, vec4(1,1,1,0.25f), CORNER_T, 4.0f); ui_draw_rect(&server_scoreboard, vec4(0,0,0,0.15f), CORNER_B, 4.0f); ui_vsplit_l(&server_header, 8.0f, 0x0, &server_header); - ui_do_label(&server_header, "Scoreboard: ", 14.0f, -1); + ui_do_label(&server_header, "Scoreboard: ", font_size+2.0f, -1); ui_vsplit_l(&server_scoreboard, 5.0f, 0x0, &server_scoreboard); @@ -1049,10 +1042,10 @@ static void menu2_render_serverbrowser(RECT main_view) ui_hsplit_t(&server_scoreboard, 16.0f, &row, &server_scoreboard); str_format(temp, sizeof(temp), "%d", selected_server->player_scores[i]); - ui_do_label(&row, temp, 14.0f, -1); + ui_do_label(&row, temp, font_size, -1); ui_vsplit_l(&row, 25.0f, 0x0, &row); - ui_do_label(&row, selected_server->player_names[i], 14.0f, -1); + ui_do_label(&row, selected_server->player_names[i], font_size, -1); } } @@ -1078,8 +1071,26 @@ static void menu2_render_serverbrowser(RECT main_view) if (ui_do_button(&config.b_filter_pw, "No password", config.b_filter_pw, &button, ui_draw_checkbox, 0)) config.b_filter_pw ^= 1; - ui_hsplit_t(&filters, 2.0f, &button, &filters); // ping ui_hsplit_t(&filters, 20.0f, &button, &filters); + if (ui_do_button((char *)&config.b_filter_compatversion, "Compatible Version", config.b_filter_compatversion, &button, ui_draw_checkbox, 0)) + config.b_filter_compatversion ^= 1; + + // game types + ui_hsplit_t(&types, 20.0f, &button, &types); + if (ui_do_button(&config.b_filter_gametype, "DM", config.b_filter_gametype&(1<