diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index 573b60d457..231f156ea7 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -228,4 +228,22 @@ Debug_ShowExpansionVersion:: Debug_ExpansionVersion: .string "pokeemerald-expansion {STR_VAR_1}$" +Debug_BerryPestsDisabled:: + msgbox DebugText_BerryPestsDisabled, MSGBOX_DEFAULT + release + end + +DebugText_BerryPestsDisabled: + .string "OW_BERRY_PESTS is disabled.\n" + .string "Unable to force pests onto berry trees.$" + +Debug_BerryWeedsDisabled:: + msgbox DebugText_BerryWeedsDisabled, MSGBOX_DEFAULT + release + end + +DebugText_BerryWeedsDisabled: + .string "OW_BERRY_WEEDS is disabled.\n" + .string "Unable to force weeds onto berry trees.$" + .endif diff --git a/include/berry.h b/include/berry.h index 68ac171370..13cf77d4dd 100644 --- a/include/berry.h +++ b/include/berry.h @@ -27,6 +27,7 @@ void ObjectEventInteractionRemoveBerryTree(void); void ObjectEventInteractionApplyMulch(void); bool8 PlayerHasBerries(void); void SetBerryTreesSeen(void); +bool32 BerryTreeGrow(struct BerryTree *tree); extern const struct Berry gBerries[]; diff --git a/src/berry.c b/src/berry.c index 5d751bdd67..e4b8cb428f 100644 --- a/src/berry.c +++ b/src/berry.c @@ -16,7 +16,6 @@ #include "constants/items.h" static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry); -static bool32 BerryTreeGrow(struct BerryTree *tree); static u16 BerryTypeToItemId(u16 berry); static u8 BerryTreeGetNumStagesWatered(struct BerryTree *tree); static u8 GetNumStagesWateredByBerryTreeId(u8 id); @@ -1688,7 +1687,7 @@ void ClearBerryTrees(void) gSaveBlock1Ptr->berryTrees[i] = gBlankBerryTree; } -static bool32 BerryTreeGrow(struct BerryTree *tree) +bool32 BerryTreeGrow(struct BerryTree *tree) { if (tree->stopGrowth) return FALSE; @@ -2177,7 +2176,7 @@ static u8 TryForMutation(u8 berryTreeId, u8 berry) for (i = 0; i < OBJECT_EVENTS_COUNT; i++) { if (gObjectEvents[i].trainerRange_berryTreeId == berryTreeId && gObjectEvents[i].movementType == MOVEMENT_TYPE_BERRY_TREE_GROWTH) - break; + break; } if (i == OBJECT_EVENTS_COUNT) return 0; diff --git a/src/debug.c b/src/debug.c index 23c21f76f0..7eb4d41eba 100644 --- a/src/debug.c +++ b/src/debug.c @@ -6,9 +6,11 @@ //AsparagusEduardo: https://github.com/AsparagusEduardo/pokeemerald/tree/InfusedEmerald_v2 //Ghoulslash: https://github.com/ghoulslash/pokeemerald //Jaizu: https://jaizu.moe/ +//AND OTHER RHH POKEEMERALD-EXPANSION CONTRIBUTORS #include "global.h" #include "battle.h" #include "battle_setup.h" +#include "berry.h" #include "clock.h" #include "coins.h" #include "credits.h" @@ -100,6 +102,7 @@ enum UtilMenu DEBUG_UTIL_MENU_ITEM_CHEAT, DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG, DEBUG_UTIL_MENU_ITEM_EXPANSION_VER, + DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS, }; enum ScriptMenu @@ -211,6 +214,14 @@ enum SoundMenu DEBUG_SOUND_MENU_ITEM_MUS, }; +enum BerryFunctionsMenu +{ + DEBUG_BERRY_FUNCTIONS_MENU_CLEAR_ALL, + DEBUG_BERRY_FUNCTIONS_MENU_READY, + DEBUG_BERRY_FUNCTIONS_MENU_WEEDS, + DEBUG_BERRY_FUNCTIONS_MENU_PESTS, +}; + // ******************************* // Constants #define DEBUG_MENU_FONT FONT_NORMAL @@ -320,6 +331,7 @@ static void DebugTask_HandleMenuInput_Battle(u8 taskId); static void DebugTask_HandleMenuInput_Give(u8 taskId); static void DebugTask_HandleMenuInput_Fill(u8 taskId); static void DebugTask_HandleMenuInput_Sound(u8 taskId); +static void DebugTask_HandleMenuInput_BerryFunctions(u8 taskId); static void DebugAction_Util_HealParty(u8 taskId); static void DebugAction_Util_Fly(u8 taskId); @@ -343,6 +355,7 @@ static void DebugAction_Util_Clear_Boxes(u8 taskId); static void DebugAction_Util_CheatStart(u8 taskId); static void DebugAction_Util_HatchAnEgg(u8 taskId); static void DebugAction_Util_ExpansionVersion(u8 taskId); +static void DebugAction_Util_BerryFunctions(u8 taskId); static void DebugAction_FlagsVars_Flags(u8 taskId); static void DebugAction_FlagsVars_FlagsSelect(u8 taskId); @@ -399,6 +412,10 @@ static void DebugAction_Sound_SE_SelectId(u8 taskId); static void DebugAction_Sound_MUS(u8 taskId); static void DebugAction_Sound_MUS_SelectId(u8 taskId); +static void DebugAction_BerryFunctions_ClearAll(u8 taskId); +static void DebugAction_BerryFunctions_Ready(u8 taskId); +static void DebugAction_BerryFunctions_Pests(u8 taskId); +static void DebugAction_BerryFunctions_Weeds(u8 taskId); extern const u8 Debug_FlagsNotSetOverworldConfigMessage[]; extern const u8 Debug_FlagsNotSetBattleConfigMessage[]; @@ -425,6 +442,9 @@ extern const u8 Debug_CheckROMSpace[]; extern const u8 Debug_BoxFilledMessage[]; extern const u8 Debug_ShowExpansionVersion[]; +extern const u8 Debug_BerryPestsDisabled[]; +extern const u8 Debug_BerryWeedsDisabled[]; + #include "data/map_group_count.h" // Text @@ -478,6 +498,7 @@ static const u8 sDebugText_Util_Clear_Boxes[] = _("Clear Storage Bo static const u8 sDebugText_Util_CheatStart[] = _("CHEAT Start"); static const u8 sDebugText_Util_HatchAnEgg[] = _("Hatch an Egg"); static const u8 sDebugText_Util_ExpansionVersion[] = _("Expansion Version"); +static const u8 sDebugText_Util_BerryFunctions[] = _("Berry Functions…{CLEAR_TO 110}{RIGHT_ARROW}"); // Flags/Vars Menu static const u8 sDebugText_FlagsVars_Flags[] = _("Set Flag XYZ…{CLEAR_TO 110}{RIGHT_ARROW}"); static const u8 sDebugText_FlagsVars_Flag[] = _("Flag: {STR_VAR_1}{CLEAR_TO 90}\n{STR_VAR_2}{CLEAR_TO 90}\n{STR_VAR_3}"); @@ -576,6 +597,11 @@ static const u8 sDebugText_Sound_SFX[] = _("SFX…{CLEAR_TO 110}{ static const u8 sDebugText_Sound_SFX_ID[] = _("SFX Id: {STR_VAR_3} {START_BUTTON} Stop\n{STR_VAR_1} \n{STR_VAR_2}"); static const u8 sDebugText_Sound_Music[] = _("Music…{CLEAR_TO 110}{RIGHT_ARROW}"); static const u8 sDebugText_Sound_Music_ID[] = _("Music Id: {STR_VAR_3} {START_BUTTON} Stop\n{STR_VAR_1} \n{STR_VAR_2}"); +// Berry Function Menu +static const u8 sDebugText_BerryFunctions_ClearAll[] = _("Clear map trees"); +static const u8 sDebugText_BerryFunctions_Ready[] = _("Ready map trees"); +static const u8 sDebugText_BerryFunctions_Pests[] = _("Give map trees pests"); +static const u8 sDebugText_BerryFunctions_Weeds[] = _("Give map trees weeds"); static const u8 sDebugText_Digit_1[] = _("{LEFT_ARROW}+1{RIGHT_ARROW} "); static const u8 sDebugText_Digit_10[] = _("{LEFT_ARROW}+10{RIGHT_ARROW} "); @@ -628,23 +654,24 @@ static const struct ListMenuItem sDebugMenu_Items_Main[] = static const struct ListMenuItem sDebugMenu_Items_Utilities[] = { - [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = {sDebugText_Util_HealParty, DEBUG_UTIL_MENU_ITEM_HEAL_PARTY}, - [DEBUG_UTIL_MENU_ITEM_FLY] = {sDebugText_Util_FlyToMap, DEBUG_UTIL_MENU_ITEM_FLY}, - [DEBUG_UTIL_MENU_ITEM_WARP] = {sDebugText_Util_WarpToMap, DEBUG_UTIL_MENU_ITEM_WARP}, - [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = {sDebugText_Util_PoisonParty, DEBUG_UTIL_MENU_ITEM_POISON_MONS}, - [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = {sDebugText_Util_SaveBlockSpace, DEBUG_UTIL_MENU_ITEM_SAVEBLOCK}, - [DEBUG_UTIL_MENU_ITEM_ROM_SPACE] = {sDebugText_Util_ROMSpace, DEBUG_UTIL_MENU_ITEM_ROM_SPACE}, - [DEBUG_UTIL_MENU_ITEM_WEATHER] = {sDebugText_Util_Weather, DEBUG_UTIL_MENU_ITEM_WEATHER}, - [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = {sDebugText_Util_CheckWallClock, DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK}, - [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = {sDebugText_Util_SetWallClock, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK}, - [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = {sDebugText_Util_WatchCredits, DEBUG_UTIL_MENU_ITEM_WATCHCREDITS}, - [DEBUG_UTIL_MENU_ITEM_PLAYER_NAME] = {sDebugText_Util_Player_Name, DEBUG_UTIL_MENU_ITEM_PLAYER_NAME}, - [DEBUG_UTIL_MENU_ITEM_PLAYER_GENDER] = {sDebugText_Util_Player_Gender, DEBUG_UTIL_MENU_ITEM_PLAYER_GENDER}, - [DEBUG_UTIL_MENU_ITEM_PLAYER_ID] = {sDebugText_Util_Player_Id, DEBUG_UTIL_MENU_ITEM_PLAYER_ID}, - [DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = {sDebugText_Util_Clear_Boxes, DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES}, - [DEBUG_UTIL_MENU_ITEM_CHEAT] = {sDebugText_Util_CheatStart, DEBUG_UTIL_MENU_ITEM_CHEAT}, - [DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG] = {sDebugText_Util_HatchAnEgg, DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG}, - [DEBUG_UTIL_MENU_ITEM_EXPANSION_VER] = {sDebugText_Util_ExpansionVersion,DEBUG_UTIL_MENU_ITEM_EXPANSION_VER}, + [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = {sDebugText_Util_HealParty, DEBUG_UTIL_MENU_ITEM_HEAL_PARTY}, + [DEBUG_UTIL_MENU_ITEM_FLY] = {sDebugText_Util_FlyToMap, DEBUG_UTIL_MENU_ITEM_FLY}, + [DEBUG_UTIL_MENU_ITEM_WARP] = {sDebugText_Util_WarpToMap, DEBUG_UTIL_MENU_ITEM_WARP}, + [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = {sDebugText_Util_PoisonParty, DEBUG_UTIL_MENU_ITEM_POISON_MONS}, + [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = {sDebugText_Util_SaveBlockSpace, DEBUG_UTIL_MENU_ITEM_SAVEBLOCK}, + [DEBUG_UTIL_MENU_ITEM_ROM_SPACE] = {sDebugText_Util_ROMSpace, DEBUG_UTIL_MENU_ITEM_ROM_SPACE}, + [DEBUG_UTIL_MENU_ITEM_WEATHER] = {sDebugText_Util_Weather, DEBUG_UTIL_MENU_ITEM_WEATHER}, + [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = {sDebugText_Util_CheckWallClock, DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK}, + [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = {sDebugText_Util_SetWallClock, DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK}, + [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = {sDebugText_Util_WatchCredits, DEBUG_UTIL_MENU_ITEM_WATCHCREDITS}, + [DEBUG_UTIL_MENU_ITEM_PLAYER_NAME] = {sDebugText_Util_Player_Name, DEBUG_UTIL_MENU_ITEM_PLAYER_NAME}, + [DEBUG_UTIL_MENU_ITEM_PLAYER_GENDER] = {sDebugText_Util_Player_Gender, DEBUG_UTIL_MENU_ITEM_PLAYER_GENDER}, + [DEBUG_UTIL_MENU_ITEM_PLAYER_ID] = {sDebugText_Util_Player_Id, DEBUG_UTIL_MENU_ITEM_PLAYER_ID}, + [DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = {sDebugText_Util_Clear_Boxes, DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES}, + [DEBUG_UTIL_MENU_ITEM_CHEAT] = {sDebugText_Util_CheatStart, DEBUG_UTIL_MENU_ITEM_CHEAT}, + [DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG] = {sDebugText_Util_HatchAnEgg, DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG}, + [DEBUG_UTIL_MENU_ITEM_EXPANSION_VER] = {sDebugText_Util_ExpansionVersion, DEBUG_UTIL_MENU_ITEM_EXPANSION_VER}, + [DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS] = {sDebugText_Util_BerryFunctions, DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS}, }; static const struct ListMenuItem sDebugMenu_Items_Scripts[] = @@ -756,6 +783,14 @@ static const struct ListMenuItem sDebugMenu_Items_Sound[] = [DEBUG_SOUND_MENU_ITEM_MUS] = {sDebugText_Sound_Music, DEBUG_SOUND_MENU_ITEM_MUS}, }; +static const struct ListMenuItem sDebugMenu_Items_BerryFunctions[] = +{ + [DEBUG_BERRY_FUNCTIONS_MENU_CLEAR_ALL] = {sDebugText_BerryFunctions_ClearAll, DEBUG_BERRY_FUNCTIONS_MENU_CLEAR_ALL}, + [DEBUG_BERRY_FUNCTIONS_MENU_READY] = {sDebugText_BerryFunctions_Ready, DEBUG_BERRY_FUNCTIONS_MENU_READY}, + [DEBUG_BERRY_FUNCTIONS_MENU_PESTS] = {sDebugText_BerryFunctions_Pests, DEBUG_BERRY_FUNCTIONS_MENU_PESTS}, + [DEBUG_BERRY_FUNCTIONS_MENU_WEEDS] = {sDebugText_BerryFunctions_Weeds, DEBUG_BERRY_FUNCTIONS_MENU_WEEDS}, +}; + // ******************************* // Menu Actions static void (*const sDebugMenu_Actions_Main[])(u8) = @@ -770,25 +805,27 @@ static void (*const sDebugMenu_Actions_Main[])(u8) = [DEBUG_MENU_ITEM_ACCESS_PC] = DebugAction_AccessPC, [DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel }; + static void (*const sDebugMenu_Actions_Utilities[])(u8) = { - [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = DebugAction_Util_HealParty, - [DEBUG_UTIL_MENU_ITEM_FLY] = DebugAction_Util_Fly, - [DEBUG_UTIL_MENU_ITEM_WARP] = DebugAction_Util_Warp_Warp, - [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = DebugAction_Util_PoisonMons, - [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = DebugAction_Util_CheckSaveBlock, - [DEBUG_UTIL_MENU_ITEM_ROM_SPACE] = DebugAction_Util_CheckROMSpace, - [DEBUG_UTIL_MENU_ITEM_WEATHER] = DebugAction_Util_Weather, - [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = DebugAction_Util_CheckWallClock, - [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = DebugAction_Util_SetWallClock, - [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = DebugAction_Util_WatchCredits, - [DEBUG_UTIL_MENU_ITEM_PLAYER_NAME] = DebugAction_Util_Player_Name, - [DEBUG_UTIL_MENU_ITEM_PLAYER_GENDER] = DebugAction_Util_Player_Gender, - [DEBUG_UTIL_MENU_ITEM_PLAYER_ID] = DebugAction_Util_Player_Id, - [DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = DebugAction_Util_Clear_Boxes, - [DEBUG_UTIL_MENU_ITEM_CHEAT] = DebugAction_Util_CheatStart, - [DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG] = DebugAction_Util_HatchAnEgg, - [DEBUG_UTIL_MENU_ITEM_EXPANSION_VER] = DebugAction_Util_ExpansionVersion, + [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY] = DebugAction_Util_HealParty, + [DEBUG_UTIL_MENU_ITEM_FLY] = DebugAction_Util_Fly, + [DEBUG_UTIL_MENU_ITEM_WARP] = DebugAction_Util_Warp_Warp, + [DEBUG_UTIL_MENU_ITEM_POISON_MONS] = DebugAction_Util_PoisonMons, + [DEBUG_UTIL_MENU_ITEM_SAVEBLOCK] = DebugAction_Util_CheckSaveBlock, + [DEBUG_UTIL_MENU_ITEM_ROM_SPACE] = DebugAction_Util_CheckROMSpace, + [DEBUG_UTIL_MENU_ITEM_WEATHER] = DebugAction_Util_Weather, + [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK] = DebugAction_Util_CheckWallClock, + [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK] = DebugAction_Util_SetWallClock, + [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS] = DebugAction_Util_WatchCredits, + [DEBUG_UTIL_MENU_ITEM_PLAYER_NAME] = DebugAction_Util_Player_Name, + [DEBUG_UTIL_MENU_ITEM_PLAYER_GENDER] = DebugAction_Util_Player_Gender, + [DEBUG_UTIL_MENU_ITEM_PLAYER_ID] = DebugAction_Util_Player_Id, + [DEBUG_UTIL_MENU_ITEM_CLEAR_BOXES] = DebugAction_Util_Clear_Boxes, + [DEBUG_UTIL_MENU_ITEM_CHEAT] = DebugAction_Util_CheatStart, + [DEBUG_UTIL_MENU_ITEM_HATCH_AN_EGG] = DebugAction_Util_HatchAnEgg, + [DEBUG_UTIL_MENU_ITEM_EXPANSION_VER] = DebugAction_Util_ExpansionVersion, + [DEBUG_UTIL_MENU_ITEM_BERRY_FUNCTIONS] = DebugAction_Util_BerryFunctions, }; static void (*const sDebugMenu_Actions_Scripts[])(u8) = @@ -853,6 +890,14 @@ static void (*const sDebugMenu_Actions_Sound[])(u8) = [DEBUG_SOUND_MENU_ITEM_MUS] = DebugAction_Sound_MUS, }; +static void (*const sDebugMenu_Actions_BerryFunctions[])(u8) = +{ + [DEBUG_BERRY_FUNCTIONS_MENU_CLEAR_ALL] = DebugAction_BerryFunctions_ClearAll, + [DEBUG_BERRY_FUNCTIONS_MENU_READY] = DebugAction_BerryFunctions_Ready, + [DEBUG_BERRY_FUNCTIONS_MENU_PESTS] = DebugAction_BerryFunctions_Pests, + [DEBUG_BERRY_FUNCTIONS_MENU_WEEDS] = DebugAction_BerryFunctions_Weeds, +}; + // ******************************* // Windows static const struct WindowTemplate sDebugMenuWindowTemplateMain = @@ -982,6 +1027,12 @@ static const struct ListMenuTemplate sDebugMenu_ListTemplate_Sound = .totalItems = ARRAY_COUNT(sDebugMenu_Items_Sound), }; +static const struct ListMenuTemplate sDebugMenu_ListTemplate_BerryFunctions = +{ + .items = sDebugMenu_Items_BerryFunctions, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .totalItems = ARRAY_COUNT(sDebugMenu_Items_BerryFunctions), +}; // ******************************* // Functions universal @@ -1614,6 +1665,25 @@ static void DebugTask_HandleMenuInput_Sound(u8 taskId) } } +static void DebugTask_HandleMenuInput_BerryFunctions(u8 taskId) +{ + void (*func)(u8); + u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuTaskId); + + if (JOY_NEW(A_BUTTON)) + { + PlaySE(SE_SELECT); + if ((func = sDebugMenu_Actions_BerryFunctions[input]) != NULL) + func(taskId); + } + else if (JOY_NEW(B_BUTTON)) + { + PlaySE(SE_SELECT); + Debug_DestroyMenu(taskId); + Debug_ReShowMainMenu(); + } +} + // ******************************* // Open sub-menus static void DebugAction_OpenUtilitiesMenu(u8 taskId) @@ -1635,7 +1705,6 @@ static void DebugAction_OpenFlagsVarsMenu(u8 taskId) Debug_ShowMenu(DebugTask_HandleMenuInput_FlagsVars, gMultiuseListMenuTemplate); } - static void DebugAction_OpenGiveMenu(u8 taskId) { Debug_DestroyMenu(taskId); @@ -1654,6 +1723,12 @@ static void DebugAction_OpenSoundMenu(u8 taskId) Debug_ShowMenu(DebugTask_HandleMenuInput_Sound, sDebugMenu_ListTemplate_Sound); } +static void DebugAction_Util_BerryFunctions(u8 taskId) +{ + Debug_DestroyMenu(taskId); + Debug_ShowMenu(DebugTask_HandleMenuInput_BerryFunctions, sDebugMenu_ListTemplate_BerryFunctions); +} + // ******************************* // Actions Utilities static void DebugAction_Util_HealParty(u8 taskId) @@ -4587,6 +4662,93 @@ SOUND_LIST_SE }; #undef X +// ******************************* +// Actions BerryFunctions + +static void DebugAction_BerryFunctions_ClearAll(u8 taskId) +{ + u8 i; + + for (i = 0; i < OBJECT_EVENTS_COUNT; i++) + { + if (gObjectEvents[i].movementType == MOVEMENT_TYPE_BERRY_TREE_GROWTH) + { + RemoveBerryTree(GetObjectEventBerryTreeId(i)); + SetBerryTreeJustPicked(gObjectEvents[i].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); + } + } + + ScriptContext_Enable(); + Debug_DestroyMenu_Full(taskId); +} + +static void DebugAction_BerryFunctions_Ready(u8 taskId) +{ + u8 i; + struct BerryTree *tree; + + for (i = 0; i < OBJECT_EVENTS_COUNT; i++) + { + if (gObjectEvents[i].movementType == MOVEMENT_TYPE_BERRY_TREE_GROWTH) + { + tree = &gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(i)]; + if (tree->stage != BERRY_STAGE_NO_BERRY) + { + tree->stage = BERRY_STAGE_FLOWERING; + BerryTreeGrow(tree); + } + } + } + + ScriptContext_Enable(); + Debug_DestroyMenu_Full(taskId); +} + +static void DebugAction_BerryFunctions_Pests(u8 taskId) +{ + u8 i; + + if (!OW_BERRY_PESTS) + { + Debug_DestroyMenu_Full_Script(taskId, Debug_BerryPestsDisabled); + return; + } + + for (i = 0; i < OBJECT_EVENTS_COUNT; i++) + { + if (gObjectEvents[i].movementType == MOVEMENT_TYPE_BERRY_TREE_GROWTH) + { + if (gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(i)].stage != BERRY_STAGE_PLANTED) + gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(i)].pests = TRUE; + } + } + + ScriptContext_Enable(); + Debug_DestroyMenu_Full(taskId); +} + +static void DebugAction_BerryFunctions_Weeds(u8 taskId) +{ + u8 i; + + if (!OW_BERRY_WEEDS) + { + Debug_DestroyMenu_Full_Script(taskId, Debug_BerryWeedsDisabled); + return; + } + + for (i = 0; i < OBJECT_EVENTS_COUNT; i++) + { + if (gObjectEvents[i].movementType == MOVEMENT_TYPE_BERRY_TREE_GROWTH) + { + gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(i)].weeds = TRUE; + } + } + + ScriptContext_Enable(); + Debug_DestroyMenu_Full(taskId); +} + // ******************************* // Actions Other