Skip to content

Commit

Permalink
Add Footsteps on Sand
Browse files Browse the repository at this point in the history
  • Loading branch information
andre111 committed Dec 29, 2015
1 parent fff8d1e commit 7eb2832
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
Binary file modified data/icons2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions source/Globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}
Expand Down Expand Up @@ -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;
}
}

Expand Down
22 changes: 13 additions & 9 deletions source/Render.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/Render.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7eb2832

Please sign in to comment.