more battle files cleaning
This commit is contained in:
@@ -43,11 +43,11 @@ extern struct SpriteTemplate gUnknown_0202499C;
|
||||
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
|
||||
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
|
||||
|
||||
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
|
||||
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
|
||||
extern void sub_81B89AC(u8 arg0);
|
||||
extern void sub_81AABB0(void);
|
||||
extern void sub_806A068(u16, u8);
|
||||
extern void sub_81A57E4(u8 bank, u16 stringId);
|
||||
extern void sub_81A57E4(u8 battlerId, u16 stringId);
|
||||
extern void sub_81851A8(u8 *);
|
||||
|
||||
// this file's functions
|
||||
@@ -130,7 +130,7 @@ static void sub_80595A4(u8 taskId);
|
||||
static void PrintLinkStandbyMsg(void);
|
||||
static u32 CopyPlayerMonData(u8 monId, u8 *dst);
|
||||
static void SetPlayerMonData(u8 monId);
|
||||
static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit);
|
||||
static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void PlayerDoMoveAnimation(void);
|
||||
static void task05_08033660(u8 taskId);
|
||||
@@ -1149,10 +1149,10 @@ static void CompleteOnInactiveTextPrinter(void)
|
||||
static void Task_GiveExpToMon(u8 taskId)
|
||||
{
|
||||
u32 monId = (u8)(gTasks[taskId].tExpTask_monId);
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||
|
||||
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[bank]) // give exp without the expbar
|
||||
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[battlerId]) // give exp without the expbar
|
||||
{
|
||||
struct Pokemon *mon = &gPlayerParty[monId];
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
@@ -1168,12 +1168,12 @@ static void Task_GiveExpToMon(u8 taskId)
|
||||
CalculateMonStats(mon);
|
||||
gainedExp -= nextLvlExp - currExp;
|
||||
savedActiveBank = gActiveBattler;
|
||||
gActiveBattler = bank;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBank;
|
||||
|
||||
if (IsDoubleBattle() == TRUE
|
||||
&& ((u16)(monId) == gBattlerPartyIndexes[bank] || (u16)(monId) == gBattlerPartyIndexes[bank ^ BIT_FLANK]))
|
||||
&& ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]))
|
||||
gTasks[taskId].func = sub_8059544;
|
||||
else
|
||||
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
||||
@@ -1182,7 +1182,7 @@ static void Task_GiveExpToMon(u8 taskId)
|
||||
{
|
||||
currExp += gainedExp;
|
||||
SetMonData(mon, MON_DATA_EXP, &currExp);
|
||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
||||
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
@@ -1196,7 +1196,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId)
|
||||
{
|
||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||
s32 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
struct Pokemon *mon = &gPlayerParty[monIndex];
|
||||
u8 level = GetMonData(mon, MON_DATA_LEVEL);
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
@@ -1206,7 +1206,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId)
|
||||
|
||||
exp -= currLvlExp;
|
||||
expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp;
|
||||
SetBattleBarStruct(bank, gHealthboxSpriteIds[bank], expToNextLvl, exp, -gainedExp);
|
||||
SetBattleBarStruct(battlerId, gHealthboxSpriteIds[battlerId], expToNextLvl, exp, -gainedExp);
|
||||
PlaySE(SE_EXP);
|
||||
gTasks[taskId].func = sub_8059400;
|
||||
}
|
||||
@@ -1221,11 +1221,11 @@ static void sub_8059400(u8 taskId)
|
||||
{
|
||||
u8 monId = gTasks[taskId].tExpTask_monId;
|
||||
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
s16 r4;
|
||||
|
||||
r4 = sub_8074AA0(bank, gHealthboxSpriteIds[bank], EXP_BAR, 0);
|
||||
SetHealthboxSpriteVisible(gHealthboxSpriteIds[bank]);
|
||||
r4 = sub_8074AA0(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0);
|
||||
SetHealthboxSpriteVisible(gHealthboxSpriteIds[battlerId]);
|
||||
if (r4 == -1)
|
||||
{
|
||||
u8 level;
|
||||
@@ -1247,7 +1247,7 @@ static void sub_8059400(u8 taskId)
|
||||
CalculateMonStats(&gPlayerParty[monId]);
|
||||
gainedExp -= expOnNextLvl - currExp;
|
||||
savedActiveBank = gActiveBattler;
|
||||
gActiveBattler = bank;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBank;
|
||||
gTasks[taskId].func = sub_8059544;
|
||||
@@ -1256,7 +1256,7 @@ static void sub_8059400(u8 taskId)
|
||||
{
|
||||
currExp += gainedExp;
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp);
|
||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
||||
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
@@ -1265,30 +1265,30 @@ static void sub_8059400(u8 taskId)
|
||||
|
||||
static void sub_8059544(u8 taskId)
|
||||
{
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK])
|
||||
bank ^= BIT_FLANK;
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
|
||||
battlerId ^= BIT_FLANK;
|
||||
|
||||
InitAndLaunchSpecialAnimation(bank, bank, bank, B_ANIM_LVL_UP);
|
||||
InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP);
|
||||
gTasks[taskId].func = sub_80595A4;
|
||||
}
|
||||
|
||||
static void sub_80595A4(u8 taskId)
|
||||
{
|
||||
u8 bank = gTasks[taskId].tExpTask_bank;
|
||||
u8 battlerId = gTasks[taskId].tExpTask_bank;
|
||||
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[bank].specialAnimActive)
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[battlerId].specialAnimActive)
|
||||
{
|
||||
u8 monIndex = gTasks[taskId].tExpTask_monId;
|
||||
|
||||
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
||||
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK])
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[bank ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
else
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId], &gPlayerParty[monIndex], HEALTHBOX_ALL);
|
||||
|
||||
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
|
||||
}
|
||||
@@ -1297,12 +1297,12 @@ static void sub_80595A4(u8 taskId)
|
||||
static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId)
|
||||
{
|
||||
u8 monIndex;
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
monIndex = gTasks[taskId].tExpTask_monId;
|
||||
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
|
||||
bank = gTasks[taskId].tExpTask_bank;
|
||||
gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter;
|
||||
battlerId = gTasks[taskId].tExpTask_bank;
|
||||
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
@@ -2191,35 +2191,35 @@ static void PlayerHandleSwitchInAnim(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_805902C;
|
||||
}
|
||||
|
||||
static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit)
|
||||
static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(bank));
|
||||
ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit);
|
||||
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
|
||||
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
|
||||
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
|
||||
sub_806A068(species, GetBattlerPosition(battlerId));
|
||||
|
||||
gBattlerSpriteIds[bank] = CreateSprite(
|
||||
gBattlerSpriteIds[battlerId] = CreateSprite(
|
||||
&gUnknown_0202499C,
|
||||
GetBattlerSpriteCoord(bank, 2),
|
||||
GetBattlerSpriteDefault_Y(bank),
|
||||
sub_80A82E4(bank));
|
||||
GetBattlerSpriteCoord(battlerId, 2),
|
||||
GetBattlerSpriteDefault_Y(battlerId),
|
||||
sub_80A82E4(battlerId));
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank];
|
||||
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId];
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId;
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].data[0] = bank;
|
||||
gSprites[gBattlerSpriteIds[bank]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].data[2] = species;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId;
|
||||
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]);
|
||||
|
||||
gSprites[gBattlerSpriteIds[bank]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE;
|
||||
gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy;
|
||||
|
||||
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
|
||||
}
|
||||
|
||||
static void PlayerHandleReturnMonToBall(void)
|
||||
@@ -2741,11 +2741,11 @@ static void PlayerHandleStatusIconUpdate(void)
|
||||
{
|
||||
if (!mplay_80342A4(gActiveBattler))
|
||||
{
|
||||
u8 bank;
|
||||
u8 battlerId;
|
||||
|
||||
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON);
|
||||
bank = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
|
||||
battlerId = gActiveBattler;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battlerId].statusAnimActive = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
|
||||
}
|
||||
}
|
||||
@@ -2954,13 +2954,13 @@ static void PlayerHandleIntroTrainerBallThrow(void)
|
||||
|
||||
void sub_805CC00(struct Sprite *sprite)
|
||||
{
|
||||
u8 bank = sprite->data[5];
|
||||
u8 battlerId = sprite->data[5];
|
||||
|
||||
FreeSpriteOamMatrix(sprite);
|
||||
FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum));
|
||||
DestroySprite(sprite);
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[bank]], bank);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], 0);
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], 0);
|
||||
}
|
||||
|
||||
static void task05_08033660(u8 taskId)
|
||||
|
||||
Reference in New Issue
Block a user