about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-12-02 17:55:45 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-12-02 17:55:45 +0000
commite96ad33a3473b7db60f88e7b6c59630cacd147c3 (patch)
treeeb41ebea8f83ce4e5676cce99193850f1ef4a892 /src/game
parent59f0a07555c124e14185dd29078b3b5e99ea09d8 (diff)
downloadzcatch-e96ad33a3473b7db60f88e7b6c59630cacd147c3.tar.gz
zcatch-e96ad33a3473b7db60f88e7b6c59630cacd147c3.zip
fixed the editor
Diffstat (limited to 'src/game')
-rw-r--r--src/game/client/game_client.cpp21
-rw-r--r--src/game/client/menu.cpp4
-rw-r--r--src/game/client/menu2.cpp51
3 files changed, 61 insertions, 15 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp
index e1949611..3325de65 100644
--- a/src/game/client/game_client.cpp
+++ b/src/game/client/game_client.cpp
@@ -34,6 +34,8 @@ int gametype = GAMETYPE_DM;
 static int music_menu = -1;
 static int music_menu_id = -1;
 
+extern void modmenu_render();
+
 enum
 {
 	CHATMODE_NONE=0,
@@ -545,9 +547,6 @@ static void render_loading(float percent)
 
 extern "C" void modc_init()
 {
-	// init menu
-	modmenu_init();
-	
 	// setup sound channels
 	snd_set_channel(CHN_GUI, 1.0f, 0.0f);
 	snd_set_channel(CHN_MUSIC, 1.0f, 0.0f);
@@ -600,7 +599,6 @@ extern "C" void modc_entergame()
 extern "C" void modc_shutdown()
 {
 	// shutdown the menu
-	modmenu_shutdown();
 }
 
 static void process_events(int s)
@@ -2596,10 +2594,7 @@ void render_game()
 
 	if (menu_active)
 	{
-		if (modmenu_render(true))
-			menu_active = false;
-
-		//ingamemenu_render();
+		modmenu_render();
 		return;
 	}
 
@@ -2676,13 +2671,9 @@ extern "C" void modc_render()
 	else // if (client_state() != CLIENTSTATE_CONNECTING && client_state() != CLIENTSTATE_LOADING)
 	{
 		if (music_menu_id == -1)
-		{
 			music_menu_id = snd_play(CHN_MUSIC, music_menu, SNDFLAG_LOOP);
-		}
 
-		//netaddr4 server_address;
-		if(modmenu_render(false) == -1)
-			client_quit();
+		modmenu_render();
 	}
 
 	//
@@ -2701,9 +2692,9 @@ extern "C" void modc_statechange(int state, int old)
 	 	menu_do_disconnected();
 	 	menu_game_active = false;
 	}
-	if(state == CLIENTSTATE_CONNECTING)
+	else if(state == CLIENTSTATE_CONNECTING)
 		menu_do_connecting();
-	if (state == CLIENTSTATE_ONLINE)
+	else if (state == CLIENTSTATE_ONLINE)
 	{
 		menu_active = false;
 	 	menu_game_active = true;
diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp
index f41e938e..10dafc39 100644
--- a/src/game/client/menu.cpp
+++ b/src/game/client/menu.cpp
@@ -1,4 +1,6 @@
 /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
+#if 0
+
 #include <stdio.h>
 #include <math.h>
 #include <string.h>
@@ -1859,3 +1861,5 @@ extern "C" int modmenu_render(int ingame) // TODO: nastyness
 
 	return r;
 }
+
+#endif
diff --git a/src/game/client/menu2.cpp b/src/game/client/menu2.cpp
index 5909a7d3..028ea7b9 100644
--- a/src/game/client/menu2.cpp
+++ b/src/game/client/menu2.cpp
@@ -1536,3 +1536,54 @@ int menu2_render()
 }
 
 
+void menu_do_disconnected()
+{
+}
+
+void menu_do_connecting()
+{
+}
+
+void menu_do_connected()
+{
+}
+
+void modmenu_render()
+{
+	static int mouse_x = 0;
+	static int mouse_y = 0;
+
+    // handle mouse movement
+    float mx, my;
+    {
+        int rx, ry;
+        inp_mouse_relative(&rx, &ry);
+        mouse_x += rx;
+        mouse_y += ry;
+        if(mouse_x < 0) mouse_x = 0;
+        if(mouse_y < 0) mouse_y = 0;
+        if(mouse_x > gfx_screenwidth()) mouse_x = gfx_screenwidth();
+        if(mouse_y > gfx_screenheight()) mouse_y = gfx_screenheight();
+            
+        // update the ui
+        mx = (mouse_x/(float)gfx_screenwidth())*800.0f;
+        my = (mouse_y/(float)gfx_screenheight())*600.0f;
+            
+        int buttons = 0;
+        if(inp_key_pressed(KEY_MOUSE_1)) buttons |= 1;
+        if(inp_key_pressed(KEY_MOUSE_2)) buttons |= 2;
+        if(inp_key_pressed(KEY_MOUSE_3)) buttons |= 4;
+            
+        ui_update(mx,my,mx*3.0f,my*3.0f,buttons);
+    }
+    
+	menu2_render();
+
+    gfx_texture_set(data->images[IMAGE_CURSOR].id);
+    gfx_quads_begin();
+    gfx_setcolor(1,1,1,1);
+    gfx_quads_drawTL(mx,my,24,24);
+    gfx_quads_end();
+
+	inp_clear();
+}