Skip to content

Commit

Permalink
Merge branch '_RHH/master' into _RHH/upcoming
Browse files Browse the repository at this point in the history
  • Loading branch information
AsparagusEduardo committed Feb 7, 2025
2 parents f9ad409 + 82b0eff commit e29e1c6
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 163 deletions.
20 changes: 12 additions & 8 deletions include/constants/event_objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,23 @@
#define OBJ_EVENT_GFX_VAR_E (OBJ_EVENT_GFX_VARS + 0xE)
#define OBJ_EVENT_GFX_VAR_F (OBJ_EVENT_GFX_VARS + 0xF)

#define OBJ_EVENT_GFX_MON_BASE 0x200 // 512
#define OBJ_EVENT_GFX_SPECIES_BITS 12 // This will need to be updated when NUM_SPECIES is > ~3.5k
#define OBJ_EVENT_GFX_SPECIES_MASK ((1 << OBJ_EVENT_GFX_SPECIES_BITS) - 1)
#define OBJ_EVENT_MON (1 << 13)
#define OBJ_EVENT_MON_SHINY (1 << 14)
#define OBJ_EVENT_MON_FEMALE (1 << 15)
#define OBJ_EVENT_MON_SPECIES_MASK (OBJ_EVENT_MON - 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 OBJ_EVENT_GFX_SPECIES(name) (SPECIES_##name + OBJ_EVENT_MON)
#define OBJ_EVENT_GFX_SPECIES_SHINY(name) (SPECIES_##name + OBJ_EVENT_MON + OBJ_EVENT_MON_SHINY)
#define OBJ_EVENT_GFX_SPECIES_FEMALE(name) (SPECIES_##name + OBJ_EVENT_MON + OBJ_EVENT_MON_FEMALE)
#define OBJ_EVENT_GFX_SPECIES_SHINY_FEMALE(name) (SPECIES_##name + OBJ_EVENT_MON + OBJ_EVENT_MON_SHINY + OBJ_EVENT_MON_FEMALE)

#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)
#define OW_SPECIES(x) ((x)->graphicsId & OBJ_EVENT_MON_SPECIES_MASK)
#define OW_SHINY(x) ((x)->graphicsId & OBJ_EVENT_MON_SHINY)
#define OW_FEMALE(x) ((x)->graphicsId & OBJ_EVENT_MON_FEMALE)

// Whether Object Event is an OW pokemon
#define IS_OW_MON_OBJ(obj) ((obj)->graphicsId >= OBJ_EVENT_GFX_MON_BASE)
#define IS_OW_MON_OBJ(obj) ((obj)->graphicsId & OBJ_EVENT_MON)

#define SHADOW_SIZE_S 0
#define SHADOW_SIZE_M 1
Expand Down
8 changes: 0 additions & 8 deletions include/event_object_movement.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,6 @@ struct LockedAnimObjectEvents
u8 count;
};

struct FollowerSpriteVisualizerData
{
u16 currentmonId;
bool8 isShiny;
bool8 isFemale;
};

extern const struct OamData gObjectEventBaseOam_32x8;
extern const struct OamData gObjectEventBaseOam_32x32;
extern const struct OamData gObjectEventBaseOam_64x64;
Expand Down Expand Up @@ -154,7 +147,6 @@ void RemoveFollowingPokemon(void);
struct ObjectEvent *GetFollowerObject(void);
void TrySpawnObjectEvents(s16 cameraX, s16 cameraY);
u8 CreateObjectGraphicsSprite(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority);
u8 CreateObjectGraphicsFollowerSpriteForVisualizer(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority, struct FollowerSpriteVisualizerData *data);
u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup);
u8 SpawnSpecialObjectEventParameterized(u16 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 elevation);
u8 SpawnSpecialObjectEvent(struct ObjectEventTemplate *);
Expand Down
2 changes: 1 addition & 1 deletion src/data/moves_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -15152,7 +15152,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_DYNAMAX] =
{
.name = COMPOUND_STRING("Nuzzle"),
.description = COMPOUND_STRING(
"Rubs its cheecks against\n"
"Rubs its cheeks against\n"
"the foe, paralyzing it."),
.effect = EFFECT_HIT,
.power = 20,
Expand Down
224 changes: 94 additions & 130 deletions src/event_object_movement.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/load_save.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void LoadObjectEvents(void)
// Try to restore saved inactive follower
if (gObjectEvents[i].localId == OBJ_EVENT_ID_FOLLOWER &&
!gObjectEvents[i].active &&
gObjectEvents[i].graphicsId >= OBJ_EVENT_GFX_MON_BASE)
gObjectEvents[i].graphicsId & OBJ_EVENT_MON)
gObjectEvents[i].active = TRUE;
}
}
Expand Down
18 changes: 8 additions & 10 deletions src/pokemon_sprite_visualizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ void CB2_Pokemon_Sprite_Visualizer(void)
gSprites[data->iconspriteId].oam.priority = 0;

//Follower Sprite
data->followerspriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_MON_BASE + species, SpriteCB_Follower, VISUALIZER_FOLLOWER_X, VISUALIZER_FOLLOWER_Y, 0);
data->followerspriteId = CreateObjectGraphicsSprite(OBJ_EVENT_MON + species, SpriteCB_Follower, VISUALIZER_FOLLOWER_X, VISUALIZER_FOLLOWER_Y, 0);
gSprites[data->followerspriteId].oam.priority = 0;
gSprites[data->followerspriteId].anims = sAnims_Follower;

Expand Down Expand Up @@ -2002,18 +2002,16 @@ static void ReloadPokemonSprites(struct PokemonSpriteVisualizer *data)
gSprites[data->iconspriteId].oam.priority = 0;

//Follower Sprite
u16 graphicsId = (OBJ_EVENT_GFX_MON_BASE + species) & OBJ_EVENT_GFX_SPECIES_MASK;
struct FollowerSpriteVisualizerData followerData;
followerData.currentmonId = graphicsId;
followerData.isFemale = data->isFemale;
followerData.isShiny = data->isShiny;
graphicsId |= data->isFemale << OBJ_EVENT_GFX_SPECIES_BITS;
data->followerspriteId = CreateObjectGraphicsFollowerSpriteForVisualizer(graphicsId,
u16 graphicsId = species + OBJ_EVENT_MON;
if (data->isShiny)
graphicsId += OBJ_EVENT_MON_SHINY;
if (data->isFemale)
graphicsId += OBJ_EVENT_MON_FEMALE;
data->followerspriteId = CreateObjectGraphicsSprite(graphicsId,
SpriteCB_Follower,
VISUALIZER_FOLLOWER_X,
VISUALIZER_FOLLOWER_Y,
0,
&followerData);
0);
gSprites[data->followerspriteId].oam.priority = 0;
gSprites[data->followerspriteId].anims = sAnims_Follower;

Expand Down
2 changes: 1 addition & 1 deletion src/scrcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2046,7 +2046,7 @@ bool8 ScrCmd_vmessage(struct ScriptContext *ctx)
bool8 ScrCmd_bufferspeciesname(struct ScriptContext *ctx)
{
u8 stringVarIndex = ScriptReadByte(ctx);
u16 species = VarGet(ScriptReadHalfword(ctx)) & OBJ_EVENT_GFX_SPECIES_MASK; // ignore possible shiny / form bits
u16 species = VarGet(ScriptReadHalfword(ctx)) & OBJ_EVENT_MON_SPECIES_MASK; // ignore possible shiny / form bits

Script_RequestEffects(SCREFF_V1);

Expand Down
2 changes: 1 addition & 1 deletion src/shop.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ static void BuyMenuCollectObjectEventData(void)
u8 objEventId = GetObjectEventIdByXY(facingX - 4 + x, facingY - 2 + y);

// skip if invalid or an overworld pokemon that is not following the player
if (objEventId != OBJECT_EVENTS_COUNT && !(gObjectEvents[objEventId].active && gObjectEvents[objEventId].graphicsId >= OBJ_EVENT_GFX_MON_BASE && gObjectEvents[objEventId].localId != OBJ_EVENT_ID_FOLLOWER))
if (objEventId != OBJECT_EVENTS_COUNT && !(gObjectEvents[objEventId].active && gObjectEvents[objEventId].graphicsId & OBJ_EVENT_MON && gObjectEvents[objEventId].localId != OBJ_EVENT_ID_FOLLOWER))
{
sShopData->viewportObjects[numObjects][OBJ_EVENT_ID] = objEventId;
sShopData->viewportObjects[numObjects][X_COORD] = x;
Expand Down
6 changes: 3 additions & 3 deletions test/battle/ability/sheer_force.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SINGLE_BATTLE_TEST("Sheer Force doesn't boost Eruption", s16 damage)
PLAYER(SPECIES_TAUROS) { Ability(ability); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_PRESENT); }
TURN { MOVE(player, MOVE_ERUPTION); }
} SCENE {
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
Expand All @@ -50,7 +50,7 @@ SINGLE_BATTLE_TEST("Sheer Force doesn't boost Water Spout", s16 damage)
PLAYER(SPECIES_TAUROS) { Ability(ability); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_PRESENT); }
TURN { MOVE(player, MOVE_WATER_SPOUT); }
} SCENE {
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
Expand Down Expand Up @@ -347,7 +347,7 @@ SINGLE_BATTLE_TEST("Sheer Force doesn't boost Comeuppance", s16 damage)
EXPECT_NE(results[0].damage, 0);
}
}
SINGLE_BATTLE_TEST("Sheer Force doesn't boost Comeuppance", s16 damage)
SINGLE_BATTLE_TEST("Sheer Force doesn't boost Payback", s16 damage)
{
u16 ability = 0;
PARAMETRIZE { ability = ABILITY_SHEER_FORCE; }
Expand Down
8 changes: 8 additions & 0 deletions test/battle/hold_effect/seeds.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ SINGLE_BATTLE_TEST("Electric Seed raises the holder's Defense on Electric Terrai
SEND_IN_MESSAGE("Wobbuffet");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Using Electric Seed, the Defense of Wobbuffet rose!");
} THEN {
EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE + 1);
}
}

Expand Down Expand Up @@ -69,6 +71,8 @@ SINGLE_BATTLE_TEST("Grassy Seed raises the holder's Defense on Grassy Terrain")
SEND_IN_MESSAGE("Wobbuffet");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Using Grassy Seed, the Defense of Wobbuffet rose!");
} THEN {
EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE + 1);
}
}

Expand Down Expand Up @@ -98,6 +102,8 @@ SINGLE_BATTLE_TEST("Misty Seed raises the holder's Sp. Defense on Misty Terrain"
SEND_IN_MESSAGE("Wobbuffet");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Using Misty Seed, the Sp. Def of Wobbuffet rose!");
} THEN {
EXPECT_EQ(player->statStages[STAT_SPDEF], DEFAULT_STAT_STAGE + 1);
}
}

Expand Down Expand Up @@ -127,5 +133,7 @@ SINGLE_BATTLE_TEST("Psychic Seed raises the holder's Sp. Defense on Psychic Terr
SEND_IN_MESSAGE("Wobbuffet");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Using Psychic Seed, the Sp. Def of Wobbuffet rose!");
} THEN {
EXPECT_EQ(player->statStages[STAT_SPDEF], DEFAULT_STAT_STAGE + 1);
}
}

0 comments on commit e29e1c6

Please sign in to comment.