From 9cc7ecdbc2ca4b97001b1d6d22e88a93647b2263 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 28 Jul 2024 00:40:06 -0400 Subject: [PATCH] Added OBJ_EVENT_GFX_SPECIES_SHINY --- include/constants/event_objects.h | 3 ++- include/constants/species.h | 2 ++ include/data.h | 2 -- src/event_object_movement.c | 7 +++++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index f4268d9f0294..e2ac7f792068 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -275,7 +275,8 @@ #define OBJ_EVENT_GFX_SPECIES_MASK ((1 << OBJ_EVENT_GFX_SPECIES_BITS) - 1) // Used to call a specific species' follower graphics. Useful for static encounters. -#define OBJ_EVENT_GFX_SPECIES(name) (OBJ_EVENT_GFX_MON_BASE + SPECIES_##name) +#define OBJ_EVENT_GFX_SPECIES(name) (SPECIES_##name + OBJ_EVENT_GFX_MON_BASE) +#define OBJ_EVENT_GFX_SPECIES_SHINY(name) (SPECIES_##name + OBJ_EVENT_GFX_MON_BASE + SPECIES_SHINY_TAG) #define OW_SPECIES(x) (((x)->graphicsId & OBJ_EVENT_GFX_SPECIES_MASK) - OBJ_EVENT_GFX_MON_BASE) #define OW_FORM(x) ((x)->graphicsId >> OBJ_EVENT_GFX_SPECIES_BITS) diff --git a/include/constants/species.h b/include/constants/species.h index 685ebae474dd..895e444d51d2 100644 --- a/include/constants/species.h +++ b/include/constants/species.h @@ -1633,6 +1633,8 @@ #define NUM_SPECIES SPECIES_EGG +#define SPECIES_SHINY_TAG 5000 + // Competitive format aliases #define SPECIES_ALCREMIE_GMAX SPECIES_ALCREMIE_GIGANTAMAX #define SPECIES_APPLETUN_GMAX SPECIES_APPLETUN_GIGANTAMAX diff --git a/include/data.h b/include/data.h index e514cadd9aa0..69c1a19a3c49 100644 --- a/include/data.h +++ b/include/data.h @@ -4,8 +4,6 @@ #include "constants/moves.h" #include "constants/trainers.h" -#define SPECIES_SHINY_TAG 5000 - #define MAX_TRAINER_ITEMS 4 #define TRAINER_PIC_WIDTH 64 diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 80a36d6818e4..25ecf48cd812 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1598,6 +1598,11 @@ static u8 TrySetupObjectEventSprite(const struct ObjectEventTemplate *objectEven if (OW_GFX_COMPRESS) spriteTemplate->tileTag = LoadSheetGraphicsInfo(graphicsInfo, objectEvent->graphicsId, NULL); + if (objectEvent->graphicsId >= OBJ_EVENT_GFX_MON_BASE + SPECIES_SHINY_TAG) + { + objectEvent->shiny = TRUE; + objectEvent->graphicsId -= SPECIES_SHINY_TAG; + } spriteId = CreateSprite(spriteTemplate, 0, 0, 0); if (spriteId == MAX_SPRITES) @@ -2751,6 +2756,8 @@ const struct ObjectEventGraphicsInfo *GetObjectEventGraphicsInfo(u16 graphicsId) if (graphicsId >= OBJ_EVENT_GFX_VARS && graphicsId <= OBJ_EVENT_GFX_VAR_F) graphicsId = VarGetObjectEventGraphicsId(graphicsId - OBJ_EVENT_GFX_VARS); + if (graphicsId >= OBJ_EVENT_GFX_MON_BASE + SPECIES_SHINY_TAG) + graphicsId -= SPECIES_SHINY_TAG; // graphicsId may contain mon form info if (graphicsId > OBJ_EVENT_GFX_SPECIES_MASK) {