Document some battle anims and helpers

This commit is contained in:
Marcus Huderle 2018-12-30 10:58:42 -06:00
parent 2c2554e2ae
commit 58f130d007
17 changed files with 301 additions and 256 deletions

View File

@ -3158,7 +3158,7 @@ Move_FORESIGHT:
monbg ANIM_DEF_PARTNER
monbgprio_28 ANIM_TARGET
setalpha 16, 0
createsprite gUnknown_085CE8C4, ANIM_TARGET, 2, 1
createsprite gForesightMagnifyingGlassSpriteTemplate, ANIM_TARGET, 2, ANIM_TARGET
delay 17
loopsewithpan SE_W166, SOUND_PAN_TARGET, 16, 4
delay 48
@ -3540,12 +3540,12 @@ Move_SMELLING_SALT:
createsprite gUnknown_085CE864, ANIM_TARGET, 2, 1, 0, 2
createsprite gUnknown_085CE864, ANIM_TARGET, 2, 1, 1, 2
delay 32
createvisualtask sub_815E840, 3, 1, 2
createvisualtask AnimTask_SmellingSaltSquish, 3, ANIM_TARGET, 2
loopsewithpan SE_W003, SOUND_PAN_TARGET, 12, 2
waitforvisualfinish
delay 4
createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 6, 2
createsprite gUnknown_085CE894, ANIM_TARGET, 2, 1, 8, 3
createsprite gSmellingSaltExclamationSpriteTemplate, ANIM_TARGET, 2, ANIM_TARGET, 8, 3
loopsewithpan SE_W207B, SOUND_PAN_TARGET, 16, 3
end
@ -3616,9 +3616,9 @@ Move_TAUNT:
Move_HELPING_HAND:
loadspritegfx ANIM_TAG_TAG_HAND
createvisualtask sub_815EC48, 5
createsprite gUnknown_085CE8AC, ANIM_ATTACKER, 40, 0
createsprite gUnknown_085CE8AC, ANIM_ATTACKER, 40, 1
createvisualtask AnimTask_HelpingHandAttackerMovement, 5
createsprite gHelpingHandClapSpriteTemplate, ANIM_ATTACKER, 40, 0
createsprite gHelpingHandClapSpriteTemplate, ANIM_ATTACKER, 40, 1
delay 19
playsewithpan SE_W227, 0
createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATK_PARTNER, 2, 0, 5, 1
@ -3687,7 +3687,7 @@ Move_RECYCLE:
monbg ANIM_ATTACKER
setalpha 0, 16
delay 1
createsprite gUnknown_085CE9B0, ANIM_ATTACKER, 2
createsprite gRecycleSpriteTemplate, ANIM_ATTACKER, 2
loopsewithpan SE_W036, SOUND_PAN_ATTACKER, 24, 3
waitforvisualfinish
createvisualtask AnimTask_BlendMonInAndOut, 5, ANIM_ATTACKER, RGB_WHITE, 12, 2, 1
@ -3989,7 +3989,7 @@ Move_FEATHER_DANCE:
Move_TEETER_DANCE:
loadspritegfx ANIM_TAG_MUSIC_NOTES
loadspritegfx ANIM_TAG_DUCK
createvisualtask sub_8160164, 5
createvisualtask AnimTask_TeeterDanceMovement, 5
createsprite gUnknown_08593050, ANIM_ATTACKER, 2, 0, 16, -2
playsewithpan SE_W298, SOUND_PAN_ATTACKER
delay 24
@ -4098,7 +4098,7 @@ Move_NEEDLE_ARM:
Move_SLACK_OFF:
loadspritegfx ANIM_TAG_BLUE_STAR
createvisualtask sub_8160544, 2, 0
createvisualtask AnimTask_SlackOffSquish, 2, ANIM_ATTACKER
playsewithpan SE_W281, SOUND_PAN_ATTACKER
waitforvisualfinish
call HealingEffect
@ -4211,7 +4211,7 @@ Move_AIR_CUTTER:
Move_ODOR_SLEUTH:
monbg ANIM_TARGET
createvisualtask sub_815F620, 5
createvisualtask AnimTask_OdorSleuthMovement, 5
delay 24
createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 3, 4
playsewithpan SE_W207, SOUND_PAN_ATTACKER
@ -4365,7 +4365,7 @@ Move_IRON_DEFENSE:
Move_BLOCK:
loadspritegfx ANIM_TAG_X_SIGN
createsprite gUnknown_085CE90C, ANIM_TARGET, 66
createsprite gBlockXSpriteTemplate, ANIM_TARGET, 66
playsewithpan SE_W207, SOUND_PAN_TARGET
end
@ -8718,12 +8718,12 @@ Move_METEOR_MASH:
fadetobg BG_COSMIC
waitbgfadein
waitforvisualfinish
createsprite gUnknown_085CE8DC, ANIM_TARGET, 3, -48, SOUND_PAN_ATTACKER, 72, 32, 30
createsprite gMeteorMashStarSpriteTemplate, ANIM_TARGET, 3, -48, -64, 72, 32, 30
delay 10
createsprite gUnknown_085CE8DC, ANIM_TARGET, 3, -112, SOUND_PAN_ATTACKER, 8, 32, 30
createsprite gMeteorMashStarSpriteTemplate, ANIM_TARGET, 3, -112, -64, 8, 32, 30
delay 40
createsprite gUnknown_08595F14, ANIM_TARGET, 3, 0, 0, 0, 30
createsprite gUnknown_085CE8DC, ANIM_TARGET, 3, -80, SOUND_PAN_ATTACKER, 40, 32, 30
createsprite gMeteorMashStarSpriteTemplate, ANIM_TARGET, 3, -80, -64, 40, 32, 30
delay 20
playsewithpan SE_W233B, SOUND_PAN_TARGET
createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 1
@ -9551,7 +9551,7 @@ Move_KNOCK_OFF:
createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 6
delay 4
playsewithpan SE_W233, SOUND_PAN_TARGET
createsprite gUnknown_085CE984, ANIM_TARGET, 2, -16, -16
createsprite gKnockOffStrikeSpriteTemplate, ANIM_TARGET, 2, -16, -16
delay 8
createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 5, 1, RGB_WHITE, 10, 0, 0
createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 2
@ -10556,11 +10556,11 @@ SnatchMoveContinue:
end
SnatchOpposingMonMove:
playsewithpan SE_W104, SOUND_PAN_ATTACKER
createvisualtask sub_815F8F4, 2
createvisualtask AnimTask_SnatchOpposingMonMove, 2
goto SnatchMoveContinue
SnatchPartnerMonMove:
playsewithpan SE_W104, SOUND_PAN_ATTACKER
createvisualtask sub_815FFC4, 2
createvisualtask AnimTask_SnatchPartnerMove, 2
goto SnatchMoveContinue
General_FutureSightHit:

View File

@ -94,7 +94,7 @@ void sub_80A66DC(struct Sprite *sprite);
void SetSpriteCoordsToAnimAttackerCoords(struct Sprite *sprite);
void RunStoredCallbackWhenAnimEnds(struct Sprite *sprite);
void SetAnimSpriteInitialXOffset(struct Sprite *sprite, s16 a2);
s16 sub_80A861C(u8 battlerId, u8 a2);
s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 a2);
u8 GetBattlerYCoordWithElevation(u8 battlerId);
void WaitAnimForDuration(struct Sprite *sprite);
void sub_80A7938(struct Sprite *sprite);
@ -148,7 +148,7 @@ void sub_80A6BFC(struct UnknownAnimStruct2 *unk, u8 unused);
u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, u32 a10);
void sub_80A749C(struct Sprite *sprite);
void sub_80A6814(u8 taskId);
void sub_80A8610(struct Sprite *sprite);
void DestroySpriteAndFreeResources_(struct Sprite *sprite);
void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId);
enum
@ -160,6 +160,17 @@ enum
BATTLER_COORD_Y_PIC_OFFSET_DEFAULT,
};
enum
{
BATTLER_COORD_ATTR_HEIGHT,
BATTLER_COORD_ATTR_WIDTH,
BATTLER_COORD_ATTR_TOP,
BATTLER_COORD_ATTR_BOTTOM,
BATTLER_COORD_ATTR_LEFT,
BATTLER_COORD_ATTR_RIGHT,
BATTLER_COORD_ATTR_RAW_BOTTOM,
};
u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId);
bool8 IsBattlerSpritePresent(u8 battlerId);

View File

@ -2092,17 +2092,17 @@ u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority
return spriteId;
}
void sub_80A8610(struct Sprite *sprite)
void DestroySpriteAndFreeResources_(struct Sprite *sprite)
{
DestroySpriteAndFreeResources(sprite);
}
s16 sub_80A861C(u8 battlerId, u8 a2)
s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr)
{
u16 species;
u32 personality;
u16 letter;
u16 var;
u16 unownSpecies;
int ret;
const struct MonCoords *coords;
struct BattleSpriteInfo *spriteInfo;
@ -2123,10 +2123,10 @@ s16 sub_80A861C(u8 battlerId, u8 a2)
{
letter = GET_UNOWN_LETTER(personality);
if (!letter)
var = SPECIES_UNOWN;
unownSpecies = SPECIES_UNOWN;
else
var = letter + SPECIES_UNOWN_B - 1;
coords = &gMonBackPicCoords[var];
unownSpecies = letter + SPECIES_UNOWN_B - 1;
coords = &gMonBackPicCoords[unownSpecies];
}
else if (species == SPECIES_CASTFORM)
{
@ -2156,16 +2156,17 @@ s16 sub_80A861C(u8 battlerId, u8 a2)
species = spriteInfo[battlerId].transformSpecies;
personality = gTransformedPersonalities[battlerId];
}
if (species == SPECIES_UNOWN)
{
letter = GET_UNOWN_LETTER(personality);
if (!letter)
var = SPECIES_UNOWN;
unownSpecies = SPECIES_UNOWN;
else
var = letter + SPECIES_UNOWN_B - 1;
coords = &gMonBackPicCoords[var];
unownSpecies = letter + SPECIES_UNOWN_B - 1;
coords = &gMonBackPicCoords[unownSpecies];
}
else if (species > SPECIES_EGG)
else if (species > NUM_SPECIES)
{
coords = &gMonBackPicCoords[0];
}
@ -2187,20 +2188,21 @@ s16 sub_80A861C(u8 battlerId, u8 a2)
species = spriteInfo[battlerId].transformSpecies;
personality = gTransformedPersonalities[battlerId];
}
if (species == SPECIES_UNOWN)
{
letter = GET_UNOWN_LETTER(personality);
if (!letter)
var = SPECIES_UNOWN;
unownSpecies = SPECIES_UNOWN;
else
var = letter + SPECIES_UNOWN_B - 1;
coords = &gMonFrontPicCoords[var];
unownSpecies = letter + SPECIES_UNOWN_B - 1;
coords = &gMonFrontPicCoords[unownSpecies];
}
else if (species == SPECIES_CASTFORM)
{
coords = &gCastformFrontSpriteCoords[gBattleMonForms[battlerId]];
}
else if (species > SPECIES_EGG)
else if (species > NUM_SPECIES)
{
coords = &gMonFrontPicCoords[0];
}
@ -2211,22 +2213,22 @@ s16 sub_80A861C(u8 battlerId, u8 a2)
}
}
switch (a2)
switch (attr)
{
case 0:
case BATTLER_COORD_ATTR_HEIGHT:
return (coords->coords & 0xf) * 8;
case 1:
case BATTLER_COORD_ATTR_WIDTH:
return (coords->coords >> 4) * 8;
case 4:
return GetBattlerSpriteCoord(battlerId, 2) - ((coords->coords >> 4) * 4);
case 5:
return GetBattlerSpriteCoord(battlerId, 2) + ((coords->coords >> 4) * 4);
case 2:
return GetBattlerSpriteCoord(battlerId, 3) - ((coords->coords & 0xf) * 4);
case 3:
return GetBattlerSpriteCoord(battlerId, 3) + ((coords->coords & 0xf) * 4);
case 6:
ret = GetBattlerSpriteCoord(battlerId, 1) + 0x1f;
case BATTLER_COORD_ATTR_LEFT:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) - ((coords->coords >> 4) * 4);
case BATTLER_COORD_ATTR_RIGHT:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + ((coords->coords >> 4) * 4);
case BATTLER_COORD_ATTR_TOP:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) - ((coords->coords & 0xf) * 4);
case BATTLER_COORD_ATTR_BOTTOM:
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) + ((coords->coords & 0xf) * 4);
case BATTLER_COORD_ATTR_RAW_BOTTOM:
ret = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 31;
return ret - coords->y_offset;
default:
return 0;

View File

@ -388,7 +388,7 @@ const struct SpriteTemplate gBattleAnimSpriteTemplate_085E535C =
};
extern const struct SpriteTemplate gUnknown_085CE388;
extern const struct SpriteTemplate gUnknown_085CE3A0;
extern const struct SpriteTemplate gMiniTwinklingStarSpriteTemplate;
void unref_sub_8170478(u8 taskId)
{
@ -2081,12 +2081,12 @@ static void sub_8172FEC(u8 taskId)
}
else if (state >= 0 && gTasks[taskId].data[11] < 4)
{
spriteId = CreateSprite(&gUnknown_085CE3A0, x, y, 5);
spriteId = CreateSprite(&gMiniTwinklingStarSpriteTemplate, x, y, 5);
gSprites[spriteId].oam.tileNum += 4;
}
else
{
spriteId = CreateSprite(&gUnknown_085CE3A0, x, y, 5);
spriteId = CreateSprite(&gMiniTwinklingStarSpriteTemplate, x, y, 5);
gSprites[spriteId].oam.tileNum += 5;
}

View File

@ -3297,8 +3297,8 @@ void sub_80FFFC0(u8 taskId)
task->data[4] = GetBattlerSpriteSubpriority(gBattleAnimTarget) - 1;
task->data[6] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
task->data[7] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
task->data[10] = sub_80A861C(gBattleAnimTarget, 1);
task->data[11] = sub_80A861C(gBattleAnimTarget, 0);
task->data[10] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_WIDTH);
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT);
task->data[5] = (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT) ? 1 : -1;
task->data[9] = 56 - (task->data[5] * 64);
task->data[8] = task->data[7] - task->data[9] + task->data[6];
@ -5452,11 +5452,11 @@ static void sub_81030B0(struct Sprite* sprite)
void sub_810310C(u8 battler, struct Sprite* sprite)
{
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
sprite->pos1.x = sub_80A861C(battler, 5) + 8;
sprite->pos1.x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_RIGHT) + 8;
else
sprite->pos1.x = sub_80A861C(battler, 4) - 8;
sprite->pos1.x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_LEFT) - 8;
sprite->pos1.y = GetBattlerSpriteCoord(battler, 3) - (s16)sub_80A861C(battler, 0) / 4;
sprite->pos1.y = GetBattlerSpriteCoord(battler, 3) - (s16)GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_HEIGHT) / 4;
}
void sub_8103164(struct Sprite* sprite)
@ -5520,7 +5520,7 @@ void sub_8103284(struct Sprite* sprite)
battler = gBattleAnimTarget;
sprite->pos1.x = GetBattlerSpriteCoord(battler, 0);
sprite->pos1.y = sub_80A861C(battler, 2);
sprite->pos1.y = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_TOP);
if (sprite->pos1.y <= 9)
sprite->pos1.y = 10;

View File

@ -2446,7 +2446,7 @@ void sub_8104E74(u8 taskId)
task->data[3] = 0;
task->data[4] = 0;
task->data[5] = 0;
task->data[15] = sub_80A861C(gBattleAnimTarget, 0);
task->data[15] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT);
if (GetBattlerSpriteBGPriorityRank(gBattleAnimTarget) == 1)
{
@ -2531,7 +2531,7 @@ void sub_810501C(struct Sprite *sprite)
sprite->data[2] = 0;
sprite->data[3] = 16;
sprite->data[4] = 0;
sprite->data[5] = sub_80A861C(gBattleAnimTarget, 0) + 2;
sprite->data[5] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT) + 2;
sprite->data[6] = BattleAnimAdjustPanning(63);
sprite->callback = sub_8105078;
}

View File

@ -46,7 +46,7 @@ void sub_815ACD0(struct Sprite *);
void sub_815B27C(struct Sprite *);
void sub_815B394(struct Sprite *);
void sub_815B49C(struct Sprite *);
void sub_815B570(struct Sprite *);
void AnimMiniTwinklingStar(struct Sprite *);
void sub_815B70C(struct Sprite *);
void sub_815BE04(struct Sprite *);
void sub_815C400(struct Sprite *);
@ -62,15 +62,15 @@ void sub_815E01C(struct Sprite *);
void sub_815E404(struct Sprite *);
void sub_815E444(struct Sprite *);
void sub_815E6D8(struct Sprite *);
void sub_815E954(struct Sprite *);
void sub_815EA14(struct Sprite *);
void sub_815EE84(struct Sprite *);
void sub_815F18C(struct Sprite *);
void sub_815F48C(struct Sprite *);
void AnimSmellingSaltExclamation(struct Sprite *);
void AnimHelpingHandClap(struct Sprite *);
void AnimForesightMagnifyingGlass(struct Sprite *);
void AnimMeteorMashStar(struct Sprite *);
void AnimBlockX(struct Sprite *);
void sub_815FE80(struct Sprite *);
void sub_81061C4(struct Sprite *);
void sub_8160338(struct Sprite *);
void sub_81603A8(struct Sprite *);
void AnimKnockOffStrike(struct Sprite *);
void AnimRecycle(struct Sprite *);
static void sub_815A114(struct Sprite *);
static void sub_815A1F4(struct Sprite *);
static void sub_815A234(struct Sprite *);
@ -112,18 +112,18 @@ static void sub_815E20C(u8);
static void sub_815E34C(s16, s16, s16, s16, u8, u8, s16 *, s16 *);
static void sub_815E5CC(u8);
static void sub_815E784(struct Sprite *);
static void sub_815E898(u8);
static void sub_815E9BC(struct Sprite *);
static void sub_815EA60(struct Sprite *);
static void sub_815ECE4(u8);
static void sub_815EF08(struct Sprite *);
static void sub_815F330(u8);
static void sub_815F4F0(struct Sprite *);
static void sub_815F79C(u8);
static void sub_815F7C4(struct Sprite *);
static void sub_81601DC(u8);
static void sub_81603F4(struct Sprite *);
static void sub_816058C(u8);
static void AnimTask_SmellingSaltSquishStep(u8);
static void AnimSmellingSaltExclamationStep(struct Sprite *);
static void AnimHelpingHandClapStep(struct Sprite *);
static void AnimTask_HelpingHandAttackerMovementStep(u8);
static void AnimForesightMagnifyingGlassStep(struct Sprite *);
static void AnimTask_MonToSubstituteDoll(u8);
static void AnimBlockXStep(struct Sprite *);
static void AnimTask_OdorSleuthMovementWaitFinish(u8);
static void MoveOdorSleuthClone(struct Sprite *);
static void AnimTask_TeeterDanceMovementStep(u8);
static void AnimRecycleStep(struct Sprite *);
static void AnimTask_SlackOffSquishStep(u8);
const union AnimCmd gUnknown_085CE004[] =
{
@ -539,7 +539,7 @@ const struct SpriteTemplate gUnknown_085CE388 =
.callback = sub_815B49C,
};
const struct SpriteTemplate gUnknown_085CE3A0 =
const struct SpriteTemplate gMiniTwinklingStarSpriteTemplate =
{
.tileTag = ANIM_TAG_GOLD_STARS,
.paletteTag = ANIM_TAG_GOLD_STARS,
@ -547,7 +547,7 @@ const struct SpriteTemplate gUnknown_085CE3A0 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_815B570,
.callback = AnimMiniTwinklingStar,
};
const union AffineAnimCmd gUnknown_085CE3B8[] =
@ -999,14 +999,14 @@ const struct SpriteTemplate gUnknown_085CE864 =
.callback = sub_815E6D8,
};
const union AffineAnimCmd gUnknown_085CE87C[] =
const union AffineAnimCmd gSmellingSaltSquishAffineAnimCmds[] =
{
AFFINEANIMCMD_FRAME(0, -16, 0, 6),
AFFINEANIMCMD_FRAME(0, 16, 0, 6),
AFFINEANIMCMD_END,
};
const struct SpriteTemplate gUnknown_085CE894 =
const struct SpriteTemplate gSmellingSaltExclamationSpriteTemplate =
{
.tileTag = ANIM_TAG_SMELLINGSALT_EFFECT,
.paletteTag = ANIM_TAG_SMELLINGSALT_EFFECT,
@ -1014,10 +1014,10 @@ const struct SpriteTemplate gUnknown_085CE894 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_815E954,
.callback = AnimSmellingSaltExclamation,
};
const struct SpriteTemplate gUnknown_085CE8AC =
const struct SpriteTemplate gHelpingHandClapSpriteTemplate =
{
.tileTag = ANIM_TAG_TAG_HAND,
.paletteTag = ANIM_TAG_TAG_HAND,
@ -1025,10 +1025,10 @@ const struct SpriteTemplate gUnknown_085CE8AC =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_815EA14,
.callback = AnimHelpingHandClap,
};
const struct SpriteTemplate gUnknown_085CE8C4 =
const struct SpriteTemplate gForesightMagnifyingGlassSpriteTemplate =
{
.tileTag = ANIM_TAG_MAGNIFYING_GLASS,
.paletteTag = ANIM_TAG_MAGNIFYING_GLASS,
@ -1036,10 +1036,10 @@ const struct SpriteTemplate gUnknown_085CE8C4 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_815EE84,
.callback = AnimForesightMagnifyingGlass,
};
const struct SpriteTemplate gUnknown_085CE8DC =
const struct SpriteTemplate gMeteorMashStarSpriteTemplate =
{
.tileTag = ANIM_TAG_GOLD_STARS,
.paletteTag = ANIM_TAG_GOLD_STARS,
@ -1047,7 +1047,7 @@ const struct SpriteTemplate gUnknown_085CE8DC =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_815F18C,
.callback = AnimMeteorMashStar,
};
const struct SpriteTemplate gUnknown_085CE8F4 =
@ -1061,7 +1061,7 @@ const struct SpriteTemplate gUnknown_085CE8F4 =
.callback = sub_81061C4,
};
const struct SpriteTemplate gUnknown_085CE90C =
const struct SpriteTemplate gBlockXSpriteTemplate =
{
.tileTag = ANIM_TAG_X_SIGN,
.paletteTag = ANIM_TAG_X_SIGN,
@ -1069,7 +1069,7 @@ const struct SpriteTemplate gUnknown_085CE90C =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_815F48C,
.callback = AnimBlockX,
};
const struct SpriteTemplate gUnknown_085CE924 =
@ -1083,72 +1083,72 @@ const struct SpriteTemplate gUnknown_085CE924 =
.callback = sub_815FE80,
};
const union AnimCmd gUnknown_085CE93C[] =
const union AnimCmd gKnockOffStrikeAnimCmds[] =
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(64, 4),
ANIMCMD_END,
};
const union AnimCmd *const gUnknown_085CE948[] =
const union AnimCmd *const gKnockOffStrikeAnimTable[] =
{
gUnknown_085CE93C,
gKnockOffStrikeAnimCmds,
};
const union AffineAnimCmd gUnknown_085CE94C[] =
const union AffineAnimCmd gKnockOffStrikeAffineanimCmds1[] =
{
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_FRAME(0, 0, -4, 8),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd gUnknown_085CE964[] =
const union AffineAnimCmd gKnockOffStrikeAffineanimCmds2[] =
{
AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
AFFINEANIMCMD_FRAME(0, 0, 4, 8),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd *const gUnknown_085CE97C[] =
const union AffineAnimCmd *const gKnockOffStrikeAffineAnimTable[] =
{
gUnknown_085CE94C,
gUnknown_085CE964,
gKnockOffStrikeAffineanimCmds1,
gKnockOffStrikeAffineanimCmds2,
};
const struct SpriteTemplate gUnknown_085CE984 =
const struct SpriteTemplate gKnockOffStrikeSpriteTemplate =
{
.tileTag = ANIM_TAG_SLAM_HIT_2,
.paletteTag = ANIM_TAG_SLAM_HIT_2,
.oam = &gUnknown_0852497C,
.anims = gUnknown_085CE948,
.anims = gKnockOffStrikeAnimTable,
.images = NULL,
.affineAnims = gUnknown_085CE97C,
.callback = sub_8160338,
.affineAnims = gKnockOffStrikeAffineAnimTable,
.callback = AnimKnockOffStrike,
};
const union AffineAnimCmd gUnknown_085CE99C[] =
const union AffineAnimCmd gRecycleSpriteAffineAnimCmds[] =
{
AFFINEANIMCMD_FRAME(0, 0, -4, 64),
AFFINEANIMCMD_JUMP(0),
};
const union AffineAnimCmd *const gUnknown_085CE9AC[] =
const union AffineAnimCmd *const gRecycleSpriteAffineAnimTable[] =
{
gUnknown_085CE99C,
gRecycleSpriteAffineAnimCmds,
};
const struct SpriteTemplate gUnknown_085CE9B0 =
const struct SpriteTemplate gRecycleSpriteTemplate =
{
.tileTag = ANIM_TAG_RECYCLE,
.paletteTag = ANIM_TAG_RECYCLE,
.oam = &gUnknown_08524A9C,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gUnknown_085CE9AC,
.callback = sub_81603A8,
.affineAnims = gRecycleSpriteAffineAnimTable,
.callback = AnimRecycle,
};
const union AffineAnimCmd gUnknown_085CE9C8[] =
const union AffineAnimCmd gSlackOffSquishAffineAnimCmds[] =
{
AFFINEANIMCMD_FRAME(0, 16, 0, 4),
AFFINEANIMCMD_FRAME(-2, 0, 0, 8),
@ -2108,7 +2108,7 @@ static void sub_815B4D4(struct Sprite *sprite)
if (++sprite->data[2] % 3 == 0)
{
CreateSpriteAndAnimate(
&gUnknown_085CE3A0,
&gMiniTwinklingStarSpriteTemplate,
sprite->pos1.x + sprite->pos2.x,
sprite->pos1.y + sprite->pos2.y,
sprite->subpriority + 1);
@ -2119,7 +2119,7 @@ static void sub_815B4D4(struct Sprite *sprite)
DestroyAnimSprite(sprite);
}
void sub_815B570(struct Sprite *sprite)
void AnimMiniTwinklingStar(struct Sprite *sprite)
{
u8 rand;
s8 y;
@ -3246,7 +3246,7 @@ static void sub_815D1BC(u8 taskId)
if (++gTasks[taskId].data[12] == 9)
{
sub_80A749C(&gSprites[spriteId]);
sub_80A8610(&gSprites[spriteId]);
DestroySpriteAndFreeResources_(&gSprites[spriteId]);
gTasks[taskId].func = sub_80A6814;
}
}
@ -3881,11 +3881,11 @@ void sub_815E114(u8 taskId)
}
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
task->data[11] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + sub_80A861C(gBattleAnimAttacker, 0) / 4;
task->data[11] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4;
else
task->data[11] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) - sub_80A861C(gBattleAnimAttacker, 0) / 4;
task->data[11] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4;
task->data[12] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) - sub_80A861C(gBattleAnimAttacker, 0) / 4;
task->data[12] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4;
task->data[13] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
task->data[14] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
task->func = sub_815E20C;
@ -4012,7 +4012,7 @@ void sub_815E47C(u8 taskId)
task->data[11] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
task->data[12] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
task->data[13] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
task->data[14] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + sub_80A861C(gBattleAnimTarget, 0) / 4;
task->data[14] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT) / 4;
task->data[15] = CreateSprite(&gUnknown_085CE84C, task->data[11], task->data[12], GetBattlerSpriteSubpriority(gBattleAnimTarget) - 5);
if (task->data[15] != MAX_SPRITES)
{
@ -4091,11 +4091,11 @@ void sub_815E6D8(struct Sprite *sprite)
if (gBattleAnimArgs[1] == 0)
{
sprite->oam.matrixNum |= 0x8;
sprite->pos1.x = sub_80A861C(battler, 4) - 8;
sprite->pos1.x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_LEFT) - 8;
}
else
{
sprite->pos1.x = sub_80A861C(battler, 5) + 8;
sprite->pos1.x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_RIGHT) + 8;
}
sprite->callback = sub_815E784;
@ -4147,9 +4147,12 @@ static void sub_815E784(struct Sprite *sprite)
}
}
void sub_815E840(u8 taskId)
// Squishes the mon horizontally a few times.
// arg 0: which mon
// arg 1: number of squishes
void AnimTask_SmellingSaltSquish(u8 taskId)
{
if (gBattleAnimArgs[0] == 0)
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
{
DestroyAnimVisualTask(taskId);
}
@ -4157,12 +4160,12 @@ void sub_815E840(u8 taskId)
{
gTasks[taskId].data[0] = gBattleAnimArgs[1];
gTasks[taskId].data[15] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
PrepareAffineAnimInTaskData(&gTasks[taskId], gTasks[taskId].data[15], gUnknown_085CE87C);
gTasks[taskId].func = sub_815E898;
PrepareAffineAnimInTaskData(&gTasks[taskId], gTasks[taskId].data[15], gSmellingSaltSquishAffineAnimCmds);
gTasks[taskId].func = AnimTask_SmellingSaltSquishStep;
}
}
static void sub_815E898(u8 taskId)
static void AnimTask_SmellingSaltSquishStep(u8 taskId)
{
struct Task *task = &gTasks[taskId];
@ -4180,7 +4183,7 @@ static void sub_815E898(u8 taskId)
gSprites[task->data[15]].pos2.x = 0;
if (--task->data[0])
{
PrepareAffineAnimInTaskData(&gTasks[taskId], gTasks[taskId].data[15], gUnknown_085CE87C);
PrepareAffineAnimInTaskData(&gTasks[taskId], gTasks[taskId].data[15], gSmellingSaltSquishAffineAnimCmds);
task->data[1] = 0;
task->data[2] = 0;
}
@ -4191,17 +4194,21 @@ static void sub_815E898(u8 taskId)
}
}
void sub_815E954(struct Sprite *sprite)
// Blinks an exclamation image over the mon a few times.
// arg 0: which mon
// arg 1: blink delay
// arg 2: number of blinks
void AnimSmellingSaltExclamation(struct Sprite *sprite)
{
if (gBattleAnimArgs[0] == 0)
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
sprite->pos1.y = sub_80A861C(gBattleAnimAttacker, 2);
sprite->pos1.y = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_TOP);
}
else
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->pos1.y = sub_80A861C(gBattleAnimTarget, 2);
sprite->pos1.y = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_TOP);
}
if (sprite->pos1.y < 8)
@ -4211,10 +4218,10 @@ void sub_815E954(struct Sprite *sprite)
sprite->data[1] = gBattleAnimArgs[1];
sprite->data[2] = 0;
sprite->data[3] = gBattleAnimArgs[2];
sprite->callback = sub_815E9BC;
sprite->callback = AnimSmellingSaltExclamationStep;
}
static void sub_815E9BC(struct Sprite *sprite)
static void AnimSmellingSaltExclamationStep(struct Sprite *sprite)
{
if (++sprite->data[0] >= sprite->data[1])
{
@ -4226,11 +4233,14 @@ static void sub_815E9BC(struct Sprite *sprite)
}
}
void sub_815EA14(struct Sprite *sprite)
// Claps a hand several times.
// arg 0: which hand
// arg 1:
void AnimHelpingHandClap(struct Sprite *sprite)
{
if (gBattleAnimArgs[0] == 0)
{
sprite->oam.matrixNum |= 0x8;
sprite->oam.matrixNum |= 0x8; // horizontal flip
sprite->pos1.x = 100;
sprite->data[7] = 1;
}
@ -4241,10 +4251,10 @@ void sub_815EA14(struct Sprite *sprite)
}
sprite->pos1.y = 56;
sprite->callback = sub_815EA60;
sprite->callback = AnimHelpingHandClapStep;
}
static void sub_815EA60(struct Sprite *sprite)
static void AnimHelpingHandClapStep(struct Sprite *sprite)
{
switch (sprite->data[0])
{
@ -4327,7 +4337,9 @@ static void sub_815EA60(struct Sprite *sprite)
}
}
void sub_815EC48(u8 taskId)
// Repeatedly moves the attacking mon in a horizontal lunging motion.
// No args.
void AnimTask_HelpingHandAttackerMovement(u8 taskId)
{
struct Task *task = &gTasks[taskId];
@ -4356,10 +4368,10 @@ void sub_815EC48(u8 taskId)
task->data[14] = 1;
}
task->func = sub_815ECE4;
task->func = AnimTask_HelpingHandAttackerMovementStep;
}
static void sub_815ECE4(u8 taskId)
static void AnimTask_HelpingHandAttackerMovementStep(u8 taskId)
{
struct Task *task = &gTasks[taskId];
@ -4441,9 +4453,11 @@ static void sub_815ECE4(u8 taskId)
}
}
void sub_815EE84(struct Sprite *sprite)
// Moves a magnifying glass around in straight lines.
// arg 0: magnifying glass target mon
void AnimForesightMagnifyingGlass(struct Sprite *sprite)
{
if (gBattleAnimArgs[0] == 0)
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
{
InitSpritePosToAnimAttacker(sprite, TRUE);
sprite->data[7] = gBattleAnimAttacker;
@ -4454,14 +4468,14 @@ void sub_815EE84(struct Sprite *sprite)
}
if (GetBattlerSide(sprite->data[7]) == B_SIDE_OPPONENT)
sprite->oam.matrixNum = 8;
sprite->oam.matrixNum = 8; // horizontal flip
sprite->oam.priority = GetBattlerSpriteBGPriority(sprite->data[7]);
sprite->oam.objMode = ST_OAM_OBJ_BLEND;
sprite->callback = sub_815EF08;
sprite->callback = AnimForesightMagnifyingGlassStep;
}
static void sub_815EF08(struct Sprite *sprite)
static void AnimForesightMagnifyingGlassStep(struct Sprite *sprite)
{
u16 x, y;
@ -4474,20 +4488,20 @@ static void sub_815EF08(struct Sprite *sprite)
sprite->data[6] = 0;
case 0:
case 4:
x = sub_80A861C(sprite->data[7], 5) - 4;
y = sub_80A861C(sprite->data[7], 3) - 4;
x = GetBattlerSpriteCoordAttr(sprite->data[7], 5) - 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], 3) - 4;
break;
case 1:
x = sub_80A861C(sprite->data[7], 5) - 4;
y = sub_80A861C(sprite->data[7], 2) + 4;
x = GetBattlerSpriteCoordAttr(sprite->data[7], 5) - 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], 2) + 4;
break;
case 2:
x = sub_80A861C(sprite->data[7], 4) + 4;
y = sub_80A861C(sprite->data[7], 3) - 4;
x = GetBattlerSpriteCoordAttr(sprite->data[7], 4) + 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], 3) - 4;
break;
case 3:
x = sub_80A861C(sprite->data[7], 4) + 4;
y = sub_80A861C(sprite->data[7], 2) - 4;
x = GetBattlerSpriteCoordAttr(sprite->data[7], 4) + 4;
y = GetBattlerSpriteCoordAttr(sprite->data[7], 2) - 4;
break;
case 5:
x = GetBattlerSpriteCoord(sprite->data[7], 2);
@ -4563,14 +4577,14 @@ static void sub_815EF08(struct Sprite *sprite)
}
}
static void sub_815F10C(struct Sprite *sprite)
static void AnimMeteorMashStarStep(struct Sprite *sprite)
{
sprite->pos2.x = ((sprite->data[2] - sprite->data[0]) * sprite->data[5]) / sprite->data[4];
sprite->pos2.y = ((sprite->data[3] - sprite->data[1]) * sprite->data[5]) / sprite->data[4];
if (!(sprite->data[5] & 1))
{
CreateSprite(
&gUnknown_085CE3A0,
&gMiniTwinklingStarSpriteTemplate,
sprite->pos1.x + sprite->pos2.x,
sprite->pos1.y + sprite->pos2.y, 5);
}
@ -4581,10 +4595,16 @@ static void sub_815F10C(struct Sprite *sprite)
sprite->data[5]++;
}
void sub_815F18C(struct Sprite *sprite)
// Moves a shooting star across the screen that leaves little twinkling stars behind its path.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
// arg 2: destination x pixel offset
// arg 3: destination y pixel offset
// arg 4: duration
void AnimMeteorMashStar(struct Sprite *sprite)
{
GetBattlerSpriteCoord(gBattleAnimTarget, 2); // unused local variable
GetBattlerSpriteCoord(gBattleAnimTarget, 3); // unused local variable
s16 y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); // unused local variable
s16 x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); // unused local variable
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER || IsContest())
{
@ -4602,13 +4622,13 @@ void sub_815F18C(struct Sprite *sprite)
sprite->data[4] = gBattleAnimArgs[4];
sprite->pos1.x = sprite->data[0];
sprite->pos1.y = sprite->data[1];
sprite->callback = sub_815F10C;
sprite->callback = AnimMeteorMashStarStep;
}
void AnimTask_MonToSubstitute(u8 taskId)
{
int i;
u8 spriteId = GetAnimBattlerSpriteId(0);
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
if (gTasks[taskId].data[0] == 0)
{
@ -4642,11 +4662,11 @@ void AnimTask_MonToSubstitute(u8 taskId)
for (i = 0; i < 16; i++)
gTasks[taskId].data[i] = 0;
gTasks[taskId].func = sub_815F330;
gTasks[taskId].func = AnimTask_MonToSubstituteDoll;
}
}
static void sub_815F330(u8 taskId)
static void AnimTask_MonToSubstituteDoll(u8 taskId)
{
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
@ -4699,27 +4719,29 @@ static void sub_815F330(u8 taskId)
}
}
void sub_815F48C(struct Sprite *sprite)
// Moves down an X that flickers and disappears.
// No args.
void AnimBlockX(struct Sprite *sprite)
{
s16 y2;
s16 y;
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
{
sprite->subpriority = GetBattlerSpriteSubpriority(gBattleAnimTarget) - 2;
y2 = -144;
y = -144;
}
else
{
sprite->subpriority = GetBattlerSpriteSubpriority(gBattleAnimTarget) + 2;
y2 = -96;
y = -96;
}
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->pos2.y = y2;
sprite->callback = sub_815F4F0;
sprite->pos2.y = y;
sprite->callback = AnimBlockXStep;
}
static void sub_815F4F0(struct Sprite *sprite)
static void AnimBlockXStep(struct Sprite *sprite)
{
switch (sprite->data[0])
{
@ -4735,7 +4757,7 @@ static void sub_815F4F0(struct Sprite *sprite)
case 1:
sprite->data[1] += 4;
sprite->pos2.y = -(gSineTable[sprite->data[1]] >> 3);
if (sprite->data[1] > 127)
if (sprite->data[1] > 0x7F)
{
PlaySE12WithPanning(SE_W166, BattleAnimAdjustPanning(63));
sprite->data[1] = 0;
@ -4746,7 +4768,7 @@ static void sub_815F4F0(struct Sprite *sprite)
case 2:
sprite->data[1] += 6;
sprite->pos2.y = -(gSineTable[sprite->data[1]] >> 4);
if (sprite->data[1] > 127)
if (sprite->data[1] > 0x7F)
{
sprite->data[1] = 0;
sprite->pos2.y = 0;
@ -4774,7 +4796,9 @@ static void sub_815F4F0(struct Sprite *sprite)
}
}
void sub_815F620(u8 taskId)
// Quickly moves two clones of the target mon back and forth.
// No args.
void AnimTask_OdorSleuthMovement(u8 taskId)
{
s16 spriteId1, spriteId2;
@ -4830,21 +4854,20 @@ void sub_815F620(u8 taskId)
gSprites[spriteId1].invisible = 1;
}
gSprites[spriteId2].oam.objMode = ST_OAM_OBJ_NORMAL;
gSprites[spriteId1].oam.objMode = ST_OAM_OBJ_NORMAL;
gSprites[spriteId2].callback = sub_815F7C4;
gSprites[spriteId1].callback = sub_815F7C4;
gTasks[taskId].func = sub_815F79C;
gSprites[spriteId2].callback = MoveOdorSleuthClone;
gSprites[spriteId1].callback = MoveOdorSleuthClone;
gTasks[taskId].func = AnimTask_OdorSleuthMovementWaitFinish;
}
static void sub_815F79C(u8 taskId)
static void AnimTask_OdorSleuthMovementWaitFinish(u8 taskId)
{
if (gTasks[taskId].data[0] == 0)
DestroyAnimVisualTask(taskId);
}
static void sub_815F7C4(struct Sprite *sprite)
static void MoveOdorSleuthClone(struct Sprite *sprite)
{
int zero = 0;
if (++sprite->data[1] > 1)
@ -4896,7 +4919,9 @@ void AnimTask_GetReturnPowerLevel(u8 taskId)
DestroyAnimVisualTask(taskId);
}
void sub_815F8F4(u8 taskId)
// Makes the mon run out of screen, run past the opposing mon, and return to its original position.
// No args.
void AnimTask_SnatchOpposingMonMove(u8 taskId)
{
u8 spriteId, spriteId2;
int personality;
@ -5010,7 +5035,7 @@ void sub_815F8F4(u8 taskId)
case 3:
spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
spriteId2 = gTasks[taskId].data[15];
sub_80A8610(&gSprites[spriteId2]);
DestroySpriteAndFreeResources_(&gSprites[spriteId2]);
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
gSprites[spriteId].pos2.x = -gSprites[spriteId].pos1.x - 32;
else
@ -5084,7 +5109,9 @@ void sub_815FE80(struct Sprite *sprite)
}
}
void sub_815FFC4(u8 taskId)
// Quickly moves the mon towards its partner and back.
// No args.
void AnimTask_SnatchPartnerMove(u8 taskId)
{
s16 attackerX, targetX;
u8 spriteId;
@ -5143,7 +5170,9 @@ void sub_815FFC4(u8 taskId)
}
}
void sub_8160164(u8 taskId)
// Moves the mon's sprite back and forth in an unpredictable swaying motion.
// No args.
void AnimTask_TeeterDanceMovement(u8 taskId)
{
struct Task *task = &gTasks[taskId];
task->data[3] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
@ -5154,10 +5183,10 @@ void sub_8160164(u8 taskId)
task->data[11] = 0;
task->data[10] = 1;
task->data[12] = 0;
task->func = sub_81601DC;
task->func = AnimTask_TeeterDanceMovementStep;
}
static void sub_81601DC(u8 taskId)
static void AnimTask_TeeterDanceMovementStep(u8 taskId)
{
struct Task *task = &gTasks[taskId];
switch (task->data[0])
@ -5191,7 +5220,7 @@ static void sub_81601DC(u8 taskId)
}
}
static void sub_81602E0(struct Sprite *sprite)
static void AnimKnockOffStrikeStep(struct Sprite *sprite)
{
// These two cases are identical.
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
@ -5213,7 +5242,10 @@ static void sub_81602E0(struct Sprite *sprite)
sprite->data[2]++;
}
void sub_8160338(struct Sprite *sprite)
// Animates a strike that swipes downard at the target mon.
// arg 0: initial x pixel offset
// arg 1: initial y pixel offset
void AnimKnockOffStrike(struct Sprite *sprite)
{
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
{
@ -5231,23 +5263,25 @@ void sub_8160338(struct Sprite *sprite)
sprite->pos1.y += gBattleAnimArgs[1];
}
sprite->callback = sub_81602E0;
sprite->callback = AnimKnockOffStrikeStep;
}
void sub_81603A8(struct Sprite *sprite)
// Gradually fades a rotating recyle arrow sprite in and back out.
// No args.
void AnimRecycle(struct Sprite *sprite)
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->pos1.y = sub_80A861C(gBattleAnimAttacker, 2);
sprite->pos1.y = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_TOP);
if (sprite->pos1.y < 16)
sprite->pos1.y = 16;
sprite->data[6] = 0;
sprite->data[7] = 16;
sprite->callback = sub_81603F4;
sprite->callback = AnimRecycleStep;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[6], sprite->data[7]));
}
static void sub_81603F4(struct Sprite *sprite)
static void AnimRecycleStep(struct Sprite *sprite)
{
switch (sprite->data[2])
{
@ -5322,16 +5356,18 @@ void AnimTask_GetWeather(u8 taskId)
DestroyAnimVisualTask(taskId);
}
void sub_8160544(u8 taskId)
// Squishes the mon sprite vertically, and shakes it back and forth.
// arg 0: which battler
void AnimTask_SlackOffSquish(u8 taskId)
{
struct Task *task = &gTasks[taskId];
task->data[0] = 0;
task->data[15] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
PrepareAffineAnimInTaskData(task, task->data[15], gUnknown_085CE9C8);
task->func = sub_816058C;
PrepareAffineAnimInTaskData(task, task->data[15], gSlackOffSquishAffineAnimCmds);
task->func = AnimTask_SlackOffSquishStep;
}
static void sub_816058C(u8 taskId)
static void AnimTask_SlackOffSquishStep(u8 taskId)
{
struct Task *task = &gTasks[taskId];
@ -5343,13 +5379,9 @@ static void sub_816058C(u8 taskId)
task->data[1] = 0;
task->data[2]++;
if (!(task->data[2] & 1))
{
gSprites[task->data[15]].pos2.x = -1;
}
else
{
gSprites[task->data[15]].pos2.x = 1;
}
}
}
else

View File

@ -357,22 +357,22 @@ void sub_8113A90(struct Sprite *sprite)
switch (gBattleAnimArgs[1])
{
case 0:
sprite->pos1.x = sub_80A861C(battler, 5) - 8;
sprite->pos1.y = sub_80A861C(battler, 2) + 8;
sprite->pos1.x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_RIGHT) - 8;
sprite->pos1.y = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_TOP) + 8;
break;
case 1:
sprite->pos1.x = sub_80A861C(battler, 5) - 14;
sprite->pos1.y = sub_80A861C(battler, 2) + 16;
sprite->pos1.x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_RIGHT) - 14;
sprite->pos1.y = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_TOP) + 16;
break;
case 2:
sprite->pos1.x = sub_80A861C(battler, 4) + 8;
sprite->pos1.y = sub_80A861C(battler, 2) + 8;
sprite->pos1.x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_LEFT) + 8;
sprite->pos1.y = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_TOP) + 8;
StartSpriteAffineAnim(sprite, 1);
xOffset = -20;
break;
case 3:
sprite->pos1.x = sub_80A861C(battler, 4) + 14;
sprite->pos1.y = sub_80A861C(battler, 2) + 16;
sprite->pos1.x = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_LEFT) + 14;
sprite->pos1.y = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_TOP) + 16;
StartSpriteAffineAnim(sprite, 1);
xOffset = -20;
break;
@ -403,7 +403,7 @@ void sub_8113BAC(u8 taskId)
struct Task *task = &gTasks[taskId];
task->data[7] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + 31;
task->data[6] = sub_80A861C(gBattleAnimAttacker, 2) - 7;
task->data[6] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_TOP) - 7;
task->data[5] = task->data[7];
task->data[4] = task->data[6];
task->data[13] = (task->data[7] - task->data[6]) << 8;
@ -576,7 +576,7 @@ void sub_8113E78(u8 taskId)
break;
case 2:
task->data[7] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + 31;
task->data[6] = sub_80A861C(gBattleAnimTarget, 2) - 7;
task->data[6] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_TOP) - 7;
task->data[13] = (task->data[7] - task->data[6]) << 8;
x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
task->data[14] = x - 4;

View File

@ -66,7 +66,7 @@ void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePale
void DecompressPicFromTable(const struct CompressedSpriteSheet *src, void* buffer, s32 species)
{
if (species > SPECIES_EGG)
if (species > NUM_SPECIES)
LZ77UnCompWram(gMonFrontPicTable[0].data, buffer);
else
LZ77UnCompWram(src->data, buffer);
@ -102,7 +102,7 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32
else
LZ77UnCompWram(gMonFrontPicTable[i].data, dest);
}
else if (species > SPECIES_EGG) // is species unknown? draw the ? icon
else if (species > NUM_SPECIES) // is species unknown? draw the ? icon
LZ77UnCompWram(gMonFrontPicTable[0].data, dest);
else
LZ77UnCompWram(src->data, dest);
@ -499,7 +499,7 @@ bool8 LoadCompressedSpritePaletteUsingHeap(const struct CompressedSpritePalette
void DecompressPicFromTable_2(const struct CompressedSpriteSheet *src, void* buffer, s32 species) // a copy of DecompressPicFromTable
{
if (species > SPECIES_EGG)
if (species > NUM_SPECIES)
LZ77UnCompWram(gMonFrontPicTable[0].data, buffer);
else
LZ77UnCompWram(src->data, buffer);
@ -523,7 +523,7 @@ void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s
else
LZ77UnCompWram(gMonFrontPicTable[i].data, dest);
}
else if (species > SPECIES_EGG) // is species unknown? draw the ? icon
else if (species > NUM_SPECIES) // is species unknown? draw the ? icon
LZ77UnCompWram(gMonFrontPicTable[0].data, dest);
else
LZ77UnCompWram(src->data, dest);
@ -546,7 +546,7 @@ void HandleLoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *d
void DecompressPicFromTable_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void* buffer, s32 species)
{
if (species > SPECIES_EGG)
if (species > NUM_SPECIES)
LZ77UnCompWram(gMonFrontPicTable[0].data, buffer);
else
LZ77UnCompWram(src->data, buffer);
@ -581,7 +581,7 @@ void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src
else
LZ77UnCompWram(gMonFrontPicTable[i].data, dest);
}
else if (species > SPECIES_EGG) // is species unknown? draw the ? icon
else if (species > NUM_SPECIES) // is species unknown? draw the ? icon
LZ77UnCompWram(gMonFrontPicTable[0].data, dest);
else
LZ77UnCompWram(src->data, dest);

View File

@ -274,8 +274,8 @@ void sub_8113250(struct Sprite *sprite)
sprite->data[4] = 0;
sprite->data[5] = 1;
sprite->data[6] = gBattleAnimArgs[0];
r5 = sub_80A861C(gBattlerAttacker, 0);
r0 = sub_80A861C(gBattlerAttacker, 1);
r5 = GetBattlerSpriteCoordAttr(gBattlerAttacker, BATTLER_COORD_ATTR_HEIGHT);
r0 = GetBattlerSpriteCoordAttr(gBattlerAttacker, BATTLER_COORD_ATTR_WIDTH);
if (r5 > r0)
sprite->data[7] = r5 / 2;
else

View File

@ -486,8 +486,8 @@ void sub_810CF30(struct Sprite *sprite)
sprite->pos1.x = GetBattlerSpriteCoord(battler, 2);
sprite->pos1.y = GetBattlerSpriteCoord(battler, 3);
xMod = sub_80A861C(battler, 1) / 2;
yMod = sub_80A861C(battler, 0) / 4;
xMod = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_WIDTH) / 2;
yMod = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_HEIGHT) / 4;
x = Random2() % xMod;
y = Random2() % yMod;

View File

@ -800,7 +800,7 @@ void sub_81123C4(u8 taskId)
task->data[10] = gBattleAnimArgs[0];
baseX = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
baseY = sub_80A861C(gBattleAnimAttacker, 3);
baseY = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_BOTTOM);
if (!IsContest())
{
for (battler = 0; battler < 4; battler++)
@ -813,7 +813,7 @@ void sub_81123C4(u8 taskId)
if (spriteId != MAX_SPRITES)
{
x = GetBattlerSpriteCoord(battler, 2);
y = sub_80A861C(battler, 3);
y = GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_BOTTOM);
gSprites[spriteId].data[0] = baseX << 4;
gSprites[spriteId].data[1] = baseY << 4;
gSprites[spriteId].data[2] = ((x - baseX) << 4) / gBattleAnimArgs[1];
@ -1168,7 +1168,7 @@ void sub_8112C6C(u8 taskId)
task->data[1] = 16;
task->data[9] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
task->data[10] = GetBattlerYCoordWithElevation(gBattleAnimAttacker);
task->data[11] = (sub_80A861C(gBattleAnimAttacker, 1) / 2) + 8;
task->data[11] = (GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_WIDTH) / 2) + 8;
task->data[7] = 0;
task->data[5] = GetBattlerSpriteBGPriority(gBattleAnimAttacker);
task->data[6] = GetBattlerSpriteSubpriority(gBattleAnimAttacker) - 2;

View File

@ -1599,12 +1599,12 @@ bool8 GenerateHailParticle(u8 a, u8 b, u8 taskId, u8 c)
switch (unk)
{
case 0:
battlerX -= sub_80A861C(battler, 1) / 6;
battlerY -= sub_80A861C(battler, 0) / 6;
battlerX -= GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_WIDTH) / 6;
battlerY -= GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_HEIGHT) / 6;
break;
case 1:
battlerX += sub_80A861C(battler, 1) / 6;
battlerY += sub_80A861C(battler, 0) / 6;
battlerX += GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_WIDTH) / 6;
battlerY += GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_HEIGHT) / 6;
break;
}
}
@ -1692,7 +1692,7 @@ bool8 GenerateHailParticle(u8 a, u8 b, u8 taskId, u8 c)
_0810CA60:\n\
adds r0, r5, 0\n\
movs r1, 0x1\n\
bl sub_80A861C\n\
bl GetBattlerSpriteCoordAttr\n\
lsls r0, 16\n\
asrs r0, 16\n\
movs r1, 0x6\n\
@ -1704,7 +1704,7 @@ _0810CA60:\n\
lsrs r7, r1, 16\n\
adds r0, r5, 0\n\
movs r1, 0\n\
bl sub_80A861C\n\
bl GetBattlerSpriteCoordAttr\n\
lsls r0, 16\n\
asrs r0, 16\n\
movs r1, 0x6\n\
@ -1716,7 +1716,7 @@ _0810CA60:\n\
_0810CA96:\n\
adds r0, r5, 0\n\
movs r1, 0x1\n\
bl sub_80A861C\n\
bl GetBattlerSpriteCoordAttr\n\
lsls r0, 16\n\
asrs r0, 16\n\
movs r1, 0x6\n\
@ -1728,7 +1728,7 @@ _0810CA96:\n\
lsrs r7, r1, 16\n\
adds r0, r5, 0\n\
movs r1, 0\n\
bl sub_80A861C\n\
bl GetBattlerSpriteCoordAttr\n\
lsls r0, 16\n\
asrs r0, 16\n\
movs r1, 0x6\n\

View File

@ -1170,7 +1170,7 @@ static void sub_80768F0(struct Sprite *sprite)
sprite->callback = SpriteCallbackDummy;
}
static void DestroySpriteAndFreeResources_(struct Sprite *sprite)
static void Unref_DestroySpriteAndFreeResources(struct Sprite *sprite)
{
DestroySpriteAndFreeResources(sprite);
}

View File

@ -6701,7 +6701,7 @@ const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32
{
u32 shinyValue;
if (species > SPECIES_EGG)
if (species > NUM_SPECIES)
return gMonPaletteTable[0].data;
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);

View File

@ -1045,7 +1045,7 @@ u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u
.paletteTag = POKE_ICON_BASE_PAL_TAG + gMonIconPaletteIndices[species],
};
if (species > SPECIES_EGG)
if (species > NUM_SPECIES)
iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG;
spriteId = CreateMonIconSprite(&iconTemplate, x, y, subpriority);
@ -1091,7 +1091,7 @@ u16 GetIconSpecies(u16 species, u32 personality)
}
else
{
if (species > SPECIES_EGG)
if (species > NUM_SPECIES)
result = 260;
else
result = species;
@ -1149,7 +1149,7 @@ void LoadMonIconPalettes(void)
void SafeLoadMonIconPalette(u16 species)
{
u8 palIndex;
if (species > SPECIES_EGG)
if (species > NUM_SPECIES)
species = 260;
palIndex = gMonIconPaletteIndices[species];
if (IndexOfSpritePaletteTag(gMonIconPaletteTable[palIndex].tag) == 0xFF)
@ -1174,7 +1174,7 @@ void FreeMonIconPalettes(void)
void SafeFreeMonIconPalette(u16 species)
{
u8 palIndex;
if (species > SPECIES_EGG)
if (species > NUM_SPECIES)
species = 260;
palIndex = gMonIconPaletteIndices[species];
FreeSpritePaletteByTag(gMonIconPaletteTable[palIndex].tag);
@ -1207,7 +1207,7 @@ void sub_80D304C(u16 offset)
s32 i;
const struct SpritePalette* monIconPalettePtr;
if(offset <= 0xA0)
if (offset <= 0xA0)
{
monIconPalettePtr = gMonIconPaletteTable;
for(i = 5; i >= 0; i--)
@ -1221,7 +1221,7 @@ void sub_80D304C(u16 offset)
u8 GetValidMonIconPalIndex(u16 species)
{
if (species > SPECIES_EGG)
if (species > NUM_SPECIES)
species = 260;
return gMonIconPaletteIndices[species];
}
@ -1233,7 +1233,7 @@ u8 sub_80D30A0(u16 species)
const u16* GetValidMonIconPalettePtr(u16 species)
{
if (species > SPECIES_EGG)
if (species > NUM_SPECIES)
species = 260;
return gMonIconPaletteTable[gMonIconPaletteIndices[species]].data;
}

View File

@ -641,8 +641,8 @@ void sub_810F634(struct Sprite *sprite)
void sub_810F6B0(struct Sprite *sprite)
{
s16 x = sub_80A861C(gBattleAnimAttacker, 1) / 2;
s16 y = sub_80A861C(gBattleAnimAttacker, 0) / -2;
s16 x = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_WIDTH) / 2;
s16 y = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / -2;
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
x = -x;
@ -753,8 +753,8 @@ void sub_810F940(u8 taskId)
task->data[13] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
task->data[14] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
var0 = sub_80A861C(gBattleAnimAttacker, 1) / 3;
var1 = sub_80A861C(gBattleAnimAttacker, 0) / 3;
var0 = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_WIDTH) / 3;
var1 = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 3;
task->data[12] = var0 > var1 ? var0 : var1;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
@ -865,18 +865,18 @@ void sub_810FBF0(u8 taskId)
if (gBattleAnimArgs[0] == 1)
{
task->data[10] = -10;
task->data[11] = sub_80A861C(gBattleAnimTarget, 5) - 8;
task->data[12] = sub_80A861C(gBattleAnimTarget, 2) + 8;
task->data[13] = sub_80A861C(gBattleAnimAttacker, 5) - 8;
task->data[14] = sub_80A861C(gBattleAnimAttacker, 2) + 8;
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_RIGHT) - 8;
task->data[12] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_TOP) + 8;
task->data[13] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_RIGHT) - 8;
task->data[14] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_TOP) + 8;
}
else
{
task->data[10] = 10;
task->data[11] = sub_80A861C(gBattleAnimAttacker, 4) + 8;
task->data[12] = sub_80A861C(gBattleAnimAttacker, 3) - 8;
task->data[13] = sub_80A861C(gBattleAnimTarget, 4) + 8;
task->data[14] = sub_80A861C(gBattleAnimTarget, 3) - 8;
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_LEFT) + 8;
task->data[12] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_BOTTOM) - 8;
task->data[13] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_LEFT) + 8;
task->data[14] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_BOTTOM) - 8;
}
}
else
@ -884,18 +884,18 @@ void sub_810FBF0(u8 taskId)
if (gBattleAnimArgs[0] == 1)
{
task->data[10] = -10;
task->data[11] = sub_80A861C(gBattleAnimTarget, 4) + 8;
task->data[12] = sub_80A861C(gBattleAnimTarget, 2) + 8;
task->data[13] = sub_80A861C(gBattleAnimAttacker, 4) + 8;
task->data[14] = sub_80A861C(gBattleAnimAttacker, 2) + 8;
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_LEFT) + 8;
task->data[12] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_TOP) + 8;
task->data[13] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_LEFT) + 8;
task->data[14] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_TOP) + 8;
}
else
{
task->data[10] = 10;
task->data[11] = sub_80A861C(gBattleAnimAttacker, 5) - 8;
task->data[12] = sub_80A861C(gBattleAnimAttacker, 3) - 8;
task->data[13] = sub_80A861C(gBattleAnimTarget, 5) - 8;
task->data[14] = sub_80A861C(gBattleAnimTarget, 3) - 8;
task->data[11] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_RIGHT) - 8;
task->data[12] = GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_BOTTOM) - 8;
task->data[13] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_RIGHT) - 8;
task->data[14] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_BOTTOM) - 8;
}
}