diff --git a/data/maps/DesertRuins/map.json b/data/maps/DesertRuins/map.json index 80c8f6a483..be0a28481a 100644 --- a/data/maps/DesertRuins/map.json +++ b/data/maps/DesertRuins/map.json @@ -15,7 +15,7 @@ "connections": null, "object_events": [ { - "graphics_id": "OBJ_EVENT_GFX_MON_BASE+SPECIES_REGIROCK", + "graphics_id": "OBJ_EVENT_GFX_SPECIES(REGIROCK)", "x": 8, "y": 7, "elevation": 3, diff --git a/data/maps/IslandCave/map.json b/data/maps/IslandCave/map.json index c6204ff1c5..142ec122d6 100644 --- a/data/maps/IslandCave/map.json +++ b/data/maps/IslandCave/map.json @@ -15,7 +15,7 @@ "connections": 0, "object_events": [ { - "graphics_id": "OBJ_EVENT_GFX_MON_BASE+SPECIES_REGICE", + "graphics_id": "OBJ_EVENT_GFX_SPECIES(REGICE)", "x": 8, "y": 7, "elevation": 3, diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index dc4fdf8870..2e7ec7939f 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -280,6 +280,10 @@ #define OBJ_EVENT_GFX_SPECIES_BITS 11 #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) (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 ec60c142ed..e6b6120a4f 100644 --- a/include/constants/species.h +++ b/include/constants/species.h @@ -419,6 +419,8 @@ #define NUM_SPECIES SPECIES_EGG +#define SPECIES_SHINY_TAG 500 + #define SPECIES_UNOWN_B (NUM_SPECIES + 1) #define SPECIES_UNOWN_C (SPECIES_UNOWN_B + 1) #define SPECIES_UNOWN_D (SPECIES_UNOWN_B + 2) diff --git a/include/data.h b/include/data.h index 99b695d72f..ef11242801 100644 --- a/include/data.h +++ b/include/data.h @@ -3,7 +3,6 @@ #include "constants/moves.h" -#define SPECIES_SHINY_TAG 500 #define N_FOLLOWER_HAPPY_MESSAGES 31 #define N_FOLLOWER_NEUTRAL_MESSAGES 14 #define N_FOLLOWER_SAD_MESSAGES 3 diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 77aee61fc0..a19d7a5169 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1672,6 +1672,12 @@ static u8 TrySetupObjectEventSprite(const struct ObjectEventTemplate *objectEven spriteTemplate->tileTag = LoadSheetGraphicsInfo(graphicsInfo, objectEvent->graphicsId, NULL); #endif + 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) { @@ -2749,6 +2755,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) { form = graphicsId >> OBJ_EVENT_GFX_SPECIES_BITS;