Use implicilt berry indexes in arrays

This commit is contained in:
DizzyEggg 2019-04-14 13:22:37 +02:00 committed by huderlem
parent 065c60544d
commit dc764698c9
6 changed files with 228 additions and 146 deletions

View File

@ -34,12 +34,6 @@ enum
BERRY_STAGE_SPARKLING = 0xFF, BERRY_STAGE_SPARKLING = 0xFF,
}; };
#define NUM_BERRIES 44
extern const u8 *const gBerryTreeEventObjectGraphicsIdTablePointers[];
extern const struct SpriteFrameImage *const gBerryTreePicTablePointers[];
extern const u8 *const gBerryTreePaletteSlotTablePointers[];
void ClearEnigmaBerries(void); void ClearEnigmaBerries(void);
void SetEnigmaBerry(u8 *src); void SetEnigmaBerry(u8 *src);
bool32 IsEnigmaBerryValid(void); bool32 IsEnigmaBerryValid(void);

View File

@ -64,6 +64,10 @@ extern const struct OamData gEventObjectBaseOam_32x32;
extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[];
extern const u8 gReflectionEffectPaletteMap[]; extern const u8 gReflectionEffectPaletteMap[];
extern const u8 *const gBerryTreeEventObjectGraphicsIdTablePointers[];
extern const struct SpriteFrameImage *const gBerryTreePicTablePointers[];
extern const u8 *const gBerryTreePaletteSlotTablePointers[];
void ResetEventObjects(void); void ResetEventObjects(void);
u8 GetMoveDirectionAnimNum(u8); u8 GetMoveDirectionAnimNum(u8);
u8 GetEventObjectIdByLocalIdAndMap(u8, u8, u8); u8 GetEventObjectIdByLocalIdAndMap(u8, u8, u8);

View File

@ -18,6 +18,7 @@ extern const u8 EventScript_TryDoRematchBattle[];
extern const u8 SecretBase_EventScript_DollInteract[]; extern const u8 SecretBase_EventScript_DollInteract[];
extern const u8 SecretBase_EventScript_CushionInteract[]; extern const u8 SecretBase_EventScript_CushionInteract[];
extern const u8 BerryTreeScript[];
extern const u8 gTVBravoTrainerText00[]; extern const u8 gTVBravoTrainerText00[];
extern const u8 gTVBravoTrainerText01[]; extern const u8 gTVBravoTrainerText01[];

View File

@ -1,6 +1,8 @@
#include "global.h" #include "global.h"
#include "berry.h" #include "berry.h"
#include "event_data.h" #include "event_data.h"
#include "event_object_movement.h"
#include "event_scripts.h"
#include "field_control_avatar.h" #include "field_control_avatar.h"
#include "fieldmap.h" #include "fieldmap.h"
#include "item.h" #include "item.h"
@ -11,11 +13,6 @@
#include "text.h" #include "text.h"
#include "constants/event_object_movement_constants.h" #include "constants/event_object_movement_constants.h"
#include "constants/items.h" #include "constants/items.h"
#include "event_object_movement.h"
extern const u8 BerryTreeScript[];
static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry); static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry);
static bool32 BerryTreeGrow(struct BerryTree *tree); static bool32 BerryTreeGrow(struct BerryTree *tree);
@ -117,6 +114,7 @@ static const u8 sBerryDescriptionPart2_Enigma[] = _("Appears to have the power o
const struct Berry gBerries[] = const struct Berry gBerries[] =
{ {
[ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("CHERI"), .name = _("CHERI"),
.firmness = BERRY_FIRMNESS_SOFT, .firmness = BERRY_FIRMNESS_SOFT,
@ -133,6 +131,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 25, .smoothness = 25,
}, },
[ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("CHESTO"), .name = _("CHESTO"),
.firmness = BERRY_FIRMNESS_SUPER_HARD, .firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -149,6 +149,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 25, .smoothness = 25,
}, },
[ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("PECHA"), .name = _("PECHA"),
.firmness = BERRY_FIRMNESS_VERY_SOFT, .firmness = BERRY_FIRMNESS_VERY_SOFT,
@ -165,6 +167,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 25, .smoothness = 25,
}, },
[ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("RAWST"), .name = _("RAWST"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -181,6 +185,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 25, .smoothness = 25,
}, },
[ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("ASPEAR"), .name = _("ASPEAR"),
.firmness = BERRY_FIRMNESS_SUPER_HARD, .firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -197,6 +203,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 25, .smoothness = 25,
}, },
[ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("LEPPA"), .name = _("LEPPA"),
.firmness = BERRY_FIRMNESS_VERY_HARD, .firmness = BERRY_FIRMNESS_VERY_HARD,
@ -213,6 +221,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("ORAN"), .name = _("ORAN"),
.firmness = BERRY_FIRMNESS_SUPER_HARD, .firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -229,6 +239,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("PERSIM"), .name = _("PERSIM"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -245,6 +257,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_LUM_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("LUM"), .name = _("LUM"),
.firmness = BERRY_FIRMNESS_SUPER_HARD, .firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -261,6 +275,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("SITRUS"), .name = _("SITRUS"),
.firmness = BERRY_FIRMNESS_VERY_HARD, .firmness = BERRY_FIRMNESS_VERY_HARD,
@ -277,6 +293,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("FIGY"), .name = _("FIGY"),
.firmness = BERRY_FIRMNESS_SOFT, .firmness = BERRY_FIRMNESS_SOFT,
@ -293,6 +311,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 25, .smoothness = 25,
}, },
[ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("WIKI"), .name = _("WIKI"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -309,6 +329,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 25, .smoothness = 25,
}, },
[ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("MAGO"), .name = _("MAGO"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -325,6 +347,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 25, .smoothness = 25,
}, },
[ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("AGUAV"), .name = _("AGUAV"),
.firmness = BERRY_FIRMNESS_SUPER_HARD, .firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -341,6 +365,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 25, .smoothness = 25,
}, },
[ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("IAPAPA"), .name = _("IAPAPA"),
.firmness = BERRY_FIRMNESS_SOFT, .firmness = BERRY_FIRMNESS_SOFT,
@ -357,6 +383,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 25, .smoothness = 25,
}, },
[ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("RAZZ"), .name = _("RAZZ"),
.firmness = BERRY_FIRMNESS_VERY_HARD, .firmness = BERRY_FIRMNESS_VERY_HARD,
@ -373,6 +401,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("BLUK"), .name = _("BLUK"),
.firmness = BERRY_FIRMNESS_SOFT, .firmness = BERRY_FIRMNESS_SOFT,
@ -389,6 +419,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("NANAB"), .name = _("NANAB"),
.firmness = BERRY_FIRMNESS_VERY_HARD, .firmness = BERRY_FIRMNESS_VERY_HARD,
@ -405,6 +437,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("WEPEAR"), .name = _("WEPEAR"),
.firmness = BERRY_FIRMNESS_SUPER_HARD, .firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -421,6 +455,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("PINAP"), .name = _("PINAP"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -437,6 +473,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("POMEG"), .name = _("POMEG"),
.firmness = BERRY_FIRMNESS_VERY_HARD, .firmness = BERRY_FIRMNESS_VERY_HARD,
@ -453,6 +491,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("KELPSY"), .name = _("KELPSY"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -469,6 +509,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("QUALOT"), .name = _("QUALOT"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -485,6 +527,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("HONDEW"), .name = _("HONDEW"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -501,6 +545,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("GREPA"), .name = _("GREPA"),
.firmness = BERRY_FIRMNESS_SOFT, .firmness = BERRY_FIRMNESS_SOFT,
@ -517,6 +563,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 20, .smoothness = 20,
}, },
[ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("TAMATO"), .name = _("TAMATO"),
.firmness = BERRY_FIRMNESS_SOFT, .firmness = BERRY_FIRMNESS_SOFT,
@ -533,6 +581,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 30, .smoothness = 30,
}, },
[ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("CORNN"), .name = _("CORNN"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -549,6 +599,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 30, .smoothness = 30,
}, },
[ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("MAGOST"), .name = _("MAGOST"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -565,6 +617,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 30, .smoothness = 30,
}, },
[ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("RABUTA"), .name = _("RABUTA"),
.firmness = BERRY_FIRMNESS_SOFT, .firmness = BERRY_FIRMNESS_SOFT,
@ -581,6 +635,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 30, .smoothness = 30,
}, },
[ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("NOMEL"), .name = _("NOMEL"),
.firmness = BERRY_FIRMNESS_SUPER_HARD, .firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -597,6 +653,8 @@ const struct Berry gBerries[] =
.sour = 20, .sour = 20,
.smoothness = 30, .smoothness = 30,
}, },
[ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("SPELON"), .name = _("SPELON"),
.firmness = BERRY_FIRMNESS_SOFT, .firmness = BERRY_FIRMNESS_SOFT,
@ -613,6 +671,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 70, .smoothness = 70,
}, },
[ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("PAMTRE"), .name = _("PAMTRE"),
.firmness = BERRY_FIRMNESS_VERY_SOFT, .firmness = BERRY_FIRMNESS_VERY_SOFT,
@ -629,6 +689,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 70, .smoothness = 70,
}, },
[ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("WATMEL"), .name = _("WATMEL"),
.firmness = BERRY_FIRMNESS_SOFT, .firmness = BERRY_FIRMNESS_SOFT,
@ -645,6 +707,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 70, .smoothness = 70,
}, },
[ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("DURIN"), .name = _("DURIN"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -661,6 +725,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 70, .smoothness = 70,
}, },
[ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("BELUE"), .name = _("BELUE"),
.firmness = BERRY_FIRMNESS_VERY_SOFT, .firmness = BERRY_FIRMNESS_VERY_SOFT,
@ -677,6 +743,8 @@ const struct Berry gBerries[] =
.sour = 40, .sour = 40,
.smoothness = 70, .smoothness = 70,
}, },
[ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("LIECHI"), .name = _("LIECHI"),
.firmness = BERRY_FIRMNESS_VERY_HARD, .firmness = BERRY_FIRMNESS_VERY_HARD,
@ -693,6 +761,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 80, .smoothness = 80,
}, },
[ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("GANLON"), .name = _("GANLON"),
.firmness = BERRY_FIRMNESS_VERY_HARD, .firmness = BERRY_FIRMNESS_VERY_HARD,
@ -709,6 +779,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 80, .smoothness = 80,
}, },
[ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("SALAC"), .name = _("SALAC"),
.firmness = BERRY_FIRMNESS_VERY_HARD, .firmness = BERRY_FIRMNESS_VERY_HARD,
@ -725,6 +797,8 @@ const struct Berry gBerries[] =
.sour = 40, .sour = 40,
.smoothness = 80, .smoothness = 80,
}, },
[ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("PETAYA"), .name = _("PETAYA"),
.firmness = BERRY_FIRMNESS_VERY_HARD, .firmness = BERRY_FIRMNESS_VERY_HARD,
@ -741,6 +815,8 @@ const struct Berry gBerries[] =
.sour = 0, .sour = 0,
.smoothness = 80, .smoothness = 80,
}, },
[ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("APICOT"), .name = _("APICOT"),
.firmness = BERRY_FIRMNESS_HARD, .firmness = BERRY_FIRMNESS_HARD,
@ -757,6 +833,8 @@ const struct Berry gBerries[] =
.sour = 40, .sour = 40,
.smoothness = 80, .smoothness = 80,
}, },
[ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("LANSAT"), .name = _("LANSAT"),
.firmness = BERRY_FIRMNESS_SOFT, .firmness = BERRY_FIRMNESS_SOFT,
@ -773,6 +851,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 30, .smoothness = 30,
}, },
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("STARF"), .name = _("STARF"),
.firmness = BERRY_FIRMNESS_SUPER_HARD, .firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -789,6 +869,8 @@ const struct Berry gBerries[] =
.sour = 10, .sour = 10,
.smoothness = 30, .smoothness = 30,
}, },
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] =
{ {
.name = _("ENIGMA"), .name = _("ENIGMA"),
.firmness = BERRY_FIRMNESS_UNKNOWN, .firmness = BERRY_FIRMNESS_UNKNOWN,

View File

@ -423,142 +423,143 @@ const u8 gDeadBerryTreeEventObjectGraphicsIdTable[] = {EVENT_OBJ_GFX_BERRY_TREE_
const u8 gBerryTreeEventObjectGraphicsIdTable[] = {EVENT_OBJ_GFX_BERRY_TREE_EARLY_STAGES, EVENT_OBJ_GFX_BERRY_TREE_EARLY_STAGES, EVENT_OBJ_GFX_BERRY_TREE_LATE_STAGES, EVENT_OBJ_GFX_BERRY_TREE_LATE_STAGES, EVENT_OBJ_GFX_BERRY_TREE_LATE_STAGES}; const u8 gBerryTreeEventObjectGraphicsIdTable[] = {EVENT_OBJ_GFX_BERRY_TREE_EARLY_STAGES, EVENT_OBJ_GFX_BERRY_TREE_EARLY_STAGES, EVENT_OBJ_GFX_BERRY_TREE_LATE_STAGES, EVENT_OBJ_GFX_BERRY_TREE_LATE_STAGES, EVENT_OBJ_GFX_BERRY_TREE_LATE_STAGES};
const struct SpriteFrameImage *const gBerryTreePicTablePointers[] = { const struct SpriteFrameImage *const gBerryTreePicTablePointers[] = {
gEventObjectPicTable_CheriBerryTree, [ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_CheriBerryTree,
gEventObjectPicTable_ChestoBerryTree, [ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_ChestoBerryTree,
gEventObjectPicTable_PechaBerryTree, [ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PechaBerryTree,
gEventObjectPicTable_RawstBerryTree, [ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RawstBerryTree,
gEventObjectPicTable_AspearBerryTree, [ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_AspearBerryTree,
gEventObjectPicTable_LeppaBerryTree, [ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LeppaBerryTree,
gEventObjectPicTable_OranBerryTree, [ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_OranBerryTree,
gEventObjectPicTable_PersimBerryTree, [ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PersimBerryTree,
gEventObjectPicTable_LumBerryTree, [ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LumBerryTree,
gEventObjectPicTable_SitrusBerryTree, [ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_SitrusBerryTree,
gEventObjectPicTable_FigyBerryTree, [ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_FigyBerryTree,
gEventObjectPicTable_WikiBerryTree, [ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_WikiBerryTree,
gEventObjectPicTable_MagoBerryTree, [ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_MagoBerryTree,
gEventObjectPicTable_AguavBerryTree, [ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_AguavBerryTree,
gEventObjectPicTable_IapapaBerryTree, [ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_IapapaBerryTree,
gEventObjectPicTable_RazzBerryTree, [ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RazzBerryTree,
gEventObjectPicTable_RazzBerryTree, [ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RazzBerryTree,
gEventObjectPicTable_MagoBerryTree, [ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_MagoBerryTree,
gEventObjectPicTable_WepearBerryTree, [ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_WepearBerryTree,
gEventObjectPicTable_IapapaBerryTree, [ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_IapapaBerryTree,
gEventObjectPicTable_PomegBerryTree, [ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PomegBerryTree,
gEventObjectPicTable_KelpsyBerryTree, [ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_KelpsyBerryTree,
gEventObjectPicTable_WepearBerryTree, [ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_WepearBerryTree,
gEventObjectPicTable_HondewBerryTree, [ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_HondewBerryTree,
gEventObjectPicTable_GrepaBerryTree, [ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_GrepaBerryTree,
gEventObjectPicTable_TamatoBerryTree, [ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_TamatoBerryTree,
gEventObjectPicTable_CornnBerryTree, [ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_CornnBerryTree,
gEventObjectPicTable_PomegBerryTree, [ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PomegBerryTree,
gEventObjectPicTable_RabutaBerryTree, [ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RabutaBerryTree,
gEventObjectPicTable_NomelBerryTree, [ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_NomelBerryTree,
gEventObjectPicTable_SpelonBerryTree, [ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_SpelonBerryTree,
gEventObjectPicTable_PamtreBerryTree, [ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PamtreBerryTree,
gEventObjectPicTable_RabutaBerryTree, [ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RabutaBerryTree,
gEventObjectPicTable_DurinBerryTree, [ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_DurinBerryTree,
gEventObjectPicTable_HondewBerryTree, [ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_HondewBerryTree,
gEventObjectPicTable_LiechiBerryTree, [ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LiechiBerryTree,
gEventObjectPicTable_HondewBerryTree, [ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_HondewBerryTree,
gEventObjectPicTable_AguavBerryTree, [ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_AguavBerryTree,
gEventObjectPicTable_PomegBerryTree, [ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PomegBerryTree,
gEventObjectPicTable_GrepaBerryTree, [ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_GrepaBerryTree,
gEventObjectPicTable_LansatBerryTree, [ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LansatBerryTree,
gEventObjectPicTable_CornnBerryTree, [ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_CornnBerryTree,
gEventObjectPicTable_DurinBerryTree, [ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_DurinBerryTree,
}; };
const u8 *const gBerryTreePaletteSlotTablePointers[] = { const u8 *const gBerryTreePaletteSlotTablePointers[] = {
gBerryTreePaletteSlotTable_Cheri, [ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Cheri,
gBerryTreePaletteSlotTable_Chesto, [ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Chesto,
gBerryTreePaletteSlotTable_Pecha, [ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pecha,
gBerryTreePaletteSlotTable_Rawst, [ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Rawst,
gBerryTreePaletteSlotTable_Aspear, [ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Aspear,
gBerryTreePaletteSlotTable_Leppa, [ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Leppa,
gBerryTreePaletteSlotTable_Oran, [ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Oran,
gBerryTreePaletteSlotTable_Persim, [ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Persim,
gBerryTreePaletteSlotTable_Lum, [ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Lum,
gBerryTreePaletteSlotTable_Sitrus, [ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Sitrus,
gBerryTreePaletteSlotTable_Figy, [ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Figy,
gBerryTreePaletteSlotTable_Wiki, [ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Wiki,
gBerryTreePaletteSlotTable_Mago, [ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Mago,
gBerryTreePaletteSlotTable_Aguav, [ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Aguav,
gBerryTreePaletteSlotTable_Iapapa, [ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Iapapa,
gBerryTreePaletteSlotTable_Razz, [ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Razz,
gBerryTreePaletteSlotTable_Razz, [ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Razz,
gBerryTreePaletteSlotTable_Mago, [ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Mago,
gBerryTreePaletteSlotTable_Wepear, [ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Wepear,
gBerryTreePaletteSlotTable_Iapapa, [ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Iapapa,
gBerryTreePaletteSlotTable_Pomeg, [ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pomeg,
gBerryTreePaletteSlotTable_Kelpsy, [ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Kelpsy,
gBerryTreePaletteSlotTable_Wepear, [ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Wepear,
gBerryTreePaletteSlotTable_Hondew, [ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Hondew,
gBerryTreePaletteSlotTable_Grepa, [ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Grepa,
gBerryTreePaletteSlotTable_Tamato, [ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Tamato,
gBerryTreePaletteSlotTable_Cornn, [ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Cornn,
gBerryTreePaletteSlotTable_Pomeg, [ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pomeg,
gBerryTreePaletteSlotTable_Rabuta, [ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Rabuta,
gBerryTreePaletteSlotTable_Nomel, [ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Nomel,
gBerryTreePaletteSlotTable_Spelon, [ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Spelon,
gBerryTreePaletteSlotTable_Pamtre, [ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pamtre,
gBerryTreePaletteSlotTable_Rabuta, [ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Rabuta,
gBerryTreePaletteSlotTable_Durin, [ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Durin,
gBerryTreePaletteSlotTable_Hondew, [ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Hondew,
gBerryTreePaletteSlotTable_Liechi, [ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Liechi,
gBerryTreePaletteSlotTable_Hondew, [ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Hondew,
gBerryTreePaletteSlotTable_Aguav, [ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Aguav,
gBerryTreePaletteSlotTable_Pomeg, [ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pomeg,
gBerryTreePaletteSlotTable_Grepa, [ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Grepa,
gBerryTreePaletteSlotTable_Lansat, [ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Lansat,
gBerryTreePaletteSlotTable_Cornn, [ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Cornn,
gBerryTreePaletteSlotTable_Durin, [ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Durin,
}; };
const u8 *const gBerryTreeEventObjectGraphicsIdTablePointers[] = { const u8 *const gBerryTreeEventObjectGraphicsIdTablePointers[] = {
gBerryTreeEventObjectGraphicsIdTable, [ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, // 3 unused berries.
gBerryTreeEventObjectGraphicsIdTable, [ITEM_0B0 - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable, [ITEM_0B1 - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_0B2 - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
}; };

View File

@ -25,6 +25,7 @@
#include "constants/event_object_movement_constants.h" #include "constants/event_object_movement_constants.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
#include "constants/field_effects.h" #include "constants/field_effects.h"
#include "constants/items.h"
// this file was known as evobjmv.c in Game Freak's original source // this file was known as evobjmv.c in Game Freak's original source
@ -2005,10 +2006,9 @@ static void get_berry_tree_graphics(struct EventObject *eventObject, struct Spri
sprite->invisible = FALSE; sprite->invisible = FALSE;
berryId = GetBerryTypeByBerryTreeId(eventObject->trainerRange_berryTreeId) - 1; berryId = GetBerryTypeByBerryTreeId(eventObject->trainerRange_berryTreeId) - 1;
berryStage--; berryStage--;
if (berryId >= NUM_BERRIES) if (berryId > ITEM_TO_BERRY(LAST_BERRY_INDEX))
{
berryId = 0; berryId = 0;
}
EventObjectSetGraphicsId(eventObject, gBerryTreeEventObjectGraphicsIdTablePointers[berryId][berryStage]); EventObjectSetGraphicsId(eventObject, gBerryTreeEventObjectGraphicsIdTablePointers[berryId][berryStage]);
sprite->images = gBerryTreePicTablePointers[berryId]; sprite->images = gBerryTreePicTablePointers[berryId];
sprite->oam.paletteNum = gBerryTreePaletteSlotTablePointers[berryId][berryStage]; sprite->oam.paletteNum = gBerryTreePaletteSlotTablePointers[berryId][berryStage];