From 625b1b69493313224277dcfd957269cc9945eb84 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 12 Sep 2017 18:47:27 +0200 Subject: start berry porting --- src/berry.c | 835 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 835 insertions(+) create mode 100644 src/berry.c (limited to 'src') diff --git a/src/berry.c b/src/berry.c new file mode 100644 index 000000000..9065261f0 --- /dev/null +++ b/src/berry.c @@ -0,0 +1,835 @@ +#include "global.h" +#include "berry.h" + +#define BERRY_NAME_LENGTH 6 + +#define FIRST_BERRY ITEM_CHERI_BERRY +#define LAST_BERRY ITEM_ENIGMA_BERRY + +#ifdef ENGLISH +#define NAME_CHERI_BERRY _("CHERI") +#define NAME_CHESTO_BERRY _("CHESTO") +#define NAME_PECHA_BERRY _("PECHA") +#define NAME_RAWST_BERRY _("RAWST") +#define NAME_ASPEAR_BERRY _("ASPEAR") +#define NAME_LEPPA_BERRY _("LEPPA") +#define NAME_ORAN_BERRY _("ORAN") +#define NAME_PERSIM_BERRY _("PERSIM") +#define NAME_LUM_BERRY _("LUM") +#define NAME_SITRUS_BERRY _("SITRUS") +#define NAME_FIGY_BERRY _("FIGY") +#define NAME_WIKI_BERRY _("WIKI") +#define NAME_MAGO_BERRY _("MAGO") +#define NAME_AGUAV_BERRY _("AGUAV") +#define NAME_IAPAPA_BERRY _("IAPAPA") +#define NAME_RAZZ_BERRY _("RAZZ") +#define NAME_BLUK_BERRY _("BLUK") +#define NAME_NANAB_BERRY _("NANAB") +#define NAME_WEPEAR_BERRY _("WEPEAR") +#define NAME_PINAP_BERRY _("PINAP") +#define NAME_POMEG_BERRY _("POMEG") +#define NAME_KELPSY_BERRY _("KELPSY") +#define NAME_QUALOT_BERRY _("QUALOT") +#define NAME_HONDEW_BERRY _("HONDEW") +#define NAME_GREPA_BERRY _("GREPA") +#define NAME_TAMATO_BERRY _("TAMATO") +#define NAME_CORNN_BERRY _("CORNN") +#define NAME_MAGOST_BERRY _("MAGOST") +#define NAME_RABUTA_BERRY _("RABUTA") +#define NAME_NOMEL_BERRY _("NOMEL") +#define NAME_SPELON_BERRY _("SPELON") +#define NAME_PAMTRE_BERRY _("PAMTRE") +#define NAME_WATMEL_BERRY _("WATMEL") +#define NAME_DURIN_BERRY _("DURIN") +#define NAME_BELUE_BERRY _("BELUE") +#define NAME_LIECHI_BERRY _("LIECHI") +#define NAME_GANLON_BERRY _("GANLON") +#define NAME_SALAC_BERRY _("SALAC") +#define NAME_PETAYA_BERRY _("PETAYA") +#define NAME_APICOT_BERRY _("APICOT") +#define NAME_LANSAT_BERRY _("LANSAT") +#define NAME_STARF_BERRY _("STARF") +#define NAME_ENIGMA_BERRY _("ENIGMA") + +#endif // ENGLISH + +const u8 gBerryDescriptionPart1_Cheri[] = _("Blooms with delicate pretty flowers."); +const u8 gBerryDescriptionPart2_Cheri[] = _("The bright red BERRY is very spicy."); +const u8 gBerryDescriptionPart1_Chesto[] = _("The BERRY’s thick skin and fruit are"); +const u8 gBerryDescriptionPart2_Chesto[] = _("very tough. It is dry-tasting all over."); +const u8 gBerryDescriptionPart1_Pecha[] = _("Very sweet and delicious."); +const u8 gBerryDescriptionPart2_Pecha[] = _("Also very tender - handle with care."); +const u8 gBerryDescriptionPart1_Rawst[] = _("If the leaves grow long and curly,"); +const u8 gBerryDescriptionPart2_Rawst[] = _("the BERRY seems to grow very bitter."); +const u8 gBerryDescriptionPart1_Aspear[] = _("The hard BERRY is dense with a rich"); +const u8 gBerryDescriptionPart2_Aspear[] = _("juice. It is quite sour."); +const u8 gBerryDescriptionPart1_Leppa[] = _("Grows slower than CHERI and others."); +const u8 gBerryDescriptionPart2_Leppa[] = _("The smaller the BERRY, the tastier."); +const u8 gBerryDescriptionPart1_Oran[] = _("A peculiar BERRY with a mix of flavors."); +const u8 gBerryDescriptionPart2_Oran[] = _("BERRIES grow in half a day."); +const u8 gBerryDescriptionPart1_Persim[] = _("Loves sunlight. The BERRY’s color"); +const u8 gBerryDescriptionPart2_Persim[] = _("grows vivid when exposed to the sun."); +const u8 gBerryDescriptionPart1_Lum[] = _("Slow to grow. If raised with loving"); +const u8 gBerryDescriptionPart2_Lum[] = _("care, it may grow two BERRIES."); +const u8 gBerryDescriptionPart1_Sitrus[] = _("Closely related to ORAN. The large"); +const u8 gBerryDescriptionPart2_Sitrus[] = _("BERRY has a well-rounded flavor."); +const u8 gBerryDescriptionPart1_Figy[] = _("The BERRY, which looks chewed up,"); +const u8 gBerryDescriptionPart2_Figy[] = _("brims with spicy substances."); +const u8 gBerryDescriptionPart1_Wiki[] = _("The BERRY is said to have grown lumpy"); +const u8 gBerryDescriptionPart2_Wiki[] = _("to help POKéMON grip it."); +const u8 gBerryDescriptionPart1_Mago[] = _("The BERRY turns curvy as it grows."); +const u8 gBerryDescriptionPart2_Mago[] = _("The curvier, the sweeter and tastier."); +const u8 gBerryDescriptionPart1_Aguav[] = _("The flower is dainty. It is rare in its"); +const u8 gBerryDescriptionPart2_Aguav[] = _("ability to grow without light."); +const u8 gBerryDescriptionPart1_Iapapa[] = _("The BERRY is very big and sour."); +const u8 gBerryDescriptionPart2_Iapapa[] = _("It takes at least a day to grow."); +const u8 gBerryDescriptionPart1_Razz[] = _("The red BERRY tastes slightly spicy."); +const u8 gBerryDescriptionPart2_Razz[] = _("It grows quickly in just four hours."); +const u8 gBerryDescriptionPart1_Bluk[] = _("The BERRY is blue on the outside, but"); +const u8 gBerryDescriptionPart2_Bluk[] = _("it blackens the mouth when eaten."); +const u8 gBerryDescriptionPart1_Nanab[] = _("This BERRY was the seventh"); +const u8 gBerryDescriptionPart2_Nanab[] = _("discovered in the world. It is sweet."); +const u8 gBerryDescriptionPart1_Wepear[] = _("The flower is small and white. It has a"); +const u8 gBerryDescriptionPart2_Wepear[] = _("delicate balance of bitter and sour."); +const u8 gBerryDescriptionPart1_Pinap[] = _("Weak against wind and cold."); +const u8 gBerryDescriptionPart2_Pinap[] = _("The fruit is spicy and the skin, sour."); +const u8 gBerryDescriptionPart1_Pomeg[] = _("However much it is watered,"); +const u8 gBerryDescriptionPart2_Pomeg[] = _("it only grows up to six BERRIES."); +const u8 gBerryDescriptionPart1_Kelpsy[] = _("A rare variety shaped like a root."); +const u8 gBerryDescriptionPart2_Kelpsy[] = _("Grows a very large flower."); +const u8 gBerryDescriptionPart1_Qualot[] = _("Loves water. Grows strong even in"); +const u8 gBerryDescriptionPart2_Qualot[] = _("locations with constant rainfall."); +const u8 gBerryDescriptionPart1_Hondew[] = _("A BERRY that is very valuable and"); +const u8 gBerryDescriptionPart2_Hondew[] = _("rarely seen. It is very delicious."); +const u8 gBerryDescriptionPart1_Grepa[] = _("Despite its tenderness and round"); +const u8 gBerryDescriptionPart2_Grepa[] = _("shape, the BERRY is unimaginably sour."); +const u8 gBerryDescriptionPart1_Tamato[] = _("The BERRY is lip-bendingly spicy."); +const u8 gBerryDescriptionPart2_Tamato[] = _("It takes time to grow."); +const u8 gBerryDescriptionPart1_Cornn[] = _("A BERRY from an ancient era. May not"); +const u8 gBerryDescriptionPart2_Cornn[] = _("grow unless planted in quantity."); +const u8 gBerryDescriptionPart1_Magost[] = _("A BERRY that is widely said to have"); +const u8 gBerryDescriptionPart2_Magost[] = _("a finely balanced flavor."); +const u8 gBerryDescriptionPart1_Rabuta[] = _("A rare variety that is overgrown with"); +const u8 gBerryDescriptionPart2_Rabuta[] = _("hair. It is quite bitter."); +const u8 gBerryDescriptionPart1_Nomel[] = _("Quite sour. Just one bite makes it"); +const u8 gBerryDescriptionPart2_Nomel[] = _("impossible to taste for three days."); +const u8 gBerryDescriptionPart1_Spelon[] = _("The vividly red BERRY is very spicy."); +const u8 gBerryDescriptionPart2_Spelon[] = _("Its warts secrete a spicy substance."); +const u8 gBerryDescriptionPart1_Pamtre[] = _("Drifts on the sea from somewhere."); +const u8 gBerryDescriptionPart2_Pamtre[] = _("It is thought to grow elsewhere."); +const u8 gBerryDescriptionPart1_Watmel[] = _("A huge BERRY, with some over 20"); +const u8 gBerryDescriptionPart2_Watmel[] = _("inches discovered. Exceedingly sweet."); +const u8 gBerryDescriptionPart1_Durin[] = _("Bitter to even look at. It is so"); +const u8 gBerryDescriptionPart2_Durin[] = _("bitter, no one has ever eaten it as is."); +const u8 gBerryDescriptionPart1_Belue[] = _("It is glossy and looks delicious, but"); +const u8 gBerryDescriptionPart2_Belue[] = _("it is awfully sour. Takes time to grow."); +const u8 gBerryDescriptionPart1_Liechi[] = _("A mysterious BERRY. It is rumored to"); +const u8 gBerryDescriptionPart2_Liechi[] = _("contain the power of the sea."); +const u8 gBerryDescriptionPart1_Ganlon[] = _("A mysterious BERRY. It is rumored to"); +const u8 gBerryDescriptionPart2_Ganlon[] = _("contain the power of the land."); +const u8 gBerryDescriptionPart1_Salac[] = _("A mysterious BERRY. It is rumored to"); +const u8 gBerryDescriptionPart2_Salac[] = _("contain the power of the sky."); +const u8 gBerryDescriptionPart1_Petaya[] = _("A mysterious BERRY. It is rumored to"); +const u8 gBerryDescriptionPart2_Petaya[] = _("contain the power of all living things."); +const u8 gBerryDescriptionPart1_Apicot[] = _("A very mystifying BERRY. No telling"); +const u8 gBerryDescriptionPart2_Apicot[] = _("what may happen or how it can be used."); +const u8 gBerryDescriptionPart1_Lansat[] = _("Said to be a legendary BERRY."); +const u8 gBerryDescriptionPart2_Lansat[] = _("Holding it supposedly brings joy."); +const u8 gBerryDescriptionPart1_Starf[] = _("So strong, it was abandoned at the"); +const u8 gBerryDescriptionPart2_Starf[] = _("world’s edge. Considered a mirage."); +const u8 gBerryDescriptionPart1_Enigma[] = _("A completely enigmatic BERRY."); +const u8 gBerryDescriptionPart2_Enigma[] = _("Appears to have the power of stars."); + + +const struct Berry gBerries[] = +{ + { + .name = NAME_CHERI_BERRY, + .firmness = BERRY_FIRMNESS_SOFT, + .size = 20, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Cheri, + .description2 = gBerryDescriptionPart2_Cheri, + .stageDuration = 3, + .spicy = 10, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = NAME_CHESTO_BERRY, + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 80, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Chesto, + .description2 = gBerryDescriptionPart2_Chesto, + .stageDuration = 3, + .spicy = 0, + .dry = 10, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = NAME_PECHA_BERRY, + .firmness = BERRY_FIRMNESS_VERY_SOFT, + .size = 40, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Pecha, + .description2 = gBerryDescriptionPart2_Pecha, + .stageDuration = 3, + .spicy = 0, + .dry = 0, + .sweet = 10, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = NAME_RAWST_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 32, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Rawst, + .description2 = gBerryDescriptionPart2_Rawst, + .stageDuration = 3, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 10, + .sour = 0, + .smoothness = 25, + }, + { + .name = NAME_ASPEAR_BERRY, + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 50, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Aspear, + .description2 = gBerryDescriptionPart2_Aspear, + .stageDuration = 3, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 10, + .smoothness = 25, + }, + { + .name = NAME_LEPPA_BERRY, + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 28, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Leppa, + .description2 = gBerryDescriptionPart2_Leppa, + .stageDuration = 4, + .spicy = 10, + .dry = 0, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = NAME_ORAN_BERRY, + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 35, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Oran, + .description2 = gBerryDescriptionPart2_Oran, + .stageDuration = 3, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = NAME_PERSIM_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 47, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Persim, + .description2 = gBerryDescriptionPart2_Persim, + .stageDuration = 3, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = NAME_LUM_BERRY, + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 34, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Lum, + .description2 = gBerryDescriptionPart2_Lum, + .stageDuration = 12, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = NAME_SITRUS_BERRY, + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 95, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Sitrus, + .description2 = gBerryDescriptionPart2_Sitrus, + .stageDuration = 6, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = NAME_FIGY_BERRY, + .firmness = BERRY_FIRMNESS_SOFT, + .size = 100, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Figy, + .description2 = gBerryDescriptionPart2_Figy, + .stageDuration = 6, + .spicy = 10, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = NAME_WIKI_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 115, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Wiki, + .description2 = gBerryDescriptionPart2_Wiki, + .stageDuration = 6, + .spicy = 0, + .dry = 10, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = NAME_MAGO_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 126, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Mago, + .description2 = gBerryDescriptionPart2_Mago, + .stageDuration = 6, + .spicy = 0, + .dry = 0, + .sweet = 10, + .bitter = 0, + .sour = 0, + .smoothness = 25, + }, + { + .name = NAME_AGUAV_BERRY, + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 64, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Aguav, + .description2 = gBerryDescriptionPart2_Aguav, + .stageDuration = 6, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 10, + .sour = 0, + .smoothness = 25, + }, + { + .name = NAME_IAPAPA_BERRY, + .firmness = BERRY_FIRMNESS_SOFT, + .size = 223, + .maxYield = 3, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Iapapa, + .description2 = gBerryDescriptionPart2_Iapapa, + .stageDuration = 6, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 10, + .smoothness = 25, + }, + { + .name = NAME_RAZZ_BERRY, + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 120, + .maxYield = 6, + .minYield = 3, + .description1 = gBerryDescriptionPart1_Razz, + .description2 = gBerryDescriptionPart2_Razz, + .stageDuration = 1, + .spicy = 10, + .dry = 10, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 20, + }, + { + .name = NAME_BLUK_BERRY, + .firmness = BERRY_FIRMNESS_SOFT, + .size = 108, + .maxYield = 6, + .minYield = 3, + .description1 = gBerryDescriptionPart1_Bluk, + .description2 = gBerryDescriptionPart2_Bluk, + .stageDuration = 1, + .spicy = 0, + .dry = 10, + .sweet = 10, + .bitter = 0, + .sour = 0, + .smoothness = 20, + }, + { + .name = NAME_NANAB_BERRY, + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 77, + .maxYield = 6, + .minYield = 3, + .description1 = gBerryDescriptionPart1_Nanab, + .description2 = gBerryDescriptionPart2_Nanab, + .stageDuration = 1, + .spicy = 0, + .dry = 0, + .sweet = 10, + .bitter = 10, + .sour = 0, + .smoothness = 20, + }, + { + .name = NAME_WEPEAR_BERRY, + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 74, + .maxYield = 6, + .minYield = 3, + .description1 = gBerryDescriptionPart1_Wepear, + .description2 = gBerryDescriptionPart2_Wepear, + .stageDuration = 1, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = NAME_PINAP_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 80, + .maxYield = 6, + .minYield = 3, + .description1 = gBerryDescriptionPart1_Pinap, + .description2 = gBerryDescriptionPart2_Pinap, + .stageDuration = 1, + .spicy = 10, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 10, + .smoothness = 20, + }, + { + .name = NAME_POMEG_BERRY, + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 135, + .maxYield = 6, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Pomeg, + .description2 = gBerryDescriptionPart2_Pomeg, + .stageDuration = 3, + .spicy = 10, + .dry = 0, + .sweet = 10, + .bitter = 10, + .sour = 0, + .smoothness = 20, + }, + { + .name = NAME_KELPSY_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 150, + .maxYield = 6, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Kelpsy, + .description2 = gBerryDescriptionPart2_Kelpsy, + .stageDuration = 3, + .spicy = 0, + .dry = 10, + .sweet = 0, + .bitter = 10, + .sour = 10, + .smoothness = 20, + }, + { + .name = NAME_QUALOT_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 110, + .maxYield = 6, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Qualot, + .description2 = gBerryDescriptionPart2_Qualot, + .stageDuration = 3, + .spicy = 10, + .dry = 0, + .sweet = 10, + .bitter = 0, + .sour = 10, + .smoothness = 20, + }, + { + .name = NAME_HONDEW_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 162, + .maxYield = 6, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Hondew, + .description2 = gBerryDescriptionPart2_Hondew, + .stageDuration = 3, + .spicy = 10, + .dry = 10, + .sweet = 0, + .bitter = 10, + .sour = 0, + .smoothness = 20, + }, + { + .name = NAME_GREPA_BERRY, + .firmness = BERRY_FIRMNESS_SOFT, + .size = 149, + .maxYield = 6, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Grepa, + .description2 = gBerryDescriptionPart2_Grepa, + .stageDuration = 3, + .spicy = 0, + .dry = 10, + .sweet = 10, + .bitter = 0, + .sour = 10, + .smoothness = 20, + }, + { + .name = NAME_TAMATO_BERRY, + .firmness = BERRY_FIRMNESS_SOFT, + .size = 200, + .maxYield = 4, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Tamato, + .description2 = gBerryDescriptionPart2_Tamato, + .stageDuration = 6, + .spicy = 20, + .dry = 10, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 30, + }, + { + .name = NAME_CORNN_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 75, + .maxYield = 4, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Cornn, + .description2 = gBerryDescriptionPart2_Cornn, + .stageDuration = 6, + .spicy = 0, + .dry = 20, + .sweet = 10, + .bitter = 0, + .sour = 0, + .smoothness = 30, + }, + { + .name = NAME_MAGOST_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 140, + .maxYield = 4, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Magost, + .description2 = gBerryDescriptionPart2_Magost, + .stageDuration = 6, + .spicy = 0, + .dry = 0, + .sweet = 20, + .bitter = 10, + .sour = 0, + .smoothness = 30, + }, + { + .name = NAME_RABUTA_BERRY, + .firmness = BERRY_FIRMNESS_SOFT, + .size = 226, + .maxYield = 4, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Rabuta, + .description2 = gBerryDescriptionPart2_Rabuta, + .stageDuration = 6, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 20, + .sour = 10, + .smoothness = 30, + }, + { + .name = NAME_NOMEL_BERRY, + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 285, + .maxYield = 4, + .minYield = 2, + .description1 = gBerryDescriptionPart1_Nomel, + .description2 = gBerryDescriptionPart2_Nomel, + .stageDuration = 6, + .spicy = 10, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 20, + .smoothness = 30, + }, + { + .name = NAME_SPELON_BERRY, + .firmness = BERRY_FIRMNESS_SOFT, + .size = 133, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Spelon, + .description2 = gBerryDescriptionPart2_Spelon, + .stageDuration = 18, + .spicy = 40, + .dry = 10, + .sweet = 0, + .bitter = 0, + .sour = 0, + .smoothness = 70, + }, + { + .name = NAME_PAMTRE_BERRY, + .firmness = BERRY_FIRMNESS_VERY_SOFT, + .size = 244, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Pamtre, + .description2 = gBerryDescriptionPart2_Pamtre, + .stageDuration = 18, + .spicy = 0, + .dry = 40, + .sweet = 10, + .bitter = 0, + .sour = 0, + .smoothness = 70, + }, + { + .name = NAME_WATMEL_BERRY, + .firmness = BERRY_FIRMNESS_SOFT, + .size = 250, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Watmel, + .description2 = gBerryDescriptionPart2_Watmel, + .stageDuration = 18, + .spicy = 0, + .dry = 0, + .sweet = 40, + .bitter = 10, + .sour = 0, + .smoothness = 70, + }, + { + .name = NAME_DURIN_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 280, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Durin, + .description2 = gBerryDescriptionPart2_Durin, + .stageDuration = 18, + .spicy = 0, + .dry = 0, + .sweet = 0, + .bitter = 40, + .sour = 10, + .smoothness = 70, + }, + { + .name = NAME_BELUE_BERRY, + .firmness = BERRY_FIRMNESS_VERY_SOFT, + .size = 300, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Belue, + .description2 = gBerryDescriptionPart2_Belue, + .stageDuration = 18, + .spicy = 10, + .dry = 0, + .sweet = 0, + .bitter = 0, + .sour = 40, + .smoothness = 70, + }, + { + .name = NAME_LIECHI_BERRY, + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 111, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Liechi, + .description2 = gBerryDescriptionPart2_Liechi, + .stageDuration = 24, + .spicy = 40, + .dry = 0, + .sweet = 40, + .bitter = 0, + .sour = 10, + .smoothness = 80, + }, + { + .name = NAME_GANLON_BERRY, + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 33, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Ganlon, + .description2 = gBerryDescriptionPart2_Ganlon, + .stageDuration = 24, + .spicy = 0, + .dry = 40, + .sweet = 0, + .bitter = 40, + .sour = 0, + .smoothness = 80, + }, + { + .name = NAME_SALAC_BERRY, + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 95, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Salac, + .description2 = gBerryDescriptionPart2_Salac, + .stageDuration = 24, + .spicy = 0, + .dry = 0, + .sweet = 40, + .bitter = 0, + .sour = 40, + .smoothness = 80, + }, + { + .name = NAME_PETAYA_BERRY, + .firmness = BERRY_FIRMNESS_VERY_HARD, + .size = 237, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Petaya, + .description2 = gBerryDescriptionPart2_Petaya, + .stageDuration = 24, + .spicy = 40, + .dry = 0, + .sweet = 0, + .bitter = 40, + .sour = 0, + .smoothness = 80, + }, + { + .name = NAME_APICOT_BERRY, + .firmness = BERRY_FIRMNESS_HARD, + .size = 75, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Apicot, + .description2 = gBerryDescriptionPart2_Apicot, + .stageDuration = 24, + .spicy = 0, + .dry = 40, + .sweet = 0, + .bitter = 0, + .sour = 40, + .smoothness = 80, + }, + { + .name = NAME_LANSAT_BERRY, + .firmness = BERRY_FIRMNESS_SOFT, + .size = 97, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Lansat, + .description2 = gBerryDescriptionPart2_Lansat, + .stageDuration = 24, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 30, + }, + { + .name = NAME_STARF_BERRY, + .firmness = BERRY_FIRMNESS_SUPER_HARD, + .size = 153, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Starf, + .description2 = gBerryDescriptionPart2_Starf, + .stageDuration = 24, + .spicy = 10, + .dry = 10, + .sweet = 10, + .bitter = 10, + .sour = 10, + .smoothness = 30, + }, + { + .name = NAME_ENIGMA_BERRY, + .firmness = BERRY_FIRMNESS_UNKNOWN, + .size = 0, + .maxYield = 2, + .minYield = 1, + .description1 = gBerryDescriptionPart1_Enigma, + .description2 = gBerryDescriptionPart2_Enigma, + .stageDuration = 24, + .spicy = 40, + .dry = 40, + .sweet = 40, + .bitter = 40, + .sour = 40, + .smoothness = 40, + }, +}; + -- cgit v1.2.3 From 5f4c5e280cda788f2c575d860a6333fc6cbebebe Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 13 Sep 2017 11:16:26 +0200 Subject: berry.s decompiled --- src/berry.c | 765 ++++++++++++++++++++++++++++++++++++++++++++++-------------- src/item.c | 5 +- 2 files changed, 595 insertions(+), 175 deletions(-) (limited to 'src') diff --git a/src/berry.c b/src/berry.c index 9065261f0..ffd30d47f 100644 --- a/src/berry.c +++ b/src/berry.c @@ -1,5 +1,23 @@ #include "global.h" #include "berry.h" +#include "main.h" +#include "item.h" +#include "items.h" +#include "text.h" +#include "rng.h" +#include "event_data.h" +#include "fieldmap.h" + +extern u8 FieldObjectGetBerryTreeId(u8 mapObjectId); +extern void sub_8092EF0(u8 mapId, u8 mapNumber, u8 mapGroup); +extern void CB2_ChooseBerry(void); +extern const u8* GetFieldObjectScriptPointerForComparison(void); +extern bool8 sub_8092E9C(u8, u8, u8); + +extern u16 gScriptItemId; + +extern const u8 BerryTreeScript[]; +extern const struct BerryTree gBlankBerryTree; #define BERRY_NAME_LENGTH 6 @@ -53,93 +71,92 @@ #endif // ENGLISH -const u8 gBerryDescriptionPart1_Cheri[] = _("Blooms with delicate pretty flowers."); -const u8 gBerryDescriptionPart2_Cheri[] = _("The bright red BERRY is very spicy."); -const u8 gBerryDescriptionPart1_Chesto[] = _("The BERRY’s thick skin and fruit are"); -const u8 gBerryDescriptionPart2_Chesto[] = _("very tough. It is dry-tasting all over."); -const u8 gBerryDescriptionPart1_Pecha[] = _("Very sweet and delicious."); -const u8 gBerryDescriptionPart2_Pecha[] = _("Also very tender - handle with care."); -const u8 gBerryDescriptionPart1_Rawst[] = _("If the leaves grow long and curly,"); -const u8 gBerryDescriptionPart2_Rawst[] = _("the BERRY seems to grow very bitter."); -const u8 gBerryDescriptionPart1_Aspear[] = _("The hard BERRY is dense with a rich"); -const u8 gBerryDescriptionPart2_Aspear[] = _("juice. It is quite sour."); -const u8 gBerryDescriptionPart1_Leppa[] = _("Grows slower than CHERI and others."); -const u8 gBerryDescriptionPart2_Leppa[] = _("The smaller the BERRY, the tastier."); -const u8 gBerryDescriptionPart1_Oran[] = _("A peculiar BERRY with a mix of flavors."); -const u8 gBerryDescriptionPart2_Oran[] = _("BERRIES grow in half a day."); -const u8 gBerryDescriptionPart1_Persim[] = _("Loves sunlight. The BERRY’s color"); -const u8 gBerryDescriptionPart2_Persim[] = _("grows vivid when exposed to the sun."); -const u8 gBerryDescriptionPart1_Lum[] = _("Slow to grow. If raised with loving"); -const u8 gBerryDescriptionPart2_Lum[] = _("care, it may grow two BERRIES."); -const u8 gBerryDescriptionPart1_Sitrus[] = _("Closely related to ORAN. The large"); -const u8 gBerryDescriptionPart2_Sitrus[] = _("BERRY has a well-rounded flavor."); -const u8 gBerryDescriptionPart1_Figy[] = _("The BERRY, which looks chewed up,"); -const u8 gBerryDescriptionPart2_Figy[] = _("brims with spicy substances."); -const u8 gBerryDescriptionPart1_Wiki[] = _("The BERRY is said to have grown lumpy"); -const u8 gBerryDescriptionPart2_Wiki[] = _("to help POKéMON grip it."); -const u8 gBerryDescriptionPart1_Mago[] = _("The BERRY turns curvy as it grows."); -const u8 gBerryDescriptionPart2_Mago[] = _("The curvier, the sweeter and tastier."); -const u8 gBerryDescriptionPart1_Aguav[] = _("The flower is dainty. It is rare in its"); -const u8 gBerryDescriptionPart2_Aguav[] = _("ability to grow without light."); -const u8 gBerryDescriptionPart1_Iapapa[] = _("The BERRY is very big and sour."); -const u8 gBerryDescriptionPart2_Iapapa[] = _("It takes at least a day to grow."); -const u8 gBerryDescriptionPart1_Razz[] = _("The red BERRY tastes slightly spicy."); -const u8 gBerryDescriptionPart2_Razz[] = _("It grows quickly in just four hours."); -const u8 gBerryDescriptionPart1_Bluk[] = _("The BERRY is blue on the outside, but"); -const u8 gBerryDescriptionPart2_Bluk[] = _("it blackens the mouth when eaten."); -const u8 gBerryDescriptionPart1_Nanab[] = _("This BERRY was the seventh"); -const u8 gBerryDescriptionPart2_Nanab[] = _("discovered in the world. It is sweet."); -const u8 gBerryDescriptionPart1_Wepear[] = _("The flower is small and white. It has a"); -const u8 gBerryDescriptionPart2_Wepear[] = _("delicate balance of bitter and sour."); -const u8 gBerryDescriptionPart1_Pinap[] = _("Weak against wind and cold."); -const u8 gBerryDescriptionPart2_Pinap[] = _("The fruit is spicy and the skin, sour."); -const u8 gBerryDescriptionPart1_Pomeg[] = _("However much it is watered,"); -const u8 gBerryDescriptionPart2_Pomeg[] = _("it only grows up to six BERRIES."); -const u8 gBerryDescriptionPart1_Kelpsy[] = _("A rare variety shaped like a root."); -const u8 gBerryDescriptionPart2_Kelpsy[] = _("Grows a very large flower."); -const u8 gBerryDescriptionPart1_Qualot[] = _("Loves water. Grows strong even in"); -const u8 gBerryDescriptionPart2_Qualot[] = _("locations with constant rainfall."); -const u8 gBerryDescriptionPart1_Hondew[] = _("A BERRY that is very valuable and"); -const u8 gBerryDescriptionPart2_Hondew[] = _("rarely seen. It is very delicious."); -const u8 gBerryDescriptionPart1_Grepa[] = _("Despite its tenderness and round"); -const u8 gBerryDescriptionPart2_Grepa[] = _("shape, the BERRY is unimaginably sour."); -const u8 gBerryDescriptionPart1_Tamato[] = _("The BERRY is lip-bendingly spicy."); -const u8 gBerryDescriptionPart2_Tamato[] = _("It takes time to grow."); -const u8 gBerryDescriptionPart1_Cornn[] = _("A BERRY from an ancient era. May not"); -const u8 gBerryDescriptionPart2_Cornn[] = _("grow unless planted in quantity."); -const u8 gBerryDescriptionPart1_Magost[] = _("A BERRY that is widely said to have"); -const u8 gBerryDescriptionPart2_Magost[] = _("a finely balanced flavor."); -const u8 gBerryDescriptionPart1_Rabuta[] = _("A rare variety that is overgrown with"); -const u8 gBerryDescriptionPart2_Rabuta[] = _("hair. It is quite bitter."); -const u8 gBerryDescriptionPart1_Nomel[] = _("Quite sour. Just one bite makes it"); -const u8 gBerryDescriptionPart2_Nomel[] = _("impossible to taste for three days."); -const u8 gBerryDescriptionPart1_Spelon[] = _("The vividly red BERRY is very spicy."); -const u8 gBerryDescriptionPart2_Spelon[] = _("Its warts secrete a spicy substance."); -const u8 gBerryDescriptionPart1_Pamtre[] = _("Drifts on the sea from somewhere."); -const u8 gBerryDescriptionPart2_Pamtre[] = _("It is thought to grow elsewhere."); -const u8 gBerryDescriptionPart1_Watmel[] = _("A huge BERRY, with some over 20"); -const u8 gBerryDescriptionPart2_Watmel[] = _("inches discovered. Exceedingly sweet."); -const u8 gBerryDescriptionPart1_Durin[] = _("Bitter to even look at. It is so"); -const u8 gBerryDescriptionPart2_Durin[] = _("bitter, no one has ever eaten it as is."); -const u8 gBerryDescriptionPart1_Belue[] = _("It is glossy and looks delicious, but"); -const u8 gBerryDescriptionPart2_Belue[] = _("it is awfully sour. Takes time to grow."); -const u8 gBerryDescriptionPart1_Liechi[] = _("A mysterious BERRY. It is rumored to"); -const u8 gBerryDescriptionPart2_Liechi[] = _("contain the power of the sea."); -const u8 gBerryDescriptionPart1_Ganlon[] = _("A mysterious BERRY. It is rumored to"); -const u8 gBerryDescriptionPart2_Ganlon[] = _("contain the power of the land."); -const u8 gBerryDescriptionPart1_Salac[] = _("A mysterious BERRY. It is rumored to"); -const u8 gBerryDescriptionPart2_Salac[] = _("contain the power of the sky."); -const u8 gBerryDescriptionPart1_Petaya[] = _("A mysterious BERRY. It is rumored to"); -const u8 gBerryDescriptionPart2_Petaya[] = _("contain the power of all living things."); -const u8 gBerryDescriptionPart1_Apicot[] = _("A very mystifying BERRY. No telling"); -const u8 gBerryDescriptionPart2_Apicot[] = _("what may happen or how it can be used."); -const u8 gBerryDescriptionPart1_Lansat[] = _("Said to be a legendary BERRY."); -const u8 gBerryDescriptionPart2_Lansat[] = _("Holding it supposedly brings joy."); -const u8 gBerryDescriptionPart1_Starf[] = _("So strong, it was abandoned at the"); -const u8 gBerryDescriptionPart2_Starf[] = _("world’s edge. Considered a mirage."); -const u8 gBerryDescriptionPart1_Enigma[] = _("A completely enigmatic BERRY."); -const u8 gBerryDescriptionPart2_Enigma[] = _("Appears to have the power of stars."); - +static const u8 sBerryDescriptionPart1_Cheri[] = _("Blooms with delicate pretty flowers."); +static const u8 sBerryDescriptionPart2_Cheri[] = _("The bright red BERRY is very spicy."); +static const u8 sBerryDescriptionPart1_Chesto[] = _("The BERRY’s thick skin and fruit are"); +static const u8 sBerryDescriptionPart2_Chesto[] = _("very tough. It is dry-tasting all over."); +static const u8 sBerryDescriptionPart1_Pecha[] = _("Very sweet and delicious."); +static const u8 sBerryDescriptionPart2_Pecha[] = _("Also very tender - handle with care."); +static const u8 sBerryDescriptionPart1_Rawst[] = _("If the leaves grow long and curly,"); +static const u8 sBerryDescriptionPart2_Rawst[] = _("the BERRY seems to grow very bitter."); +static const u8 sBerryDescriptionPart1_Aspear[] = _("The hard BERRY is dense with a rich"); +static const u8 sBerryDescriptionPart2_Aspear[] = _("juice. It is quite sour."); +static const u8 sBerryDescriptionPart1_Leppa[] = _("Grows slower than CHERI and others."); +static const u8 sBerryDescriptionPart2_Leppa[] = _("The smaller the BERRY, the tastier."); +static const u8 sBerryDescriptionPart1_Oran[] = _("A peculiar BERRY with a mix of flavors."); +static const u8 sBerryDescriptionPart2_Oran[] = _("BERRIES grow in half a day."); +static const u8 sBerryDescriptionPart1_Persim[] = _("Loves sunlight. The BERRY’s color"); +static const u8 sBerryDescriptionPart2_Persim[] = _("grows vivid when exposed to the sun."); +static const u8 sBerryDescriptionPart1_Lum[] = _("Slow to grow. If raised with loving"); +static const u8 sBerryDescriptionPart2_Lum[] = _("care, it may grow two BERRIES."); +static const u8 sBerryDescriptionPart1_Sitrus[] = _("Closely related to ORAN. The large"); +static const u8 sBerryDescriptionPart2_Sitrus[] = _("BERRY has a well-rounded flavor."); +static const u8 sBerryDescriptionPart1_Figy[] = _("The BERRY, which looks chewed up,"); +static const u8 sBerryDescriptionPart2_Figy[] = _("brims with spicy substances."); +static const u8 sBerryDescriptionPart1_Wiki[] = _("The BERRY is said to have grown lumpy"); +static const u8 sBerryDescriptionPart2_Wiki[] = _("to help POKĂ©MON grip it."); +static const u8 sBerryDescriptionPart1_Mago[] = _("The BERRY turns curvy as it grows."); +static const u8 sBerryDescriptionPart2_Mago[] = _("The curvier, the sweeter and tastier."); +static const u8 sBerryDescriptionPart1_Aguav[] = _("The flower is dainty. It is rare in its"); +static const u8 sBerryDescriptionPart2_Aguav[] = _("ability to grow without light."); +static const u8 sBerryDescriptionPart1_Iapapa[] = _("The BERRY is very big and sour."); +static const u8 sBerryDescriptionPart2_Iapapa[] = _("It takes at least a day to grow."); +static const u8 sBerryDescriptionPart1_Razz[] = _("The red BERRY tastes slightly spicy."); +static const u8 sBerryDescriptionPart2_Razz[] = _("It grows quickly in just four hours."); +static const u8 sBerryDescriptionPart1_Bluk[] = _("The BERRY is blue on the outside, but"); +static const u8 sBerryDescriptionPart2_Bluk[] = _("it blackens the mouth when eaten."); +static const u8 sBerryDescriptionPart1_Nanab[] = _("This BERRY was the seventh"); +static const u8 sBerryDescriptionPart2_Nanab[] = _("discovered in the world. It is sweet."); +static const u8 sBerryDescriptionPart1_Wepear[] = _("The flower is small and white. It has a"); +static const u8 sBerryDescriptionPart2_Wepear[] = _("delicate balance of bitter and sour."); +static const u8 sBerryDescriptionPart1_Pinap[] = _("Weak against wind and cold."); +static const u8 sBerryDescriptionPart2_Pinap[] = _("The fruit is spicy and the skin, sour."); +static const u8 sBerryDescriptionPart1_Pomeg[] = _("However much it is watered,"); +static const u8 sBerryDescriptionPart2_Pomeg[] = _("it only grows up to six BERRIES."); +static const u8 sBerryDescriptionPart1_Kelpsy[] = _("A rare variety shaped like a root."); +static const u8 sBerryDescriptionPart2_Kelpsy[] = _("Grows a very large flower."); +static const u8 sBerryDescriptionPart1_Qualot[] = _("Loves water. Grows strong even in"); +static const u8 sBerryDescriptionPart2_Qualot[] = _("locations with constant rainfall."); +static const u8 sBerryDescriptionPart1_Hondew[] = _("A BERRY that is very valuable and"); +static const u8 sBerryDescriptionPart2_Hondew[] = _("rarely seen. It is very delicious."); +static const u8 sBerryDescriptionPart1_Grepa[] = _("Despite its tenderness and round"); +static const u8 sBerryDescriptionPart2_Grepa[] = _("shape, the BERRY is unimaginably sour."); +static const u8 sBerryDescriptionPart1_Tamato[] = _("The BERRY is lip-bendingly spicy."); +static const u8 sBerryDescriptionPart2_Tamato[] = _("It takes time to grow."); +static const u8 sBerryDescriptionPart1_Cornn[] = _("A BERRY from an ancient era. May not"); +static const u8 sBerryDescriptionPart2_Cornn[] = _("grow unless planted in quantity."); +static const u8 sBerryDescriptionPart1_Magost[] = _("A BERRY that is widely said to have"); +static const u8 sBerryDescriptionPart2_Magost[] = _("a finely balanced flavor."); +static const u8 sBerryDescriptionPart1_Rabuta[] = _("A rare variety that is overgrown with"); +static const u8 sBerryDescriptionPart2_Rabuta[] = _("hair. It is quite bitter."); +static const u8 sBerryDescriptionPart1_Nomel[] = _("Quite sour. Just one bite makes it"); +static const u8 sBerryDescriptionPart2_Nomel[] = _("impossible to taste for three days."); +static const u8 sBerryDescriptionPart1_Spelon[] = _("The vividly red BERRY is very spicy."); +static const u8 sBerryDescriptionPart2_Spelon[] = _("Its warts secrete a spicy substance."); +static const u8 sBerryDescriptionPart1_Pamtre[] = _("Drifts on the sea from somewhere."); +static const u8 sBerryDescriptionPart2_Pamtre[] = _("It is thought to grow elsewhere."); +static const u8 sBerryDescriptionPart1_Watmel[] = _("A huge BERRY, with some over 20"); +static const u8 sBerryDescriptionPart2_Watmel[] = _("inches discovered. Exceedingly sweet."); +static const u8 sBerryDescriptionPart1_Durin[] = _("Bitter to even look at. It is so"); +static const u8 sBerryDescriptionPart2_Durin[] = _("bitter, no one has ever eaten it as is."); +static const u8 sBerryDescriptionPart1_Belue[] = _("It is glossy and looks delicious, but"); +static const u8 sBerryDescriptionPart2_Belue[] = _("it is awfully sour. Takes time to grow."); +static const u8 sBerryDescriptionPart1_Liechi[] = _("A mysterious BERRY. It is rumored to"); +static const u8 sBerryDescriptionPart2_Liechi[] = _("contain the power of the sea."); +static const u8 sBerryDescriptionPart1_Ganlon[] = _("A mysterious BERRY. It is rumored to"); +static const u8 sBerryDescriptionPart2_Ganlon[] = _("contain the power of the land."); +static const u8 sBerryDescriptionPart1_Salac[] = _("A mysterious BERRY. It is rumored to"); +static const u8 sBerryDescriptionPart2_Salac[] = _("contain the power of the sky."); +static const u8 sBerryDescriptionPart1_Petaya[] = _("A mysterious BERRY. It is rumored to"); +static const u8 sBerryDescriptionPart2_Petaya[] = _("contain the power of all living things."); +static const u8 sBerryDescriptionPart1_Apicot[] = _("A very mystifying BERRY. No telling"); +static const u8 sBerryDescriptionPart2_Apicot[] = _("what may happen or how it can be used."); +static const u8 sBerryDescriptionPart1_Lansat[] = _("Said to be a legendary BERRY."); +static const u8 sBerryDescriptionPart2_Lansat[] = _("Holding it supposedly brings joy."); +static const u8 sBerryDescriptionPart1_Starf[] = _("So strong, it was abandoned at the"); +static const u8 sBerryDescriptionPart2_Starf[] = _("world’s edge. Considered a mirage."); +static const u8 sBerryDescriptionPart1_Enigma[] = _("A completely enigmatic BERRY."); +static const u8 sBerryDescriptionPart2_Enigma[] = _("Appears to have the power of stars."); const struct Berry gBerries[] = { @@ -149,8 +166,8 @@ const struct Berry gBerries[] = .size = 20, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Cheri, - .description2 = gBerryDescriptionPart2_Cheri, + .description1 = sBerryDescriptionPart1_Cheri, + .description2 = sBerryDescriptionPart2_Cheri, .stageDuration = 3, .spicy = 10, .dry = 0, @@ -165,8 +182,8 @@ const struct Berry gBerries[] = .size = 80, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Chesto, - .description2 = gBerryDescriptionPart2_Chesto, + .description1 = sBerryDescriptionPart1_Chesto, + .description2 = sBerryDescriptionPart2_Chesto, .stageDuration = 3, .spicy = 0, .dry = 10, @@ -181,8 +198,8 @@ const struct Berry gBerries[] = .size = 40, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Pecha, - .description2 = gBerryDescriptionPart2_Pecha, + .description1 = sBerryDescriptionPart1_Pecha, + .description2 = sBerryDescriptionPart2_Pecha, .stageDuration = 3, .spicy = 0, .dry = 0, @@ -197,8 +214,8 @@ const struct Berry gBerries[] = .size = 32, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Rawst, - .description2 = gBerryDescriptionPart2_Rawst, + .description1 = sBerryDescriptionPart1_Rawst, + .description2 = sBerryDescriptionPart2_Rawst, .stageDuration = 3, .spicy = 0, .dry = 0, @@ -213,8 +230,8 @@ const struct Berry gBerries[] = .size = 50, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Aspear, - .description2 = gBerryDescriptionPart2_Aspear, + .description1 = sBerryDescriptionPart1_Aspear, + .description2 = sBerryDescriptionPart2_Aspear, .stageDuration = 3, .spicy = 0, .dry = 0, @@ -229,8 +246,8 @@ const struct Berry gBerries[] = .size = 28, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Leppa, - .description2 = gBerryDescriptionPart2_Leppa, + .description1 = sBerryDescriptionPart1_Leppa, + .description2 = sBerryDescriptionPart2_Leppa, .stageDuration = 4, .spicy = 10, .dry = 0, @@ -245,8 +262,8 @@ const struct Berry gBerries[] = .size = 35, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Oran, - .description2 = gBerryDescriptionPart2_Oran, + .description1 = sBerryDescriptionPart1_Oran, + .description2 = sBerryDescriptionPart2_Oran, .stageDuration = 3, .spicy = 10, .dry = 10, @@ -261,8 +278,8 @@ const struct Berry gBerries[] = .size = 47, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Persim, - .description2 = gBerryDescriptionPart2_Persim, + .description1 = sBerryDescriptionPart1_Persim, + .description2 = sBerryDescriptionPart2_Persim, .stageDuration = 3, .spicy = 10, .dry = 10, @@ -277,8 +294,8 @@ const struct Berry gBerries[] = .size = 34, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Lum, - .description2 = gBerryDescriptionPart2_Lum, + .description1 = sBerryDescriptionPart1_Lum, + .description2 = sBerryDescriptionPart2_Lum, .stageDuration = 12, .spicy = 10, .dry = 10, @@ -293,8 +310,8 @@ const struct Berry gBerries[] = .size = 95, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Sitrus, - .description2 = gBerryDescriptionPart2_Sitrus, + .description1 = sBerryDescriptionPart1_Sitrus, + .description2 = sBerryDescriptionPart2_Sitrus, .stageDuration = 6, .spicy = 10, .dry = 10, @@ -309,8 +326,8 @@ const struct Berry gBerries[] = .size = 100, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Figy, - .description2 = gBerryDescriptionPart2_Figy, + .description1 = sBerryDescriptionPart1_Figy, + .description2 = sBerryDescriptionPart2_Figy, .stageDuration = 6, .spicy = 10, .dry = 0, @@ -325,8 +342,8 @@ const struct Berry gBerries[] = .size = 115, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Wiki, - .description2 = gBerryDescriptionPart2_Wiki, + .description1 = sBerryDescriptionPart1_Wiki, + .description2 = sBerryDescriptionPart2_Wiki, .stageDuration = 6, .spicy = 0, .dry = 10, @@ -341,8 +358,8 @@ const struct Berry gBerries[] = .size = 126, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Mago, - .description2 = gBerryDescriptionPart2_Mago, + .description1 = sBerryDescriptionPart1_Mago, + .description2 = sBerryDescriptionPart2_Mago, .stageDuration = 6, .spicy = 0, .dry = 0, @@ -357,8 +374,8 @@ const struct Berry gBerries[] = .size = 64, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Aguav, - .description2 = gBerryDescriptionPart2_Aguav, + .description1 = sBerryDescriptionPart1_Aguav, + .description2 = sBerryDescriptionPart2_Aguav, .stageDuration = 6, .spicy = 0, .dry = 0, @@ -373,8 +390,8 @@ const struct Berry gBerries[] = .size = 223, .maxYield = 3, .minYield = 2, - .description1 = gBerryDescriptionPart1_Iapapa, - .description2 = gBerryDescriptionPart2_Iapapa, + .description1 = sBerryDescriptionPart1_Iapapa, + .description2 = sBerryDescriptionPart2_Iapapa, .stageDuration = 6, .spicy = 0, .dry = 0, @@ -389,8 +406,8 @@ const struct Berry gBerries[] = .size = 120, .maxYield = 6, .minYield = 3, - .description1 = gBerryDescriptionPart1_Razz, - .description2 = gBerryDescriptionPart2_Razz, + .description1 = sBerryDescriptionPart1_Razz, + .description2 = sBerryDescriptionPart2_Razz, .stageDuration = 1, .spicy = 10, .dry = 10, @@ -405,8 +422,8 @@ const struct Berry gBerries[] = .size = 108, .maxYield = 6, .minYield = 3, - .description1 = gBerryDescriptionPart1_Bluk, - .description2 = gBerryDescriptionPart2_Bluk, + .description1 = sBerryDescriptionPart1_Bluk, + .description2 = sBerryDescriptionPart2_Bluk, .stageDuration = 1, .spicy = 0, .dry = 10, @@ -421,8 +438,8 @@ const struct Berry gBerries[] = .size = 77, .maxYield = 6, .minYield = 3, - .description1 = gBerryDescriptionPart1_Nanab, - .description2 = gBerryDescriptionPart2_Nanab, + .description1 = sBerryDescriptionPart1_Nanab, + .description2 = sBerryDescriptionPart2_Nanab, .stageDuration = 1, .spicy = 0, .dry = 0, @@ -437,8 +454,8 @@ const struct Berry gBerries[] = .size = 74, .maxYield = 6, .minYield = 3, - .description1 = gBerryDescriptionPart1_Wepear, - .description2 = gBerryDescriptionPart2_Wepear, + .description1 = sBerryDescriptionPart1_Wepear, + .description2 = sBerryDescriptionPart2_Wepear, .stageDuration = 1, .spicy = 0, .dry = 0, @@ -453,8 +470,8 @@ const struct Berry gBerries[] = .size = 80, .maxYield = 6, .minYield = 3, - .description1 = gBerryDescriptionPart1_Pinap, - .description2 = gBerryDescriptionPart2_Pinap, + .description1 = sBerryDescriptionPart1_Pinap, + .description2 = sBerryDescriptionPart2_Pinap, .stageDuration = 1, .spicy = 10, .dry = 0, @@ -469,8 +486,8 @@ const struct Berry gBerries[] = .size = 135, .maxYield = 6, .minYield = 2, - .description1 = gBerryDescriptionPart1_Pomeg, - .description2 = gBerryDescriptionPart2_Pomeg, + .description1 = sBerryDescriptionPart1_Pomeg, + .description2 = sBerryDescriptionPart2_Pomeg, .stageDuration = 3, .spicy = 10, .dry = 0, @@ -485,8 +502,8 @@ const struct Berry gBerries[] = .size = 150, .maxYield = 6, .minYield = 2, - .description1 = gBerryDescriptionPart1_Kelpsy, - .description2 = gBerryDescriptionPart2_Kelpsy, + .description1 = sBerryDescriptionPart1_Kelpsy, + .description2 = sBerryDescriptionPart2_Kelpsy, .stageDuration = 3, .spicy = 0, .dry = 10, @@ -501,8 +518,8 @@ const struct Berry gBerries[] = .size = 110, .maxYield = 6, .minYield = 2, - .description1 = gBerryDescriptionPart1_Qualot, - .description2 = gBerryDescriptionPart2_Qualot, + .description1 = sBerryDescriptionPart1_Qualot, + .description2 = sBerryDescriptionPart2_Qualot, .stageDuration = 3, .spicy = 10, .dry = 0, @@ -517,8 +534,8 @@ const struct Berry gBerries[] = .size = 162, .maxYield = 6, .minYield = 2, - .description1 = gBerryDescriptionPart1_Hondew, - .description2 = gBerryDescriptionPart2_Hondew, + .description1 = sBerryDescriptionPart1_Hondew, + .description2 = sBerryDescriptionPart2_Hondew, .stageDuration = 3, .spicy = 10, .dry = 10, @@ -533,8 +550,8 @@ const struct Berry gBerries[] = .size = 149, .maxYield = 6, .minYield = 2, - .description1 = gBerryDescriptionPart1_Grepa, - .description2 = gBerryDescriptionPart2_Grepa, + .description1 = sBerryDescriptionPart1_Grepa, + .description2 = sBerryDescriptionPart2_Grepa, .stageDuration = 3, .spicy = 0, .dry = 10, @@ -549,8 +566,8 @@ const struct Berry gBerries[] = .size = 200, .maxYield = 4, .minYield = 2, - .description1 = gBerryDescriptionPart1_Tamato, - .description2 = gBerryDescriptionPart2_Tamato, + .description1 = sBerryDescriptionPart1_Tamato, + .description2 = sBerryDescriptionPart2_Tamato, .stageDuration = 6, .spicy = 20, .dry = 10, @@ -565,8 +582,8 @@ const struct Berry gBerries[] = .size = 75, .maxYield = 4, .minYield = 2, - .description1 = gBerryDescriptionPart1_Cornn, - .description2 = gBerryDescriptionPart2_Cornn, + .description1 = sBerryDescriptionPart1_Cornn, + .description2 = sBerryDescriptionPart2_Cornn, .stageDuration = 6, .spicy = 0, .dry = 20, @@ -581,8 +598,8 @@ const struct Berry gBerries[] = .size = 140, .maxYield = 4, .minYield = 2, - .description1 = gBerryDescriptionPart1_Magost, - .description2 = gBerryDescriptionPart2_Magost, + .description1 = sBerryDescriptionPart1_Magost, + .description2 = sBerryDescriptionPart2_Magost, .stageDuration = 6, .spicy = 0, .dry = 0, @@ -597,8 +614,8 @@ const struct Berry gBerries[] = .size = 226, .maxYield = 4, .minYield = 2, - .description1 = gBerryDescriptionPart1_Rabuta, - .description2 = gBerryDescriptionPart2_Rabuta, + .description1 = sBerryDescriptionPart1_Rabuta, + .description2 = sBerryDescriptionPart2_Rabuta, .stageDuration = 6, .spicy = 0, .dry = 0, @@ -613,8 +630,8 @@ const struct Berry gBerries[] = .size = 285, .maxYield = 4, .minYield = 2, - .description1 = gBerryDescriptionPart1_Nomel, - .description2 = gBerryDescriptionPart2_Nomel, + .description1 = sBerryDescriptionPart1_Nomel, + .description2 = sBerryDescriptionPart2_Nomel, .stageDuration = 6, .spicy = 10, .dry = 0, @@ -629,8 +646,8 @@ const struct Berry gBerries[] = .size = 133, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Spelon, - .description2 = gBerryDescriptionPart2_Spelon, + .description1 = sBerryDescriptionPart1_Spelon, + .description2 = sBerryDescriptionPart2_Spelon, .stageDuration = 18, .spicy = 40, .dry = 10, @@ -645,8 +662,8 @@ const struct Berry gBerries[] = .size = 244, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Pamtre, - .description2 = gBerryDescriptionPart2_Pamtre, + .description1 = sBerryDescriptionPart1_Pamtre, + .description2 = sBerryDescriptionPart2_Pamtre, .stageDuration = 18, .spicy = 0, .dry = 40, @@ -661,8 +678,8 @@ const struct Berry gBerries[] = .size = 250, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Watmel, - .description2 = gBerryDescriptionPart2_Watmel, + .description1 = sBerryDescriptionPart1_Watmel, + .description2 = sBerryDescriptionPart2_Watmel, .stageDuration = 18, .spicy = 0, .dry = 0, @@ -677,8 +694,8 @@ const struct Berry gBerries[] = .size = 280, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Durin, - .description2 = gBerryDescriptionPart2_Durin, + .description1 = sBerryDescriptionPart1_Durin, + .description2 = sBerryDescriptionPart2_Durin, .stageDuration = 18, .spicy = 0, .dry = 0, @@ -693,8 +710,8 @@ const struct Berry gBerries[] = .size = 300, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Belue, - .description2 = gBerryDescriptionPart2_Belue, + .description1 = sBerryDescriptionPart1_Belue, + .description2 = sBerryDescriptionPart2_Belue, .stageDuration = 18, .spicy = 10, .dry = 0, @@ -709,8 +726,8 @@ const struct Berry gBerries[] = .size = 111, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Liechi, - .description2 = gBerryDescriptionPart2_Liechi, + .description1 = sBerryDescriptionPart1_Liechi, + .description2 = sBerryDescriptionPart2_Liechi, .stageDuration = 24, .spicy = 40, .dry = 0, @@ -725,8 +742,8 @@ const struct Berry gBerries[] = .size = 33, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Ganlon, - .description2 = gBerryDescriptionPart2_Ganlon, + .description1 = sBerryDescriptionPart1_Ganlon, + .description2 = sBerryDescriptionPart2_Ganlon, .stageDuration = 24, .spicy = 0, .dry = 40, @@ -741,8 +758,8 @@ const struct Berry gBerries[] = .size = 95, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Salac, - .description2 = gBerryDescriptionPart2_Salac, + .description1 = sBerryDescriptionPart1_Salac, + .description2 = sBerryDescriptionPart2_Salac, .stageDuration = 24, .spicy = 0, .dry = 0, @@ -757,8 +774,8 @@ const struct Berry gBerries[] = .size = 237, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Petaya, - .description2 = gBerryDescriptionPart2_Petaya, + .description1 = sBerryDescriptionPart1_Petaya, + .description2 = sBerryDescriptionPart2_Petaya, .stageDuration = 24, .spicy = 40, .dry = 0, @@ -773,8 +790,8 @@ const struct Berry gBerries[] = .size = 75, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Apicot, - .description2 = gBerryDescriptionPart2_Apicot, + .description1 = sBerryDescriptionPart1_Apicot, + .description2 = sBerryDescriptionPart2_Apicot, .stageDuration = 24, .spicy = 0, .dry = 40, @@ -789,8 +806,8 @@ const struct Berry gBerries[] = .size = 97, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Lansat, - .description2 = gBerryDescriptionPart2_Lansat, + .description1 = sBerryDescriptionPart1_Lansat, + .description2 = sBerryDescriptionPart2_Lansat, .stageDuration = 24, .spicy = 10, .dry = 10, @@ -805,8 +822,8 @@ const struct Berry gBerries[] = .size = 153, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Starf, - .description2 = gBerryDescriptionPart2_Starf, + .description1 = sBerryDescriptionPart1_Starf, + .description2 = sBerryDescriptionPart2_Starf, .stageDuration = 24, .spicy = 10, .dry = 10, @@ -821,8 +838,8 @@ const struct Berry gBerries[] = .size = 0, .maxYield = 2, .minYield = 1, - .description1 = gBerryDescriptionPart1_Enigma, - .description2 = gBerryDescriptionPart2_Enigma, + .description1 = sBerryDescriptionPart1_Enigma, + .description2 = sBerryDescriptionPart2_Enigma, .stageDuration = 24, .spicy = 40, .dry = 40, @@ -833,3 +850,405 @@ const struct Berry gBerries[] = }, }; +// unused +void ClearEnigmaBerries(void) +{ + CpuFill16(0, &gSaveBlock1Ptr->enigmaBerry, sizeof(gSaveBlock1Ptr->enigmaBerry)); +} + +void SetEnigmaBerry(u8 *src) +{ + u32 i; + u8 *dest = (u8*)&gSaveBlock1Ptr->enigmaBerry; + + for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry); i++) + dest[i] = src[i]; +} + +u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) +{ + u32 i; + u32 checksum; + u8 *dest; + + dest = (u8*)enigmaBerry; + checksum = 0; + for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry) - sizeof(gSaveBlock1Ptr->enigmaBerry.checksum); i++) + { + checksum += dest[i]; + } + + return checksum; +} + +bool32 IsEnigmaBerryValid(void) +{ + if (!gSaveBlock1Ptr->enigmaBerry.berry.stageDuration) + return FALSE; + if (!gSaveBlock1Ptr->enigmaBerry.berry.maxYield) + return FALSE; + if (GetEnigmaBerryChecksum(&gSaveBlock1Ptr->enigmaBerry) != gSaveBlock1Ptr->enigmaBerry.checksum) + return FALSE; + return TRUE; +} + +const struct Berry *GetBerryInfo(u8 berry) +{ + if (berry == 0x2B && IsEnigmaBerryValid()) + return (struct Berry*)(&gSaveBlock1Ptr->enigmaBerry.berry); + else + { + if (berry == 0 || berry > 0x2B) + berry = 1; + return &gBerries[berry - 1]; + } +} + +struct BerryTree *GetBerryTreeInfo(u8 id) +{ + return &gSaveBlock1Ptr->berryTrees[id]; +} + +bool32 FieldObjectInteractionWaterBerryTree(void) +{ + struct BerryTree *tree = GetBerryTreeInfo(FieldObjectGetBerryTreeId(gSelectedMapObject)); + + switch (tree->stage) + { + case 1: + tree->watered1 = TRUE; + break; + case 2: + tree->watered2 = TRUE; + break; + case 3: + tree->watered3 = TRUE; + break; + case 4: + tree->watered4 = TRUE; + break; + default: + return FALSE; + } + return TRUE; +} + +bool8 IsPlayerFacingPlantedBerryTree(void) +{ + if (GetFieldObjectScriptPointerForComparison() == BerryTreeScript + && GetStageByBerryTreeId(FieldObjectGetBerryTreeId(gSelectedMapObject)) == 0) + return TRUE; + else + return FALSE; +} + +bool8 TryToWaterBerryTree(void) +{ + if (GetFieldObjectScriptPointerForComparison() != BerryTreeScript) + return FALSE; + else + return FieldObjectInteractionWaterBerryTree(); +} + +void ClearBerryTrees(void) +{ + int i; + + for (i = 0; i < BERRY_TREES_NUMBER; i++) + gSaveBlock1Ptr->berryTrees[i] = gBlankBerryTree; +} + +bool32 BerryTreeGrow(struct BerryTree *tree) +{ + if (tree->growthSparkle) + return FALSE; + switch (tree->stage) + { + case 0: + return FALSE; + case 4: + tree->berryYield = CalcBerryYield(tree); + case 1: + case 2: + case 3: + tree->stage++; + break; + case 5: + tree->watered1 = 0; + tree->watered2 = 0; + tree->watered3 = 0; + tree->watered4 = 0; + tree->berryYield = 0; + tree->stage = 2; + if (++tree->regrowthCount == 10) + *tree = gBlankBerryTree; + break; + } + return TRUE; +} + +void BerryTreeTimeUpdate(s32 minutes) +{ + int i; + struct BerryTree *tree; + + for (i = 0; i < BERRY_TREES_NUMBER; i++) + { + tree = &gSaveBlock1Ptr->berryTrees[i]; + + if (tree->berry && tree->stage && !tree->growthSparkle) + { + if (minutes >= GetStageDurationByBerryType(tree->berry) * 71) + { + *tree = gBlankBerryTree; + } + else + { + s32 time = minutes; + + while (time != 0) + { + if (tree->minutesUntilNextStage > time) + { + tree->minutesUntilNextStage -= time; + break; + } + time -= tree->minutesUntilNextStage; + tree->minutesUntilNextStage = GetStageDurationByBerryType(tree->berry); + if (!BerryTreeGrow(tree)) + break; + if (tree->stage == 5) + tree->minutesUntilNextStage *= 4; + } + } + } + } +} + +void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 sparkle) +{ + struct BerryTree *tree = GetBerryTreeInfo(id); + + *tree = gBlankBerryTree; + tree->berry = berry; + tree->minutesUntilNextStage = GetStageDurationByBerryType(berry); + tree->stage = stage; + if (stage == 5) + { + tree->berryYield = CalcBerryYield(tree); + tree->minutesUntilNextStage *= 4; + } + if (!sparkle) + { + tree->growthSparkle = TRUE; + } +} + +void RemoveBerryTree(u8 id) +{ + gSaveBlock1Ptr->berryTrees[id] = gBlankBerryTree; +} + +u8 GetBerryTypeByBerryTreeId(u8 id) +{ + return gSaveBlock1Ptr->berryTrees[id].berry; +} + +u8 GetStageByBerryTreeId(u8 id) +{ + return gSaveBlock1Ptr->berryTrees[id].stage; +} + +u8 ItemIdToBerryType(u16 item) +{ + u16 berry = item - FIRST_BERRY; + + if (berry > LAST_BERRY - FIRST_BERRY) + return 1; + else + return item - FIRST_BERRY + 1; +} + +u16 BerryTypeToItemId(u16 berry) +{ + u16 item = berry - 1; + + if (item > LAST_BERRY - FIRST_BERRY) + return FIRST_BERRY; + else + return berry + FIRST_BERRY - 1; +} + +void GetBerryNameByBerryType(u8 berry, u8 *string) +{ + memcpy(string, GetBerryInfo(berry)->name, BERRY_NAME_LENGTH); + string[BERRY_NAME_LENGTH] = EOS; +} + +void GetBerryCountStringByBerryType(u8 berry, u8* dest, u32 berryCount) +{ + GetBerryCountString(dest, GetBerryInfo(berry)->name, berryCount); +} + +void ResetBerryTreeSparkleFlag(u8 id) +{ + GetBerryTreeInfo(id)->growthSparkle = 0; +} + +u8 BerryTreeGetNumStagesWatered(struct BerryTree *tree) +{ + u8 count = 0; + + if (tree->watered1) + count++; + if (tree->watered2) + count++; + if (tree->watered3) + count++; + if (tree->watered4) + count++; + return count; +} + +u8 GetNumStagesWateredByBerryTreeId(u8 id) +{ + return BerryTreeGetNumStagesWatered(GetBerryTreeInfo(id)); +} + +u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water) +{ + u32 randMin; + u32 randMax; + u32 rand; + u32 extraYield; + + if (water == 0) + return min; + else + { + randMin = (max - min) * (water - 1); + randMax = (max - min) * (water); + rand = randMin + Random() % (randMax - randMin + 1); + + if ((rand & 3) > 1) + extraYield = rand / 4 + 1; + else + extraYield = rand / 4; + return extraYield + min; + } +} + +u8 CalcBerryYield(struct BerryTree *tree) +{ + const struct Berry *berry = GetBerryInfo(tree->berry); + u8 min = berry->minYield; + u8 max = berry->maxYield; + + return CalcBerryYieldInternal(max, min, BerryTreeGetNumStagesWatered(tree)); +} + +u8 GetBerryCountByBerryTreeId(u8 id) +{ + return gSaveBlock1Ptr->berryTrees[id].berryYield; +} + +u16 GetStageDurationByBerryType(u8 berry) +{ + return GetBerryInfo(berry)->stageDuration * 60; +} + +void FieldObjectInteractionGetBerryTreeData(void) +{ + u8 id; + u8 berry; + u8 unk; + u8 group; + u8 num; + + id = FieldObjectGetBerryTreeId(gSelectedMapObject); + berry = GetBerryTypeByBerryTreeId(id); + ResetBerryTreeSparkleFlag(id); + unk = gScriptLastTalked; + num = gSaveBlock1Ptr->location.mapNum; + group = gSaveBlock1Ptr->location.mapGroup; + if (sub_8092E9C(unk, num, group)) + gSpecialVar_0x8004 = 0xFF; + else + gSpecialVar_0x8004 = GetStageByBerryTreeId(id); + gSpecialVar_0x8005 = GetNumStagesWateredByBerryTreeId(id); + gSpecialVar_0x8006 = GetBerryCountByBerryTreeId(id); + GetBerryCountStringByBerryType(berry, gStringVar1, gSpecialVar_0x8006); +} + +void FieldObjectInteractionGetBerryName(void) +{ + u8 berryType = GetBerryTypeByBerryTreeId(FieldObjectGetBerryTreeId(gSelectedMapObject)); + GetBerryNameByBerryType(berryType, gStringVar1); +} + +void FieldObjectInteractionGetBerryCountString(void) +{ + u8 treeId = FieldObjectGetBerryTreeId(gSelectedMapObject); + u8 berry = GetBerryTypeByBerryTreeId(treeId); + u8 count = GetBerryCountByBerryTreeId(treeId); + GetBerryCountStringByBerryType(berry, gStringVar1, count); +} + +void Bag_ChooseBerry(void) +{ + SetMainCallback2(CB2_ChooseBerry); +} + +void FieldObjectInteractionPlantBerryTree(void) +{ + u8 berry = ItemIdToBerryType(gScriptItemId); + + PlantBerryTree(FieldObjectGetBerryTreeId(gSelectedMapObject), berry, 1, TRUE); + FieldObjectInteractionGetBerryTreeData(); +} + +void FieldObjectInteractionPickBerryTree(void) +{ + u8 id = FieldObjectGetBerryTreeId(gSelectedMapObject); + u8 berry = GetBerryTypeByBerryTreeId(id); + + gSpecialVar_0x8004 = AddBagItem(BerryTypeToItemId(berry), GetBerryCountByBerryTreeId(id)); +} + +void FieldObjectInteractionRemoveBerryTree(void) +{ + RemoveBerryTree(FieldObjectGetBerryTreeId(gSelectedMapObject)); + sub_8092EF0(gScriptLastTalked, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); +} + +u8 PlayerHasBerries(void) +{ + return IsBagPocketNonEmpty(BAG_BERRIES); +} + +void ResetBerryTreeSparkleFlags(void) +{ + s16 cam_left; + s16 cam_top; + s16 left; + s16 top; + s16 right; + s16 bottom; + int i; + + GetCameraCoords(&cam_left, &cam_top); + left = cam_left; + top = cam_top + 3; + right = cam_left + 14; + bottom = top + 8; + for (i = 0; i < (u8)ARRAY_COUNT(gSaveBlock1Ptr->mapObjects); i++) + { + if (gMapObjects[i].active && gMapObjects[i].animPattern == 12) + { + cam_left = gMapObjects[i].coords2.x; + cam_top = gMapObjects[i].coords2.y; + if (left <= cam_left && cam_left <= right && top <= cam_top && cam_top <= bottom) + ResetBerryTreeSparkleFlag(gMapObjects[i].trainerRange_berryTreeId); + } + } +} diff --git a/src/item.c b/src/item.c index 4ad70e11f..c85e2fe1f 100644 --- a/src/item.c +++ b/src/item.c @@ -1,5 +1,6 @@ #include "global.h" #include "item.h" +#include "items.h" #include "string_util.h" #include "text.h" #include "event_data.h" @@ -86,10 +87,10 @@ void CopyItemName(u16 itemId, u8 *string) void CopyItemNameHandlePlural(u16 itemId, u8 *string, u32 quantity) { - if (itemId == 4) + if (itemId == ITEM_POKE_BALL) { if (quantity < 2) - StringCopy(string, ItemId_GetItem(4)->name); + StringCopy(string, ItemId_GetItem(ITEM_POKE_BALL)->name); else StringCopy(string, gOtherText_PokeBalls); } -- cgit v1.2.3 From a08cd8e5a718ad4383a5b66b48e44a50a99dc6bf Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 13 Sep 2017 12:17:48 +0200 Subject: define number of map objects --- src/berry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/berry.c b/src/berry.c index ffd30d47f..17dd5eaf1 100644 --- a/src/berry.c +++ b/src/berry.c @@ -1241,7 +1241,7 @@ void ResetBerryTreeSparkleFlags(void) top = cam_top + 3; right = cam_left + 14; bottom = top + 8; - for (i = 0; i < (u8)ARRAY_COUNT(gSaveBlock1Ptr->mapObjects); i++) + for (i = 0; i < MAP_OBJECTS_NUMBER; i++) { if (gMapObjects[i].active && gMapObjects[i].animPattern == 12) { -- cgit v1.2.3 From b1e90c1d5011ea19a50cacbb36bda39e436b1e56 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 13 Sep 2017 19:30:05 +0200 Subject: review berry cleanings --- src/berry.c | 138 ++++++++++++++++++++---------------------------------------- 1 file changed, 46 insertions(+), 92 deletions(-) (limited to 'src') diff --git a/src/berry.c b/src/berry.c index 17dd5eaf1..b6eaa14a0 100644 --- a/src/berry.c +++ b/src/berry.c @@ -24,52 +24,6 @@ extern const struct BerryTree gBlankBerryTree; #define FIRST_BERRY ITEM_CHERI_BERRY #define LAST_BERRY ITEM_ENIGMA_BERRY -#ifdef ENGLISH -#define NAME_CHERI_BERRY _("CHERI") -#define NAME_CHESTO_BERRY _("CHESTO") -#define NAME_PECHA_BERRY _("PECHA") -#define NAME_RAWST_BERRY _("RAWST") -#define NAME_ASPEAR_BERRY _("ASPEAR") -#define NAME_LEPPA_BERRY _("LEPPA") -#define NAME_ORAN_BERRY _("ORAN") -#define NAME_PERSIM_BERRY _("PERSIM") -#define NAME_LUM_BERRY _("LUM") -#define NAME_SITRUS_BERRY _("SITRUS") -#define NAME_FIGY_BERRY _("FIGY") -#define NAME_WIKI_BERRY _("WIKI") -#define NAME_MAGO_BERRY _("MAGO") -#define NAME_AGUAV_BERRY _("AGUAV") -#define NAME_IAPAPA_BERRY _("IAPAPA") -#define NAME_RAZZ_BERRY _("RAZZ") -#define NAME_BLUK_BERRY _("BLUK") -#define NAME_NANAB_BERRY _("NANAB") -#define NAME_WEPEAR_BERRY _("WEPEAR") -#define NAME_PINAP_BERRY _("PINAP") -#define NAME_POMEG_BERRY _("POMEG") -#define NAME_KELPSY_BERRY _("KELPSY") -#define NAME_QUALOT_BERRY _("QUALOT") -#define NAME_HONDEW_BERRY _("HONDEW") -#define NAME_GREPA_BERRY _("GREPA") -#define NAME_TAMATO_BERRY _("TAMATO") -#define NAME_CORNN_BERRY _("CORNN") -#define NAME_MAGOST_BERRY _("MAGOST") -#define NAME_RABUTA_BERRY _("RABUTA") -#define NAME_NOMEL_BERRY _("NOMEL") -#define NAME_SPELON_BERRY _("SPELON") -#define NAME_PAMTRE_BERRY _("PAMTRE") -#define NAME_WATMEL_BERRY _("WATMEL") -#define NAME_DURIN_BERRY _("DURIN") -#define NAME_BELUE_BERRY _("BELUE") -#define NAME_LIECHI_BERRY _("LIECHI") -#define NAME_GANLON_BERRY _("GANLON") -#define NAME_SALAC_BERRY _("SALAC") -#define NAME_PETAYA_BERRY _("PETAYA") -#define NAME_APICOT_BERRY _("APICOT") -#define NAME_LANSAT_BERRY _("LANSAT") -#define NAME_STARF_BERRY _("STARF") -#define NAME_ENIGMA_BERRY _("ENIGMA") - -#endif // ENGLISH static const u8 sBerryDescriptionPart1_Cheri[] = _("Blooms with delicate pretty flowers."); static const u8 sBerryDescriptionPart2_Cheri[] = _("The bright red BERRY is very spicy."); @@ -161,7 +115,7 @@ static const u8 sBerryDescriptionPart2_Enigma[] = _("Appears to have the power o const struct Berry gBerries[] = { { - .name = NAME_CHERI_BERRY, + .name = _("CHERI"), .firmness = BERRY_FIRMNESS_SOFT, .size = 20, .maxYield = 3, @@ -177,7 +131,7 @@ const struct Berry gBerries[] = .smoothness = 25, }, { - .name = NAME_CHESTO_BERRY, + .name = _("CHESTO"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .size = 80, .maxYield = 3, @@ -193,7 +147,7 @@ const struct Berry gBerries[] = .smoothness = 25, }, { - .name = NAME_PECHA_BERRY, + .name = _("PECHA"), .firmness = BERRY_FIRMNESS_VERY_SOFT, .size = 40, .maxYield = 3, @@ -209,7 +163,7 @@ const struct Berry gBerries[] = .smoothness = 25, }, { - .name = NAME_RAWST_BERRY, + .name = _("RAWST"), .firmness = BERRY_FIRMNESS_HARD, .size = 32, .maxYield = 3, @@ -225,7 +179,7 @@ const struct Berry gBerries[] = .smoothness = 25, }, { - .name = NAME_ASPEAR_BERRY, + .name = _("ASPEAR"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .size = 50, .maxYield = 3, @@ -241,7 +195,7 @@ const struct Berry gBerries[] = .smoothness = 25, }, { - .name = NAME_LEPPA_BERRY, + .name = _("LEPPA"), .firmness = BERRY_FIRMNESS_VERY_HARD, .size = 28, .maxYield = 3, @@ -257,7 +211,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_ORAN_BERRY, + .name = _("ORAN"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .size = 35, .maxYield = 3, @@ -273,7 +227,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_PERSIM_BERRY, + .name = _("PERSIM"), .firmness = BERRY_FIRMNESS_HARD, .size = 47, .maxYield = 3, @@ -289,7 +243,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_LUM_BERRY, + .name = _("LUM"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .size = 34, .maxYield = 2, @@ -305,7 +259,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_SITRUS_BERRY, + .name = _("SITRUS"), .firmness = BERRY_FIRMNESS_VERY_HARD, .size = 95, .maxYield = 3, @@ -321,7 +275,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_FIGY_BERRY, + .name = _("FIGY"), .firmness = BERRY_FIRMNESS_SOFT, .size = 100, .maxYield = 3, @@ -337,7 +291,7 @@ const struct Berry gBerries[] = .smoothness = 25, }, { - .name = NAME_WIKI_BERRY, + .name = _("WIKI"), .firmness = BERRY_FIRMNESS_HARD, .size = 115, .maxYield = 3, @@ -353,7 +307,7 @@ const struct Berry gBerries[] = .smoothness = 25, }, { - .name = NAME_MAGO_BERRY, + .name = _("MAGO"), .firmness = BERRY_FIRMNESS_HARD, .size = 126, .maxYield = 3, @@ -369,7 +323,7 @@ const struct Berry gBerries[] = .smoothness = 25, }, { - .name = NAME_AGUAV_BERRY, + .name = _("AGUAV"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .size = 64, .maxYield = 3, @@ -385,7 +339,7 @@ const struct Berry gBerries[] = .smoothness = 25, }, { - .name = NAME_IAPAPA_BERRY, + .name = _("IAPAPA"), .firmness = BERRY_FIRMNESS_SOFT, .size = 223, .maxYield = 3, @@ -401,7 +355,7 @@ const struct Berry gBerries[] = .smoothness = 25, }, { - .name = NAME_RAZZ_BERRY, + .name = _("RAZZ"), .firmness = BERRY_FIRMNESS_VERY_HARD, .size = 120, .maxYield = 6, @@ -417,7 +371,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_BLUK_BERRY, + .name = _("BLUK"), .firmness = BERRY_FIRMNESS_SOFT, .size = 108, .maxYield = 6, @@ -433,7 +387,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_NANAB_BERRY, + .name = _("NANAB"), .firmness = BERRY_FIRMNESS_VERY_HARD, .size = 77, .maxYield = 6, @@ -449,7 +403,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_WEPEAR_BERRY, + .name = _("WEPEAR"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .size = 74, .maxYield = 6, @@ -465,7 +419,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_PINAP_BERRY, + .name = _("PINAP"), .firmness = BERRY_FIRMNESS_HARD, .size = 80, .maxYield = 6, @@ -481,7 +435,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_POMEG_BERRY, + .name = _("POMEG"), .firmness = BERRY_FIRMNESS_VERY_HARD, .size = 135, .maxYield = 6, @@ -497,7 +451,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_KELPSY_BERRY, + .name = _("KELPSY"), .firmness = BERRY_FIRMNESS_HARD, .size = 150, .maxYield = 6, @@ -513,7 +467,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_QUALOT_BERRY, + .name = _("QUALOT"), .firmness = BERRY_FIRMNESS_HARD, .size = 110, .maxYield = 6, @@ -529,7 +483,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_HONDEW_BERRY, + .name = _("HONDEW"), .firmness = BERRY_FIRMNESS_HARD, .size = 162, .maxYield = 6, @@ -545,7 +499,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_GREPA_BERRY, + .name = _("GREPA"), .firmness = BERRY_FIRMNESS_SOFT, .size = 149, .maxYield = 6, @@ -561,7 +515,7 @@ const struct Berry gBerries[] = .smoothness = 20, }, { - .name = NAME_TAMATO_BERRY, + .name = _("TAMATO"), .firmness = BERRY_FIRMNESS_SOFT, .size = 200, .maxYield = 4, @@ -577,7 +531,7 @@ const struct Berry gBerries[] = .smoothness = 30, }, { - .name = NAME_CORNN_BERRY, + .name = _("CORNN"), .firmness = BERRY_FIRMNESS_HARD, .size = 75, .maxYield = 4, @@ -593,7 +547,7 @@ const struct Berry gBerries[] = .smoothness = 30, }, { - .name = NAME_MAGOST_BERRY, + .name = _("MAGOST"), .firmness = BERRY_FIRMNESS_HARD, .size = 140, .maxYield = 4, @@ -609,7 +563,7 @@ const struct Berry gBerries[] = .smoothness = 30, }, { - .name = NAME_RABUTA_BERRY, + .name = _("RABUTA"), .firmness = BERRY_FIRMNESS_SOFT, .size = 226, .maxYield = 4, @@ -625,7 +579,7 @@ const struct Berry gBerries[] = .smoothness = 30, }, { - .name = NAME_NOMEL_BERRY, + .name = _("NOMEL"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .size = 285, .maxYield = 4, @@ -641,7 +595,7 @@ const struct Berry gBerries[] = .smoothness = 30, }, { - .name = NAME_SPELON_BERRY, + .name = _("SPELON"), .firmness = BERRY_FIRMNESS_SOFT, .size = 133, .maxYield = 2, @@ -657,7 +611,7 @@ const struct Berry gBerries[] = .smoothness = 70, }, { - .name = NAME_PAMTRE_BERRY, + .name = _("PAMTRE"), .firmness = BERRY_FIRMNESS_VERY_SOFT, .size = 244, .maxYield = 2, @@ -673,7 +627,7 @@ const struct Berry gBerries[] = .smoothness = 70, }, { - .name = NAME_WATMEL_BERRY, + .name = _("WATMEL"), .firmness = BERRY_FIRMNESS_SOFT, .size = 250, .maxYield = 2, @@ -689,7 +643,7 @@ const struct Berry gBerries[] = .smoothness = 70, }, { - .name = NAME_DURIN_BERRY, + .name = _("DURIN"), .firmness = BERRY_FIRMNESS_HARD, .size = 280, .maxYield = 2, @@ -705,7 +659,7 @@ const struct Berry gBerries[] = .smoothness = 70, }, { - .name = NAME_BELUE_BERRY, + .name = _("BELUE"), .firmness = BERRY_FIRMNESS_VERY_SOFT, .size = 300, .maxYield = 2, @@ -721,7 +675,7 @@ const struct Berry gBerries[] = .smoothness = 70, }, { - .name = NAME_LIECHI_BERRY, + .name = _("LIECHI"), .firmness = BERRY_FIRMNESS_VERY_HARD, .size = 111, .maxYield = 2, @@ -737,7 +691,7 @@ const struct Berry gBerries[] = .smoothness = 80, }, { - .name = NAME_GANLON_BERRY, + .name = _("GANLON"), .firmness = BERRY_FIRMNESS_VERY_HARD, .size = 33, .maxYield = 2, @@ -753,7 +707,7 @@ const struct Berry gBerries[] = .smoothness = 80, }, { - .name = NAME_SALAC_BERRY, + .name = _("SALAC"), .firmness = BERRY_FIRMNESS_VERY_HARD, .size = 95, .maxYield = 2, @@ -769,7 +723,7 @@ const struct Berry gBerries[] = .smoothness = 80, }, { - .name = NAME_PETAYA_BERRY, + .name = _("PETAYA"), .firmness = BERRY_FIRMNESS_VERY_HARD, .size = 237, .maxYield = 2, @@ -785,7 +739,7 @@ const struct Berry gBerries[] = .smoothness = 80, }, { - .name = NAME_APICOT_BERRY, + .name = _("APICOT"), .firmness = BERRY_FIRMNESS_HARD, .size = 75, .maxYield = 2, @@ -801,7 +755,7 @@ const struct Berry gBerries[] = .smoothness = 80, }, { - .name = NAME_LANSAT_BERRY, + .name = _("LANSAT"), .firmness = BERRY_FIRMNESS_SOFT, .size = 97, .maxYield = 2, @@ -817,7 +771,7 @@ const struct Berry gBerries[] = .smoothness = 30, }, { - .name = NAME_STARF_BERRY, + .name = _("STARF"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .size = 153, .maxYield = 2, @@ -833,7 +787,7 @@ const struct Berry gBerries[] = .smoothness = 30, }, { - .name = NAME_ENIGMA_BERRY, + .name = _("ENIGMA"), .firmness = BERRY_FIRMNESS_UNKNOWN, .size = 0, .maxYield = 2, @@ -954,7 +908,7 @@ void ClearBerryTrees(void) { int i; - for (i = 0; i < BERRY_TREES_NUMBER; i++) + for (i = 0; i < BERRY_TREES_COUNT; i++) gSaveBlock1Ptr->berryTrees[i] = gBlankBerryTree; } @@ -992,7 +946,7 @@ void BerryTreeTimeUpdate(s32 minutes) int i; struct BerryTree *tree; - for (i = 0; i < BERRY_TREES_NUMBER; i++) + for (i = 0; i < BERRY_TREES_COUNT; i++) { tree = &gSaveBlock1Ptr->berryTrees[i]; @@ -1241,7 +1195,7 @@ void ResetBerryTreeSparkleFlags(void) top = cam_top + 3; right = cam_left + 14; bottom = top + 8; - for (i = 0; i < MAP_OBJECTS_NUMBER; i++) + for (i = 0; i < MAP_OBJECTS_COUNT; i++) { if (gMapObjects[i].active && gMapObjects[i].animPattern == 12) { -- cgit v1.2.3