about summary refs log tree commit diff
path: root/src/game/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/client')
-rw-r--r--src/game/client/game_client.cpp47
-rw-r--r--src/game/client/mapres_tilemap.cpp22
2 files changed, 39 insertions, 30 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp
index 365205a4..ff212006 100644
--- a/src/game/client/game_client.cpp
+++ b/src/game/client/game_client.cpp
@@ -1373,33 +1373,34 @@ void modc_render()
 	// draw background
 	gfx_clear(0.65f,0.78f,0.9f);
 
-	// draw the sun	
-	render_sun(20+screen_x*0.6f, 20+screen_y*0.6f);
-
-
-	static vec2 cloud_pos[6] = {vec2(-500,0),vec2(-500,200),vec2(-500,400)};
-	static float cloud_speed[6] = {30, 20, 10};
-	static int cloud_images[6] = {IMAGE_CLOUD_1, IMAGE_CLOUD_2, IMAGE_CLOUD_3};
-	
-	for(int i = 0; i < 3; i++)
+	// draw the sun
+	if(config.gfx_high_detail)
 	{
-		float parallax_amount = 0.55f;
-		gfx_texture_set(data->images[cloud_images[i]].id);
+		render_sun(20+screen_x*0.6f, 20+screen_y*0.6f);
+		
+		static vec2 cloud_pos[6] = {vec2(-500,0),vec2(-500,200),vec2(-500,400)};
+		static float cloud_speed[6] = {30, 20, 10};
+		static int cloud_images[6] = {IMAGE_CLOUD_1, IMAGE_CLOUD_2, IMAGE_CLOUD_3};
+		
+		for(int i = 0; i < 3; i++)
+		{
+			float parallax_amount = 0.55f;
+			gfx_texture_set(data->images[cloud_images[i]].id);
+			gfx_quads_begin();
+			gfx_quads_drawTL((cloud_pos[i].x+fmod(client_localtime()*cloud_speed[i]+i*100.0f, 1700.0f))+screen_x*parallax_amount,
+				cloud_pos[i].y+screen_y*parallax_amount, 300, 300);
+			gfx_quads_end();
+		}
+
+		
+		// draw backdrop
+		gfx_texture_set(data->images[IMAGE_BACKDROP].id);
 		gfx_quads_begin();
-		gfx_quads_drawTL((cloud_pos[i].x+fmod(client_localtime()*cloud_speed[i]+i*100.0f, 1700.0f))+screen_x*parallax_amount,
-			cloud_pos[i].y+screen_y*parallax_amount, 300, 300);
+		float parallax_amount = 0.25f;
+		for(int x = -1; x < 3; x++)
+			gfx_quads_drawTL(1024*x+screen_x*parallax_amount, (screen_y)*parallax_amount+150, 1024, 1024);
 		gfx_quads_end();
 	}
-
-	
-	// draw backdrop
-	gfx_texture_set(data->images[IMAGE_BACKDROP].id);
-	gfx_quads_begin();
-	float parallax_amount = 0.25f;
-	for(int x = -1; x < 3; x++)
-		gfx_quads_drawTL(1024*x+screen_x*parallax_amount, (screen_y)*parallax_amount+150, 1024, 1024);
-	gfx_quads_end();
-	
 	
 	// render map
 	tilemap_render(32.0f, 0);
diff --git a/src/game/client/mapres_tilemap.cpp b/src/game/client/mapres_tilemap.cpp
index 3b2a5006..6f61e656 100644
--- a/src/game/client/mapres_tilemap.cpp
+++ b/src/game/client/mapres_tilemap.cpp
@@ -2,6 +2,7 @@
 #include "mapres_tilemap.h"
 #include "mapres_image.h"
 #include "../mapres.h"
+#include "../../engine/config.h"
 
 #include <baselib/opengl.h>
 
@@ -22,7 +23,7 @@ void tilemap_render(float scale, int fg)
 {
 	if(!map_is_loaded())
 		return;
-		
+	
 	float screen_x0, screen_y0, screen_x1, screen_y1;
 	gfx_getscreen(&screen_x0, &screen_y0, &screen_x1, &screen_y1);
 	
@@ -39,21 +40,28 @@ void tilemap_render(float scale, int fg)
 		
 		if(tmap->main)
 			passed_main = 1;
-
+			
 		if((fg && passed_main) || (!fg && !passed_main))
 		{
+			if(!config.gfx_high_detail && !tmap->main)
+				continue;
 			gfx_texture_set(img_get(tmap->image));
 			
 			if(!batches[t])
 			{
 				gfx_quads_begin();
 				
+				int starty = (int)(screen_y0/scale)-1;
+				int startx = (int)(screen_x0/scale)-1;
+				int endy = (int)(screen_y1/scale)+1;
+				int endx = (int)(screen_x1/scale)+1;
+				
 				float frac = (1.0f/1024.0f);//2.0f; //2.0f;
 				float texsize = 1024.0f;
 				float nudge = 0.5f/texsize;
 				int border = 24;
-				for(int y = -border; y < tmap->height+border; y++)
-					for(int x = -border; x < tmap->width+border; x++)
+				for(int y = starty; y < endy; y++)
+					for(int x = startx; x < endx; x++)
 					{
 						int mx = x;
 						int my = y;
@@ -92,11 +100,11 @@ void tilemap_render(float scale, int fg)
 						}
 					}
 				
-				//gfx_quads_end();
-				batches[t] = gfx_quads_create_batch();
+				gfx_quads_end();
+				//batches[t] = gfx_quads_create_batch();
 			}
 			
-			gfx_quads_draw_batch(batches[t]);
+			//gfx_quads_draw_batch(batches[t]);
 			//glCallList(lists_start+t);
 		}
 	}