about summary refs log tree commit diff
path: root/src/engine/client
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-07-15 13:25:10 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-07-15 13:25:10 +0000
commitf2611cad8bf1c1f4664ae5f328ffa6934a4d1d16 (patch)
tree89d1dd650f4f57428ff87c8771d5b6c3c6c94e19 /src/engine/client
parent07c8ff2e537958c6f6217b4fd48ddaa85882e068 (diff)
downloadzcatch-f2611cad8bf1c1f4664ae5f328ffa6934a4d1d16.tar.gz
zcatch-f2611cad8bf1c1f4664ae5f328ffa6934a4d1d16.zip
fixed so that the editor works again
Diffstat (limited to 'src/engine/client')
-rw-r--r--src/engine/client/client.cpp27
-rw-r--r--src/engine/client/gfx.cpp62
2 files changed, 64 insertions, 25 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp
index 7c1fda54..68e93fbe 100644
--- a/src/engine/client/client.cpp
+++ b/src/engine/client/client.cpp
@@ -412,6 +412,13 @@ public:
 			if(input::pressed(input::lctrl) && input::pressed('Q'))
 				break;
 				
+			// editor invoke
+			/*
+			if(input::pressed(input::lctrl) && input::pressed('O'))
+			{
+				disconnect();
+			}*/
+				
 			// pump the network
 			pump_network();
 			
@@ -634,6 +641,8 @@ public:
 	}	
 };
 
+int editor_main(int argc, char **argv);
+
 int main(int argc, char **argv)
 {
 	dbg_msg("client", "starting...");
@@ -645,6 +654,7 @@ int main(int argc, char **argv)
 	//const char *name = "nameless jerk";
 	bool connect_at_once = false;
 	bool fullscreen = true;
+	bool editor = false;
 
 	// init network, need to be done first so we can do lookups
 	net_init();
@@ -686,11 +696,20 @@ int main(int argc, char **argv)
 			// -w
 			fullscreen = false;
 		}
+		else if(argv[i][0] == '-' && argv[i][1] == 'e' && argv[i][2] == 0)
+		{
+			editor = true;
+		}
 	}
 	
-	// start the server
-	client c;
-	c.set_fullscreen(fullscreen);
-	c.run(connect_at_once ? &server_address : 0x0);
+	if(editor)
+		editor_main(argc, argv);
+	else
+	{
+		// start the client
+		client c;
+		c.set_fullscreen(fullscreen);
+		c.run(connect_at_once ? &server_address : 0x0);
+	}
 	return 0;
 }
diff --git a/src/engine/client/gfx.cpp b/src/engine/client/gfx.cpp
index c30ad0f1..5280ef5d 100644
--- a/src/engine/client/gfx.cpp
+++ b/src/engine/client/gfx.cpp
@@ -544,19 +544,28 @@ void gfx_quads_draw_freeform(
 void gfx_quads_text(float x, float y, float size, const char *text)
 {
 	gfx_quads_begin();
+	float startx = x;
 	while(*text)
 	{
 		char c = *text;
 		text++;
 		
-		gfx_quads_setsubset(
-			(c%16)/16.0f,
-			(c/16)/16.0f,
-			(c%16)/16.0f+1.0f/16.0f,
-			(c/16)/16.0f+1.0f/16.0f);
-		
-		gfx_quads_drawTL(x,y,size,size);
-		x += size/2;
+		if(c == '\n')
+		{
+			x = startx;
+			y += size;
+		}
+		else
+		{
+			gfx_quads_setsubset(
+				(c%16)/16.0f,
+				(c/16)/16.0f,
+				(c%16)/16.0f+1.0f/16.0f,
+				(c/16)/16.0f+1.0f/16.0f);
+			
+			gfx_quads_drawTL(x,y,size,size);
+			x += size/2;
+		}
 	}
 	
 	gfx_quads_end();
@@ -620,26 +629,37 @@ void gfx_pretty_text(float x, float y, float size, const char *text)
 	gfx_texture_set(current_font->font_texture);
 	gfx_quads_begin();
 	
+	float startx = x;
+	
 	while (*text)
 	{
 		const int c = *text;
-		const float width = current_font->m_CharEndTable[c] - current_font->m_CharStartTable[c];
-
-		x -= size * current_font->m_CharStartTable[c];
 		
-		gfx_quads_setsubset(
-			(c%16)/16.0f, // startx
-			(c/16)/16.0f, // starty
-			(c%16)/16.0f+1.0f/16.0f, // endx
-			(c/16)/16.0f+1.0f/16.0f); // endy
+		if(c == '\n')
+		{
+			x = startx;
+			y += size;
+		}
+		else
+		{
+			const float width = current_font->m_CharEndTable[c] - current_font->m_CharStartTable[c];
 
-		gfx_quads_drawTL(x, y, size, size);
+			x -= size * current_font->m_CharStartTable[c];
+			
+			gfx_quads_setsubset(
+				(c%16)/16.0f, // startx
+				(c/16)/16.0f, // starty
+				(c%16)/16.0f+1.0f/16.0f, // endx
+				(c/16)/16.0f+1.0f/16.0f); // endy
 
-		double x_nudge = 0;
-		if (text[1])
-			x_nudge = extra_kerning[text[0] + text[1] * 256];
+			gfx_quads_drawTL(x, y, size, size);
 
-		x += (width + current_font->m_CharStartTable[c] + spacing + x_nudge) * size;
+			double x_nudge = 0;
+			if (text[1])
+				x_nudge = extra_kerning[text[0] + text[1] * 256];
+
+			x += (width + current_font->m_CharStartTable[c] + spacing + x_nudge) * size;
+		}
 
 		text++;
 	}