Add Bucket + Water/Lava = Rock Interaction
This commit is contained in:
parent
3a7865b913
commit
6f73c1892a
7 changed files with 53 additions and 5 deletions
BIN
data/icons2.png
BIN
data/icons2.png
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 17 KiB |
|
@ -98,7 +98,7 @@ void initRecipes(){
|
||||||
workbenchRecipes.recipes[14] = defineRecipe(TOOL_PICKAXE,1,2,ITEM_WOOD,5,ITEM_STONE,5);
|
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);
|
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 = (Recipe*)malloc(sizeof(Recipe) * (anvilRecipes.size));
|
||||||
anvilRecipes.recipes[0] = defineRecipe(TOOL_SWORD,2,2,ITEM_WOOD,5,ITEM_IRONINGOT,5);
|
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);
|
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[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[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[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.size = 3;
|
||||||
furnaceRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (furnaceRecipes.size));
|
furnaceRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (furnaceRecipes.size));
|
||||||
|
|
|
@ -455,7 +455,7 @@ void healPlayer(int amount){
|
||||||
s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir){
|
s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir){
|
||||||
|
|
||||||
// Furniture items
|
// Furniture items
|
||||||
if(item->id > 27){
|
if(item->id > 27 && item->id < 34){
|
||||||
if(!tileIsSolid(getTile(x,y), NULL)){
|
if(!tileIsSolid(getTile(x,y), NULL)){
|
||||||
addEntityToList(newFurnitureEntity(item->id,item->chestPtr, (x<<4)+8, (y<<4)+8, currentLevel), &eManager);
|
addEntityToList(newFurnitureEntity(item->id,item->chestPtr, (x<<4)+8, (y<<4)+8, currentLevel), &eManager);
|
||||||
removeItemFromCurrentInv(item);
|
removeItemFromCurrentInv(item);
|
||||||
|
@ -576,12 +576,38 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir)
|
||||||
return 1;
|
return 1;
|
||||||
} break;
|
} break;
|
||||||
case TILE_HOLE:
|
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:
|
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:
|
case TILE_LAVA:
|
||||||
if(item->id == ITEM_DIRT){
|
if(item->id == ITEM_DIRT){
|
||||||
setTile(TILE_DIRT,x,y);
|
setTile(TILE_DIRT,x,y);
|
||||||
--item->countLevel;
|
--item->countLevel;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
else if(item->id == TOOL_BUCKET && item->countLevel == 0 && playerUseEnergy(4)) {
|
||||||
|
setTile(TILE_HOLE,x,y);
|
||||||
|
item->countLevel = 2;
|
||||||
} break;
|
} break;
|
||||||
case TILE_NULL:
|
case TILE_NULL:
|
||||||
if(item->id == ITEM_CLOUD){
|
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-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,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;
|
break;
|
||||||
case TILE_HOLE: // This makes water flow slightly faster than lava
|
case TILE_HOLE: // This makes water flow slightly faster than lava
|
||||||
if(getTile(x+1,y)==TILE_WATER) setTile(TILE_WATER,x,y);
|
if(getTile(x+1,y)==TILE_WATER) setTile(TILE_WATER,x,y);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
char currentName[16];
|
char currentName[16];
|
||||||
|
|
||||||
bool isItemEmpty(Item* item){
|
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;
|
if(item->countLevel < 1) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ Item newItem(int id, int cLevel){
|
||||||
if(id != ITEM_NULL){
|
if(id != ITEM_NULL){
|
||||||
if(cLevel > 999) cLevel = 999;
|
if(cLevel > 999) cLevel = 999;
|
||||||
item.countLevel = cLevel;
|
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;
|
else item.onlyOne = false;
|
||||||
}
|
}
|
||||||
item.chestPtr = NULL;
|
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_GLASS: sprintf(currentName,"%d Glass", countLevel); return currentName;
|
||||||
case ITEM_GEM: sprintf(currentName,"%d Gem", countLevel); return currentName;
|
case ITEM_GEM: sprintf(currentName,"%d Gem", countLevel); return currentName;
|
||||||
case ITEM_SLIME: sprintf(currentName,"%d Slime", 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
|
default: return ""; // null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,6 +238,12 @@ char* getBasicItemName(int itemID, int countLevel){
|
||||||
case ITEM_GLASS: return "Glass";
|
case ITEM_GLASS: return "Glass";
|
||||||
case ITEM_GEM: return "Gem";
|
case ITEM_GEM: return "Gem";
|
||||||
case ITEM_SLIME: return "Slime";
|
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
|
default: return ""; // null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#define ITEM_FURNACE 31
|
#define ITEM_FURNACE 31
|
||||||
#define ITEM_WORKBENCH 32
|
#define ITEM_WORKBENCH 32
|
||||||
#define ITEM_LANTERN 33
|
#define ITEM_LANTERN 33
|
||||||
|
#define TOOL_BUCKET 101
|
||||||
|
|
||||||
typedef struct Inventory Inventory;
|
typedef struct Inventory Inventory;
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,7 @@ void tickMenu(int menu){
|
||||||
removeItemFromInventory(curInvSel, player.p.inv); // remove original
|
removeItemFromInventory(curInvSel, player.p.inv); // remove original
|
||||||
pushItemToInventoryFront(median, player.p.inv); // add copy to front
|
pushItemToInventoryFront(median, player.p.inv); // add copy to front
|
||||||
player.p.activeItem = &player.p.inv->items[0]; // active item = copy.
|
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;
|
else player.p.isCarrying = false;
|
||||||
}
|
}
|
||||||
currentMenu = MENU_NONE;
|
currentMenu = MENU_NONE;
|
||||||
|
|
|
@ -1206,6 +1206,9 @@ void renderItemIcon2(int itemID, int countLevel, int x, int y, int z) {
|
||||||
case ITEM_GEM:
|
case ITEM_GEM:
|
||||||
renderb(x, y, 112, 152, 0, 0xFF);
|
renderb(x, y, 112, 152, 0, 0xFF);
|
||||||
break;
|
break;
|
||||||
|
case TOOL_BUCKET:
|
||||||
|
renderb(x, y, 200 + countLevel * 8, 144, 0, 0xFF);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
y -= z;
|
y -= z;
|
||||||
renderItemIcon(itemID, countLevel, x, y);
|
renderItemIcon(itemID, countLevel, x, y);
|
||||||
|
@ -1314,6 +1317,9 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
|
||||||
case ITEM_GEM:
|
case ITEM_GEM:
|
||||||
render(x, y, 112, 152, 0);
|
render(x, y, 112, 152, 0);
|
||||||
break;
|
break;
|
||||||
|
case TOOL_BUCKET:
|
||||||
|
render(x, y, 200 + countLevel * 8, 144, 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue