Fix up berry sparkle

This commit is contained in:
GriffinR 2021-01-26 05:16:01 -05:00
parent 9e59581220
commit 92bd6400b7
7 changed files with 120 additions and 90 deletions

View File

@ -1,6 +1,8 @@
#ifndef GUARD_BERRY_H
#define GUARD_BERRY_H
#include "constants/berry.h"
void ClearEnigmaBerries(void);
void SetEnigmaBerry(u8 *src);
bool32 IsEnigmaBerryValid(void);
@ -24,7 +26,7 @@ void ObjectEventInteractionPlantBerryTree(void);
void ObjectEventInteractionPickBerryTree(void);
void ObjectEventInteractionRemoveBerryTree(void);
bool8 PlayerHasBerries(void);
void ResetBerryTreeSparkleFlags(void);
void SetBerryTreesSeen(void);
extern const struct Berry gBerries[];

View File

@ -203,7 +203,7 @@ s16 GetFigure8XOffset(s16 idx);
s16 GetFigure8YOffset(s16 idx);
void CameraObjectReset2(void);
u8 GetObjectEventBerryTreeId(u8 objectEventId);
void sub_8092EF0(u8 mapId, u8 mapNumber, u8 mapGroup);
void SetBerryTreeJustPicked(u8 mapId, u8 mapNumber, u8 mapGroup);
bool8 IsBerryTreeSparkling(u8, u8, u8);
void MovementType_None(struct Sprite *);
@ -307,11 +307,11 @@ u8 MovementType_WanderLeftAndRight_Step6(struct ObjectEvent *, struct Sprite *);
u8 MovementType_FaceDirection_Step0(struct ObjectEvent *, struct Sprite *);
u8 MovementType_FaceDirection_Step1(struct ObjectEvent *, struct Sprite *);
u8 MovementType_FaceDirection_Step2(struct ObjectEvent *, struct Sprite *);
u8 MovementType_BerryTreeGrowth_Step0(struct ObjectEvent *, struct Sprite *);
u8 MovementType_BerryTreeGrowth_Step1(struct ObjectEvent *, struct Sprite *);
u8 MovementType_BerryTreeGrowth_Step2(struct ObjectEvent *, struct Sprite *);
u8 MovementType_BerryTreeGrowth_Step3(struct ObjectEvent *, struct Sprite *);
u8 MovementType_BerryTreeGrowth_Step4(struct ObjectEvent *, struct Sprite *);
u8 MovementType_BerryTreeGrowth_Normal(struct ObjectEvent *, struct Sprite *);
u8 MovementType_BerryTreeGrowth_Move(struct ObjectEvent *, struct Sprite *);
u8 MovementType_BerryTreeGrowth_SparkleStart(struct ObjectEvent *, struct Sprite *);
u8 MovementType_BerryTreeGrowth_Sparkle(struct ObjectEvent *, struct Sprite *);
u8 MovementType_BerryTreeGrowth_SparkleEnd(struct ObjectEvent *, struct Sprite *);
u8 MovementType_FaceDownAndUp_Step0(struct ObjectEvent *, struct Sprite *);
u8 MovementType_FaceDownAndUp_Step1(struct ObjectEvent *, struct Sprite *);
u8 MovementType_FaceDownAndUp_Step2(struct ObjectEvent *, struct Sprite *);

View File

@ -63,7 +63,7 @@ struct BerryTree
{
u8 berry;
u8 stage:7;
u8 growthSparkle:1;
u8 stopGrowth:1;
u16 minutesUntilNextStage;
u8 berryYield;
u8 regrowthCount:4;

View File

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

View File

@ -63,11 +63,11 @@ u8 (*const gMovementTypeFuncs_FaceDirection[])(struct ObjectEvent *, struct Spri
};
u8 (*const gMovementTypeFuncs_BerryTreeGrowth[])(struct ObjectEvent *, struct Sprite *) = {
MovementType_BerryTreeGrowth_Step0,
MovementType_BerryTreeGrowth_Step1,
MovementType_BerryTreeGrowth_Step2,
MovementType_BerryTreeGrowth_Step3,
MovementType_BerryTreeGrowth_Step4,
MovementType_BerryTreeGrowth_Normal,
MovementType_BerryTreeGrowth_Move,
MovementType_BerryTreeGrowth_SparkleStart,
MovementType_BerryTreeGrowth_Sparkle,
MovementType_BerryTreeGrowth_SparkleEnd,
};
u8 (*const gMovementTypeFuncs_FaceDownAndUp[])(struct ObjectEvent *, struct Sprite *) = {

View File

@ -1834,7 +1834,7 @@ void PlayerObjectTurn(struct PlayerAvatar *playerAvatar, u8 direction)
ObjectEventTurn(&gObjectEvents[playerAvatar->objectEventId], direction);
}
static void get_berry_tree_graphics(struct ObjectEvent *objectEvent, struct Sprite *sprite)
static void SetBerryTreeGraphics(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
u8 berryStage;
u8 berryId;
@ -1842,7 +1842,7 @@ static void get_berry_tree_graphics(struct ObjectEvent *objectEvent, struct Spri
objectEvent->invisible = TRUE;
sprite->invisible = TRUE;
berryStage = GetStageByBerryTreeId(objectEvent->trainerRange_berryTreeId);
if (berryStage != 0)
if (berryStage != BERRY_STAGE_NO_BERRY)
{
objectEvent->invisible = FALSE;
sprite->invisible = FALSE;
@ -2595,7 +2595,7 @@ bool8 MovementType_WanderAround_Step4(struct ObjectEvent *objectEvent, struct Sp
bool8 MovementType_WanderAround_Step5(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkNormalMovementAction(objectEvent->movementDirection));
objectEvent->singleMovementActive = 1;
objectEvent->singleMovementActive = TRUE;
sprite->data[1] = 6;
return TRUE;
}
@ -2604,7 +2604,7 @@ bool8 MovementType_WanderAround_Step6(struct ObjectEvent *objectEvent, struct Sp
{
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 1;
}
return FALSE;
@ -2880,7 +2880,7 @@ bool8 MovementType_LookAround_Step2(struct ObjectEvent *objectEvent, struct Spri
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
SetMovementDelay(sprite, gMovementDelaysMedium[Random() & 3]);
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 3;
}
return FALSE;
@ -2964,7 +2964,7 @@ bool8 MovementType_WanderUpAndDown_Step4(struct ObjectEvent *objectEvent, struct
bool8 MovementType_WanderUpAndDown_Step5(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkNormalMovementAction(objectEvent->movementDirection));
objectEvent->singleMovementActive = 1;
objectEvent->singleMovementActive = TRUE;
sprite->data[1] = 6;
return TRUE;
}
@ -2973,7 +2973,7 @@ bool8 MovementType_WanderUpAndDown_Step6(struct ObjectEvent *objectEvent, struct
{
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 1;
}
return FALSE;
@ -3033,7 +3033,7 @@ bool8 MovementType_WanderLeftAndRight_Step4(struct ObjectEvent *objectEvent, str
bool8 MovementType_WanderLeftAndRight_Step5(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkNormalMovementAction(objectEvent->movementDirection));
objectEvent->singleMovementActive = 1;
objectEvent->singleMovementActive = TRUE;
sprite->data[1] = 6;
return TRUE;
}
@ -3042,7 +3042,7 @@ bool8 MovementType_WanderLeftAndRight_Step6(struct ObjectEvent *objectEvent, str
{
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 1;
}
return FALSE;
@ -3070,39 +3070,58 @@ bool8 MovementType_FaceDirection_Step1(struct ObjectEvent *objectEvent, struct S
bool8 MovementType_FaceDirection_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
return FALSE;
}
static bool8 ObjectEventCB2_BerryTree(struct ObjectEvent *objectEvent, struct Sprite *sprite);
extern bool8 (*const gMovementTypeFuncs_BerryTreeGrowth[])(struct ObjectEvent *objectEvent, struct Sprite *sprite);
enum {
BERRYTREEFUNC_NORMAL,
BERRYTREEFUNC_MOVE,
BERRYTREEFUNC_SPARKLE_START,
BERRYTREEFUNC_SPARKLE,
BERRYTREEFUNC_SPARKLE_END,
};
#define sObjEventId data[0]
#define sFuncId data[1]
#define sTimer data[2]
#define sBerryTreeFlags data[7]
#define BERRY_FLAG_SET_GFX (1 << 0)
#define BERRY_FLAG_SPARKLING (1 << 1)
#define BERRY_FLAG_JUST_PICKED (1 << 2)
void MovementType_BerryTreeGrowth(struct Sprite *sprite)
{
struct ObjectEvent *objectEvent;
objectEvent = &gObjectEvents[sprite->data[0]];
if (!(sprite->data[7] & 1))
objectEvent = &gObjectEvents[sprite->sObjEventId];
if (!(sprite->sBerryTreeFlags & BERRY_FLAG_SET_GFX))
{
get_berry_tree_graphics(objectEvent, sprite);
sprite->data[7] |= 1;
SetBerryTreeGraphics(objectEvent, sprite);
sprite->sBerryTreeFlags |= BERRY_FLAG_SET_GFX;
}
UpdateObjectEventCurrentMovement(objectEvent, sprite, ObjectEventCB2_BerryTree);
}
static bool8 ObjectEventCB2_BerryTree(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
return gMovementTypeFuncs_BerryTreeGrowth[sprite->data[1]](objectEvent, sprite);
return gMovementTypeFuncs_BerryTreeGrowth[sprite->sFuncId](objectEvent, sprite);
}
bool8 MovementType_BerryTreeGrowth_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
// BERRYTREEFUNC_NORMAL
bool8 MovementType_BerryTreeGrowth_Normal(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
u8 berryStage;
ClearObjectEventMovement(objectEvent, sprite);
objectEvent->invisible = TRUE;
sprite->invisible = TRUE;
berryStage = GetStageByBerryTreeId(objectEvent->trainerRange_berryTreeId);
if (berryStage == 0)
if (berryStage == BERRY_STAGE_NO_BERRY)
{
if (!(sprite->data[7] & 4) && sprite->animNum == 4)
if (!(sprite->sBerryTreeFlags & BERRY_FLAG_JUST_PICKED) && sprite->animNum == BERRY_STAGE_FLOWERING)
{
gFieldEffectArguments[0] = objectEvent->currentCoords.x;
gFieldEffectArguments[1] = objectEvent->currentCoords.y;
@ -3115,34 +3134,36 @@ bool8 MovementType_BerryTreeGrowth_Step0(struct ObjectEvent *objectEvent, struct
}
objectEvent->invisible = FALSE;
sprite->invisible = FALSE;
berryStage --;
berryStage--;
if (sprite->animNum != berryStage)
{
sprite->data[1] = 2;
sprite->sFuncId = BERRYTREEFUNC_SPARKLE_START;
return TRUE;
}
get_berry_tree_graphics(objectEvent, sprite);
SetBerryTreeGraphics(objectEvent, sprite);
ObjectEventSetSingleMovement(objectEvent, sprite, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION);
sprite->data[1] = 1;
sprite->sFuncId = BERRYTREEFUNC_MOVE;
return TRUE;
}
bool8 MovementType_BerryTreeGrowth_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite)
// BERRYTREEFUNC_MOVE
bool8 MovementType_BerryTreeGrowth_Move(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
sprite->data[1] = 0;
sprite->sFuncId = BERRYTREEFUNC_NORMAL;
return TRUE;
}
return FALSE;
}
bool8 MovementType_BerryTreeGrowth_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite)
// BERRYTREEFUNC_SPARKLE_START
bool8 MovementType_BerryTreeGrowth_SparkleStart(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
objectEvent->singleMovementActive = 1;
sprite->data[1] = 3;
sprite->data[2] = 0;
sprite->data[7] |= 2;
objectEvent->singleMovementActive = TRUE;
sprite->sFuncId = BERRYTREEFUNC_SPARKLE;
sprite->sTimer = 0;
sprite->sBerryTreeFlags |= BERRY_FLAG_SPARKLING;
gFieldEffectArguments[0] = objectEvent->currentCoords.x;
gFieldEffectArguments[1] = objectEvent->currentCoords.y;
gFieldEffectArguments[2] = sprite->subpriority - 1;
@ -3151,30 +3172,32 @@ bool8 MovementType_BerryTreeGrowth_Step2(struct ObjectEvent *objectEvent, struct
return TRUE;
}
bool8 MovementType_BerryTreeGrowth_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite)
// BERRYTREEFUNC_SPARKLE
bool8 MovementType_BerryTreeGrowth_Sparkle(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
sprite->data[2]++;
objectEvent->invisible = (sprite->data[2] & 0x02) >> 1;
sprite->sTimer++;
objectEvent->invisible = (sprite->sTimer & 2) >> 1;
sprite->animPaused = TRUE;
if (sprite->data[2] > 64)
if (sprite->sTimer > 64)
{
get_berry_tree_graphics(objectEvent, sprite);
sprite->data[1] = 4;
sprite->data[2] = 0;
SetBerryTreeGraphics(objectEvent, sprite);
sprite->sFuncId = BERRYTREEFUNC_SPARKLE_END;
sprite->sTimer = 0;
return TRUE;
}
return FALSE;
}
bool8 MovementType_BerryTreeGrowth_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite)
// BERRYTREEFUNC_SPARKLE_END
bool8 MovementType_BerryTreeGrowth_SparkleEnd(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
sprite->data[2]++;
objectEvent->invisible = (sprite->data[2] & 0x02) >> 1;
sprite->sTimer++;
objectEvent->invisible = (sprite->sTimer & 2) >> 1;
sprite->animPaused = TRUE;
if (sprite->data[2] > 64)
if (sprite->sTimer > 64)
{
sprite->data[1] = 0;
sprite->data[7] &= ~0x0002;
sprite->sFuncId = BERRYTREEFUNC_NORMAL;
sprite->sBerryTreeFlags &= ~BERRY_FLAG_SPARKLING;
return TRUE;
}
return FALSE;
@ -3201,7 +3224,7 @@ bool8 MovementType_FaceDownAndUp_Step2(struct ObjectEvent *objectEvent, struct S
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
SetMovementDelay(sprite, gMovementDelaysMedium[Random() & 3]);
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 3;
}
return FALSE;
@ -3253,7 +3276,7 @@ bool8 MovementType_FaceLeftAndRight_Step2(struct ObjectEvent *objectEvent, struc
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
SetMovementDelay(sprite, gMovementDelaysMedium[Random() & 3]);
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 3;
}
return FALSE;
@ -3305,7 +3328,7 @@ bool8 MovementType_FaceUpAndLeft_Step2(struct ObjectEvent *objectEvent, struct S
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]);
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 3;
}
return FALSE;
@ -3357,7 +3380,7 @@ bool8 MovementType_FaceUpAndRight_Step2(struct ObjectEvent *objectEvent, struct
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]);
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 3;
}
return FALSE;
@ -3409,7 +3432,7 @@ bool8 MovementType_FaceDownAndLeft_Step2(struct ObjectEvent *objectEvent, struct
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]);
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 3;
}
return FALSE;
@ -3461,7 +3484,7 @@ bool8 MovementType_FaceDownAndRight_Step2(struct ObjectEvent *objectEvent, struc
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]);
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 3;
}
return FALSE;
@ -3513,7 +3536,7 @@ bool8 MovementType_FaceDownUpAndLeft_Step2(struct ObjectEvent *objectEvent, stru
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]);
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 3;
}
return FALSE;
@ -3565,7 +3588,7 @@ bool8 MovementType_FaceDownUpAndRight_Step2(struct ObjectEvent *objectEvent, str
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]);
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 3;
}
return FALSE;
@ -3617,7 +3640,7 @@ bool8 MovementType_FaceUpLeftAndRight_Step2(struct ObjectEvent *objectEvent, str
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]);
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 3;
}
return FALSE;
@ -3669,7 +3692,7 @@ bool8 MovementType_FaceDownLeftAndRight_Step2(struct ObjectEvent *objectEvent, s
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]);
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 3;
}
return FALSE;
@ -3835,7 +3858,7 @@ bool8 MovementType_WalkBackAndForth_Step2(struct ObjectEvent *objectEvent, struc
movementActionId = GetWalkInPlaceNormalMovementAction(objectEvent->facingDirection);
ObjectEventSetSingleMovement(objectEvent, sprite, movementActionId);
objectEvent->singleMovementActive = 1;
objectEvent->singleMovementActive = TRUE;
sprite->data[1] = 3;
return TRUE;
}
@ -3844,7 +3867,7 @@ bool8 MovementType_WalkBackAndForth_Step3(struct ObjectEvent *objectEvent, struc
{
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 1;
}
return FALSE;
@ -3880,7 +3903,7 @@ bool8 MoveNextDirectionInSequence(struct ObjectEvent *objectEvent, struct Sprite
movementActionId = GetWalkInPlaceNormalMovementAction(objectEvent->facingDirection);
ObjectEventSetSingleMovement(objectEvent, sprite, movementActionId);
objectEvent->singleMovementActive = 1;
objectEvent->singleMovementActive = TRUE;
sprite->data[1] = 2;
return TRUE;
}
@ -3889,7 +3912,7 @@ bool8 MovementType_WalkSequence_Step2(struct ObjectEvent *objectEvent, struct Sp
{
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 1;
}
return FALSE;
@ -4233,7 +4256,7 @@ bool8 MovementType_CopyPlayer_Step2(struct ObjectEvent *objectEvent, struct Spri
{
if (ObjectEventExecSingleMovementAction(objectEvent, sprite))
{
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
sprite->data[1] = 1;
}
return FALSE;
@ -4247,7 +4270,7 @@ bool8 CopyablePlayerMovement_None(struct ObjectEvent *objectEvent, struct Sprite
bool8 CopyablePlayerMovement_FaceDirection(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8))
{
ObjectEventSetSingleMovement(objectEvent, sprite, GetFaceDirectionMovementAction(state_to_direction(gInitialMovementTypeFacingDirections[objectEvent->movementType], objectEvent->directionSequenceIndex, playerDirection)));
objectEvent->singleMovementActive = 1;
objectEvent->singleMovementActive = TRUE;
sprite->data[1] = 2;
return TRUE;
}
@ -4268,7 +4291,7 @@ bool8 CopyablePlayerMovement_GoSpeed0(struct ObjectEvent *objectEvent, struct Sp
direction = state_to_direction(gInitialMovementTypeFacingDirections[objectEvent->movementType], objectEvent->directionSequenceIndex, direction);
ObjectEventMoveDestCoords(objectEvent, direction, &x, &y);
ObjectEventSetSingleMovement(objectEvent, sprite, GetFaceDirectionMovementAction(direction));
objectEvent->singleMovementActive = 1;
objectEvent->singleMovementActive = TRUE;
sprite->data[1] = 2;
return TRUE;
}
@ -4283,7 +4306,7 @@ bool8 CopyablePlayerMovement_GoSpeed0(struct ObjectEvent *objectEvent, struct Sp
{
ObjectEventSetSingleMovement(objectEvent, sprite, GetFaceDirectionMovementAction(direction));
}
objectEvent->singleMovementActive = 1;
objectEvent->singleMovementActive = TRUE;
sprite->data[1] = 2;
return TRUE;
}
@ -4538,13 +4561,13 @@ bool8 MovementType_Invisible_Step1(struct ObjectEvent *objectEvent, struct Sprit
bool8 MovementType_Invisible_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
return FALSE;
}
static void ClearObjectEventMovement(struct ObjectEvent *objectEvent, struct Sprite *sprite)
{
objectEvent->singleMovementActive = 0;
objectEvent->singleMovementActive = FALSE;
objectEvent->heldMovementActive = FALSE;
objectEvent->heldMovementFinished = FALSE;
objectEvent->movementActionId = 0xFF;
@ -4824,7 +4847,7 @@ bool8 IsBerryTreeSparkling(u8 localId, u8 mapNum, u8 mapGroup)
u8 objectEventId;
if (!TryGetObjectEventIdByLocalIdAndMap(localId, mapNum, mapGroup, &objectEventId)
&& gSprites[gObjectEvents[objectEventId].spriteId].data[7] & 2)
&& gSprites[gObjectEvents[objectEventId].spriteId].sBerryTreeFlags & BERRY_FLAG_SPARKLING)
{
return TRUE;
}
@ -4832,13 +4855,13 @@ bool8 IsBerryTreeSparkling(u8 localId, u8 mapNum, u8 mapGroup)
return FALSE;
}
void sub_8092EF0(u8 localId, u8 mapNum, u8 mapGroup)
void SetBerryTreeJustPicked(u8 localId, u8 mapNum, u8 mapGroup)
{
u8 objectEventId;
if (!TryGetObjectEventIdByLocalIdAndMap(localId, mapNum, mapGroup, &objectEventId))
{
gSprites[gObjectEvents[objectEventId].spriteId].data[7] |= 0x04;
gSprites[gObjectEvents[objectEventId].spriteId].sBerryTreeFlags |= BERRY_FLAG_JUST_PICKED;
}
}

View File

@ -417,7 +417,7 @@ void CameraUpdate(void)
CameraMove(deltaX, deltaY);
UpdateObjectEventsForCameraUpdate(deltaX, deltaY);
RotatingGatePuzzleCameraUpdate(deltaX, deltaY);
ResetBerryTreeSparkleFlags();
SetBerryTreesSeen();
AddCameraTileOffset(&sFieldCameraOffset, deltaX * 2, deltaY * 2);
RedrawMapSlicesForCameraUpdate(&sFieldCameraOffset, deltaX * 2, deltaY * 2);
}