about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/engine/e_config.c62
-rw-r--r--src/engine/e_config.h2
-rw-r--r--src/engine/e_console.c6
-rw-r--r--src/engine/e_system.c2
-rw-r--r--src/game/editor/ed_editor.cpp24
-rw-r--r--src/game/g_variables.h2
6 files changed, 30 insertions, 68 deletions
diff --git a/src/engine/e_config.c b/src/engine/e_config.c
index 73993f5b..858cec59 100644
--- a/src/engine/e_config.c
+++ b/src/engine/e_config.c
@@ -22,69 +22,9 @@ void config_reset()
     #undef MACRO_CONFIG_STR 
 }
 
-void strip_spaces(char **p)
-{
-	char *s = *p;
-	char *end;
-	
-	while (*s == ' ')
-		++s;
-
-	end = s + strlen(s);
-	while (end > s && *(end - 1) == ' ')
-		*--end = 0;
-}
-
-void config_set(const char *line)
-{
-	const char *c = strchr(line, '=');
-	if (c)
-	{
-		char var[256];
-		char val[256];
-		char *var_str = var;
-		char *val_str = val;
-
-		str_copy(val, c+1, sizeof(val));
-		mem_copy(var, line, c - line);
-		var[c - line] = 0;
-
-		strip_spaces(&var_str);
-		strip_spaces(&val_str);
-
-		#define MACRO_CONFIG_INT(name,def,min,max) { if (strcmp(#name, var_str) == 0) config_set_ ## name (&config, atoi(val_str)); }
-    	#define MACRO_CONFIG_STR(name,len,def) { if (strcmp(#name, var_str) == 0) { config_set_ ## name (&config, val_str); } }
- 
-    	#include "e_config_variables.h" 
- 
-    	#undef MACRO_CONFIG_INT 
-    	#undef MACRO_CONFIG_STR 
-	}
-}
-
-void config_load(const char *filename)
-{
-	/*
-	IOHANDLE file;
-	dbg_msg("config/load", "loading %s", filename);
-	file = io_open(filename, IOFLAG_READ);
-	
-	if(file)
-	{
-		char *line;
-		LINEREADER lr;
-		linereader_init(&lr, file);
-
-		while ((line = linereader_get(&lr)))
-			config_set(line);
-
-		io_close(file);
-	}*/
-}
-
 void config_save()
 {
-	char linebuf[512];
+	char linebuf[1024*2];
 	
 	#define MACRO_CONFIG_INT(name,def,min,max) { str_format(linebuf, sizeof(linebuf), "%s %i", #name, config.name); engine_config_write_line(linebuf); }
 	#define MACRO_CONFIG_STR(name,len,def) { str_format(linebuf, sizeof(linebuf), "%s %s", #name, config.name); engine_config_write_line(linebuf); }
diff --git a/src/engine/e_config.h b/src/engine/e_config.h
index 514a6ceb..6d56b026 100644
--- a/src/engine/e_config.h
+++ b/src/engine/e_config.h
@@ -18,9 +18,7 @@ typedef struct
 extern CONFIGURATION config;
 
 void config_init();
-void config_set(const char *line);
 void config_reset();
-/*void config_load(const char *filename);*/
 void config_save();
 
 typedef int (*CONFIG_INT_GETTER)(CONFIGURATION *c);
diff --git a/src/engine/e_console.c b/src/engine/e_console.c
index 751b78ef..1283d721 100644
--- a/src/engine/e_console.c
+++ b/src/engine/e_console.c
@@ -7,7 +7,7 @@
 #include <stdlib.h>
 
 
-#define CONSOLE_MAX_STR_LENGTH 255
+#define CONSOLE_MAX_STR_LENGTH 1024
 /* the maximum number of tokens occurs in a string of length CONSOLE_MAX_STR_LENGTH with tokens size 1 separated by single spaces */
 #define MAX_PARTS (CONSOLE_MAX_STR_LENGTH+1)/2
 
@@ -333,7 +333,7 @@ static void int_variable_command(void *result, void *user_data)
 		data->setter(&config, console_arg_int(result, 0));
 	else
 	{
-		char buf[256];
+		char buf[1024];
 		str_format(buf, sizeof(buf), "Value: %d", data->getter(&config));
 		console_print(buf);
 	}
@@ -347,7 +347,7 @@ static void str_variable_command(void *result, void *user_data)
 		data->setter(&config, console_arg_string(result, 0));
 	else
 	{
-		char buf[256];
+		char buf[1024];
 		str_format(buf, sizeof(buf), "Value: %s", data->getter(&config));
 		console_print(buf);
 	}
diff --git a/src/engine/e_system.c b/src/engine/e_system.c
index 5075c062..2b24ab7c 100644
--- a/src/engine/e_system.c
+++ b/src/engine/e_system.c
@@ -76,7 +76,7 @@ void dbg_break()
 void dbg_msg(const char *sys, const char *fmt, ...)
 {
 	va_list args;
-	char str[1024];
+	char str[1024*4];
 	char *msg;
 	int i, len;
 	
diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp
index a7ef9576..8b514c88 100644
--- a/src/game/editor/ed_editor.cpp
+++ b/src/game/editor/ed_editor.cpp
@@ -2303,6 +2303,26 @@ void EDITOR::render()
 
 	if(editor.gui_active)
 		render_statusbar(statusbar);
+
+	//
+	if(config.ed_showkeys)
+	{
+		gfx_mapscreen(ui_screen()->x, ui_screen()->y, ui_screen()->w, ui_screen()->h);
+		TEXT_CURSOR cursor;
+		gfx_text_set_cursor(&cursor, view.x+10, view.y+view.h-24-10, 24.0f, TEXTFLAG_RENDER);
+		
+		int nkeys = 0;
+		for(int i = 0; i < KEY_LAST; i++)
+		{
+			if(inp_key_pressed(i))
+			{
+				if(nkeys)
+					gfx_text_ex(&cursor, " + ", -1);
+				gfx_text_ex(&cursor, inp_key_name(i), -1);
+				nkeys++;
+			}
+		}
+	}
 	
 	// render butt ugly mouse cursor
 	float mx = ui_mouse_x();
@@ -2312,7 +2332,8 @@ void EDITOR::render()
 	if(ui_got_context == ui_hot_item())
 		gfx_setcolor(1,0,0,1);
 	gfx_quads_drawTL(mx,my, 16.0f, 16.0f);
-	gfx_quads_end();	
+	gfx_quads_end();
+	
 }
 
 void EDITOR::reset(bool create_default)
@@ -2454,6 +2475,7 @@ extern "C" void editor_update_and_render()
 		editor.load("data/maps/debug_test.map");
 	
 	editor.render();
+	
 	inp_clear_events();
 }
 
diff --git a/src/game/g_variables.h b/src/game/g_variables.h
index 86b40b71..84725ee4 100644
--- a/src/game/g_variables.h
+++ b/src/game/g_variables.h
@@ -17,6 +17,8 @@ MACRO_CONFIG_INT(cl_mouse_followfactor, 60, 0, 200)
 MACRO_CONFIG_INT(cl_mouse_max_distance, 800, 0, 0)
 
 
+MACRO_CONFIG_INT(ed_showkeys, 0, 0, 1)
+
 MACRO_CONFIG_INT(cl_flow, 0, 0, 1)
 
 MACRO_CONFIG_INT(cl_show_welcome, 1, 0, 1)