Create Macros and refactor
This commit is contained in:
parent
aa841047a3
commit
608da287c1
3 changed files with 52 additions and 65 deletions
|
@ -5003,11 +5003,11 @@ void AnimTask_GetReturnPowerLevel(u8 taskId)
|
|||
void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
||||
{
|
||||
u8 spriteId, spriteId2;
|
||||
int personality;
|
||||
int otId;
|
||||
u32 personality;
|
||||
u32 otId;
|
||||
u16 species;
|
||||
u8 subpriority;
|
||||
u8 isBackPic;
|
||||
bool8 isBackPic;
|
||||
s16 x;
|
||||
|
||||
switch (gTasks[taskId].data[0])
|
||||
|
@ -5035,12 +5035,10 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||
otId = gContestResources->moveAnim->otId;
|
||||
species = gContestResources->moveAnim->species;
|
||||
subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
|
||||
isBackPic = 0;
|
||||
isBackPic = FALSE;
|
||||
x = -32;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
||||
else if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
||||
{
|
||||
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_PERSONALITY);
|
||||
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_OT_ID);
|
||||
|
@ -5050,7 +5048,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||
species = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies;
|
||||
|
||||
subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1;
|
||||
isBackPic = 0;
|
||||
isBackPic = FALSE;
|
||||
x = 272;
|
||||
}
|
||||
else
|
||||
|
@ -5063,10 +5061,9 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||
species = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies;
|
||||
|
||||
subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority - 1;
|
||||
isBackPic = 1;
|
||||
isBackPic = TRUE;
|
||||
x = -32;
|
||||
}
|
||||
}
|
||||
|
||||
spriteId2 = sub_80A8394(species, isBackPic, 0, x, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y), subpriority, personality, otId, gBattleAnimAttacker, 0);
|
||||
if (gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies != SPECIES_NONE)
|
||||
|
@ -5092,7 +5089,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||
if (x < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X))
|
||||
{
|
||||
gTasks[taskId].data[14]++;
|
||||
gBattleAnimArgs[7] = 0xFFFF;
|
||||
gBattleAnimArgs[7] = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -5100,7 +5097,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||
if (x > GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X))
|
||||
{
|
||||
gTasks[taskId].data[14]++;
|
||||
gBattleAnimArgs[7] = 0xFFFF;
|
||||
gBattleAnimArgs[7] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5138,7 +5135,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||
gSprites[spriteId].pos2.x = 0;
|
||||
}
|
||||
|
||||
gTasks[taskId].data[1] = (u8)gTasks[taskId].data[1];
|
||||
gTasks[taskId].data[1] &= 0xFF;
|
||||
if (gSprites[spriteId].pos2.x == 0)
|
||||
DestroyAnimVisualTask(taskId);
|
||||
break;
|
||||
|
|
|
@ -563,9 +563,18 @@ struct FeatherDanceData
|
|||
u16 unkE_1:15;
|
||||
};
|
||||
|
||||
#define ANIM_SWITCH(sprite) \
|
||||
{ \
|
||||
(sprite)->hFlip ^= 1; \
|
||||
(sprite)->animNum = (sprite)->hFlip; \
|
||||
(sprite)->animBeginning = TRUE; \
|
||||
(sprite)->animEnded = FALSE; \
|
||||
}
|
||||
|
||||
static void AnimFallingFeather(struct Sprite *sprite)
|
||||
{
|
||||
u8 battler, matrixNum, sinIndex;
|
||||
u8 battler, sinIndex;
|
||||
u32 matrixNum;
|
||||
s16 sinVal;
|
||||
|
||||
struct FeatherDanceData *data = (struct FeatherDanceData *)sprite->data;
|
||||
|
@ -583,12 +592,12 @@ static void AnimFallingFeather(struct Sprite *sprite)
|
|||
data->unkE_1 = (u16)(sinVal + gBattleAnimArgs[6]);
|
||||
data->unk0_0c = 1;
|
||||
data->unk2 = (u16)(gBattleAnimArgs[2] & 0xFF);
|
||||
data->unkA = (u16)((gBattleAnimArgs[2] >> 8) & 0xFF) ;
|
||||
data->unkA = (u16)gBattleAnimArgs[2] >> 8;
|
||||
data->unk4 = gBattleAnimArgs[3];
|
||||
data->unk6 = (u16)gBattleAnimArgs[4];
|
||||
*(u16 *)(data->unkC) = (u16)gBattleAnimArgs[5];
|
||||
|
||||
if (data->unk2 >= 64 && data->unk2 <= 191)
|
||||
if (data->unk2 >= 64 && data->unk2 < 192)
|
||||
{
|
||||
if (!IsContest())
|
||||
sprite->oam.priority = GetBattlerSpriteBGPriority(battler) + 1;
|
||||
|
@ -599,11 +608,7 @@ static void AnimFallingFeather(struct Sprite *sprite)
|
|||
|
||||
if (!(data->unk4 & 0x8000))
|
||||
{
|
||||
sprite->hFlip ^= 1;
|
||||
sprite->animNum = sprite->hFlip;
|
||||
|
||||
sprite->animBeginning = 1;
|
||||
sprite->animEnded = 0;
|
||||
ANIM_SWITCH(sprite);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -613,11 +618,7 @@ static void AnimFallingFeather(struct Sprite *sprite)
|
|||
|
||||
if (data->unk4 & 0x8000)
|
||||
{
|
||||
sprite->hFlip ^= 1;
|
||||
sprite->animNum = sprite->hFlip;
|
||||
|
||||
sprite->animBeginning = 1;
|
||||
sprite->animEnded = 0;
|
||||
ANIM_SWITCH(sprite);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -637,7 +638,8 @@ static void AnimFallingFeather(struct Sprite *sprite)
|
|||
|
||||
static void sub_810E520(struct Sprite *sprite)
|
||||
{
|
||||
u8 matrixNum, sinIndex;
|
||||
u8 sinIndex;
|
||||
u32 matrixNum;
|
||||
s16 sinVal = 0;
|
||||
struct FeatherDanceData *data = (struct FeatherDanceData *)sprite->data;
|
||||
if (data->unk0_0a)
|
||||
|
@ -667,10 +669,7 @@ static void sub_810E520(struct Sprite *sprite)
|
|||
}
|
||||
else if (data->unk0_0d)
|
||||
{
|
||||
sprite->hFlip ^= 1;
|
||||
sprite->animNum = sprite->hFlip;
|
||||
sprite->animBeginning = TRUE;
|
||||
sprite->animEnded = FALSE;
|
||||
ANIM_SWITCH(sprite);
|
||||
if (data->unk0_0c)
|
||||
{
|
||||
if (!IsContest())
|
||||
|
@ -718,10 +717,7 @@ static void sub_810E520(struct Sprite *sprite)
|
|||
}
|
||||
else if (data->unk0_0d)
|
||||
{
|
||||
sprite->hFlip ^= 1;
|
||||
sprite->animNum = sprite->hFlip;
|
||||
sprite->animBeginning = TRUE;
|
||||
sprite->animEnded = FALSE;
|
||||
ANIM_SWITCH(sprite);
|
||||
if (data->unk0_0c)
|
||||
{
|
||||
if (!IsContest())
|
||||
|
@ -769,10 +765,7 @@ static void sub_810E520(struct Sprite *sprite)
|
|||
}
|
||||
else if (data->unk0_0d)
|
||||
{
|
||||
sprite->hFlip ^= 1;
|
||||
sprite->animNum = sprite->hFlip;
|
||||
sprite->animBeginning = TRUE;
|
||||
sprite->animEnded = FALSE;
|
||||
ANIM_SWITCH(sprite);
|
||||
if (data->unk0_0c)
|
||||
{
|
||||
if (!IsContest())
|
||||
|
@ -819,10 +812,7 @@ static void sub_810E520(struct Sprite *sprite)
|
|||
}
|
||||
else if (data->unk0_0d)
|
||||
{
|
||||
sprite->hFlip ^= 1;
|
||||
sprite->animNum = sprite->hFlip;
|
||||
sprite->animBeginning = TRUE;
|
||||
sprite->animEnded = FALSE;
|
||||
ANIM_SWITCH(sprite);
|
||||
if (data->unk0_0c)
|
||||
{
|
||||
if (!IsContest())
|
||||
|
|
|
@ -1774,7 +1774,7 @@ static int GetNumOwnedBadges(void)
|
|||
static bool32 sub_8196D74(int matchCallId)
|
||||
{
|
||||
int dayCount;
|
||||
int otId;
|
||||
u32 otId;
|
||||
u16 easyChatWord;
|
||||
int numRematchTrainersFought;
|
||||
int var0, var1, var2;
|
||||
|
|
Loading…
Reference in a new issue