From b36b3c346c2f9d940edb2878c2951f54d864186c Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 15 Aug 2024 21:37:17 -0700 Subject: [PATCH 1/8] Added OW_BERRY_IMMORTAL Added cases for OW_BERRY_IMMORTAL --- include/config/overworld.h | 1 + src/berry.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/config/overworld.h b/include/config/overworld.h index b47cef5c5082..06768c45e96a 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -33,6 +33,7 @@ #define OW_BERRY_GROWTH_RATE GEN_3 // Presets for how long each Berry plant takes to grow. #define OW_BERRY_YIELD_RATE GEN_3 // Presets for how many Berries each plant can yield. #define OW_BERRY_DRAIN_RATE GEN_6_ORAS // If OW_BERRY_MOISTURE is enabled, this setting changes how fast the soil dries out. GEN_4 uses a Berry-dependent drain rate, GEN_6_XY dries out in 24 hours (4 hours with the relevant Mulch) and GEN_6_ORAS dries out in 4 hours. Other values are illegal. +#define OW_BERRY_IMMORTAL TRUE // If enabled, once a Berry tree has grown a berry, the tree will not disappear until picked by the player. // Overworld Pokémon #define OW_POKEMON_OBJECT_EVENTS TRUE // Adds Object Event fields for every species. Can be used for NPCs using the OBJ_EVENT_GFX_SPECIES macro (eg. OBJ_EVENT_GFX_SPECIES(BULBASAUR)) diff --git a/src/berry.c b/src/berry.c index 9f187bd1e239..2fd5c3364b6c 100644 --- a/src/berry.c +++ b/src/berry.c @@ -1817,6 +1817,8 @@ bool32 BerryTreeGrow(struct BerryTree *tree) tree->stage = BERRY_STAGE_BERRIES; break; case BERRY_STAGE_BERRIES: + if (OW_BERRY_IMMORTAL) + break; tree->watered = 0; tree->berryYield = 0; tree->stage = BERRY_STAGE_SPROUTED; @@ -1842,16 +1844,16 @@ static u16 GetMulchAffectedGrowthRate(u16 berryDuration, u8 mulch, u8 stage) void BerryTreeTimeUpdate(s32 minutes) { int i; - u8 drainVal; + u32 drainVal; struct BerryTree *tree; for (i = 0; i < BERRY_TREES_COUNT; i++) { tree = &gSaveBlock1Ptr->berryTrees[i]; - if (tree->berry && tree->stage && !tree->stopGrowth) + if (tree->berry && tree->stage && !tree->stopGrowth && (tree->stage != BERRY_STAGE_BERRIES && OW_BERRY_IMMORTAL)) { - if (minutes >= GetStageDurationByBerryType(tree->berry) * 71) + if ((minutes >= GetStageDurationByBerryType(tree->berry) * 71) && !OW_BERRY_IMMORTAL) { *tree = gBlankBerryTree; } From 7d29f25fad55da96db08fc8ccfea117aac4b9eb7 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 15 Aug 2024 22:21:13 -0700 Subject: [PATCH 2/8] removed one preproc --- src/berry.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/berry.c b/src/berry.c index 2fd5c3364b6c..938ba99a43ee 100644 --- a/src/berry.c +++ b/src/berry.c @@ -1851,13 +1851,15 @@ void BerryTreeTimeUpdate(s32 minutes) { tree = &gSaveBlock1Ptr->berryTrees[i]; - if (tree->berry && tree->stage && !tree->stopGrowth && (tree->stage != BERRY_STAGE_BERRIES && OW_BERRY_IMMORTAL)) + if (tree->berry && tree->stage && !tree->stopGrowth && (!OW_BERRY_IMMORTAL || tree->stage != BERRY_STAGE_BERRIES)) { - if ((minutes >= GetStageDurationByBerryType(tree->berry) * 71) && !OW_BERRY_IMMORTAL) +#if OW_BERRY_IMMORTAL == FALSE + if (minutes >= GetStageDurationByBerryType(tree->berry) * 71) { *tree = gBlankBerryTree; - } + } else +#endif { s32 time = minutes; From 44b8f9a5bb59b5c815ea2cc2559c14715370405c Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 15 Aug 2024 22:26:00 -0700 Subject: [PATCH 3/8] removed other preproc --- src/berry.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/berry.c b/src/berry.c index 938ba99a43ee..cc37d690919c 100644 --- a/src/berry.c +++ b/src/berry.c @@ -1853,13 +1853,11 @@ void BerryTreeTimeUpdate(s32 minutes) if (tree->berry && tree->stage && !tree->stopGrowth && (!OW_BERRY_IMMORTAL || tree->stage != BERRY_STAGE_BERRIES)) { -#if OW_BERRY_IMMORTAL == FALSE - if (minutes >= GetStageDurationByBerryType(tree->berry) * 71) + if ((minutes >= GetStageDurationByBerryType(tree->berry) * 71) && !OW_BERRY_IMMORTAL) { *tree = gBlankBerryTree; } else -#endif { s32 time = minutes; From 084cfb96db97d4371144e76b1bbd0698f65eb45d Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Fri, 16 Aug 2024 18:49:08 -0700 Subject: [PATCH 4/8] Fixed identation --- src/berry.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/berry.c b/src/berry.c index cc37d690919c..64a4e761adcc 100644 --- a/src/berry.c +++ b/src/berry.c @@ -1817,8 +1817,8 @@ bool32 BerryTreeGrow(struct BerryTree *tree) tree->stage = BERRY_STAGE_BERRIES; break; case BERRY_STAGE_BERRIES: - if (OW_BERRY_IMMORTAL) - break; + if (OW_BERRY_IMMORTAL) + break; tree->watered = 0; tree->berryYield = 0; tree->stage = BERRY_STAGE_SPROUTED; @@ -1856,7 +1856,7 @@ void BerryTreeTimeUpdate(s32 minutes) if ((minutes >= GetStageDurationByBerryType(tree->berry) * 71) && !OW_BERRY_IMMORTAL) { *tree = gBlankBerryTree; - } + } else { s32 time = minutes; From 5c12f0ebf973b27409aa2372812cc818ef455893 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Fri, 16 Aug 2024 19:43:24 -0700 Subject: [PATCH 5/8] Set config to FALSE --- include/config/overworld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/overworld.h b/include/config/overworld.h index 06768c45e96a..84586300bc58 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -33,7 +33,7 @@ #define OW_BERRY_GROWTH_RATE GEN_3 // Presets for how long each Berry plant takes to grow. #define OW_BERRY_YIELD_RATE GEN_3 // Presets for how many Berries each plant can yield. #define OW_BERRY_DRAIN_RATE GEN_6_ORAS // If OW_BERRY_MOISTURE is enabled, this setting changes how fast the soil dries out. GEN_4 uses a Berry-dependent drain rate, GEN_6_XY dries out in 24 hours (4 hours with the relevant Mulch) and GEN_6_ORAS dries out in 4 hours. Other values are illegal. -#define OW_BERRY_IMMORTAL TRUE // If enabled, once a Berry tree has grown a berry, the tree will not disappear until picked by the player. +#define OW_BERRY_IMMORTAL FALSE // If enabled, once a Berry tree has grown a berry, the tree will not disappear until picked by the player. // Overworld Pokémon #define OW_POKEMON_OBJECT_EVENTS TRUE // Adds Object Event fields for every species. Can be used for NPCs using the OBJ_EVENT_GFX_SPECIES macro (eg. OBJ_EVENT_GFX_SPECIES(BULBASAUR)) From b5de34b5247f06fe31ff61f2eebf8096a135230e Mon Sep 17 00:00:00 2001 From: psf <77138753+pkmnsnfrn@users.noreply.github.com> Date: Sat, 17 Aug 2024 07:40:25 -0700 Subject: [PATCH 6/8] Update include/config/overworld.h per https://github.com/rh-hideout/pokeemerald-expansion/pull/5187#discussion_r1720747388 Co-authored-by: Bassoonian --- include/config/overworld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/overworld.h b/include/config/overworld.h index 84586300bc58..16148f65163b 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -33,7 +33,7 @@ #define OW_BERRY_GROWTH_RATE GEN_3 // Presets for how long each Berry plant takes to grow. #define OW_BERRY_YIELD_RATE GEN_3 // Presets for how many Berries each plant can yield. #define OW_BERRY_DRAIN_RATE GEN_6_ORAS // If OW_BERRY_MOISTURE is enabled, this setting changes how fast the soil dries out. GEN_4 uses a Berry-dependent drain rate, GEN_6_XY dries out in 24 hours (4 hours with the relevant Mulch) and GEN_6_ORAS dries out in 4 hours. Other values are illegal. -#define OW_BERRY_IMMORTAL FALSE // If enabled, once a Berry tree has grown a berry, the tree will not disappear until picked by the player. +#define OW_BERRY_IMMORTAL FALSE // If enabled, once a Berry tree has grown a Berry, the tree will not disappear until picked by the player. // Overworld Pokémon #define OW_POKEMON_OBJECT_EVENTS TRUE // Adds Object Event fields for every species. Can be used for NPCs using the OBJ_EVENT_GFX_SPECIES macro (eg. OBJ_EVENT_GFX_SPECIES(BULBASAUR)) From 08173147c47658a390c91de65f931d46a9588b16 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Sat, 17 Aug 2024 07:48:17 -0700 Subject: [PATCH 7/8] Reordered condition per https://github.com/rh-hideout/pokeemerald-expansion/pull/5187\#discussion_r1720747652 --- src/berry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/berry.c b/src/berry.c index 64a4e761adcc..1a1c3b7f1f6b 100644 --- a/src/berry.c +++ b/src/berry.c @@ -1853,7 +1853,7 @@ void BerryTreeTimeUpdate(s32 minutes) if (tree->berry && tree->stage && !tree->stopGrowth && (!OW_BERRY_IMMORTAL || tree->stage != BERRY_STAGE_BERRIES)) { - if ((minutes >= GetStageDurationByBerryType(tree->berry) * 71) && !OW_BERRY_IMMORTAL) + if ((!OW_BERRY_IMMORTAL) && (minutes >= GetStageDurationByBerryType(tree->berry) * 71)) { *tree = gBlankBerryTree; } From d589332e4bc7e4c48349799d74ec47397c2d7902 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sat, 17 Aug 2024 18:20:31 +0200 Subject: [PATCH 8/8] Update include/config/overworld.h --- include/config/overworld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/overworld.h b/include/config/overworld.h index 16148f65163b..63479f18317c 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -33,7 +33,7 @@ #define OW_BERRY_GROWTH_RATE GEN_3 // Presets for how long each Berry plant takes to grow. #define OW_BERRY_YIELD_RATE GEN_3 // Presets for how many Berries each plant can yield. #define OW_BERRY_DRAIN_RATE GEN_6_ORAS // If OW_BERRY_MOISTURE is enabled, this setting changes how fast the soil dries out. GEN_4 uses a Berry-dependent drain rate, GEN_6_XY dries out in 24 hours (4 hours with the relevant Mulch) and GEN_6_ORAS dries out in 4 hours. Other values are illegal. -#define OW_BERRY_IMMORTAL FALSE // If enabled, once a Berry tree has grown a Berry, the tree will not disappear until picked by the player. +#define OW_BERRY_IMMORTAL FALSE // If enabled, once a Berry tree has grown a Berry, the tree will not disappear until picked by the player. // Overworld Pokémon #define OW_POKEMON_OBJECT_EVENTS TRUE // Adds Object Event fields for every species. Can be used for NPCs using the OBJ_EVENT_GFX_SPECIES macro (eg. OBJ_EVENT_GFX_SPECIES(BULBASAUR))