diff --git a/data/icons2.png b/data/icons2.png index 00e635d..e9e408a 100644 Binary files a/data/icons2.png and b/data/icons2.png differ diff --git a/source/Globals.c b/source/Globals.c index c91bb0f..9224e05 100644 --- a/source/Globals.c +++ b/source/Globals.c @@ -409,6 +409,7 @@ bool tileIsSolid(int tile, Entity * e){ case TILE_GEMORE: case TILE_CLOUDCACTUS: case TILE_LAVA: + case TILE_WOOD_WALL: case 255: return true; case TILE_WATER: @@ -548,6 +549,10 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir) setTile(TILE_FLOWER,x,y); --item->countLevel; setData(rand()%4,x,y); // determines mirroring. return 1; + } + else if(item->id == ITEM_WOOD){ + setTile(TILE_WOOD_WALL,x,y); --item->countLevel; + return 1; } else if(item->id == TOOL_SHOVEL && playerUseEnergy(4-item->countLevel)){ if(rand()%5==0)addEntityToList(newItemEntity(newItem(ITEM_SEEDS,1),(x<<4)+8, (y<<4)+8,currentLevel),&eManager); @@ -570,6 +575,10 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir) setTile(TILE_FARM,x,y); return 1; } + else if(item->id == ITEM_WOOD){ + setTile(TILE_WOOD_WALL,x,y); --item->countLevel; + return 1; + } else if(item->id == TOOL_SHOVEL && playerUseEnergy(4-item->countLevel)){ addEntityToList(newItemEntity(newItem(ITEM_DIRT,1), (x<<4)+8, (y<<4)+8, currentLevel), &eManager); setTile(TILE_HOLE,x,y); @@ -636,6 +645,11 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir) setTile(TILE_DIRT,x,y); } } break; + case TILE_WOOD_WALL: + if(item->id == TOOL_AXE && playerUseEnergy(4-item->countLevel)){ + playerHurtTile(tile, x, y, (rand()%10) + (item->countLevel) * 5 + 10, player.p.dir); + return 1; + } break; } return 0; } @@ -1137,6 +1151,16 @@ void playerHurtTile(int tile, int xt, int yt, int damage, int dir){ setTile(TILE_GRASS,xt,yt); addEntityToList(newItemEntity(newItem(ITEM_FLOWER,1), (xt<<4)+8,(yt<<4)+8, currentLevel), &eManager); break; + case TILE_WOOD_WALL: + sprintf(hurtText, "%d", damage); + addEntityToList(newTextParticleEntity(hurtText,0xFF0000FF,xt<<4,yt<<4,currentLevel), &eManager); + addEntityToList(newSmashParticleEntity(xt<<4,yt<<4,currentLevel), &eManager); + setData(getData(xt,yt)+damage,xt,yt); + if(getData(xt,yt) > 20){ + setTile(TILE_DIRT,xt,yt); + addItemsToWorld(newItem(ITEM_WOOD,1),(xt<<4)+8,(yt<<4)+8,1); + } + break; } } @@ -1456,4 +1480,7 @@ void reloadColors() { rockColor[1] = SWAP_UINT32(sf2d_get_pixel(icons, 21, 1)); rockColor[2] = SWAP_UINT32(sf2d_get_pixel(icons, 21, 2)); rockColor[3] = SWAP_UINT32(sf2d_get_pixel(icons, 21, 3)); + + woodColor[0] = SWAP_UINT32(sf2d_get_pixel(icons, 22, 0)); + woodColor[1] = SWAP_UINT32(sf2d_get_pixel(icons, 22, 1)); } \ No newline at end of file diff --git a/source/Globals.h b/source/Globals.h index 9b6fe51..8ce33b2 100644 --- a/source/Globals.h +++ b/source/Globals.h @@ -48,6 +48,7 @@ #define TILE_HARDROCK 19 #define TILE_CLOUDCACTUS 20 #define TILE_HOLE 21 +#define TILE_WOOD_WALL 22 #define SWAP_UINT32(x) (((x) >> 24) | (((x) & 0x00FF0000) >> 8) | (((x) & 0x0000FF00) << 8) | ((x) << 24)) @@ -83,6 +84,7 @@ u32 sandColor[2]; u32 waterColor[2]; u32 lavaColor[2]; u32 rockColor[4]; +u32 woodColor[2]; char currentFileName[256]; extern u8 currentMenu; diff --git a/source/Render.c b/source/Render.c index 6a945f2..42385af 100644 --- a/source/Render.c +++ b/source/Render.c @@ -643,6 +643,9 @@ void renderTile(int i, int x, int y) { age = 5; render16(x, y, 160 + (age << 4), 0, 0); break; + case TILE_WOOD_WALL: + render16b(x, y, grassTable[checkSurrTiles4(x >> 4, y >> 4, TILE_WOOD_WALL)], 176, 0, woodColor[0]); + break; } }