about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/engine/client/ec_gfx.c2
-rw-r--r--src/engine/client/ec_srvbrowse.c13
-rw-r--r--src/engine/e_config_variables.h2
-rw-r--r--src/game/client/components/controls.cpp10
-rw-r--r--src/game/client/components/controls.hpp1
-rw-r--r--src/game/client/components/menus_browser.cpp31
-rw-r--r--src/game/client/components/scoreboard.cpp31
-rw-r--r--src/game/client/gameclient.cpp10
-rw-r--r--src/game/server/gamecontroller.cpp2
-rw-r--r--src/game/server/gamemodes/ctf.cpp1
-rw-r--r--src/game/server/gamemodes/dm.cpp6
-rw-r--r--src/game/server/gamemodes/dm.hpp1
-rw-r--r--src/game/server/gamemodes/tdm.cpp1
13 files changed, 78 insertions, 33 deletions
diff --git a/src/engine/client/ec_gfx.c b/src/engine/client/ec_gfx.c
index d26c0b72..c062ebbd 100644
--- a/src/engine/client/ec_gfx.c
+++ b/src/engine/client/ec_gfx.c
@@ -177,7 +177,7 @@ int gfx_init()
 	}
 	else
 	{
-		int result = glfwOpenWindow(screen_width, screen_height, 0, 0, 0, 8, 24, 0, GLFW_WINDOW);
+		int result = glfwOpenWindow(screen_width, screen_height, 0, 0, 0, config.gfx_alphabits, 24, 0, GLFW_WINDOW);
 		if(result != GL_TRUE)
 		{
 			dbg_msg("game", "failed to create gl context");
diff --git a/src/engine/client/ec_srvbrowse.c b/src/engine/client/ec_srvbrowse.c
index f26ac9e3..e9d8dd75 100644
--- a/src/engine/client/ec_srvbrowse.c
+++ b/src/engine/client/ec_srvbrowse.c
@@ -48,6 +48,7 @@ static int num_server_capacity = 0;
 
 static int sorthash = 0;
 static char filterstring[64] = {0};
+static char filtergametypestring[128] = {0};
 
 static int serverlist_lan = 1;
 static int64 broadcast_time = 0;
@@ -181,7 +182,13 @@ static void client_serverbrowse_filter()
 			if(!matchfound)
 				filtered = 1;
 		}
-			
+		else if(config.b_filter_gametype[0] != 0)
+		{
+			/* match against game type */
+			if(!str_find_nocase(serverlist[i]->info.gametype, config.b_filter_gametype))
+				filtered = 1;
+		}
+
 		if(filtered == 0)
 			sorted_serverlist[num_sorted_servers++] = i;
 	}
@@ -195,7 +202,6 @@ 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_gametype<<9;
 	i |= config.b_filter_ping<<16;
 	return i;
 }
@@ -236,6 +242,7 @@ static void client_serverbrowse_sort()
 	for(i = 0; i < num_sorted_servers; i++)
 		serverlist[sorted_serverlist[i]]->info.sorted_index = i;
 	
+	str_copy(filtergametypestring, config.b_filter_gametype, sizeof(filtergametypestring)); 
 	str_copy(filterstring, config.b_filter_string, sizeof(filterstring)); 
 	sorthash = client_serverbrowse_sorthash();
 }
@@ -467,6 +474,6 @@ void client_serverbrowse_update()
 	
 	/* check if we need to resort */
 	/* TODO: remove the strcmp */
-	if(sorthash != client_serverbrowse_sorthash() || strcmp(filterstring, config.b_filter_string) != 0)
+	if(sorthash != client_serverbrowse_sorthash() || strcmp(filterstring, config.b_filter_string) != 0 || strcmp(filtergametypestring, config.b_filter_gametype) != 0)
 		client_serverbrowse_sort();
 }
diff --git a/src/engine/e_config_variables.h b/src/engine/e_config_variables.h
index bceda2fb..f4016ddb 100644
--- a/src/engine/e_config_variables.h
+++ b/src/engine/e_config_variables.h
@@ -18,7 +18,7 @@ MACRO_CONFIG_INT(b_filter_full, 0, 0, 1)
 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_STR(b_filter_gametype, 128, "")
 MACRO_CONFIG_INT(b_filter_compatversion, 1, 0, 1)
 
 MACRO_CONFIG_INT(b_sort, 0, 0, 256)
diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp
index 0cf8b861..6cb89836 100644
--- a/src/game/client/components/controls.cpp
+++ b/src/game/client/components/controls.cpp
@@ -65,6 +65,16 @@ void CONTROLS::on_init()
 	{ static INPUTSET set = {this, &input_data.prev_weapon, 0};  MACRO_REGISTER_COMMAND("+prevweapon", "", con_key_input_nextprev_weapon, (void *)&set); }
 }
 
+void CONTROLS::on_message(int msg, void *rawmsg)
+{
+    if(msg == NETMSGTYPE_SV_WEAPONPICKUP)
+    {
+    	NETMSG_SV_WEAPONPICKUP *msg = (NETMSG_SV_WEAPONPICKUP *)rawmsg;
+        if(config.cl_autoswitch_weapons)
+        	input_data.wanted_weapon = msg->weapon+1;
+    }
+}
+
 int CONTROLS::snapinput(int *data)
 {
 	static NETOBJ_PLAYER_INPUT last_data = {0};
diff --git a/src/game/client/components/controls.hpp b/src/game/client/components/controls.hpp
index d875522a..262fd235 100644
--- a/src/game/client/components/controls.hpp
+++ b/src/game/client/components/controls.hpp
@@ -12,6 +12,7 @@ public:
 	int input_direction_right;
 
 	CONTROLS();
+	virtual void on_message(int msg, void *rawmsg);
 	virtual bool on_mousemove(float x, float y);
 	virtual void on_init();
 	
diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp
index e2e1ae9e..be0e1904 100644
--- a/src/game/client/components/menus_browser.cpp
+++ b/src/game/client/components/menus_browser.cpp
@@ -296,7 +296,17 @@ void MENUS::render_serverbrowser(RECT main_view)
 				ui_do_label(&button, version, 12.0f, 1);
 			}			
 			else if(id == COL_GAMETYPE)
-				ui_do_label(&button, item->gametype, 12.0f, 0);
+			{
+				// all these are just for nice compability
+				if(item->gametype[0] == '0' && item->gametype[1] == 0)
+					ui_do_label(&button, "DM", 12.0f, 0);
+				else if(item->gametype[0] == '1' && item->gametype[1] == 0)
+					ui_do_label(&button, "TDM", 12.0f, 0);
+				else if(item->gametype[0] == '2' && item->gametype[1] == 0)
+					ui_do_label(&button, "CTF", 12.0f, 0);
+				else
+					ui_do_label(&button, item->gametype, 12.0f, 0);
+			}
 		}
 	}
 
@@ -425,8 +435,16 @@ void MENUS::render_serverbrowser(RECT main_view)
 	ui_hsplit_t(&filters, 20.0f, &button, &filters);
 	ui_do_label(&button, "Quick search: ", 14.0f, -1);
 	ui_vsplit_l(&button, 95.0f, 0, &button);
+	ui_margin(&button, 1.0f, &button);
 	ui_do_edit_box(&config.b_filter_string, &button, config.b_filter_string, sizeof(config.b_filter_string), 14.0f);
 
+
+	ui_hsplit_t(&filters, 20.0f, &button, &filters);
+	ui_do_label(&button, "Game types: ", 14.0f, -1);
+	ui_vsplit_l(&button, 95.0f, 0, &button);
+	ui_margin(&button, 1.0f, &button);
+	ui_do_edit_box(&config.b_filter_gametype, &button, config.b_filter_gametype, sizeof(config.b_filter_gametype), 14.0f);
+
 	ui_vsplit_l(&filters, 180.0f, &filters, &types);
 
 	// render filters
@@ -442,10 +460,6 @@ void MENUS::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, 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);
@@ -462,8 +476,13 @@ void MENUS::render_serverbrowser(RECT main_view)
 	*/
 
 	// ping
+	ui_hsplit_t(&types, 20.0f, &button, &types);
+	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;
+	
 	ui_hsplit_t(&types, 2.0f, &button, &types);
 	ui_hsplit_t(&types, 20.0f, &button, &types);
+	
 	{
 		RECT editbox;
 		ui_vsplit_l(&button, 40.0f, &editbox, &button);
@@ -517,7 +536,7 @@ void MENUS::render_serverbrowser(RECT main_view)
 			config.b_filter_empty = 0;
 			config.b_filter_pw = 0;
 			config.b_filter_ping = 999;
-			config.b_filter_gametype = 0xf;
+			config.b_filter_gametype[0] = 0;
 			config.b_filter_compatversion = 1;
 			config.b_filter_string[0] = 0;
 		}
diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp
index bd8c7ea9..2388c4c3 100644
--- a/src/game/client/components/scoreboard.cpp
+++ b/src/game/client/components/scoreboard.cpp
@@ -225,23 +225,30 @@ void SCOREBOARD::render_scoreboard(float x, float y, float w, int team, const ch
 
 void SCOREBOARD::on_render()
 {
-	if(!active)
-		return;
-		
-	// if the score board is active, then we should clear the motd message aswell
-	gameclient.motd->clear();
-	
-	// TODO: repair me
-	/*
 	bool do_scoreboard = false;
 
-	// if we are dead
-	if(!spectate && (!gameclient.snap.local_character || gameclient.snap.local_character->health < 0))
+	// if we activly wanna look on the scoreboard	
+	if(active)
 		do_scoreboard = true;
-	
+		
+	if(gameclient.snap.local_info && gameclient.snap.local_info->team != -1)
+	{
+		// we are not a spectator, check if we are ead
+		if(!gameclient.snap.local_character || gameclient.snap.local_character->health < 0)
+			do_scoreboard = true;
+	}
+
 	// if we the game is over
 	if(gameclient.snap.gameobj && gameclient.snap.gameobj->game_over)
-		do_scoreboard = true;*/
+		do_scoreboard = true;
+		
+	if(!do_scoreboard)
+		return;
+		
+	// if the score board is active, then we should clear the motd message aswell
+	if(active)
+		gameclient.motd->clear();
+	
 
 	float width = 400*3.0f*gfx_screenaspect();
 	float height = 400*3.0f;
diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp
index 1fde8f18..977b7863 100644
--- a/src/game/client/gameclient.cpp
+++ b/src/game/client/gameclient.cpp
@@ -73,7 +73,7 @@ static void load_sounds_thread(void *do_render)
 	// load sounds
 	for(int s = 0; s < data->num_sounds; s++)
 	{
-		if(do_render) // TODO: repair me
+		if(do_render)
 			gameclient.menus->render_loading(load_current/(float)load_total);
 		for(int i = 0; i < data->sounds[s].num_sounds; i++)
 		{
@@ -175,7 +175,6 @@ void GAMECLIENT::on_init()
 	// load textures
 	for(int i = 0; i < data->num_images; i++)
 	{
-		// TODO: repair me
 		gameclient.menus->render_loading(load_current/load_total);
 		data->images[i].id = gfx_load_texture(data->images[i].filename, IMG_AUTO, 0);
 		load_current++;
@@ -387,13 +386,6 @@ void GAMECLIENT::on_message(int msgtype)
 
 		clients[msg->cid].update_render_info();
 	}
-    else if(msgtype == NETMSGTYPE_SV_WEAPONPICKUP)
-    {
-    	// TODO: repair me
-    	/*NETMSG_SV_WEAPONPICKUP *msg = (NETMSG_SV_WEAPONPICKUP *)rawmsg;
-        if(config.cl_autoswitch_weapons)
-        	input_data.wanted_weapon = msg->weapon+1;*/
-    }
 	else if(msgtype == NETMSGTYPE_SV_READYTOENTER)
 	{
 		client_entergame();
diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp
index 76d003e7..ab24b7d4 100644
--- a/src/game/server/gamecontroller.cpp
+++ b/src/game/server/gamecontroller.cpp
@@ -14,7 +14,7 @@
 
 GAMECONTROLLER::GAMECONTROLLER()
 {
-	gametype = config.sv_gametype;
+	gametype = "unknown";
 	
 	//
 	do_warmup(config.sv_warmup);
diff --git a/src/game/server/gamemodes/ctf.cpp b/src/game/server/gamemodes/ctf.cpp
index ba8df237..94dac1da 100644
--- a/src/game/server/gamemodes/ctf.cpp
+++ b/src/game/server/gamemodes/ctf.cpp
@@ -10,6 +10,7 @@ GAMECONTROLLER_CTF::GAMECONTROLLER_CTF()
 {
 	flags[0] = 0;
 	flags[1] = 0;
+	gametype = "CTF";
 	game_flags = GAMEFLAG_TEAMS|GAMEFLAG_FLAGS;
 }
 
diff --git a/src/game/server/gamemodes/dm.cpp b/src/game/server/gamemodes/dm.cpp
index b38d18f6..15c0b987 100644
--- a/src/game/server/gamemodes/dm.cpp
+++ b/src/game/server/gamemodes/dm.cpp
@@ -1,6 +1,12 @@
 /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
 #include "dm.hpp"
 
+
+GAMECONTROLLER_DM::GAMECONTROLLER_DM()
+{
+	gametype = "DM";
+}
+
 void GAMECONTROLLER_DM::tick()
 {
 	do_player_score_wincheck();
diff --git a/src/game/server/gamemodes/dm.hpp b/src/game/server/gamemodes/dm.hpp
index f57fe06d..6fb25f61 100644
--- a/src/game/server/gamemodes/dm.hpp
+++ b/src/game/server/gamemodes/dm.hpp
@@ -5,5 +5,6 @@
 class GAMECONTROLLER_DM : public GAMECONTROLLER
 {
 public:
+	GAMECONTROLLER_DM();
 	virtual void tick();
 };
diff --git a/src/game/server/gamemodes/tdm.cpp b/src/game/server/gamemodes/tdm.cpp
index 914bae08..a490907a 100644
--- a/src/game/server/gamemodes/tdm.cpp
+++ b/src/game/server/gamemodes/tdm.cpp
@@ -6,6 +6,7 @@
 
 GAMECONTROLLER_TDM::GAMECONTROLLER_TDM()
 {
+	gametype = "TDM";
 	game_flags = GAMEFLAG_TEAMS;
 }