Skip to content

Commit

Permalink
Decouple Poke Ball ids from item ids (#5560)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexOn1ine authored Oct 28, 2024
1 parent 0b66f52 commit 76eae8e
Show file tree
Hide file tree
Showing 26 changed files with 300 additions and 296 deletions.
Binary file added graphics/balls/strange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions graphics/items/icon_palettes/strange_ball.pal
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
JASC-PAL
0100
16
180 180 180
164 226 197
238 242 230
139 170 180
8 113 115
0 157 156
106 222 172
41 182 189
90 206 172
90 182 180
8 0 0
65 190 189
115 194 189
0 117 131
0 129 131
0 12 0
Binary file added graphics/items/icons/strange_ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion include/battle_anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ extern const union AffineAnimCmd *const gAffineAnims_SpinningBone[];

// battle_anim_throw.c
void TryShinyAnimation(u8 battler, struct Pokemon *mon);
u8 ItemIdToBallId(u16 itemId);
u8 AnimateBallOpenParticles(u8 x, u8 y, u8 priority, u8 subpriority, u8 ballId);
u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 spritePalNum, u32 selectedPalettes, u8 ballId);
bool32 IsCriticalCapture(void);
Expand Down
10 changes: 3 additions & 7 deletions include/constants/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@
#define ITEM_BEAST_BALL 26
#define ITEM_CHERISH_BALL 27

// Note: If moving ball IDs around, updating FIRST_BALL/LAST_BALL is not sufficient
// Several places expect the ball IDs to be first and contiguous (e.g. MON_DATA_POKEBALL)
// If adding new balls, it's easiest to insert them after the last ball and increment the below IDs (and removing ITEM_034 for example)
#define FIRST_BALL ITEM_POKE_BALL
#define LAST_BALL ITEM_CHERISH_BALL

// Medicine
#define ITEM_POTION 28
#define ITEM_SUPER_POTION 29
Expand Down Expand Up @@ -998,10 +992,12 @@
#define ITEM_TWICE_SPICED_RADISH 826
#define ITEM_POKESHI_DOLL 827

#define ITEM_STRANGE_BALL 828

// HOPO BERRY
// LEGEND PLATE

#define ITEMS_COUNT 828
#define ITEMS_COUNT 829
#define ITEM_FIELD_ARROW ITEMS_COUNT

// A special item id associated with "Cancel"/"Exit" etc. in a list of items or decorations
Expand Down
4 changes: 4 additions & 0 deletions include/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ extern const u32 gMessageBox_Gfx[];
extern const u16 gMessageBox_Pal[];

// pokeballs
extern const u32 gBallGfx_Strange[];
extern const u32 gBallPal_Strange[];
extern const u32 gBallGfx_Poke[];
extern const u32 gBallPal_Poke[];
extern const u32 gBallGfx_Great[];
Expand Down Expand Up @@ -360,6 +362,8 @@ extern const u32 gRaySceneChasesAway_Light_Gfx[];
extern const u32 gRaySceneChasesAway_Ring_Gfx[];

// Poké Balls
extern const u32 gItemIcon_StrangeBall[];
extern const u32 gItemIconPalette_StrangeBall[];
extern const u32 gItemIcon_PokeBall[];
extern const u32 gItemIconPalette_PokeBall[];
extern const u32 gItemIcon_GreatBall[];
Expand Down
2 changes: 1 addition & 1 deletion include/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ u8 ItemId_GetPocket(u16 itemId);
u8 ItemId_GetType(u16 itemId);
ItemUseFunc ItemId_GetFieldFunc(u16 itemId);
u8 ItemId_GetBattleUsage(u16 itemId);
u8 ItemId_GetSecondaryId(u16 itemId);
u32 ItemId_GetSecondaryId(u32 itemId);
u32 ItemId_GetFlingPower(u32 itemId);
u32 GetItemStatus1Mask(u16 itemId);
u32 GetItemStatus2Mask(u16 itemId);
Expand Down
58 changes: 30 additions & 28 deletions include/pokeball.h
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
#ifndef GUARD_POKEBALL_H
#define GUARD_POKEBALL_H

enum
enum PokeBall
{
BALL_POKE,
BALL_GREAT,
BALL_ULTRA,
BALL_MASTER,
BALL_PREMIER,
BALL_HEAL,
BALL_NET,
BALL_NEST,
BALL_DIVE,
BALL_DUSK,
BALL_TIMER,
BALL_QUICK,
BALL_REPEAT,
BALL_LUXURY,
BALL_LEVEL,
BALL_LURE,
BALL_MOON,
BALL_FRIEND,
BALL_LOVE,
BALL_FAST,
BALL_HEAVY,
BALL_DREAM,
BALL_SAFARI,
BALL_SPORT,
BALL_PARK,
BALL_BEAST,
BALL_CHERISH,
BALL_STRANGE = 0,
BALL_POKE = 1,
BALL_GREAT = 2,
BALL_ULTRA = 3,
BALL_MASTER = 4,
BALL_PREMIER = 5,
BALL_HEAL = 6,
BALL_NET = 7,
BALL_NEST = 8,
BALL_DIVE = 9,
BALL_DUSK = 10,
BALL_TIMER = 11,
BALL_QUICK = 12,
BALL_REPEAT = 13,
BALL_LUXURY = 14,
BALL_LEVEL = 15,
BALL_LURE = 16,
BALL_MOON = 17,
BALL_FRIEND = 18,
BALL_LOVE = 19,
BALL_FAST = 20,
BALL_HEAVY = 21,
BALL_DREAM = 22,
BALL_SAFARI = 23,
BALL_SPORT = 24,
BALL_PARK = 25,
BALL_BEAST = 26,
BALL_CHERISH = 27,
POKEBALL_COUNT
};

Expand All @@ -56,5 +57,6 @@ void StartHealthboxSlideIn(u8 battler);
void DoHitAnimHealthboxEffect(u8 battler);
void LoadBallGfx(u8 ballId);
void FreeBallGfx(u8 ballId);
enum PokeBall ItemIdToBallId(u32 ballItem);

#endif // GUARD_POKEBALL_H
2 changes: 1 addition & 1 deletion migration_scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Moves all information from `gItemIconTable` to `gItemsInfo`.
.pocket = POCKET_POKE_BALLS,
.type = ITEM_USE_BAG_MENU,
.battleUsage = EFFECT_ITEM_THROW_BALL,
.secondaryId = ITEM_POKE_BALL - FIRST_BALL,
.secondaryId = BALL_POKE,
+ .iconSprite = gItemIcon_PokeBall,
+ .iconPalette = gItemIconPalette_PokeBall,
},
Expand Down
Loading

0 comments on commit 76eae8e

Please sign in to comment.