Add defines for field effect sprite data, misc task data

This commit is contained in:
GriffinR 2023-08-20 01:35:51 -04:00
parent 6792028254
commit 56ff4ce998
2 changed files with 369 additions and 354 deletions

File diff suppressed because it is too large Load diff

View file

@ -1116,7 +1116,7 @@ static u8 GetPartyIdFromSelectionId_(u8 selectionId)
static void LoadAndCreateUpDownSprites(void)
{
u16 i, spriteId;
u16 i;
LoadSpriteSheet(&sSpriteSheet_UpDown);
LoadSpritePalette(&sSpritePalette_UpDown);
@ -1126,7 +1126,7 @@ static void LoadAndCreateUpDownSprites(void)
{
if (sInfo->enhancements[i] != 0)
{
spriteId = CreateSprite(&sSpriteTemplate_UpDown, sUpDownCoordsOnGraph[i][0], sUpDownCoordsOnGraph[i][1], 0);
u16 spriteId = CreateSprite(&sSpriteTemplate_UpDown, sUpDownCoordsOnGraph[i][0], sUpDownCoordsOnGraph[i][1], 0);
if (spriteId != MAX_SPRITES)
{
if (sInfo->enhancements[i] != 0) // Always true here
@ -1137,20 +1137,24 @@ static void LoadAndCreateUpDownSprites(void)
}
}
#define tTimer data[0]
static void SpriteCB_UpDown(struct Sprite *sprite)
{
if (sprite->data[0] < 6)
if (sprite->tTimer < 6)
sprite->y2 -= 2;
else if (sprite->data[0] < 12)
else if (sprite->tTimer < 12)
sprite->y2 += 2;
if (++sprite->data[0] > 60)
if (++sprite->tTimer > 60)
{
DestroySprite(sprite);
sInfo->numEnhancements--;
}
}
#undef tTimer
static void LoadPartyInfo(void)
{
u16 i;
@ -1612,12 +1616,15 @@ static void LoadConditionGfx(void)
LoadSpritePalette(&spritePalette);
}
#define sSpeed data[0]
#define sTargetX data[1]
static void CreateConditionSprite(void)
{
u16 i;
s16 xDiff, xStart;
int yStart = 17;
int var = 8;
int speed = 8;
struct Sprite **sprites = sMenu->condition;
const struct SpriteTemplate *template = &sSpriteTemplate_Condition;
@ -1626,9 +1633,9 @@ static void CreateConditionSprite(void)
u8 spriteId = CreateSprite(template, i * xDiff + xStart, yStart, 0);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].data[0] = var;
gSprites[spriteId].data[1] = (i * xDiff) | 0x20;
gSprites[spriteId].data[2] = i;
gSprites[spriteId].sSpeed = speed;
gSprites[spriteId].sTargetX = (i * xDiff) | 0x20;
gSprites[spriteId].data[2] = i; // Unused
StartSpriteAnim(&gSprites[spriteId], i);
sprites[i] = &gSprites[spriteId];
}
@ -1657,11 +1664,15 @@ static void SpriteCB_Condition(struct Sprite *sprite)
{
s16 prevX = sprite->x;
sprite->x += sprite->data[0];
if ((prevX <= sprite->data[1] && sprite->x >= sprite->data[1])
|| (prevX >= sprite->data[1] && sprite->x <= sprite->data[1]))
// Slide onscreen
sprite->x += sprite->sSpeed;
// Check if target position has been reached/surpassed
if ((prevX <= sprite->sTargetX && sprite->x >= sprite->sTargetX)
|| (prevX >= sprite->sTargetX && sprite->x <= sprite->sTargetX))
{
sprite->x = sprite->data[1];
// End slide onscreen, become static sprite.
sprite->x = sprite->sTargetX;
sprite->callback = SpriteCallbackDummy;
}
}