removed the tuning filtering and warning. modded servers can use tuning for free. added pure server checking - ctf, dm and tdm gametypes are not allowed to have different tuning.

This commit is contained in:
Alfred Eriksson 2009-01-11 10:40:14 +00:00
parent 371e862316
commit 39a12060d6
15 changed files with 63 additions and 62 deletions

View file

@ -361,7 +361,7 @@ container.sprites.Add(Sprite("blank2", set_emoticons, 3, 3, 1, 1))
container.sprites.Add(Sprite("browse_lock", set_browseicons, 0,0,1,1))
container.sprites.Add(Sprite("browse_heart", set_browseicons, 1,0,1,1))
container.sprites.Add(Sprite("browse_tuned", set_browseicons, 2,0,1,1))
container.sprites.Add(Sprite("browse_pure", set_browseicons, 2,0,1,1))
anim = Animation("base")
anim.body.frames.Add(AnimKeyframe(0, 0, -4, 0))

View file

@ -164,7 +164,7 @@ static void client_serverbrowse_filter()
filtered = 1;
else if(config.b_filter_pw && serverlist[i]->info.flags&SRVFLAG_PASSWORD)
filtered = 1;
else if(config.b_filter_tuned && serverlist[i]->info.flags&SRVFLAG_TUNED)
else if(config.b_filter_pure && (strcmp(serverlist[i]->info.gametype, "DM") != 0 && strcmp(serverlist[i]->info.gametype, "TDM") != 0 && strcmp(serverlist[i]->info.gametype, "CTF") != 0))
filtered = 1;
else if(config.b_filter_ping < serverlist[i]->info.latency)
filtered = 1;
@ -228,7 +228,7 @@ static int client_serverbrowse_sorthash()
i |= config.b_filter_pw<<6;
i |= config.b_sort_order<<7;
i |= config.b_filter_compatversion<<8;
i |= config.b_filter_tuned<<9;
i |= config.b_filter_pure<<9;
i |= config.b_filter_ping<<16;
return i;
}

View file

@ -19,7 +19,7 @@ MACRO_CONFIG_INT(b_filter_empty, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter o
MACRO_CONFIG_INT(b_filter_pw, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out password protected servers in browser")
MACRO_CONFIG_INT(b_filter_ping, 999, 0, 999, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Ping to filter by in the server browser")
MACRO_CONFIG_STR(b_filter_gametype, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Game types to filter")
MACRO_CONFIG_INT(b_filter_tuned, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out tuned servers in browser")
MACRO_CONFIG_INT(b_filter_pure, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-pure servers in browser")
MACRO_CONFIG_INT(b_filter_compatversion, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out non-compatible servers in browser")
MACRO_CONFIG_INT(b_sort, 0, 0, 256, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")

View file

@ -165,7 +165,4 @@ const char *mods_version();
*/
void mods_message(int msg, int client_id);
int mods_is_tuned();
#endif

View file

@ -31,8 +31,6 @@ enum
enum
{
SRVFLAG_PASSWORD = 0x1,
SRVFLAG_TUNED = 0x2,
SRVFLAG_MOD = 0x4
};
/*

View file

@ -859,8 +859,6 @@ static void server_send_serverinfo(NETADDR *addr, int token)
i = 0;
if(config.password[0]) /* password set */
i |= SRVFLAG_PASSWORD;
if (mods_is_tuned()) /* is tuned */
i |= SRVFLAG_TUNED;
str_format(buf, sizeof(buf), "%d", i);
packer_add_string(&p, buf, 2);

View file

@ -167,24 +167,6 @@ void HUD::render_connectionwarning()
}
}
void HUD::render_tunewarning()
{
TUNING_PARAMS standard_tuning;
// render warning about non standard tuning
bool flash = time_get()/(time_freq()/2)%2 == 0;
if(config.cl_warning_tuning && memcmp(&standard_tuning, &gameclient.tuning, sizeof(TUNING_PARAMS)) != 0)
{
const char *text = "Warning! Server is running non-standard tuning.";
if(flash)
gfx_text_color(1,0.4f,0.4f,1.0f);
else
gfx_text_color(0.75f,0.2f,0.2f,1.0f);
gfx_text(0x0, 5, 40, 6, text, -1);
gfx_text_color(1,1,1,1);
}
}
void HUD::render_teambalancewarning()
{
// render prompt about team-balance
@ -307,7 +289,6 @@ void HUD::on_render()
render_fps();
if(client_state() != CLIENTSTATE_DEMOPLAYBACK)
render_connectionwarning();
render_tunewarning();
render_teambalancewarning();
render_voting();
render_cursor();

View file

@ -8,7 +8,6 @@ class HUD : public COMPONENT
void render_fps();
void render_connectionwarning();
void render_tunewarning();
void render_teambalancewarning();
void render_voting();
void render_healthandammo();

View file

@ -761,6 +761,13 @@ int MENUS::render()
button_text = "Ok";
extra_align = -1;
}
else if(popup == POPUP_PURE)
{
title = "Disconnected";
extra_text = "The server is running a non-standard tuning on a pure game mode.";
button_text = "Ok";
extra_align = -1;
}
else if(popup == POPUP_PASSWORD)
{
title = "Password Error";
@ -996,6 +1003,13 @@ void MENUS::on_render()
render_demoplayer(screen);
}
if(client_state() == CLIENTSTATE_ONLINE && gameclient.servermode == gameclient.SERVERMODE_PUREMOD)
{
client_disconnect();
set_active(true);
popup = POPUP_PURE;
}
if(!is_active())
{
escape_pressed = false;

View file

@ -68,6 +68,7 @@ class MENUS : public COMPONENT
POPUP_FIRST_LAUNCH,
POPUP_CONNECTING,
POPUP_DISCONNECTED,
POPUP_PURE,
POPUP_PASSWORD,
POPUP_QUIT,
};

View file

@ -46,7 +46,7 @@ void MENUS::render_serverbrowser_serverlist(RECT view)
SPACER=2,
COL_FLAG_LOCK=0,
COL_FLAG_TUNED,
COL_FLAG_PURE,
COL_FLAG_FAV,
COL_NAME,
COL_GAMETYPE,
@ -60,7 +60,7 @@ void MENUS::render_serverbrowser_serverlist(RECT view)
static column cols[] = {
{-1, -1, " ", -1, 2.0f, 0, {0}, {0}},
{COL_FLAG_LOCK, -1, " ", -1, 14.0f, 0, {0}, {0}},
{COL_FLAG_TUNED, -1, " ", -1, 14.0f, 0, {0}, {0}},
{COL_FLAG_PURE, -1, " ", -1, 14.0f, 0, {0}, {0}},
{COL_FLAG_FAV, -1, " ", -1, 14.0f, 0, {0}, {0}},
{COL_NAME, BROWSESORT_NAME, "Name", 0, 300.0f, 0, {0}, {0}},
{COL_GAMETYPE, BROWSESORT_GAMETYPE, "Type", 1, 50.0f, 0, {0}, {0}},
@ -161,16 +161,17 @@ void MENUS::render_serverbrowser_serverlist(RECT view)
selected_index = -1;
for (int i = 0; i < num_servers; i++)
/*for (int i = 0; i < num_servers; i++)
{
SERVER_INFO *item = client_serverbrowse_sorted_get(i);
num_players += item->num_players;
}
}*/
for (int i = 0; i < num_servers; i++)
{
int item_index = i;
SERVER_INFO *item = client_serverbrowse_sorted_get(item_index);
num_players += item->num_players;
RECT row;
RECT select_hit_box;
@ -226,10 +227,10 @@ void MENUS::render_serverbrowser_serverlist(RECT view)
if(item->flags & SRVFLAG_PASSWORD)
ui_draw_browse_icon(SPRITE_BROWSE_LOCK, &button);
}
else if(id == COL_FLAG_TUNED)
else if(id == COL_FLAG_PURE)
{
if(item->flags & SRVFLAG_TUNED)
ui_draw_browse_icon(SPRITE_BROWSE_TUNED, &button);
if(strncmp(item->gametype, "DM", 2) == 0 || strncmp(item->gametype, "TDM", 3) == 0 || strncmp(item->gametype, "CTF", 3) == 0)
ui_draw_browse_icon(SPRITE_BROWSE_PURE, &button);
}
else if(id == COL_FLAG_FAV)
{
@ -347,8 +348,8 @@ void MENUS::render_serverbrowser_filters(RECT view)
config.b_filter_compatversion ^= 1;
ui_hsplit_t(&view, 20.0f, &button, &view);
if (ui_do_button((char *)&config.b_filter_tuned, "Not tuned", config.b_filter_tuned, &button, ui_draw_checkbox, 0))
config.b_filter_tuned ^= 1;
if (ui_do_button((char *)&config.b_filter_pure, "Only pure", config.b_filter_pure, &button, ui_draw_checkbox, 0))
config.b_filter_pure ^= 1;
ui_hsplit_t(&view, 20.0f, &button, &view);
ui_do_label(&button, "Game types: ", 14.0f, -1);
@ -387,7 +388,6 @@ void MENUS::render_serverbrowser_filters(RECT view)
config.b_filter_ping = 999;
config.b_filter_gametype[0] = 0;
config.b_filter_compatversion = 1;
config.b_filter_tuned = 1;
config.b_filter_string[0] = 0;
}
}
@ -420,7 +420,7 @@ void MENUS::render_serverbrowser_serverdetail(RECT view)
if (selected_server)
{
RECT row;
static const char *labels[] = { "Version:", "Game Type:", "Tuning:", "Progression:", "Ping:" };
static const char *labels[] = { "Version:", "Game Type:", "Progression:", "Ping:" };
RECT left_column;
RECT right_column;
@ -457,12 +457,6 @@ void MENUS::render_serverbrowser_serverdetail(RECT view)
char temp[16];
str_format(temp, sizeof(temp), "%s", selected_server->flags & SRVFLAG_TUNED ? "non-standard" : "standard");
ui_hsplit_t(&right_column, 15.0f, &row, &right_column);
ui_do_label(&row, temp, font_size, -1);
if(selected_server->progression < 0)
str_format(temp, sizeof(temp), "N/A");
else

View file

@ -1,3 +1,4 @@
#include <string.h>
#include <engine/e_client_interface.h>
#include <engine/e_demorec.h>
@ -214,6 +215,7 @@ void GAMECLIENT::on_init()
int64 end = time_get();
dbg_msg("", "%f.2ms", ((end-start)*1000)/(float)time_freq());
servermode = SERVERMODE_PURE;
}
void GAMECLIENT::on_save()
@ -273,6 +275,11 @@ void GAMECLIENT::on_connected()
all.components[i]->on_reset();
}
SERVER_INFO current_server_info;
client_serverinfo(&current_server_info);
servermode = SERVERMODE_PURE;
// send the inital info
send_info(true);
}
@ -394,6 +401,8 @@ void GAMECLIENT::on_message(int msgtype)
if(msg_unpack_error())
return;
servermode = SERVERMODE_PURE;
// apply new tuning
tuning = new_tuning;
return;
@ -639,6 +648,20 @@ void GAMECLIENT::on_snapshot()
else
snap.spectate = true;
TUNING_PARAMS standard_tuning;
SERVER_INFO current_server_info;
client_serverinfo(&current_server_info);
if(current_server_info.gametype[0] != '0')
{
if(strcmp(current_server_info.gametype, "DM") != 0 && strcmp(current_server_info.gametype, "TDM") != 0 && strcmp(current_server_info.gametype, "CTF") != 0)
servermode = SERVERMODE_MOD;
else if(memcmp(&standard_tuning, &tuning, sizeof(TUNING_PARAMS)) == 0)
servermode = SERVERMODE_PURE;
else
servermode = SERVERMODE_PUREMOD;
}
// update render info
for(int i = 0; i < MAX_CLIENTS; i++)
clients[i].update_render_info();

View file

@ -40,6 +40,14 @@ public:
// TODO: move this
TUNING_PARAMS tuning;
enum
{
SERVERMODE_PURE=0,
SERVERMODE_MOD,
SERVERMODE_PUREMOD,
};
int servermode;
vec2 local_character_pos;
vec2 local_target_pos;

View file

@ -46,16 +46,6 @@ void send_tuning_params(int cid)
server_send_msg(cid);
}
int mods_is_tuned()
{
TUNING_PARAMS standard_tuning;
if (memcmp(&standard_tuning, &tuning, sizeof(TUNING_PARAMS)) != 0)
return 1;
else
return 0;
}
// Server hooks
void mods_client_direct_input(int client_id, void *input)
{

View file

@ -12,8 +12,6 @@ MACRO_CONFIG_INT(cl_showfps, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame
MACRO_CONFIG_INT(cl_airjumpindicator, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "")
MACRO_CONFIG_INT(cl_threadsoundloading, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "")
MACRO_CONFIG_INT(cl_warning_tuning, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Warn about tuned servers")
MACRO_CONFIG_INT(cl_warning_teambalance, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Warn about team balance")
MACRO_CONFIG_INT(cl_mouse_deadzone, 300, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SAVE, "")