Skip to content

Commit

Permalink
Added OBJ_EVENT_GFX_SPECIES_SHINY
Browse files Browse the repository at this point in the history
  • Loading branch information
AsparagusEduardo committed Jul 28, 2024
1 parent 18aff2d commit 9cc7ecd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/constants/event_objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions include/constants/species.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions include/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/event_object_movement.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 9cc7ecd

Please sign in to comment.