Adds OW_BERRY_IMMORTAL (#5187)

* Added OW_BERRY_IMMORTAL
Added cases for OW_BERRY_IMMORTAL

* removed one preproc

* removed other preproc

* Fixed identation

* Set config to FALSE

* Update include/config/overworld.h per https://github.com/rh-hideout/pokeemerald-expansion/pull/5187#discussion_r1720747388

Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>

* Reordered condition per https://github.com/rh-hideout/pokeemerald-expansion/pull/5187\#discussion_r1720747652

* Update include/config/overworld.h

---------

Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
This commit is contained in:
psf 2024-08-20 04:23:33 -07:00 committed by GitHub
parent 8ca234de7e
commit af12697845
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -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 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))

View File

@ -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 && (!OW_BERRY_IMMORTAL || tree->stage != BERRY_STAGE_BERRIES))
{
if (minutes >= GetStageDurationByBerryType(tree->berry) * 71)
if ((!OW_BERRY_IMMORTAL) && (minutes >= GetStageDurationByBerryType(tree->berry) * 71))
{
*tree = gBlankBerryTree;
}