Fix up berry sparkle
This commit is contained in:
+16
-11
@@ -1046,8 +1046,9 @@ void ClearBerryTrees(void)
|
||||
|
||||
static bool32 BerryTreeGrow(struct BerryTree *tree)
|
||||
{
|
||||
if (tree->growthSparkle)
|
||||
if (tree->stopGrowth)
|
||||
return FALSE;
|
||||
|
||||
switch (tree->stage)
|
||||
{
|
||||
case BERRY_STAGE_NO_BERRY:
|
||||
@@ -1082,7 +1083,7 @@ void BerryTreeTimeUpdate(s32 minutes)
|
||||
{
|
||||
tree = &gSaveBlock1Ptr->berryTrees[i];
|
||||
|
||||
if (tree->berry && tree->stage && !tree->growthSparkle)
|
||||
if (tree->berry && tree->stage && !tree->stopGrowth)
|
||||
{
|
||||
if (minutes >= GetStageDurationByBerryType(tree->berry) * 71)
|
||||
{
|
||||
@@ -1111,7 +1112,7 @@ void BerryTreeTimeUpdate(s32 minutes)
|
||||
}
|
||||
}
|
||||
|
||||
void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 sparkle)
|
||||
void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 allowGrowth)
|
||||
{
|
||||
struct BerryTree *tree = GetBerryTreeInfo(id);
|
||||
|
||||
@@ -1125,8 +1126,10 @@ void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 sparkle)
|
||||
tree->minutesUntilNextStage *= 4;
|
||||
}
|
||||
|
||||
if (!sparkle)
|
||||
tree->growthSparkle = TRUE;
|
||||
// Stop growth, to keep tree at this stage until the player has seen it
|
||||
// allowGrowth is always true for berry trees the player has planted
|
||||
if (!allowGrowth)
|
||||
tree->stopGrowth = TRUE;
|
||||
}
|
||||
|
||||
void RemoveBerryTree(u8 id)
|
||||
@@ -1175,9 +1178,9 @@ void GetBerryCountStringByBerryType(u8 berry, u8* dest, u32 berryCount)
|
||||
GetBerryCountString(dest, GetBerryInfo(berry)->name, berryCount);
|
||||
}
|
||||
|
||||
void ResetBerryTreeSparkleFlag(u8 id)
|
||||
void AllowBerryTreeGrowth(u8 id)
|
||||
{
|
||||
GetBerryTreeInfo(id)->growthSparkle = FALSE;
|
||||
GetBerryTreeInfo(id)->stopGrowth = FALSE;
|
||||
}
|
||||
|
||||
static u8 BerryTreeGetNumStagesWatered(struct BerryTree *tree)
|
||||
@@ -1262,7 +1265,7 @@ void ObjectEventInteractionGetBerryTreeData(void)
|
||||
|
||||
id = GetObjectEventBerryTreeId(gSelectedObjectEvent);
|
||||
berry = GetBerryTypeByBerryTreeId(id);
|
||||
ResetBerryTreeSparkleFlag(id);
|
||||
AllowBerryTreeGrowth(id);
|
||||
localId = gSpecialVar_LastTalked;
|
||||
num = gSaveBlock1Ptr->location.mapNum;
|
||||
group = gSaveBlock1Ptr->location.mapGroup;
|
||||
@@ -1313,7 +1316,7 @@ void ObjectEventInteractionPickBerryTree(void)
|
||||
void ObjectEventInteractionRemoveBerryTree(void)
|
||||
{
|
||||
RemoveBerryTree(GetObjectEventBerryTreeId(gSelectedObjectEvent));
|
||||
sub_8092EF0(gSpecialVar_LastTalked, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
|
||||
SetBerryTreeJustPicked(gSpecialVar_LastTalked, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
|
||||
}
|
||||
|
||||
bool8 PlayerHasBerries(void)
|
||||
@@ -1321,7 +1324,9 @@ bool8 PlayerHasBerries(void)
|
||||
return IsBagPocketNonEmpty(POCKET_BERRIES);
|
||||
}
|
||||
|
||||
void ResetBerryTreeSparkleFlags(void)
|
||||
// Berry tree growth is frozen at their initial stage (usually, fully grown) until the player has seen the tree
|
||||
// For all berry trees on screen, allow normal growth
|
||||
void SetBerryTreesSeen(void)
|
||||
{
|
||||
s16 cam_left;
|
||||
s16 cam_top;
|
||||
@@ -1343,7 +1348,7 @@ void ResetBerryTreeSparkleFlags(void)
|
||||
cam_left = gObjectEvents[i].currentCoords.x;
|
||||
cam_top = gObjectEvents[i].currentCoords.y;
|
||||
if (left <= cam_left && cam_left <= right && top <= cam_top && cam_top <= bottom)
|
||||
ResetBerryTreeSparkleFlag(gObjectEvents[i].trainerRange_berryTreeId);
|
||||
AllowBerryTreeGrowth(gObjectEvents[i].trainerRange_berryTreeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user