diff --git a/Makefile b/Makefile index ea1b739..fa154b9 100644 --- a/Makefile +++ b/Makefile @@ -110,6 +110,7 @@ ifeq ($(strip $(ICON)),) export APP_ICON := $(TOPDIR)/$(TARGET).png else ifneq (,$(findstring icons-banners/icon.png,$(icons))) + ifneq (,$(findstring /icons-banners/icon.png,$(icons))) export APP_ICON := $(TOPDIR)/icons-banners/icon.png endif endif diff --git a/source/Crafting.c b/source/Crafting.c index ef1106e..3a69950 100644 --- a/source/Crafting.c +++ b/source/Crafting.c @@ -152,9 +152,10 @@ void initRecipes(){ enchanterRecipes.recipes[6] = defineRecipe(ITEM_WALL_GEM,1,1,ITEM_GEM,10); enchanterRecipes.recipes[7] = defineRecipe(ITEM_GOLD_APPLE,1,2,ITEM_APPLE,1,ITEM_GOLDINGOT,15); - potionMakerRecipes.size = 1; + potionMakerRecipes.size = 2; potionMakerRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (potionMakerRecipes.size)); potionMakerRecipes.recipes[0] = defineRecipe(ITEM_STRENGTH_POTION,1,3,ITEM_GOLD_APPLE,1,ITEM_GLASS,10,ITEM_IRONINGOT,10); + potionMakerRecipes.recipes[1] = defineRecipe(ITEM_SPEED_POTION,1,4,ITEM_GEM,2,ITEM_GLASS,10,ITEM_IRONINGOT,10, ITEM_GOLDINGOT,15); } diff --git a/source/Entity.h b/source/Entity.h index f00b7b8..d2ea03a 100644 --- a/source/Entity.h +++ b/source/Entity.h @@ -45,7 +45,9 @@ typedef struct { bool isCarrying; bool isSwimming; int swimTimer; + int regenTimer; int strengthTimer; + int speedTimer; int score; Inventory* inv; Item* activeItem; diff --git a/source/Globals.c b/source/Globals.c index edcc550..f855a6d 100644 --- a/source/Globals.c +++ b/source/Globals.c @@ -5,6 +5,8 @@ char versionText[34] = "Version 1.3.2"; char fpsstr[34]; u8 currentMenu = 0; bool UnderStrengthEffect = false; +bool UnderSpeedEffect = false; +bool regening = false; void addItemsToWorld(Item item,int x, int y, int count){ int i; @@ -691,6 +693,9 @@ void healPlayer(int amount){ void strengthPotionEffect() { UnderStrengthEffect = true; } +void speedPotionEffect() { + UnderSpeedEffect = true; +} s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir){ @@ -718,6 +723,12 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir) strengthPotionEffect(); --item->countLevel; } + return 0; + case ITEM_SPEED_POTION: + if(player.p.health < 20 && playerUseEnergy(2) && player.p.strengthTimer == 0){ + speedPotionEffect(); + --item->countLevel; + } return 0; case ITEM_GOLD_APPLE: if(player.p.health < 10 && playerUseEnergy(1)){ @@ -1681,6 +1692,7 @@ void initPlayer(){ addItemToInventory(newItem(ITEM_GOLD_APPLE,1), player.p.inv); addItemToInventory(newItem(ITEM_POTION_MAKER,0), player.p.inv); addItemToInventory(newItem(ITEM_STRENGTH_POTION,1), player.p.inv); + addItemToInventory(newItem(ITEM_SPEED_POTION,1), player.p.inv); addItemToInventory(newItem(TOOL_SHOVEL,4), player.p.inv); addItemToInventory(newItem(TOOL_HOE,4), player.p.inv); addItemToInventory(newItem(TOOL_SWORD,4), player.p.inv); @@ -2183,24 +2195,48 @@ void tickPlayer(){ player.p.ay = 0; if (k_left.down){ - player.p.ax -= 1; - player.p.dir = 2; - ++player.p.walkDist; + if (!UnderSpeedEffect) { + player.p.ax -= 1; + player.p.dir = 2; + ++player.p.walkDist; + } else if (UnderSpeedEffect) { + player.p.ax -= 2; + player.p.dir = 2; + player.p.walkDist = player.p.walkDist + 2; + } } if (k_right.down){ - player.p.ax += 1; - player.p.dir = 3; - ++player.p.walkDist; + if (!UnderSpeedEffect) { + player.p.ax += 1; + player.p.dir = 3; + ++player.p.walkDist; + } else if (UnderSpeedEffect) { + player.p.ax += 2; + player.p.dir = 3; + player.p.walkDist = player.p.walkDist + 2; + } } if (k_up.down){ - player.p.ay -= 1; - player.p.dir = 1; - ++player.p.walkDist; + if (!UnderSpeedEffect) { + player.p.ay -= 1; + player.p.dir = 1; + ++player.p.walkDist; + } else if (UnderSpeedEffect) { + player.p.ay -= 2; + player.p.dir = 1; + player.p.walkDist = player.p.walkDist + 2; + } } if (k_down.down){ - player.p.ay += 1; - player.p.dir = 0; - ++player.p.walkDist; + if (!UnderSpeedEffect) { + player.p.ay += 1; + player.p.dir = 0; + ++player.p.walkDist; + } else if (UnderSpeedEffect) { + player.p.ay += 2; + player.p.dir = 0; + player.p.walkDist = player.p.walkDist + 2; + } } if (player.p.staminaRechargeDelay % 2 == 0) moveMob(&player, player.p.ax, player.p.ay); @@ -2213,6 +2249,10 @@ void tickPlayer(){ } } + if (regening && player.p.regenTimer % 60 == 0) { + if(!shouldRenderDebug) --healPlayer(1); + } + if (k_pause.clicked){ currentSelection = 0; currentMenu = MENU_PAUSED; @@ -2233,11 +2273,17 @@ void tickPlayer(){ } if(isSwimming()) ++player.p.swimTimer; + if(regening) ++player.p.regenTimer; if(UnderStrengthEffect) ++player.p.strengthTimer; if(player.p.strengthTimer >= 2000) { player.p.strengthTimer = 0; UnderStrengthEffect = false; } + if(UnderSpeedEffect) ++player.p.speedTimer; + if(player.p.speedTimer >= 2000) { + player.p.speedTimer = 0; + UnderSpeedEffect = false; + } if(player.p.attackTimer > 0) { --player.p.attackTimer; } diff --git a/source/Item.c b/source/Item.c index 374c4ed..f7ee41c 100644 --- a/source/Item.c +++ b/source/Item.c @@ -153,6 +153,7 @@ char* getItemName(int itemID, int countLevel){ case ITEM_APPLE: sprintf(currentName,"%d Apple", countLevel); return currentName; case ITEM_GOLD_APPLE: sprintf(currentName,"%d Golden Apple", countLevel); return currentName; case ITEM_STRENGTH_POTION: sprintf(currentName,"%d Strength Potion", countLevel); return currentName; + case ITEM_SPEED_POTION: sprintf(currentName,"%d Speed Potion", countLevel); return currentName; case ITEM_COAL: sprintf(currentName,"%d Coal", countLevel); return currentName; case ITEM_IRONORE: sprintf(currentName,"%d Iron ore", countLevel); return currentName; case ITEM_GOLDORE: sprintf(currentName,"%d Gold ore", countLevel); return currentName; @@ -302,6 +303,7 @@ char* getBasicItemName(int itemID, int countLevel){ case ITEM_MAGIC_DUST: return "Magic Dust"; case ITEM_COIN: return "Coin"; case ITEM_STRENGTH_POTION: return "Strength Potion"; + case ITEM_SPEED_POTION: return "Speed Potion"; case TOOL_BUCKET: switch(countLevel){ case 1: return "Water Bucket"; diff --git a/source/Item.h b/source/Item.h index b6c1f9f..7836e94 100644 --- a/source/Item.h +++ b/source/Item.h @@ -74,6 +74,7 @@ #define ITEM_COIN 75 #define ITEM_GOLD_APPLE 76 #define ITEM_STRENGTH_POTION 77 +#define ITEM_SPEED_POTION 78 #define TOOL_BUCKET 101 #define TOOL_BOW 102 diff --git a/source/MenuTutorial.c b/source/MenuTutorial.c index db061b3..c2b7d3e 100644 --- a/source/MenuTutorial.c +++ b/source/MenuTutorial.c @@ -1,7 +1,7 @@ #include "MenuTutorial.h" u8 pageNum = 0; -u8 maxPageNum = 6; +u8 maxPageNum = 7; u32 biasedCirclePad(u32 in){ if(in & KEY_CPAD_UP) return KEY_CPAD_UP; @@ -95,6 +95,14 @@ void renderTutorialPage(bool topScreen){ drawText("Mine gem ore to get gems",(400-24*12)/2,154); drawText("It takes 4 ore and 1 coal to",(400-28*12)/2,190); drawText("make an ingot inside a furnace",(400-30*12)/2,210); + break; + case 7: // Potion Brewing + drawTextColor("Brewing",(400-6*12)/2,40,0xFF007FBF); + drawText("Use the Potion Maker to make potions",(400-29*12)/2,74); + drawText("The potions give you abilities",(400-20*12)/2,94); + drawText("Like speed and strength",(400-22*12)/2,114); + drawText("They are hard to obtain",(400-22*12)/2,134); + drawText("So get to it!",(400-24*12)/2,154); break; } } else { @@ -232,6 +240,34 @@ void renderTutorialPage(bool topScreen){ drawText(">",244,114); render(130,36,136,144,0); // Iron Pickaxe render(130,56,144,144,0); // Gold Pickaxe + break; + case 7: // Brewing + render16(23,32,464,48,0); // iron ore + render16(23,52,480,48,0); // gold ore + render16(23,72,496,48,0); // gem ore + renderb(41,38,88,152,0,ironColor); // Iron ore item + renderb(41,58,88,152,0,goldColor); // Gold ore item + render(41,78,112,152,0); // Gem item + drawText(">",104,74); + drawText(">",104,114); + drawText(">",104,154); + render16(60,32,112,128,0); // Furnace + render16(60,52,112,128,0); // Furnace + render16(60,72,240,128,0); // Enchanter + drawText(">",160,74); + drawText(">",160,114); + drawText(">",160,154); + renderb(88,36,96,152,0,ironColor); // Iron ingot item + renderb(88,56,96,152,0,goldColor); // Gold ingot item + renderb(88,76,152,144,0,goldColor); // Gem Pickaxe + drawText(">",200,74); + drawText(">",200,114); + render16(106,32,64,128,0); // Anvil + render16(106,52,64,128,0); // Anvil + drawText(">",244,74); + drawText(">",244,114); + render(130,36,136,144,0); // Iron Pickaxe + render(130,56,144,144,0); // Gold Pickaxe break; } diff --git a/source/Render.c b/source/Render.c index e6473b5..6f0abf2 100644 --- a/source/Render.c +++ b/source/Render.c @@ -1496,6 +1496,9 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) { case ITEM_STRENGTH_POTION: render(x, y, 184, 160, 0); break; + case ITEM_SPEED_POTION: + render(x, y, 191, 160, 0); + break; case ITEM_SLIME: renderb(x, y, 88, 152, 0, 0xFF4DC04D); break; diff --git a/source/Sound.c b/source/Sound.c index 0e188e4..9e44817 100644 --- a/source/Sound.c +++ b/source/Sound.c @@ -78,4 +78,4 @@ void freeSounds(){ linearFree(music_floor1_night.buffer); linearFree(music_floor23.buffer); linearFree(music_floor4.buffer); -} +} \ No newline at end of file diff --git a/source/main.c b/source/main.c index b95a97b..5e92c5a 100644 --- a/source/main.c +++ b/source/main.c @@ -322,7 +322,7 @@ int main() { offsetY = 0; if(shouldRenderDebug){ - sprintf(fpsstr, "FPS: %.0f X:%d Y:%d E:%d %d", sf2d_get_fps(), player.x, player.y, eManager.lastSlot[currentLevel], player.p.strengthTimer); + sprintf(fpsstr, "FPS: %.0f X:%d Y:%d E:%d %d", sf2d_get_fps(), player.x, player.y, eManager.lastSlot[currentLevel], player.p.speedTimer); drawText(fpsstr, 2, 225); }