diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2009-05-31 09:44:20 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2009-05-31 09:44:20 +0000 |
| commit | 4bb1df318905f491740f4298c69cda317fb53fcb (patch) | |
| tree | 486c4edf2d6af2089ffab60a7422d5e7abefa891 /src/engine/client | |
| parent | b28ede2da2c42643c5aa710a8076f0249d48c9e4 (diff) | |
| download | zcatch-4bb1df318905f491740f4298c69cda317fb53fcb.tar.gz zcatch-4bb1df318905f491740f4298c69cda317fb53fcb.zip | |
moved 0.5 branch to trunk
Diffstat (limited to 'src/engine/client')
| -rw-r--r-- | src/engine/client/ec_client.c | 2 | ||||
| -rw-r--r-- | src/engine/client/ec_gfx.c | 21 | ||||
| -rw-r--r-- | src/engine/client/ec_inp.c | 16 | ||||
| -rw-r--r-- | src/engine/client/ec_srvbrowse.c | 17 |
4 files changed, 39 insertions, 17 deletions
diff --git a/src/engine/client/ec_client.c b/src/engine/client/ec_client.c index 0a785df7..ad52d077 100644 --- a/src/engine/client/ec_client.c +++ b/src/engine/client/ec_client.c @@ -1362,6 +1362,7 @@ static void client_pump_network() if(client_state() != CLIENTSTATE_OFFLINE && netclient_state(net) == NETSTATE_OFFLINE) { client_set_state(CLIENTSTATE_OFFLINE); + client_disconnect(); dbg_msg("client", "offline error='%s'", netclient_error_string(net)); } @@ -1972,6 +1973,7 @@ static void con_serverdummy(void *result, void *user_data) static void client_register_commands() { MACRO_REGISTER_COMMAND("quit", "", CFGFLAG_CLIENT, con_quit, 0x0, "Quit Teeworlds"); + MACRO_REGISTER_COMMAND("exit", "", CFGFLAG_CLIENT, con_quit, 0x0, "Quit Teeworlds"); MACRO_REGISTER_COMMAND("connect", "s", CFGFLAG_CLIENT, con_connect, 0x0, "Connect to the specified host/ip"); MACRO_REGISTER_COMMAND("disconnect", "", CFGFLAG_CLIENT, con_disconnect, 0x0, "Disconnect from the server"); MACRO_REGISTER_COMMAND("ping", "", CFGFLAG_CLIENT, con_ping, 0x0, "Ping the current server"); diff --git a/src/engine/client/ec_gfx.c b/src/engine/client/ec_gfx.c index 64840b2b..97dced87 100644 --- a/src/engine/client/ec_gfx.c +++ b/src/engine/client/ec_gfx.c @@ -252,11 +252,24 @@ int gfx_init() if(config.dbg_stress) no_gfx = 1; - if(SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0) { - dbg_msg("gfx", "unable to init SDL: %s", SDL_GetError()); - return -1; - } + int systems = 0; + + if(!no_gfx) + systems |= SDL_INIT_VIDEO; + + if(config.snd_enable) + systems |= SDL_INIT_AUDIO; + + if(config.cl_eventthread) + systems |= SDL_INIT_EVENTTHREAD; + + if(SDL_Init(systems) < 0) + { + dbg_msg("gfx", "unable to init SDL: %s", SDL_GetError()); + return -1; + } + } atexit(SDL_Quit); diff --git a/src/engine/client/ec_inp.c b/src/engine/client/ec_inp.c index 6aae34fc..4aea840a 100644 --- a/src/engine/client/ec_inp.c +++ b/src/engine/client/ec_inp.c @@ -16,26 +16,16 @@ static unsigned char input_state[2][1024] = {{0}, {0}}; static int input_current = 0; static int input_grabbed = 0; -static int input_use_grab = 0; static unsigned int last_release = 0; static unsigned int release_delta = -1; void inp_mouse_relative(int *x, int *y) { - static int last_x = 0, last_y = 0; - static int last_sens = 100.0f; int nx = 0, ny = 0; float sens = config.inp_mousesens/100.0f; - if(last_sens != config.inp_mousesens) - { - last_x = (last_x/(float)last_sens)*(float)config.inp_mousesens; - last_y = (last_y/(float)last_sens)*(float)config.inp_mousesens; - last_sens = config.inp_mousesens; - } - - if(input_use_grab) + if(config.inp_grab) SDL_GetRelativeMouseState(&nx, &ny); else { @@ -101,7 +91,7 @@ void inp_mouse_mode_absolute() { SDL_ShowCursor(1); input_grabbed = 0; - if(input_use_grab) + if(config.inp_grab) SDL_WM_GrabInput(SDL_GRAB_OFF); } @@ -109,7 +99,7 @@ void inp_mouse_mode_relative() { SDL_ShowCursor(0); input_grabbed = 1; - if(input_use_grab) + if(config.inp_grab) SDL_WM_GrabInput(SDL_GRAB_ON); } diff --git a/src/engine/client/ec_srvbrowse.c b/src/engine/client/ec_srvbrowse.c index 81712cb4..4a85e778 100644 --- a/src/engine/client/ec_srvbrowse.c +++ b/src/engine/client/ec_srvbrowse.c @@ -166,6 +166,22 @@ static void client_serverbrowse_filter() filtered = 1; 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_pure_map && + !(strcmp(serverlist[i]->info.map, "dm1") == 0 || + strcmp(serverlist[i]->info.map, "dm2") == 0 || + strcmp(serverlist[i]->info.map, "dm6") == 0 || + strcmp(serverlist[i]->info.map, "dm7") == 0 || + strcmp(serverlist[i]->info.map, "dm8") == 0 || + strcmp(serverlist[i]->info.map, "dm9") == 0 || + strcmp(serverlist[i]->info.map, "ctf1") == 0 || + strcmp(serverlist[i]->info.map, "ctf2") == 0 || + strcmp(serverlist[i]->info.map, "ctf3") == 0 || + strcmp(serverlist[i]->info.map, "ctf4") == 0 || + strcmp(serverlist[i]->info.map, "ctf5") == 0) + ) + { + filtered = 1; + } else if(config.b_filter_ping < serverlist[i]->info.latency) filtered = 1; else if(config.b_filter_compatversion && strncmp(serverlist[i]->info.version, modc_net_version(), 3) != 0) @@ -229,6 +245,7 @@ static int client_serverbrowse_sorthash() i |= config.b_sort_order<<7; i |= config.b_filter_compatversion<<8; i |= config.b_filter_pure<<9; + i |= config.b_filter_pure_map<<10; i |= config.b_filter_ping<<16; return i; } |