--- a/src/Terrain.cc Mon Dec 08 23:00:23 2008 +0000
+++ b/src/Terrain.cc Mon Dec 08 23:11:40 2008 +0000
@@ -111,15 +111,26 @@
* x and y should be valid coordinates (not outside)
*/
void Terrain::noisifyPixel(CL_Color& color, PixelCoordinate pc) {
- int tx = pc.x % texture.size();
- int ty = pc.y % texture[0].size();
+ int texture_fade = 8;
+ switch (terrain[pc.x][pc.y]) {
+ case TERRAIN_EMPTY:
+ break;
+ case TERRAIN_DIRT:
+ texture_fade = 4;
+ break;
+ case TERRAIN_ROCK:
+ texture_fade = 2;
+ break;
+ }
+ int tx = (pc.x + texture_fade * 37) % texture.size();
+ int ty = (pc.y + texture_fade * 37) % texture[0].size();
int red = color.get_red();
int green = color.get_green();
int blue = color.get_blue();
- red += texture[tx][ty] / 8 - 16;
- green += texture[tx][ty] / 8 - 16;
- blue += texture[tx][ty] / 8 - 16;
+ red += (texture[tx][ty] - 128) / texture_fade;
+ green += (texture[tx][ty] - 128) / texture_fade;
+ blue += (texture[tx][ty] - 128) / texture_fade;
if (red < 0)
red = 0;