diff --git a/asm/battle_1.s b/asm/battle_1.s index d450df884..9a981e222 100644 --- a/asm/battle_1.s +++ b/asm/battle_1.s @@ -1424,8 +1424,8 @@ _0803575A: .pool thumb_func_end ApplyPlayerChosenFrameToBattleMenu - thumb_func_start LoadFittingBackgroundForBattle -LoadFittingBackgroundForBattle: @ 8035770 + thumb_func_start DrawMainBattleBackground +DrawMainBattleBackground: @ 8035770 push {r4,r5,lr} ldr r0, =gBattleTypeFlags ldr r1, [r0] @@ -1665,7 +1665,7 @@ _08035A8A: pop {r0} bx r0 .pool - thumb_func_end LoadFittingBackgroundForBattle + thumb_func_end DrawMainBattleBackground thumb_func_start LoadBattleTextboxAndBackground LoadBattleTextboxAndBackground: @ 8035AA4 @@ -1686,7 +1686,7 @@ LoadBattleTextboxAndBackground: @ 8035AA4 movs r2, 0x40 bl LoadCompressedPalette bl ApplyPlayerChosenFrameToBattleMenu - bl LoadFittingBackgroundForBattle + bl DrawMainBattleBackground pop {r0} bx r0 .pool diff --git a/include/battle.h b/include/battle.h index a36fdec23..a7a26e5eb 100644 --- a/include/battle.h +++ b/include/battle.h @@ -830,7 +830,7 @@ void LoadBattleTextboxAndBackground(void); void LoadBattleEntryBackground(void); void ApplyPlayerChosenFrameToBattleMenu(void); bool8 LoadChosenBattleElement(u8 caseId); -void LoadFittingBackgroundForBattle(void); +void DrawMainBattleBackground(void); void task00_0800F6FC(u8 taskId); // battle_5 diff --git a/include/battle_anim.h b/include/battle_anim.h index 3345d7de3..f38572d19 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -39,6 +39,9 @@ struct BattleAnimBackground #define ANIM_ARGS_COUNT 8 +#define PAN_ATTACKER_PLAYER -64 +#define PAN_ATTACKER_OPPONENT 63 + extern void (*gAnimScriptCallback)(void); extern bool8 gAnimScriptActive; extern u8 gAnimVisualTaskCount; diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index 5234e5b6c..f8c89fdbd 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -521,6 +521,8 @@ #define DISPSTAT_HBLANK_INTR 0x0010 // H-Blank interrupt enabled #define DISPSTAT_VCOUNT_INTR 0x0020 // V-Count interrupt enabled +// BLDCNT + // SOUNDCNT_H #define SOUND_CGB_MIX_QUARTER 0x0000 #define SOUND_CGB_MIX_HALF 0x0001 diff --git a/src/battle_anim.c b/src/battle_anim.c index 13b74a84a..8b858f34a 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -831,26 +831,24 @@ void sub_80A477C(bool8 to_BG2) static void task_pA_ma0A_obj_to_bg_pal(u8 taskId) { - u8 r4; - u8 r6; - s16 r3; - s16 r2; + u8 spriteId, palIndex; + s16 x, y; struct UnknownAnimStruct2 unknownStruct; - r4 = gTasks[taskId].data[0]; - r6 = gTasks[taskId].data[6]; + spriteId = gTasks[taskId].data[0]; + palIndex = gTasks[taskId].data[6]; sub_80A6B30(&unknownStruct); - r3 = gTasks[taskId].data[1] - (gSprites[r4].pos1.x + gSprites[r4].pos2.x); - r2 = gTasks[taskId].data[2] - (gSprites[r4].pos1.y + gSprites[r4].pos2.y); + x = gTasks[taskId].data[1] - (gSprites[spriteId].pos1.x + gSprites[spriteId].pos2.x); + y = gTasks[taskId].data[2] - (gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y); if (gTasks[taskId].data[5] == 0) { u16 *src; u16 *dst; - gBattle_BG1_X = r3 + gTasks[taskId].data[3]; - gBattle_BG1_Y = r2 + gTasks[taskId].data[4]; - src = gPlttBufferFaded + 0x100 + r6 * 16; + gBattle_BG1_X = x + gTasks[taskId].data[3]; + gBattle_BG1_Y = y + gTasks[taskId].data[4]; + src = gPlttBufferFaded + 0x100 + palIndex * 16; dst = gPlttBufferFaded + 0x100 + unknownStruct.unk8 * 16 - 256; CpuCopy32(src, dst, 0x20); } @@ -859,9 +857,9 @@ static void task_pA_ma0A_obj_to_bg_pal(u8 taskId) u16 *src; u16 *dst; - gBattle_BG2_X = r3 + gTasks[taskId].data[3]; - gBattle_BG2_Y = r2 + gTasks[taskId].data[4]; - src = gPlttBufferFaded + 0x100 + r6 * 16; + gBattle_BG2_X = x + gTasks[taskId].data[3]; + gBattle_BG2_Y = y + gTasks[taskId].data[4]; + src = gPlttBufferFaded + 0x100 + palIndex * 16; dst = gPlttBufferFaded + 0x100 - 112; CpuCopy32(src, dst, 0x20); } @@ -1232,7 +1230,7 @@ static void LoadDefaultBg(void) if (IsContest()) LoadContestBgAfterMoveAnim(); else - LoadFittingBackgroundForBattle(); + DrawMainBattleBackground(); } static void ScriptCmd_restorebg(void) @@ -1286,39 +1284,39 @@ s8 BattleAnimAdjustPanning(s8 pan) if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].flag_x10) { if (GetBankSide(gAnimBankAttacker) != SIDE_PLAYER) - pan = 63; + pan = PAN_ATTACKER_OPPONENT; else - pan = -64; + pan = PAN_ATTACKER_PLAYER; } else if (IsContest()) { - if (gAnimBankAttacker != gAnimBankTarget || gAnimBankAttacker != 2 || pan != 63) + if (gAnimBankAttacker != gAnimBankTarget || gAnimBankAttacker != 2 || pan != PAN_ATTACKER_OPPONENT) pan *= -1; } else if (GetBankSide(gAnimBankAttacker) == SIDE_PLAYER) { if (GetBankSide(gAnimBankTarget) == SIDE_PLAYER) { - if (pan == 63) - pan = -64; - else if (pan != -64) + if (pan == PAN_ATTACKER_OPPONENT) + pan = PAN_ATTACKER_PLAYER; + else if (pan != PAN_ATTACKER_PLAYER) pan *= -1; } } else if (GetBankSide(gAnimBankTarget) == SIDE_OPPONENT) { - if (pan == -64) - pan = 63; + if (pan == PAN_ATTACKER_PLAYER) + pan = PAN_ATTACKER_OPPONENT; } else { pan *= -1; } - if (pan > 63) - pan = 63; - else if (pan < -64) - pan = -64; + if (pan > PAN_ATTACKER_OPPONENT) + pan = PAN_ATTACKER_OPPONENT; + else if (pan < PAN_ATTACKER_PLAYER) + pan = PAN_ATTACKER_PLAYER; return pan; } @@ -1328,9 +1326,9 @@ s8 BattleAnimAdjustPanning2(s8 pan) if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].flag_x10) { if (GetBankSide(gAnimBankAttacker) != SIDE_PLAYER) - pan = 63; + pan = PAN_ATTACKER_OPPONENT; else - pan = -64; + pan = PAN_ATTACKER_PLAYER; } else {