From d88834dd586eef503bb677f9425f5876cfb6a05b Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 7 Aug 2024 13:42:18 -0400 Subject: [PATCH 1/2] Backported OBJ_EVENT_GFX_SPECIES macro from Expansion --- data/maps/DesertRuins/map.json | 2 +- data/maps/IslandCave/map.json | 2 +- include/constants/event_objects.h | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) 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..4eaa82b75d 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -280,6 +280,9 @@ #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 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) From e6e2285c441ba0b3965365f7a9f7c1919ea53d9c Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 11 Aug 2024 14:50:38 -0400 Subject: [PATCH 2/2] Added OBJ_EVENT_GFX_SPECIES_SHINY --- include/constants/event_objects.h | 1 + include/constants/species.h | 2 ++ include/data.h | 1 - src/event_object_movement.c | 8 ++++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index 4eaa82b75d..2e7ec7939f 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -282,6 +282,7 @@ // 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;