about summary refs log tree commit diff
path: root/src/engine
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-07-29 15:55:04 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-07-29 15:55:04 +0000
commit7699e4b400fef04e9353302b8fd253bf7b2c8cc2 (patch)
tree25d00d4faf78c6c099505ad9f990b3c57d37064a /src/engine
parentb1f65c46ed9b055cf1ecf94b5a8ff80eebe94ac9 (diff)
downloadzcatch-7699e4b400fef04e9353302b8fd253bf7b2c8cc2.tar.gz
zcatch-7699e4b400fef04e9353302b8fd253bf7b2c8cc2.zip
removed the batch functions as it did next to nothing. changed some of the default values. cleaned up some of the config variables. added options in the menu to control gfx quality of the game.
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/client/client.cpp2
-rw-r--r--src/engine/client/gfx.cpp83
-rw-r--r--src/engine/config_variables.h14
-rw-r--r--src/engine/interface.h4
4 files changed, 19 insertions, 84 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp
index d4c7f2db..55646b35 100644
--- a/src/engine/client/client.cpp
+++ b/src/engine/client/client.cpp
@@ -997,7 +997,7 @@ int main(int argc, char **argv)
 		else if(argv[i][0] == '-' && argv[i][1] == 'w' && argv[i][2] == 0)
 		{
 			// -w
-			config.fullscreen = 0;
+			config.gfx_fullscreen = 0;
 		}
 		
 		else if(argv[i][0] == '-' && argv[i][1] == 'e' && argv[i][2] == 0)
diff --git a/src/engine/client/gfx.cpp b/src/engine/client/gfx.cpp
index 1ccd686d..819061ba 100644
--- a/src/engine/client/gfx.cpp
+++ b/src/engine/client/gfx.cpp
@@ -24,10 +24,7 @@ struct custom_vertex
 };
 
 const int vertex_buffer_size = 32*1024;
-//static custom_vertex vertices[4];
 static custom_vertex *vertices = 0;
-//static index_buffer ib;
-static unsigned short indecies[vertex_buffer_size*6];
 static int num_vertices = 0;
 static vec4 color[4];
 static vec2 texture[4];
@@ -85,8 +82,8 @@ static void draw_quad(bool _bflush = false)
 					sizeof(custom_vertex),
 					sizeof(vec3)+sizeof(vec2));		
 					
-			glDrawElements(GL_TRIANGLES, num_vertices, GL_UNSIGNED_SHORT, indecies);
-			//opengl::draw_arrays(GL_QUADS, 0, num_vertices);
+			//glDrawElements(GL_TRIANGLES, num_vertices, GL_UNSIGNED_SHORT, indecies);
+			opengl::draw_arrays(GL_QUADS, 0, num_vertices);
 		}
 		else
 		{
@@ -109,70 +106,11 @@ static void draw_quad(bool _bflush = false)
 		num_vertices = 0;
 	}
 }
-struct batch
-{
-	opengl::vertex_buffer vb;
-	int num;
-};
-
-void gfx_destoy_batch(void *in_b)
-{
-	batch *b = (batch*)in_b;
-	delete b;
-	
-}
-
-void gfx_quads_draw_batch(void *in_b)
-{
-	batch *b = (batch*)in_b;
-	
-	if(GLEW_ARB_vertex_buffer_object)
-	{
-		// set the data
-		opengl::stream_vertex(&b->vb, 3, GL_FLOAT, sizeof(custom_vertex), 0);
-		opengl::stream_texcoord(&b->vb, 0, 2, GL_FLOAT,
-				sizeof(custom_vertex),
-				sizeof(vec3));
-		opengl::stream_color(&b->vb, 4, GL_FLOAT,
-				sizeof(custom_vertex),
-				sizeof(vec3)+sizeof(vec2));		
-		opengl::draw_arrays(GL_QUADS, 0, b->num);
-	}
-	/*
-	else
-	{
-		glVertexPointer(3, GL_FLOAT,
-				sizeof(custom_vertex),
-				(char*)vertices);
-		glTexCoordPointer(2, GL_FLOAT,
-				sizeof(custom_vertex),
-				(char*)vertices + sizeof(vec3));
-		glColorPointer(4, GL_FLOAT,
-				sizeof(custom_vertex),
-				(char*)vertices + sizeof(vec3) + sizeof(vec2));
-		glEnableClientState(GL_VERTEX_ARRAY);
-		glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-		glEnableClientState(GL_COLOR_ARRAY);
-		glDrawArrays(GL_QUADS, 0, b->num);
-	}*/	
-}
-
 
-void *gfx_quads_create_batch()
-{
-	batch *b = new batch;
-	b->num = num_vertices;
-	b->vb.data(vertices, num_vertices*sizeof(custom_vertex), GL_STATIC_DRAW);
-	dbg_msg("gfx", "created batch. num=%d size=%d", num_vertices, num_vertices*sizeof(custom_vertex));
-	num_vertices = 0;
-	gfx_quads_end();
-	return b;
-}
-
-	
 bool gfx_init()
 {
-	if(!context.create(config.screen_width, config.screen_height, 24, 8, 16, 0, config.fullscreen?opengl::context::FLAG_FULLSCREEN:0))
+	if(!context.create(config.gfx_screen_width, config.gfx_screen_height, 24, 8, 16, 0,
+		config.gfx_fullscreen?opengl::context::FLAG_FULLSCREEN:0))
 	{
 		dbg_msg("game", "failed to create gl context");
 		return false;
@@ -192,7 +130,7 @@ bool gfx_init()
 											  context.version_minor(),
 											  context.version_rev());*/
 
-	gfx_mapscreen(0,0,config.screen_width, config.screen_height);
+	gfx_mapscreen(0,0,config.gfx_screen_width, config.gfx_screen_height);
 	
 	// TODO: make wrappers for this
 	glEnable(GL_BLEND);
@@ -225,6 +163,7 @@ bool gfx_init()
 	textures[MAX_TEXTURES-1].next = -1;
 	
 	// init indecies
+	/*
 	for(int i = 0; i < vertex_buffer_size; i++)
 	{
 		indecies[i*6 + 0] = i+0;
@@ -234,7 +173,7 @@ bool gfx_init()
 		indecies[i*6 + 3] = i+1;
 		indecies[i*6 + 4] = i+3;
 		indecies[i*6 + 5] = i+2;
-	}
+	}*/
 	
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
 	
@@ -242,7 +181,7 @@ bool gfx_init()
 	gfx_load_texture_raw(4,4,IMG_RGBA,null_texture_data);
 
 	// set vsync as needed
-	gfx_set_vsync(config.vsync);
+	gfx_set_vsync(config.gfx_vsync);
 
 	return true;
 }
@@ -273,7 +212,7 @@ video_mode fakemodes[] = {
 
 int gfx_get_video_modes(video_mode *list, int maxcount)
 {
-	if(config.display_all_modes)
+	if(config.gfx_display_all_modes)
 	{
 		mem_copy(list, fakemodes, sizeof(fakemodes));
 		return min((int)(sizeof(fakemodes)/sizeof(video_mode)), maxcount);
@@ -458,12 +397,12 @@ void gfx_swap()
 
 int gfx_screenwidth()
 {
-	return config.screen_width;
+	return config.gfx_screen_width;
 }
 
 int gfx_screenheight()
 {
-	return config.screen_height;
+	return config.gfx_screen_height;
 }
 
 void gfx_texture_set(int slot)
diff --git a/src/engine/config_variables.h b/src/engine/config_variables.h
index 8dcc7365..4919af0b 100644
--- a/src/engine/config_variables.h
+++ b/src/engine/config_variables.h
@@ -1,19 +1,19 @@
 #include "../game/game_variables.h"
 
-MACRO_CONFIG_INT(screen_width, 800, 0, 0)
-MACRO_CONFIG_INT(screen_height, 600, 0, 0)
-MACRO_CONFIG_INT(fullscreen, 1, 0, 1)
-MACRO_CONFIG_INT(color_depth, 24, 16, 24)
-MACRO_CONFIG_INT(vsync, 1, 0, 1)
 MACRO_CONFIG_INT(debug, 0, 0, 1)
-MACRO_CONFIG_INT(display_all_modes, 0, 0, 1)
 MACRO_CONFIG_INT(volume, 200, 0, 255)
 MACRO_CONFIG_INT(cpu_throttle, 0, 0, 1)
 MACRO_CONFIG_STR(player_name, 32, "nameless tee")
 MACRO_CONFIG_STR(clan_name, 32, "")
 MACRO_CONFIG_STR(password, 32, "")
 
-MACRO_CONFIG_INT(gfx_texture_compression, 1, 0, 1)
+MACRO_CONFIG_INT(gfx_screen_width, 800, 0, 0)
+MACRO_CONFIG_INT(gfx_screen_height, 600, 0, 0)
+MACRO_CONFIG_INT(gfx_fullscreen, 1, 0, 1)
+MACRO_CONFIG_INT(gfx_color_depth, 24, 16, 24)
+MACRO_CONFIG_INT(gfx_vsync, 1, 0, 1)
+MACRO_CONFIG_INT(gfx_display_all_modes, 0, 0, 1)
+MACRO_CONFIG_INT(gfx_texture_compression, 0, 0, 1)
 MACRO_CONFIG_INT(gfx_high_detail, 1, 0, 1)
 MACRO_CONFIG_INT(gfx_texture_quality, 1, 0, 1)
 
diff --git a/src/engine/interface.h b/src/engine/interface.h
index d51cedc4..f3de5109 100644
--- a/src/engine/interface.h
+++ b/src/engine/interface.h
@@ -754,10 +754,6 @@ float gfx_pretty_text_width(float size, const char *text, int length = -1);
 
 void gfx_getscreen(float *tl_x, float *tl_y, float *br_x, float *br_y);
 
-void gfx_quads_draw_batch(void *batch);
-void *gfx_quads_create_batch();
-void gfx_destoy_batch(void *batch);
-
 void mods_message(int msg, int client_id);
 void modc_message(int msg);