Document item menu
This commit is contained in:
1 parent
d391486247
commit
28a8fe191a
21 files changed
+1268
-1158
No files matched your search
+36
-26
@@ -11,6 +11,15 @@
|
||||
#include "window.h"
|
||||
#include "constants/items.h"
|
||||
|
||||
enum {
|
||||
TAG_BAG_GFX = 100,
|
||||
TAG_ROTATING_BALL_GFX,
|
||||
TAG_ITEM_ICON,
|
||||
TAG_ITEM_ICON_ALT,
|
||||
};
|
||||
#define TAG_BERRY_CHECK_CIRCLE_GFX 10000
|
||||
#define TAG_BERRY_PIC_PAL 30020
|
||||
|
||||
struct CompressedTilesPal
|
||||
{
|
||||
const u32 *tiles;
|
||||
@@ -128,7 +137,7 @@ const struct CompressedSpritePalette gBagPaletteTable =
|
||||
gBagPalette, TAG_BAG_GFX
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gBagSpriteTemplate =
|
||||
static const struct SpriteTemplate sBagSpriteTemplate =
|
||||
{
|
||||
.tileTag = TAG_BAG_GFX,
|
||||
.paletteTag = TAG_BAG_GFX,
|
||||
@@ -189,17 +198,17 @@ static const union AffineAnimCmd *const sRotatingBallAnimCmds_FullRotation[] =
|
||||
sSpriteAffineAnim_RotatingBallRotation2,
|
||||
};
|
||||
|
||||
static const struct SpriteSheet gRotatingBallTable =
|
||||
static const struct SpriteSheet sRotatingBallTable =
|
||||
{
|
||||
gRotatingBall, 0x80, TAG_ROTATING_BALL_GFX
|
||||
};
|
||||
|
||||
static const struct SpritePalette gRotatingBallPaletteTable =
|
||||
static const struct SpritePalette sRotatingBallPaletteTable =
|
||||
{
|
||||
gRotatingBall_Pal, TAG_ROTATING_BALL_GFX
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gRotatingBallSpriteTemplate =
|
||||
static const struct SpriteTemplate sRotatingBallSpriteTemplate =
|
||||
{
|
||||
.tileTag = TAG_ROTATING_BALL_GFX,
|
||||
.paletteTag = TAG_ROTATING_BALL_GFX,
|
||||
@@ -262,7 +271,7 @@ static const struct SpriteFrameImage sBerryPicSpriteImageTable[] =
|
||||
|
||||
static const struct SpriteTemplate gBerryPicSpriteTemplate =
|
||||
{
|
||||
.tileTag = TAG_BERRY_PIC_TILE,
|
||||
.tileTag = 0xFFFF,
|
||||
.paletteTag = TAG_BERRY_PIC_PAL,
|
||||
.oam = &sBerryPicOamData,
|
||||
.anims = sBerryPicSpriteAnimTable,
|
||||
@@ -301,7 +310,7 @@ static const union AffineAnimCmd *const sBerryPicRotatingAnimCmds[] =
|
||||
|
||||
static const struct SpriteTemplate gBerryPicRotatingSpriteTemplate =
|
||||
{
|
||||
.tileTag = TAG_BERRY_PIC_TILE,
|
||||
.tileTag = 0xFFFF,
|
||||
.paletteTag = TAG_BERRY_PIC_PAL,
|
||||
.oam = &sBerryPicRotatingOamData,
|
||||
.anims = sBerryPicSpriteAnimTable,
|
||||
@@ -409,11 +418,11 @@ static const struct SpriteTemplate gBerryCheckCircleSpriteTemplate =
|
||||
// code
|
||||
void RemoveBagSprite(u8 id)
|
||||
{
|
||||
u8 *spriteId = &gBagMenu->spriteId[id];
|
||||
u8 *spriteId = &gBagMenu->spriteIds[id];
|
||||
if (*spriteId != SPRITE_NONE)
|
||||
{
|
||||
FreeSpriteTilesByTag(id + 100);
|
||||
FreeSpritePaletteByTag(id + 100);
|
||||
FreeSpriteTilesByTag(id + TAG_BAG_GFX);
|
||||
FreeSpritePaletteByTag(id + TAG_BAG_GFX);
|
||||
FreeSpriteOamMatrix(&gSprites[*spriteId]);
|
||||
DestroySprite(&gSprites[*spriteId]);
|
||||
*spriteId = SPRITE_NONE;
|
||||
@@ -422,14 +431,14 @@ void RemoveBagSprite(u8 id)
|
||||
|
||||
void AddBagVisualSprite(u8 bagPocketId)
|
||||
{
|
||||
u8 *spriteId = &gBagMenu->spriteId[0];
|
||||
*spriteId = CreateSprite(&gBagSpriteTemplate, 68, 66, 0);
|
||||
u8 *spriteId = &gBagMenu->spriteIds[ITEMMENUSPRITE_BAG];
|
||||
*spriteId = CreateSprite(&sBagSpriteTemplate, 68, 66, 0);
|
||||
SetBagVisualPocketId(bagPocketId, FALSE);
|
||||
}
|
||||
|
||||
void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets)
|
||||
{
|
||||
struct Sprite *sprite = &gSprites[gBagMenu->spriteId[0]];
|
||||
struct Sprite *sprite = &gSprites[gBagMenu->spriteIds[ITEMMENUSPRITE_BAG]];
|
||||
if (isSwitchingPockets)
|
||||
{
|
||||
sprite->y2 = -5;
|
||||
@@ -458,7 +467,7 @@ static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite)
|
||||
|
||||
void ShakeBagSprite(void)
|
||||
{
|
||||
struct Sprite *sprite = &gSprites[gBagMenu->spriteId[0]];
|
||||
struct Sprite *sprite = &gSprites[gBagMenu->spriteIds[ITEMMENUSPRITE_BAG]];
|
||||
if (sprite->affineAnimEnded)
|
||||
{
|
||||
StartSpriteAffineAnim(sprite, 1);
|
||||
@@ -477,10 +486,10 @@ static void SpriteCB_ShakeBagSprite(struct Sprite *sprite)
|
||||
|
||||
void AddSwitchPocketRotatingBallSprite(s16 rotationDirection)
|
||||
{
|
||||
u8 *spriteId = &gBagMenu->spriteId[1];
|
||||
LoadSpriteSheet(&gRotatingBallTable);
|
||||
LoadSpritePalette(&gRotatingBallPaletteTable);
|
||||
*spriteId = CreateSprite(&gRotatingBallSpriteTemplate, 16, 16, 0);
|
||||
u8 *spriteId = &gBagMenu->spriteIds[ITEMMENUSPRITE_BALL];
|
||||
LoadSpriteSheet(&sRotatingBallTable);
|
||||
LoadSpritePalette(&sRotatingBallPaletteTable);
|
||||
*spriteId = CreateSprite(&sRotatingBallSpriteTemplate, 16, 16, 0);
|
||||
gSprites[*spriteId].data[0] = rotationDirection;
|
||||
}
|
||||
|
||||
@@ -510,19 +519,20 @@ static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite)
|
||||
sprite->data[3]++;
|
||||
UpdateSwitchPocketRotatingBallCoords(sprite);
|
||||
if (sprite->data[3] == 16)
|
||||
RemoveBagSprite(1);
|
||||
RemoveBagSprite(ITEMMENUSPRITE_BALL);
|
||||
}
|
||||
|
||||
void AddBagItemIconSprite(u16 itemId, u8 id)
|
||||
{
|
||||
u8 *spriteId = &gBagMenu->spriteId[id + 2];
|
||||
u8 *spriteId = &gBagMenu->spriteIds[id + ITEMMENUSPRITE_ITEM];
|
||||
if (*spriteId == SPRITE_NONE)
|
||||
{
|
||||
u8 iconSpriteId;
|
||||
|
||||
FreeSpriteTilesByTag(id + 102);
|
||||
FreeSpritePaletteByTag(id + 102);
|
||||
iconSpriteId = AddItemIconSprite(id + 102, id + 102, itemId);
|
||||
// Either TAG_ITEM_ICON or TAG_ITEM_ICON_ALT
|
||||
FreeSpriteTilesByTag(id + TAG_ITEM_ICON);
|
||||
FreeSpritePaletteByTag(id + TAG_ITEM_ICON);
|
||||
iconSpriteId = AddItemIconSprite(id + TAG_ITEM_ICON, id + TAG_ITEM_ICON, itemId);
|
||||
if (iconSpriteId != MAX_SPRITES)
|
||||
{
|
||||
*spriteId = iconSpriteId;
|
||||
@@ -534,22 +544,22 @@ void AddBagItemIconSprite(u16 itemId, u8 id)
|
||||
|
||||
void RemoveBagItemIconSprite(u8 id)
|
||||
{
|
||||
RemoveBagSprite(id + 2);
|
||||
RemoveBagSprite(id + ITEMMENUSPRITE_ITEM);
|
||||
}
|
||||
|
||||
void CreateItemMenuSwapLine(void)
|
||||
{
|
||||
CreateSwapLineSprites(&gBagMenu->spriteId[4], 8);
|
||||
CreateSwapLineSprites(&gBagMenu->spriteIds[ITEMMENUSPRITE_SWAP_LINE], ITEMMENU_SWAP_LINE_LENGTH);
|
||||
}
|
||||
|
||||
void SetItemMenuSwapLineInvisibility(bool8 invisible)
|
||||
{
|
||||
SetSwapLineSpritesInvisibility(&gBagMenu->spriteId[4], 8, invisible);
|
||||
SetSwapLineSpritesInvisibility(&gBagMenu->spriteIds[ITEMMENUSPRITE_SWAP_LINE], ITEMMENU_SWAP_LINE_LENGTH, invisible);
|
||||
}
|
||||
|
||||
void UpdateItemMenuSwapLinePos(u8 y)
|
||||
{
|
||||
UpdateSwapLineSpritesPos(&gBagMenu->spriteId[4], 136, 120, (y + 1) * 16);
|
||||
UpdateSwapLineSpritesPos(&gBagMenu->spriteIds[ITEMMENUSPRITE_SWAP_LINE], ITEMMENU_SWAP_LINE_LENGTH | 0x80, 120, (y + 1) * 16);
|
||||
}
|
||||
|
||||
static void sub_80D5018(void *mem0, void *mem1)
|
||||
|
||||
Reference in new issue
Block a user