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,
};
#define NUM_BERRIES 44
extern const u8 *const gBerryTreeEventObjectGraphicsIdTablePointers[];
extern const struct SpriteFrameImage *const gBerryTreePicTablePointers[];
extern const u8 *const gBerryTreePaletteSlotTablePointers[];
void ClearEnigmaBerries(void);
void SetEnigmaBerry(u8 *src);
bool32 IsEnigmaBerryValid(void);

View File

@ -64,6 +64,10 @@ extern const struct OamData gEventObjectBaseOam_32x32;
extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[];
extern const u8 gReflectionEffectPaletteMap[];
extern const u8 *const gBerryTreeEventObjectGraphicsIdTablePointers[];
extern const struct SpriteFrameImage *const gBerryTreePicTablePointers[];
extern const u8 *const gBerryTreePaletteSlotTablePointers[];
void ResetEventObjects(void);
u8 GetMoveDirectionAnimNum(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_CushionInteract[];
extern const u8 BerryTreeScript[];
extern const u8 gTVBravoTrainerText00[];
extern const u8 gTVBravoTrainerText01[];

View File

@ -1,6 +1,8 @@
#include "global.h"
#include "berry.h"
#include "event_data.h"
#include "event_object_movement.h"
#include "event_scripts.h"
#include "field_control_avatar.h"
#include "fieldmap.h"
#include "item.h"
@ -11,11 +13,6 @@
#include "text.h"
#include "constants/event_object_movement_constants.h"
#include "constants/items.h"
#include "event_object_movement.h"
extern const u8 BerryTreeScript[];
static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry);
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[] =
{
[ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("CHERI"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -133,6 +131,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("CHESTO"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -149,6 +149,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("PECHA"),
.firmness = BERRY_FIRMNESS_VERY_SOFT,
@ -165,6 +167,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("RAWST"),
.firmness = BERRY_FIRMNESS_HARD,
@ -181,6 +185,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("ASPEAR"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -197,6 +203,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 25,
},
[ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("LEPPA"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -213,6 +221,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("ORAN"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -229,6 +239,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("PERSIM"),
.firmness = BERRY_FIRMNESS_HARD,
@ -245,6 +257,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_LUM_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("LUM"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -261,6 +275,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("SITRUS"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -277,6 +293,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("FIGY"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -293,6 +311,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("WIKI"),
.firmness = BERRY_FIRMNESS_HARD,
@ -309,6 +329,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("MAGO"),
.firmness = BERRY_FIRMNESS_HARD,
@ -325,6 +347,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("AGUAV"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -341,6 +365,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("IAPAPA"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -357,6 +383,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 25,
},
[ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("RAZZ"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -373,6 +401,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 20,
},
[ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("BLUK"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -389,6 +419,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 20,
},
[ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("NANAB"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -405,6 +437,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 20,
},
[ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("WEPEAR"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -421,6 +455,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("PINAP"),
.firmness = BERRY_FIRMNESS_HARD,
@ -437,6 +473,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("POMEG"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -453,6 +491,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 20,
},
[ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("KELPSY"),
.firmness = BERRY_FIRMNESS_HARD,
@ -469,6 +509,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("QUALOT"),
.firmness = BERRY_FIRMNESS_HARD,
@ -485,6 +527,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("HONDEW"),
.firmness = BERRY_FIRMNESS_HARD,
@ -501,6 +545,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 20,
},
[ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("GREPA"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -517,6 +563,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("TAMATO"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -533,6 +581,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 30,
},
[ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("CORNN"),
.firmness = BERRY_FIRMNESS_HARD,
@ -549,6 +599,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 30,
},
[ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("MAGOST"),
.firmness = BERRY_FIRMNESS_HARD,
@ -565,6 +617,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 30,
},
[ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("RABUTA"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -581,6 +635,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 30,
},
[ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("NOMEL"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -597,6 +653,8 @@ const struct Berry gBerries[] =
.sour = 20,
.smoothness = 30,
},
[ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("SPELON"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -613,6 +671,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 70,
},
[ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("PAMTRE"),
.firmness = BERRY_FIRMNESS_VERY_SOFT,
@ -629,6 +689,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 70,
},
[ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("WATMEL"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -645,6 +707,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 70,
},
[ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("DURIN"),
.firmness = BERRY_FIRMNESS_HARD,
@ -661,6 +725,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 70,
},
[ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("BELUE"),
.firmness = BERRY_FIRMNESS_VERY_SOFT,
@ -677,6 +743,8 @@ const struct Berry gBerries[] =
.sour = 40,
.smoothness = 70,
},
[ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("LIECHI"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -693,6 +761,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 80,
},
[ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("GANLON"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -709,6 +779,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 80,
},
[ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("SALAC"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -725,6 +797,8 @@ const struct Berry gBerries[] =
.sour = 40,
.smoothness = 80,
},
[ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("PETAYA"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -741,6 +815,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 80,
},
[ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("APICOT"),
.firmness = BERRY_FIRMNESS_HARD,
@ -757,6 +833,8 @@ const struct Berry gBerries[] =
.sour = 40,
.smoothness = 80,
},
[ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("LANSAT"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -773,6 +851,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 30,
},
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("STARF"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -789,6 +869,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 30,
},
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("ENIGMA"),
.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 struct SpriteFrameImage *const gBerryTreePicTablePointers[] = {
gEventObjectPicTable_CheriBerryTree,
gEventObjectPicTable_ChestoBerryTree,
gEventObjectPicTable_PechaBerryTree,
gEventObjectPicTable_RawstBerryTree,
gEventObjectPicTable_AspearBerryTree,
gEventObjectPicTable_LeppaBerryTree,
gEventObjectPicTable_OranBerryTree,
gEventObjectPicTable_PersimBerryTree,
gEventObjectPicTable_LumBerryTree,
gEventObjectPicTable_SitrusBerryTree,
gEventObjectPicTable_FigyBerryTree,
gEventObjectPicTable_WikiBerryTree,
gEventObjectPicTable_MagoBerryTree,
gEventObjectPicTable_AguavBerryTree,
gEventObjectPicTable_IapapaBerryTree,
gEventObjectPicTable_RazzBerryTree,
gEventObjectPicTable_RazzBerryTree,
gEventObjectPicTable_MagoBerryTree,
gEventObjectPicTable_WepearBerryTree,
gEventObjectPicTable_IapapaBerryTree,
gEventObjectPicTable_PomegBerryTree,
gEventObjectPicTable_KelpsyBerryTree,
gEventObjectPicTable_WepearBerryTree,
gEventObjectPicTable_HondewBerryTree,
gEventObjectPicTable_GrepaBerryTree,
gEventObjectPicTable_TamatoBerryTree,
gEventObjectPicTable_CornnBerryTree,
gEventObjectPicTable_PomegBerryTree,
gEventObjectPicTable_RabutaBerryTree,
gEventObjectPicTable_NomelBerryTree,
gEventObjectPicTable_SpelonBerryTree,
gEventObjectPicTable_PamtreBerryTree,
gEventObjectPicTable_RabutaBerryTree,
gEventObjectPicTable_DurinBerryTree,
gEventObjectPicTable_HondewBerryTree,
gEventObjectPicTable_LiechiBerryTree,
gEventObjectPicTable_HondewBerryTree,
gEventObjectPicTable_AguavBerryTree,
gEventObjectPicTable_PomegBerryTree,
gEventObjectPicTable_GrepaBerryTree,
gEventObjectPicTable_LansatBerryTree,
gEventObjectPicTable_CornnBerryTree,
gEventObjectPicTable_DurinBerryTree,
[ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_CheriBerryTree,
[ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_ChestoBerryTree,
[ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PechaBerryTree,
[ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RawstBerryTree,
[ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_AspearBerryTree,
[ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LeppaBerryTree,
[ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_OranBerryTree,
[ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PersimBerryTree,
[ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LumBerryTree,
[ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_SitrusBerryTree,
[ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_FigyBerryTree,
[ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_WikiBerryTree,
[ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_MagoBerryTree,
[ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_AguavBerryTree,
[ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_IapapaBerryTree,
[ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RazzBerryTree,
[ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RazzBerryTree,
[ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_MagoBerryTree,
[ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_WepearBerryTree,
[ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_IapapaBerryTree,
[ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PomegBerryTree,
[ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_KelpsyBerryTree,
[ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_WepearBerryTree,
[ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_HondewBerryTree,
[ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_GrepaBerryTree,
[ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_TamatoBerryTree,
[ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_CornnBerryTree,
[ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PomegBerryTree,
[ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RabutaBerryTree,
[ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_NomelBerryTree,
[ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_SpelonBerryTree,
[ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PamtreBerryTree,
[ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RabutaBerryTree,
[ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_DurinBerryTree,
[ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_HondewBerryTree,
[ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LiechiBerryTree,
[ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_HondewBerryTree,
[ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_AguavBerryTree,
[ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PomegBerryTree,
[ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_GrepaBerryTree,
[ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LansatBerryTree,
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_CornnBerryTree,
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_DurinBerryTree,
};
const u8 *const gBerryTreePaletteSlotTablePointers[] = {
gBerryTreePaletteSlotTable_Cheri,
gBerryTreePaletteSlotTable_Chesto,
gBerryTreePaletteSlotTable_Pecha,
gBerryTreePaletteSlotTable_Rawst,
gBerryTreePaletteSlotTable_Aspear,
gBerryTreePaletteSlotTable_Leppa,
gBerryTreePaletteSlotTable_Oran,
gBerryTreePaletteSlotTable_Persim,
gBerryTreePaletteSlotTable_Lum,
gBerryTreePaletteSlotTable_Sitrus,
gBerryTreePaletteSlotTable_Figy,
gBerryTreePaletteSlotTable_Wiki,
gBerryTreePaletteSlotTable_Mago,
gBerryTreePaletteSlotTable_Aguav,
gBerryTreePaletteSlotTable_Iapapa,
gBerryTreePaletteSlotTable_Razz,
gBerryTreePaletteSlotTable_Razz,
gBerryTreePaletteSlotTable_Mago,
gBerryTreePaletteSlotTable_Wepear,
gBerryTreePaletteSlotTable_Iapapa,
gBerryTreePaletteSlotTable_Pomeg,
gBerryTreePaletteSlotTable_Kelpsy,
gBerryTreePaletteSlotTable_Wepear,
gBerryTreePaletteSlotTable_Hondew,
gBerryTreePaletteSlotTable_Grepa,
gBerryTreePaletteSlotTable_Tamato,
gBerryTreePaletteSlotTable_Cornn,
gBerryTreePaletteSlotTable_Pomeg,
gBerryTreePaletteSlotTable_Rabuta,
gBerryTreePaletteSlotTable_Nomel,
gBerryTreePaletteSlotTable_Spelon,
gBerryTreePaletteSlotTable_Pamtre,
gBerryTreePaletteSlotTable_Rabuta,
gBerryTreePaletteSlotTable_Durin,
gBerryTreePaletteSlotTable_Hondew,
gBerryTreePaletteSlotTable_Liechi,
gBerryTreePaletteSlotTable_Hondew,
gBerryTreePaletteSlotTable_Aguav,
gBerryTreePaletteSlotTable_Pomeg,
gBerryTreePaletteSlotTable_Grepa,
gBerryTreePaletteSlotTable_Lansat,
gBerryTreePaletteSlotTable_Cornn,
gBerryTreePaletteSlotTable_Durin,
[ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Cheri,
[ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Chesto,
[ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pecha,
[ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Rawst,
[ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Aspear,
[ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Leppa,
[ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Oran,
[ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Persim,
[ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Lum,
[ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Sitrus,
[ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Figy,
[ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Wiki,
[ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Mago,
[ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Aguav,
[ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Iapapa,
[ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Razz,
[ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Razz,
[ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Mago,
[ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Wepear,
[ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Iapapa,
[ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pomeg,
[ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Kelpsy,
[ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Wepear,
[ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Hondew,
[ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Grepa,
[ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Tamato,
[ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Cornn,
[ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pomeg,
[ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Rabuta,
[ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Nomel,
[ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Spelon,
[ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pamtre,
[ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Rabuta,
[ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Durin,
[ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Hondew,
[ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Liechi,
[ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Hondew,
[ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Aguav,
[ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pomeg,
[ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Grepa,
[ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Lansat,
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Cornn,
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Durin,
};
const u8 *const gBerryTreeEventObjectGraphicsIdTablePointers[] = {
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
[ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
// 3 unused berries.
[ITEM_0B0 - FIRST_BERRY_INDEX] = 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_objects.h"
#include "constants/field_effects.h"
#include "constants/items.h"
// 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;
berryId = GetBerryTypeByBerryTreeId(eventObject->trainerRange_berryTreeId) - 1;
berryStage--;
if (berryId >= NUM_BERRIES)
{
if (berryId > ITEM_TO_BERRY(LAST_BERRY_INDEX))
berryId = 0;
}
EventObjectSetGraphicsId(eventObject, gBerryTreeEventObjectGraphicsIdTablePointers[berryId][berryStage]);
sprite->images = gBerryTreePicTablePointers[berryId];
sprite->oam.paletteNum = gBerryTreePaletteSlotTablePointers[berryId][berryStage];