diff --git a/data/icons2.png b/data/icons2.png index 7059007..74311be 100644 Binary files a/data/icons2.png and b/data/icons2.png differ diff --git a/source/Globals.c b/source/Globals.c index a1aaf28..c949190 100644 --- a/source/Globals.c +++ b/source/Globals.c @@ -720,6 +720,9 @@ void tickTile(int x, int y){ if(getTile(x,y+1)==TILE_DIRT) if((rand()%25) == 0) setTile(TILE_GRASS,x,y+1); if(getTile(x,y-1)==TILE_DIRT) if((rand()%25) == 0) setTile(TILE_GRASS,x,y-1); break; + case TILE_SAND: + if(data > 0) setData(--data,x,y); + break; } } @@ -1324,6 +1327,9 @@ void entityTileInteract(Entity*e, int tile, int x, int y){ if(rand()%20 == 0)setTile(TILE_DIRT,x,y); } return; + case TILE_SAND: + setData(10,x,y); + return; } } diff --git a/source/Render.c b/source/Render.c index 6f200db..2af96f4 100644 --- a/source/Render.c +++ b/source/Render.c @@ -418,7 +418,7 @@ void checkSurrTiles4(int xt, int yt, int id) { } u8 tData = 0; -void renderTile(int i, int x, int y) { +void renderTile(int i, int d, int x, int y) { int age = 0; switch (i) { case TILE_GRASS: @@ -430,7 +430,7 @@ void renderTile(int i, int x, int y) { renderConnectedTile4(x, y, 112, 16, grassColor); break; case TILE_TREE: - renderTile(TILE_GRASS, x, y); + renderTile(TILE_GRASS, 0, x, y); checkSurrTiles8(x >> 4, y >> 4, TILE_TREE); @@ -460,6 +460,10 @@ void renderTile(int i, int x, int y) { checkSurrTiles4(x >> 4, y >> 4, TILE_SAPLING_CACTUS); renderConnectedTile4(x, y, 112, 16, sandColor); + + if (d > 0) { + render16b(x, y, 128, 0, 0, sandColor); + } break; case TILE_WATER: checkSurrTiles4(x >> 4, y >> 4, TILE_WATER); @@ -487,16 +491,16 @@ void renderTile(int i, int x, int y) { renderConnectedTile4(x, y, 176, 16, 0xFF383838); break; case TILE_CACTUS: - renderTile(TILE_SAND, x, y); + renderTile(TILE_SAND, 0, x, y); render16(x, y, 48, 0, 0); break; case TILE_FLOWER: - renderTile(TILE_GRASS, x, y); + renderTile(TILE_GRASS, 0, x, y); render16(x, y, 64, 0, getData(x >> 4, y >> 4)); break; case TILE_STAIRS_DOWN: if (currentLevel == 0) - renderTile(TILE_CLOUD, x, y); + renderTile(TILE_CLOUD, 0, x, y); render16(x, y, 96, 0, 0); break; case TILE_STAIRS_UP: @@ -519,15 +523,15 @@ void renderTile(int i, int x, int y) { renderConnectedTile4(x, y, 64, 32, 0xFFFFFFFF); break; case TILE_CLOUDCACTUS: - renderTile(TILE_CLOUD, x, y); + renderTile(TILE_CLOUD, 0, x, y); render16(x, y, 80, 0, 0); break; case TILE_SAPLING_TREE: - renderTile(TILE_GRASS, x, y); + renderTile(TILE_GRASS, 0, x, y); render16(x, y, 32, 0, 0); break; case TILE_SAPLING_CACTUS: - renderTile(TILE_SAND, x, y); + renderTile(TILE_SAND, 0, x, y); render16(x, y, 32, 0, 0); break; case TILE_FARM: @@ -758,7 +762,7 @@ void renderBackground(int xScroll, int yScroll) { int x, y; for (x = xo; x <= 13 + xo; ++x) { for (y = yo; y <= 8 + yo; ++y) - renderTile(getTile(x, y), x << 4, y << 4); + renderTile(getTile(x, y), getData(x, y), x << 4, y << 4); } } diff --git a/source/Render.h b/source/Render.h index 237139e..f34b311 100644 --- a/source/Render.h +++ b/source/Render.h @@ -26,7 +26,7 @@ void render16s(s32 xp, s32 yp, u32 tile, u8 bits, u32 color); void renderTitle(int x, int y); void renderFrame(int x1, int y1, int x2, int y2, u32 bgColor); -void renderTile(int i, int x, int y); +void renderTile(int i, int d, int x, int y); void renderConnectedTile4(int x, int y, u32 xTile, u32 yTile, u32 color); void renderConnectedTile8(int x, int y, u32 xTile, u32 yTile, u32 color); void renderBackground(int xScroll, int yScroll);