diff --git a/data/icons2.png b/data/icons2.png index d103678..f085799 100644 Binary files a/data/icons2.png and b/data/icons2.png differ diff --git a/source/Crafting.c b/source/Crafting.c index 670b906..98d1cbb 100644 --- a/source/Crafting.c +++ b/source/Crafting.c @@ -98,7 +98,7 @@ void initRecipes(){ workbenchRecipes.recipes[14] = defineRecipe(TOOL_PICKAXE,1,2,ITEM_WOOD,5,ITEM_STONE,5); workbenchRecipes.recipes[15] = defineRecipe(TOOL_SHOVEL,1,2,ITEM_WOOD,5,ITEM_STONE,5); - anvilRecipes.size = 15; + anvilRecipes.size = 16; anvilRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (anvilRecipes.size)); anvilRecipes.recipes[0] = defineRecipe(TOOL_SWORD,2,2,ITEM_WOOD,5,ITEM_IRONINGOT,5); anvilRecipes.recipes[1] = defineRecipe(TOOL_AXE,2,2,ITEM_WOOD,5,ITEM_IRONINGOT,5); @@ -115,6 +115,7 @@ void initRecipes(){ anvilRecipes.recipes[12] = defineRecipe(TOOL_HOE,4,2,ITEM_WOOD,5,ITEM_GEM,50); anvilRecipes.recipes[13] = defineRecipe(TOOL_PICKAXE,4,2,ITEM_WOOD,5,ITEM_GEM,50); anvilRecipes.recipes[14] = defineRecipe(TOOL_SHOVEL,4,2,ITEM_WOOD,5,ITEM_GEM,50); + anvilRecipes.recipes[15] = defineRecipe(TOOL_BUCKET,0,1,ITEM_IRONINGOT,10); furnaceRecipes.size = 3; furnaceRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (furnaceRecipes.size)); diff --git a/source/Globals.c b/source/Globals.c index abfa1c5..9507cba 100644 --- a/source/Globals.c +++ b/source/Globals.c @@ -455,7 +455,7 @@ void healPlayer(int amount){ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir){ // Furniture items - if(item->id > 27){ + if(item->id > 27 && item->id < 34){ if(!tileIsSolid(getTile(x,y), NULL)){ addEntityToList(newFurnitureEntity(item->id,item->chestPtr, (x<<4)+8, (y<<4)+8, currentLevel), &eManager); removeItemFromCurrentInv(item); @@ -576,12 +576,38 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir) return 1; } break; case TILE_HOLE: + if(item->id == ITEM_DIRT){ + setTile(TILE_DIRT,x,y); + --item->countLevel; + return 1; + } + else if(item->id == TOOL_BUCKET && item->countLevel == 1 && playerUseEnergy(4)) { + setTile(TILE_WATER,x,y); + item->countLevel = 0; + } + else if(item->id == TOOL_BUCKET && item->countLevel == 2 && playerUseEnergy(4)) { + setTile(TILE_LAVA,x,y); + item->countLevel = 0; + } break; case TILE_WATER: + if(item->id == ITEM_DIRT){ + setTile(TILE_DIRT,x,y); + --item->countLevel; + return 1; + } + else if(item->id == TOOL_BUCKET && item->countLevel == 0 && playerUseEnergy(4)) { + setTile(TILE_HOLE,x,y); + item->countLevel = 1; + } break; case TILE_LAVA: if(item->id == ITEM_DIRT){ setTile(TILE_DIRT,x,y); --item->countLevel; return 1; + } + else if(item->id == TOOL_BUCKET && item->countLevel == 0 && playerUseEnergy(4)) { + setTile(TILE_HOLE,x,y); + item->countLevel = 2; } break; case TILE_NULL: if(item->id == ITEM_CLOUD){ @@ -639,6 +665,8 @@ void tickTile(int x, int y){ if(getTile(x-1,y)==TILE_HOLE) setTile(TILE_LAVA,x-1,y); if(getTile(x,y+1)==TILE_HOLE) setTile(TILE_LAVA,x,y+1); if(getTile(x,y-1)==TILE_HOLE) setTile(TILE_LAVA,x,y-1); + + if(getTile(x+1,y)==TILE_WATER || getTile(x-1,y)==TILE_WATER || getTile(x,y+1)==TILE_WATER || getTile(x,y-1)==TILE_WATER) setTile(TILE_ROCK,x,y); break; case TILE_HOLE: // This makes water flow slightly faster than lava if(getTile(x+1,y)==TILE_WATER) setTile(TILE_WATER,x,y); diff --git a/source/Item.c b/source/Item.c index a4dc71e..ca47720 100644 --- a/source/Item.c +++ b/source/Item.c @@ -3,7 +3,7 @@ char currentName[16]; bool isItemEmpty(Item* item){ - if(item->id < 6 || item->onlyOne == true) return false; + if(item->id < 6 || item->id > 100 || item->onlyOne == true) return false; if(item->countLevel < 1) return true; return false; } @@ -59,7 +59,7 @@ Item newItem(int id, int cLevel){ if(id != ITEM_NULL){ if(cLevel > 999) cLevel = 999; item.countLevel = cLevel; - if(id < 7 || id > 27) item.onlyOne = true; // Tools + Furniture. + if(id < 7 || id > 27 || id > 100) item.onlyOne = true; // Tools + Furniture. else item.onlyOne = false; } item.chestPtr = NULL; @@ -158,6 +158,12 @@ char* getItemName(int itemID, int countLevel){ case ITEM_GLASS: sprintf(currentName,"%d Glass", countLevel); return currentName; case ITEM_GEM: sprintf(currentName,"%d Gem", countLevel); return currentName; case ITEM_SLIME: sprintf(currentName,"%d Slime", countLevel); return currentName; + case TOOL_BUCKET: + switch(countLevel){ + case 1: return "Water Bucket"; + case 2: return "Lava Bucket"; + default: return "Empty Bucket"; + } default: return ""; // null } } @@ -232,6 +238,12 @@ char* getBasicItemName(int itemID, int countLevel){ case ITEM_GLASS: return "Glass"; case ITEM_GEM: return "Gem"; case ITEM_SLIME: return "Slime"; + case TOOL_BUCKET: + switch(countLevel){ + case 1: return "Water Bucket"; + case 2: return "Lava Bucket"; + default: return "Empty Bucket"; + } default: return ""; // null } diff --git a/source/Item.h b/source/Item.h index 1fd86e5..6e806e7 100644 --- a/source/Item.h +++ b/source/Item.h @@ -42,6 +42,7 @@ #define ITEM_FURNACE 31 #define ITEM_WORKBENCH 32 #define ITEM_LANTERN 33 +#define TOOL_BUCKET 101 typedef struct Inventory Inventory; diff --git a/source/Menu.c b/source/Menu.c index df0166e..ee21b84 100644 --- a/source/Menu.c +++ b/source/Menu.c @@ -408,7 +408,7 @@ void tickMenu(int menu){ removeItemFromInventory(curInvSel, player.p.inv); // remove original pushItemToInventoryFront(median, player.p.inv); // add copy to front player.p.activeItem = &player.p.inv->items[0]; // active item = copy. - if(player.p.activeItem->id > 27) player.p.isCarrying = true; + if(player.p.activeItem->id > 27 && player.p.activeItem->id < 34) player.p.isCarrying = true; else player.p.isCarrying = false; } currentMenu = MENU_NONE; diff --git a/source/Render.c b/source/Render.c index f8cf80b..362a69d 100644 --- a/source/Render.c +++ b/source/Render.c @@ -1206,6 +1206,9 @@ void renderItemIcon2(int itemID, int countLevel, int x, int y, int z) { case ITEM_GEM: renderb(x, y, 112, 152, 0, 0xFF); break; + case TOOL_BUCKET: + renderb(x, y, 200 + countLevel * 8, 144, 0, 0xFF); + break; } y -= z; renderItemIcon(itemID, countLevel, x, y); @@ -1314,6 +1317,9 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) { case ITEM_GEM: render(x, y, 112, 152, 0); break; + case TOOL_BUCKET: + render(x, y, 200 + countLevel * 8, 144, 0); + break; } }