pokeemerald/src/item_menu_icons.c

619 lines
16 KiB
C
Raw Normal View History

2018-03-04 18:41:07 +01:00
#include "global.h"
2018-12-15 19:08:13 +01:00
#include "berry.h"
2018-03-04 18:41:07 +01:00
#include "decompress.h"
2018-12-15 19:08:13 +01:00
#include "graphics.h"
#include "item.h"
2018-03-04 18:41:07 +01:00
#include "item_menu.h"
#include "item_icon.h"
#include "item_menu_icons.h"
#include "menu_helpers.h"
2018-12-15 19:08:13 +01:00
#include "sprite.h"
#include "window.h"
2018-12-03 13:37:32 +01:00
#include "constants/items.h"
2018-03-04 18:41:07 +01:00
struct CompressedTilesPal
{
2018-10-21 09:24:57 +02:00
const u32 *tiles;
const u32 *pal;
2018-03-04 18:41:07 +01:00
};
// this file's functions
2018-03-04 20:03:11 +01:00
static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite);
static void SpriteCB_ShakeBagVisual(struct Sprite *sprite);
static void SpriteCB_SwitchPocketRotatingBallInit(struct Sprite *sprite);
static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite);
// static const rom data
static const u16 gRotatingBall_Pal[] = INCBIN_U16("graphics/interface/bag_spinner.gbapal");
static const u8 gRotatingBall[] = INCBIN_U8("graphics/interface/bag_spinner.4bpp");
static const u8 gCherryUnused[] = INCBIN_U8("graphics/unused/cherry.4bpp");
static const u16 gCherryUnused_Pal[] = INCBIN_U16("graphics/unused/cherry.gbapal");
2018-03-04 18:41:07 +01:00
static const struct OamData sBagOamData =
2018-03-04 18:41:07 +01:00
{
.y = 0,
.affineMode = ST_OAM_AFFINE_NORMAL,
.objMode = ST_OAM_OBJ_NORMAL,
2018-03-04 18:41:07 +01:00
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
2018-03-04 18:41:07 +01:00
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(64x64),
2018-03-04 18:41:07 +01:00
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_Bag_Closed[] =
2018-03-04 18:41:07 +01:00
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_Bag_Items[] =
2018-03-04 18:41:07 +01:00
{
ANIMCMD_FRAME(64, 4),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_Bag_KeyItems[] =
2018-03-04 18:41:07 +01:00
{
ANIMCMD_FRAME(128, 4),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_Bag_Pokeballs[] =
2018-03-04 18:41:07 +01:00
{
ANIMCMD_FRAME(192, 4),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_Bag_TMsHMs[] =
2018-03-04 18:41:07 +01:00
{
ANIMCMD_FRAME(256, 4),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_Bag_Berries[] =
2018-03-04 18:41:07 +01:00
{
ANIMCMD_FRAME(320, 4),
ANIMCMD_END
};
static const union AnimCmd *const sBagSpriteAnimTable[] =
2018-03-04 18:41:07 +01:00
{
sSpriteAnim_Bag_Closed,
sSpriteAnim_Bag_Items,
sSpriteAnim_Bag_Pokeballs,
sSpriteAnim_Bag_TMsHMs,
sSpriteAnim_Bag_Berries,
sSpriteAnim_Bag_KeyItems
2018-03-04 18:41:07 +01:00
};
static const union AffineAnimCmd sSpriteAffineAnim_BagNormal[] =
2018-03-04 18:41:07 +01:00
{
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd sSpriteAffineAnim_BagShake[] =
2018-03-04 18:41:07 +01:00
{
AFFINEANIMCMD_FRAME(0, 0, 254, 2),
AFFINEANIMCMD_FRAME(0, 0, 2, 4),
AFFINEANIMCMD_FRAME(0, 0, 254, 4),
AFFINEANIMCMD_FRAME(0, 0, 2, 2),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd *const sBagAffineAnimCmds[] =
2018-03-04 18:41:07 +01:00
{
sSpriteAffineAnim_BagNormal,
sSpriteAffineAnim_BagShake
2018-03-04 18:41:07 +01:00
};
const struct CompressedSpriteSheet gBagMaleSpriteSheet =
2018-03-04 18:41:07 +01:00
{
gBagMaleTiles, 0x3000, TAG_BAG_GFX
2018-03-04 18:41:07 +01:00
};
const struct CompressedSpriteSheet gBagFemaleSpriteSheet =
2018-03-04 18:41:07 +01:00
{
gBagFemaleTiles, 0x3000, TAG_BAG_GFX
2018-03-04 18:41:07 +01:00
};
const struct CompressedSpritePalette gBagPaletteTable =
2018-03-04 18:41:07 +01:00
{
gBagPalette, TAG_BAG_GFX
2018-03-04 18:41:07 +01:00
};
static const struct SpriteTemplate gBagSpriteTemplate =
2018-03-04 18:41:07 +01:00
{
.tileTag = TAG_BAG_GFX,
.paletteTag = TAG_BAG_GFX,
.oam = &sBagOamData,
.anims = sBagSpriteAnimTable,
2018-03-04 18:41:07 +01:00
.images = NULL,
.affineAnims = sBagAffineAnimCmds,
2018-03-04 18:41:07 +01:00
.callback = SpriteCallbackDummy,
};
static const struct OamData sRotatingBallOamData =
2018-03-04 18:41:07 +01:00
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
2018-03-04 18:41:07 +01:00
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(16x16),
2018-03-04 18:41:07 +01:00
.x = 0,
.matrixNum = 4,
.size = SPRITE_SIZE(16x16),
2018-03-04 18:41:07 +01:00
.tileNum = 0,
.priority = 2,
.paletteNum = 0,
.affineParam = 0
};
static const union AnimCmd sSpriteAffineAnim_RotatingBallStationary[] =
2018-03-04 18:41:07 +01:00
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END
};
static const union AnimCmd *const sRotatingBallSpriteAnimTable[] =
2018-03-04 18:41:07 +01:00
{
sSpriteAffineAnim_RotatingBallStationary
2018-03-04 18:41:07 +01:00
};
static const union AffineAnimCmd sSpriteAffineAnim_RotatingBallRotation1[] =
2018-03-04 18:41:07 +01:00
{
AFFINEANIMCMD_FRAME(0, 0, 8, 16),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd sSpriteAffineAnim_RotatingBallRotation2[] =
2018-03-04 18:41:07 +01:00
{
AFFINEANIMCMD_FRAME(0, 0, 248, 16),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd *const sRotatingBallAnimCmds[] =
2018-03-04 18:41:07 +01:00
{
sSpriteAffineAnim_RotatingBallRotation1,
2018-03-04 18:41:07 +01:00
};
static const union AffineAnimCmd *const sRotatingBallAnimCmds_FullRotation[] =
2018-03-04 18:41:07 +01:00
{
sSpriteAffineAnim_RotatingBallRotation2,
2018-03-04 18:41:07 +01:00
};
static const struct SpriteSheet gRotatingBallTable =
2018-03-04 18:41:07 +01:00
{
gRotatingBall, 0x80, TAG_ROTATING_BALL_GFX
2018-03-04 18:41:07 +01:00
};
static const struct SpritePalette gRotatingBallPaletteTable =
2018-03-04 18:41:07 +01:00
{
gRotatingBall_Pal, TAG_ROTATING_BALL_GFX
2018-03-04 18:41:07 +01:00
};
static const struct SpriteTemplate gRotatingBallSpriteTemplate =
2018-03-04 18:41:07 +01:00
{
.tileTag = TAG_ROTATING_BALL_GFX,
.paletteTag = TAG_ROTATING_BALL_GFX,
.oam = &sRotatingBallOamData,
.anims = sRotatingBallSpriteAnimTable,
2018-03-04 18:41:07 +01:00
.images = NULL,
.affineAnims = sRotatingBallAnimCmds,
2018-03-04 18:41:07 +01:00
.callback = SpriteCB_SwitchPocketRotatingBallInit,
};
static const struct OamData sBerryPicOamData =
2018-03-04 18:41:07 +01:00
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
2018-03-04 18:41:07 +01:00
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
2018-03-04 18:41:07 +01:00
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(64x64),
2018-03-04 18:41:07 +01:00
.tileNum = 0,
.priority = 1,
.paletteNum = 7,
.affineParam = 0
};
static const struct OamData sBerryPicRotatingOamData =
2018-03-04 18:41:07 +01:00
{
.y = 0,
.affineMode = ST_OAM_AFFINE_DOUBLE,
.objMode = ST_OAM_OBJ_NORMAL,
2018-03-04 18:41:07 +01:00
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
2018-03-04 18:41:07 +01:00
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(64x64),
2018-03-04 18:41:07 +01:00
.tileNum = 0,
.priority = 0,
.paletteNum = 7,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_857FBD8[] =
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END
};
static const union AnimCmd *const sBerryPicSpriteAnimTable[] =
2018-03-04 18:41:07 +01:00
{
sSpriteAnim_857FBD8
};
static const struct SpriteFrameImage sBerryPicSpriteImageTable[] =
2018-03-04 18:41:07 +01:00
{
{&gDecompressionBuffer[0], 0x800},
};
static const struct SpriteTemplate gBerryPicSpriteTemplate =
2018-03-04 18:41:07 +01:00
{
.tileTag = TAG_BERRY_PIC_TILE,
.paletteTag = TAG_BERRY_PIC_PAL,
.oam = &sBerryPicOamData,
.anims = sBerryPicSpriteAnimTable,
.images = sBerryPicSpriteImageTable,
2018-03-04 18:41:07 +01:00
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const union AffineAnimCmd sSpriteAffineAnim_BerryPicRotation1[] =
2018-03-04 18:41:07 +01:00
{
AFFINEANIMCMD_FRAME(-1, -1, 253, 96),
AFFINEANIMCMD_FRAME(0, 0, 0, 16),
AFFINEANIMCMD_FRAME(-2, -2, 255, 64),
AFFINEANIMCMD_FRAME(-8, 0, 0, 16),
AFFINEANIMCMD_FRAME(0, -8, 0, 16),
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_JUMP(0)
};
static const union AffineAnimCmd sSpriteAffineAnim_BerryPicRotation2[] =
2018-03-04 18:41:07 +01:00
{
AFFINEANIMCMD_FRAME(-1, -1, 3, 96),
AFFINEANIMCMD_FRAME(0, 0, 0, 16),
AFFINEANIMCMD_FRAME(-2, -2, 1, 64),
AFFINEANIMCMD_FRAME(-8, 0, 0, 16),
AFFINEANIMCMD_FRAME(0, -8, 0, 16),
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_JUMP(0)
};
static const union AffineAnimCmd *const sBerryPicRotatingAnimCmds[] =
2018-03-04 18:41:07 +01:00
{
sSpriteAffineAnim_BerryPicRotation1,
sSpriteAffineAnim_BerryPicRotation2
2018-03-04 18:41:07 +01:00
};
static const struct SpriteTemplate gBerryPicRotatingSpriteTemplate =
2018-03-04 18:41:07 +01:00
{
.tileTag = TAG_BERRY_PIC_TILE,
.paletteTag = TAG_BERRY_PIC_PAL,
.oam = &sBerryPicRotatingOamData,
.anims = sBerryPicSpriteAnimTable,
.images = sBerryPicSpriteImageTable,
.affineAnims = sBerryPicRotatingAnimCmds,
2018-03-04 18:41:07 +01:00
.callback = SpriteCallbackDummy,
};
static const struct CompressedTilesPal gBerryPicTable[] =
{
{gBerryPic_Cheri, gBerryPalette_Cheri},
{gBerryPic_Chesto, gBerryPalette_Chesto},
{gBerryPic_Pecha, gBerryPalette_Pecha},
{gBerryPic_Rawst, gBerryPalette_Rawst},
{gBerryPic_Aspear, gBerryPalette_Aspear},
{gBerryPic_Leppa, gBerryPalette_Leppa},
{gBerryPic_Oran, gBerryPalette_Oran},
{gBerryPic_Persim, gBerryPalette_Persim},
{gBerryPic_Lum, gBerryPalette_Lum},
{gBerryPic_Sitrus, gBerryPalette_Sitrus},
{gBerryPic_Figy, gBerryPalette_Figy},
{gBerryPic_Wiki, gBerryPalette_Wiki},
{gBerryPic_Mago, gBerryPalette_Mago},
{gBerryPic_Aguav, gBerryPalette_Aguav},
{gBerryPic_Iapapa, gBerryPalette_Iapapa},
{gBerryPic_Razz, gBerryPalette_Razz},
{gBerryPic_Bluk, gBerryPalette_Bluk},
{gBerryPic_Nanab, gBerryPalette_Nanab},
{gBerryPic_Wepear, gBerryPalette_Wepear},
{gBerryPic_Pinap, gBerryPalette_Pinap},
{gBerryPic_Pomeg, gBerryPalette_Pomeg},
{gBerryPic_Kelpsy, gBerryPalette_Kelpsy},
{gBerryPic_Qualot, gBerryPalette_Qualot},
{gBerryPic_Hondew, gBerryPalette_Hondew},
{gBerryPic_Grepa, gBerryPalette_Grepa},
{gBerryPic_Tamato, gBerryPalette_Tamato},
{gBerryPic_Cornn, gBerryPalette_Cornn},
{gBerryPic_Magost, gBerryPalette_Magost},
{gBerryPic_Rabuta, gBerryPalette_Rabuta},
{gBerryPic_Nomel, gBerryPalette_Nomel},
{gBerryPic_Spelon, gBerryPalette_Spelon},
{gBerryPic_Pamtre, gBerryPalette_Pamtre},
{gBerryPic_Watmel, gBerryPalette_Watmel},
{gBerryPic_Durin, gBerryPalette_Durin},
{gBerryPic_Belue, gBerryPalette_Belue},
{gBerryPic_Liechi, gBerryPalette_Liechi},
{gBerryPic_Ganlon, gBerryPalette_Ganlon},
{gBerryPic_Salac, gBerryPalette_Salac},
{gBerryPic_Petaya, gBerryPalette_Petaya},
{gBerryPic_Apicot, gBerryPalette_Apicot},
{gBerryPic_Lansat, gBerryPalette_Lansat},
{gBerryPic_Starf, gBerryPalette_Starf},
{gBerryPic_Enigma, gBerryPalette_Enigma},
};
const struct CompressedSpriteSheet gBerryCheckCircleSpriteSheet =
2018-03-04 20:03:11 +01:00
{
gBerryCheckCircle_Gfx, 0x800, TAG_BERRY_CHECK_CIRCLE_GFX
2018-03-04 20:03:11 +01:00
};
const struct CompressedSpritePalette gBerryCheckCirclePaletteTable =
2018-03-04 20:03:11 +01:00
{
gBerryCheck_Pal, TAG_BERRY_CHECK_CIRCLE_GFX
2018-03-04 20:03:11 +01:00
};
static const struct OamData sBerryCheckCircleOamData =
2018-03-04 20:03:11 +01:00
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
2018-03-04 20:03:11 +01:00
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
2018-03-04 20:03:11 +01:00
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(64x64),
2018-03-04 20:03:11 +01:00
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_BerryCheckCircle[] =
2018-03-04 20:03:11 +01:00
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END
};
static const union AnimCmd *const sBerryCheckCircleSpriteAnimTable[] =
2018-03-04 20:03:11 +01:00
{
sSpriteAnim_BerryCheckCircle
2018-03-04 20:03:11 +01:00
};
static const struct SpriteTemplate gBerryCheckCircleSpriteTemplate =
2018-03-04 20:03:11 +01:00
{
.tileTag = TAG_BERRY_CHECK_CIRCLE_GFX,
.paletteTag = TAG_BERRY_CHECK_CIRCLE_GFX,
.oam = &sBerryCheckCircleOamData,
.anims = sBerryCheckCircleSpriteAnimTable,
2018-03-04 20:03:11 +01:00
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
2018-03-04 18:41:07 +01:00
// code
void RemoveBagSprite(u8 id)
{
u8 *spriteId = &gBagMenu->spriteId[id];
2018-03-04 18:41:07 +01:00
if (*spriteId != 0xFF)
{
FreeSpriteTilesByTag(id + 100);
FreeSpritePaletteByTag(id + 100);
FreeSpriteOamMatrix(&gSprites[*spriteId]);
DestroySprite(&gSprites[*spriteId]);
*spriteId = 0xFF;
}
}
void AddBagVisualSprite(u8 bagPocketId)
{
u8 *spriteId = &gBagMenu->spriteId[0];
*spriteId = CreateSprite(&gBagSpriteTemplate, 68, 66, 0);
2018-03-04 18:41:07 +01:00
SetBagVisualPocketId(bagPocketId, FALSE);
}
void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets)
{
struct Sprite *sprite = &gSprites[gBagMenu->spriteId[0]];
2018-03-04 18:41:07 +01:00
if (isSwitchingPockets)
{
sprite->pos2.y = -5;
sprite->callback = SpriteCB_BagVisualSwitchingPockets;
sprite->data[0] = bagPocketId + 1;
StartSpriteAnim(sprite, 0);
}
else
{
StartSpriteAnim(sprite, bagPocketId + 1);
}
}
2018-03-04 20:03:11 +01:00
static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite)
2018-03-04 18:41:07 +01:00
{
if (sprite->pos2.y != 0)
{
sprite->pos2.y++;
}
else
{
StartSpriteAnim(sprite, sprite->data[0]);
sprite->callback = SpriteCallbackDummy;
}
}
void ShakeBagVisual(void)
{
struct Sprite *sprite = &gSprites[gBagMenu->spriteId[0]];
2018-03-04 18:41:07 +01:00
if (sprite->affineAnimEnded)
{
StartSpriteAffineAnim(sprite, 1);
sprite->callback = SpriteCB_ShakeBagVisual;
}
}
2018-03-04 20:03:11 +01:00
static void SpriteCB_ShakeBagVisual(struct Sprite *sprite)
2018-03-04 18:41:07 +01:00
{
if (sprite->affineAnimEnded)
{
StartSpriteAffineAnim(sprite, 0);
sprite->callback = SpriteCallbackDummy;
}
}
2018-03-04 20:03:11 +01:00
void AddSwitchPocketRotatingBallSprite(s16 rotationDirection)
2018-03-04 18:41:07 +01:00
{
u8 *spriteId = &gBagMenu->spriteId[1];
LoadSpriteSheet(&gRotatingBallTable);
LoadSpritePalette(&gRotatingBallPaletteTable);
*spriteId = CreateSprite(&gRotatingBallSpriteTemplate, 16, 16, 0);
2018-03-04 18:41:07 +01:00
gSprites[*spriteId].data[0] = rotationDirection;
}
static void UpdateSwitchPocketRotatingBallCoords(struct Sprite *sprite)
2018-03-04 18:41:07 +01:00
{
sprite->centerToCornerVecX = sprite->data[1] - ((sprite->data[3] + 1) & 1);
sprite->centerToCornerVecY = sprite->data[1] - ((sprite->data[3] + 1) & 1);
}
2018-03-04 20:03:11 +01:00
static void SpriteCB_SwitchPocketRotatingBallInit(struct Sprite *sprite)
2018-03-04 18:41:07 +01:00
{
sprite->oam.affineMode = ST_OAM_AFFINE_NORMAL;
2018-03-04 18:41:07 +01:00
if (sprite->data[0] == -1)
sprite->affineAnims = sRotatingBallAnimCmds;
2018-03-04 18:41:07 +01:00
else
sprite->affineAnims = sRotatingBallAnimCmds_FullRotation;
2018-03-04 18:41:07 +01:00
InitSpriteAffineAnim(sprite);
sprite->data[1] = sprite->centerToCornerVecX;
sprite->data[1] = sprite->centerToCornerVecY;
UpdateSwitchPocketRotatingBallCoords(sprite);
2018-03-04 18:41:07 +01:00
sprite->callback = SpriteCB_SwitchPocketRotatingBallContinue;
}
2018-03-04 20:03:11 +01:00
static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite)
2018-03-04 18:41:07 +01:00
{
sprite->data[3]++;
UpdateSwitchPocketRotatingBallCoords(sprite);
2018-03-04 18:41:07 +01:00
if (sprite->data[3] == 16)
RemoveBagSprite(1);
}
void AddBagItemIconSprite(u16 itemId, u8 id)
{
u8 *spriteId = &gBagMenu->spriteId[id + 2];
2018-03-04 18:41:07 +01:00
if (*spriteId == 0xFF)
{
u8 iconSpriteId;
FreeSpriteTilesByTag(id + 102);
FreeSpritePaletteByTag(id + 102);
iconSpriteId = AddItemIconSprite(id + 102, id + 102, itemId);
if (iconSpriteId != MAX_SPRITES)
{
*spriteId = iconSpriteId;
gSprites[iconSpriteId].pos2.x = 24;
gSprites[iconSpriteId].pos2.y = 88;
}
}
}
void RemoveBagItemIconSprite(u8 id)
{
RemoveBagSprite(id + 2);
}
void sub_80D4FAC(void)
{
sub_8122344(&gBagMenu->spriteId[4], 8);
2018-03-04 18:41:07 +01:00
}
void sub_80D4FC8(u8 arg0)
{
sub_81223FC(&gBagMenu->spriteId[4], 8, arg0);
2018-03-04 18:41:07 +01:00
}
void sub_80D4FEC(u8 arg0)
{
sub_8122448(&gBagMenu->spriteId[4], 136, 120, (arg0 + 1) * 16);
2018-03-04 18:41:07 +01:00
}
2018-03-04 20:03:11 +01:00
static void sub_80D5018(void *mem0, void *mem1)
2018-03-04 18:41:07 +01:00
{
u8 i, j;
memset(mem1, 0, 0x800);
mem1 += 0x100;
for (i = 0; i < 6; i++)
{
mem1 += 0x20;
for (j = 0; j < 6; j++)
{
memcpy(mem1, mem0, 0x20);
mem1 += 0x20;
mem0 += 0x20;
}
if (i != 5)
mem1 += 0x20;
}
}
static void LoadBerryGfx(u8 berryId)
2018-03-04 18:41:07 +01:00
{
struct CompressedSpritePalette pal;
2018-03-09 22:22:00 +01:00
if (berryId == ITEM_TO_BERRY(ITEM_ENIGMA_BERRY) - 1 && IsEnigmaBerryValid())
{
// unknown empty if statement
}
2018-03-04 18:41:07 +01:00
pal.data = gBerryPicTable[berryId].pal;
pal.tag = TAG_BERRY_PIC_PAL;
2018-12-17 23:00:08 +01:00
LoadCompressedSpritePalette(&pal);
2018-03-04 18:41:07 +01:00
LZDecompressWram(gBerryPicTable[berryId].tiles, &gDecompressionBuffer[0x1000]);
sub_80D5018(&gDecompressionBuffer[0x1000], &gDecompressionBuffer[0]);
}
u8 CreateBerryTagSprite(u8 id, s16 x, s16 y)
{
LoadBerryGfx(id);
return CreateSprite(&gBerryPicSpriteTemplate, x, y, 0);
2018-03-04 18:41:07 +01:00
}
void FreeBerryTagSpritePalette(void)
{
FreeSpritePaletteByTag(TAG_BERRY_PIC_PAL);
2018-03-04 18:41:07 +01:00
}
u8 LoadSpinningBerryPicGfx(u8 berryId, u8 x, u8 y, bool8 startAffine)
2018-03-04 18:41:07 +01:00
{
u8 spriteId;
FreeSpritePaletteByTag(TAG_BERRY_PIC_PAL);
LoadBerryGfx(berryId);
spriteId = CreateSprite(&gBerryPicRotatingSpriteTemplate, x, y, 0);
2018-03-04 18:41:07 +01:00
if (startAffine == TRUE)
StartSpriteAffineAnim(&gSprites[spriteId], 1);
return spriteId;
}
u8 CreateBerryFlavorCircleSprite(s16 x)
{
return CreateSprite(&gBerryCheckCircleSpriteTemplate, x, 116, 0);
2018-03-04 18:41:07 +01:00
}