diff options
author | Marcus Huderle <huderlem@gmail.com> | 2017-10-23 17:39:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-23 17:39:15 -0700 |
commit | fe8629615bb6e847ab632797ff1291c02e70a35c (patch) | |
tree | 20b7bbb74a99a7b96d0f33d3ef79641bffd21374 /include | |
parent | 7529e63a5aafad47543b1651474ec6b143cb958a (diff) | |
parent | c5241d9e80582b746d050ac4424393ccc1636d4b (diff) |
Merge pull request #449 from ProjectRevoTPP/clean_berry
document berry.c.
Diffstat (limited to 'include')
-rw-r--r-- | include/berry.h | 29 | ||||
-rw-r--r-- | include/field_control_avatar.h | 2 | ||||
-rw-r--r-- | include/field_map_obj.h | 2 | ||||
-rw-r--r-- | include/global.berry.h | 71 |
4 files changed, 55 insertions, 49 deletions
diff --git a/include/berry.h b/include/berry.h index f0acbe0ad..a7ac5ba94 100644 --- a/include/berry.h +++ b/include/berry.h @@ -11,38 +11,39 @@ enum BERRY_FIRMNESS_SUPER_HARD, }; -void ClearEnigmaBerries(void); +// berry stages +enum +{ + BERRY_STAGE_NO_BERRY, // there is no tree planted and the soil is completely flat. + BERRY_STAGE_PLANTED, + BERRY_STAGE_SPROUTED, + BERRY_STAGE_TALLER, + BERRY_STAGE_FLOWERING, + BERRY_STAGE_BERRIES, + BERRY_STAGE_SPARKLING = 0xFF, +}; + void SetEnigmaBerry(u8 *src); -u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry); bool32 IsEnigmaBerryValid(void); const struct Berry *GetBerryInfo(u8 berry); -struct BerryTree *GetBerryTreeInfo(u8 id); bool32 FieldObjectInteractionWaterBerryTree(void); -bool8 IsPlayerFacingPlantedBerryTree(void); +bool8 IsPlayerFacingUnplantedSoil(void); bool8 TryToWaterBerryTree(void); void ClearBerryTrees(void); -bool32 BerryTreeGrow(struct BerryTree *tree); void BerryTreeTimeUpdate(s32 minutes); void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 sparkle); void RemoveBerryTree(u8 id); u8 GetBerryTypeByBerryTreeId(u8 id); u8 GetStageByBerryTreeId(u8); u8 ItemIdToBerryType(u16 item); -u16 BerryTypeToItemId(u16 berry); void GetBerryNameByBerryType(u8 berry, u8 *string); void ResetBerryTreeSparkleFlag(u8 id); -u8 BerryTreeGetNumStagesWatered(struct BerryTree *tree); -u8 GetNumStagesWateredByBerryTreeId(u8 id); -u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water); -u8 CalcBerryYield(struct BerryTree *tree); -u8 GetBerryCountByBerryTreeId(u8 id); -u16 GetStageDurationByBerryType(u8); void FieldObjectInteractionGetBerryTreeData(void); -void sub_80B4EE4(void); +void Berry_FadeAndGoToBerryBagMenu(void); void FieldObjectInteractionPlantBerryTree(void); void FieldObjectInteractionPickBerryTree(void); void FieldObjectInteractionRemoveBerryTree(void); -u8 PlayerHasBerries(void); +bool8 PlayerHasBerries(void); void ResetBerryTreeSparkleFlags(void); #endif // GUARD_BERRY_H diff --git a/include/field_control_avatar.h b/include/field_control_avatar.h index a85e02132..2d5693e40 100644 --- a/include/field_control_avatar.h +++ b/include/field_control_avatar.h @@ -30,7 +30,7 @@ u8 *sub_80682A8(struct MapPosition *, u8, u8); void overworld_poison_timer_set(void); void prev_quest_postbuffer_cursor_backup_reset(void); u8 *sub_8068E24(struct MapPosition *); -u8 *GetFieldObjectScriptPointerForComparison(); +u8 *GetFieldObjectScriptPointerPlayerFacing(void); bool8 mapheader_trigger_activate_at__run_now(struct MapPosition *); bool8 sub_8068870(u16 a); bool8 sub_8068894(void); diff --git a/include/field_map_obj.h b/include/field_map_obj.h index 641a28ed3..19482e71f 100644 --- a/include/field_map_obj.h +++ b/include/field_map_obj.h @@ -381,7 +381,7 @@ void npc_set_running_behaviour_etc(struct MapObject *, u8); u8 npc_running_behaviour_by_direction(u8); u8 npc_block_way(struct MapObject *, s16, s16, u32); u8 sub_8060024(struct MapObject *, s16, s16, u8); -u8 sub_8060234(u8, u8, u8); +bool8 IsBerryTreeSparkling(u8, u8, u8); void sub_8060288(u8, u8, u8); void sub_8060388(s16, s16, s16 *, s16 *); void sub_80603CC(s16 x, s16 y, s16 *pInt, s16 *pInt1); diff --git a/include/global.berry.h b/include/global.berry.h index 096d8b1d8..21a0dd500 100644 --- a/include/global.berry.h +++ b/include/global.berry.h @@ -3,33 +3,33 @@ struct Berry { - /*0x00*/const u8 name[7]; - /*0x07*/u8 firmness; - /*0x08*/u16 size; - /*0x0A*/u8 maxYield; - /*0x0B*/u8 minYield; - /*0x0C*/const u8 *description1; - /*0x10*/const u8 *description2; - /*0x14*/u8 stageDuration; - /*0x15*/u8 spicy; - /*0x16*/u8 dry; - /*0x17*/u8 sweet; - /*0x18*/u8 bitter; - /*0x19*/u8 sour; - /*0x1A*/u8 smoothness; + /*0x00*/ const u8 name[7]; + /*0x07*/ u8 firmness; + /*0x08*/ u16 size; + /*0x0A*/ u8 maxYield; + /*0x0B*/ u8 minYield; + /*0x0C*/ const u8 *description1; + /*0x10*/ const u8 *description2; + /*0x14*/ u8 stageDuration; + /*0x15*/ u8 spicy; + /*0x16*/ u8 dry; + /*0x17*/ u8 sweet; + /*0x18*/ u8 bitter; + /*0x19*/ u8 sour; + /*0x1A*/ u8 smoothness; }; struct EnigmaBerry { - /*0x000*/struct Berry berry; - /*0x01B*/u8 pic[(6 * 6) * TILE_SIZE_4BPP]; - /*0x49C*/u16 palette[16]; - /*0x4BC*/u8 description1[45]; - /*0x4E9*/u8 description2[45]; - /*0x516*/u8 itemEffect[18]; - /*0x528*/u8 holdEffect; - /*0x529*/u8 holdEffectParam; - /*0x52C*/u32 checksum; + /*0x000*/ struct Berry berry; + /*0x01B*/ u8 pic[(6 * 6) * TILE_SIZE_4BPP]; + /*0x49C*/ u16 palette[16]; + /*0x4BC*/ u8 description1[45]; + /*0x4E9*/ u8 description2[45]; + /*0x516*/ u8 itemEffect[18]; + /*0x528*/ u8 holdEffect; + /*0x529*/ u8 holdEffectParam; + /*0x52C*/ u32 checksum; }; struct BattleEnigmaBerry @@ -42,16 +42,21 @@ struct BattleEnigmaBerry struct BerryTree { - u8 berry; - u8 stage:7; - u8 growthSparkle:1; - u16 minutesUntilNextStage; - u8 berryYield; - u8 regrowthCount:4; - u8 watered1:1; - u8 watered2:1; - u8 watered3:1; - u8 watered4:1; + /*0x00*/ u8 berry; + /*0x01*/ u8 stage:7; + /* + A berry sparkle is a state that a berry tree + can be in after growing within the player's + viewport. + */ + /*0x01*/ bool8 growthSparkle:1; + /*0x02*/ u16 minutesUntilNextStage; + /*0x04*/ u8 berryYield; + /*0x05*/ u8 regrowthCount:4; + /*0x05*/ u8 watered1:1; + /*0x05*/ u8 watered2:1; + /*0x05*/ u8 watered3:1; + /*0x05*/ u8 watered4:1; }; #endif // GUARD_GLOBAL_BERRY_H |