about summary refs log tree commit diff
path: root/src/game/client
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-07-22 12:01:20 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-07-22 12:01:20 +0000
commit2231cd8c39b553e1ddf4bf1388083c618b708470 (patch)
tree819646eef860ee3215d411c33da8214620c19536 /src/game/client
parentbcb97cfdf631edec486e8f56349a275ddb706392 (diff)
downloadzcatch-2231cd8c39b553e1ddf4bf1388083c618b708470.tar.gz
zcatch-2231cd8c39b553e1ddf4bf1388083c618b708470.zip
various small changes
Diffstat (limited to 'src/game/client')
-rw-r--r--src/game/client/game_client.cpp15
-rw-r--r--src/game/client/mapres_tilemap.cpp36
-rw-r--r--src/game/client/menu.h2
3 files changed, 38 insertions, 15 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp
index 511df061..7b5b69c4 100644
--- a/src/game/client/game_client.cpp
+++ b/src/game/client/game_client.cpp
@@ -629,7 +629,7 @@ static void render_powerup(obj_powerup *prev, obj_powerup *current)
 	float size = 64.0f;
 	if (current->type == POWERUP_TYPE_WEAPON)
 	{
-		angle = -0.25f * pi * 2.0f;
+		angle = 0; //-pi/6;//-0.25f * pi * 2.0f;
 		select_sprite(data->weapons[current->subtype%data->num_weapons].sprite_body);
 		size = data->weapons[current->subtype%data->num_weapons].visual_size;
 	}
@@ -1213,9 +1213,16 @@ void modc_render()
 	gfx_clear(0.65f,0.78f,0.9f);
 
 	// draw the sun	
-	{
-		render_sun(local_player_pos.x*0.5f, local_player_pos.y*0.5f);
-	}
+	render_sun(local_player_pos.x*0.5f, local_player_pos.y*0.5f);
+	
+	// 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 dfc7a7f8..6038e67c 100644
--- a/src/game/client/mapres_tilemap.cpp
+++ b/src/game/client/mapres_tilemap.cpp
@@ -15,6 +15,10 @@ 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);
+	
 	// fetch indecies
 	int start, num;
 	map_get_type(MAPRES_TILEMAP, &start, &num);
@@ -40,23 +44,35 @@ void tilemap_render(float scale, int fg)
 			gfx_texture_set(img_get(tmap->image));
 			gfx_quads_begin();
 			
-			int c = 0;
 			float frac = (1.0f/1024.0f);//2.0f; //2.0f;
 			float texsize = 1024.0f;
 			float nudge = 0.5f/texsize;
-			for(int y = 0; y < tmap->height; y++)
-				for(int x = 0; x < tmap->width; x++, c++)
+			
+			int startx = (int)(screen_x0/scale) - 1;
+			int endx = (int)(screen_x1/scale) + 1;
+			int starty = (int)(screen_y0/scale) - 1;
+			int endy = (int)(screen_y1/scale) + 1;
+			for(int y = starty; y < endy; y++)
+				for(int x = startx; x < endx; x++)
 				{
+					int mx = x;
+					int my = y;
+					if(mx<0) mx = 0;
+					if(mx>=tmap->width) mx = tmap->width-1;
+					if(my<0) my = 0;
+					if(my>=tmap->height) my = tmap->height-1;
+					
+					int c = mx + my*tmap->width;
+						
 					unsigned char d = data[c*2];
 					if(d)
 					{
-						/*
-						gfx_quads_setsubset(
-							(d%16)/16.0f*s+frac,
-							(d/16)/16.0f*s+frac,
-							((d%16)/16.0f+1.0f/16.0f)*s-frac,
-							((d/16)/16.0f+1.0f/16.0f)*s-frac);
-							*/
+						//gfx_quads_setsubset(
+						//	(d%16)/16.0f*s+frac,
+						//	(d/16)/16.0f*s+frac,
+						//	((d%16)/16.0f+1.0f/16.0f)*s-frac,
+						//	((d/16)/16.0f+1.0f/16.0f)*s-frac);
+							
 						int tx = d%16;
 						int ty = d/16;
 						int px0 = tx*(1024/16);
diff --git a/src/game/client/menu.h b/src/game/client/menu.h
index 0a8c1fe3..66c69953 100644
--- a/src/game/client/menu.h
+++ b/src/game/client/menu.h
@@ -14,4 +14,4 @@ int ui_do_check_box(void *id, float x, float y, float w, float h, int value);
 int do_scroll_bar_horiz(void *id, float x, float y, float width, int steps, int last_index);
 int do_scroll_bar_vert(void *id, float x, float y, float height, int steps, int last_index);
 
-#endif
\ No newline at end of file
+#endif