From 6a4967689e62e6a3276bbe2372e8066cdfacb6fd Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Tue, 6 Feb 2018 13:48:02 -0600 Subject: [PATCH] more renaming --- asm/battle_anim_80A5C6C.s | 234 +-- asm/battle_anim_80A9C70.s | 12 +- asm/battle_anim_80D51AC.s | 86 +- asm/battle_anim_80FE840.s | 1870 ++++++++--------- asm/battle_anim_815A0D4.s | 394 ++-- asm/battle_anim_8170478.s | 130 +- asm/battle_anim_sound_tasks.s | 30 +- asm/battle_link_817C95C.s | 230 +-- asm/battle_tower.s | 2 +- asm/contest.s | 24 +- asm/party_menu.s | 14 +- asm/pokemon_item_effect.s | 8 +- data/battle_scripts_1.s | 26 +- include/battle_anim.h | 14 +- include/battle_controllers.h | 112 +- include/battle_gfx_sfx_util.h | 4 +- include/battle_interface.h | 4 +- include/battle_link_817C95C.h | 2 +- include/battle_script_commands.h | 2 +- include/battle_util.h | 4 +- include/pokemon.h | 2 +- include/recorded_battle.h | 6 +- src/battle_ai_script_commands.c | 144 +- src/battle_ai_switch_items.c | 48 +- src/battle_anim.c | 142 +- src/battle_controller_link_opponent.c | 308 +-- src/battle_controller_link_partner.c | 300 +-- src/battle_controller_opponent.c | 332 +-- src/battle_controller_player.c | 446 ++-- src/battle_controller_player_partner.c | 334 +-- src/battle_controller_recorded_opponent.c | 300 +-- src/battle_controller_recorded_player.c | 326 +-- src/battle_controller_safari.c | 72 +- src/battle_controller_wally.c | 200 +- src/battle_controllers.c | 340 +-- src/battle_gfx_sfx_util.c | 95 +- src/battle_interface.c | 54 +- src/battle_main.c | 454 ++-- src/battle_message.c | 66 +- src/battle_script_commands.c | 2298 ++++++++++----------- src/battle_util.c | 464 +++-- src/battle_util2.c | 14 +- src/item_use.c | 4 +- src/pokeball.c | 88 +- src/pokemon_2.c | 8 +- src/pokemon_3.c | 22 +- src/pokemon_animation.c | 4 +- src/recorded_battle.c | 28 +- src/reshow_battle_screen.c | 98 +- sym_common.txt | 4 +- sym_ewram.txt | 10 +- 51 files changed, 5105 insertions(+), 5108 deletions(-) diff --git a/asm/battle_anim_80A5C6C.s b/asm/battle_anim_80A5C6C.s index 12aa61185..202861b83 100644 --- a/asm/battle_anim_80A5C6C.s +++ b/asm/battle_anim_80A5C6C.s @@ -5,8 +5,8 @@ .text - thumb_func_start GetBankCoord -GetBankCoord: @ 80A5C6C + thumb_func_start GetBattlerSpriteCoord +GetBattlerSpriteCoord: @ 80A5C6C push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 @@ -102,7 +102,7 @@ _080A5D28: ldrh r0, [r1, 0x2] cmp r0, 0 bne _080A5D98 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r5, 1 adds r0, r1 ldrh r1, [r0] @@ -120,7 +120,7 @@ _080A5D60: ldrh r0, [r1, 0x2] cmp r0, 0 bne _080A5D98 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r5, 1 adds r0, r1 ldrh r1, [r0] @@ -154,7 +154,7 @@ _080A5DB0: pop {r4,r5} pop {r1} bx r1 - thumb_func_end GetBankCoord + thumb_func_end GetBattlerSpriteCoord thumb_func_start sub_80A5DB8 sub_80A5DB8: @ 80A5DB8 @@ -203,7 +203,7 @@ _080A5E04: ldrh r0, [r0, 0x2] cmp r0, 0 bne _080A5E3C - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r1 ldrh r1, [r0] @@ -293,7 +293,7 @@ _080A5EC8: ldrh r0, [r0, 0x2] cmp r0, 0 bne _080A5F04 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r1 ldrh r1, [r0] @@ -577,7 +577,7 @@ _080A611C: _080A6126: adds r0, r4, 0 adds r1, r5, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord _080A612E: lsls r0, 24 lsrs r0, 24 @@ -586,18 +586,18 @@ _080A612E: bx r1 thumb_func_end sub_80A60AC - thumb_func_start GetBankSpriteDefault_Y -GetBankSpriteDefault_Y: @ 80A6138 + thumb_func_start GetBattlerSpriteDefault_Y +GetBattlerSpriteDefault_Y: @ 80A6138 push {lr} lsls r0, 24 lsrs r0, 24 movs r1, 0x4 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 pop {r1} bx r1 - thumb_func_end GetBankSpriteDefault_Y + thumb_func_end GetBattlerSpriteDefault_Y thumb_func_start GetSubstituteSpriteDefault_Y GetSubstituteSpriteDefault_Y: @ 80A614C @@ -611,7 +611,7 @@ GetSubstituteSpriteDefault_Y: @ 80A614C beq _080A6170 adds r0, r4, 0 movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 8 movs r1, 0x80 @@ -620,7 +620,7 @@ GetSubstituteSpriteDefault_Y: @ 80A614C _080A6170: adds r0, r4, 0 movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 8 movs r1, 0x88 @@ -642,7 +642,7 @@ sub_80A6190: @ 80A6190 lsrs r5, r0, 24 adds r0, r5, 0 movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 bl IsContest @@ -662,7 +662,7 @@ sub_80A6190: @ 80A6190 ldrh r0, [r1, 0x2] cmp r0, 0 bne _080A621C - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r5, 1 adds r0, r1 ldrh r1, [r0] @@ -680,7 +680,7 @@ _080A61E4: ldrh r0, [r1, 0x2] cmp r0, 0 bne _080A621C - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r5, 1 adds r0, r1 ldrh r1, [r0] @@ -716,56 +716,56 @@ _080A6238: bx r1 thumb_func_end sub_80A6190 - thumb_func_start GetAnimBankSpriteId -GetAnimBankSpriteId: @ 80A6240 + thumb_func_start GetBattlerSpriteId +GetBattlerSpriteId: @ 80A6240 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 adds r1, r0, 0 cmp r0, 0 bne _080A6268 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] - bl IsBankSpritePresent + bl IsBattlerSpritePresent lsls r0, 24 cmp r0, 0 beq _080A62B6 - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldrb r0, [r4] b _080A62C6 .pool _080A6268: cmp r0, 0x1 bne _080A6288 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] - bl IsBankSpritePresent + bl IsBattlerSpritePresent lsls r0, 24 cmp r0, 0 beq _080A62B6 - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldrb r0, [r4] b _080A62C6 .pool _080A6288: cmp r1, 0x2 bne _080A62A4 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r4, 0x2 eors r0, r4 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A62B6 b _080A62C0 .pool _080A62A4: - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r4, 0x2 eors r0, r4 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 bne _080A62C0 @@ -774,7 +774,7 @@ _080A62B6: b _080A62CA .pool _080A62C0: - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldrb r0, [r5] eors r0, r4 _080A62C6: @@ -785,7 +785,7 @@ _080A62CA: pop {r1} bx r1 .pool - thumb_func_end GetAnimBankSpriteId + thumb_func_end GetBattlerSpriteId thumb_func_start StoreSpriteCallbackInData6 StoreSpriteCallbackInData6: @ 80A62D4 @@ -1242,16 +1242,16 @@ sub_80A65EC: @ 80A65EC ldrh r1, [r4, 0x22] adds r0, r1 strh r0, [r4, 0x34] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -1439,16 +1439,16 @@ sub_80A6760: @ 80A6760 ldrh r1, [r4, 0x22] adds r0, r1 strh r0, [r4, 0x34] - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -1547,16 +1547,16 @@ sub_80A6814: @ 80A6814 sub_80A6838: @ 80A6838 push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -1575,16 +1575,16 @@ sub_80A6864: @ 80A6864 lsls r1, 16 lsrs r5, r1, 16 mov r8, r5 - ldr r7, =gAnimBankAttacker + ldr r7, =gBattleAnimAttacker ldrb r0, [r7] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 cmp r6, r0 @@ -1729,7 +1729,7 @@ sub_80A6980: @ 80A6980 lsls r1, 24 cmp r1, 0 bne _080A69A8 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0 bl sub_80A60AC @@ -1765,7 +1765,7 @@ sub_80A69CC: @ 80A69CC lsls r1, 24 cmp r1, 0 bne _080A69F0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0 bl sub_80A60AC @@ -1777,7 +1777,7 @@ sub_80A69CC: @ 80A69CC b _080A6A04 .pool _080A69F0: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 bl sub_80A60AC @@ -1862,8 +1862,8 @@ _080A6A7E: .pool thumb_func_end GetBattlerAtPosition - thumb_func_start IsBankSpritePresent -IsBankSpritePresent: @ 80A6A90 + thumb_func_start IsBattlerSpritePresent +IsBattlerSpritePresent: @ 80A6A90 push {r4,r5,lr} lsls r0, 24 lsrs r4, r0, 24 @@ -1872,11 +1872,11 @@ IsBankSpritePresent: @ 80A6A90 lsls r0, 24 cmp r0, 0 beq _080A6ABC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] cmp r0, r4 beq _080A6B0A - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] cmp r0, r4 beq _080A6B0A @@ -1893,7 +1893,7 @@ _080A6ABC: lsls r0, 24 cmp r0, 0 beq _080A6AF0 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r1 ldrh r1, [r0] @@ -1903,7 +1903,7 @@ _080A6ABC: b _080A6AFE .pool _080A6AF0: - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r5, 1 adds r0, r1 ldrh r1, [r0] @@ -1926,7 +1926,7 @@ _080A6B1A: pop {r4,r5} pop {r1} bx r1 - thumb_func_end IsBankSpritePresent + thumb_func_end IsBattlerSpritePresent thumb_func_start IsDoubleBattle IsDoubleBattle: @ 80A6B20 @@ -2061,7 +2061,7 @@ sub_80A6BFC: @ 80A6BFC b _080A6C60 .pool _080A6C30: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -2889,7 +2889,7 @@ sub_80A7238: @ 80A7238 beq _080A7268 ldr r4, =gSprites movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 lsls r1, r0, 4 @@ -2934,7 +2934,7 @@ sub_80A7270: @ 80A7270 cmp r0, 0 bne _080A72A6 adds r0, r7, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A72B4 @@ -3372,7 +3372,7 @@ _080A75F6: _080A7602: cmp r7, 0 beq _080A7614 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r1, r0, 0 adds r1, 0x10 @@ -3383,7 +3383,7 @@ _080A7614: mov r0, r8 cmp r0, 0 beq _080A7628 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r1, r0, 0 adds r1, 0x10 @@ -3394,11 +3394,11 @@ _080A7628: mov r0, r9 cmp r0, 0 beq _080A764E - ldr r6, =gAnimBankAttacker + ldr r6, =gBattleAnimAttacker ldrb r0, [r6] movs r5, 0x2 eors r0, r5 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A764E @@ -3413,11 +3413,11 @@ _080A764E: mov r0, r10 cmp r0, 0 beq _080A7674 - ldr r6, =gAnimBankTarget + ldr r6, =gBattleAnimTarget ldrb r0, [r6] movs r5, 0x2 eors r0, r5 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A7674 @@ -3499,7 +3499,7 @@ _080A76F2: bl GetBattlerAtPosition lsls r0, 24 lsrs r0, 24 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A771A @@ -3517,7 +3517,7 @@ _080A771A: bl GetBattlerAtPosition lsls r0, 24 lsrs r0, 24 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A7746 @@ -3537,7 +3537,7 @@ _080A7746: bl GetBattlerAtPosition lsls r0, 24 lsrs r0, 24 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A7772 @@ -3558,7 +3558,7 @@ _080A7772: bl GetBattlerAtPosition lsls r0, 24 lsrs r0, 24 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A77A0 @@ -3670,7 +3670,7 @@ _080A7838: _080A7842: adds r0, r5, 0 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -3682,10 +3682,10 @@ _080A7842: _080A785C: ldrh r0, [r6, 0x8] strh r0, [r5, 0x2E] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r6, 0x4] @@ -3693,7 +3693,7 @@ _080A785C: strh r0, [r5, 0x32] ldrb r0, [r4] adds r1, r7, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r6, [r6, 0x6] @@ -3716,7 +3716,7 @@ sub_80A78AC: @ 80A78AC adds r6, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -3730,10 +3730,10 @@ _080A78CC: ldr r4, =gBattleAnimArgs ldrh r0, [r4, 0x8] strh r0, [r6, 0x2E] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x4] @@ -3741,7 +3741,7 @@ _080A78CC: strh r0, [r6, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x6] @@ -3799,17 +3799,17 @@ _080A7954: adds r0, r5, 0 adds r1, r4, 0 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _080A7976 .pool _080A796C: adds r0, r5, 0 adds r1, r4, 0 bl sub_80A6980 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _080A7976: ldrb r6, [r0] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -3828,7 +3828,7 @@ _080A798E: strh r0, [r5, 0x2E] adds r0, r6, 0 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r2, [r4, 0x4] @@ -3836,7 +3836,7 @@ _080A798E: strh r0, [r5, 0x32] adds r0, r6, 0 adds r1, r7, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r4, [r4, 0x6] @@ -3858,7 +3858,7 @@ duplicate_obj_of_side_rel2move_in_transparent_mode: @ 80A79E8 push {r4-r6,lr} lsls r0, 24 lsrs r0, 24 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r1, r0, 24 cmp r1, 0xFF @@ -4084,7 +4084,7 @@ sub_80A7B98: @ 80A7B98 lsrs r4, r0, 24 ldr r0, =gBattleAnimArgs ldrb r0, [r0] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r3, r0, 24 cmp r3, 0xFF @@ -4539,7 +4539,7 @@ sub_80A7F18: @ 80A7F18 lsls r0, 24 lsrs r5, r0, 24 movs r4, 0 - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldr r7, =0x00000181 ldr r0, =gBattleMonForms adds r6, r5, r0 @@ -4579,7 +4579,7 @@ _080A7F78: ldrh r0, [r1, 0x2] cmp r0, 0 bne _080A7FC0 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r1 ldrh r1, [r0] @@ -4614,7 +4614,7 @@ _080A7FD8: ldrh r0, [r1, 0x2] cmp r0, 0 bne _080A8010 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r1 ldrh r1, [r0] @@ -4837,14 +4837,14 @@ sub_80A8174: @ 80A8174 lsls r0, 24 lsrs r4, r0, 24 adds r7, r4, 0 - ldr r6, =gAnimBankTarget + ldr r6, =gBattleAnimTarget ldrb r0, [r6] - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A81B4 ldr r2, =gSprites - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldrb r0, [r6] adds r0, r1 ldrb r0, [r0] @@ -4863,15 +4863,15 @@ sub_80A8174: @ 80A8174 orrs r0, r2 strb r0, [r1, 0x5] _080A81B4: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker mov r8, r0 ldrb r0, [r0] - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A81EC ldr r2, =gSprites - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds mov r3, r8 ldrb r0, [r3] adds r0, r1 @@ -4894,12 +4894,12 @@ _080A81EC: ldrb r0, [r6] movs r5, 0x2 eors r0, r5 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A8224 ldr r2, =gSprites - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldrb r0, [r6] eors r0, r5 adds r0, r1 @@ -4922,12 +4922,12 @@ _080A8224: mov r1, r8 ldrb r0, [r1] eors r0, r5 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A825C ldr r2, =gSprites - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds mov r3, r8 ldrb r0, [r3] eors r0, r5 @@ -4968,13 +4968,13 @@ _080A8286: lsls r0, r5, 24 lsrs r4, r0, 24 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080A82C8 adds r0, r4, 0 bl sub_80A82E4 - ldr r3, =gBankSpriteIds + ldr r3, =gBattlerSpriteIds adds r3, r5, r3 ldrb r2, [r3] lsls r1, r2, 4 @@ -5499,7 +5499,7 @@ _080A86C4: ldrh r0, [r1, 0x2] cmp r0, 0 bne _080A871C - ldr r0, =gBattlePartyID + ldr r0, =gBattlerPartyIndexes mov r1, r8 lsls r4, r1, 1 adds r4, r0 @@ -5589,7 +5589,7 @@ _080A8790: ldrh r0, [r1, 0x2] cmp r0, 0 bne _080A87DC - ldr r0, =gBattlePartyID + ldr r0, =gBattlerPartyIndexes mov r1, r8 lsls r4, r1, 1 adds r4, r0 @@ -5713,7 +5713,7 @@ _080A88A6: _080A88AE: mov r0, r8 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrb r1, [r4] @@ -5722,7 +5722,7 @@ _080A88AE: _080A88C0: mov r0, r8 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrb r1, [r4] @@ -5731,7 +5731,7 @@ _080A88C0: _080A88D2: mov r0, r8 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrb r2, [r4] @@ -5744,7 +5744,7 @@ _080A88E4: _080A88EA: mov r0, r8 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrb r2, [r4] @@ -5757,7 +5757,7 @@ _080A88FC: _080A8902: mov r0, r8 movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, 0x1F @@ -5798,13 +5798,13 @@ _080A8942: _080A8946: adds r0, r4, 0 adds r1, r5, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 mov r8, r0 adds r0, r4, 0 adds r1, r6, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r7, r0, 24 bl IsDoubleBattle @@ -5819,12 +5819,12 @@ _080A8946: eors r4, r0 adds r0, r4, 0 adds r1, r5, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r5, r0, 24 adds r0, r4, 0 adds r1, r6, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r3, r0, 24 mov r0, r8 @@ -5941,7 +5941,7 @@ sub_80A8A6C: @ 80A8A6C push {r4,lr} adds r4, r0, 0 bl sub_80A6838 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -5998,7 +5998,7 @@ _080A8AB6: sub_80A8AEC: @ 80A8AEC push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -6054,7 +6054,7 @@ sub_80A8B64: @ 80A8B64 push {r4,lr} adds r4, r0, 0 bl sub_80A6838 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -6101,12 +6101,12 @@ sub_80A8BC4: @ 80A8BC4 ldr r0, =gTasks adds r5, r1, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 movs r6, 0 strh r0, [r5, 0x8] - ldr r7, =gAnimBankAttacker + ldr r7, =gBattleAnimAttacker ldrb r0, [r7] bl GetBattlerSide lsls r0, 24 @@ -6389,16 +6389,16 @@ _080A8E26: sub_80A8E30: @ 80A8E30 push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -6487,7 +6487,7 @@ sub_80A8EE4: @ 80A8EE4 ldrh r1, [r4, 0x22] adds r0, r1 strh r0, [r4, 0x36] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 diff --git a/asm/battle_anim_80A9C70.s b/asm/battle_anim_80A9C70.s index 82981ff21..755653156 100644 --- a/asm/battle_anim_80A9C70.s +++ b/asm/battle_anim_80A9C70.s @@ -17,7 +17,7 @@ sub_80A9C70: @ 80A9C70 lsrs r4, 24 lsls r5, 24 lsrs r5, 24 - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r4, r0 ldrb r6, [r0] ldr r0, =sub_80A9DB4 @@ -331,10 +331,10 @@ sub_80A9EF4: @ 80A9EF4 push {r4-r6,lr} lsls r0, 24 lsrs r6, r0, 24 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 8 ldr r1, =0xffe00000 @@ -342,7 +342,7 @@ sub_80A9EF4: @ 80A9EF4 lsrs r5, r0, 16 ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 8 ldr r1, =0xffdc0000 @@ -863,9 +863,9 @@ LaunchStatusAnimation: @ 80AA364 lsrs r4, 24 lsls r1, 24 lsrs r1, 24 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker strb r4, [r0] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget strb r4, [r0] ldr r0, =gBattleAnims_Statuses movs r2, 0 diff --git a/asm/battle_anim_80D51AC.s b/asm/battle_anim_80D51AC.s index 514bf2594..7714d1a2f 100644 --- a/asm/battle_anim_80D51AC.s +++ b/asm/battle_anim_80D51AC.s @@ -12,7 +12,7 @@ sub_80D51AC: @ 80D51AC lsrs r5, r0, 24 ldr r4, =gBattleAnimArgs ldrb r0, [r4] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -165,7 +165,7 @@ sub_80D52D0: @ 80D52D0 bgt _080D52FC lsls r0, 24 lsrs r0, 24 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r3, r0, 24 cmp r3, 0xFF @@ -204,19 +204,19 @@ _080D5326: lsls r0, 24 lsrs r4, r0, 24 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 bne _080D533C movs r6, 0x1 _080D533C: - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r4, r0 b _080D5350 .pool _080D5348: - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r0, r1 _080D5350: @@ -379,7 +379,7 @@ sub_80D5484: @ 80D5484 lsrs r5, r0, 24 ldr r4, =gBattleAnimArgs ldrb r0, [r4] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r3, r0, 24 cmp r3, 0xFF @@ -603,7 +603,7 @@ sub_80D5644: @ 80D5644 lsrs r4, 24 ldr r5, =gBattleAnimArgs ldrb r0, [r5] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 ldr r2, =gSprites @@ -723,7 +723,7 @@ sub_80D5738: @ 80D5738 movs r6, 0x1 ldr r4, =gBattleAnimArgs ldrb r0, [r4] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r7, r0, 24 movs r1, 0x8 @@ -842,7 +842,7 @@ sub_80D5830: @ 80D5830 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -871,7 +871,7 @@ sub_80D5860: @ 80D5860 movs r1, 0x4 orrs r0, r1 strb r0, [r2] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -891,8 +891,8 @@ _080D5894: movs r0, 0 strh r2, [r4, 0x2E] strh r0, [r4, 0x32] - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r0, r1 ldrb r0, [r0] @@ -938,7 +938,7 @@ sub_80D58F8: @ 80D58F8 strb r0, [r2] ldr r5, =gBattleAnimArgs ldrb r0, [r5, 0x4] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 ldrh r2, [r5] @@ -987,13 +987,13 @@ sub_80D5968: @ 80D5968 ldrsh r0, [r0, r1] cmp r0, 0 bne _080D598C - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker b _080D5990 .pool _080D598C: - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankTarget + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimTarget _080D5990: ldrb r0, [r0] adds r0, r1 @@ -1133,14 +1133,14 @@ sub_80D5A94: @ 80D5A94 ldrsh r0, [r0, r1] cmp r0, 0 bne _080D5AB0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _080D5AB2 .pool _080D5AB0: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _080D5AB2: ldrb r2, [r0] - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r2, r0 ldrb r6, [r0] adds r0, r2, 0 @@ -1218,14 +1218,14 @@ sub_80D5B48: @ 80D5B48 ldrsh r0, [r0, r1] cmp r0, 0 bne _080D5B70 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _080D5B72 .pool _080D5B70: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _080D5B72: ldrb r1, [r0] - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r1, r0 ldrb r7, [r0] adds r0, r1, 0 @@ -1338,7 +1338,7 @@ sub_80D5C50: @ 80D5C50 bl __divsi3 lsls r0, 16 lsrs r7, r0, 16 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -1352,7 +1352,7 @@ sub_80D5C50: @ 80D5C50 strh r0, [r5, 0xA] _080D5C82: ldrb r0, [r5] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId ldr r1, =gTasks lsls r4, r6, 2 adds r4, r6 @@ -1508,7 +1508,7 @@ sub_80D5DB0: @ 80D5DB0 cmp r0, 0 blt _080D5E10 ldrb r0, [r1] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r2, r0, 24 b _080D5E18 @@ -1518,20 +1518,20 @@ _080D5DD8: beq _080D5DE8 b _080D5E10 _080D5DDE: - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker b _080D5DEA .pool _080D5DE8: - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget _080D5DEA: ldrb r0, [r5] movs r4, 0x2 eors r0, r4 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _080D5E10 - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldrb r0, [r5] eors r0, r4 adds r0, r1 @@ -1549,7 +1549,7 @@ _080D5E18: lsls r0, 3 adds r5, r0, r1 strh r2, [r5, 0x8] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -1622,7 +1622,7 @@ sub_80D5EB8: @ 80D5EB8 push {r4-r6,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r6, =gAnimBankAttacker + ldr r6, =gBattleAnimAttacker ldrb r0, [r6] bl GetBattlerSide lsls r0, 24 @@ -1635,7 +1635,7 @@ sub_80D5EB8: @ 80D5EB8 _080D5ED4: ldr r4, =gBattleAnimArgs ldrb r0, [r4, 0x8] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 ldr r2, =gTasks @@ -1660,7 +1660,7 @@ _080D5ED4: b _080D5F18 .pool _080D5F14: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] _080D5F18: strh r0, [r2, 0x12] @@ -1836,7 +1836,7 @@ sub_80D6064: @ 80D6064 lsrs r4, 24 ldr r6, =gBattleAnimArgs ldrb r0, [r6, 0x6] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 @@ -1939,7 +1939,7 @@ sub_80D6134: @ 80D6134 lsrs r7, r0, 24 ldr r4, =gBattleAnimArgs ldrb r0, [r4, 0x4] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 mov r8, r0 @@ -1995,11 +1995,11 @@ _080D61B8: ldrsh r0, [r6, r1] cmp r0, 0 bne _080D61C8 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _080D61CA .pool _080D61C8: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _080D61CA: ldrb r0, [r0] bl GetBattlerSide @@ -2057,7 +2057,7 @@ sub_80D622C: @ 80D622C lsrs r5, r0, 24 ldr r4, =gBattleAnimArgs ldrb r0, [r4, 0x4] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 mov r8, r0 @@ -2076,11 +2076,11 @@ sub_80D622C: @ 80D622C ldrsh r0, [r4, r1] cmp r0, 0 bne _080D6274 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _080D6276 .pool _080D6274: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _080D6276: ldrb r0, [r0] bl GetBattlerSide @@ -2290,7 +2290,7 @@ _080D63EE: ldrh r0, [r1, 0x8] strh r0, [r4, 0x1E] movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x16] diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index 7671f473d..5cbaf41f7 100644 --- a/asm/battle_anim_80FE840.s +++ b/asm/battle_anim_80FE840.s @@ -22,7 +22,7 @@ sub_80FE840: @ 80FE840 strh r0, [r4, 0x2E] ldrh r0, [r5, 0x6] strh r0, [r4, 0x30] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -96,16 +96,16 @@ sub_80FE8E0: @ 80FE8E0 ldr r0, =gBattleAnimArgs ldrh r0, [r0, 0x4] strh r0, [r4, 0x2E] - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -132,16 +132,16 @@ sub_80FE930: @ 80FE930 bl StartSpriteAnim ldrh r0, [r5, 0x4] strh r0, [r4, 0x2E] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -167,10 +167,10 @@ sub_80FE988: @ 80FE988 strh r0, [r4, 0x2E] ldrh r0, [r4, 0x20] strh r0, [r4, 0x30] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] @@ -178,7 +178,7 @@ sub_80FE988: @ 80FE988 strh r0, [r4, 0x34] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -212,14 +212,14 @@ _080FE9FA: ldrsh r0, [r4, r1] cmp r0, 0x7F ble _080FEA14 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A82E4 adds r0, 0x1 b _080FEA1E .pool _080FEA14: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A82E4 adds r0, 0x6 @@ -287,7 +287,7 @@ sub_80FEA58: @ 80FEA58 strh r0, [r1, 0x4] strh r2, [r1, 0x6] ldr r4, =gUnknown_08592210 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A82E4 adds r3, r0, 0 @@ -321,16 +321,16 @@ sub_80FEAD8: @ 80FEAD8 ldr r6, =gBattleAnimArgs ldrh r0, [r6, 0x6] strh r0, [r4, 0x2E] - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -374,16 +374,16 @@ sub_80FEB44: @ 80FEB44 ands r1, r0 adds r0, r5, 0 bl StartSpriteAnim - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -410,10 +410,10 @@ _080FEB94: strh r0, [r5, 0x2E] ldrh r0, [r5, 0x20] strh r0, [r5, 0x30] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] @@ -421,7 +421,7 @@ _080FEB94: strh r0, [r5, 0x34] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -494,7 +494,7 @@ sub_80FEC48: @ 80FEC48 adds r6, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -508,10 +508,10 @@ _080FEC68: ldr r4, =gBattleAnimArgs ldrh r0, [r4, 0x8] strh r0, [r6, 0x2E] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x4] @@ -519,7 +519,7 @@ _080FEC68: strh r0, [r6, 0x32] ldrb r0, [r5] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x6] @@ -655,7 +655,7 @@ sub_80FED74: @ 80FED74 lsrs r0, 16 cmp r0, 0x7F bhi _080FEDC8 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8328 movs r1, 0x3 @@ -669,7 +669,7 @@ sub_80FED74: @ 80FED74 b _080FEDEC .pool _080FEDC8: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8328 adds r0, 0x1 @@ -730,7 +730,7 @@ _080FEE36: bl DestroyAnimVisualTask b _080FEE70 _080FEE3E: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -771,10 +771,10 @@ sub_80FEE78: @ 80FEE78 strh r0, [r4, 0x32] ldrh r0, [r4, 0x22] strh r0, [r4, 0x34] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r5, [r5, 0x4] @@ -823,14 +823,14 @@ sub_80FEECC: @ 80FEECC lsrs r0, 16 cmp r0, 0x7F bhi _080FEF18 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A82E4 subs r0, 0x1 b _080FEF22 .pool _080FEF18: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A82E4 adds r0, 0x1 @@ -868,10 +868,10 @@ sub_80FEF44: @ 80FEF44 strh r0, [r4, 0x32] ldrh r0, [r4, 0x22] strh r0, [r4, 0x34] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r5, [r5, 0x4] @@ -950,16 +950,16 @@ _080FEFF6: sub_80FEFFC: @ 80FEFFC push {r4,r5,lr} adds r4, r0, 0 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -1026,7 +1026,7 @@ _080FF08C: sub_80FF090: @ 80FF090 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -1080,7 +1080,7 @@ sub_80FF0F4: @ 80FF0F4 adds r5, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -1098,10 +1098,10 @@ _080FF114: ldrsh r0, [r6, r1] cmp r0, 0 bne _080FF154 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r6, 0x4] @@ -1109,7 +1109,7 @@ _080FF114: strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r6, [r6, 0x6] @@ -1117,7 +1117,7 @@ _080FF114: b _080FF174 .pool _080FF154: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r5, 0 adds r2, 0x32 @@ -1139,11 +1139,11 @@ _080FF174: strh r0, [r5, 0x38] adds r0, r5, 0 bl sub_80A68D4 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide adds r4, r0, 0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r4, 24 @@ -1265,7 +1265,7 @@ sub_80FF268: @ 80FF268 lsrs r0, 24 cmp r0, 0x1 bne _080FF28A - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r4, 0 adds r2, 0x20 @@ -1350,7 +1350,7 @@ _080FF2F8: ldrsh r0, [r4, r1] cmp r0, 0x7F bgt _080FF338 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8328 lsls r0, 24 @@ -1359,7 +1359,7 @@ _080FF2F8: b _080FF346 .pool _080FF338: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8328 lsls r0, 24 @@ -1434,7 +1434,7 @@ sub_80FF3B0: @ 80FF3B0 ands r0, r1 strb r0, [r2] movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId movs r0, 0x80 lsls r0, 1 strh r0, [r4, 0x2E] @@ -1452,7 +1452,7 @@ sub_80FF3EC: @ 80FF3EC push {r4,lr} adds r4, r0, 0 movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId movs r1, 0x32 ldrsh r0, [r4, r1] cmp r0, 0 @@ -1517,7 +1517,7 @@ sub_80FF458: @ 80FF458 lsls r0, 24 lsrs r4, r0, 24 movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r1, r0, 24 ldr r0, =gSprites @@ -1550,7 +1550,7 @@ _080FF498: lsls r0, 28 lsrs r0, 30 strh r0, [r6, 0x24] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget mov r9, r0 ldrb r0, [r0] bl sub_80A8328 @@ -1567,7 +1567,7 @@ _080FF498: orrs r0, r1 strb r0, [r7, 0x5] movs r0, 0x3 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r1, r0, 24 lsls r4, r1, 4 @@ -1618,7 +1618,7 @@ sub_80FF53C: @ 80FF53C lsls r4, 24 lsrs r4, 24 movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 adds r6, r0, 0 @@ -1639,7 +1639,7 @@ sub_80FF53C: @ 80FF53C lsls r1, 16 asrs r1, 24 strh r1, [r5, 0x24] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -1698,7 +1698,7 @@ sub_80FF5CC: @ 80FF5CC cmp r5, 0 bne _080FF674 movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -1723,7 +1723,7 @@ sub_80FF5CC: @ 80FF5CC orrs r0, r2 strb r0, [r1, 0x5] movs r0, 0x3 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 lsls r1, r0, 4 @@ -1785,7 +1785,7 @@ sub_80FF698: @ 80FF698 beq _080FF704 b _080FF756 _080FF6AA: - ldr r6, =gAnimBankTarget + ldr r6, =gBattleAnimTarget ldrb r0, [r6] bl GetBattlerSide lsls r0, 24 @@ -1799,7 +1799,7 @@ _080FF6AA: _080FF6C2: ldrb r0, [r6] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -1808,7 +1808,7 @@ _080FF6C2: strh r0, [r5, 0x20] ldrb r0, [r6] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r4, [r4, 0x2] @@ -1845,16 +1845,16 @@ _080FF704: bl ChangeSpriteAffineAnim movs r0, 0x19 strh r0, [r5, 0x2E] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -1878,16 +1878,16 @@ sub_80FF768: @ 80FF768 ldrsh r0, [r5, r1] cmp r0, 0 bne _080FF7D4 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -1941,31 +1941,31 @@ sub_80FF7EC: @ 80FF7EC push {r4-r6} sub sp, 0x4 mov r9, r0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord mov r8, r0 mov r0, r8 lsls r0, 24 lsrs r0, 24 mov r8, r0 - ldr r6, =gAnimBankTarget + ldr r6, =gBattleAnimTarget ldrb r0, [r6] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 ldrb r0, [r6] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r2, r0, 0 lsls r2, 24 subs r4, r5 @@ -2095,10 +2095,10 @@ sub_80FF934: @ 80FF934 ldrsh r0, [r6, r1] cmp r0, 0 bne _080FF974 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -2107,7 +2107,7 @@ sub_80FF934: @ 80FF934 strh r0, [r6, 0x20] ldrb r0, [r5] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x2] @@ -2349,18 +2349,18 @@ sub_80FFB18: @ 80FFB18 adds r5, r0, 0 movs r1, 0 bl sub_80A69CC - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r2, r0, 24 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r1, [r0] movs r0, 0x2 eors r0, r1 @@ -2453,10 +2453,10 @@ _080FFBEC: sub_80FFBF4: @ 80FFBF4 push {r4-r6,lr} adds r5, r0, 0 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 ldrb r0, [r4] @@ -2551,18 +2551,18 @@ sub_80FFCB4: @ 80FFCB4 adds r5, r0, 0 movs r1, 0 bl sub_80A6980 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r2, r0, 24 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r1, [r0] movs r0, 0x2 eors r0, r1 @@ -2954,7 +2954,7 @@ sub_80FFFC0: @ 80FFFC0 lsls r0, 3 ldr r1, =gTasks adds r5, r0, r1 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] bl sub_80A82E4 lsls r0, 24 @@ -2963,13 +2963,13 @@ sub_80FFFC0: @ 80FFFC0 strh r0, [r5, 0x10] ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x14] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x16] @@ -3772,11 +3772,11 @@ sub_8100640: @ 8100640 ldrsh r0, [r0, r1] cmp r0, 0 bne _0810065C - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0810065E .pool _0810065C: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0810065E: ldrb r6, [r0] adds r0, r6, 0 @@ -3837,7 +3837,7 @@ _081006CE: _081006D4: adds r0, r6, 0 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r5, [r5] @@ -3857,17 +3857,17 @@ _081006E4: strb r0, [r4, 0x5] b _08100738 _08100700: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r7, [r7] adds r0, r7 strh r0, [r4, 0x22] movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId _0810071A: adds r0, r6, 0 bl sub_80A8328 @@ -4074,20 +4074,20 @@ _081008B4: ldrsh r0, [r1, r3] cmp r0, 0 bne _081008C4 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _081008C6 .pool _081008C4: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _081008C6: ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r5, r0, 24 ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r2, r0, 24 ldr r0, =gBattleAnimArgs @@ -4237,7 +4237,7 @@ _081009F2: sub_81009F8: @ 81009F8 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -4277,7 +4277,7 @@ _08100A2C: sub_8100A50: @ 8100A50 push {r4,r5,lr} adds r5, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -4343,16 +4343,16 @@ sub_8100A94: @ 8100A94 sub_8100AE0: @ 8100AE0 push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -4439,12 +4439,12 @@ sub_8100B88: @ 8100B88 b _08100C24 .pool _08100BA8: - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r4, 0x2 eors r0, r4 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r7, r0, 24 ldrb r0, [r5] @@ -4453,15 +4453,15 @@ _08100BA8: b _08100C34 .pool _08100BC8: - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r7, r0, 24 ldrb r0, [r5] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r4, r0, 24 ldrb r0, [r5] @@ -4469,7 +4469,7 @@ _08100BC8: mov r8, r2 mov r1, r8 eors r0, r1 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _08100C3E @@ -4477,7 +4477,7 @@ _08100BC8: mov r2, r8 eors r0, r2 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r7 @@ -4486,7 +4486,7 @@ _08100BC8: mov r1, r8 eors r0, r1 movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r4 @@ -4494,22 +4494,22 @@ _08100BC8: b _08100C3E .pool _08100C24: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r7, r0, 24 ldrb r0, [r4] _08100C34: movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r4, r0, 24 _08100C3E: strh r7, [r6, 0x20] strh r4, [r6, 0x22] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -4754,7 +4754,7 @@ sub_8100E1C: @ 8100E1C ldr r4, =gBattleAnimArgs ldrh r0, [r4, 0x4] strh r0, [r5, 0x2E] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -4866,7 +4866,7 @@ sub_8100EF0: @ 8100EF0 adds r0, 0x8 strh r0, [r1, 0x2] _08100F06: - ldr r6, =gAnimBankAttacker + ldr r6, =gBattleAnimAttacker ldrb r0, [r6] movs r1, 0 bl sub_80A60AC @@ -5090,17 +5090,17 @@ _081010C2: sub_81010CC: @ 81010CC push {r4-r6,lr} adds r4, r0, 0 - ldr r6, =gAnimBankTarget + ldr r6, =gBattleAnimTarget ldrb r0, [r6] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 movs r5, 0 strh r0, [r4, 0x20] ldrb r0, [r6] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldr r1, =0x0000ffe8 @@ -5426,11 +5426,11 @@ sub_810135C: @ 810135C ldrsh r0, [r0, r1] cmp r0, 0 bne _08101378 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0810137A .pool _08101378: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0810137A: ldrb r6, [r0] bl IsDoubleBattle @@ -5440,7 +5440,7 @@ _0810137A: movs r1, 0x2 adds r0, r6, 0 eors r0, r1 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _081013C4 @@ -5470,7 +5470,7 @@ _081013C4: bne _081013E8 adds r0, r6, 0 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] @@ -5481,14 +5481,14 @@ _081013C4: _081013E8: adds r0, r6, 0 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] adds r0, r6, 0 movs r1, 0x3 _081013FA: - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r4, [r4, 0x2] @@ -5523,7 +5523,7 @@ sub_8101440: @ 8101440 push {r4,lr} adds r4, r0, 0 bl sub_80A6838 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -5611,7 +5611,7 @@ sub_81014F4: @ 81014F4 push {r4,lr} adds r4, r0, 0 bl sub_80A6838 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -5885,17 +5885,17 @@ _08101718: strh r1, [r5, 0x24] movs r0, 0x6 strh r0, [r5, 0x2E] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r7 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r6 @@ -6199,7 +6199,7 @@ sub_8101998: @ 8101998 adds r4, r0, 0 movs r0, 0x6 strh r0, [r4, 0x2E] - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] bl GetBattlerSide lsls r0, 24 @@ -6213,7 +6213,7 @@ _081019B6: strh r1, [r4, 0x30] movs r0, 0 strh r0, [r4, 0x32] - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldrb r0, [r5] adds r0, r1 ldrb r0, [r0] @@ -6237,8 +6237,8 @@ sub_81019E8: @ 81019E8 ldrsh r6, [r5, r0] cmp r6, 0 bne _08101A24 - ldr r1, =gBankSpriteIds - ldr r4, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] adds r0, r1 ldrb r0, [r0] @@ -6301,7 +6301,7 @@ sub_8101A74: @ 8101A74 adds r4, r0, 0 movs r0, 0x4 strh r0, [r4, 0x2E] - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] bl GetBattlerSide lsls r0, 24 @@ -6315,7 +6315,7 @@ _08101A92: strh r1, [r4, 0x30] movs r0, 0 strh r0, [r4, 0x32] - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldrb r0, [r5] adds r0, r1 ldrb r0, [r0] @@ -6360,8 +6360,8 @@ sub_8101AE8: @ 8101AE8 ldrsh r0, [r5, r1] cmp r0, 0 bne _08101B38 - ldr r1, =gBankSpriteIds - ldr r4, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] adds r0, r1 ldrb r0, [r0] @@ -6465,8 +6465,8 @@ _08101BB6: b _08101C8E _08101BBC: strh r5, [r4, 0x30] - ldr r1, =gBankSpriteIds - ldr r2, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r2, =gBattleAnimAttacker ldrb r0, [r2] adds r0, r1 ldrb r0, [r0] @@ -6575,8 +6575,8 @@ sub_8101C94: @ 8101C94 adds r0, r6 lsls r0, 3 adds r5, r0, r1 - ldr r1, =gBankSpriteIds - ldr r2, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r2, =gBattleAnimAttacker ldrb r0, [r2] adds r0, r1 ldrb r0, [r0] @@ -6922,15 +6922,15 @@ sub_8101F40: @ 8101F40 ldrsh r0, [r6, r1] cmp r0, 0 bne _08101F5C - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _08101F5E .pool _08101F5C: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _08101F5E: ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r6, 0x2] @@ -6938,7 +6938,7 @@ _08101F5E: strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r6, [r6, 0x4] @@ -6962,10 +6962,10 @@ _08101F5E: sub_8101FA8: @ 8101FA8 push {r4,r5,lr} adds r4, r0, 0 - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldr r1, =0x0000ffd0 @@ -6973,7 +6973,7 @@ sub_8101FA8: @ 8101FA8 strh r0, [r4, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -6992,10 +6992,10 @@ sub_8101FA8: @ 8101FA8 sub_8101FF0: @ 8101FF0 push {r4-r6,lr} adds r4, r0, 0 - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldr r1, =gBattleAnimArgs @@ -7007,7 +7007,7 @@ sub_8101FF0: @ 8101FF0 strh r0, [r4, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -7115,15 +7115,15 @@ sub_81020D8: @ 81020D8 ldrsh r0, [r6, r1] cmp r0, 0 bne _081020F4 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _081020F6 .pool _081020F4: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _081020F6: ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r6, 0x2] @@ -7131,7 +7131,7 @@ _081020F6: strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r6, [r6, 0x4] @@ -7191,17 +7191,17 @@ _08102178: sub_810217C: @ 810217C push {r4-r6,lr} adds r4, r0, 0 - ldr r6, =gAnimBankAttacker + ldr r6, =gBattleAnimAttacker ldrb r0, [r6] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 movs r5, 0 strh r0, [r4, 0x20] ldrb r0, [r6] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 subs r0, 0xC @@ -7316,10 +7316,10 @@ sub_8102268: @ 8102268 ldrsh r0, [r6, r1] cmp r0, 0 bne _081022B2 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r5, =gBattleAnimArgs lsrs r0, 24 @@ -7328,7 +7328,7 @@ sub_8102268: @ 8102268 strh r0, [r6, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r5, [r5, 0x2] @@ -7465,16 +7465,16 @@ _08102390: strb r0, [r2] movs r0, 0x1E strh r0, [r5, 0x2E] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -7544,7 +7544,7 @@ sub_8102434: @ 8102434 cmp r4, r0 bcs _08102490 ldr r6, =gBattleAnimArgs - ldr r5, =gHealthBoxesIds + ldr r5, =gHealthboxSpriteIds _08102448: movs r1, 0 ldrsh r0, [r6, r1] @@ -7597,7 +7597,7 @@ sub_81024A8: @ 81024A8 movs r4, 0 b _081024C2 _081024B2: - ldr r0, =gHealthBoxesIds + ldr r0, =gHealthboxSpriteIds adds r0, r4, r0 ldrb r0, [r0] bl SetHealthboxSpriteVisible @@ -7673,10 +7673,10 @@ _0810253A: sub_8102540: @ 8102540 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r2, =gBattleAnimArgs lsrs r0, 24 @@ -8068,10 +8068,10 @@ _08102862: strh r0, [r5, 0x2E] ldrh r0, [r6, 0x4] strh r0, [r5, 0x30] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r6] @@ -8079,7 +8079,7 @@ _08102862: strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r6, [r6, 0x2] @@ -8113,7 +8113,7 @@ _08102862: b _081028FA .pool _081028D4: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -8237,7 +8237,7 @@ sub_81029B4: @ 81029B4 ldr r1, =gTasks adds r6, r0, r1 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x8] @@ -8333,7 +8333,7 @@ _08102A88: _08102A9A: ldr r0, =sub_8102AE0 str r0, [r6] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -8374,7 +8374,7 @@ sub_8102AE0: @ 8102AE0 ldrsh r0, [r0, r1] cmp r0, 0 bne _08102B32 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -8657,15 +8657,15 @@ _08102D10: b _08102D4E .pool _08102D34: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r3, r0, 24 _08102D4E: @@ -8855,7 +8855,7 @@ _08102EA6: sub_8102EB0: @ 8102EB0 push {r4-r7,lr} adds r6, r0, 0 - ldr r7, =gAnimBankAttacker + ldr r7, =gBattleAnimAttacker ldrb r0, [r7] bl GetBattlerSide lsls r0, 24 @@ -8870,7 +8870,7 @@ sub_8102EB0: @ 8102EB0 _08102ECE: ldrb r0, [r7] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -8880,7 +8880,7 @@ _08102ECE: strh r0, [r6, 0x20] ldrb r0, [r7] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r2, [r4, 0x4] @@ -9002,17 +9002,17 @@ sub_8102FB8: @ 8102FB8 _08102FDC: ldr r6, =0x0000fff0 _08102FDE: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r6 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, 0x8 @@ -9167,7 +9167,7 @@ _08103136: strh r0, [r6, 0x20] adds r0, r5, 0 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 adds r0, r5, 0 movs r1, 0 @@ -9197,11 +9197,11 @@ sub_8103164: @ 8103164 ldrsh r0, [r0, r1] cmp r0, 0 bne _08103180 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08103182 .pool _08103180: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08103182: ldrb r4, [r0] adds r0, r4, 0 @@ -9268,11 +9268,11 @@ sub_8103208: @ 8103208 ldrsh r0, [r0, r1] cmp r0, 0 bne _08103224 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08103226 .pool _08103224: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08103226: ldrb r0, [r0] adds r1, r4, 0 @@ -9325,16 +9325,16 @@ sub_8103284: @ 8103284 ldrsh r0, [r0, r1] cmp r0, 0 bne _081032A0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _081032A2 .pool _081032A0: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _081032A2: ldrb r5, [r0] adds r0, r5, 0 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 movs r6, 0 @@ -9463,11 +9463,11 @@ sub_8103390: @ 8103390 ldrsh r0, [r0, r1] cmp r0, 0 bne _081033AC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _081033AE .pool _081033AC: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _081033AE: ldrb r4, [r0] adds r0, r4, 0 @@ -9591,11 +9591,11 @@ sub_8103498: @ 8103498 ldrsh r0, [r0, r1] cmp r0, 0 bne _081034B4 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _081034B6 .pool _081034B4: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _081034B6: ldrb r0, [r0] adds r1, r4, 0 @@ -9716,21 +9716,21 @@ _0810357A: sub_810358C: @ 810358C push {r4-r6,lr} adds r5, r0, 0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankTarget + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r0, r1 ldrb r6, [r0] @@ -9846,8 +9846,8 @@ sub_81036A0: @ 81036A0 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r0, r1 ldrb r0, [r0] @@ -9871,8 +9871,8 @@ sub_81036DC: @ 81036DC push {r4-r6,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r1, r0, r1 ldrb r4, [r1] @@ -9992,7 +9992,7 @@ sub_81037D8: @ 81037D8 push {r4,r5,lr} adds r4, r0, 0 bl sub_80A6838 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -10018,7 +10018,7 @@ _08103810: ldrh r1, [r4, 0x22] adds r0, r1 strh r0, [r4, 0x22] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -10117,7 +10117,7 @@ sub_81038C8: @ 81038C8 b _0810390E .pool _081038EC: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -10137,10 +10137,10 @@ _0810390E: adds r0, r5, 0 movs r1, 0x1 bl sub_80A69CC - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r6, =gBattleAnimArgs lsrs r0, 24 @@ -10151,7 +10151,7 @@ _0810390E: mov r8, r0 ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r2, [r6, 0x6] @@ -10677,7 +10677,7 @@ _08103D54: b _08103DB6 _08103D5C: ldr r1, =gBattlerPositions - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r0, r1 ldrb r1, [r0] @@ -10716,10 +10716,10 @@ _08103DB0: _08103DB4: strh r0, [r2, 0x4] _08103DB6: - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord ldr r1, =gTasks mov r3, r8 adds r4, r3, r7 @@ -10731,7 +10731,7 @@ _08103DB6: adds r6, r0, 0 ldrb r0, [r5] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x1C] @@ -10742,11 +10742,11 @@ _08103DB6: ands r0, r1 cmp r0, 0 beq _08103E20 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r1, [r4] movs r0, 0x2 eors r0, r1 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _08103E20 @@ -10759,16 +10759,16 @@ _08103DB6: .pool _08103E20: mov r5, sp - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 mov r1, r10 @@ -10897,7 +10897,7 @@ _08103F28: asrs r0, 16 cmp r0, 0x3F ble _08103FA0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A82E4 lsls r0, 24 @@ -10914,7 +10914,7 @@ _08103F78: asrs r0, 16 cmp r0, 0x3F ble _08103FA0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A82E4 lsls r0, 24 @@ -10927,7 +10927,7 @@ _08103F78: b _08103FB0 .pool _08103FA0: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A82E4 lsls r0, 24 @@ -11050,15 +11050,15 @@ sub_8104088: @ 8104088 adds r5, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -11066,7 +11066,7 @@ sub_8104088: @ 8104088 adds r0, r1 lsls r0, 16 lsrs r7, r0, 16 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -11145,7 +11145,7 @@ sub_8104154: @ 8104154 lsls r0, 16 asrs r0, 24 strh r0, [r4, 0x24] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -11200,16 +11200,16 @@ sub_81041C4: @ 81041C4 bl sub_80A69CC movs r0, 0x14 strh r0, [r4, 0x2E] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -11352,7 +11352,7 @@ sub_8104304: @ 8104304 adds r4, r0, 0 movs r1, 0 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -11423,17 +11423,17 @@ _08104390: strh r0, [r5, 0x22] movs r0, 0x6 strh r0, [r5, 0x2E] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 add r0, r8 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r6 @@ -11510,10 +11510,10 @@ _08104448: movs r0, 0x6 strh r0, [r5, 0x2E] strh r1, [r5, 0x30] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 add r0, r9 @@ -11522,7 +11522,7 @@ _08104448: strh r0, [r5, 0x34] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r6 @@ -11678,7 +11678,7 @@ sub_81045B0: @ 81045B0 lsls r5, 24 lsrs r5, 24 movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -11735,7 +11735,7 @@ sub_8104614: @ 8104614 cmp r1, r0 bne _08104664 movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -11771,7 +11771,7 @@ sub_8104674: @ 8104674 ldr r0, =gTasks adds r4, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 movs r5, 0 @@ -11786,7 +11786,7 @@ sub_8104674: @ 8104674 strh r0, [r4, 0x10] strh r5, [r4, 0x12] strh r5, [r4, 0x14] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A82E4 lsls r0, 24 @@ -12129,7 +12129,7 @@ sub_8104938: @ 8104938 .pool _08104964: ldrb r0, [r5] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -12303,7 +12303,7 @@ sub_8104AB4: @ 8104AB4 ldr r0, =gTasks adds r4, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -12345,7 +12345,7 @@ _08104B10: sub_8104B1C: @ 8104B1C push {r4,r5,lr} adds r4, r0, 0 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] bl GetBattlerSide lsls r0, 24 @@ -12356,7 +12356,7 @@ sub_8104B1C: @ 8104B1C bl StartSpriteAnim ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, 0x20 @@ -12370,7 +12370,7 @@ _08104B50: bl StartSpriteAnim ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 subs r0, 0x20 @@ -12378,10 +12378,10 @@ _08104B50: ldr r0, =0x0000ffc0 _08104B6A: strh r0, [r4, 0x30] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 movs r1, 0 @@ -12411,11 +12411,11 @@ sub_8104BAC: @ 8104BAC ldrsh r0, [r0, r1] cmp r0, 0 bne _08104BC8 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08104BCA .pool _08104BC8: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08104BCA: ldrb r5, [r0] adds r0, r5, 0 @@ -12432,7 +12432,7 @@ _08104BCA: _08104BE4: adds r0, r5, 0 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -12441,7 +12441,7 @@ _08104BE4: strh r0, [r6, 0x20] adds r0, r5, 0 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r4, [r4, 0x4] @@ -12476,7 +12476,7 @@ sub_8104C38: @ 8104C38 ldr r0, =gTasks adds r4, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -12528,7 +12528,7 @@ sub_8104CA4: @ 8104CA4 ldr r0, =gTasks adds r4, r1, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 movs r2, 0 @@ -12559,7 +12559,7 @@ sub_8104CA4: @ 8104CA4 strh r2, [r4, 0x18] movs r0, 0x2 strh r0, [r4, 0x1A] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -12759,7 +12759,7 @@ sub_8104E74: @ 8104E74 lsls r1, 3 ldr r0, =gTasks adds r5, r1, r0 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] bl sub_80A6190 lsls r0, 24 @@ -12959,10 +12959,10 @@ _0810500E: sub_810501C: @ 810501C push {r4-r6,lr} adds r4, r0, 0 - ldr r6, =gAnimBankTarget + ldr r6, =gBattleAnimTarget ldrb r0, [r6] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 subs r0, 0x10 @@ -13194,11 +13194,11 @@ sub_81051C4: @ 81051C4 adds r1, r0, 0 cmp r2, 0 bne _081051F0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _081051F2 .pool _081051F0: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _081051F2: ldrb r5, [r0] ldrb r1, [r1, 0x6] @@ -13212,7 +13212,7 @@ _081051F2: movs r1, 0x2 adds r0, r5, 0 eors r0, r1 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810526A @@ -13231,7 +13231,7 @@ _08105230: adds r0, r5, 0 movs r1, 0x2 _08105234: - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r4, r0, 24 adds r0, r5, 0 @@ -13305,15 +13305,15 @@ sub_81052A4: @ 81052A4 ldrsh r0, [r0, r2] cmp r0, 0 bne _081052DC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r7, [r0] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget b _081052E2 .pool _081052DC: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r7, [r0] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker _081052E2: ldrb r0, [r0] mov r8, r0 @@ -13341,7 +13341,7 @@ _08105310: beq _0810536C adds r0, r7, 0 mov r1, r10 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r1, =gBattleAnimArgs lsrs r0, 24 @@ -13354,25 +13354,25 @@ _08105310: mov r4, r8 eors r4, r0 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810535C ldr r2, =gSprites - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r4, r0 b _081053EA .pool _0810535C: ldr r2, =gSprites - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds add r0, r8 b _081053EA .pool _0810536C: adds r0, r7, 0 mov r1, r10 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldr r1, =gBattleAnimArgs @@ -13389,12 +13389,12 @@ _0810536C: adds r4, r7, 0 eors r4, r0 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _081053E4 ldr r3, =gSprites - ldr r2, =gBankSpriteIds + ldr r2, =gBattlerSpriteIds adds r0, r7, r2 ldrb r1, [r0] lsls r0, r1, 4 @@ -13424,7 +13424,7 @@ _081053E0: b _081053F4 _081053E4: ldr r2, =gSprites - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r7, r0 _081053EA: ldrb r1, [r0] @@ -13442,7 +13442,7 @@ _081053FA: strb r0, [r1] adds r0, r7, 0 ldr r1, [sp, 0x4] - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -13457,7 +13457,7 @@ _081053FA: movs r1, 0x2 mov r0, r8 eors r0, r1 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810544C @@ -13473,13 +13473,13 @@ _0810544C: mov r4, sp mov r0, r8 mov r1, r10 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4] mov r0, r8 ldr r1, [sp, 0x4] - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 mov r2, sp @@ -13581,7 +13581,7 @@ sub_8105538: @ 8105538 adds r4, r0, 0 movs r1, 0 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -13622,7 +13622,7 @@ sub_810557C: @ 810557C strh r0, [r4, 0x24] subs r2, 0x20 strh r2, [r4, 0x2E] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -13873,7 +13873,7 @@ sub_810577C: @ 810577C ldr r0, =gTasks adds r4, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -13950,7 +13950,7 @@ sub_8105810: @ 8105810 strh r0, [r4, 0xE] movs r0, 0x3 strh r0, [r4, 0x20] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -13968,7 +13968,7 @@ _08105850: _08105856: strh r0, [r4, 0x24] movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x26] @@ -14154,7 +14154,7 @@ sub_810599C: @ 810599C movs r0, 0x2 strh r0, [r4, 0x24] movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x26] @@ -14292,16 +14292,16 @@ sub_8105AAC: @ 8105AAC strh r0, [r4, 0x16] strh r0, [r4, 0x18] strh r0, [r4, 0x22] - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x24] ldrb r0, [r5] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x26] @@ -14684,7 +14684,7 @@ sub_8105DE8: @ 8105DE8 adds r5, r0, 0 movs r1, 0 bl sub_80A69CC - ldr r6, =gAnimBankAttacker + ldr r6, =gBattleAnimAttacker ldrb r0, [r6] bl GetBattlerSide lsls r0, 24 @@ -14700,7 +14700,7 @@ _08105E08: strh r0, [r5, 0x2E] ldrb r0, [r6] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x4] @@ -14708,7 +14708,7 @@ _08105E08: strh r0, [r5, 0x32] ldrb r0, [r6] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x6] @@ -14939,7 +14939,7 @@ sub_8106020: @ 8106020 lsrs r0, 24 adds r6, r0, 0 movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r4, r0, 24 ldr r1, =gTasks @@ -14955,7 +14955,7 @@ sub_8106020: @ 8106020 cmp r0, 0x1 bne _0810607C movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -15004,7 +15004,7 @@ sub_81060B0: @ 81060B0 lsrs r0, 24 adds r6, r0, 0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r4, r0, 24 ldr r1, =gTasks @@ -15020,7 +15020,7 @@ sub_81060B0: @ 81060B0 cmp r0, 0x1 bne _0810610C movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -15072,10 +15072,10 @@ sub_8106140: @ 8106140 strh r0, [r4, 0x2E] ldrh r0, [r4, 0x20] strh r0, [r4, 0x30] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] @@ -15083,7 +15083,7 @@ sub_8106140: @ 8106140 strh r0, [r4, 0x34] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -15561,7 +15561,7 @@ _0810653A: b _0810658A .pool _08106578: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -15773,16 +15773,16 @@ _08106730: sub_810673C: @ 810673C push {r4,r5,lr} adds r4, r0, 0 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -15924,16 +15924,16 @@ _08106868: sub_8106878: @ 8106878 push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -16029,16 +16029,16 @@ _08106940: sub_8106944: @ 8106944 push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -16314,7 +16314,7 @@ sub_8106B54: @ 8106B54 adds r0, r4, 0 movs r1, 0 bl StartSpriteAnim - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A82E4 subs r0, 0x1 @@ -16505,21 +16505,21 @@ _08106CEC: ldrsh r0, [r1, r2] cmp r0, 0 bne _08106CFC - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _08106CFE .pool _08106CFC: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _08106CFE: ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -16593,7 +16593,7 @@ sub_8106D90: @ 8106D90 lsrs r5, 24 ldr r0, =gBattleAnimArgs ldrb r0, [r0] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -16645,11 +16645,11 @@ sub_8106E00: @ 8106E00 ldrsh r0, [r0, r1] cmp r0, 0 bne _08106E1C - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08106E1E .pool _08106E1C: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08106E1E: ldrb r6, [r0] adds r0, r6, 0 @@ -16666,7 +16666,7 @@ _08106E1E: _08106E38: adds r0, r6, 0 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r7, =gBattleAnimArgs lsrs r0, 24 @@ -16676,7 +16676,7 @@ _08106E38: strh r0, [r5, 0x20] adds r0, r6, 0 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r7, 0x4] @@ -16992,11 +16992,11 @@ sub_81070AC: @ 81070AC ands r0, r1 cmp r0, 0 beq _081070F8 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r1, [r4] movs r0, 0x2 eors r0, r1 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _081070F8 @@ -17016,16 +17016,16 @@ sub_81070AC: @ 81070AC b _08107118 .pool _081070F8: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, 0x28 @@ -17196,7 +17196,7 @@ _0810725A: sub_8107260: @ 8107260 push {r4-r6,lr} adds r6, r0, 0 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] bl GetBattlerSide lsls r0, 24 @@ -17204,7 +17204,7 @@ sub_8107260: @ 8107260 beq _08107290 ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldr r4, =gBattleAnimArgs @@ -17215,7 +17215,7 @@ sub_8107260: @ 8107260 _08107290: ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -17225,7 +17225,7 @@ _081072A2: strh r0, [r6, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r4, [r4, 0x2] @@ -17237,7 +17237,7 @@ _081072A2: movs r1, 0x40 orrs r0, r1 strb r0, [r2] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -17253,10 +17253,10 @@ _081072D8: strh r0, [r6, 0x2E] ldrh r0, [r6, 0x20] strh r0, [r6, 0x30] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x32] @@ -17264,7 +17264,7 @@ _081072D8: strh r0, [r6, 0x34] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x36] @@ -17422,7 +17422,7 @@ sub_810744C: @ 810744C adds r5, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -17445,10 +17445,10 @@ _08107482: strh r0, [r5, 0x2E] ldrh r0, [r5, 0x20] strh r0, [r5, 0x30] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r6 @@ -17457,7 +17457,7 @@ _08107482: strh r0, [r5, 0x34] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r7, [r7, 0x6] @@ -17621,10 +17621,10 @@ sub_81075EC: @ 81075EC strh r0, [r5, 0x2E] ldrh r0, [r5, 0x20] strh r0, [r5, 0x30] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] @@ -17632,7 +17632,7 @@ sub_81075EC: @ 81075EC strh r0, [r5, 0x34] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -17773,16 +17773,16 @@ _08107722: sub_8107730: @ 8107730 push {r4-r7,lr} adds r4, r0, 0 - ldr r7, =gAnimBankAttacker + ldr r7, =gBattleAnimAttacker ldrb r0, [r7] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x20] ldrb r0, [r7] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -17846,11 +17846,11 @@ _081077BA: sub_81077C0: @ 81077C0 push {r4-r7,lr} adds r6, r0, 0 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] bl GetBattlerSide adds r4, r0, 0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r4, 24 @@ -17898,7 +17898,7 @@ _0810781E: _08107828: adds r0, r6, 0 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -17910,10 +17910,10 @@ _08107828: _08107842: ldrh r0, [r5, 0x8] strh r0, [r6, 0x2E] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r5, 0x4] @@ -17921,7 +17921,7 @@ _08107842: strh r0, [r6, 0x32] ldrb r0, [r4] adds r1, r7, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r5, [r5, 0x6] @@ -18069,7 +18069,7 @@ sub_8107954: @ 8107954 movs r1, 0x3 movs r2, 0x1 bl SetAnimBgAttribute - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -18174,7 +18174,7 @@ _08107A32: b _08107B0E .pool _08107AB4: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -18963,7 +18963,7 @@ sub_81080E4: @ 81080E4 ldr r0, =gTasks adds r4, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x26] @@ -19278,13 +19278,13 @@ _0810837A: thumb_func_start sub_8108384 sub_8108384: @ 8108384 push {r4,r5,lr} - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 cmp r0, 0 bne _081083B8 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes ldrb r0, [r4] lsls r0, 1 adds r0, r1 @@ -19298,7 +19298,7 @@ _081083B4: adds r0, r2, 0 b _081083FA _081083B8: - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes ldrb r0, [r4] lsls r0, 1 adds r0, r1 @@ -19350,16 +19350,16 @@ sub_8108408: @ 8108408 lsls r1, 24 lsrs r1, 24 str r1, [sp] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 mov r8, r0 ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 movs r5, 0xAC @@ -19576,7 +19576,7 @@ sub_81085C8: @ 81085C8 lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0xA] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -19956,17 +19956,17 @@ sub_81088E4: @ 81088E4 lsls r1, 3 ldr r0, =gTasks adds r5, r1, r0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 movs r6, 0 strh r0, [r5, 0xE] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x10] @@ -20418,16 +20418,16 @@ sub_8108C94: @ 8108C94 adds r4, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x30] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] @@ -20593,7 +20593,7 @@ _08108DE2: strh r0, [r4, 0x2E] mov r0, r9 strh r0, [r4, 0x30] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A82E4 subs r0, 0x1 @@ -20648,7 +20648,7 @@ _08108E58: strh r0, [r4, 0x2E] mov r0, r9 strh r0, [r4, 0x30] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A82E4 subs r0, 0x1 @@ -20746,7 +20746,7 @@ sub_8108F4C: @ 8108F4C push {r4,lr} adds r4, r0, 0 bl sub_80A6838 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -20798,7 +20798,7 @@ _08108F9E: sub_8108FBC: @ 8108FBC push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -20886,7 +20886,7 @@ sub_8109064: @ 8109064 push {r4,lr} adds r4, r0, 0 bl sub_80A6838 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -21037,11 +21037,11 @@ sub_810916C: @ 810916C sub_8109198: @ 8109198 push {r4-r6,lr} adds r6, r0, 0 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] bl GetBattlerSide adds r4, r0, 0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r4, 24 @@ -21128,10 +21128,10 @@ sub_8109244: @ 8109244 strh r0, [r5, 0x2E] ldrh r0, [r5, 0x20] strh r0, [r5, 0x30] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] @@ -21139,7 +21139,7 @@ sub_8109244: @ 8109244 strh r0, [r5, 0x34] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -21164,16 +21164,16 @@ sub_810929C: @ 810929C beq _081092E4 movs r4, 0 strh r4, [r6, 0x2E] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x22] @@ -21389,7 +21389,7 @@ sub_8109460: @ 8109460 ldr r0, =gTasks adds r4, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 movs r5, 0 @@ -21407,7 +21407,7 @@ sub_8109460: @ 8109460 adds r0, r2 ldrh r0, [r0, 0x22] strh r0, [r4, 0x10] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -21820,7 +21820,7 @@ sub_81097B4: @ 81097B4 lsls r0, 2 adds r0, r1 ldrh r4, [r0, 0x20] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -21992,7 +21992,7 @@ sub_8109930: @ 8109930 adds r0, r2 lsls r0, 16 lsrs r4, r0, 16 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -22248,7 +22248,7 @@ _08109B18: bl StartSpriteAnim ldrh r0, [r4, 0x4] strh r0, [r5, 0x3C] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -22261,7 +22261,7 @@ _08109B48: ldr r0, =0x0000fffc _08109B4A: strh r0, [r5, 0x36] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8328 movs r1, 0x3 @@ -22279,7 +22279,7 @@ _08109B70: ldrh r0, [r5, 0x30] adds r0, 0xC0 strh r0, [r5, 0x30] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -22356,10 +22356,10 @@ _08109BCE: lsls r0, 1 strh r0, [r5, 0x2E] strh r1, [r5, 0x30] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] @@ -22367,7 +22367,7 @@ _08109BCE: strh r0, [r5, 0x34] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -22485,7 +22485,7 @@ _08109CC8: lsrs r0, 16 cmp r0, 0x83 bls _08109D3C - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8328 movs r1, 0x3 @@ -22500,7 +22500,7 @@ _08109CC8: b _08109D80 .pool _08109D3C: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8328 lsls r0, 24 @@ -22578,7 +22578,7 @@ sub_8109DBC: @ 8109DBC lsls r1, 3 ldr r0, =gTasks adds r4, r1, r0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -22590,22 +22590,22 @@ sub_8109DBC: @ 8109DBC movs r1, 0x1 _08109DE2: strh r1, [r4, 0x20] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r1, [r0] movs r0, 0x2 eors r0, r1 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 lsrs r0, 24 adds r0, 0x1 strh r0, [r4, 0x22] movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x24] movs r0, 0x3 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x26] @@ -22973,8 +22973,8 @@ _0810A0CA: ldrh r0, [r2, 0x8] adds r0, 0x1 strh r0, [r2, 0x8] - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankTarget + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r0, r1 ldrb r6, [r0] @@ -23075,7 +23075,7 @@ _0810A194: sub_810A1A8: @ 810A1A8 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -23129,7 +23129,7 @@ _0810A20E: sub_810A214: @ 810A214 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -23178,20 +23178,20 @@ _0810A26E: sub_810A274: @ 810A274 push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -23261,15 +23261,15 @@ _0810A324: beq _0810A35C b _0810A380 _0810A32E: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0810A382 .pool _0810A338: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r6, 0x2 eors r0, r6 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 bne _0810A354 @@ -23282,21 +23282,21 @@ _0810A354: eors r4, r0 b _0810A384 _0810A35C: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] movs r4, 0x2 eors r0, r4 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810A380 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] eors r4, r0 b _0810A384 .pool _0810A380: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0810A382: ldrb r4, [r0] _0810A384: @@ -23307,7 +23307,7 @@ _0810A384: bne _0810A3AC adds r0, r4, 0 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] @@ -23318,14 +23318,14 @@ _0810A384: _0810A3AC: adds r0, r4, 0 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] adds r0, r4, 0 movs r1, 0x3 _0810A3BE: - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -23417,10 +23417,10 @@ sub_810A46C: @ 810A46C strh r0, [r4, 0x2E] ldrh r0, [r4, 0x20] strh r0, [r4, 0x30] - ldr r6, =gAnimBankTarget + ldr r6, =gBattleAnimTarget ldrb r0, [r6] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] @@ -23428,7 +23428,7 @@ sub_810A46C: @ 810A46C strh r0, [r4, 0x34] ldrb r0, [r6] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -23576,7 +23576,7 @@ sub_810A5BC: @ 810A5BC lsls r0, 24 cmp r0, 0 bne _0810A5D8 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -23588,10 +23588,10 @@ _0810A5D8: negs r0, r0 strh r0, [r1, 0x2] _0810A5E0: - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -23600,7 +23600,7 @@ _0810A5E0: strh r0, [r6, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x4] @@ -23633,11 +23633,11 @@ sub_810A628: @ 810A628 ands r0, r1 cmp r0, 0 beq _0810A64C - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget b _0810A64E .pool _0810A64C: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker _0810A64E: ldrb r6, [r0] bl IsContest @@ -23657,7 +23657,7 @@ _0810A666: _0810A66E: adds r0, r6, 0 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -23666,7 +23666,7 @@ _0810A66E: strh r0, [r5, 0x20] adds r0, r6, 0 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x2] @@ -23827,10 +23827,10 @@ sub_810A7DC: @ 810A7DC adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 - ldr r6, =gAnimBankTarget + ldr r6, =gBattleAnimTarget ldrb r0, [r6] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord ldr r1, =gTasks lsls r4, r5, 2 adds r4, r5 @@ -23844,7 +23844,7 @@ sub_810A7DC: @ 810A7DC strh r0, [r4, 0x8] ldrb r0, [r6] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r5, 0x2] @@ -24220,21 +24220,21 @@ sub_810AAFC: @ 810AAFC ldrsh r0, [r0, r1] cmp r0, 0 bne _0810AB28 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _0810AB2A .pool _0810AB28: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _0810AB2A: ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x24] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x26] @@ -24440,21 +24440,21 @@ sub_810ACD8: @ 810ACD8 ldrsh r0, [r0, r1] cmp r0, 0 bne _0810ACF4 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _0810ACF6 .pool _0810ACF4: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _0810ACF6: ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -24478,21 +24478,21 @@ sub_810AD30: @ 810AD30 ldrsh r0, [r0, r1] cmp r0, 0 bne _0810AD4C - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _0810AD4E .pool _0810AD4C: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _0810AD4E: ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -24518,21 +24518,21 @@ sub_810AD98: @ 810AD98 adds r5, r0, 0 movs r1, 0x1 bl StartSpriteAffineAnim - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x3A] @@ -24641,15 +24641,15 @@ _0810AE8E: b _0810AFC0 _0810AE90: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 movs r6, 0 strh r0, [r5, 0x26] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x24] @@ -24820,7 +24820,7 @@ _0810AFF4: _0810AFFA: b _0810B14E _0810AFFC: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 @@ -24855,13 +24855,13 @@ _0810B012: _0810B048: ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0xE] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x12] @@ -24878,16 +24878,16 @@ _0810B070: movs r0, 0x78 subs r0, r1 strh r0, [r5, 0xE] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x12] ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 movs r2, 0xA @@ -25124,16 +25124,16 @@ sub_810B23C: @ 810B23C beq _0810B280 b _0810B294 _0810B24E: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -25191,25 +25191,25 @@ _0810B2C8: .4byte _0810B404 .4byte _0810B414 _0810B2DC: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x14] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x16] movs r0, 0x4 strh r0, [r5, 0x18] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x1C] @@ -25539,10 +25539,10 @@ _0810B584: beq _0810B600 b _0810B60E _0810B58A: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, 0x20 @@ -25561,10 +25561,10 @@ _0810B5A4: bgt _0810B5A4 strh r1, [r5, 0x24] _0810B5B4: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -25721,29 +25721,29 @@ sub_810B6C4: @ 810B6C4 ands r0, r2 orrs r0, r1 strh r0, [r5, 0x4] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 mov r9, r0 ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 mov r8, r0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r3, r0, 24 ldrb r0, [r4] movs r1, 0x3 str r3, [sp] - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 ldr r1, =gBattleAnimArgs @@ -25976,14 +25976,14 @@ sub_810B8EC: @ 810B8EC adds r4, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -26003,10 +26003,10 @@ _0810B92C: adds r0, r1 strh r0, [r4, 0x32] _0810B936: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r1, =gBattleAnimArgs lsrs r0, 24 @@ -26041,7 +26041,7 @@ sub_810B974: @ 810B974 b _0810B9C6 .pool _0810B990: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r4, 0 adds r2, 0x20 @@ -26049,7 +26049,7 @@ _0810B990: adds r3, 0x22 movs r1, 0x1 bl sub_80A8924 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -26130,16 +26130,16 @@ sub_810BA24: @ 810BA24 ldrsh r0, [r6, r1] cmp r0, 0 bne _0810BA74 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r6, [r6, 0x6] @@ -26148,7 +26148,7 @@ sub_810BA24: @ 810BA24 b _0810BA86 .pool _0810BA74: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r5, 0 adds r2, 0x32 @@ -26157,7 +26157,7 @@ _0810BA74: movs r1, 0x1 bl sub_80A8924 _0810BA86: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -26277,7 +26277,7 @@ sub_810BB60: @ 810BB60 strh r5, [r4, 0x24] movs r0, 0x80 strh r0, [r4, 0x2E] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -26312,7 +26312,7 @@ _0810BB90: sub_810BBC8: @ 810BBC8 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -26431,23 +26431,23 @@ sub_810BC94: @ 810BC94 ldrsh r0, [r1, r2] cmp r0, 0 bne _0810BCE0 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] b _0810BCF2 .pool _0810BCE0: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r5, 0 adds r2, 0x32 @@ -26456,7 +26456,7 @@ _0810BCE0: movs r1, 0x1 bl sub_80A8924 _0810BCF2: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -26645,7 +26645,7 @@ sub_810BE48: @ 810BE48 b _0810BEA2 .pool _0810BE6C: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r4, 0 adds r2, 0x20 @@ -26653,7 +26653,7 @@ _0810BE6C: adds r3, 0x22 movs r1, 0 bl sub_80A8924 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -26712,7 +26712,7 @@ sub_810BED0: @ 810BED0 b _0810BF32 .pool _0810BEF4: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] adds r2, r5, 0 adds r2, 0x20 @@ -26742,7 +26742,7 @@ _0810BF26: adds r0, r1 strh r0, [r5, 0x22] _0810BF32: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0810BF90 .pool _0810BF40: @@ -26755,7 +26755,7 @@ _0810BF40: bl sub_80A6980 b _0810BF8E _0810BF52: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] adds r2, r5, 0 adds r2, 0x20 @@ -26785,7 +26785,7 @@ _0810BF82: adds r0, r1 strh r0, [r5, 0x22] _0810BF8E: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0810BF90: ldrb r0, [r0] strh r0, [r5, 0x3C] @@ -26806,7 +26806,7 @@ _0810BFB4: movs r0, 0x40 _0810BFB6: strh r0, [r5, 0x3A] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -27179,16 +27179,16 @@ _0810C2DA: sub_810C2F0: @ 810C2F0 push {r4,r5,lr} adds r4, r0, 0 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -27456,16 +27456,16 @@ sub_810C560: @ 810C560 ldr r6, =gBattleAnimArgs ldrh r0, [r6] strh r0, [r5, 0x2E] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker mov r8, r0 ldrb r0, [r0] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 - ldr r7, =gAnimBankTarget + ldr r7, =gBattleAnimTarget ldrb r0, [r7] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r4, 24 lsls r0, 24 cmp r4, r0 @@ -27505,7 +27505,7 @@ _0810C594: cmp r0, 0 bne _0810C5F0 movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId ldr r2, =gSprites lsls r0, 24 lsrs r0, 24 @@ -27523,16 +27523,16 @@ _0810C5F0: movs r0, 0x1 strh r0, [r5, 0x3A] _0810C5F4: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -27545,10 +27545,10 @@ _0810C5F4: ldrh r1, [r5, 0x20] adds r0, r1 strh r0, [r5, 0x30] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r6, 0x6] @@ -27567,10 +27567,10 @@ _0810C65C: ldrh r1, [r5, 0x20] adds r0, r1 strh r0, [r5, 0x30] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r6, 0x6] @@ -27583,7 +27583,7 @@ _0810C65C: ldrb r0, [r4] movs r1, 0x1 _0810C684: - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r6, [r6, 0x8] @@ -27676,10 +27676,10 @@ _0810C728: _0810C736: movs r5, 0x50 strh r5, [r4, 0x2E] - ldr r6, =gAnimBankTarget + ldr r6, =gBattleAnimTarget ldrb r0, [r6] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x20] @@ -27844,7 +27844,7 @@ _0810C85A: cmp r0, 0 bne _0810C8B4 ldr r1, =gBattlerPositions - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r0, r1 ldrb r1, [r0] @@ -28054,7 +28054,7 @@ sub_810C9E4: @ 810C9E4 lsls r0, 24 lsrs r5, r0, 24 adds r0, r5, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810CAD0 @@ -28062,12 +28062,12 @@ sub_810C9E4: @ 810C9E4 str r0, [sp, 0x4] adds r0, r5, 0 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r7, r0, 24 adds r0, r5, 0 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 mov r1, r8 @@ -28371,7 +28371,7 @@ _0810CCA6: ldr r6, =gBattleAnimArgs ldrh r0, [r6, 0x8] strh r0, [r5, 0x2E] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -28381,10 +28381,10 @@ _0810CCA6: negs r0, r0 strh r0, [r6, 0x4] _0810CCCE: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r6, 0x4] @@ -28392,7 +28392,7 @@ _0810CCCE: strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r6, 0x6] @@ -28581,7 +28581,7 @@ sub_810CE68: @ 810CE68 ldrsh r0, [r4, r1] cmp r0, 0x1 bne _0810CE90 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -28680,11 +28680,11 @@ sub_810CF30: @ 810CF30 mov r9, r0 cmp r1, 0 bne _0810CF54 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0810CF56 .pool _0810CF54: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0810CF56: ldrb r0, [r0] mov r8, r0 @@ -28705,13 +28705,13 @@ _0810CF74: bl StartSpriteAnim mov r0, r8 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] mov r0, r8 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -28974,10 +28974,10 @@ _0810D1A4: sub_810D1B4: @ 810D1B4 push {r4-r6,lr} adds r6, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r1, [r0] movs r0, 0x2 - ldr r2, =gAnimBankTarget + ldr r2, =gBattleAnimTarget eors r0, r1 ldrb r1, [r2] cmp r0, r1 @@ -28997,7 +28997,7 @@ _0810D1E0: adds r0, r6, 0 movs r1, 0x1 bl sub_80A6980 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -29146,16 +29146,16 @@ sub_810D308: @ 810D308 bne _0810D34C movs r0, 0x6 strh r0, [r5, 0x2E] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -29267,21 +29267,21 @@ sub_810D40C: @ 810D40C ldrsh r0, [r0, r1] cmp r0, 0 bne _0810D428 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _0810D42A .pool _0810D428: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _0810D42A: ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -29386,10 +29386,10 @@ sub_810D4F4: @ 810D4F4 ldrsh r0, [r6, r1] cmp r0, 0 bne _0810D520 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r2, [r6, 0x4] @@ -29397,10 +29397,10 @@ sub_810D4F4: @ 810D4F4 b _0810D532 .pool _0810D520: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r6, 0x4] @@ -29409,7 +29409,7 @@ _0810D532: strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r6, [r6, 0x6] @@ -29520,20 +29520,20 @@ sub_810D608: @ 810D608 ldrsh r0, [r0, r1] cmp r0, 0 bne _0810D664 - ldr r4, =gBattleAttacker + ldr r4, =gBattleMoveAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8328 movs r1, 0x3 @@ -29545,11 +29545,11 @@ sub_810D608: @ 810D608 ands r0, r2 orrs r0, r1 strb r0, [r5, 0x5] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget b _0810D680 .pool _0810D664: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8328 movs r1, 0x3 @@ -29561,7 +29561,7 @@ _0810D664: ands r0, r2 orrs r0, r1 strb r0, [r5, 0x5] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker _0810D680: ldrb r0, [r0] strh r0, [r5, 0x3C] @@ -29601,7 +29601,7 @@ sub_810D6A8: @ 810D6A8 lsls r0, 24 lsrs r0, 24 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] @@ -29611,7 +29611,7 @@ sub_810D6A8: @ 810D6A8 lsls r0, 24 lsrs r0, 24 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -29712,31 +29712,31 @@ _0810D7BA: strh r0, [r7, 0x2E] b _0810D818 _0810D7C2: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r6, r0, 0 lsls r6, 24 lsrs r6, 24 ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 - ldr r2, =gAnimBankTarget + ldr r2, =gBattleAnimTarget mov r8, r2 ldrb r0, [r2] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 mov r1, r8 ldrb r0, [r1] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 subs r4, r6 strh r4, [r7, 0x2E] @@ -29808,28 +29808,28 @@ sub_810D874: @ 810D874 ldrsh r0, [r0, r1] cmp r0, 0 bne _0810D8B8 - ldr r4, =gBattleAttacker + ldr r4, =gBattleMoveAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r4, [r0] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0810D8BE .pool _0810D8B8: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r4, [r0] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0810D8BE: ldrb r0, [r0] bl sub_80A8328 @@ -29879,7 +29879,7 @@ _0810D918: strh r0, [r5, 0x30] adds r0, r4, 0 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] @@ -29887,7 +29887,7 @@ _0810D918: strh r0, [r5, 0x34] adds r0, r4, 0 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -29929,16 +29929,16 @@ _0810D976: sub_810D984: @ 810D984 push {r4-r6,lr} adds r5, r0, 0 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -30018,7 +30018,7 @@ _0810DA34: bl StartSpriteAnim b _0810DA5E _0810DA48: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -30128,7 +30128,7 @@ _0810DB1A: ldrh r1, [r4, 0x1C] adds r0, r1 strh r0, [r4, 0x1C] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -30205,16 +30205,16 @@ _0810DBC2: bl sub_80A69CC ldrh r0, [r4, 0x4] strh r0, [r5, 0x2E] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -30263,7 +30263,7 @@ _0810DC44: adds r0, r4, 0 movs r1, 0x1 bl sub_80A69CC - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] mov r6, sp adds r6, 0x2 @@ -30271,7 +30271,7 @@ _0810DC44: mov r2, sp adds r3, r6, 0 bl sub_80A8924 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -30389,7 +30389,7 @@ _0810DD4A: sub_810DD50: @ 810DD50 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r4, 0 adds r2, 0x20 @@ -30397,7 +30397,7 @@ sub_810DD50: @ 810DD50 adds r3, 0x22 movs r1, 0x1 bl sub_80A8924 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -30450,7 +30450,7 @@ sub_810DDC4: @ 810DDC4 b _0810DE16 .pool _0810DDE0: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r4, 0 adds r2, 0x20 @@ -30458,7 +30458,7 @@ _0810DDE0: adds r3, 0x22 movs r1, 0x1 bl sub_80A8924 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -30680,7 +30680,7 @@ sub_810DFA8: @ 810DFA8 adds r6, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -30696,10 +30696,10 @@ _0810DFC8: strh r0, [r6, 0x2E] ldrh r0, [r6, 0x20] strh r0, [r6, 0x30] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x4] @@ -30709,7 +30709,7 @@ _0810DFC8: strh r0, [r6, 0x34] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r4, [r4, 0x6] @@ -30748,7 +30748,7 @@ _0810E03C: sub_810E044: @ 810E044 push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 @@ -30782,13 +30782,13 @@ _0810E070: _0810E088: ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r2, =gBattleAnimArgs ldrh r1, [r2] @@ -30805,23 +30805,23 @@ _0810E088: ldrsh r0, [r2, r3] cmp r0, 0 bne _0810E0EC - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] b _0810E0FE .pool _0810E0EC: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r5, 0 adds r2, 0x32 @@ -30867,7 +30867,7 @@ sub_810E13C: @ 810E13C ldr r0, =sub_810E184 str r0, [r4, 0x1C] movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId ldr r2, =gSprites lsls r0, 24 lsrs r0, 24 @@ -30929,7 +30929,7 @@ _0810E1C2: sub_810E1C8: @ 810E1C8 push {r4,r5,lr} adds r5, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -30955,10 +30955,10 @@ _0810E1FE: strh r0, [r5, 0x2E] ldrh r0, [r5, 0x20] strh r0, [r5, 0x30] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] @@ -30966,7 +30966,7 @@ _0810E1FE: strh r0, [r5, 0x34] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -31021,7 +31021,7 @@ _0810E274: ble _0810E2BC _0810E296: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId ldr r2, =gSprites lsls r0, 24 lsrs r0, 24 @@ -31099,11 +31099,11 @@ sub_810E314: @ 810E314 ands r0, r1 cmp r0, 0 beq _0810E33C - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0810E33E .pool _0810E33C: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0810E33E: ldrb r6, [r0] adds r0, r6, 0 @@ -31118,7 +31118,7 @@ _0810E33E: _0810E354: adds r0, r6, 0 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -31127,7 +31127,7 @@ _0810E354: strh r0, [r7, 0x20] adds r0, r6, 0 movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldrh r1, [r4, 0x2] lsrs r0, 24 @@ -32049,7 +32049,7 @@ _0810EA36: sub_810EA4C: @ 810EA4C push {r4,r5,lr} adds r4, r0, 0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8328 movs r1, 0x3 @@ -32061,16 +32061,16 @@ sub_810EA4C: @ 810EA4C ands r0, r2 orrs r0, r1 strb r0, [r4, 0x5] - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -32106,7 +32106,7 @@ _0810EAC4: ldrsh r0, [r4, r2] cmp r0, 0 bne _0810EADC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -32117,7 +32117,7 @@ _0810EADC: ldrsh r0, [r4, r1] cmp r0, 0x1 bne _0810EAF8 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -32237,16 +32237,16 @@ sub_810EB88: @ 810EB88 strh r0, [r4, 0x6] ldr r0, =gUnknown_085973E8 mov r8, r0 - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r2, r0, 0 lsls r2, 24 lsrs r2, 24 @@ -32289,7 +32289,7 @@ _0810EC46: movs r1, 0x1 bl sub_80A69CC movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId ldr r2, =gSprites lsls r0, 24 lsrs r0, 24 @@ -32341,10 +32341,10 @@ _0810ECAA: beq _0810ECE0 b _0810ED1E _0810ECB0: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -32379,7 +32379,7 @@ _0810ECE0: cmp r0, r1 bge _0810ED1E movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId ldr r2, =gSprites lsls r0, 24 lsrs r0, 24 @@ -32416,7 +32416,7 @@ sub_810ED28: @ 810ED28 ldr r0, =sub_810ED70 str r0, [r4, 0x1C] movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId ldr r2, =gSprites lsls r0, 24 lsrs r0, 24 @@ -32545,21 +32545,21 @@ _0810EE28: ldrsh r0, [r0, r2] cmp r0, 0 bne _0810EE40 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _0810EE42 .pool _0810EE40: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _0810EE42: ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -32700,21 +32700,21 @@ _0810EF60: ldrsh r0, [r2, r1] cmp r0, 0 bne _0810EF74 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _0810EF76 .pool _0810EF74: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _0810EF76: ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, 0x20 @@ -32861,17 +32861,17 @@ sub_810F084: @ 810F084 mov r8, r0 ldrh r4, [r0, 0x20] ldrh r5, [r0, 0x22] - ldr r6, =gAnimBankAttacker + ldr r6, =gBattleAnimAttacker ldrb r0, [r6] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 mov r1, r8 strh r0, [r1, 0x20] ldrb r0, [r6] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r6, r0, 0 lsls r6, 24 lsrs r6, 24 @@ -32989,7 +32989,7 @@ sub_810F184: @ 810F184 cmp r0, 0 bne _0810F1BC movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 ldr r2, =gSprites @@ -33005,7 +33005,7 @@ sub_810F184: @ 810F184 .pool _0810F1BC: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 ldr r2, =gSprites @@ -33038,7 +33038,7 @@ sub_810F1EC: @ 810F1EC lsls r0, 24 lsrs r0, 24 mov r8, r0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -33078,7 +33078,7 @@ _0810F22E: orrs r1, r0 lsrs r6, r1, 31 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810F264 @@ -33091,7 +33091,7 @@ _0810F264: adds r4, r0, 0 eors r4, r7 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810F284 @@ -33109,7 +33109,7 @@ _0810F284: lsls r0, 24 cmp r0, 0 beq _0810F2B8 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -33126,7 +33126,7 @@ _0810F2B0: movs r0, 0x28 b _0810F2F2 _0810F2B8: - ldr r6, =gAnimBankAttacker + ldr r6, =gBattleAnimAttacker ldrb r0, [r6] bl GetBattlerSide lsls r0, 24 @@ -33139,7 +33139,7 @@ _0810F2B8: _0810F2CE: ldrb r0, [r6] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -33148,7 +33148,7 @@ _0810F2CE: strh r0, [r5, 0x20] ldrb r0, [r6] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r4, [r4, 0x2] @@ -33205,12 +33205,12 @@ sub_810F340: @ 810F340 b _0810F3B6 _0810F35C: adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810F382 ldr r2, =gSprites - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r4, r0 ldrb r1, [r0] lsls r0, r1, 4 @@ -33226,12 +33226,12 @@ _0810F382: movs r0, 0x2 eors r4, r0 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810F3AC ldr r2, =gSprites - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r4, r0 ldrb r1, [r0] lsls r0, r1, 4 @@ -33375,12 +33375,12 @@ sub_810F46C: @ 810F46C lsrs r4, r0, 24 adds r6, r4, 0 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810F4D4 ldr r2, =gSprites - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r4, r0 ldrb r1, [r0] lsls r0, r1, 4 @@ -33398,12 +33398,12 @@ _0810F4D4: adds r4, r0, 0 eors r4, r6 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810F502 ldr r2, =gSprites - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r4, r0 ldrb r1, [r0] lsls r0, r1, 4 @@ -33454,7 +33454,7 @@ sub_810F524: @ 810F524 orrs r1, r0 lsrs r5, r1, 31 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810F562 @@ -33464,7 +33464,7 @@ _0810F562: movs r0, 0x2 eors r4, r0 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0810F57C @@ -33505,7 +33505,7 @@ _0810F5A6: lsls r0, 24 cmp r0, 0 beq _0810F5EE - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -33568,16 +33568,16 @@ _0810F62C: sub_810F634: @ 810F634 push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -33623,7 +33623,7 @@ _0810F692: sub_810F6B0: @ 810F6B0 push {r4-r7,lr} adds r5, r0, 0 - ldr r6, =gAnimBankAttacker + ldr r6, =gBattleAnimAttacker ldrb r0, [r6] movs r1, 0x1 bl sub_80A861C @@ -33656,14 +33656,14 @@ sub_810F6B0: @ 810F6B0 _0810F6F6: ldrb r0, [r6] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r4 strh r0, [r5, 0x20] ldrb r0, [r6] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r7 @@ -33774,7 +33774,7 @@ sub_810F7D4: @ 810F7D4 ldr r0, =gTasks adds r4, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -33824,14 +33824,14 @@ sub_810F83C: @ 810F83C ldr r0, =gTasks adds r4, r1, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 movs r1, 0 strh r0, [r4, 0x8] strh r1, [r4, 0xA] strh r1, [r4, 0xC] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -33952,16 +33952,16 @@ sub_810F940: @ 810F940 movs r0, 0x10 strh r0, [r5, 0xE] strh r1, [r5, 0x10] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x24] @@ -34260,16 +34260,16 @@ sub_810FBA8: @ 810FBA8 ldrsh r0, [r6, r1] cmp r0, 0 bne _0810FBD4 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -34305,7 +34305,7 @@ sub_810FBF0: @ 810FBF0 bne _0810FC60 ldr r0, =0x0000fff6 strh r0, [r5, 0x1C] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x5 bl sub_80A861C @@ -34316,7 +34316,7 @@ sub_810FBF0: @ 810FBF0 bl sub_80A861C adds r0, 0x8 strh r0, [r5, 0x20] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x5 bl sub_80A861C @@ -34331,7 +34331,7 @@ sub_810FBF0: @ 810FBF0 _0810FC60: movs r0, 0xA strh r0, [r5, 0x1C] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x4 bl sub_80A861C @@ -34342,7 +34342,7 @@ _0810FC60: bl sub_80A861C subs r0, 0x8 strh r0, [r5, 0x20] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x4 bl sub_80A861C @@ -34357,7 +34357,7 @@ _0810FC94: bne _0810FCE8 ldr r0, =0x0000fff6 strh r0, [r5, 0x1C] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x4 bl sub_80A861C @@ -34368,7 +34368,7 @@ _0810FC94: bl sub_80A861C adds r0, 0x8 strh r0, [r5, 0x20] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x4 bl sub_80A861C @@ -34383,7 +34383,7 @@ _0810FC94: _0810FCE8: movs r0, 0xA strh r0, [r5, 0x1C] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x5 bl sub_80A861C @@ -34394,7 +34394,7 @@ _0810FCE8: bl sub_80A861C subs r0, 0x8 strh r0, [r5, 0x20] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x5 bl sub_80A861C @@ -34535,7 +34535,7 @@ sub_810FE14: @ 810FE14 lsls r1, 3 ldr r0, =gTasks adds r4, r1, r0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A6190 lsls r0, 24 @@ -34590,7 +34590,7 @@ _0810FE86: movs r0, 0 strh r0, [r4, 0x24] _0810FE92: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -34891,7 +34891,7 @@ _08110094: bl CalcCenterToCornerVec ldr r1, =gBattleAnimArgs ldrb r0, [r1] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r7, 0x22] @@ -35062,16 +35062,16 @@ _08110256: beq _0811034A b _08110360 _08110260: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -35209,7 +35209,7 @@ sub_8110368: @ 8110368 b _081103C4 .pool _08110394: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -35232,7 +35232,7 @@ _08110394: negs r0, r0 strh r0, [r1] _081103C4: - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 bl sub_80A60AC @@ -35254,7 +35254,7 @@ _081103C4: strh r0, [r6, 0x2E] ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x4] @@ -35262,7 +35262,7 @@ _081103C4: strh r0, [r6, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r4, [r4, 0x6] @@ -35297,7 +35297,7 @@ sub_8110438: @ 8110438 b _08110478 .pool _0811045C: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -35311,7 +35311,7 @@ _0811045C: negs r1, r1 strh r1, [r0] _08110478: - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 bl sub_80A60AC @@ -35333,13 +35333,13 @@ _08110478: strh r0, [r6, 0x2E] ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x36] @@ -35384,23 +35384,23 @@ _08110500: ldrsh r0, [r1, r2] cmp r0, 0 bne _08110548 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] b _0811055A .pool _08110548: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r5, 0 adds r2, 0x32 @@ -35457,7 +35457,7 @@ _081105AE: sub_81105B4: @ 81105B4 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r4, 0 adds r2, 0x20 @@ -35465,7 +35465,7 @@ sub_81105B4: @ 81105B4 adds r3, 0x22 movs r1, 0 bl sub_80A8924 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -35490,7 +35490,7 @@ _081105FC: ldrh r1, [r4, 0x22] adds r0, r1 strh r0, [r4, 0x22] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -35655,7 +35655,7 @@ sub_8110720: @ 8110720 b _08110762 .pool _08110740: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -35676,11 +35676,11 @@ _08110762: lsls r0, 24 cmp r0, 0 bne _081107B2 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide adds r4, r0, 0 - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] bl GetBattlerSide lsls r4, 24 @@ -35712,10 +35712,10 @@ _081107B2: adds r0, r7, 0 movs r1, 0x1 bl sub_80A69CC - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 lsls r4, 24 ldr r6, =gBattleAnimArgs @@ -35726,7 +35726,7 @@ _081107B2: lsrs r4, 16 ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -35780,7 +35780,7 @@ sub_8110850: @ 8110850 adds r6, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -35794,10 +35794,10 @@ _08110870: ldr r4, =gBattleAnimArgs ldrh r0, [r4, 0x8] strh r0, [r6, 0x2E] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x4] @@ -35805,7 +35805,7 @@ _08110870: strh r0, [r6, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x6] @@ -35941,21 +35941,21 @@ sub_8110994: @ 8110994 ldrsh r0, [r0, r1] cmp r0, 0 bne _081109B0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _081109B2 .pool _081109B0: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _081109B2: ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, 0x12 @@ -35980,7 +35980,7 @@ sub_81109F0: @ 81109F0 ldrsh r0, [r6, r1] cmp r0, 0 beq _08110A10 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r2, r5, 0 adds r2, 0x20 @@ -36064,7 +36064,7 @@ sub_8110AB4: @ 8110AB4 bl StartSpriteAnim adds r0, r5, 0 bl AnimateSprite - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -36254,7 +36254,7 @@ _08110C10: ldrsh r0, [r0, r1] cmp r0, 0 beq _08110C6E - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -36480,7 +36480,7 @@ sub_8110E4C: @ 8110E4C ldrsh r0, [r4, r2] cmp r0, 0 beq _08110E98 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -36620,32 +36620,32 @@ sub_8110F74: @ 8110F74 lsls r1, 3 ldr r0, =gTasks adds r6, r1, r0 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 mov r9, r0 ldrb r0, [r5] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 8 movs r1, 0xC0 lsls r1, 13 adds r0, r1 lsrs r7, r0, 16 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 mov r10, r0 ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 8 movs r2, 0xC0 @@ -36732,7 +36732,7 @@ _0811101E: strh r0, [r6, 0x24] strh r5, [r6, 0xA] movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x26] @@ -37193,7 +37193,7 @@ _08111412: sub_8111418: @ 8111418 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -37216,16 +37216,16 @@ _08111434: sub_8111444: @ 8111444 push {r4,r5,lr} adds r4, r0, 0 - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x20] ldrb r0, [r5] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldr r2, =gBattleAnimArgs @@ -37443,10 +37443,10 @@ sub_811160C: @ 811160C strh r0, [r4, 0x2E] ldrh r0, [r4, 0x20] strh r0, [r4, 0x30] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] @@ -37454,7 +37454,7 @@ sub_811160C: @ 811160C strh r0, [r4, 0x34] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -37770,7 +37770,7 @@ sub_811188C: @ 811188C movs r0, 0x52 bl SetGpuReg movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -37881,7 +37881,7 @@ sub_811196C: @ 811196C .pool _08111994: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r1, r0, 24 ldrh r0, [r4, 0x8] @@ -37925,11 +37925,11 @@ sub_81119E0: @ 81119E0 adds r4, r0, 0 ldrh r5, [r4, 0x20] ldrh r6, [r4, 0x22] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker mov r8, r0 ldrb r0, [r0] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 movs r1, 0 @@ -37938,7 +37938,7 @@ sub_81119E0: @ 81119E0 mov r1, r8 ldrb r0, [r1] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -38042,16 +38042,16 @@ _08111AD2: lsls r0, 16 cmp r0, 0 bgt _08111B96 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x30] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] @@ -38104,16 +38104,16 @@ _08111B3C: lsls r0, 16 cmp r0, 0 bgt _08111B96 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -38285,7 +38285,7 @@ _08111C80: adds r0, r4 movs r1, 0x50 strh r1, [r0, 0x2E] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -38510,7 +38510,7 @@ sub_8111E78: @ 8111E78 lsls r0, 3 ldr r1, =gTasks adds r5, r0, r1 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -38604,7 +38604,7 @@ _08111F0C: adds r2, r4 ldr r0, =gBattleSpritesDataPtr ldr r1, [r0] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] ldr r1, [r1] lsls r0, 2 @@ -38626,7 +38626,7 @@ _08111F0C: movs r0, 0x10 strh r0, [r5, 0xE] movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -38864,7 +38864,7 @@ sub_8112170: @ 8112170 lsls r0, 3 ldr r1, =gTasks adds r4, r0, r1 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -38888,7 +38888,7 @@ _081121AE: movs r0, 0x3 strb r0, [r1, 0x15] movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x24] @@ -38979,51 +38979,51 @@ sub_8112264: @ 8112264 ldrsh r0, [r0, r1] cmp r0, 0 bne _081122AC - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 8 movs r2, 0xE0 lsls r2, 13 adds r0, r2 lsrs r5, r0, 16 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget b _081122D0 .pool _081122AC: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r6, r0, 24 ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 8 movs r2, 0xE0 lsls r2, 13 adds r0, r2 lsrs r5, r0, 16 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker _081122D0: ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 mov r10, r0 ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 8 movs r1, 0xE0 @@ -39166,10 +39166,10 @@ sub_81123C4: @ 81123C4 ldr r2, =gBattleAnimArgs ldrh r0, [r2] strh r0, [r1, 0x1C] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 str r0, [sp, 0x4] @@ -39189,7 +39189,7 @@ _08112434: _08112436: lsls r1, r4, 16 asrs r3, r1, 16 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r2, [r0] str r1, [sp, 0x10] cmp r3, r2 @@ -39201,7 +39201,7 @@ _08112436: lsls r0, r4, 24 lsrs r4, r0, 24 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _08112502 @@ -39221,7 +39221,7 @@ _08112436: beq _08112502 adds r0, r4, 0 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 mov r10, r0 @@ -39594,7 +39594,7 @@ sub_8112758: @ 8112758 movs r0, 0x54 movs r1, 0x10 bl SetGpuReg - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -39869,7 +39869,7 @@ sub_81129F0: @ 81129F0 adds r4, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -40064,7 +40064,7 @@ sub_8112B78: @ 8112B78 movs r1, 0xC bl Sin strh r0, [r5, 0x24] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -40195,10 +40195,10 @@ sub_8112C6C: @ 8112C6C mov r8, r0 mov r0, r8 strh r0, [r4, 0xA] - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x1A] @@ -40301,7 +40301,7 @@ _08112D56: lsls r0, 2 adds r5, r0, r1 strh r7, [r5, 0x2E] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide movs r1, 0 @@ -40561,8 +40561,8 @@ sub_8112F60: @ 8112F60 movs r2, 0x4 orrs r1, r2 strb r1, [r3] - ldr r2, =gBankSpriteIds - ldr r1, =gAnimBankAttacker + ldr r2, =gBattlerSpriteIds + ldr r1, =gBattleAnimAttacker ldrb r1, [r1] adds r1, r2 ldrb r1, [r1] @@ -40679,16 +40679,16 @@ _08113054: sub_8113064: @ 8113064 push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -40752,20 +40752,20 @@ sub_8113100: @ 8113100 push {r4,r5,lr} adds r5, r0, 0 bl sub_80A6838 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -40834,21 +40834,21 @@ sub_81131B4: @ 81131B4 ldrsh r0, [r0, r1] cmp r0, 0 bne _081131D0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _081131D2 .pool _081131D0: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _081131D2: ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -40876,7 +40876,7 @@ _081131D2: sub_8113224: @ 8113224 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -40898,17 +40898,17 @@ _0811323E: sub_8113250: @ 8113250 push {r4-r7,lr} adds r6, r0, 0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 movs r5, 0 strh r0, [r6, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x22] @@ -40918,7 +40918,7 @@ sub_8113250: @ 8113250 ldr r0, =gBattleAnimArgs ldrh r0, [r0] strh r0, [r6, 0x3A] - ldr r4, =gBattleAttacker + ldr r4, =gBattleMoveAttacker ldrb r0, [r4] movs r1, 0 bl sub_80A861C @@ -41106,7 +41106,7 @@ sub_81133E8: @ 81133E8 lsls r1, 3 ldr r0, =gTasks adds r4, r1, r0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -41133,7 +41133,7 @@ _0811342A: strb r0, [r1, 0x8] mov r0, sp strb r5, [r0, 0x9] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A6190 lsls r0, 24 @@ -41354,18 +41354,18 @@ sub_81135EC: @ 81135EC movs r1, 0x5 bl __divsi3 adds r6, r0, 0 - ldr r1, =gAnimBankAttacker + ldr r1, =gBattleAnimAttacker mov r8, r1 ldrb r0, [r1] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x20] mov r2, r8 ldrb r0, [r2] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r3, [r5, 0x8] @@ -41473,7 +41473,7 @@ sub_81136E8: @ 81136E8 ldr r1, =gBattleAnimArgs ldrh r1, [r1] strh r1, [r0, 0x8] - ldr r1, =gAnimBankAttacker + ldr r1, =gBattleAnimAttacker ldrb r4, [r1] movs r1, 0x10 strh r1, [r0, 0xA] @@ -41544,8 +41544,8 @@ sub_811375C: @ 811375C cmp r4, 0x10 bne _081137DE ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r0, r1 ldrb r1, [r0] @@ -41661,7 +41661,7 @@ sub_8113888: @ 8113888 lsls r1, 5 movs r0, 0x52 bl SetGpuReg - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -41690,29 +41690,29 @@ _081138C4: sub_81138D4: @ 81138D4 push {r4-r6,lr} adds r4, r0, 0 - ldr r6, =gAnimBankTarget + ldr r6, =gBattleAnimTarget ldrb r0, [r6] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x30] - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] ldrb r0, [r6] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x34] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -41918,11 +41918,11 @@ sub_8113A90: @ 8113A90 adds r3, r0, 0 cmp r1, 0 bne _08113AAC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08113AAE .pool _08113AAC: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08113AAE: ldrb r5, [r0] movs r6, 0x14 @@ -42054,10 +42054,10 @@ sub_8113BAC: @ 8113BAC lsls r1, 3 ldr r0, =gTasks adds r5, r1, r0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, 0x1F @@ -42076,7 +42076,7 @@ sub_8113BAC: @ 8113BAC strh r1, [r5, 0x22] ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r1, r0, 0 @@ -42096,7 +42096,7 @@ _08113C1C: ldr r0, =0x0000ffc0 _08113C1E: strh r0, [r5, 0x18] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -42415,7 +42415,7 @@ _08113EBC: b _081140A6 .pool _08113EF8: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -42472,10 +42472,10 @@ _08113F78: b _08114044 .pool _08113F84: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, 0x1F @@ -42492,7 +42492,7 @@ _08113F84: strh r1, [r5, 0x22] ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 subs r1, r0, 0x4 @@ -42979,7 +42979,7 @@ sub_8114374: @ 8114374 _0811438A: lsls r0, r4, 24 lsrs r0, 24 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -43014,7 +43014,7 @@ sub_81143C0: @ 81143C0 lsls r0, 24 lsrs r0, 24 mov r10, r0 - ldr r6, =gAnimBankAttacker + ldr r6, =gBattleAnimAttacker ldrb r0, [r6] bl sub_80A8364 lsls r0, 24 @@ -43030,7 +43030,7 @@ sub_81143C0: @ 81143C0 bl sub_80A438C ldr r0, =gSprites mov r9, r0 - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds mov r8, r0 ldrb r0, [r6] add r0, r8 @@ -43049,7 +43049,7 @@ sub_81143C0: @ 81143C0 ldrb r0, [r6] movs r5, 0x2 eors r0, r5 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0811444E @@ -43091,7 +43091,7 @@ sub_8114470: @ 8114470 push {r4-r6,lr} lsls r0, 24 lsrs r6, r0, 24 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] bl sub_80A8364 lsls r0, 24 @@ -43106,7 +43106,7 @@ sub_8114470: @ 8114470 ldrb r1, [r4] movs r0, 0x2 eors r0, r1 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _081144AC @@ -43202,7 +43202,7 @@ _0811455C: lsls r0, 24 cmp r0, 0 bne _081145D6 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] bl GetBattlerPosition lsls r0, 24 @@ -43218,13 +43218,13 @@ _0811458C: ldrb r0, [r4] movs r5, 0x2 eors r0, r5 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 bne _081145D6 ldr r3, =gSprites - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldrb r0, [r4] eors r0, r5 adds r0, r1 @@ -43262,13 +43262,13 @@ _081145D6: b _0811465C .pool _08114614: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 cmp r0, 0 beq _08114640 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes ldrb r0, [r4] lsls r0, 1 adds r0, r1 @@ -43279,7 +43279,7 @@ _08114614: b _08114650 .pool _08114640: - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes ldrb r0, [r4] lsls r0, 1 adds r0, r1 @@ -43295,11 +43295,11 @@ _08114650: lsrs r5, r0, 16 _0811465C: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r1, r4, 0 adds r2, r5, 0 @@ -43421,7 +43421,7 @@ _08114776: cmp r0, 0x2 bne _08114824 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 ldr r5, =gSprites @@ -43457,8 +43457,8 @@ _081147B8: ldrsh r0, [r4, r1] cmp r0, 0x1 bne _08114886 - ldr r2, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r2, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r1, [r0] movs r0, 0x2 eors r0, r1 @@ -43562,7 +43562,7 @@ _081148C4: .4byte _081148FC _081148E4: ldrb r0, [r2] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r2, r0, 24 b _08114902 @@ -43590,11 +43590,11 @@ _08114908: lsls r0, 24 lsrs r4, r0, 24 adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0811492C - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r4, r0 ldrb r2, [r0] b _0811492E @@ -43655,31 +43655,31 @@ _08114980: sub_8114994: @ 8114994 push {r4,r5,lr} adds r4, r0, 0 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] movs r0, 0x14 strh r0, [r4, 0x2E] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x36] @@ -43716,16 +43716,16 @@ sub_81149FC: @ 81149FC strh r1, [r5, 0x24] movs r0, 0x14 strh r0, [r5, 0x2E] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -43764,7 +43764,7 @@ sub_8114A7C: @ 8114A7C adds r6, r0, 0 movs r1, 0x1 bl sub_80A6980 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -43778,10 +43778,10 @@ _08114A9C: ldr r4, =gBattleAnimArgs ldrh r0, [r4, 0x8] strh r0, [r6, 0x2E] - ldr r5, =gAnimBankTarget + ldr r5, =gBattleAnimTarget ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x4] @@ -43789,7 +43789,7 @@ _08114A9C: strh r0, [r6, 0x32] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r4, [r4, 0x6] @@ -43814,7 +43814,7 @@ sub_8114AF0: @ 8114AF0 adds r6, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 bl sub_80A60AC @@ -43890,10 +43890,10 @@ sub_8114B80: @ 8114B80 ldrsh r0, [r6, r1] cmp r0, 0 bne _08114BF4 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r2, [r6, 0x2] @@ -43901,7 +43901,7 @@ sub_8114B80: @ 8114B80 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r3, [r6, 0x4] @@ -44092,11 +44092,11 @@ _08114D28: .4byte _08114E8C _08114D3C: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x1C] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -44118,7 +44118,7 @@ _08114D70: _08114D78: ldrh r0, [r0] strh r0, [r4, 0x22] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A6190 lsls r0, 24 @@ -44272,7 +44272,7 @@ sub_8114EB4: @ 8114EB4 lsls r0, 24 lsrs r5, r0, 24 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 ldr r2, =gSprites @@ -44289,7 +44289,7 @@ sub_8114EB4: @ 8114EB4 movs r4, 0 strh r4, [r1, 0x24] strh r4, [r1, 0x26] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -44361,7 +44361,7 @@ sub_8114F54: @ 8114F54 .pool _08114F78: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x1C] @@ -44438,11 +44438,11 @@ _08115004: .4byte _081150D4 _08115018: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x1C] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -44458,7 +44458,7 @@ _08115044: _08115046: ldrh r0, [r0] strh r0, [r4, 0x20] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A6190 lsls r0, 24 @@ -44634,11 +44634,11 @@ sub_81151A0: @ 81151A0 adds r7, r0, 0 cmp r1, 0 bne _081151BC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _081151BE .pool _081151BC: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _081151BE: ldrb r4, [r0] movs r6, 0x18 @@ -44657,7 +44657,7 @@ _081151BE: _081151DA: adds r0, r4, 0 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r6 @@ -44714,16 +44714,16 @@ sub_8115244: @ 8115244 ldrsh r0, [r0, r1] cmp r0, 0 bne _08115260 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08115262 .pool _08115260: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08115262: ldrb r5, [r0] adds r0, r5, 0 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldr r2, =0x0000fff0 @@ -44818,7 +44818,7 @@ _08115340: _08115346: lsls r0, r5, 24 lsrs r0, 24 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _08115370 @@ -44829,7 +44829,7 @@ _08115346: adds r1, r4, 0 adds r1, 0x8 adds r1, r0 - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r5, r0 ldrb r0, [r0] strh r0, [r1] @@ -44846,7 +44846,7 @@ _08115370: .pool _08115380: ldrb r0, [r6] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x1A] @@ -45217,11 +45217,11 @@ sub_8115628: @ 8115628 adds r6, r2, 0 cmp r0, 0 beq _08115648 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget b _0811564A .pool _08115648: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker _0811564A: ldrb r0, [r0] adds r5, r0, 0 @@ -45244,7 +45244,7 @@ _0811565A: adds r4, r0 adds r0, r5, 0 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 movs r1, 0x20 @@ -45255,7 +45255,7 @@ _0811565A: strh r1, [r4, 0xA] adds r0, r5, 0 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 movs r1, 0x40 @@ -45333,7 +45333,7 @@ sub_811572C: @ 811572C strh r0, [r4, 0x22] ldrh r0, [r5, 0x4] strh r0, [r4, 0x2E] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -45852,9 +45852,9 @@ sub_8115B0C: @ 8115B0C mov r8, r2 cmp r5, r1 bge _08115B74 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r3, [r0] - ldr r7, =gAnimBankTarget + ldr r7, =gBattleAnimTarget movs r0, 0x1 mov r12, r0 adds r2, r1, 0 @@ -46336,9 +46336,9 @@ sub_8115F10: @ 8115F10 lsrs r0, 24 mov r8, r0 movs r2, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r6, [r0] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r7, [r0] ldr r4, =gBattleAnimArgs ldrh r1, [r4] @@ -46429,10 +46429,10 @@ _08115FD6: ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] mov r9, r0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] mov r10, r0 ldrh r1, [r4, 0xC] @@ -46450,7 +46450,7 @@ _08115FF8: cmp r0, 0 beq _08116028 ldr r2, =gSprites - ldr r0, =gHealthBoxesIds + ldr r0, =gHealthboxSpriteIds add r0, r9 ldrb r1, [r0] lsls r0, r1, 4 @@ -46656,7 +46656,7 @@ _0811618A: bcs _081161DC ldr r2, =gSprites mov r12, r2 - ldr r6, =gBankSpriteIds + ldr r6, =gBattlerSpriteIds movs r7, 0x3 negs r7, r7 _081161BA: @@ -46691,8 +46691,8 @@ _081161E2: sub_81161F4: @ 81161F4 push {r4-r6,lr} ldr r6, =gSprites - ldr r4, =gBankSpriteIds - ldr r5, =gAnimBankAttacker + ldr r4, =gBattlerSpriteIds + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] adds r0, r4 ldrb r0, [r0] @@ -46707,7 +46707,7 @@ sub_81161F4: @ 81161F4 adds r0, r2, 0 ands r0, r3 strb r0, [r1] - ldr r3, =gAnimBankTarget + ldr r3, =gBattleAnimTarget ldrb r0, [r3] adds r0, r4 ldrb r1, [r0] @@ -46955,7 +46955,7 @@ _081163FC: sub_8116420: @ 8116420 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -47048,7 +47048,7 @@ sub_81164F0: @ 81164F0 adds r4, r0, 0 ldr r5, =gBattleAnimArgs ldrb r0, [r5] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x2E] @@ -47256,14 +47256,14 @@ _081166B8: movs r5, 0 _081166BA: mov r0, sp - ldr r1, =gAnimBankAttacker + ldr r1, =gBattleAnimAttacker b _081166CA .pool _081166C4: movs r5, 0 _081166C6: mov r0, sp - ldr r1, =gAnimBankTarget + ldr r1, =gBattleAnimTarget _081166CA: ldrb r1, [r1] strb r1, [r0] @@ -47271,10 +47271,10 @@ _081166CA: .pool _081166D4: mov r1, sp - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] strb r0, [r1] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] strb r0, [r1, 0x1] b _0811670E @@ -47287,13 +47287,13 @@ _081166EC: _081166F4: movs r5, 0 mov r2, sp - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08116706 .pool _08116700: movs r5, 0 mov r2, sp - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08116706: ldrb r0, [r0] movs r1, 0x2 @@ -47310,7 +47310,7 @@ _08116712: cmp r4, r0 beq _0811673C adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0811673C @@ -47867,7 +47867,7 @@ _08116BA2: lsls r0, 24 cmp r0, 0 bne _08116C26 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] bl GetBattlerPosition lsls r0, 24 @@ -47883,13 +47883,13 @@ _08116BD2: ldrb r0, [r5] movs r6, 0x2 eors r0, r6 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 bne _08116C26 ldr r3, =gSprites - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldrb r0, [r5] eors r0, r6 adds r0, r1 @@ -47932,13 +47932,13 @@ _08116C26: b _08116CAC .pool _08116C64: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 cmp r0, 0 beq _08116C90 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes ldrb r0, [r4] lsls r0, 1 adds r0, r1 @@ -47949,7 +47949,7 @@ _08116C64: b _08116CA0 .pool _08116C90: - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes ldrb r0, [r4] lsls r0, 1 adds r0, r1 @@ -47965,11 +47965,11 @@ _08116CA0: lsrs r5, r0, 16 _08116CAC: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r1, r4, 0 adds r2, r5, 0 @@ -48119,7 +48119,7 @@ _08116DF6: movs r1, 0 bl SetGpuReg movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId ldr r4, =gSprites movs r0, 0x8 ldrsh r1, [r5, r0] @@ -48137,8 +48137,8 @@ _08116DF6: ldrsh r0, [r5, r1] cmp r0, 0x1 bne _08116E7C - ldr r2, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r2, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r1, [r0] movs r0, 0x2 eors r0, r1 @@ -48223,11 +48223,11 @@ sub_8116F04: @ 8116F04 ldrsh r0, [r1, r2] cmp r0, 0 bne _08116F24 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08116F26 .pool _08116F24: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08116F26: ldrb r0, [r0] strb r0, [r1] @@ -48247,7 +48247,7 @@ _08116F26: cmp r0, 0 beq _08116F5C ldrb r0, [r1, 0x1] - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 bne _08116F5C @@ -48320,13 +48320,13 @@ _08116FBA: _08116FEC: ldr r0, [r4] ldrb r0, [r0, 0x1] - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 lsrs r5, r0, 24 cmp r5, 0x1 bne _08117036 ldr r3, =gSprites - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds ldr r0, [r4] ldrb r0, [r0, 0x1] adds r0, r1 @@ -48374,7 +48374,7 @@ _08117078: lsls r0, 24 cmp r0, 0 beq _081170A8 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes ldr r0, [r4] ldrb r0, [r0] lsls r0, 1 @@ -48386,7 +48386,7 @@ _08117078: b _081170BA .pool _081170A8: - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes ldr r0, [r4] ldrb r0, [r0] lsls r0, 1 @@ -48425,7 +48425,7 @@ sub_81170EC: @ 81170EC lsrs r5, r0, 24 movs r0, 0 mov r8, r0 - ldr r6, =gBankSpriteIds + ldr r6, =gBattlerSpriteIds ldr r4, =gUnknown_0203A110 ldr r2, [r4] ldrb r0, [r2] @@ -48601,7 +48601,7 @@ _08117280: strh r4, [r1, 0xE] ldrb r0, [r3, 0x2] strh r0, [r1, 0x14] - ldr r2, =gBankSpriteIds + ldr r2, =gBattlerSpriteIds ldrb r0, [r3, 0x1] adds r0, r2 ldrb r0, [r0] @@ -49044,7 +49044,7 @@ sub_8117610: @ 8117610 lsrs r6, r0, 24 movs r4, 0 movs r2, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r3, [r0] movs r5, 0x1 _08117620: @@ -49096,7 +49096,7 @@ sub_8117660: @ 8117660 ldrsh r0, [r4, r1] cmp r0, 0 beq _0811769C - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -49196,7 +49196,7 @@ sub_8117754: @ 8117754 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide ldr r1, =gBattleAnimArgs @@ -49217,7 +49217,7 @@ sub_8117780: @ 8117780 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide ldr r1, =gBattleAnimArgs @@ -49239,10 +49239,10 @@ sub_81177AC: @ 81177AC lsrs r3, r0, 24 ldr r5, =gBattleAnimArgs movs r4, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r2, [r0] movs r0, 0x2 - ldr r1, =gAnimBankTarget + ldr r1, =gBattleAnimTarget eors r0, r2 ldrb r1, [r1] cmp r0, r1 @@ -49266,17 +49266,17 @@ sub_81177E4: @ 81177E4 movs r4, 0 ldr r6, =gSprites _081177EE: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] cmp r4, r0 beq _0811782C lsls r0, r4, 24 lsrs r0, 24 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _0811782C - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds adds r0, r4, r0 ldrb r0, [r0] lsls r2, r0, 4 @@ -49355,7 +49355,7 @@ sub_8117854: @ 8117854 cmp r1, 0 beq _081178BA adds r0, r6, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 bne _081178BA @@ -49435,7 +49435,7 @@ _08117964: lsls r0, 24 cmp r0, 0 beq _08117988 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r7, 1 adds r0, r1 ldrh r1, [r0] @@ -49445,7 +49445,7 @@ _08117964: b _08117996 .pool _08117988: - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r7, 1 adds r0, r1 ldrh r1, [r0] @@ -49459,7 +49459,7 @@ _08117996: lsls r0, 16 lsrs r4, r0, 16 _081179A2: - ldr r5, =gBankSpriteIds + ldr r5, =gBattlerSpriteIds adds r0, r7, r5 ldrb r1, [r0] adds r0, r7, 0 @@ -49854,13 +49854,13 @@ _08117CD2: _08117CE4: cmp r0, 0x1 bne _08117CF0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08117CF6 .pool _08117CF0: cmp r0, 0x2 bne _08117CFC - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08117CF6: ldrb r0, [r0] adds r4, r0, 0 @@ -49929,13 +49929,13 @@ _08117D6E: _08117D80: cmp r0, 0x1 bne _08117D8C - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08117D92 .pool _08117D8C: cmp r0, 0x2 bne _08117D98 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08117D92: ldrb r0, [r0] adds r4, r0, 0 @@ -50004,13 +50004,13 @@ _08117E0A: _08117E1C: cmp r0, 0x1 bne _08117E28 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08117E2E .pool _08117E28: cmp r0, 0x2 bne _08117E34 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08117E2E: ldrb r0, [r0] adds r4, r0, 0 @@ -50064,11 +50064,11 @@ sub_8117E94: @ 8117E94 push {lr} lsls r0, 24 lsrs r0, 24 - ldr r2, =gAnimBankAttacker - ldr r1, =gBattleDefender + ldr r2, =gBattleAnimAttacker + ldr r1, =gBattleMoveTarget ldrb r1, [r1] strb r1, [r2] - ldr r2, =gAnimBankTarget + ldr r2, =gBattleAnimTarget ldr r1, =gEffectBank ldrb r1, [r1] strb r1, [r2] @@ -50083,11 +50083,11 @@ sub_8117EC4: @ 8117EC4 push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide adds r4, r0, 0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r4, 24 @@ -50116,8 +50116,8 @@ sub_8117F10: @ 8117F10 push {lr} lsls r0, 24 lsrs r0, 24 - ldr r2, =gAnimBankTarget - ldr r1, =gBattleDefender + ldr r2, =gBattleAnimTarget + ldr r1, =gBattleMoveTarget ldrb r1, [r1] strb r1, [r2] bl DestroyAnimVisualTask @@ -50131,11 +50131,11 @@ sub_8117F30: @ 8117F30 push {lr} lsls r0, 24 lsrs r0, 24 - ldr r2, =gAnimBankAttacker - ldr r1, =gBattleAttacker + ldr r2, =gBattleAnimAttacker + ldr r1, =gBattleMoveAttacker ldrb r1, [r1] strb r1, [r2] - ldr r2, =gAnimBankTarget + ldr r2, =gBattleAnimTarget ldr r1, =gEffectBank ldrb r1, [r1] strb r1, [r2] @@ -50165,7 +50165,7 @@ _08117F78: adds r3, r0 ldr r0, =gBattleSpritesDataPtr ldr r4, [r0] - ldr r2, =gAnimBankAttacker + ldr r2, =gBattleAnimAttacker ldrb r0, [r2] ldr r1, [r4] lsls r0, 2 @@ -50209,7 +50209,7 @@ sub_8117FD0: @ 8117FD0 bne _08118014 ldr r0, =gBattleSpritesDataPtr ldr r1, [r0] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r3, [r0] ldr r0, [r1] lsls r3, 2 diff --git a/asm/battle_anim_815A0D4.s b/asm/battle_anim_815A0D4.s index d4c1b90b9..f0a08d8c5 100644 --- a/asm/battle_anim_815A0D4.s +++ b/asm/battle_anim_815A0D4.s @@ -87,10 +87,10 @@ sub_815A160: @ 815A160 adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 - ldr r6, =gAnimBankTarget + ldr r6, =gBattleAnimTarget ldrb r0, [r6] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 lsls r4, 24 lsrs r4, 8 @@ -100,7 +100,7 @@ sub_815A160: @ 815A160 asrs r4, 16 ldrb r0, [r6] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r1, r0, 0 lsls r1, 24 lsrs r1, 8 @@ -207,16 +207,16 @@ sub_815A254: @ 815A254 push {r4-r7,lr} sub sp, 0x4 adds r5, r0, 0 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r7, r0, 0 ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r6, r0, 0 @@ -768,7 +768,7 @@ sub_815A6C4: @ 815A6C4 adds r4, r0, 0 movs r1, 0x1 bl sub_80A69CC - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] mov r5, sp adds r5, 0x2 @@ -776,7 +776,7 @@ sub_815A6C4: @ 815A6C4 mov r2, sp adds r3, r5, 0 bl sub_80A8924 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -919,7 +919,7 @@ sub_815A7EC: @ 815A7EC lsls r0, 24 cmp r0, 0 bne _0815A840 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -1017,7 +1017,7 @@ sub_815A8C8: @ 815A8C8 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -1251,16 +1251,16 @@ sub_815AAA4: @ 815AAA4 ldrsh r0, [r6, r1] cmp r0, 0 bne _0815AAD0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -1502,15 +1502,15 @@ sub_815ACD0: @ 815ACD0 ldrsh r0, [r6, r1] cmp r0, 0 bne _0815ACEC - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _0815ACEE .pool _0815ACEC: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _0815ACEE: ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r6, [r6, 0x2] @@ -1518,7 +1518,7 @@ _0815ACEE: strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -1618,11 +1618,11 @@ sub_815ADB0: @ 815ADB0 ldrsh r0, [r0, r1] cmp r0, 0 bne _0815ADDC - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _0815ADDE .pool _0815ADDC: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _0815ADDE: ldrb r0, [r4] bl sub_80A6190 @@ -1903,16 +1903,16 @@ sub_815AFF0: @ 815AFF0 movs r5, 0 strh r5, [r4, 0x8] strh r5, [r4, 0xA] - ldr r6, =gAnimBankAttacker + ldr r6, =gBattleAnimAttacker ldrb r0, [r6] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0xC] ldrb r0, [r6] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0xE] @@ -1922,7 +1922,7 @@ sub_815AFF0: @ 815AFF0 strh r0, [r4, 0x12] strh r5, [r4, 0x14] movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x26] @@ -2278,16 +2278,16 @@ _0815B2D8: strh r1, [r5, 0x26] movs r0, 0x14 strh r0, [r5, 0x2E] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x32] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x36] @@ -2320,7 +2320,7 @@ sub_815B338: @ 815B338 .pool _0815B35C: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -2351,7 +2351,7 @@ sub_815B394: @ 815B394 push {r4-r6,lr} adds r5, r0, 0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r6, r0, 24 movs r1, 0x2E @@ -2370,16 +2370,16 @@ _0815B3B4: beq _0815B478 b _0815B496 _0815B3BE: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -2482,7 +2482,7 @@ _0815B496: sub_815B49C: @ 815B49C push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -2513,7 +2513,7 @@ sub_815B4D4: @ 815B4D4 ldrh r0, [r4, 0x2E] adds r0, 0x48 strh r0, [r4, 0x2E] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -2728,7 +2728,7 @@ sub_815B65C: @ 815B65C cmp r0, 0 bne _0815B69C movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -2770,7 +2770,7 @@ sub_815B6B4: @ 815B6B4 cmp r0, 0 bne _0815B6F4 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -2814,10 +2814,10 @@ _0815B71E: movs r0, 0x90 lsls r0, 4 strh r0, [r4, 0x30] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x32] @@ -2868,7 +2868,7 @@ sub_815B778: @ 815B778 cmp r0, 0 bne _0815B7B8 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -2933,7 +2933,7 @@ _0815B81C: movs r0, 0x4C movs r1, 0 bl SetGpuReg - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -2996,9 +2996,9 @@ _0815B886: _0815B8A6: b _0815BA7A _0815B8A8: - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] - ldr r1, =gAnimBankTarget + ldr r1, =gBattleAnimTarget ldrb r1, [r1] mov r2, r8 lsls r4, r2, 2 @@ -3030,7 +3030,7 @@ _0815B8EA: adds r2, 0x4 adds r2, r0 ldr r1, =gBattleMonForms - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r0, r1 ldrb r1, [r0] @@ -3122,8 +3122,8 @@ _0815B99C: cmp r0, 0 beq _0815B9EC ldr r3, =gSprites - ldr r4, =gBankSpriteIds - ldr r2, =gAnimBankAttacker + ldr r4, =gBattlerSpriteIds + ldr r2, =gBattleAnimAttacker ldrb r0, [r2] adds r0, r4 ldrb r1, [r0] @@ -3138,8 +3138,8 @@ _0815B99C: .pool _0815B9EC: ldr r3, =gSprites - ldr r4, =gBankSpriteIds - ldr r2, =gAnimBankAttacker + ldr r4, =gBattlerSpriteIds + ldr r2, =gBattleAnimAttacker ldrb r0, [r2] adds r0, r4 ldrb r1, [r0] @@ -3209,7 +3209,7 @@ _0815BA82: movs r0, 0x4C movs r1, 0 bl SetGpuReg - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -3232,7 +3232,7 @@ _0815BAB6: lsls r0, 24 cmp r0, 0 bne _0815BAF6 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 @@ -3256,7 +3256,7 @@ _0815BAB6: lsls r1, r0, 2 adds r1, r2 ldrh r1, [r1, 0x2] - bl SetBankEnemyShadowSpriteCallback + bl SetBattlerShadowSpriteCallback _0815BAF6: mov r0, r8 bl DestroyAnimVisualTask @@ -3278,8 +3278,8 @@ sub_815BB18: @ 815BB18 lsrs r0, 24 ldr r4, =gBattleAnimArgs ldr r3, =gSprites - ldr r2, =gBankSpriteIds - ldr r1, =gAnimBankAttacker + ldr r2, =gBattlerSpriteIds + ldr r1, =gBattleAnimAttacker ldrb r1, [r1] adds r1, r2 ldrb r2, [r1] @@ -3305,9 +3305,9 @@ sub_815BB58: @ 815BB58 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] - ldr r1, =gAnimBankTarget + ldr r1, =gBattleAnimTarget ldrb r1, [r1] movs r2, 0x1 bl HandleSpeciesGfxDataChange @@ -3390,7 +3390,7 @@ _0815BC02: b _0815BC5C .pool _0815BC34: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -3621,17 +3621,17 @@ sub_815BE04: @ 815BE04 lsls r0, 16 lsrs r5, r0, 16 _0815BE2E: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, r5 strh r0, [r7, 0x20] ldrb r0, [r4] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, 0x20 @@ -3996,7 +3996,7 @@ _0815C124: b _0815C1CA .pool _0815C15C: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerPosition lsls r0, 24 @@ -4085,7 +4085,7 @@ _0815C224: adds r5, r0, r1 movs r0, 0 strh r0, [r5, 0xE] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -4272,7 +4272,7 @@ sub_815C3A8: @ 815C3A8 cmp r0, 0 bne _0815C3E8 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -4325,7 +4325,7 @@ _0815C41E: ldrh r0, [r4, 0x32] adds r0, 0x80 strh r0, [r4, 0x32] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -4419,7 +4419,7 @@ _0815C4BC: subs r0, 0x1 strh r0, [r4, 0x14] ldrb r0, [r5] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x26] @@ -4427,11 +4427,11 @@ _0815C4BC: ldrsh r0, [r5, r1] cmp r0, 0 bne _0815C508 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0815C50A .pool _0815C508: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0815C50A: ldrb r0, [r0] bl GetBattlerSide @@ -4643,7 +4643,7 @@ _0815C6A8: sub_815C6B0: @ 815C6B0 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -4683,7 +4683,7 @@ sub_815C700: @ 815C700 ldrh r0, [r4, 0x2E] adds r0, 0x3 strh r0, [r4, 0x2E] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -4758,7 +4758,7 @@ sub_815C770: @ 815C770 strh r0, [r4, 0x24] ldr r0, =gBattleAnimArgs ldrb r0, [r0] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x26] @@ -4991,16 +4991,16 @@ sub_815C95C: @ 815C95C ldrsh r0, [r6, r2] cmp r0, 0 bne _0815C990 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -5100,17 +5100,17 @@ sub_815CA20: @ 815CA20 mov r8, r0 cmp r1, 0 bne _0815CA5C - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0815CA5E .pool _0815CA5C: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0815CA5E: ldrb r0, [r0] strh r0, [r2, 0x1E] mov r1, r8 ldrb r0, [r1] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r5, r0, 24 ldr r1, =gTasks @@ -5528,16 +5528,16 @@ _0815CDAA: sub_815CDB4: @ 815CDB4 push {r4,r5,lr} adds r4, r0, 0 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x20] ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -5586,14 +5586,14 @@ sub_815CDFC: @ 815CDFC cmp r0, 0xC3 ble _0815CE48 _0815CE36: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A82E4 subs r0, 0x1 b _0815CE52 .pool _0815CE48: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A82E4 adds r0, 0x1 @@ -5674,7 +5674,7 @@ sub_815CED8: @ 815CED8 lsrs r0, 24 str r0, [sp, 0x18] movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId bl IsContest lsls r0, 24 cmp r0, 0 @@ -5693,7 +5693,7 @@ sub_815CED8: @ 815CED8 b _0815D058 .pool _0815CF18: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -5701,8 +5701,8 @@ _0815CF18: beq _0815CFC4 movs r0, 0 str r0, [sp, 0x1C] - ldr r6, =gBattlePartyID - ldr r4, =gAnimBankTarget + ldr r6, =gBattlerPartyIndexes + ldr r4, =gBattleAnimTarget ldrb r0, [r4] lsls r0, 1 adds r0, r6 @@ -5769,8 +5769,8 @@ _0815CFBE: _0815CFC4: movs r2, 0x1 str r2, [sp, 0x1C] - ldr r6, =gBattlePartyID - ldr r4, =gAnimBankTarget + ldr r6, =gBattlerPartyIndexes + ldr r4, =gBattleAnimTarget ldrb r0, [r4] lsls r0, 1 adds r0, r6 @@ -5834,21 +5834,21 @@ _0815D056: _0815D058: mov r10, r3 _0815D05A: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8328 lsls r0, 24 lsrs r7, r0, 24 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 ldrb r0, [r5] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 mov r2, r10 lsls r1, r2, 16 @@ -5864,7 +5864,7 @@ _0815D05A: str r3, [sp, 0x8] mov r0, r8 str r0, [sp, 0xC] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] str r0, [sp, 0x10] movs r0, 0x1 @@ -6072,11 +6072,11 @@ sub_815D240: @ 815D240 ldrsh r0, [r0, r1] cmp r0, 0 bne _0815D26C - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0815D26E .pool _0815D26C: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0815D26E: ldrb r5, [r0] movs r6, 0 @@ -6118,7 +6118,7 @@ _0815D2B4: strh r0, [r4, 0x24] ldr r0, =gBattleAnimArgs ldrb r0, [r0] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x26] @@ -6562,7 +6562,7 @@ sub_815D64C: @ 815D64C strh r0, [r4, 0x8] ldr r0, =gBattleAnimArgs ldrb r0, [r0] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -6827,7 +6827,7 @@ sub_815D870: @ 815D870 ldrb r1, [r6] adds r0, r5, 0 bl StartSpriteAffineAnim - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -6837,10 +6837,10 @@ sub_815D870: @ 815D870 negs r0, r0 strh r0, [r6, 0x2] _0815D896: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r6, 0x2] @@ -6848,7 +6848,7 @@ _0815D896: strh r0, [r5, 0x20] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r6, [r6, 0x4] @@ -7237,8 +7237,8 @@ sub_815DB90: @ 815DB90 lsls r0, 3 mov r1, r8 adds r4, r0, r1 - ldr r1, =gBankSpriteIds - ldr r2, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r2, =gBattleAnimAttacker ldrb r0, [r2] adds r0, r1 ldrb r0, [r0] @@ -7373,22 +7373,22 @@ _0815DCC4: ldrsh r0, [r4, r1] cmp r0, 0 bne _0815DCE8 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0815DCEA .pool _0815DCE8: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0815DCEA: ldrb r4, [r0] adds r0, r4, 0 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x10] adds r0, r4, 0 movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x12] @@ -7399,7 +7399,7 @@ _0815DCEA: strh r0, [r5, 0x14] ldr r0, =gBattleAnimArgs ldrb r0, [r0] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -7661,7 +7661,7 @@ sub_815DF0C: @ 815DF0C ldrh r0, [r1, 0x2] strh r0, [r4, 0xA] ldrb r0, [r1] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 ldr r2, =gSprites @@ -7746,7 +7746,7 @@ sub_815DFCC: @ 815DFCC lsrs r0, 24 movs r2, 0xD0 lsls r2, 1 - ldr r1, =gAnimBankAttacker + ldr r1, =gBattleAnimAttacker ldrb r3, [r1] ldr r1, =gBattleAnimArgs ldrb r1, [r1] @@ -7775,7 +7775,7 @@ sub_815DFCC: @ 815DFCC sub_815E01C: @ 815E01C push {r4-r6,lr} adds r5, r0, 0 - ldr r6, =gAnimBankAttacker + ldr r6, =gBattleAnimAttacker ldrb r0, [r6] bl GetBattlerSide lsls r0, 24 @@ -7789,7 +7789,7 @@ sub_815E01C: @ 815E01C _0815E038: ldrb r0, [r6] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r4, =gBattleAnimArgs lsrs r0, 24 @@ -7798,7 +7798,7 @@ _0815E038: strh r0, [r5, 0x20] ldrb r0, [r6] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r1, [r4, 0x2] @@ -7837,7 +7837,7 @@ _0815E09A: lsls r0, 2 strh r0, [r5, 0x2E] _0815E0A8: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -7923,7 +7923,7 @@ _0815E144: strh r0, [r6, 0x14] strh r1, [r6, 0x16] _0815E14E: - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] bl GetBattlerSide lsls r0, 24 @@ -7931,7 +7931,7 @@ _0815E14E: bne _0815E188 ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 ldrb r0, [r5] movs r1, 0 @@ -7951,7 +7951,7 @@ _0815E17C: _0815E188: ldrb r0, [r5] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 ldrb r0, [r5] movs r1, 0 @@ -7968,10 +7968,10 @@ _0815E1A8: subs r0, r4, r0 _0815E1AC: strh r0, [r6, 0x1E] - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 ldrb r0, [r5] movs r1, 0 @@ -7987,16 +7987,16 @@ _0815E1D0: asrs r0, 2 subs r0, r4, r0 strh r0, [r6, 0x20] - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x22] ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x24] @@ -8345,33 +8345,33 @@ sub_815E47C: @ 815E47C lsls r0, 3 ldr r1, =gTasks adds r7, r0, r1 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker mov r10, r0 ldrb r0, [r0] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r7, 0x1E] mov r1, r10 ldrb r0, [r1] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r7, 0x20] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget mov r8, r0 ldrb r0, [r0] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r7, 0x22] mov r1, r8 ldrb r0, [r1] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 mov r1, r8 ldrb r0, [r1] @@ -8626,11 +8626,11 @@ sub_815E6D8: @ 815E6D8 adds r6, r0, 0 cmp r1, 0 bne _0815E6F4 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0815E6F6 .pool _0815E6F4: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0815E6F6: ldrb r5, [r0] ldrh r2, [r4, 0x4] @@ -8659,7 +8659,7 @@ _0815E724: strh r1, [r4, 0x3C] adds r0, r5, 0 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -8827,7 +8827,7 @@ _0815E85C: ldrh r0, [r2, 0x2] strh r0, [r4, 0x8] ldrb r0, [r2] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -8942,15 +8942,15 @@ sub_815E954: @ 815E954 ldrsh r0, [r0, r1] cmp r0, 0 bne _0815E970 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker b _0815E972 .pool _0815E970: - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget _0815E972: ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] @@ -9326,7 +9326,7 @@ sub_815EC48: @ 815EC48 ldr r0, =gTasks adds r6, r1, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x26] @@ -9339,10 +9339,10 @@ sub_815EC48: @ 815EC48 lsrs r7, r0, 24 cmp r7, 0x1 bne _0815ECB4 - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -9350,7 +9350,7 @@ sub_815EC48: @ 815EC48 movs r0, 0x2 eors r0, r1 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 cmp r4, r0 @@ -9363,7 +9363,7 @@ _0815ECAC: b _0815ECD2 .pool _0815ECB4: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -9606,11 +9606,11 @@ sub_815EE84: @ 815EE84 adds r0, r4, 0 movs r1, 0x1 bl sub_80A69CC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _0815EEAA .pool _0815EEA8: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _0815EEAA: ldrb r0, [r0] strh r0, [r4, 0x3C] @@ -9771,14 +9771,14 @@ _0815EFEC: lsls r0, 24 lsrs r0, 24 movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r5, r0, 24 ldrh r0, [r4, 0x3C] lsls r0, 24 lsrs r0, 24 movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r1, r0, 24 _0815F00C: @@ -9991,13 +9991,13 @@ _0815F17C: sub_815F18C: @ 815F18C push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord ldrb r0, [r4] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 @@ -10057,7 +10057,7 @@ sub_815F20C: @ 815F20C lsls r0, 24 lsrs r6, r0, 24 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r5, r0, 24 adds r2, r5, 0 @@ -10126,7 +10126,7 @@ _0815F2A0: b _0815F310 .pool _0815F2AC: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0 bl LoadBattleMonGfxAndAnimate @@ -10135,7 +10135,7 @@ _0815F2AC: cmp r0, 0 beq _0815F2EE ldr r3, =gSprites - ldr r2, =gBankSpriteIds + ldr r2, =gBattlerSpriteIds ldrb r0, [r4] adds r0, r2 ldrb r1, [r0] @@ -10191,7 +10191,7 @@ sub_815F330: @ 815F330 lsls r0, 24 lsrs r6, r0, 24 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r3, r0, 24 ldr r1, =gTasks @@ -10360,7 +10360,7 @@ _0815F482: sub_815F48C: @ 815F48C push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankTarget + ldr r4, =gBattleAnimTarget ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 @@ -10384,10 +10384,10 @@ _0815F4B8: strb r0, [r1] ldr r4, =0x0000ffa0 _0815F4C8: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0x3 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x22] @@ -10639,7 +10639,7 @@ _0815F67C: strh r1, [r0, 0x8] ldr r0, =gBattleSpritesDataPtr ldr r1, [r0] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] ldr r1, [r1] lsls r0, 2 @@ -10764,7 +10764,7 @@ sub_815F7C4: @ 815F7C4 strh r0, [r4, 0x30] ldr r0, =gBattleSpritesDataPtr ldr r1, [r0] - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] ldr r1, [r1] lsls r0, 2 @@ -10943,7 +10943,7 @@ _0815F92C: .4byte _0815FD8C _0815F940: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r7, r0, 24 ldr r1, =gTasks @@ -10958,7 +10958,7 @@ _0815F940: ldrh r1, [r6, 0xA] adds r0, r1 strh r0, [r6, 0xA] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -11036,7 +11036,7 @@ _0815F9F4: ldr r3, [r0, 0xC] mov r9, r3 ldrh r6, [r0] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A82E4 lsls r0, 24 @@ -11045,13 +11045,13 @@ _0815F9F4: b _0815FB4E .pool _0815FA28: - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 cmp r0, 0 bne _0815FAC8 - ldr r7, =gBattlePartyID + ldr r7, =gBattlerPartyIndexes ldrb r0, [r4] lsls r0, 1 adds r0, r7 @@ -11096,7 +11096,7 @@ _0815FA9C: ldrh r6, [r1, 0x2] _0815FA9E: movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId ldr r2, =gSprites lsls r0, 24 lsrs r0, 24 @@ -11115,7 +11115,7 @@ _0815FA9E: b _0815FB50 .pool _0815FAC8: - ldr r7, =gBattlePartyID + ldr r7, =gBattlerPartyIndexes ldrb r0, [r4] lsls r0, 1 adds r0, r7 @@ -11160,7 +11160,7 @@ _0815FB2C: ldrh r6, [r1, 0x2] _0815FB2E: movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId ldr r2, =gSprites lsls r0, 24 lsrs r0, 24 @@ -11177,10 +11177,10 @@ _0815FB2E: _0815FB4E: ldr r5, =0x0000ffe0 _0815FB50: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 lsls r3, r5, 16 @@ -11191,7 +11191,7 @@ _0815FB50: str r4, [sp, 0x8] mov r0, r9 str r0, [sp, 0xC] - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] str r0, [sp, 0x10] movs r0, 0 @@ -11253,7 +11253,7 @@ _0815FBE8: ldrh r2, [r6, 0xA] adds r0, r2 strh r0, [r6, 0xA] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -11307,7 +11307,7 @@ _0815FC56: ldrsh r0, [r6, r1] cmp r0, 0 bne _0815FCD6 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -11315,10 +11315,10 @@ _0815FC56: bne _0815FCB4 lsls r4, r5, 16 asrs r4, 16 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 cmp r4, r0 @@ -11328,10 +11328,10 @@ _0815FC56: _0815FCB4: lsls r4, r5, 16 asrs r4, 16 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 cmp r4, r0 @@ -11365,7 +11365,7 @@ _0815FCE8: .pool _0815FD08: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r7, r0, 24 ldr r1, =gTasks @@ -11383,7 +11383,7 @@ _0815FD08: ldr r5, =gSprites adds r0, r5 bl sub_80A8610 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -11425,7 +11425,7 @@ _0815FD7E: .pool _0815FD8C: movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r7, r0, 24 ldr r1, =gTasks @@ -11440,7 +11440,7 @@ _0815FD8C: ldrh r3, [r2, 0xA] adds r0, r3 strh r0, [r2, 0xA] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker mov r10, r0 ldrb r0, [r0] str r2, [sp, 0x18] @@ -11469,7 +11469,7 @@ _0815FD8C: mov r1, r10 ldrb r0, [r1] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r3, r5, 0 @@ -11499,7 +11499,7 @@ _0815FE0C: mov r2, r10 ldrb r0, [r2] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r3, r5, 0 @@ -11563,10 +11563,10 @@ _0815FE92: asrs r1, 24 movs r0, 0x7A bl PlaySE12WithPanning - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r0, 0x10 @@ -11583,7 +11583,7 @@ _0815FE92: negs r0, r0 ands r0, r1 strb r0, [r2] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -11595,7 +11595,7 @@ _0815FE92: cmp r0, 0 bne _0815FFBC movs r0, 0x1 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId ldr r2, =gSprites lsls r0, 24 lsrs r0, 24 @@ -11652,7 +11652,7 @@ _0815FF6E: ldrh r1, [r4, 0x32] adds r0, r1 strh r0, [r4, 0x32] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -11721,17 +11721,17 @@ _0815FFF4: .4byte _081600CC .4byte _08160132 _08160008: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r5, r0, 0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 adds r2, r0, 0 @@ -11755,8 +11755,8 @@ _0816003E: b _08160150 .pool _08160058: - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r0, r1 ldrb r2, [r0] @@ -11811,8 +11811,8 @@ _081600B4: strh r1, [r0, 0x26] b _08160150 _081600CC: - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r0, r1 ldrb r2, [r0] @@ -11861,8 +11861,8 @@ _0816012A: strh r0, [r2, 0x26] b _08160150 _08160132: - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r0, r1 ldrb r2, [r0] @@ -11893,12 +11893,12 @@ sub_8160164: @ 8160164 ldr r0, =gTasks adds r4, r1, r0 movs r0, 0 - bl GetAnimBankSpriteId + bl GetBattlerSpriteId lsls r0, 24 lsrs r0, 24 movs r5, 0 strh r0, [r4, 0xE] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -12072,7 +12072,7 @@ _081602DA: sub_81602E0: @ 81602E0 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -12115,7 +12115,7 @@ _08160326: sub_8160338: @ 8160338 push {r4,lr} adds r4, r0, 0 - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -12166,10 +12166,10 @@ _08160396: sub_81603A8: @ 81603A8 push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gAnimBankAttacker + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] movs r1, 0x2 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x20] @@ -12396,7 +12396,7 @@ sub_8160544: @ 8160544 strh r0, [r4, 0x8] ldr r0, =gBattleAnimArgs ldrb r0, [r0] - bl GetAnimBankSpriteId + bl GetBattlerSpriteId adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 diff --git a/asm/battle_anim_8170478.s b/asm/battle_anim_8170478.s index ad37b18d2..1bd7e9629 100644 --- a/asm/battle_anim_8170478.s +++ b/asm/battle_anim_8170478.s @@ -16,7 +16,7 @@ sub_8170478: @ 8170478 lsls r0, 24 lsrs r0, 24 str r0, [sp, 0x10] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r4, [r0] ldr r0, =gBattle_WIN0H movs r1, 0 @@ -56,7 +56,7 @@ sub_8170478: @ 8170478 movs r1, 0x3 movs r2, 0x1 bl SetAnimBgAttribute - ldr r0, =gHealthBoxesIds + ldr r0, =gHealthboxSpriteIds adds r4, r0 ldrb r0, [r4] ldr r1, =gSprites @@ -212,7 +212,7 @@ sub_8170660: @ 8170660 push {r7} lsls r0, 24 lsrs r7, r0, 24 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] mov r8, r0 ldr r1, =gTasks @@ -373,7 +373,7 @@ _0817076C: movs r1, 0x1 movs r2, 0 bl SetAnimBgAttribute - ldr r0, =gHealthBoxesIds + ldr r0, =gHealthboxSpriteIds add r0, r8 ldrb r0, [r0] lsls r1, r0, 4 @@ -434,7 +434,7 @@ sub_8170834: @ 8170834 adds r7, r1, 0 lsls r2, 24 lsrs r2, 24 - ldr r0, =gHealthBoxesIds + ldr r0, =gHealthboxSpriteIds adds r2, r0 ldrb r0, [r2] lsls r5, r0, 4 @@ -540,7 +540,7 @@ sub_8170920: @ 8170920 lsrs r4, 24 mov r1, sp adds r1, 0x1 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r2, [r0] mov r0, sp bl sub_8170834 @@ -561,7 +561,7 @@ sub_817094C: @ 817094C push {r5,r6} lsls r0, 24 lsrs r0, 24 - ldr r1, =gHealthBoxesIds + ldr r1, =gHealthboxSpriteIds adds r0, r1 ldrb r0, [r0] ldr r1, =gSprites @@ -628,7 +628,7 @@ sub_81709EC: @ 81709EC adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_817094C adds r0, r4, 0 @@ -765,8 +765,8 @@ sub_8170B04: @ 8170B04 push {r4-r6,lr} lsls r0, 24 lsrs r6, r0, 24 - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r0, r1 ldrb r5, [r0] @@ -851,8 +851,8 @@ sub_8170BB0: @ 8170BB0 sub sp, 0xC lsls r0, 24 lsrs r5, r0, 24 - ldr r1, =gBankSpriteIds - ldr r4, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] adds r1, r0, r1 ldrb r1, [r1] @@ -861,7 +861,7 @@ sub_8170BB0: @ 8170BB0 lsls r0, 24 cmp r0, 0 bne _08170BF8 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes ldrb r0, [r4] lsls r0, 1 adds r0, r1 @@ -872,7 +872,7 @@ sub_8170BB0: @ 8170BB0 b _08170C08 .pool _08170BF8: - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes ldrb r0, [r4] lsls r0, 1 adds r0, r1 @@ -904,16 +904,16 @@ _08170C08: b _08170CEE .pool _08170C44: - ldr r5, =gAnimBankAttacker + ldr r5, =gBattleAnimAttacker ldrb r0, [r5] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 ldrb r0, [r5] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord adds r1, r0, 0 lsls r1, 24 ldr r2, =gSprites @@ -1162,18 +1162,18 @@ sub_8170E04: @ 8170E04 adds r6, r4, r1 movs r0, 0x22 strh r0, [r6, 0x2E] - ldr r2, =gAnimBankTarget + ldr r2, =gBattleAnimTarget mov r8, r2 ldrb r0, [r2] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x30] mov r1, r8 ldrb r0, [r1] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 subs r0, 0x10 @@ -1186,7 +1186,7 @@ sub_8170E04: @ 8170E04 ldr r0, =gBattleSpritesDataPtr ldr r0, [r0] ldr r3, [r0, 0x8] - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds mov r2, r8 ldrb r0, [r2] adds r0, r1 @@ -1313,18 +1313,18 @@ _08170F54: adds r6, r4, r0 movs r0, 0x22 strh r0, [r6, 0x2E] - ldr r1, =gAnimBankTarget + ldr r1, =gBattleAnimTarget mov r8, r1 ldrb r0, [r1] movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x30] mov r1, r8 ldrb r0, [r1] movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 subs r0, 0x10 @@ -1336,7 +1336,7 @@ _08170F54: str r0, [r4] movs r0, 0 bl GetBattlerAtPosition - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds lsls r0, 24 lsrs r0, 24 adds r0, r1 @@ -1372,7 +1372,7 @@ sub_8171030: @ 8171030 ldr r6, =gSprites movs r0, 0 bl GetBattlerAtPosition - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds lsls r0, 24 lsrs r0, 24 adds r0, r1 @@ -1423,7 +1423,7 @@ sub_81710A8: @ 81710A8 ldr r6, =gSprites movs r0, 0 bl GetBattlerAtPosition - ldr r4, =gBankSpriteIds + ldr r4, =gBattlerSpriteIds lsls r0, 24 lsrs r0, 24 adds r0, r4 @@ -1550,7 +1550,7 @@ _08171188: movs r2, 0x1 movs r3, 0x1C bl LaunchBallStarsTask - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r1, [r0] movs r0, 0 movs r2, 0xE @@ -1584,8 +1584,8 @@ sub_81711E8: @ 81711E8 ldr r0, =sub_8171240 str r0, [r4, 0x1C] ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankTarget + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r0, r1 ldrb r1, [r0] @@ -1606,8 +1606,8 @@ _08171224: sub_8171240: @ 8171240 push {r4-r7,lr} adds r7, r0, 0 - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankTarget + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimTarget ldrb r0, [r0] adds r0, r1 ldrb r4, [r0] @@ -2333,7 +2333,7 @@ sub_81717F8: @ 81717F8 push {r7} sub sp, 0x4 adds r6, r0, 0 - ldr r7, =gAnimBankTarget + ldr r7, =gBattleAnimTarget ldrh r0, [r6, 0x36] adds r0, 0x1 movs r1, 0 @@ -2390,7 +2390,7 @@ _08171880: cmp r1, r0 bne _081718BC ldr r5, =gSprites - ldr r4, =gBankSpriteIds + ldr r4, =gBattlerSpriteIds ldrb r0, [r7] adds r0, r4 ldrb r1, [r0] @@ -2715,7 +2715,7 @@ sub_8171AE4: @ 8171AE4 movs r2, 0x1 movs r3, 0x1C bl LaunchBallStarsTask - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r1, [r0] movs r0, 0x1 movs r2, 0xE @@ -2723,8 +2723,8 @@ sub_8171AE4: @ 8171AE4 bl LaunchBallFadeMonTask _08171B36: ldr r6, =gSprites - ldr r5, =gBankSpriteIds - ldr r4, =gAnimBankTarget + ldr r5, =gBattlerSpriteIds + ldr r4, =gBattleAnimTarget ldrb r0, [r4] adds r0, r5 ldrb r1, [r0] @@ -2791,8 +2791,8 @@ sub_8171BAC: @ 8171BAC strb r0, [r2] _08171BCA: ldr r4, =gSprites - ldr r3, =gBankSpriteIds - ldr r2, =gAnimBankTarget + ldr r3, =gBattlerSpriteIds + ldr r2, =gBattleAnimTarget ldrb r0, [r2] adds r0, r3 ldrb r1, [r0] @@ -2840,8 +2840,8 @@ _08171C24: cmp r5, 0 beq _08171C8A ldr r4, =gSprites - ldr r3, =gBankSpriteIds - ldr r2, =gAnimBankTarget + ldr r3, =gBattlerSpriteIds + ldr r2, =gBattleAnimTarget ldrb r0, [r2] adds r0, r3 ldrb r1, [r0] @@ -4729,8 +4729,8 @@ sub_8172BF0: @ 8172BF0 lsrs r7, r0, 24 movs r0, 0 mov r8, r0 - ldr r0, =gBankSpriteIds - ldr r3, =gAnimBankAttacker + ldr r0, =gBattlerSpriteIds + ldr r3, =gBattleAnimAttacker ldrb r2, [r3] adds r0, r2, r0 ldrb r6, [r0] @@ -4877,7 +4877,7 @@ _08172D28: adds r0, r1 ldrb r1, [r0, 0x8] strh r1, [r0, 0x8] - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -4949,7 +4949,7 @@ _08172DC0: beq _08172E4E b _08172E84 _08172DC6: - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] bl sub_80A8364 lsls r0, 24 @@ -5009,8 +5009,8 @@ _08172E14: strh r0, [r4, 0x26] b _08172E84 _08172E4E: - ldr r1, =gBankSpriteIds - ldr r4, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r4, =gBattleAnimAttacker ldrb r0, [r4] adds r0, r1 ldrb r1, [r0] @@ -5048,7 +5048,7 @@ sub_8172E9C: @ 8172E9C ldr r3, =gBattleAnimArgs ldr r1, =gBattleSpritesDataPtr ldr r2, [r1] - ldr r1, =gAnimBankAttacker + ldr r1, =gBattleAnimAttacker ldrb r1, [r1] ldr r2, [r2] lsls r1, 2 @@ -5068,7 +5068,7 @@ sub_8172ED0: @ 8172ED0 push {lr} lsls r0, 24 lsrs r0, 24 - ldr r2, =gAnimBankTarget + ldr r2, =gBattleAnimTarget ldr r1, =gEffectBank ldrb r1, [r1] strb r1, [r2] @@ -5108,7 +5108,7 @@ sub_8172EF0: @ 8172EF0 bl GetMonData adds r4, r0, 0 adds r0, r6, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 beq _08172FC8 @@ -5234,12 +5234,12 @@ _0817303A: ldrb r0, [r4, 0x8] mov r8, r0 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r5, r0, 24 mov r0, r8 movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r2, r0, 24 movs r1, 0x1E @@ -5579,7 +5579,7 @@ sub_817330C: @ 817330C lsls r0, 24 lsrs r0, 24 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 ldr r5, =gBattleAnimArgs lsrs r0, 24 @@ -5591,7 +5591,7 @@ sub_817330C: @ 817330C lsls r0, 24 lsrs r0, 24 movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 ldrh r5, [r5, 0x6] @@ -5602,8 +5602,8 @@ sub_817330C: @ 817330C adds r0, r4, 0 bl sub_80A68D4 ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r0, r1 ldrb r1, [r0] @@ -5627,8 +5627,8 @@ sub_817339C: @ 817339C push {lr} adds r3, r0, 0 ldr r2, =gSprites - ldr r1, =gBankSpriteIds - ldr r0, =gAnimBankAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] adds r0, r1 ldrb r1, [r0] @@ -5678,8 +5678,8 @@ sub_8173400: @ 8173400 push {r4,r5,lr} adds r4, r0, 0 ldr r5, =gSprites - ldr r3, =gBankSpriteIds - ldr r2, =gAnimBankAttacker + ldr r3, =gBattlerSpriteIds + ldr r2, =gBattleAnimAttacker ldrb r0, [r2] adds r0, r3 ldrb r1, [r0] @@ -5733,7 +5733,7 @@ sub_817345C: @ 817345C _08173478: movs r0, 0 bl GetBattlerAtPosition - ldr r1, =gAnimBankAttacker + ldr r1, =gBattleAnimAttacker strb r0, [r1] movs r0, 0x1 b _08173498 @@ -5741,12 +5741,12 @@ _08173478: _0817348C: movs r0, 0x1 bl GetBattlerAtPosition - ldr r1, =gAnimBankAttacker + ldr r1, =gBattleAnimAttacker strb r0, [r1] movs r0, 0 _08173498: bl GetBattlerAtPosition - ldr r1, =gAnimBankTarget + ldr r1, =gBattleAnimTarget strb r0, [r1] _081734A0: adds r0, r4, 0 @@ -5812,13 +5812,13 @@ sub_817351C: @ 817351C push {lr} lsls r0, 24 lsrs r0, 24 - ldr r3, =gAnimBankAttacker + ldr r3, =gBattleAnimAttacker ldr r1, =gBattleSpritesDataPtr ldr r2, [r1] ldr r1, [r2, 0x8] ldrh r1, [r1] strb r1, [r3] - ldr r3, =gAnimBankTarget + ldr r3, =gBattleAnimTarget ldr r1, [r2, 0x8] ldrh r1, [r1] lsrs r1, 8 diff --git a/asm/battle_anim_sound_tasks.s b/asm/battle_anim_sound_tasks.s index 85148c8b6..def934fab 100644 --- a/asm/battle_anim_sound_tasks.s +++ b/asm/battle_anim_sound_tasks.s @@ -336,25 +336,25 @@ _08158DD0: adds r2, r0, 0 cmp r1, 0 bne _08158DEC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r4, [r0] b _08158E12 .pool _08158DEC: cmp r1, 0x1 bne _08158DFC - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r4, [r0] b _08158E12 .pool _08158DFC: cmp r1, 0x2 bne _08158E08 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08158E0A .pool _08158E08: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08158E0A: ldrb r1, [r0] movs r0, 0x2 @@ -369,7 +369,7 @@ _08158E12: bne _08158E38 _08158E1E: adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 bne _08158E38 @@ -383,7 +383,7 @@ _08158E38: lsls r0, 24 cmp r0, 0 beq _08158E5C - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r1 ldrh r1, [r0] @@ -393,7 +393,7 @@ _08158E38: b _08158E6A .pool _08158E5C: - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r1 ldrh r1, [r0] @@ -461,25 +461,25 @@ _08158EE0: adds r2, r0, 0 cmp r1, 0 bne _08158EFC - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r4, [r0] b _08158F22 .pool _08158EFC: cmp r1, 0x1 bne _08158F0C - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget ldrb r4, [r0] b _08158F22 .pool _08158F0C: cmp r1, 0x2 bne _08158F18 - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker b _08158F1A .pool _08158F18: - ldr r0, =gAnimBankTarget + ldr r0, =gBattleAnimTarget _08158F1A: ldrb r1, [r0] movs r0, 0x2 @@ -494,7 +494,7 @@ _08158F22: bne _08158F48 _08158F2E: adds r0, r4, 0 - bl IsAnimBankSpriteVisible + bl IsBattlerSpriteVisible lsls r0, 24 cmp r0, 0 bne _08158F48 @@ -508,7 +508,7 @@ _08158F48: lsls r0, 24 cmp r0, 0 beq _08158F6C - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r1 ldrh r1, [r0] @@ -518,7 +518,7 @@ _08158F48: b _08158F7A .pool _08158F6C: - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r1 ldrh r1, [r0] @@ -705,7 +705,7 @@ sub_81590B8: @ 81590B8 .pool _081590F8: ldr r1, =gAnimSpeciesByBanks - ldr r0, =gAnimBankAttacker + ldr r0, =gBattleAnimAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 diff --git a/asm/battle_link_817C95C.s b/asm/battle_link_817C95C.s index b9205632b..61e303417 100644 --- a/asm/battle_link_817C95C.s +++ b/asm/battle_link_817C95C.s @@ -34,12 +34,12 @@ _0817C988: movs r1, 0x81 lsls r1, 2 adds r7, r0, r1 - ldr r5, =gBattleAttacker + ldr r5, =gBattleMoveAttacker ldrb r0, [r5] bl GetBattlerSide lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gBattleDefender + ldr r0, =gBattleMoveTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -59,7 +59,7 @@ _0817C988: str r0, [sp, 0x4] cmp r4, 0 bne _0817CA00 - ldr r2, =gBattlePartyID + ldr r2, =gBattlerPartyIndexes ldrb r0, [r5] lsls r0, 1 adds r0, r2 @@ -70,7 +70,7 @@ _0817C988: b _0817CA10 .pool _0817CA00: - ldr r2, =gBattlePartyID + ldr r2, =gBattlerPartyIndexes ldrb r0, [r5] lsls r0, 1 adds r0, r2 @@ -83,7 +83,7 @@ _0817CA10: str r1, [sp, 0x8] cmp r6, 0 bne _0817CA3C - ldr r0, =gBattleDefender + ldr r0, =gBattleMoveTarget ldrb r0, [r0] lsls r0, 1 adds r0, r2 @@ -94,7 +94,7 @@ _0817CA10: b _0817CA4C .pool _0817CA3C: - ldr r0, =gBattleDefender + ldr r0, =gBattleMoveTarget ldrb r0, [r0] lsls r0, 1 adds r0, r2 @@ -105,12 +105,12 @@ _0817CA3C: _0817CA4C: adds r1, r0 str r1, [sp, 0xC] - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] ldr r1, =gStringInfo ldr r1, [r1] ldrh r1, [r1] - bl GetBankMoveSlotId + bl GetBattlerMoveSlotId lsls r0, 24 lsrs r0, 24 mov r10, r0 @@ -134,13 +134,13 @@ _0817CA4C: bl _0817E0A2 .pool _0817CA9C: - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] bl GetBattlerPosition lsls r0, 24 lsrs r0, 25 mov r8, r0 - ldr r0, =gBattleDefender + ldr r0, =gBattleMoveTarget ldrb r0, [r0] bl GetBattlerPosition lsls r0, 24 @@ -571,8 +571,8 @@ _0817D0DC: adds r3, r4 lsls r3, 2 adds r3, r7, r3 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -601,8 +601,8 @@ _0817D124: adds r2, r4 lsls r2, 2 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -634,8 +634,8 @@ _0817D16C: adds r0, r4 lsls r0, 2 adds r5, r7, r0 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -715,8 +715,8 @@ _0817D216: adds r2, r4 lsls r2, 2 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -775,8 +775,8 @@ _0817D296: adds r2, r4 lsls r2, 2 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -833,8 +833,8 @@ _0817D314: lsls r0, r4, 4 adds r3, r0 adds r3, r7, r3 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -940,8 +940,8 @@ _0817D3F2: bne _0817D3FE bl _0817E0A6 _0817D3FE: - ldr r0, =gBattleAttacker - ldr r1, =gBattleDefender + ldr r0, =gBattleMoveAttacker + ldr r1, =gBattleMoveTarget ldrb r0, [r0] ldrb r1, [r1] cmp r0, r1 @@ -1014,8 +1014,8 @@ _0817D498: lsls r0, r6, 4 adds r2, r0 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -1091,8 +1091,8 @@ _0817D53C: lsls r0, r6, 4 adds r2, r0 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -1161,8 +1161,8 @@ _0817D5CE: lsls r0, r6, 4 adds r2, r0 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -1226,8 +1226,8 @@ _0817D65E: lsls r0, r6, 4 adds r2, r0 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -1301,7 +1301,7 @@ _0817D6F2: strb r0, [r1] bl _0817E0A6 _0817D704: - ldr r5, =gBattlePartyID + ldr r5, =gBattlerPartyIndexes ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 @@ -1314,7 +1314,7 @@ _0817D704: lsls r4, 3 adds r2, r4 adds r2, r7, r2 - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r5 @@ -1353,8 +1353,8 @@ _0817D76C: bne _0817D77E bl _0817E0A6 _0817D77E: - ldr r6, =gBattlePartyID - ldr r5, =gBattleAttacker + ldr r6, =gBattlerPartyIndexes + ldr r5, =gBattleMoveAttacker ldrb r0, [r5] lsls r0, 1 adds r0, r6 @@ -1395,7 +1395,7 @@ _0817D7B2: b _0817D934 .pool _0817D7D8: - ldr r5, =gBattlePartyID + ldr r5, =gBattlerPartyIndexes ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 @@ -1408,7 +1408,7 @@ _0817D7D8: lsls r4, 3 adds r2, r4 adds r2, r7, r2 - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r5 @@ -1439,7 +1439,7 @@ _0817D7D8: b _0817D88C .pool _0817D838: - ldr r5, =gBattlePartyID + ldr r5, =gBattlerPartyIndexes ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 @@ -1452,7 +1452,7 @@ _0817D838: lsls r4, 3 adds r2, r4 adds r2, r7, r2 - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r5 @@ -1496,9 +1496,9 @@ _0817D8A4: bne _0817D8B6 bl _0817E0A6 _0817D8B6: - ldr r2, =gBattlePartyID + ldr r2, =gBattlerPartyIndexes mov r8, r2 - ldr r6, =gBattleAttacker + ldr r6, =gBattleMoveAttacker ldrb r0, [r6] lsls r0, 1 add r0, r8 @@ -1573,8 +1573,8 @@ _0817D94C: lsls r0, r6, 4 adds r2, r0 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -1627,7 +1627,7 @@ _0817D9AE: movs r0, 0x9 b _0817E086 _0817D9C2: - ldr r5, =gBattlePartyID + ldr r5, =gBattlerPartyIndexes ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 @@ -1640,7 +1640,7 @@ _0817D9C2: lsls r4, 3 adds r2, r4 adds r2, r7, r2 - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r5 @@ -1671,8 +1671,8 @@ _0817D9C2: b _0817DB76 .pool _0817DA24: - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -1702,7 +1702,7 @@ _0817DA48: b _0817E0A6 .pool _0817DA68: - ldr r5, =gBattlePartyID + ldr r5, =gBattlerPartyIndexes ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 @@ -1715,7 +1715,7 @@ _0817DA68: lsls r4, 3 adds r2, r4 adds r2, r7, r2 - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r5 @@ -1747,8 +1747,8 @@ _0817DA68: b _0817DB76 .pool _0817DACC: - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -1790,7 +1790,7 @@ _0817DB10: b _0817E0A6 .pool _0817DB24: - ldr r5, =gBattlePartyID + ldr r5, =gBattlerPartyIndexes ldr r6, =gEffectBank ldrb r0, [r6] lsls r0, 1 @@ -1803,7 +1803,7 @@ _0817DB24: lsls r4, 3 adds r3, r4 adds r3, r7, r3 - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r5 @@ -1838,8 +1838,8 @@ _0817DB76: b _0817E0A6 .pool _0817DB90: - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -1875,8 +1875,8 @@ _0817DBD4: lsls r0, r1, 4 adds r3, r0 adds r3, r7, r3 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -1943,8 +1943,8 @@ _0817DC62: adds r2, r6 lsls r2, 2 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -2021,8 +2021,8 @@ _0817DCFC: lsls r0, r4, 4 adds r2, r0 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -2049,8 +2049,8 @@ _0817DD38: lsls r0, r4, 4 adds r2, r0 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -2121,8 +2121,8 @@ _0817DDC8: adds r2, r4 lsls r2, 2 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -2154,8 +2154,8 @@ _0817DE10: adds r2, r4 lsls r2, 2 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -2253,8 +2253,8 @@ _0817DEDC: adds r2, r4 lsls r2, 2 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -2331,8 +2331,8 @@ _0817DF70: adds r2, r4 lsls r2, 2 adds r2, r7, r2 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -2413,8 +2413,8 @@ _0817DFE6: negs r0, r0 ands r0, r2 strb r0, [r1] - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -2557,14 +2557,14 @@ _0817E122: lsls r1, 2 adds r1, r0, r1 str r1, [sp, 0x8] - ldr r2, =gBattleAttacker + ldr r2, =gBattleMoveAttacker mov r10, r2 ldrb r0, [r2] bl GetBattlerSide lsls r0, 24 lsrs r0, 24 mov r9, r0 - ldr r0, =gBattleDefender + ldr r0, =gBattleMoveTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -2572,7 +2572,7 @@ _0817E122: mov r1, r10 ldrb r0, [r1] adds r1, r7, 0 - bl GetBankMoveSlotId + bl GetBattlerMoveSlotId lsls r0, 24 lsrs r6, r0, 24 cmp r6, 0x3 @@ -2604,7 +2604,7 @@ _0817E184: mov r2, r10 ldrb r1, [r2] lsls r1, 1 - ldr r2, =gBattlePartyID + ldr r2, =gBattlerPartyIndexes adds r1, r2 ldrh r2, [r1] adds r2, 0x1 @@ -2685,7 +2685,7 @@ _0817E23C: mov r1, r10 ldrb r0, [r1] lsls r0, 1 - ldr r2, =gBattlePartyID + ldr r2, =gBattlerPartyIndexes adds r0, r2 ldrh r1, [r0] adds r1, 0x1 @@ -2723,7 +2723,7 @@ _0817E27A: mov r1, r10 ldrb r0, [r1] lsls r0, 1 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes adds r0, r1 ldrh r1, [r0] adds r1, 0x1 @@ -2812,7 +2812,7 @@ sub_817E32C: @ 817E32C movs r1, 0x81 lsls r1, 2 adds r4, r0, r1 - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -3244,12 +3244,12 @@ sub_817E684: @ 817E684 movs r2, 0x81 lsls r2, 2 adds r7, r0, r2 - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gBattleDefender + ldr r0, =gBattleMoveTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -3297,8 +3297,8 @@ _0817E6F0: .4byte _0817E760 .4byte _0817E760 _0817E760: - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -3324,13 +3324,13 @@ _0817E760: _0817E79C: ldr r1, =gUnknown_0860A834 add r1, r12 - ldr r7, =gBattlePartyID + ldr r7, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r4 lsls r2, r0, 4 ldr r4, =0x0000ffff ldr r1, [r1] - ldr r3, =gBattleAttacker + ldr r3, =gBattleMoveAttacker ldrh r0, [r1] cmp r6, r0 bne _0817E7E0 @@ -3708,13 +3708,13 @@ sub_817EA80: @ 817EA80 movs r1, 0x81 lsls r1, 2 adds r5, r0, r1 - ldr r3, =gBattleAttacker + ldr r3, =gBattleMoveAttacker mov r8, r3 ldrb r0, [r3] bl GetBattlerSide lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gBattleDefender + ldr r0, =gBattleMoveTarget ldrb r0, [r0] bl GetBattlerSide lsls r0, 24 @@ -4005,8 +4005,8 @@ _0817ECCC: ldrb r0, [r0] lsrs r0, 5 subs r6, r0, 0x1 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -4164,8 +4164,8 @@ _0817EE1C: cmp r7, 0x1 bne _0817EEBC adds r2, r4, 0 - ldr r1, =gBattlePartyID - ldr r0, =gBattleAttacker + ldr r1, =gBattlerPartyIndexes + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -4227,7 +4227,7 @@ _0817EE8E: b _0817EEBC _0817EE96: adds r2, r4, 0 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes mov r3, r8 ldrb r0, [r3] lsls r0, 1 @@ -4269,7 +4269,7 @@ sub_817EECC: @ 817EECC beq _0817EEE6 b _0817F1FA _0817EEE6: - ldr r4, =gBattleAttacker + ldr r4, =gBattleMoveAttacker ldrb r0, [r4] bl GetBattlerSide lsls r0, 24 @@ -4291,7 +4291,7 @@ _0817EEF8: bgt _0817EF10 b _0817F1FA _0817EF10: - ldr r0, =gBattleDefender + ldr r0, =gBattleMoveTarget ldrb r0, [r0] muls r0, r1 adds r0, r5 @@ -4367,7 +4367,7 @@ _0817EF8A: beq _0817EF98 b _0817F1FA _0817EF98: - ldr r2, =gBattleAttacker + ldr r2, =gBattleMoveAttacker ldrb r0, [r2] adds r0, r6 ldrb r0, [r0] @@ -4386,11 +4386,11 @@ _0817EF98: mov r10, r3 mov r8, r0 add r7, sp, 0x10 - ldr r4, =gBattleDefender + ldr r4, =gBattleMoveTarget mov r9, r4 _0817EFC2: lsls r1, r5, 1 - ldr r6, =gBattleAttacker + ldr r6, =gBattleMoveAttacker ldrb r0, [r6] movs r2, 0x58 muls r0, r2 @@ -4420,7 +4420,7 @@ _0817EFC2: lsls r1, 1 adds r1, r4 ldrh r3, [r1] - ldr r2, =gBattleAttacker + ldr r2, =gBattleMoveAttacker ldrb r0, [r2] movs r4, 0x58 muls r0, r4 @@ -4437,7 +4437,7 @@ _0817EFC2: str r4, [sp] movs r4, 0 str r4, [sp, 0x4] - ldr r6, =gBattleAttacker + ldr r6, =gBattleMoveAttacker ldrb r4, [r6] str r4, [sp, 0x8] mov r6, r9 @@ -4448,7 +4448,7 @@ _0817EFC2: ldr r4, =gBattleMoveDamage str r3, [r4] ldr r1, =gStatuses3 - ldr r2, =gBattleAttacker + ldr r2, =gBattleMoveAttacker ldrb r0, [r2] lsls r0, 2 adds r0, r1 @@ -4472,7 +4472,7 @@ _0817EFC2: str r0, [r4] _0817F06A: ldr r0, =gProtectStructs - ldr r6, =gBattleAttacker + ldr r6, =gBattleMoveAttacker ldrb r1, [r6] lsls r1, 4 adds r1, r0 @@ -4513,9 +4513,9 @@ _0817F0B4: cmp r5, 0x3 ble _0817EFC2 movs r5, 0 - ldr r3, =gBattleAttacker + ldr r3, =gBattleMoveAttacker ldr r6, =gMoveSelectionCursor - ldr r4, =gBattlePartyID + ldr r4, =gBattlerPartyIndexes mov r8, r4 movs r7, 0x64 mov r9, r7 @@ -4545,9 +4545,9 @@ _0817F0D8: movs r7, 0 _0817F0F6: movs r5, 0 - ldr r4, =gBattleDefender + ldr r4, =gBattleMoveTarget ldr r6, =gEnemyParty - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] add r0, r10 ldrb r3, [r0] @@ -4582,7 +4582,7 @@ _0817F11A: adds r6, r0, 0 lsls r6, 16 lsrs r6, 16 - ldr r2, =gBattleAttacker + ldr r2, =gBattleMoveAttacker ldrb r0, [r2] lsls r0, 1 add r0, r8 @@ -4598,7 +4598,7 @@ _0817F11A: adds r1, r0, 0 lsls r1, 16 lsrs r1, 16 - ldr r4, =gBattleAttacker + ldr r4, =gBattleMoveAttacker ldrb r3, [r4] mov r2, r10 adds r0, r3, r2 @@ -4625,7 +4625,7 @@ _0817F1D4: _0817F1DC: ldr r2, =gBattleMoveDamage ldr r1, =gMoveSelectionCursor - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] adds r0, r1 ldrb r0, [r0] @@ -4695,7 +4695,7 @@ _0817F270: cmp r2, 0x95 bne _0817F294 ldr r2, =gBattleMons - ldr r0, =gBattleAttacker + ldr r0, =gBattleMoveAttacker ldrb r1, [r0] movs r0, 0x58 muls r0, r1 @@ -4793,8 +4793,8 @@ _0817F324: .pool thumb_func_end sub_817F2A8 - thumb_func_start GetBankMoveSlotId -GetBankMoveSlotId: @ 817F33C + thumb_func_start GetBattlerMoveSlotId +GetBattlerMoveSlotId: @ 817F33C push {r4-r7,lr} lsls r0, 24 lsrs r5, r0, 24 @@ -4809,7 +4809,7 @@ GetBankMoveSlotId: @ 817F33C ldr r6, =gPlayerParty _0817F356: movs r4, 0 - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r5, 1 adds r5, r0, r1 b _0817F36E @@ -4835,7 +4835,7 @@ _0817F388: pop {r4-r7} pop {r1} bx r1 - thumb_func_end GetBankMoveSlotId + thumb_func_end GetBattlerMoveSlotId thumb_func_start sub_817F394 sub_817F394: @ 817F394 diff --git a/asm/battle_tower.s b/asm/battle_tower.s index b5b06c4e1..6156d6890 100644 --- a/asm/battle_tower.s +++ b/asm/battle_tower.s @@ -5354,7 +5354,7 @@ sub_8164E04: @ 8164E04 adds r0, r2 ldrh r1, [r5] bl sub_8165B88 - ldr r6, =gBattlePartyID + ldr r6, =gBattlerPartyIndexes ldrh r0, [r6, 0x2] movs r5, 0x64 muls r0, r5 diff --git a/asm/contest.s b/asm/contest.s index 8760464aa..8f5ff780e 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -1058,12 +1058,12 @@ _080D8004: strb r2, [r1, 0x3] ldr r0, =gBattleTypeFlags str r4, [r0] - ldr r4, =gBattleAttacker + ldr r4, =gBattleMoveAttacker strb r2, [r4] - ldr r0, =gBattleDefender + ldr r0, =gBattleMoveTarget strb r3, [r0] bl sub_80DB0C4 - ldr r2, =gBankSpriteIds + ldr r2, =gBattlerSpriteIds ldrb r1, [r4] adds r1, r2 strb r0, [r1] @@ -2547,8 +2547,8 @@ _080D8DD0: lsls r4, 3 adds r4, r0 strh r5, [r4, 0xC] - ldr r1, =gBankSpriteIds - ldr r0, =gBattleAttacker + ldr r1, =gBattlerSpriteIds + ldr r0, =gBattleMoveAttacker ldrb r0, [r0] adds r0, r1 strb r5, [r0] @@ -13796,9 +13796,9 @@ sub_80DEA20: @ 80DEA20 push {lr} ldr r0, =SpriteCallbackDummy bl CreateInvisibleSpriteWithCallback - ldr r1, =gBankSpriteIds + ldr r1, =gBattlerSpriteIds strb r0, [r1, 0x3] - ldr r0, =gBattleDefender + ldr r0, =gBattleMoveTarget ldrb r0, [r0] adds r0, r1 ldrb r1, [r0] @@ -13817,7 +13817,7 @@ sub_80DEA20: @ 80DEA20 thumb_func_start sub_80DEA5C sub_80DEA5C: @ 80DEA5C push {r4,lr} - ldr r0, =gBankSpriteIds + ldr r0, =gBattlerSpriteIds ldrb r0, [r0, 0x3] lsls r4, r0, 4 adds r4, r0 @@ -13829,13 +13829,13 @@ sub_80DEA5C: @ 80DEA5C strh r0, [r4, 0x26] movs r0, 0x3 movs r1, 0 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x20] movs r0, 0x3 movs r1, 0x1 - bl GetBankCoord + bl GetBattlerSpriteCoord lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x22] @@ -13905,12 +13905,12 @@ _080DEAD0: .4byte _080DEB60 .4byte _080DEB60 _080DEB54: - ldr r1, =gBattleDefender + ldr r1, =gBattleMoveTarget movs r0, 0x2 b _080DEB64 .pool _080DEB60: - ldr r1, =gBattleDefender + ldr r1, =gBattleMoveTarget movs r0, 0x3 _080DEB64: strb r0, [r1] diff --git a/asm/party_menu.s b/asm/party_menu.s index 6112d2413..b9f9cc65e 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -16048,7 +16048,7 @@ _081B8AFC: adds r0, r5, 0 bl sub_81B8F38 lsls r0, 24 - ldr r2, =gBattlePartyID + ldr r2, =gBattlerPartyIndexes lsls r1, r4, 1 adds r1, r2 lsrs r0, 24 @@ -16115,7 +16115,7 @@ _081B8BA8: ldr r1, =gUnknown_0203CEE8 movs r0, 0x1 strb r0, [r1] - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes ldr r0, =gBankInMenu ldrb r0, [r0] lsls r0, 1 @@ -16150,7 +16150,7 @@ _081B8BFC: _081B8C20: ldr r0, =gBankInMenu ldrb r0, [r0] - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, 1 adds r0, r1 ldrb r0, [r0] @@ -16230,7 +16230,7 @@ _081B8CBE: movs r0, 0 bl GetBattlerAtPosition mov r2, sp - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, 24 lsrs r0, 23 adds r0, r1 @@ -16257,7 +16257,7 @@ _081B8CFC: movs r0, 0 bl GetBattlerAtPosition mov r1, sp - ldr r4, =gBattlePartyID + ldr r4, =gBattlerPartyIndexes lsls r0, 24 lsrs r0, 23 adds r0, r4 @@ -16388,7 +16388,7 @@ _081B8DF0: bne _081B8E28 movs r3, 0x1 mov r2, sp - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r1 ldrh r0, [r0] @@ -16412,7 +16412,7 @@ _081B8E1A: _081B8E28: movs r3, 0x2 mov r1, sp - ldr r2, =gBattlePartyID + ldr r2, =gBattlerPartyIndexes lsls r0, r4, 1 adds r0, r2 ldrh r0, [r0] diff --git a/asm/pokemon_item_effect.s b/asm/pokemon_item_effect.s index 6da70ff2f..928eb5550 100644 --- a/asm/pokemon_item_effect.s +++ b/asm/pokemon_item_effect.s @@ -130,7 +130,7 @@ _0806BDC4: ldrb r0, [r0] cmp r1, r0 bge _0806BE70 - ldr r2, =gBattlePartyID + ldr r2, =gBattlerPartyIndexes lsls r0, r1, 1 adds r0, r2 ldrh r3, [r0] @@ -973,7 +973,7 @@ _0806C4FC: ldrb r0, [r2] bics r0, r1 strb r0, [r2] - ldr r1, =gBattlePartyID + ldr r1, =gBattlerPartyIndexes lsls r0, r3, 1 adds r0, r1 ldrb r0, [r0] @@ -1155,9 +1155,9 @@ _0806C6AE: movs r0, 0 movs r1, 0 movs r2, 0 - bl EmitGetMonData + bl BtlController_EmitGetMonData ldrb r0, [r4] - bl MarkBufferBankForExecution + bl MarkBattlerForControllerExec strb r5, [r4] b _0806C6EC .pool diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 8c39348e2..8eb3deaf2 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -735,7 +735,7 @@ BattleScript_AlreadyPoisoned:: goto BattleScript_MoveEnd BattleScript_ImmunityProtected:: - copybyte gEffectBank, gBattleDefender + copybyte gEffectBank, gBattleMoveTarget setbyte cMULTISTRING_CHOOSER, 0x0 call BattleScript_PSNPrevention goto BattleScript_MoveEnd @@ -1055,7 +1055,7 @@ BattleScript_AlreadyParalyzed:: goto BattleScript_MoveEnd BattleScript_LimberProtected:: - copybyte gEffectBank, gBattleDefender + copybyte gEffectBank, gBattleMoveTarget setbyte cMULTISTRING_CHOOSER, 0x0 call BattleScript_PRLZPrevention goto BattleScript_MoveEnd @@ -1513,7 +1513,7 @@ BattleScript_EffectCurse:: jumpifstat ATTACKER, NOT_EQUAL, ATK, 0xC, BattleScript_CurseTrySpeed jumpifstat ATTACKER, EQUAL, DEF, 0xC, BattleScript_ButItFailed BattleScript_CurseTrySpeed:: - copybyte gBattleDefender, gBattleAttacker + copybyte gBattleMoveTarget, gBattleMoveAttacker setbyte sANIM_TURN, 0x1 attackanimation waitanimation @@ -1534,7 +1534,7 @@ BattleScript_CurseTryDefence:: BattleScript_CurseEnd:: goto BattleScript_MoveEnd BattleScript_GhostCurse:: - jumpifbytenotequal gBattleAttacker, gBattleDefender, BattleScript_DoGhostCurse + jumpifbytenotequal gBattleMoveAttacker, gBattleMoveTarget, BattleScript_DoGhostCurse getmovetarget ATTACKER BattleScript_DoGhostCurse:: attackcanceler @@ -2217,7 +2217,7 @@ BattleScript_EffectWillOWisp:: goto BattleScript_MoveEnd BattleScript_WaterVeilPrevents:: - copybyte gEffectBank, gBattleDefender + copybyte gEffectBank, gBattleMoveTarget setbyte cMULTISTRING_CHOOSER, 0x0 call BattleScript_BRNPrevention goto BattleScript_MoveEnd @@ -2598,11 +2598,11 @@ BattleScript_EffectTeeterDance:: attackcanceler attackstring ppreduce - setbyte gBattleDefender, 0x0 + setbyte gBattleMoveTarget, 0x0 BattleScript_TeeterDanceLoop:: movevaluescleanup setmoveeffect EFFECT_CONFUSION - jumpifbyteequal gBattleAttacker, gBattleDefender, BattleScript_TeeterDanceLoopIncrement + jumpifbyteequal gBattleMoveAttacker, gBattleMoveTarget, BattleScript_TeeterDanceLoopIncrement jumpifability TARGET, ABILITY_OWN_TEMPO, BattleScript_TeeterDanceOwnTempoPrevents jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_TeeterDanceSubstitutePrevents jumpifstatus2 TARGET, STATUS2_CONFUSION, BattleScript_TeeterDanceAlreadyConfused @@ -2618,8 +2618,8 @@ BattleScript_TeeterDanceDoMoveEndIncrement:: setbyte sMOVEEND_STATE, 0x0 moveend 0x2, 0x10 BattleScript_TeeterDanceLoopIncrement:: - addbyte gBattleDefender, 0x1 - jumpifbytenotequal gBattleDefender, gBattlersCount, BattleScript_TeeterDanceLoop + addbyte gBattleMoveTarget, 0x1 + jumpifbytenotequal gBattleMoveTarget, gBattlersCount, BattleScript_TeeterDanceLoop end BattleScript_TeeterDanceOwnTempoPrevents:: @@ -3228,7 +3228,7 @@ BattleScript_DamagingWeatherContinues:: playanimation2 ATTACKER, sANIM_ARG1, NULL setbyte gBattleCommunication, 0x0 BattleScript_DamagingWeatherLoop:: - copyarraywithindex gBattleAttacker, gBattleTurnOrder, gBattleCommunication, 0x1 + copyarraywithindex gBattleMoveAttacker, gBattleTurnOrder, gBattleCommunication, 0x1 weatherdamage jumpifword EQUAL, gBattleMoveDamage, 0x0, BattleScript_DamagingWeatherLoopIncrement printfromtable gSandStormHailDmgStringIds @@ -3521,7 +3521,7 @@ BattleScript_RapidSpinAway:: BattleScript_WrapFree:: printstring STRINGID_PKMNGOTFREE waitmessage 0x40 - copybyte gBattleDefender, sBANK + copybyte gBattleMoveTarget, sBANK return BattleScript_LeechSeedFree:: @@ -4053,7 +4053,7 @@ BattleScript_82DB4B8:: BattleScript_82DB4BE:: pause 0x20 BattleScript_82DB4C1:: - setbyte gBattleDefender, 0x0 + setbyte gBattleMoveTarget, 0x0 setstatchanger ATK, 1, TRUE BattleScript_82DB4CD:: trygetintimidatetarget BattleScript_82DB51B @@ -4068,7 +4068,7 @@ BattleScript_82DB4CD:: printstring STRINGID_PKMNCUTSATTACKWITH waitmessage 0x40 BattleScript_82DB510:: - addbyte gBattleDefender, 0x1 + addbyte gBattleMoveTarget, 0x1 goto BattleScript_82DB4CD BattleScript_82DB51B:: return diff --git a/include/battle_anim.h b/include/battle_anim.h index 746e19bfe..8f8e3a377 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -45,8 +45,8 @@ extern u8 gAnimFriendship; extern u16 gWeatherMoveAnim; extern s16 gBattleAnimArgs[ANIM_ARGS_COUNT]; extern u8 gAnimMoveTurn; -extern u8 gAnimBankAttacker; -extern u8 gAnimBankTarget; +extern u8 gBattleAnimAttacker; +extern u8 gBattleAnimTarget; extern u16 gAnimSpeciesByBanks[MAX_BATTLERS_COUNT]; extern u8 gUnknown_02038440; @@ -56,7 +56,7 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo void DestroyAnimSprite(struct Sprite *sprite); void DestroyAnimVisualTask(u8 taskId); void DestroyAnimSoundTask(u8 taskId); -bool8 IsAnimBankSpriteVisible(u8 bank); +bool8 IsBattlerSpriteVisible(u8 bank); void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible); bool8 IsContest(void); s8 BattleAnimAdjustPanning(s8 pan); @@ -85,17 +85,17 @@ enum BANK_Y_POS, }; -u8 GetBankCoord(u8 bank, u8 attributeId); +u8 GetBattlerSpriteCoord(u8 bank, u8 attributeId); -bool8 IsBankSpritePresent(u8 bank); +bool8 IsBattlerSpritePresent(u8 bank); void sub_80A6C68(u8 arg0); -u8 GetAnimBankSpriteId(u8 wantedBank); +u8 GetBattlerSpriteId(u8 wantedBank); bool8 IsDoubleBattle(void); u8 sub_80A6D94(void); u8 sub_80A8364(u8); void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*)); void oamt_add_pos2_onto_pos1(struct Sprite *sprite); -u8 GetBankSpriteDefault_Y(u8 bank); +u8 GetBattlerSpriteDefault_Y(u8 bank); u8 sub_80A82E4(u8 bank); u8 GetSubstituteSpriteDefault_Y(u8 bank); diff --git a/include/battle_controllers.h b/include/battle_controllers.h index c69cb1017..a0fc41b52 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -181,62 +181,62 @@ void sub_8033648(void); void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data); // emitters -void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck); -void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused -void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data); -void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused -void EmitLoadMonSprite(u8 bufferId); -void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit); -void EmitReturnMonToBall(u8 bufferId, u8 arg1); -void EmitDrawTrainerPic(u8 bufferId); -void EmitTrainerSlide(u8 bufferId); -void EmitTrainerSlideBack(u8 bufferId); -void EmitFaintAnimation(u8 bufferId); -void EmitPaletteFade(u8 bufferId); // unused -void EmitSuccessBallThrowAnim(u8 bufferId); // unused -void EmitBallThrowAnim(u8 bufferId, u8 caseId); -void EmitPause(u8 bufferId, u8 toWait, void *data); // unused -void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit); -void EmitPrintString(u8 bufferId, u16 stringId); -void EmitPrintSelectionString(u8 bufferId, u16 stringId); -void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2); -void EmitUnknownYesNoBox(u8 bufferId); -void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); -void EmitChooseItem(u8 bufferId, u8* arg1); -void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4); -void EmitCmd23(u8 bufferId); // unused -void EmitHealthBarUpdate(u8 bufferId, u16 hpValue); -void EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints); -void EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2); -void EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status); -void EmitStatusXor(u8 bufferId, u8 b); // unused -void EmitDataTransfer(u8 bufferId, u16 size, void *data); -void EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused -void EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter); // unused -void EmitCmd32(u8 bufferId, u16 size, void *c); // unused -void EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2); -void EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c); -void EmitOneReturnValue(u8 bufferId, u16 arg1); -void EmitOneReturnValue_Duplicate(u8 bufferId, u16 b); -void EmitCmd37(u8 bufferId); // unused -void EmitCmd38(u8 bufferId, u8 b); // unused -void EmitCmd39(u8 bufferId); // unused -void EmitCmd40(u8 bufferId); // unused -void EmitHitAnimation(u8 bufferId); -void EmitCmd42(u8 bufferId); -void EmitPlaySE(u8 bufferId, u16 songId); -void EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM); -void EmitFaintingCry(u8 bufferId); -void EmitIntroSlide(u8 bufferId, u8 terrainId); -void EmitIntroTrainerBallThrow(u8 bufferId); -void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2); -void EmitCmd49(u8 bufferId); -void EmitCmd50(u8 bufferId); -void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible); -void EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument); -void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2); -void EmitResetActionMoveSelection(u8 bufferId, u8 caseId); -void EmitCmd55(u8 bufferId, u8 arg1); +void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck); +void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused +void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data); +void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused +void BtlController_EmitLoadMonSprite(u8 bufferId); +void BtlController_EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit); +void BtlController_EmitReturnMonToBall(u8 bufferId, u8 arg1); +void BtlController_EmitDrawTrainerPic(u8 bufferId); +void BtlController_EmitTrainerSlide(u8 bufferId); +void BtlController_EmitTrainerSlideBack(u8 bufferId); +void BtlController_EmitFaintAnimation(u8 bufferId); +void BtlController_EmitPaletteFade(u8 bufferId); // unused +void BtlController_EmitSuccessBallThrowAnim(u8 bufferId); // unused +void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId); +void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data); // unused +void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit); +void BtlController_EmitPrintString(u8 bufferId, u16 stringId); +void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringId); +void BtlController_EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2); +void BtlController_EmitUnknownYesNoBox(u8 bufferId); +void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); +void BtlController_EmitChooseItem(u8 bufferId, u8* arg1); +void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4); +void BtlController_EmitCmd23(u8 bufferId); // unused +void BtlController_EmitHealthBarUpdate(u8 bufferId, u16 hpValue); +void BtlController_EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints); +void BtlController_EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2); +void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status); +void BtlController_EmitStatusXor(u8 bufferId, u8 b); // unused +void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data); +void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused +void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter); // unused +void BtlController_EmitCmd32(u8 bufferId, u16 size, void *c); // unused +void BtlController_EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2); +void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c); +void BtlController_EmitOneReturnValue(u8 bufferId, u16 arg1); +void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 b); +void BtlController_EmitCmd37(u8 bufferId); // unused +void BtlController_EmitCmd38(u8 bufferId, u8 b); // unused +void BtlController_EmitCmd39(u8 bufferId); // unused +void BtlController_EmitCmd40(u8 bufferId); // unused +void BtlController_EmitHitAnimation(u8 bufferId); +void BtlController_EmitCmd42(u8 bufferId); +void BtlController_EmitPlaySE(u8 bufferId, u16 songId); +void BtlController_EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM); +void BtlController_EmitFaintingCry(u8 bufferId); +void BtlController_EmitIntroSlide(u8 bufferId, u8 terrainId); +void BtlController_EmitIntroTrainerBallThrow(u8 bufferId); +void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2); +void BtlController_EmitCmd49(u8 bufferId); +void BtlController_EmitCmd50(u8 bufferId); +void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible); +void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument); +void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2); +void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId); +void BtlController_EmitCmd55(u8 bufferId, u8 arg1); // player controller void SetControllerToPlayer(void); diff --git a/include/battle_gfx_sfx_util.h b/include/battle_gfx_sfx_util.h index 313a29811..75bc3e003 100644 --- a/include/battle_gfx_sfx_util.h +++ b/include/battle_gfx_sfx_util.h @@ -39,8 +39,8 @@ void sub_805EAE8(void); void sub_805EB9C(u8 affineMode); void LoadAndCreateEnemyShadowSprites(void); void SpriteCB_SetInvisible(struct Sprite *sprite); -void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species); -void EnemyShadowCallbackToSetInvisible(u8 bank); +void SetBattlerShadowSpriteCallback(u8 bank, u16 species); +void HideBattlerShadowSprite(u8 bank); void sub_805EF14(void); void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute); void AllocateMonSpritesGfx(void); diff --git a/include/battle_interface.h b/include/battle_interface.h index b2d3b1b97..5ccec56ca 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -54,7 +54,7 @@ enum HEALTHBOX_SAFARI_BALLS_TEXT }; -u8 CreateBankHealthboxSprites(u8 bank); +u8 CreateHealthboxSprites(u8 bank); u8 CreateSafariPlayerHealthboxSprites(void); void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue); void SetHealthboxSpriteInvisible(u8 healthboxSpriteId); @@ -62,7 +62,7 @@ void SetHealthboxSpriteVisible(u8 healthboxSpriteId); void DestoryHealthboxSprite(u8 healthboxSpriteId); void DummyBattleInterfaceFunc(u8 healthboxSpriteId, bool8 isDoubleBattleBankOnly); void UpdateOamPriorityInAllHealthboxes(u8 priority); -void SetBankHealthboxSpritePos(u8 bank); +void InitBattlerHealthboxCoords(u8 bank); void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent); void SwapHpBarsWithHpText(void); u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart); diff --git a/include/battle_link_817C95C.h b/include/battle_link_817C95C.h index 815c1f058..cb2cb0b27 100644 --- a/include/battle_link_817C95C.h +++ b/include/battle_link_817C95C.h @@ -6,6 +6,6 @@ void sub_817E0FC(u16 move, u16 weatherFlags, struct DisableStruct *disableStruct void sub_817E32C(u8 animationId); void sub_817E3F4(void); void sub_817F2A8(void); -u8 GetBankMoveSlotId(u8 bank, u16 move); +u8 GetBattlerMoveSlotId(u8 bank, u16 move); #endif // GUARD_BATTLE_LINK_817C95C_H diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index 80fabaa64..26659ff20 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -52,7 +52,7 @@ void AI_CalcDmg(u8 bankAtk, u8 bankDef); u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef); u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility); -u8 BankGetTurnOrder(u8 bank); +u8 GetBattlerTurnOrderNum(u8 bank); void SetMoveEffect(bool8 primary, u8 certain); void BattleDestroyYesNoCursorAt(u8 cursorPosition); void BattleCreateYesNoCursorAt(u8 cursorPosition); diff --git a/include/battle_util.h b/include/battle_util.h index 81eb85dc7..56628c11d 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -48,8 +48,8 @@ u8 GetBattleBank(u8 caseId); void PressurePPLose(u8 bankDef, u8 bankAtk, u16 move); void PressurePPLoseOnUsingPerishSong(u8 bankAtk); void PressurePPLoseOnUsingImprision(u8 bankAtk); -void MarkAllBufferBanksForExecution(void); // unused -void MarkBufferBankForExecution(u8 bank); +void MarkAllBattlersForControllerExec(void); // unused +void MarkBattlerForControllerExec(u8 bank); void sub_803F850(u8 arg0); void CancelMultiTurnMoves(u8 bank); bool8 WasUnableToUseMove(u8 bank); diff --git a/include/pokemon.h b/include/pokemon.h index cdab96687..fbdd93924 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -631,7 +631,7 @@ bool8 IsShinyOtIdPersonality(u32 otId, u32 personality); void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies); bool8 IsTradedMon(struct Pokemon *mon); void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality); -s32 GetBankMultiplayerId(u16 a1); +s32 GetBattlerMultiplayerId(u16 a1); bool16 sub_806D82C(u8 id); u16 MonTryLearningNewMove(struct Pokemon* mon, bool8); void sub_8068AA4(void); // sets stats for deoxys diff --git a/include/recorded_battle.h b/include/recorded_battle.h index adc4c6c85..5c7bdc983 100644 --- a/include/recorded_battle.h +++ b/include/recorded_battle.h @@ -7,9 +7,9 @@ extern u8 gUnknown_0203C7B4; void sub_8184DA4(u8 arg0); void sub_8184E58(void); -void RecordedBattle_SetBankAction(u8 bank, u8 action); -void RecordedBattle_ClearBankAction(u8 bank, u8 bytesToClear); -u8 RecordedBattle_ReadBankAction(u8 bank); +void RecordedBattle_SetBattlerAction(u8 bank, u8 action); +void RecordedBattle_ClearBattlerAction(u8 bank, u8 bytesToClear); +u8 RecordedBattle_GetBankAction(u8 bank); u8 sub_81850D0(void); u8 sub_81850DC(u8 *arg0); void sub_81851A8(u8 *arg0); diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 2ddc3fdfe..3e8d8d40e 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -48,14 +48,14 @@ extern u32 gBattleTypeFlags; extern u8 gActiveBattler; extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; extern u16 gCurrentMove; -extern u8 gBattleDefender; +extern u8 gBattleMoveTarget; extern u8 gAbsentBattlerFlags; extern u16 gLastMoves[MAX_BATTLERS_COUNT]; extern u16 gTrainerBattleOpponent_A; extern u16 gTrainerBattleOpponent_B; extern u32 gStatuses3[MAX_BATTLERS_COUNT]; extern u16 gSideStatuses[2]; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u16 gDynamicBasePower; extern u8 gMoveResultFlags; extern s32 gBattleMoveDamage; @@ -367,14 +367,14 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves) // decide a random target bank in doubles if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - gBattleDefender = (Random() & BIT_FLANK) + (GetBattlerSide(gActiveBattler) ^ BIT_SIDE); - if (gAbsentBattlerFlags & gBitTable[gBattleDefender]) - gBattleDefender ^= BIT_FLANK; + gBattleMoveTarget = (Random() & BIT_FLANK) + (GetBattlerSide(gActiveBattler) ^ BIT_SIDE); + if (gAbsentBattlerFlags & gBitTable[gBattleMoveTarget]) + gBattleMoveTarget ^= BIT_FLANK; } // in singles there's only one choice else { - gBattleDefender = sBank_AI ^ BIT_SIDE; + gBattleMoveTarget = sBank_AI ^ BIT_SIDE; } if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) @@ -491,7 +491,7 @@ static u8 BattleAI_ChooseMoveOrAction_Doubles(void) else BattleAI_SetupAIData(0xF); - gBattleDefender = i; + gBattleMoveTarget = i; if ((i & BIT_SIDE) != (sBank_AI & BIT_SIDE)) RecordLastUsedMoveByTarget(); @@ -573,8 +573,8 @@ static u8 BattleAI_ChooseMoveOrAction_Doubles(void) } } - gBattleDefender = mostViableTargetsArray[Random() % mostViableTargetsNo]; - return actionOrMoveIndex[gBattleDefender]; + gBattleMoveTarget = mostViableTargetsArray[Random() % mostViableTargetsNo]; + return actionOrMoveIndex[gBattleMoveTarget]; } static void BattleAI_DoAIProcessing(void) @@ -627,12 +627,12 @@ static void RecordLastUsedMoveByTarget(void) for (i = 0; i < 4; i++) { - if (gBattleResources->battleHistory->usedMoves[gBattleDefender].moves[i] == gLastMoves[gBattleDefender]) + if (gBattleResources->battleHistory->usedMoves[gBattleMoveTarget].moves[i] == gLastMoves[gBattleMoveTarget]) break; - if (gBattleResources->battleHistory->usedMoves[gBattleDefender].moves[i] != gLastMoves[gBattleDefender] // HACK: This redundant condition is a hack to make the asm match. - && gBattleResources->battleHistory->usedMoves[gBattleDefender].moves[i] == 0) + if (gBattleResources->battleHistory->usedMoves[gBattleMoveTarget].moves[i] != gLastMoves[gBattleMoveTarget] // HACK: This redundant condition is a hack to make the asm match. + && gBattleResources->battleHistory->usedMoves[gBattleMoveTarget].moves[i] == 0) { - gBattleResources->battleHistory->usedMoves[gBattleDefender].moves[i] = gLastMoves[gBattleDefender]; + gBattleResources->battleHistory->usedMoves[gBattleMoveTarget].moves[i] = gLastMoves[gBattleMoveTarget]; break; } } @@ -723,7 +723,7 @@ static void BattleAICmd_if_hp_less_than(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) < gAIScriptPtr[2]) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3); @@ -738,7 +738,7 @@ static void BattleAICmd_if_hp_more_than(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) > gAIScriptPtr[2]) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3); @@ -753,7 +753,7 @@ static void BattleAICmd_if_hp_equal(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) == gAIScriptPtr[2]) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3); @@ -768,7 +768,7 @@ static void BattleAICmd_if_hp_not_equal(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) != gAIScriptPtr[2]) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3); @@ -784,7 +784,7 @@ static void BattleAICmd_if_status(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; status = AIScriptRead32(gAIScriptPtr + 2); @@ -802,7 +802,7 @@ static void BattleAICmd_if_not_status(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; status = AIScriptRead32(gAIScriptPtr + 2); @@ -820,7 +820,7 @@ static void BattleAICmd_if_status2(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; status = AIScriptRead32(gAIScriptPtr + 2); @@ -838,7 +838,7 @@ static void BattleAICmd_if_not_status2(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; status = AIScriptRead32(gAIScriptPtr + 2); @@ -856,7 +856,7 @@ static void BattleAICmd_if_status3(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; status = AIScriptRead32(gAIScriptPtr + 2); @@ -874,7 +874,7 @@ static void BattleAICmd_if_not_status3(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; status = AIScriptRead32(gAIScriptPtr + 2); @@ -892,7 +892,7 @@ static void BattleAICmd_if_side_affecting(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; side = GET_BATTLER_SIDE(bank); status = AIScriptRead32(gAIScriptPtr + 2); @@ -911,7 +911,7 @@ static void BattleAICmd_if_not_side_affecting(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; side = GET_BATTLER_SIDE(bank); status = AIScriptRead32(gAIScriptPtr + 2); @@ -1126,13 +1126,13 @@ static void BattleAICmd_get_type(void) AI_THINKING_STRUCT->funcResult = gBattleMons[sBank_AI].type1; break; case AI_TYPE1_TARGET: // target primary type - AI_THINKING_STRUCT->funcResult = gBattleMons[gBattleDefender].type1; + AI_THINKING_STRUCT->funcResult = gBattleMons[gBattleMoveTarget].type1; break; case AI_TYPE2_USER: // AI user secondary type AI_THINKING_STRUCT->funcResult = gBattleMons[sBank_AI].type2; break; case AI_TYPE2_TARGET: // target secondary type - AI_THINKING_STRUCT->funcResult = gBattleMons[gBattleDefender].type2; + AI_THINKING_STRUCT->funcResult = gBattleMons[gBattleMoveTarget].type2; break; case AI_TYPE_MOVE: // type of move being pointed to AI_THINKING_STRUCT->funcResult = gBattleMoves[AI_THINKING_STRUCT->moveConsidered].type; @@ -1149,11 +1149,11 @@ static u8 BattleAI_GetWantedBank(u8 bank) return sBank_AI; case AI_TARGET: default: - return gBattleDefender; + return gBattleMoveTarget; case AI_USER_PARTNER: return sBank_AI ^ BIT_FLANK; case AI_TARGET_PARTNER: - return gBattleDefender ^ BIT_FLANK; + return gBattleMoveTarget ^ BIT_FLANK; } } @@ -1212,8 +1212,8 @@ static void BattleAICmd_get_how_powerful_move_is(void) && gBattleMoves[gBattleMons[sBank_AI].moves[checkedMove]].power > 1) { gCurrentMove = gBattleMons[sBank_AI].moves[checkedMove]; - AI_CalcDmg(sBank_AI, gBattleDefender); - TypeCalc(gCurrentMove, sBank_AI, gBattleDefender); + AI_CalcDmg(sBank_AI, gBattleMoveTarget); + TypeCalc(gCurrentMove, sBank_AI, gBattleMoveTarget); moveDmgs[checkedMove] = gBattleMoveDamage * AI_THINKING_STRUCT->simulatedRNG[checkedMove] / 100; if (moveDmgs[checkedMove] == 0) moveDmgs[checkedMove] = 1; @@ -1248,7 +1248,7 @@ static void BattleAICmd_get_last_used_bank_move(void) if (gAIScriptPtr[1] == AI_USER) AI_THINKING_STRUCT->funcResult = gLastMoves[sBank_AI]; else - AI_THINKING_STRUCT->funcResult = gLastMoves[gBattleDefender]; + AI_THINKING_STRUCT->funcResult = gLastMoves[gBattleMoveTarget]; gAIScriptPtr += 2; } @@ -1271,7 +1271,7 @@ static void BattleAICmd_if_not_equal_(void) // same as if_not_equal static void BattleAICmd_if_user_goes(void) { - if (GetWhoStrikesFirst(sBank_AI, gBattleDefender, TRUE) == gAIScriptPtr[1]) + if (GetWhoStrikesFirst(sBank_AI, gBattleMoveTarget, TRUE) == gAIScriptPtr[1]) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2); else gAIScriptPtr += 6; @@ -1279,7 +1279,7 @@ static void BattleAICmd_if_user_goes(void) static void BattleAICmd_if_user_doesnt_go(void) { - if (GetWhoStrikesFirst(sBank_AI, gBattleDefender, TRUE) != gAIScriptPtr[1]) + if (GetWhoStrikesFirst(sBank_AI, gBattleMoveTarget, TRUE) != gAIScriptPtr[1]) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2); else gAIScriptPtr += 6; @@ -1305,7 +1305,7 @@ static void BattleAICmd_count_usable_party_mons(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if (GetBattlerSide(bank) == B_SIDE_PLAYER) party = gPlayerParty; @@ -1315,14 +1315,14 @@ static void BattleAICmd_count_usable_party_mons(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { u32 position; - bankOnField1 = gBattlePartyID[bank]; + bankOnField1 = gBattlerPartyIndexes[bank]; position = GetBattlerPosition(bank) ^ BIT_FLANK; - bankOnField2 = gBattlePartyID[GetBattlerAtPosition(position)]; + bankOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(position)]; } else // in singles there's only one bank by side { - bankOnField1 = gBattlePartyID[bank]; - bankOnField2 = gBattlePartyID[bank]; + bankOnField1 = gBattlerPartyIndexes[bank]; + bankOnField2 = gBattlerPartyIndexes[bank]; } for (i = 0; i < PARTY_SIZE; i++) @@ -1358,7 +1358,7 @@ static void BattleAICmd_get_ability(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if (gActiveBattler != bank) { @@ -1493,7 +1493,7 @@ static void BattleAICmd_get_highest_type_effectiveness(void) if (gCurrentMove) { - TypeCalc(gCurrentMove, sBank_AI, gBattleDefender); + TypeCalc(gCurrentMove, sBank_AI, gBattleMoveTarget); // reduce by 1/3. if (gBattleMoveDamage == 120) @@ -1528,7 +1528,7 @@ static void BattleAICmd_if_type_effectiveness(void) gBattleMoveDamage = AI_EFFECTIVENESS_x1; gCurrentMove = AI_THINKING_STRUCT->moveConsidered; - TypeCalc(gCurrentMove, sBank_AI, gBattleDefender); + TypeCalc(gCurrentMove, sBank_AI, gBattleMoveTarget); if (gBattleMoveDamage == 120) gBattleMoveDamage = AI_EFFECTIVENESS_x2; @@ -1572,7 +1572,7 @@ static void BattleAICmd_if_status_in_party(void) bank = sBank_AI; break; default: - bank = gBattleDefender; + bank = gBattleMoveTarget; break; } @@ -1609,7 +1609,7 @@ static void BattleAICmd_if_status_not_in_party(void) bank = sBank_AI; break; default: - bank = gBattleDefender; + bank = gBattleMoveTarget; break; } @@ -1669,7 +1669,7 @@ static void BattleAICmd_if_stat_level_less_than(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if (gBattleMons[bank].statStages[gAIScriptPtr[2]] < gAIScriptPtr[3]) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4); @@ -1684,7 +1684,7 @@ static void BattleAICmd_if_stat_level_more_than(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if (gBattleMons[bank].statStages[gAIScriptPtr[2]] > gAIScriptPtr[3]) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4); @@ -1699,7 +1699,7 @@ static void BattleAICmd_if_stat_level_equal(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if (gBattleMons[bank].statStages[gAIScriptPtr[2]] == gAIScriptPtr[3]) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4); @@ -1714,7 +1714,7 @@ static void BattleAICmd_if_stat_level_not_equal(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if (gBattleMons[bank].statStages[gAIScriptPtr[2]] != gAIScriptPtr[3]) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4); @@ -1736,8 +1736,8 @@ static void BattleAICmd_if_can_faint(void) gMoveResultFlags = 0; gCritMultiplier = 1; gCurrentMove = AI_THINKING_STRUCT->moveConsidered; - AI_CalcDmg(sBank_AI, gBattleDefender); - TypeCalc(gCurrentMove, sBank_AI, gBattleDefender); + AI_CalcDmg(sBank_AI, gBattleMoveTarget); + TypeCalc(gCurrentMove, sBank_AI, gBattleMoveTarget); gBattleMoveDamage = gBattleMoveDamage * AI_THINKING_STRUCT->simulatedRNG[AI_THINKING_STRUCT->movesetIndex] / 100; @@ -1745,7 +1745,7 @@ static void BattleAICmd_if_can_faint(void) if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - if (gBattleMons[gBattleDefender].hp <= gBattleMoveDamage) + if (gBattleMons[gBattleMoveTarget].hp <= gBattleMoveDamage) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1); else gAIScriptPtr += 5; @@ -1765,14 +1765,14 @@ static void BattleAICmd_if_cant_faint(void) gMoveResultFlags = 0; gCritMultiplier = 1; gCurrentMove = AI_THINKING_STRUCT->moveConsidered; - AI_CalcDmg(sBank_AI, gBattleDefender); - TypeCalc(gCurrentMove, sBank_AI, gBattleDefender); + AI_CalcDmg(sBank_AI, gBattleMoveTarget); + TypeCalc(gCurrentMove, sBank_AI, gBattleMoveTarget); gBattleMoveDamage = gBattleMoveDamage * AI_THINKING_STRUCT->simulatedRNG[AI_THINKING_STRUCT->movesetIndex] / 100; // this macro is missing the damage 0 = 1 assumption. - if (gBattleMons[gBattleDefender].hp > gBattleMoveDamage) + if (gBattleMons[gBattleMoveTarget].hp > gBattleMoveDamage) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1); else gAIScriptPtr += 5; @@ -1829,7 +1829,7 @@ static void BattleAICmd_if_has_move(void) case AI_TARGET_PARTNER: for (i = 0; i < 4; i++) { - if (BATTLE_HISTORY->usedMoves[gBattleDefender].moves[i] == *movePtr) + if (BATTLE_HISTORY->usedMoves[gBattleMoveTarget].moves[i] == *movePtr) break; } if (i == 4) @@ -1873,7 +1873,7 @@ static void BattleAICmd_if_doesnt_have_move(void) case AI_TARGET_PARTNER: for (i = 0; i < 4; i++) { - if (BATTLE_HISTORY->usedMoves[gBattleDefender].moves[i] == *movePtr) + if (BATTLE_HISTORY->usedMoves[gBattleMoveTarget].moves[i] == *movePtr) break; } if (i != 4) @@ -1911,8 +1911,8 @@ static void BattleAICmd_if_has_move_with_effect(void) case AI_TARGET_PARTNER: for (i = 0; i < 4; i++) { - // UB: checks sBank_AI instead of gBattleDefender - if (gBattleMons[sBank_AI].moves[i] != 0 && gBattleMoves[BATTLE_HISTORY->usedMoves[gBattleDefender].moves[i]].effect == gAIScriptPtr[2]) + // UB: checks sBank_AI instead of gBattleMoveTarget + if (gBattleMons[sBank_AI].moves[i] != 0 && gBattleMoves[BATTLE_HISTORY->usedMoves[gBattleMoveTarget].moves[i]].effect == gAIScriptPtr[2]) break; } if (i == 4) @@ -1945,7 +1945,7 @@ static void BattleAICmd_if_doesnt_have_move_with_effect(void) case AI_TARGET_PARTNER: for (i = 0; i < 4; i++) { - if (BATTLE_HISTORY->usedMoves[gBattleDefender].moves[i] && gBattleMoves[BATTLE_HISTORY->usedMoves[gBattleDefender].moves[i]].effect == gAIScriptPtr[2]) + if (BATTLE_HISTORY->usedMoves[gBattleMoveTarget].moves[i] && gBattleMoves[BATTLE_HISTORY->usedMoves[gBattleMoveTarget].moves[i]].effect == gAIScriptPtr[2]) break; } if (i != 4) @@ -1963,7 +1963,7 @@ static void BattleAICmd_if_any_move_disabled_or_encored(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if (gAIScriptPtr[2] == 0) { @@ -2041,7 +2041,7 @@ static void BattleAICmd_get_hold_effect(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; if (gActiveBattler != bank) AI_THINKING_STRUCT->funcResult = ItemId_GetHoldEffect(BATTLE_HISTORY->itemEffects[bank]); @@ -2079,7 +2079,7 @@ static void BattleAICmd_get_gender(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; AI_THINKING_STRUCT->funcResult = GetGenderFromSpeciesAndPersonality(gBattleMons[bank].species, gBattleMons[bank].personality); @@ -2093,7 +2093,7 @@ static void BattleAICmd_is_first_turn_for(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].isFirstTurn; @@ -2107,7 +2107,7 @@ static void BattleAICmd_get_stockpile_count(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].stockpileCounter; @@ -2128,7 +2128,7 @@ static void BattleAICmd_get_used_held_item(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; // This is likely a leftover from Ruby's code and its ugly ewram access #ifdef NONMATCHING @@ -2168,7 +2168,7 @@ static void BattleAICmd_get_protect_count(void) if (gAIScriptPtr[1] == AI_USER) bank = sBank_AI; else - bank = gBattleDefender; + bank = gBattleMoveTarget; AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].protectUses; @@ -2221,7 +2221,7 @@ static void BattleAICmd_if_level_cond(void) switch (gAIScriptPtr[1]) { case 0: // greater than - if (gBattleMons[sBank_AI].level > gBattleMons[gBattleDefender].level) + if (gBattleMons[sBank_AI].level > gBattleMons[gBattleMoveTarget].level) { gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2); return; @@ -2229,7 +2229,7 @@ static void BattleAICmd_if_level_cond(void) gAIScriptPtr += 6; return; case 1: // less than - if (gBattleMons[sBank_AI].level < gBattleMons[gBattleDefender].level) + if (gBattleMons[sBank_AI].level < gBattleMons[gBattleMoveTarget].level) { gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2); return; @@ -2237,7 +2237,7 @@ static void BattleAICmd_if_level_cond(void) gAIScriptPtr += 6; return; case 2: // equal - if (gBattleMons[sBank_AI].level == gBattleMons[gBattleDefender].level) + if (gBattleMons[sBank_AI].level == gBattleMons[gBattleMoveTarget].level) { gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2); return; @@ -2249,7 +2249,7 @@ static void BattleAICmd_if_level_cond(void) static void BattleAICmd_if_target_taunted(void) { - if (gDisableStructs[gBattleDefender].tauntTimer1 != 0) + if (gDisableStructs[gBattleMoveTarget].tauntTimer1 != 0) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1); else gAIScriptPtr += 5; @@ -2257,7 +2257,7 @@ static void BattleAICmd_if_target_taunted(void) static void BattleAICmd_if_target_not_taunted(void) { - if (gDisableStructs[gBattleDefender].tauntTimer1 == 0) + if (gDisableStructs[gBattleMoveTarget].tauntTimer1 == 0) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1); else gAIScriptPtr += 5; @@ -2265,7 +2265,7 @@ static void BattleAICmd_if_target_not_taunted(void) static void BattleAICmd_if_target_is_ally(void) { - if ((sBank_AI & BIT_SIDE) == (gBattleDefender & BIT_SIDE)) + if ((sBank_AI & BIT_SIDE) == (gBattleMoveTarget & BIT_SIDE)) gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1); else gAIScriptPtr += 5; diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 7d187559b..1671fad7e 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -15,7 +15,7 @@ extern u8 gAbsentBattlerFlags; extern u32 gBattleTypeFlags; extern u32 gStatuses3[MAX_BATTLERS_COUNT]; extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u16 gLastLandedMoves[MAX_BATTLERS_COUNT]; extern u8 gLastHitBy[MAX_BATTLERS_COUNT]; extern u16 gDynamicBasePower; @@ -39,7 +39,7 @@ static bool8 ShouldSwitchIfPerishSong(void) && gDisableStructs[gActiveBattler].perishSongTimer1 == 0) { *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6; - EmitTwoReturnValues(1, ACTION_SWITCH, 0); + BtlController_EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -104,7 +104,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) continue; if (GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_EGG) continue; - if (i == gBattlePartyID[gActiveBattler]) + if (i == gBattlerPartyIndexes[gActiveBattler]) continue; GetMonData(&party[i], MON_DATA_SPECIES); // unused return value @@ -121,7 +121,7 @@ static bool8 ShouldSwitchIfWonderGuard(void) { // we found a mon *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i; - EmitTwoReturnValues(1, ACTION_SWITCH, 0); + BtlController_EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -202,9 +202,9 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void) continue; if (GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_EGG) continue; - if (i == gBattlePartyID[bankIn1]) + if (i == gBattlerPartyIndexes[bankIn1]) continue; - if (i == gBattlePartyID[bankIn2]) + if (i == gBattlerPartyIndexes[bankIn2]) continue; if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1)) continue; @@ -221,7 +221,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void) { // we found a mon *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i; - EmitTwoReturnValues(1, ACTION_SWITCH, 0); + BtlController_EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -241,13 +241,13 @@ static bool8 ShouldSwitchIfNaturalCure(void) if ((gLastLandedMoves[gActiveBattler] == 0 || gLastLandedMoves[gActiveBattler] == 0xFFFF) && Random() & 1) { *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6; - EmitTwoReturnValues(1, ACTION_SWITCH, 0); + BtlController_EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0 && Random() & 1) { *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6; - EmitTwoReturnValues(1, ACTION_SWITCH, 0); + BtlController_EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -258,7 +258,7 @@ static bool8 ShouldSwitchIfNaturalCure(void) if (Random() & 1) { *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6; - EmitTwoReturnValues(1, ACTION_SWITCH, 0); + BtlController_EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } @@ -396,9 +396,9 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent) continue; if (GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_EGG) continue; - if (i == gBattlePartyID[bankIn1]) + if (i == gBattlerPartyIndexes[bankIn1]) continue; - if (i == gBattlePartyID[bankIn2]) + if (i == gBattlerPartyIndexes[bankIn2]) continue; if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1)) continue; @@ -426,7 +426,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent) if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE && Random() % moduloPercent == 0) { *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i; - EmitTwoReturnValues(1, ACTION_SWITCH, 0); + BtlController_EmitTwoReturnValues(1, ACTION_SWITCH, 0); return TRUE; } } @@ -504,9 +504,9 @@ static bool8 ShouldSwitch(void) continue; if (GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_EGG) continue; - if (i == gBattlePartyID[bankIn1]) + if (i == gBattlerPartyIndexes[bankIn1]) continue; - if (i == gBattlePartyID[bankIn2]) + if (i == gBattlerPartyIndexes[bankIn2]) continue; if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1)) continue; @@ -586,9 +586,9 @@ void AI_TrySwitchOrUseItem(void) { if (GetMonData(&party[monToSwitchId], MON_DATA_HP) == 0) continue; - if (monToSwitchId == gBattlePartyID[bankIn1]) + if (monToSwitchId == gBattlerPartyIndexes[bankIn1]) continue; - if (monToSwitchId == gBattlePartyID[bankIn2]) + if (monToSwitchId == gBattlerPartyIndexes[bankIn2]) continue; if (monToSwitchId == *(gBattleStruct->monToSwitchIntoId + bankIn1)) continue; @@ -611,7 +611,7 @@ void AI_TrySwitchOrUseItem(void) } } - EmitTwoReturnValues(1, ACTION_USE_MOVE, (gActiveBattler ^ BIT_SIDE) << 8); + BtlController_EmitTwoReturnValues(1, ACTION_USE_MOVE, (gActiveBattler ^ BIT_SIDE) << 8); } static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8 *var) @@ -654,7 +654,7 @@ u8 GetMostSuitableMonToSwitchInto(void) if (*(gBattleStruct->monToSwitchIntoId + gActiveBattler) != 6) return *(gBattleStruct->monToSwitchIntoId + gActiveBattler); if (gBattleTypeFlags & BATTLE_TYPE_ARENA) - return gBattlePartyID[gActiveBattler] + 1; + return gBattlerPartyIndexes[gActiveBattler] + 1; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { @@ -706,8 +706,8 @@ u8 GetMostSuitableMonToSwitchInto(void) if (species != SPECIES_NONE && GetMonData(&party[i], MON_DATA_HP) != 0 && !(gBitTable[i] & invalidMons) - && gBattlePartyID[bankIn1] != i - && gBattlePartyID[bankIn2] != i + && gBattlerPartyIndexes[bankIn1] != i + && gBattlerPartyIndexes[bankIn2] != i && i != *(gBattleStruct->monToSwitchIntoId + bankIn1) && i != *(gBattleStruct->monToSwitchIntoId + bankIn2)) { @@ -764,9 +764,9 @@ u8 GetMostSuitableMonToSwitchInto(void) continue; if (GetMonData(&party[i], MON_DATA_HP) == 0) continue; - if (gBattlePartyID[bankIn1] == i) + if (gBattlerPartyIndexes[bankIn1] == i) continue; - if (gBattlePartyID[bankIn2] == i) + if (gBattlerPartyIndexes[bankIn2] == i) continue; if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1)) continue; @@ -937,7 +937,7 @@ static bool8 ShouldUseItem(void) if (shouldUse) { - EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); + BtlController_EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); *(gBattleStruct->chosenItem + (gActiveBattler / 2) * 2) = item; gBattleResources->battleHistory->trainerItems[i] = 0; return shouldUse; diff --git a/src/battle_anim.c b/src/battle_anim.c index 93d4de7b3..f5de56610 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -25,8 +25,8 @@ #define ANIM_SPRITE_INDEX_COUNT 8 -extern u8 gBattleAttacker; -extern u8 gBattleDefender; +extern u8 gBattleMoveAttacker; +extern u8 gBattleMoveTarget; extern u16 gBattle_WIN0H; extern u16 gBattle_WIN0V; extern u16 gBattle_WIN1H; @@ -35,8 +35,8 @@ extern u16 gBattle_BG1_X; extern u16 gBattle_BG1_Y; extern u16 gBattle_BG2_X; extern u16 gBattle_BG2_Y; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern struct MusicPlayerInfo gMPlayInfo_BGM; extern struct MusicPlayerInfo gMPlayInfo_SE1; extern struct MusicPlayerInfo gMPlayInfo_SE2; @@ -130,8 +130,8 @@ EWRAM_DATA static u8 sMonAnimTaskIdArray[2] = {0}; EWRAM_DATA u8 gAnimMoveTurn = 0; EWRAM_DATA static u8 sAnimBackgroundFadeState = 0; EWRAM_DATA static u16 sAnimMoveIndex = 0; // set but unused. -EWRAM_DATA u8 gAnimBankAttacker = 0; -EWRAM_DATA u8 gAnimBankTarget = 0; +EWRAM_DATA u8 gBattleAnimAttacker = 0; +EWRAM_DATA u8 gBattleAnimTarget = 0; EWRAM_DATA u16 gAnimSpeciesByBanks[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u8 gUnknown_02038440 = 0; @@ -214,15 +214,15 @@ void ClearBattleAnimationVars(void) gAnimMoveTurn = 0; sAnimBackgroundFadeState = 0; sAnimMoveIndex = 0; - gAnimBankAttacker = 0; - gAnimBankTarget = 0; + gBattleAnimAttacker = 0; + gBattleAnimTarget = 0; gUnknown_02038440 = 0; } void DoMoveAnim(u16 move) { - gAnimBankAttacker = gBattleAttacker; - gAnimBankTarget = gBattleDefender; + gBattleAnimAttacker = gBattleMoveAttacker; + gBattleAnimTarget = gBattleMoveTarget; LaunchBattleAnimation(gBattleAnims_Moves, move, TRUE); } @@ -237,9 +237,9 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo for (i = 0; i < MAX_BATTLERS_COUNT; i++) { if (GetBattlerSide(i) != 0) - gAnimSpeciesByBanks[i] = GetMonData(&gEnemyParty[gBattlePartyID[i]], MON_DATA_SPECIES); + gAnimSpeciesByBanks[i] = GetMonData(&gEnemyParty[gBattlerPartyIndexes[i]], MON_DATA_SPECIES); else - gAnimSpeciesByBanks[i] = GetMonData(&gPlayerParty[gBattlePartyID[i]], MON_DATA_SPECIES); + gAnimSpeciesByBanks[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_SPECIES); } } else @@ -409,7 +409,7 @@ static void ScriptCmd_createsprite(void) else argVar *= -1; - subpriority = sub_80A82E4(gAnimBankTarget) + (s8)(argVar); + subpriority = sub_80A82E4(gBattleAnimTarget) + (s8)(argVar); } else { @@ -418,13 +418,13 @@ static void ScriptCmd_createsprite(void) else argVar *= -1; - subpriority = sub_80A82E4(gAnimBankAttacker) + (s8)(argVar); + subpriority = sub_80A82E4(gBattleAnimAttacker) + (s8)(argVar); } if (subpriority < 3) subpriority = 3; - CreateSpriteAndAnimate(template, GetBankCoord(gAnimBankTarget, 2), GetBankCoord(gAnimBankTarget, 3), subpriority); + CreateSpriteAndAnimate(template, GetBattlerSpriteCoord(gBattleAnimTarget, 2), GetBattlerSpriteCoord(gBattleAnimTarget, 3), subpriority); gAnimVisualTaskCount++; } @@ -565,7 +565,7 @@ static void sub_80A40F4(u8 taskId) u8 newTaskId; s16 *selfData = gTasks[taskId].data; - u8 bankSpriteId = gBankSpriteIds[selfData[t1_MONBG_BANK]]; + u8 bankSpriteId = gBattlerSpriteIds[selfData[t1_MONBG_BANK]]; gSprites[bankSpriteId].invisible = 1; if (!selfData[t1_CREATE_ANOTHER_TASK]) @@ -607,11 +607,11 @@ static void ScriptCmd_monbg(void) animBank = sBattleAnimScriptPtr[0]; if (animBank & ANIM_TARGET) - bank = gAnimBankTarget; + bank = gBattleAnimTarget; else - bank = gAnimBankAttacker; + bank = gBattleAnimAttacker; - if (IsAnimBankSpriteVisible(bank)) + if (IsBattlerSpriteVisible(bank)) { u8 position = GetBattlerPosition(bank); if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest()) @@ -630,7 +630,7 @@ static void ScriptCmd_monbg(void) } bank ^= BIT_FLANK; - if (IsAnimBankSpriteVisible(bank)) + if (IsBattlerSpriteVisible(bank)) { u8 position = GetBattlerPosition(bank); if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest()) @@ -652,20 +652,20 @@ static void ScriptCmd_monbg(void) gAnimScriptCallback = WaitAnimFrameCount; } -bool8 IsAnimBankSpriteVisible(u8 bank) +bool8 IsBattlerSpriteVisible(u8 bank) { if (IsContest()) { - if (bank == gAnimBankAttacker) + if (bank == gBattleAnimAttacker) return TRUE; else return FALSE; } - if (!IsBankSpritePresent(bank)) + if (!IsBattlerSpritePresent(bank)) return FALSE; if (IsContest()) return TRUE; // this line wont ever be reached. - if (!gBattleSpritesDataPtr->bankData[bank].invisible || !gSprites[gBankSpriteIds[bank]].invisible) + if (!gBattleSpritesDataPtr->bankData[bank].invisible || !gSprites[gBattlerSpriteIds[bank]].invisible) return TRUE; return FALSE; @@ -699,7 +699,7 @@ void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible) SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 1); SetAnimBgAttribute(1, BG_ANIM_AREA_OVERFLOW_MODE, 0); - bankSpriteId = gBankSpriteIds[bank]; + bankSpriteId = gBattlerSpriteIds[bank]; gBattle_BG1_X = -(gSprites[bankSpriteId].pos1.x + gSprites[bankSpriteId].pos2.x) + 0x20; if (IsContest() && IsSpeciesNotUnown(gContestResources->field_18->field_0)) @@ -707,7 +707,7 @@ void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible) gBattle_BG1_Y = -(gSprites[bankSpriteId].pos1.y + gSprites[bankSpriteId].pos2.y) + 0x20; if (setSpriteInvisible) - gSprites[gBankSpriteIds[bank]].invisible = 1; + gSprites[gBattlerSpriteIds[bank]].invisible = 1; SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); @@ -736,13 +736,13 @@ void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible) SetAnimBgAttribute(2, BG_ANIM_SCREEN_SIZE, 1); SetAnimBgAttribute(2, BG_ANIM_AREA_OVERFLOW_MODE, 0); - bankSpriteId = gBankSpriteIds[bank]; + bankSpriteId = gBattlerSpriteIds[bank]; gBattle_BG2_X = -(gSprites[bankSpriteId].pos1.x + gSprites[bankSpriteId].pos2.x) + 0x20; gBattle_BG2_Y = -(gSprites[bankSpriteId].pos1.y + gSprites[bankSpriteId].pos2.y) + 0x20; if (setSpriteInvisible) - gSprites[gBankSpriteIds[bank]].invisible = 1; + gSprites[gBattlerSpriteIds[bank]].invisible = 1; SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X); SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y); @@ -869,14 +869,14 @@ static void ScriptCmd_clearmonbg(void) animBankId = ANIM_DEF_PARTNER; if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER) - bank = gAnimBankAttacker; + bank = gBattleAnimAttacker; else - bank = gAnimBankTarget; + bank = gBattleAnimTarget; if (sMonAnimTaskIdArray[0] != 0xFF) - gSprites[gBankSpriteIds[bank]].invisible = 0; + gSprites[gBattlerSpriteIds[bank]].invisible = 0; if (animBankId > 1 && sMonAnimTaskIdArray[1] != 0xFF) - gSprites[gBankSpriteIds[bank ^ BIT_FLANK]].invisible = 0; + gSprites[gBattlerSpriteIds[bank ^ BIT_FLANK]].invisible = 0; else animBankId = 0; @@ -931,11 +931,11 @@ static void ScriptCmd_monbg_22(void) animBankId = ANIM_DEF_PARTNER; if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER) - bank = gAnimBankAttacker; + bank = gBattleAnimAttacker; else - bank = gAnimBankTarget; + bank = gBattleAnimTarget; - if (IsAnimBankSpriteVisible(bank)) + if (IsBattlerSpriteVisible(bank)) { u8 position = GetBattlerPosition(bank); if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest()) @@ -947,7 +947,7 @@ static void ScriptCmd_monbg_22(void) } bank ^= BIT_FLANK; - if (animBankId > 1 && IsAnimBankSpriteVisible(bank)) + if (animBankId > 1 && IsBattlerSpriteVisible(bank)) { u8 position = GetBattlerPosition(bank); if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest()) @@ -976,14 +976,14 @@ static void ScriptCmd_clearmonbg_23(void) animBankId = ANIM_DEF_PARTNER; if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER) - bank = gAnimBankAttacker; + bank = gBattleAnimAttacker; else - bank = gAnimBankTarget; + bank = gBattleAnimTarget; - if (IsAnimBankSpriteVisible(bank)) - gSprites[gBankSpriteIds[bank]].invisible = 0; - if (animBankId > 1 && IsAnimBankSpriteVisible(bank ^ BIT_FLANK)) - gSprites[gBankSpriteIds[bank ^ BIT_FLANK]].invisible = 0; + if (IsBattlerSpriteVisible(bank)) + gSprites[gBattlerSpriteIds[bank]].invisible = 0; + if (animBankId > 1 && IsBattlerSpriteVisible(bank ^ BIT_FLANK)) + gSprites[gBattlerSpriteIds[bank ^ BIT_FLANK]].invisible = 0; else animBankId = 0; @@ -1007,9 +1007,9 @@ static void sub_80A4BB0(u8 taskId) else toBG_2 = TRUE; - if (IsAnimBankSpriteVisible(bank)) + if (IsBattlerSpriteVisible(bank)) sub_80A477C(toBG_2); - if (gTasks[taskId].data[0] > 1 && IsAnimBankSpriteVisible(bank ^ BIT_FLANK)) + if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(bank ^ BIT_FLANK)) sub_80A477C(toBG_2 ^ 1); DestroyTask(taskId); @@ -1145,7 +1145,7 @@ static void ScriptCmd_fadetobgfromset(void) if (IsContest()) gTasks[taskId].tBackgroundId = bg3; - else if (GetBattlerSide(gAnimBankTarget) == B_SIDE_PLAYER) + else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) gTasks[taskId].tBackgroundId = bg2; else gTasks[taskId].tBackgroundId = bg1; @@ -1270,21 +1270,21 @@ static void ScriptCmd_changebg(void) s8 BattleAnimAdjustPanning(s8 pan) { - if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].statusAnimActive) + if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gBattleAnimAttacker].statusAnimActive) { - if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER) + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) pan = PAN_SIDE_OPPONENT; else pan = PAN_SIDE_PLAYER; } else if (IsContest()) { - if (gAnimBankAttacker != gAnimBankTarget || gAnimBankAttacker != 2 || pan != PAN_SIDE_OPPONENT) + if (gBattleAnimAttacker != gBattleAnimTarget || gBattleAnimAttacker != 2 || pan != PAN_SIDE_OPPONENT) pan *= -1; } - else if (GetBattlerSide(gAnimBankAttacker) == B_SIDE_PLAYER) + else if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) { - if (GetBattlerSide(gAnimBankTarget) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) { if (pan == PAN_SIDE_OPPONENT) pan = PAN_SIDE_PLAYER; @@ -1292,7 +1292,7 @@ s8 BattleAnimAdjustPanning(s8 pan) pan *= -1; } } - else if (GetBattlerSide(gAnimBankTarget) == B_SIDE_OPPONENT) + else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT) { if (pan == PAN_SIDE_PLAYER) pan = PAN_SIDE_OPPONENT; @@ -1312,16 +1312,16 @@ s8 BattleAnimAdjustPanning(s8 pan) s8 BattleAnimAdjustPanning2(s8 pan) { - if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].statusAnimActive) + if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gBattleAnimAttacker].statusAnimActive) { - if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER) + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) pan = PAN_SIDE_OPPONENT; else pan = PAN_SIDE_PLAYER; } else { - if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER || IsContest()) + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER || IsContest()) pan = -pan; } return pan; @@ -1701,9 +1701,9 @@ static void ScriptCmd_monbgprio_28(void) sBattleAnimScriptPtr += 2; if (wantedBank != ANIM_ATTACKER) - bank = gAnimBankTarget; + bank = gBattleAnimTarget; else - bank = gAnimBankAttacker; + bank = gBattleAnimAttacker; bankIdentity = GetBattlerPosition(bank); if (!IsContest() && (bankIdentity == B_POSITION_PLAYER_LEFT || bankIdentity == B_POSITION_OPPONENT_RIGHT)) @@ -1731,12 +1731,12 @@ static void ScriptCmd_monbgprio_2A(void) wantedBank = sBattleAnimScriptPtr[1]; sBattleAnimScriptPtr += 2; - if (GetBattlerSide(gAnimBankAttacker) != GetBattlerSide(gAnimBankTarget)) + if (GetBattlerSide(gBattleAnimAttacker) != GetBattlerSide(gBattleAnimTarget)) { if (wantedBank != ANIM_ATTACKER) - bank = gAnimBankTarget; + bank = gBattleAnimTarget; else - bank = gAnimBankAttacker; + bank = gBattleAnimAttacker; bankIdentity = GetBattlerPosition(bank); if (!IsContest() && (bankIdentity == B_POSITION_PLAYER_LEFT || bankIdentity == B_POSITION_OPPONENT_RIGHT)) @@ -1751,7 +1751,7 @@ static void ScriptCmd_invisible(void) { u8 spriteId; - spriteId = GetAnimBankSpriteId(sBattleAnimScriptPtr[1]); + spriteId = GetBattlerSpriteId(sBattleAnimScriptPtr[1]); if (spriteId != 0xFF) gSprites[spriteId].invisible = 1; @@ -1762,7 +1762,7 @@ static void ScriptCmd_visible(void) { u8 spriteId; - spriteId = GetAnimBankSpriteId(sBattleAnimScriptPtr[1]); + spriteId = GetBattlerSpriteId(sBattleAnimScriptPtr[1]); if (spriteId != 0xFF) gSprites[spriteId].invisible = 0; @@ -1778,17 +1778,17 @@ static void ScriptCmd_doublebattle_2D(void) wantedBank = sBattleAnimScriptPtr[1]; sBattleAnimScriptPtr += 2; if (!IsContest() && IsDoubleBattle() - && GetBattlerSide(gAnimBankAttacker) == GetBattlerSide(gAnimBankTarget)) + && GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget)) { if (wantedBank == ANIM_ATTACKER) { - r4 = sub_80A8364(gAnimBankAttacker); - spriteId = GetAnimBankSpriteId(ANIM_ATTACKER); + r4 = sub_80A8364(gBattleAnimAttacker); + spriteId = GetBattlerSpriteId(ANIM_ATTACKER); } else { - r4 = sub_80A8364(gAnimBankTarget); - spriteId = GetAnimBankSpriteId(ANIM_TARGET); + r4 = sub_80A8364(gBattleAnimTarget); + spriteId = GetBattlerSpriteId(ANIM_TARGET); } if (spriteId != 0xFF) { @@ -1813,17 +1813,17 @@ static void ScriptCmd_doublebattle_2E(void) wantedBank = sBattleAnimScriptPtr[1]; sBattleAnimScriptPtr += 2; if (!IsContest() && IsDoubleBattle() - && GetBattlerSide(gAnimBankAttacker) == GetBattlerSide(gAnimBankTarget)) + && GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget)) { if (wantedBank == ANIM_ATTACKER) { - r4 = sub_80A8364(gAnimBankAttacker); - spriteId = GetAnimBankSpriteId(ANIM_ATTACKER); + r4 = sub_80A8364(gBattleAnimAttacker); + spriteId = GetBattlerSpriteId(ANIM_ATTACKER); } else { - r4 = sub_80A8364(gAnimBankTarget); - spriteId = GetAnimBankSpriteId(ANIM_TARGET); + r4 = sub_80A8364(gBattleAnimTarget); + spriteId = GetBattlerSpriteId(ANIM_TARGET); } if (spriteId != 0xFF && r4 == 2) diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 0c7d929a4..2ce9d8712 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -24,21 +24,21 @@ #include "pokeball.h" #include "data2.h" -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u8 gActiveBattler; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gBattlersCount; extern bool8 gDoingBattleAnim; -extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void); +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern void (*gPreBattleCallback1)(void); -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; extern struct SpriteTemplate gUnknown_0202499C; extern u16 gSpecialVar_ItemId; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleOutcome; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; @@ -47,7 +47,7 @@ extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; extern u16 gPartnerTrainerId; extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); -extern u8 gBattleDefender; +extern u8 gBattleMoveTarget; extern u8 gAbsentBattlerFlags; extern u8 gUnknown_020244B4[]; extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT]; @@ -203,12 +203,12 @@ static void nullsub_28(void) void SetControllerToLinkOpponent(void) { - gBattlerFuncs[gActiveBattler] = LinkOpponentBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = LinkOpponentBufferRunCommand; } static void LinkOpponentBufferRunCommand(void) { - if (gBattleExecBuffer & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) { if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sLinkOpponentBufferCommands)) sLinkOpponentBufferCommands[gBattleBufferA[gActiveBattler][0]](); @@ -219,23 +219,23 @@ static void LinkOpponentBufferRunCommand(void) static void CompleteOnBankSpriteCallbackDummy(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) LinkOpponentBufferExecCompleted(); } static void CompleteOnBankSpriteCallbackDummy2(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) LinkOpponentBufferExecCompleted(); } static void sub_8064470(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - FreeTrainerFrontPicPalette(gSprites[gBankSpriteIds[gActiveBattler]].oam.affineParam); - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); + FreeTrainerFrontPicPalette(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); LinkOpponentBufferExecCompleted(); } } @@ -256,13 +256,13 @@ static void sub_8064520(void) if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) r8 = TRUE; } else { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { r8 = TRUE; } @@ -271,7 +271,7 @@ static void sub_8064520(void) if (r8) { - if (r4 || !IsAnimBankSpriteVisible(gActiveBattler ^ BIT_FLANK)) + if (r4 || !IsBattlerSpriteVisible(gActiveBattler ^ BIT_FLANK)) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1) return; @@ -303,7 +303,7 @@ static void sub_8064520(void) } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerFuncs[gActiveBattler] = sub_80644D8; + gBattlerControllerFuncs[gActiveBattler] = sub_80644D8; } } @@ -315,14 +315,14 @@ static void sub_8064734(void) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1) { - sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); } if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].field_1_x1) { - sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]]); + sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); } @@ -332,13 +332,13 @@ static void sub_8064734(void) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); sub_8076918(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gEnemyParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 1; } @@ -368,7 +368,7 @@ static void sub_8064734(void) if (r10) { if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT) { @@ -380,30 +380,30 @@ static void sub_8064734(void) if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); - SetBankEnemyShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); + SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); } DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - SetBankEnemyShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES)); + SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); gBattleSpritesDataPtr->animationData->field_9_x1 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; - gBattlerFuncs[gActiveBattler] = sub_8064520; + gBattlerControllerFuncs[gActiveBattler] = sub_8064520; } } } static void sub_8064B04(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].pos2.x == 0) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80) { - sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); } else { @@ -421,13 +421,13 @@ static void sub_8064B04(void) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBattler, gHealthBoxesIds[gActiveBattler], HEALTH_BAR, 0); + s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); if (hpValue != -1) { - UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], hpValue, HP_CURRENT); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], hpValue, HP_CURRENT); } else { @@ -437,9 +437,9 @@ static void CompleteOnHealthbarDone(void) static void sub_8064C14(void) { - if (!gSprites[gBankSpriteIds[gActiveBattler]].inUse) + if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse) { - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); LinkOpponentBufferExecCompleted(); } } @@ -448,10 +448,10 @@ static void sub_8064C58(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - EnemyShadowCallbackToSetInvisible(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + HideBattlerShadowSprite(gActiveBattler); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); LinkOpponentBufferExecCompleted(); } } @@ -464,7 +464,7 @@ static void CompleteOnInactiveTextPrinter(void) static void DoHitAnimBlinkSpriteEffect(void) { - u8 spriteId = gBankSpriteIds[gActiveBattler]; + u8 spriteId = gBattlerSpriteIds[gActiveBattler]; if (gSprites[spriteId].data[1] == 32) { @@ -483,12 +483,12 @@ static void DoHitAnimBlinkSpriteEffect(void) static void sub_8064D60(void) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerFuncs[gActiveBattler] = sub_8064DD0; + gBattlerControllerFuncs[gActiveBattler] = sub_8064DD0; } } @@ -496,8 +496,8 @@ static void sub_8064DD0(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - || gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + || gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) { m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); LinkOpponentBufferExecCompleted(); @@ -508,7 +508,7 @@ static void sub_8064DD0(void) static void sub_8064E50(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 = 0; @@ -516,13 +516,13 @@ static void sub_8064E50(void) FreeSpriteTilesByTag(0x27F9); FreeSpritePaletteByTag(0x27F9); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 0); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gEnemyParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); CopyBattleSpriteInvisibility(gActiveBattler); - gBattlerFuncs[gActiveBattler] = sub_8064D60; + gBattlerControllerFuncs[gActiveBattler] = sub_8064D60; } } @@ -531,15 +531,15 @@ static void sub_8064F40(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80) { - sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); } if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - SetBankEnemyShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerFuncs[gActiveBattler] = sub_8064E50; + SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); + gBattlerControllerFuncs[gActiveBattler] = sub_8064E50; } } @@ -557,7 +557,7 @@ static void CompleteOnFinishedBattleAnimation(void) static void LinkOpponentBufferExecCompleted(void) { - gBattlerFuncs[gActiveBattler] = LinkOpponentBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = LinkOpponentBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); @@ -567,7 +567,7 @@ static void LinkOpponentBufferExecCompleted(void) } else { - gBattleExecBuffer &= ~gBitTable[gActiveBattler]; + gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; } } @@ -580,7 +580,7 @@ static void LinkOpponentHandleGetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - size += CopyLinkOpponentMonData(gBattlePartyID[gActiveBattler], monData); + size += CopyLinkOpponentMonData(gBattlerPartyIndexes[gActiveBattler], monData); } else { @@ -592,7 +592,7 @@ static void LinkOpponentHandleGetMonData(void) monToCheck >>= 1; } } - EmitDataTransfer(1, size, monData); + BtlController_EmitDataTransfer(1, size, monData); LinkOpponentBufferExecCompleted(); } @@ -914,7 +914,7 @@ static void LinkOpponentHandleSetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - SetLinkOpponentMonData(gBattlePartyID[gActiveBattler]); + SetLinkOpponentMonData(gBattlerPartyIndexes[gActiveBattler]); } else { @@ -1147,7 +1147,7 @@ static void SetLinkOpponentMonData(u8 monId) static void LinkOpponentHandleSetRawMonData(void) { - u8 *dst = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; + u8 *dst = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; u8 i; for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++) @@ -1158,31 +1158,31 @@ static void LinkOpponentHandleSetRawMonData(void) static void LinkOpponentHandleLoadMonSprite(void) { - u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); sub_806A068(species, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, - GetBankCoord(gActiveBattler, 2), - GetBankSpriteDefault_Y(gActiveBattler), + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, + GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteDefault_Y(gActiveBattler), sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - SetBankEnemyShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES)); + SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerFuncs[gActiveBattler] = sub_8064B04; + gBattlerControllerFuncs[gActiveBattler] = sub_8064B04; } static void LinkOpponentHandleSwitchInAnim(void) { - gBattlePartyID[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; + gBattlerPartyIndexes[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; sub_8066494(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlerFuncs[gActiveBattler] = sub_8064F40; + gBattlerControllerFuncs[gActiveBattler] = sub_8064F40; } static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit) @@ -1190,29 +1190,29 @@ static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit) u16 species; ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); - gBattlePartyID[bank] = gBattleBufferA[bank][1]; - species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank); sub_806A068(species, GetBattlerPosition(bank)); - gBankSpriteIds[bank] = CreateSprite( + gBattlerSpriteIds[bank] = CreateSprite( &gUnknown_0202499C, - GetBankCoord(bank, 2), - GetBankSpriteDefault_Y(bank), + GetBattlerSpriteCoord(bank, 2), + GetBattlerSpriteDefault_Y(bank), sub_80A82E4(bank)); - gSprites[gUnknown_03005D7C[bank]].data[1] = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank]; gSprites[gUnknown_03005D7C[bank]].data[2] = bank; - gSprites[gBankSpriteIds[bank]].data[0] = bank; - gSprites[gBankSpriteIds[bank]].data[2] = species; - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].data[2] = species; + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; - StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]); - gSprites[gBankSpriteIds[bank]].invisible = TRUE; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[bank]].invisible = TRUE; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); } @@ -1222,14 +1222,14 @@ static void LinkOpponentHandleReturnMonToBall(void) if (gBattleBufferA[gActiveBattler][1] == 0) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = DoSwitchOutAnimation; + gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; } else { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - EnemyShadowCallbackToSetInvisible(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + HideBattlerShadowSprite(gActiveBattler); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); LinkOpponentBufferExecCompleted(); } } @@ -1249,7 +1249,7 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON); - gBattlerFuncs[gActiveBattler] = sub_8064C58; + gBattlerControllerFuncs[gActiveBattler] = sub_8064C58; } break; } @@ -1276,25 +1276,25 @@ static void LinkOpponentHandleDrawTrainerPic(void) } else { - if ((gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED - || (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN) + if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN) { - if (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender != 0) + if (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender != 0) trainerPicId = gUnknown_0831F578[0x4F]; else trainerPicId = gUnknown_0831F578[0x4E]; } - else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY - || (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE) + else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE) { - if (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender != 0) + if (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender != 0) trainerPicId = gUnknown_0831F578[0x51]; else trainerPicId = gUnknown_0831F578[0x50]; } else { - trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender); + trainerPicId = PlayerGenderToFrontTrainerPicId(gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender); } } } @@ -1329,18 +1329,18 @@ static void LinkOpponentHandleDrawTrainerPic(void) DecompressTrainerFrontPic(trainerPicId, gActiveBattler); sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 2; - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBankSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; } static void LinkOpponentHandleTrainerSlide(void) @@ -1354,28 +1354,28 @@ static void LinkOpponentHandleTrainerSlide(void) DecompressTrainerFrontPic(trainerPicId, gActiveBattler); sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 96; - gSprites[gBankSpriteIds[gActiveBattler]].pos1.x += 32; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBankSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; // this line is redundant, because LinkOpponentBufferExecCompleted changes the battle bank function + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; // this line is redundant, because LinkOpponentBufferExecCompleted changes the battle bank function LinkOpponentBufferExecCompleted(); } static void LinkOpponentHandleTrainerSlideBack(void) { - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerFuncs[gActiveBattler] = sub_8064470; + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); + gBattlerControllerFuncs[gActiveBattler] = sub_8064470; } static void LinkOpponentHandleFaintAnimation(void) @@ -1392,8 +1392,8 @@ static void LinkOpponentHandleFaintAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT); - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_8039934; - gBattlerFuncs[gActiveBattler] = sub_8064C14; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039934; + gBattlerControllerFuncs[gActiveBattler] = sub_8064C14; } } } @@ -1438,7 +1438,7 @@ static void LinkOpponentHandleMoveAnimation(void) else { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = LinkOpponentDoMoveAnimation; + gBattlerControllerFuncs[gActiveBattler] = LinkOpponentDoMoveAnimation; sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); } } @@ -1502,7 +1502,7 @@ static void LinkOpponentHandlePrintString(void) stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]); BufferStringBattle(*stringId); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); - gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; sub_817C95C(*stringId); } @@ -1550,19 +1550,19 @@ static void LinkOpponentHandleHealthBarUpdate(void) if (hpVal != INSTANT_HP_BAR_DROP) { - u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_HP); + u32 maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, curHP, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); } else { - u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); + u32 maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, 0, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); } - gBattlerFuncs[gActiveBattler] = CompleteOnHealthbarDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; } static void LinkOpponentHandleExpUpdate(void) @@ -1576,10 +1576,10 @@ static void LinkOpponentHandleStatusIconUpdate(void) { u8 bank; - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gEnemyParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_STATUS_ICON); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); bank = gActiveBattler; gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1589,7 +1589,7 @@ static void LinkOpponentHandleStatusAnimation(void) { InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8) | (gBattleBufferA[gActiveBattler][4] << 16) | (gBattleBufferA[gActiveBattler][5] << 24)); - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1664,16 +1664,16 @@ static void LinkOpponentHandleCmd40(void) static void LinkOpponentHandleHitAnimation(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].invisible == TRUE) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) { LinkOpponentBufferExecCompleted(); } else { gDoingBattleAnim = TRUE; - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; + gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; } } @@ -1712,7 +1712,7 @@ static void LinkOpponentHandlePlayFanfareOrBGM(void) static void LinkOpponentHandleFaintingCry(void) { - u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); PlayCry3(species, 25, 5); LinkOpponentBufferExecCompleted(); @@ -1730,14 +1730,14 @@ static void LinkOpponentHandleIntroTrainerBallThrow(void) u8 paletteNum; u8 taskId; - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], sub_80676FC); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_80676FC); taskId = CreateTask(sub_8067618, 5); gTasks[taskId].data[0] = gActiveBattler; @@ -1746,7 +1746,7 @@ static void LinkOpponentHandleIntroTrainerBallThrow(void) gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30; gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerFuncs[gActiveBattler] = nullsub_28; + gBattlerControllerFuncs[gActiveBattler] = nullsub_28; } static void sub_8067618(u8 taskId) @@ -1756,19 +1756,19 @@ static void sub_8067618(u8 taskId) gActiveBattler = gTasks[taskId].data[0]; if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_8066494(gActiveBattler, FALSE); } else { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_8066494(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_8066494(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerFuncs[gActiveBattler] = sub_8064734; + gBattlerControllerFuncs[gActiveBattler] = sub_8064734; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1809,7 +1809,7 @@ static void LinkOpponentHandleDrawPartyStatusSummary(void) if (gBattleBufferA[gActiveBattler][2] != 0) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; - gBattlerFuncs[gActiveBattler] = sub_806782C; + gBattlerControllerFuncs[gActiveBattler] = sub_806782C; } } @@ -1836,9 +1836,9 @@ static void LinkOpponentHandleCmd50(void) static void LinkOpponentHandleSpriteInvisibility(void) { - if (IsBankSpritePresent(gActiveBattler)) + if (IsBattlerSpritePresent(gActiveBattler)) { - gSprites[gBankSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; + gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; CopyBattleSpriteInvisibility(gActiveBattler); } LinkOpponentBufferExecCompleted(); @@ -1854,7 +1854,7 @@ static void LinkOpponentHandleBattleAnimation(void) if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) LinkOpponentBufferExecCompleted(); else - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; sub_817E32C(animationId); } @@ -1884,7 +1884,7 @@ static void LinkOpponentHandleCmd55(void) FadeOutMapMusic(5); BeginFastPaletteFade(3); LinkOpponentBufferExecCompleted(); - gBattlerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; } static void nullsub_92(void) diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index d184370f4..26f808620 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -24,21 +24,21 @@ #include "pokeball.h" #include "data2.h" -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u8 gActiveBattler; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gBattlersCount; extern bool8 gDoingBattleAnim; -extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void); +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern void (*gPreBattleCallback1)(void); -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; extern struct SpriteTemplate gUnknown_0202499C; extern u16 gSpecialVar_ItemId; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleOutcome; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; @@ -47,7 +47,7 @@ extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; extern u16 gPartnerTrainerId; extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); -extern u8 gBattleDefender; +extern u8 gBattleMoveTarget; extern u8 gAbsentBattlerFlags; extern u8 gUnknown_020244B4[]; extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT]; @@ -198,12 +198,12 @@ static void nullsub_112(void) void SetControllerToLinkPartner(void) { - gBattlerFuncs[gActiveBattler] = LinkPartnerBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = LinkPartnerBufferRunCommand; } static void LinkPartnerBufferRunCommand(void) { - if (gBattleExecBuffer & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) { if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sLinkPartnerBufferCommands)) sLinkPartnerBufferCommands[gBattleBufferA[gActiveBattler][0]](); @@ -214,17 +214,17 @@ static void LinkPartnerBufferRunCommand(void) static void CompleteOnBankSpriteCallbackDummy(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) LinkPartnerBufferExecCompleted(); } static void sub_814AF54(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { nullsub_25(0); - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); LinkPartnerBufferExecCompleted(); } } @@ -244,13 +244,13 @@ static void sub_814B004(void) if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) r6 = TRUE; } else { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { r6 = TRUE; } @@ -262,7 +262,7 @@ static void sub_814B004(void) if (r6) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerFuncs[gActiveBattler] = sub_814AFBC; + gBattlerControllerFuncs[gActiveBattler] = sub_814AFBC; } } @@ -271,7 +271,7 @@ static void sub_814B0E8(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive && gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 != 1) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; @@ -279,55 +279,55 @@ static void sub_814B0E8(void) if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); sub_8076918(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); gBattleSpritesDataPtr->animationData->field_9_x1 = 0; - gBattlerFuncs[gActiveBattler] = sub_814B004; + gBattlerControllerFuncs[gActiveBattler] = sub_814B004; } } static void sub_814B290(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].animEnded && gSprites[gBankSpriteIds[gActiveBattler]].pos2.x == 0) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) LinkPartnerBufferExecCompleted(); } static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBattler, gHealthBoxesIds[gActiveBattler], HEALTH_BAR, 0); + s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); if (hpValue != -1) { - UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], hpValue, HP_CURRENT); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], hpValue, HP_CURRENT); } else { - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); LinkPartnerBufferExecCompleted(); } } static void sub_814B340(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].pos1.y + gSprites[gBankSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) { - u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); nullsub_24(species); - FreeOamMatrix(gSprites[gBankSpriteIds[gActiveBattler]].oam.matrixNum); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); LinkPartnerBufferExecCompleted(); } } @@ -336,9 +336,9 @@ static void sub_814B3DC(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); LinkPartnerBufferExecCompleted(); } } @@ -351,7 +351,7 @@ static void CompleteOnInactiveTextPrinter(void) static void DoHitAnimBlinkSpriteEffect(void) { - u8 spriteId = gBankSpriteIds[gActiveBattler]; + u8 spriteId = gBattlerSpriteIds[gActiveBattler]; if (gSprites[spriteId].data[1] == 32) { @@ -370,20 +370,20 @@ static void DoHitAnimBlinkSpriteEffect(void) static void sub_814B4E0(void) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { CopyBattleSpriteInvisibility(gActiveBattler); if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerFuncs[gActiveBattler] = sub_814B554; + gBattlerControllerFuncs[gActiveBattler] = sub_814B554; } } static void sub_814B554(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { LinkPartnerBufferExecCompleted(); } @@ -400,13 +400,13 @@ static void sub_814B5A8(void) FreeSpritePaletteByTag(0x27F9); CreateTask(c3_0802FDF4, 10); - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 0); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattlerFuncs[gActiveBattler] = sub_814B4E0; + gBattlerControllerFuncs[gActiveBattler] = sub_814B4E0; } } @@ -415,20 +415,20 @@ static void sub_814B69C(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); } if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - gBattlerFuncs[gActiveBattler] = sub_814B5A8; + gBattlerControllerFuncs[gActiveBattler] = sub_814B5A8; } } static void LinkPartnerBufferExecCompleted(void) { - gBattlerFuncs[gActiveBattler] = LinkPartnerBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = LinkPartnerBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); @@ -438,7 +438,7 @@ static void LinkPartnerBufferExecCompleted(void) } else { - gBattleExecBuffer &= ~gBitTable[gActiveBattler]; + gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; } } @@ -463,7 +463,7 @@ static void LinkPartnerHandleGetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - size += CopyLinkPartnerMonData(gBattlePartyID[gActiveBattler], monData); + size += CopyLinkPartnerMonData(gBattlerPartyIndexes[gActiveBattler], monData); } else { @@ -475,7 +475,7 @@ static void LinkPartnerHandleGetMonData(void) monToCheck >>= 1; } } - EmitDataTransfer(1, size, monData); + BtlController_EmitDataTransfer(1, size, monData); LinkPartnerBufferExecCompleted(); } @@ -797,7 +797,7 @@ static void LinkPartnerHandleSetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - SetLinkPartnerMonData(gBattlePartyID[gActiveBattler]); + SetLinkPartnerMonData(gBattlerPartyIndexes[gActiveBattler]); } else { @@ -1027,12 +1027,12 @@ static void SetLinkPartnerMonData(u8 monId) break; } - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); } static void LinkPartnerHandleSetRawMonData(void) { - u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; + u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; u8 i; for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++) @@ -1045,28 +1045,28 @@ static void LinkPartnerHandleLoadMonSprite(void) { u16 species; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); - species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); sub_806A068(species, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, - GetBankCoord(gActiveBattler, 2), - GetBankSpriteDefault_Y(gActiveBattler), + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, + GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteDefault_Y(gActiveBattler), sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - gBattlerFuncs[gActiveBattler] = sub_814B290; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); + gBattlerControllerFuncs[gActiveBattler] = sub_814B290; } static void LinkPartnerHandleSwitchInAnim(void) { ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlePartyID[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + gBattlerPartyIndexes[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); sub_814CC98(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlerFuncs[gActiveBattler] = sub_814B69C; + gBattlerControllerFuncs[gActiveBattler] = sub_814B69C; } static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit) @@ -1074,28 +1074,28 @@ static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit) u16 species; ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); - gBattlePartyID[bank] = gBattleBufferA[bank][1]; - species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); sub_806A068(species, GetBattlerPosition(bank)); - gBankSpriteIds[bank] = CreateSprite( + gBattlerSpriteIds[bank] = CreateSprite( &gUnknown_0202499C, - GetBankCoord(bank, 2), - GetBankSpriteDefault_Y(bank), + GetBattlerSpriteCoord(bank, 2), + GetBattlerSpriteDefault_Y(bank), sub_80A82E4(bank)); - gSprites[gUnknown_03005D7C[bank]].data[1] = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank]; gSprites[gUnknown_03005D7C[bank]].data[2] = bank; - gSprites[gBankSpriteIds[bank]].data[0] = bank; - gSprites[gBankSpriteIds[bank]].data[2] = species; - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].data[2] = species; + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; - StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]); - gSprites[gBankSpriteIds[bank]].invisible = TRUE; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[bank]].invisible = TRUE; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); } @@ -1105,13 +1105,13 @@ static void LinkPartnerHandleReturnMonToBall(void) if (gBattleBufferA[gActiveBattler][1] == 0) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = DoSwitchOutAnimation; + gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; } else { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); LinkPartnerBufferExecCompleted(); } } @@ -1131,7 +1131,7 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerFuncs[gActiveBattler] = sub_814B3DC; + gBattlerControllerFuncs[gActiveBattler] = sub_814B3DC; } break; } @@ -1154,31 +1154,31 @@ static void LinkPartnerHandleDrawTrainerPic(void) xPos = 80; } - if ((gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED - || (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN) + if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN) { - trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender + BACK_PIC_RED; + trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RED; } - else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY - || (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE) + else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE) { - trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender + BACK_PIC_RS_BRENDAN; + trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RS_BRENDAN; } else { - trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender; + trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender; } DecompressTrainerBackPic(trainerPicId, gActiveBattler); sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; } static void LinkPartnerHandleTrainerSlide(void) @@ -1188,13 +1188,13 @@ static void LinkPartnerHandleTrainerSlide(void) static void LinkPartnerHandleTrainerSlideBack(void) { - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerFuncs[gActiveBattler] = sub_814AF54; + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); + gBattlerControllerFuncs[gActiveBattler] = sub_814AF54; } static void LinkPartnerHandleFaintAnimation(void) @@ -1210,12 +1210,12 @@ static void LinkPartnerHandleFaintAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER); - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 5; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_8039C00; - gBattlerFuncs[gActiveBattler] = sub_814B340; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00; + gBattlerControllerFuncs[gActiveBattler] = sub_814B340; } } } @@ -1260,7 +1260,7 @@ static void LinkPartnerHandleMoveAnimation(void) else { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = LinkPartnerDoMoveAnimation; + gBattlerControllerFuncs[gActiveBattler] = LinkPartnerDoMoveAnimation; sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); } } @@ -1324,7 +1324,7 @@ static void LinkPartnerHandlePrintString(void) stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]); BufferStringBattle(*stringId); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); - gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; sub_817C95C(*stringId); } @@ -1372,19 +1372,19 @@ static void LinkPartnerHandleHealthBarUpdate(void) if (hpVal != INSTANT_HP_BAR_DROP) { - u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_HP); + u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, curHP, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); } else { - u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); + u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, 0, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); } - gBattlerFuncs[gActiveBattler] = CompleteOnHealthbarDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; } static void LinkPartnerHandleExpUpdate(void) @@ -1398,10 +1398,10 @@ static void LinkPartnerHandleStatusIconUpdate(void) { u8 bank; - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_STATUS_ICON); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); bank = gActiveBattler; gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1411,7 +1411,7 @@ static void LinkPartnerHandleStatusAnimation(void) { InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8) | (gBattleBufferA[gActiveBattler][4] << 16) | (gBattleBufferA[gActiveBattler][5] << 24)); - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1486,16 +1486,16 @@ static void LinkPartnerHandleCmd40(void) static void LinkPartnerHandleHitAnimation(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].invisible == TRUE) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) { LinkPartnerBufferExecCompleted(); } else { gDoingBattleAnim = TRUE; - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; + gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; } } @@ -1534,7 +1534,7 @@ static void LinkPartnerHandlePlayFanfareOrBGM(void) static void LinkPartnerHandleFaintingCry(void) { - u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); PlayCry3(species, -25, 5); LinkPartnerBufferExecCompleted(); @@ -1553,37 +1553,37 @@ static void LinkPartnerHandleIntroTrainerBallThrow(void) u8 taskId; u32 trainerPicId; - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - gSprites[gBankSpriteIds[gActiveBattler]].data[5] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], sub_805CC00); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F9); - if ((gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED - || (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN) + if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED + || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN) { - trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender + BACK_PIC_RED; + trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RED; } - else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY - || (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE) + else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY + || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE) { - trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender + BACK_PIC_RS_BRENDAN; + trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RS_BRENDAN; } else { - trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender; + trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender; } LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, 0x100 + paletteNum * 16, 32); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; taskId = CreateTask(sub_814DCCC, 5); gTasks[taskId].data[0] = gActiveBattler; @@ -1592,7 +1592,7 @@ static void LinkPartnerHandleIntroTrainerBallThrow(void) gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30; gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerFuncs[gActiveBattler] = nullsub_112; + gBattlerControllerFuncs[gActiveBattler] = nullsub_112; } static void sub_814DCCC(u8 taskId) @@ -1608,20 +1608,20 @@ static void sub_814DCCC(u8 taskId) gActiveBattler = gTasks[taskId].data[0]; if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_814CC98(gActiveBattler, FALSE); } else { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_814CC98(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); sub_814CC98(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerFuncs[gActiveBattler] = sub_814B0E8; + gBattlerControllerFuncs[gActiveBattler] = sub_814B0E8; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1642,7 +1642,7 @@ static void LinkPartnerHandleDrawPartyStatusSummary(void) if (gBattleBufferA[gActiveBattler][2] != 0) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; - gBattlerFuncs[gActiveBattler] = sub_814DE9C; + gBattlerControllerFuncs[gActiveBattler] = sub_814DE9C; } } @@ -1669,9 +1669,9 @@ static void LinkPartnerHandleCmd50(void) static void LinkPartnerHandleSpriteInvisibility(void) { - if (IsBankSpritePresent(gActiveBattler)) + if (IsBattlerSpritePresent(gActiveBattler)) { - gSprites[gBankSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; + gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; CopyBattleSpriteInvisibility(gActiveBattler); } LinkPartnerBufferExecCompleted(); @@ -1687,7 +1687,7 @@ static void LinkPartnerHandleBattleAnimation(void) if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) LinkPartnerBufferExecCompleted(); else - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; sub_817E32C(animationId); } @@ -1712,7 +1712,7 @@ static void LinkPartnerHandleCmd55(void) FadeOutMapMusic(5); BeginFastPaletteFade(3); LinkPartnerBufferExecCompleted(); - gBattlerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; } static void nullsub_113(void) diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 7131cbde6..2ce339732 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -28,19 +28,19 @@ #include "pokeball.h" #include "data2.h" -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u8 gActiveBattler; -extern u8 gBattleDefender; +extern u8 gBattleMoveTarget; extern u8 gAbsentBattlerFlags; extern bool8 gDoingBattleAnim; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern struct MusicPlayerInfo gMPlayInfo_BGM; extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; -extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void); +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern void *gUnknown_020244D8; extern void *gUnknown_020244DC; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; @@ -207,12 +207,12 @@ static void nullsub_26(void) void SetControllerToOpponent(void) { - gBattlerFuncs[gActiveBattler] = OpponentBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = OpponentBufferRunCommand; } static void OpponentBufferRunCommand(void) { - if (gBattleExecBuffer & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) { if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sOpponentBufferCommands)) sOpponentBufferCommands[gBattleBufferA[gActiveBattler][0]](); @@ -223,23 +223,23 @@ static void OpponentBufferRunCommand(void) static void CompleteOnBankSpriteCallbackDummy(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) OpponentBufferExecCompleted(); } static void CompleteOnBankSpriteCallbackDummy2(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) OpponentBufferExecCompleted(); } static void sub_805F240(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - FreeTrainerFrontPicPalette(gSprites[gBankSpriteIds[gActiveBattler]].oam.affineParam); - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); + FreeTrainerFrontPicPalette(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); OpponentBufferExecCompleted(); } } @@ -260,14 +260,14 @@ static void sub_805F2F0(void) if (!IsDoubleBattle() || ((IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI)) || (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS))) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) var = TRUE; var2 = FALSE; } else { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) var = TRUE; var2 = TRUE; } @@ -310,7 +310,7 @@ static void sub_805F2F0(void) return; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerFuncs[gActiveBattler] = sub_805F2A8; + gBattlerControllerFuncs[gActiveBattler] = sub_805F2A8; } } @@ -320,22 +320,22 @@ static void sub_805F560(void) bool32 r10 = FALSE; if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1) - sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI) && IsDoubleBattle() && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].field_1_x1) - sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]]); + sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); sub_8076918(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gEnemyParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 1; } @@ -362,7 +362,7 @@ static void sub_805F560(void) if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { r10 = TRUE; } @@ -370,9 +370,9 @@ static void sub_805F560(void) else { if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { r10 = TRUE; } @@ -383,25 +383,25 @@ static void sub_805F560(void) if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); - SetBankEnemyShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); + SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); } DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - SetBankEnemyShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES)); + SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); gBattleSpritesDataPtr->animationData->field_9_x1 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; - gBattlerFuncs[gActiveBattler] = sub_805F2F0; + gBattlerControllerFuncs[gActiveBattler] = sub_805F2F0; } } static void sub_805F994(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].pos2.x == 0 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1) - sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlePartyID[gActiveBattler]]); + if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1) + sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 = 0; @@ -413,11 +413,11 @@ static void sub_805F994(void) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBattler, gHealthBoxesIds[gActiveBattler], HEALTH_BAR, 0); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); if (hpValue != -1) { - UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], hpValue, HP_CURRENT); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], hpValue, HP_CURRENT); } else OpponentBufferExecCompleted(); @@ -425,9 +425,9 @@ static void CompleteOnHealthbarDone(void) static void sub_805FAC4(void) { - if (!gSprites[gBankSpriteIds[gActiveBattler]].inUse) + if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse) { - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); OpponentBufferExecCompleted(); } } @@ -436,10 +436,10 @@ static void sub_805FB08(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - EnemyShadowCallbackToSetInvisible(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + HideBattlerShadowSprite(gActiveBattler); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); OpponentBufferExecCompleted(); } } @@ -452,7 +452,7 @@ static void CompleteOnInactiveTextPrinter(void) static void DoHitAnimBlinkSpriteEffect(void) { - u8 spriteId = gBankSpriteIds[gActiveBattler]; + u8 spriteId = gBattlerSpriteIds[gActiveBattler]; if (gSprites[spriteId].data[1] == 32) { @@ -471,11 +471,11 @@ static void DoHitAnimBlinkSpriteEffect(void) static void sub_805FC10(void) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerFuncs[gActiveBattler] = sub_805FC80; + gBattlerControllerFuncs[gActiveBattler] = sub_805FC80; } } @@ -483,7 +483,7 @@ static void sub_805FC80(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy || gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy || gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) { m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); OpponentBufferExecCompleted(); @@ -493,32 +493,32 @@ static void sub_805FC80(void) static void sub_805FD00(void) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 = 0; FreeSpriteTilesByTag(0x27F9); FreeSpritePaletteByTag(0x27F9); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 0); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gEnemyParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); CopyBattleSpriteInvisibility(gActiveBattler); - gBattlerFuncs[gActiveBattler] = sub_805FC10; + gBattlerControllerFuncs[gActiveBattler] = sub_805FC10; } } static void sub_805FDF0(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) - sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - SetBankEnemyShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerFuncs[gActiveBattler] = sub_805FD00; + SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); + gBattlerControllerFuncs[gActiveBattler] = sub_805FD00; } } @@ -536,7 +536,7 @@ static void CompleteOnFinishedBattleAnimation(void) static void OpponentBufferExecCompleted(void) { - gBattlerFuncs[gActiveBattler] = OpponentBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = OpponentBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); @@ -546,7 +546,7 @@ static void OpponentBufferExecCompleted(void) } else { - gBattleExecBuffer &= ~gBitTable[gActiveBattler]; + gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; } } @@ -559,7 +559,7 @@ static void OpponentHandleGetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - size += GetOpponentMonData(gBattlePartyID[gActiveBattler], monData); + size += GetOpponentMonData(gBattlerPartyIndexes[gActiveBattler], monData); } else { @@ -571,7 +571,7 @@ static void OpponentHandleGetMonData(void) monToCheck >>= 1; } } - EmitDataTransfer(1, size, monData); + BtlController_EmitDataTransfer(1, size, monData); OpponentBufferExecCompleted(); } @@ -884,14 +884,14 @@ static u32 GetOpponentMonData(u8 monId, u8 *dst) static void OpponentHandleGetRawMonData(void) { struct BattlePokemon battleMon; - u8 *src = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; + u8 *src = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; u8 *dst = (u8 *)&battleMon + gBattleBufferA[gActiveBattler][1]; u8 i; for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++) dst[i] = src[i]; - EmitDataTransfer(1, gBattleBufferA[gActiveBattler][2], dst); + BtlController_EmitDataTransfer(1, gBattleBufferA[gActiveBattler][2], dst); OpponentBufferExecCompleted(); } @@ -902,7 +902,7 @@ static void OpponentHandleSetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - SetOpponentMonData(gBattlePartyID[gActiveBattler]); + SetOpponentMonData(gBattlerPartyIndexes[gActiveBattler]); } else { @@ -1135,7 +1135,7 @@ static void SetOpponentMonData(u8 monId) static void OpponentHandleSetRawMonData(void) { - u8 *dst = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; + u8 *dst = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; u8 i; for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++) @@ -1146,33 +1146,33 @@ static void OpponentHandleSetRawMonData(void) static void OpponentHandleLoadMonSprite(void) { - u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); sub_806A068(species, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, - GetBankCoord(gActiveBattler, 2), - GetBankSpriteDefault_Y(gActiveBattler), + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, + GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteDefault_Y(gActiveBattler), sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = species; - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = species; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - SetBankEnemyShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES)); + SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerFuncs[gActiveBattler] = sub_805F994; + gBattlerControllerFuncs[gActiveBattler] = sub_805F994; } static void OpponentHandleSwitchInAnim(void) { *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = 6; - gBattlePartyID[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; + gBattlerPartyIndexes[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; sub_80613DC(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlerFuncs[gActiveBattler] = sub_805FDF0; + gBattlerControllerFuncs[gActiveBattler] = sub_805FDF0; } static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit) @@ -1180,29 +1180,29 @@ static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit) u16 species; ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); - gBattlePartyID[bank] = gBattleBufferA[bank][1]; - species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank); sub_806A068(species, GetBattlerPosition(bank)); - gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, - GetBankCoord(bank, 2), - GetBankSpriteDefault_Y(bank), + gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, + GetBattlerSpriteCoord(bank, 2), + GetBattlerSpriteDefault_Y(bank), sub_80A82E4(bank)); - gSprites[gBankSpriteIds[bank]].data[0] = bank; - gSprites[gBankSpriteIds[bank]].data[2] = species; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].data[2] = species; - gSprites[gUnknown_03005D7C[bank]].data[1] = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank]; gSprites[gUnknown_03005D7C[bank]].data[2] = bank; - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; - StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]); - gSprites[gBankSpriteIds[bank]].invisible = TRUE; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[bank]].invisible = TRUE; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); } @@ -1212,14 +1212,14 @@ static void OpponentHandleReturnMonToBall(void) if (gBattleBufferA[gActiveBattler][1] == 0) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = DoSwitchOutAnimation; + gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; } else { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - EnemyShadowCallbackToSetInvisible(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + HideBattlerShadowSprite(gActiveBattler); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); OpponentBufferExecCompleted(); } } @@ -1239,7 +1239,7 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON); - gBattlerFuncs[gActiveBattler] = sub_805FB08; + gBattlerControllerFuncs[gActiveBattler] = sub_805FB08; } break; } @@ -1316,18 +1316,18 @@ static void OpponentHandleDrawTrainerPic(void) DecompressTrainerFrontPic(trainerPicId, gActiveBattler); sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 2; - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBankSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; } static void OpponentHandleTrainerSlide(void) @@ -1388,27 +1388,27 @@ static void OpponentHandleTrainerSlide(void) DecompressTrainerFrontPic(trainerPicId, gActiveBattler); sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 96; - gSprites[gBankSpriteIds[gActiveBattler]].pos1.x += 32; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBankSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; } static void OpponentHandleTrainerSlideBack(void) { - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerFuncs[gActiveBattler] = sub_805F240; + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); + gBattlerControllerFuncs[gActiveBattler] = sub_805F240; } static void OpponentHandleFaintAnimation(void) @@ -1425,8 +1425,8 @@ static void OpponentHandleFaintAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT); - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_8039934; - gBattlerFuncs[gActiveBattler] = sub_805FAC4; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039934; + gBattlerControllerFuncs[gActiveBattler] = sub_805FAC4; } } } @@ -1471,7 +1471,7 @@ static void OpponentHandleMoveAnimation(void) else { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = OpponentDoMoveAnimation; + gBattlerControllerFuncs[gActiveBattler] = OpponentDoMoveAnimation; } } } @@ -1534,7 +1534,7 @@ static void OpponentHandlePrintString(void) stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]); BufferStringBattle(*stringId); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); - gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; sub_81A57E4(gActiveBattler, *stringId); } @@ -1558,7 +1558,7 @@ static void OpponentHandleChooseMove(void) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + BtlController_EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); OpponentBufferExecCompleted(); } else @@ -1575,24 +1575,24 @@ static void OpponentHandleChooseMove(void) switch (chosenMoveId) { case 5: - EmitTwoReturnValues(1, ACTION_WATCHES_CAREFULLY, 0); + BtlController_EmitTwoReturnValues(1, ACTION_WATCHES_CAREFULLY, 0); break; case 4: - EmitTwoReturnValues(1, ACTION_RUN, 0); + BtlController_EmitTwoReturnValues(1, ACTION_RUN, 0); break; case 6: - EmitTwoReturnValues(1, 15, gBattleDefender); + BtlController_EmitTwoReturnValues(1, 15, gBattleMoveTarget); break; default: if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER | MOVE_TARGET_x10)) - gBattleDefender = gActiveBattler; + gBattleMoveTarget = gActiveBattler; if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH) { - gBattleDefender = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - if (gAbsentBattlerFlags & gBitTable[gBattleDefender]) - gBattleDefender = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + if (gAbsentBattlerFlags & gBitTable[gBattleMoveTarget]) + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); } - EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBattleDefender << 8)); + BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBattleMoveTarget << 8)); break; } OpponentBufferExecCompleted(); @@ -1607,11 +1607,11 @@ static void OpponentHandleChooseMove(void) } while (move == MOVE_NONE); if (gBattleMoves[move].target & (MOVE_TARGET_USER | MOVE_TARGET_x10)) - EmitTwoReturnValues(1, 10, (chosenMoveId) | (gActiveBattler << 8)); + BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (gActiveBattler << 8)); else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) - EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8)); + BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8)); else - EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8)); + BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8)); OpponentBufferExecCompleted(); } @@ -1620,7 +1620,7 @@ static void OpponentHandleChooseMove(void) static void OpponentHandleChooseItem(void) { - EmitOneReturnValue(1, *(gBattleStruct->chosenItem + (gActiveBattler / 2) * 2)); + BtlController_EmitOneReturnValue(1, *(gBattleStruct->chosenItem + (gActiveBattler / 2) * 2)); OpponentBufferExecCompleted(); } @@ -1661,8 +1661,8 @@ static void OpponentHandleChoosePokemon(void) for (chosenMonId = firstId; chosenMonId < lastId; chosenMonId++) { if (GetMonData(&gEnemyParty[chosenMonId], MON_DATA_HP) != 0 - && chosenMonId != gBattlePartyID[bank1] - && chosenMonId != gBattlePartyID[bank2]) + && chosenMonId != gBattlerPartyIndexes[bank1] + && chosenMonId != gBattlerPartyIndexes[bank2]) { break; } @@ -1677,7 +1677,7 @@ static void OpponentHandleChoosePokemon(void) *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = chosenMonId; - EmitChosenMonReturnValue(1, chosenMonId, NULL); + BtlController_EmitChosenMonReturnValue(1, chosenMonId, NULL); OpponentBufferExecCompleted(); } @@ -1695,19 +1695,19 @@ static void OpponentHandleHealthBarUpdate(void) if (hpVal != INSTANT_HP_BAR_DROP) { - u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_HP); + u32 maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, curHP, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); } else { - u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); + u32 maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, 0, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); } - gBattlerFuncs[gActiveBattler] = CompleteOnHealthbarDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; } static void OpponentHandleExpUpdate(void) @@ -1721,10 +1721,10 @@ static void OpponentHandleStatusIconUpdate(void) { u8 bank; - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gEnemyParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_STATUS_ICON); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); bank = gActiveBattler; gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1734,7 +1734,7 @@ static void OpponentHandleStatusAnimation(void) { InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8) | (gBattleBufferA[gActiveBattler][4] << 16) | (gBattleBufferA[gActiveBattler][5] << 24)); - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1809,16 +1809,16 @@ static void OpponentHandleCmd40(void) static void OpponentHandleHitAnimation(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].invisible == TRUE) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) { OpponentBufferExecCompleted(); } else { gDoingBattleAnim = TRUE; - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; + gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; } } @@ -1857,7 +1857,7 @@ static void OpponentHandlePlayFanfareOrBGM(void) static void OpponentHandleFaintingCry(void) { - u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); PlayCry3(species, 25, 5); OpponentBufferExecCompleted(); @@ -1875,14 +1875,14 @@ static void OpponentHandleIntroTrainerBallThrow(void) u8 paletteNum; u8 taskId; - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], sub_806280C); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_806280C); taskId = CreateTask(sub_8062828, 5); gTasks[taskId].data[0] = gActiveBattler; @@ -1891,7 +1891,7 @@ static void OpponentHandleIntroTrainerBallThrow(void) gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30; gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerFuncs[gActiveBattler] = nullsub_26; + gBattlerControllerFuncs[gActiveBattler] = nullsub_26; } static void sub_806280C(struct Sprite *sprite) @@ -1908,24 +1908,24 @@ static void sub_8062828(u8 taskId) gActiveBattler = gTasks[taskId].data[0]; if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_80613DC(gActiveBattler, FALSE); } else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)) { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_80613DC(gActiveBattler, FALSE); } else { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_80613DC(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_80613DC(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerFuncs[gActiveBattler] = sub_805F560; + gBattlerControllerFuncs[gActiveBattler] = sub_805F560; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1959,7 +1959,7 @@ static void OpponentHandleDrawPartyStatusSummary(void) if (gBattleBufferA[gActiveBattler][2] != 0) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; - gBattlerFuncs[gActiveBattler] = sub_8062A2C; + gBattlerControllerFuncs[gActiveBattler] = sub_8062A2C; } } @@ -1986,9 +1986,9 @@ static void OpponentHandleCmd50(void) static void OpponentHandleSpriteInvisibility(void) { - if (IsBankSpritePresent(gActiveBattler)) + if (IsBattlerSpritePresent(gActiveBattler)) { - gSprites[gBankSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; + gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; CopyBattleSpriteInvisibility(gActiveBattler); } OpponentBufferExecCompleted(); @@ -2004,7 +2004,7 @@ static void OpponentHandleBattleAnimation(void) if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) OpponentBufferExecCompleted(); else - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; } } diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 8d52ee377..7a7f87e55 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -27,18 +27,18 @@ #include "pokeball.h" #include "data2.h" -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u8 gActiveBattler; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gAbsentBattlerFlags; extern u8 gBattlersCount; extern bool8 gDoingBattleAnim; extern u8 gPlayerDpadHoldFrames; -extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void); +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern void (*gPreBattleCallback1)(void); -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; extern u8 gMultiUsePlayerCursor; @@ -52,7 +52,7 @@ extern u8 gUnknown_0203CEE8; extern u8 gUnknown_0203CEE9; extern u8 gUnknown_0203CF00[]; extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleOutcome; extern u8 gNumberOfMovesToChoose; extern u16 gBattle_BG0_X; @@ -243,14 +243,14 @@ void nullsub_21(void) void SetControllerToPlayer(void) { - gBattlerFuncs[gActiveBattler] = PlayerBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = PlayerBufferRunCommand; gDoingBattleAnim = FALSE; gPlayerDpadHoldFrames = 0; } static void PlayerBufferExecCompleted(void) { - gBattlerFuncs[gActiveBattler] = PlayerBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = PlayerBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); @@ -260,13 +260,13 @@ static void PlayerBufferExecCompleted(void) } else { - gBattleExecBuffer &= ~gBitTable[gActiveBattler]; + gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; } } static void PlayerBufferRunCommand(void) { - if (gBattleExecBuffer & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) { if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sPlayerBufferCommands)) sPlayerBufferCommands[gBattleBufferA[gActiveBattler][0]](); @@ -277,7 +277,7 @@ static void PlayerBufferRunCommand(void) static void CompleteOnBankSpritePosX_0(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].pos2.x == 0) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) PlayerBufferExecCompleted(); } @@ -300,16 +300,16 @@ static void HandleInputChooseAction(void) switch (gActionSelectionCursor[gActiveBattler]) { case 0: - EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); + BtlController_EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); break; case 1: - EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); + BtlController_EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); break; case 2: - EmitTwoReturnValues(1, ACTION_SWITCH, 0); + BtlController_EmitTwoReturnValues(1, ACTION_SWITCH, 0); break; case 3: - EmitTwoReturnValues(1, ACTION_RUN, 0); + BtlController_EmitTwoReturnValues(1, ACTION_RUN, 0); break; } PlayerBufferExecCompleted(); @@ -370,7 +370,7 @@ static void HandleInputChooseAction(void) return; } PlaySE(SE_SELECT); - EmitTwoReturnValues(1, ACTION_CANCEL_PARTNER, 0); + BtlController_EmitTwoReturnValues(1, ACTION_CANCEL_PARTNER, 0); PlayerBufferExecCompleted(); } } @@ -384,7 +384,7 @@ static void sub_80577F0(void) // unused { dp11b_obj_free(gActiveBattler, 1); dp11b_obj_free(gActiveBattler, 0); - gBattlerFuncs[gActiveBattler] = HandleInputChooseTarget; + gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseTarget; } static void HandleInputChooseTarget(void) @@ -415,16 +415,16 @@ static void HandleInputChooseTarget(void) if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; - EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); dp11b_obj_free(gMultiUsePlayerCursor, 1); PlayerBufferExecCompleted(); } else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) { PlaySE(SE_SELECT); - gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; - gBattlerFuncs[gActiveBattler] = HandleInputChooseMove; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; dp11b_obj_instanciate(gActiveBattler, 1, 7, 1); dp11b_obj_instanciate(gActiveBattler, 0, 7, 1); dp11b_obj_free(gMultiUsePlayerCursor, 1); @@ -432,7 +432,7 @@ static void HandleInputChooseTarget(void) else if (gMain.newKeys & (DPAD_LEFT | DPAD_UP)) { PlaySE(SE_SELECT); - gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; do { @@ -457,7 +457,7 @@ static void HandleInputChooseTarget(void) case B_POSITION_PLAYER_RIGHT: if (gActiveBattler != gMultiUsePlayerCursor) i++; - else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER) + else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER) i++; break; case B_POSITION_OPPONENT_LEFT: @@ -469,12 +469,12 @@ static void HandleInputChooseTarget(void) if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor]) i = 0; } while (i == 0); - gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; } else if (gMain.newKeys & (DPAD_RIGHT | DPAD_DOWN)) { PlaySE(SE_SELECT); - gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C; do { @@ -499,7 +499,7 @@ static void HandleInputChooseTarget(void) case B_POSITION_PLAYER_RIGHT: if (gActiveBattler != gMultiUsePlayerCursor) i++; - else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER) + else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER) i++; break; case B_POSITION_OPPONENT_LEFT: @@ -511,7 +511,7 @@ static void HandleInputChooseTarget(void) if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor]) i = 0; } while (i == 0); - gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; } } @@ -570,12 +570,12 @@ static void HandleInputChooseMove(void) if (!canSelectTarget) { - EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); + BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); PlayerBufferExecCompleted(); } else { - gBattlerFuncs[gActiveBattler] = HandleInputChooseTarget; + gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseTarget; if (moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER)) gMultiUsePlayerCursor = gActiveBattler; @@ -584,13 +584,13 @@ static void HandleInputChooseMove(void) else gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; } } else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) { PlaySE(SE_SELECT); - EmitTwoReturnValues(1, 10, 0xFFFF); + BtlController_EmitTwoReturnValues(1, 10, 0xFFFF); PlayerBufferExecCompleted(); } else if (gMain.newKeys & DPAD_LEFT) @@ -656,7 +656,7 @@ static void HandleInputChooseMove(void) MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27); BattleHandleAddTextPrinter(gText_BattleSwitchWhich, 0xB); - gBattlerFuncs[gActiveBattler] = HandleMoveSwitchting; + gBattlerControllerFuncs[gActiveBattler] = HandleMoveSwitchting; } } } @@ -770,11 +770,11 @@ static void HandleMoveSwitchting(void) { for (i = 0; i < 4; i++) { - moveStruct.moves[i] = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MOVE1 + i); - moveStruct.currentPp[i] = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_PP1 + i); + moveStruct.moves[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + i); + moveStruct.currentPp[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP1 + i); } - totalPPBonuses = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_PP_BONUSES); + totalPPBonuses = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP_BONUSES); for (i = 0; i < 4; i++) perMovePPBonuses[i] = (totalPPBonuses & (3 << (i * 2))) >> (i * 2); @@ -796,15 +796,15 @@ static void HandleMoveSwitchting(void) for (i = 0; i < 4; i++) { - SetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MOVE1 + i, &moveStruct.moves[i]); - SetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_PP1 + i, &moveStruct.currentPp[i]); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + i, &moveStruct.moves[i]); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP1 + i, &moveStruct.currentPp[i]); } - SetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_PP_BONUSES, &totalPPBonuses); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_PP_BONUSES, &totalPPBonuses); } } - gBattlerFuncs[gActiveBattler] = HandleInputChooseMove; + gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; gMoveSelectionCursor[gActiveBattler] = gMultiUsePlayerCursor; MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); MoveSelectionDisplayPpString(); @@ -816,7 +816,7 @@ static void HandleMoveSwitchting(void) PlaySE(SE_SELECT); MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor); MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); - gBattlerFuncs[gActiveBattler] = HandleInputChooseMove; + gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; MoveSelectionDisplayPpString(); MoveSelectionDisplayPpNumber(); MoveSelectionDisplayMoveType(); @@ -938,7 +938,7 @@ void sub_80587B0(void) else sub_800ADF8(); - gBattlerFuncs[gActiveBattler] = sub_80586F8; + gBattlerControllerFuncs[gActiveBattler] = sub_80586F8; } } else @@ -953,23 +953,23 @@ void sub_80587B0(void) static void CompleteOnBankSpriteCallbackDummy(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) PlayerBufferExecCompleted(); } static void CompleteOnBankSpriteCallbackDummy2(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) PlayerBufferExecCompleted(); } static void sub_80588B4(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { nullsub_25(gSaveBlock2Ptr->playerGender); - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); PlayerBufferExecCompleted(); } } @@ -989,13 +989,13 @@ static void sub_805896C(void) if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) var = TRUE; } else { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) var = TRUE; } @@ -1009,13 +1009,13 @@ static void sub_805896C(void) FreeSpriteTilesByTag(0x27F9); FreeSpritePaletteByTag(0x27F9); - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); if (IsDoubleBattle()) - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerFuncs[gActiveBattler] = sub_8058924; + gBattlerControllerFuncs[gActiveBattler] = sub_8058924; } } @@ -1025,9 +1025,9 @@ static void sub_8058B40(void) bool32 r8 = FALSE; if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) - sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) - sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]]); + sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) { @@ -1035,13 +1035,13 @@ static void sub_8058B40(void) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); sub_8076918(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 1; } @@ -1065,7 +1065,7 @@ static void sub_8058B40(void) if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { r8 = TRUE; } @@ -1073,9 +1073,9 @@ static void sub_8058B40(void) else { if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { r8 = TRUE; } @@ -1091,15 +1091,15 @@ static void sub_8058B40(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; - gBattlerFuncs[gActiveBattler] = sub_805896C; + gBattlerControllerFuncs[gActiveBattler] = sub_805896C; } } static void sub_8058EDC(void) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { CopyBattleSpriteInvisibility(gActiveBattler); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 = 0; @@ -1110,7 +1110,7 @@ static void sub_8058EDC(void) if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerFuncs[gActiveBattler] = sub_8058FC0; + gBattlerControllerFuncs[gActiveBattler] = sub_8058FC0; } } @@ -1120,7 +1120,7 @@ static void sub_8058FC0(void) && !IsCryPlayingOrClearCrySongs()) { m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlayerBufferExecCompleted(); } } @@ -1130,17 +1130,17 @@ static void sub_805902C(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); } if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); - gBattlerFuncs[gActiveBattler] = sub_8058EDC; + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + gBattlerControllerFuncs[gActiveBattler] = sub_8058EDC; } } @@ -1155,17 +1155,17 @@ void c3_0802FDF4(u8 taskId) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBattler, gHealthBoxesIds[gActiveBattler], HEALTH_BAR, 0); + s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); if (hpValue != -1) { - UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], hpValue, HP_CURRENT); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], hpValue, HP_CURRENT); } else { - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlayerBufferExecCompleted(); } } @@ -1187,7 +1187,7 @@ static void Task_GiveExpToMon(u8 taskId) u8 bank = gTasks[taskId].tExpTask_bank; s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; - if (IsDoubleBattle() == TRUE || monId != gBattlePartyID[bank]) // give exp without the expbar + if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[bank]) // give exp without the expbar { struct Pokemon *mon = &gPlayerParty[monId]; u16 species = GetMonData(mon, MON_DATA_SPECIES); @@ -1204,11 +1204,11 @@ static void Task_GiveExpToMon(u8 taskId) gainedExp -= nextLvlExp - currExp; savedActiveBank = gActiveBattler; gActiveBattler = bank; - EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); + BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); gActiveBattler = savedActiveBank; if (IsDoubleBattle() == TRUE - && ((u16)(monId) == gBattlePartyID[bank] || (u16)(monId) == gBattlePartyID[bank ^ BIT_FLANK])) + && ((u16)(monId) == gBattlerPartyIndexes[bank] || (u16)(monId) == gBattlerPartyIndexes[bank ^ BIT_FLANK])) gTasks[taskId].func = sub_8059544; else gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; @@ -1217,7 +1217,7 @@ static void Task_GiveExpToMon(u8 taskId) { currExp += gainedExp; SetMonData(mon, MON_DATA_EXP, &currExp); - gBattlerFuncs[bank] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter; DestroyTask(taskId); } } @@ -1241,7 +1241,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId) exp -= currLvlExp; expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp; - SetBattleBarStruct(bank, gHealthBoxesIds[bank], expToNextLvl, exp, -gainedExp); + SetBattleBarStruct(bank, gHealthboxSpriteIds[bank], expToNextLvl, exp, -gainedExp); PlaySE(SE_EXP); gTasks[taskId].func = sub_8059400; } @@ -1259,8 +1259,8 @@ static void sub_8059400(u8 taskId) u8 bank = gTasks[taskId].tExpTask_bank; s16 r4; - r4 = sub_8074AA0(bank, gHealthBoxesIds[bank], EXP_BAR, 0); - SetHealthboxSpriteVisible(gHealthBoxesIds[bank]); + r4 = sub_8074AA0(bank, gHealthboxSpriteIds[bank], EXP_BAR, 0); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[bank]); if (r4 == -1) { u8 level; @@ -1283,7 +1283,7 @@ static void sub_8059400(u8 taskId) gainedExp -= expOnNextLvl - currExp; savedActiveBank = gActiveBattler; gActiveBattler = bank; - EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); + BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); gActiveBattler = savedActiveBank; gTasks[taskId].func = sub_8059544; } @@ -1291,7 +1291,7 @@ static void sub_8059400(u8 taskId) { currExp += gainedExp; SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp); - gBattlerFuncs[bank] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter; DestroyTask(taskId); } } @@ -1303,7 +1303,7 @@ static void sub_8059544(u8 taskId) u8 bank = gTasks[taskId].tExpTask_bank; u8 monIndex = gTasks[taskId].tExpTask_monId; - if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_FLANK]) + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK]) bank ^= BIT_FLANK; InitAndLaunchSpecialAnimation(bank, bank, bank, B_ANIM_LVL_UP); @@ -1320,10 +1320,10 @@ static void sub_80595A4(u8 taskId) GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value - if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_FLANK]) - UpdateHealthboxAttribute(gHealthBoxesIds[bank ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL); + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK]) + UpdateHealthboxAttribute(gHealthboxSpriteIds[bank ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL); else - UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL); gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; } @@ -1337,20 +1337,20 @@ static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) monIndex = gTasks[taskId].tExpTask_monId; GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value bank = gTasks[taskId].tExpTask_bank; - gBattlerFuncs[bank] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter; DestroyTask(taskId); } static void sub_80596A8(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].pos1.y + gSprites[gBankSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) { - u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); nullsub_24(species); - FreeOamMatrix(gSprites[gBankSpriteIds[gActiveBattler]].oam.matrixNum); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); PlayerBufferExecCompleted(); } } @@ -1359,9 +1359,9 @@ static void sub_8059744(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); PlayerBufferExecCompleted(); } } @@ -1378,7 +1378,7 @@ static void sub_80597CC(void) { u8 r4; - gBattlerFuncs[gActiveBattler] = sub_8059828; + gBattlerControllerFuncs[gActiveBattler] = sub_8059828; r4 = gTasks[gUnknown_03005D7C[gActiveBattler]].data[0]; DestroyTask(gUnknown_03005D7C[gActiveBattler]); FreeAllWindowBuffers(); @@ -1391,9 +1391,9 @@ static void sub_8059828(void) if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { if (gUnknown_0203CEE8 == 1) - EmitChosenMonReturnValue(1, gUnknown_0203CEE9, gUnknown_0203CF00); + BtlController_EmitChosenMonReturnValue(1, gUnknown_0203CEE9, gUnknown_0203CF00); else - EmitChosenMonReturnValue(1, 6, NULL); + BtlController_EmitChosenMonReturnValue(1, 6, NULL); if ((gBattleBufferA[gActiveBattler][1] & 0xF) == 1) PrintLinkStandbyMsg(); @@ -1406,7 +1406,7 @@ static void OpenBagAndChooseItem(void) { if (!gPaletteFade.active) { - gBattlerFuncs[gActiveBattler] = CompleteWhenChoseItem; + gBattlerControllerFuncs[gActiveBattler] = CompleteWhenChoseItem; nullsub_35(); FreeAllWindowBuffers(); sub_81AABB0(); @@ -1417,7 +1417,7 @@ static void CompleteWhenChoseItem(void) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - EmitOneReturnValue(1, gSpecialVar_ItemId); + BtlController_EmitOneReturnValue(1, gSpecialVar_ItemId); PlayerBufferExecCompleted(); } } @@ -1430,7 +1430,7 @@ static void CompleteOnSpecialAnimDone(void) static void DoHitAnimBlinkSpriteEffect(void) { - u8 spriteId = gBankSpriteIds[gActiveBattler]; + u8 spriteId = gBattlerSpriteIds[gActiveBattler]; if (gSprites[spriteId].data[1] == 32) { @@ -1469,9 +1469,9 @@ static void PlayerHandleUnknownYesNoInput(void) PlaySE(SE_SELECT); if (gMultiUsePlayerCursor != 0) - EmitTwoReturnValues(1, 0xE, 0); + BtlController_EmitTwoReturnValues(1, 0xE, 0); else - EmitTwoReturnValues(1, 0xD, 0); + BtlController_EmitTwoReturnValues(1, 0xD, 0); PlayerBufferExecCompleted(); } @@ -1621,7 +1621,7 @@ static void PlayerHandleGetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - size += CopyPlayerMonData(gBattlePartyID[gActiveBattler], monData); + size += CopyPlayerMonData(gBattlerPartyIndexes[gActiveBattler], monData); } else { @@ -1633,7 +1633,7 @@ static void PlayerHandleGetMonData(void) monToCheck >>= 1; } } - EmitDataTransfer(1, size, monData); + BtlController_EmitDataTransfer(1, size, monData); PlayerBufferExecCompleted(); } @@ -1946,14 +1946,14 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst) void PlayerHandleGetRawMonData(void) { struct BattlePokemon battleMon; - u8 *src = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; + u8 *src = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; u8 *dst = (u8 *)&battleMon + gBattleBufferA[gActiveBattler][1]; u8 i; for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++) dst[i] = src[i]; - EmitDataTransfer(1, gBattleBufferA[gActiveBattler][2], dst); + BtlController_EmitDataTransfer(1, gBattleBufferA[gActiveBattler][2], dst); PlayerBufferExecCompleted(); } @@ -1964,7 +1964,7 @@ static void PlayerHandleSetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - SetPlayerMonData(gBattlePartyID[gActiveBattler]); + SetPlayerMonData(gBattlerPartyIndexes[gActiveBattler]); } else { @@ -2194,12 +2194,12 @@ static void SetPlayerMonData(u8 monId) break; } - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); } static void PlayerHandleSetRawMonData(void) { - u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; + u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; u8 i; for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++) @@ -2210,20 +2210,20 @@ static void PlayerHandleSetRawMonData(void) static void PlayerHandleLoadMonSprite(void) { - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpritePosX_0; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpritePosX_0; } static void PlayerHandleSwitchInAnim(void) { ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlePartyID[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + gBattlerPartyIndexes[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); gActionSelectionCursor[gActiveBattler] = 0; gMoveSelectionCursor[gActiveBattler] = 0; sub_805B258(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlerFuncs[gActiveBattler] = sub_805902C; + gBattlerControllerFuncs[gActiveBattler] = sub_805902C; } static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit) @@ -2231,28 +2231,28 @@ static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit) u16 species; ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); - gBattlePartyID[bank] = gBattleBufferA[bank][1]; - species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); sub_806A068(species, GetBattlerPosition(bank)); - gBankSpriteIds[bank] = CreateSprite( + gBattlerSpriteIds[bank] = CreateSprite( &gUnknown_0202499C, - GetBankCoord(bank, 2), - GetBankSpriteDefault_Y(bank), + GetBattlerSpriteCoord(bank, 2), + GetBattlerSpriteDefault_Y(bank), sub_80A82E4(bank)); - gSprites[gUnknown_03005D7C[bank]].data[1] = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank]; gSprites[gUnknown_03005D7C[bank]].data[2] = bank; - gSprites[gBankSpriteIds[bank]].data[0] = bank; - gSprites[gBankSpriteIds[bank]].data[2] = species; - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].data[2] = species; + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; - StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]); - gSprites[gBankSpriteIds[bank]].invisible = TRUE; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[bank]].invisible = TRUE; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); } @@ -2262,13 +2262,13 @@ static void PlayerHandleReturnMonToBall(void) if (gBattleBufferA[gActiveBattler][1] == 0) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = DoSwitchOutAnimation; + gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; } else { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); PlayerBufferExecCompleted(); } } @@ -2288,7 +2288,7 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerFuncs[gActiveBattler] = sub_8059744; + gBattlerControllerFuncs[gActiveBattler] = sub_8059744; } break; } @@ -2354,30 +2354,30 @@ static void PlayerHandleDrawTrainerPic(void) trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); DecompressTrainerFrontPic(trainerPicId, gActiveBattler); sub_806A1C0(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBankSpriteIds[gActiveBattler]].pos2.y = 48; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gSprites[gBankSpriteIds[gActiveBattler]].oam.affineMode = 0; - gSprites[gBankSpriteIds[gActiveBattler]].hFlip = 1; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y = 48; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1; } // use the back pic in any other scenario else { DecompressTrainerBackPic(trainerPicId, gActiveBattler); sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; } - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; } static void PlayerHandleTrainerSlide(void) @@ -2408,26 +2408,26 @@ static void PlayerHandleTrainerSlide(void) DecompressTrainerBackPic(trainerPicId, gActiveBattler); sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -96; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 2; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -96; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; } static void PlayerHandleTrainerSlideBack(void) { - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1); - gBattlerFuncs[gActiveBattler] = sub_80588B4; + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); + gBattlerControllerFuncs[gActiveBattler] = sub_80588B4; } static void PlayerHandleFaintAnimation(void) @@ -2443,12 +2443,12 @@ static void PlayerHandleFaintAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER); - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 5; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_8039C00; - gBattlerFuncs[gActiveBattler] = sub_80596A8; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00; + gBattlerControllerFuncs[gActiveBattler] = sub_80596A8; } } } @@ -2464,7 +2464,7 @@ static void PlayerHandleSuccessBallThrowAnim(void) gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; gDoingBattleAnim = TRUE; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW); - gBattlerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; } static void PlayerHandleBallThrowAnim(void) @@ -2474,7 +2474,7 @@ static void PlayerHandleBallThrowAnim(void) gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; gDoingBattleAnim = TRUE; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW); - gBattlerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; } static void PlayerHandlePause(void) @@ -2508,7 +2508,7 @@ static void PlayerHandleMoveAnimation(void) else { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = PlayerDoMoveAnimation; + gBattlerControllerFuncs[gActiveBattler] = PlayerDoMoveAnimation; sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); } } @@ -2572,7 +2572,7 @@ static void PlayerHandlePrintString(void) stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]); BufferStringBattle(*stringId); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); - gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2; sub_817C95C(*stringId); sub_81A57E4(gActiveBattler, *stringId); } @@ -2591,7 +2591,7 @@ static void HandleChooseActionAfterDma3(void) { gBattle_BG0_X = 0; gBattle_BG0_Y = 160; - gBattlerFuncs[gActiveBattler] = HandleInputChooseAction; + gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseAction; } } @@ -2599,7 +2599,7 @@ static void PlayerHandleChooseAction(void) { s32 i; - gBattlerFuncs[gActiveBattler] = HandleChooseActionAfterDma3; + gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3; sub_817F2A8(); BattleHandleAddTextPrinter(gText_BattleMenu, 2); @@ -2619,7 +2619,7 @@ static void PlayerHandleUnknownYesNoBox(void) BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 12); gMultiUsePlayerCursor = 1; BattleCreateYesNoCursorAt(1); - gBattlerFuncs[gActiveBattler] = PlayerHandleUnknownYesNoInput; + gBattlerControllerFuncs[gActiveBattler] = PlayerHandleUnknownYesNoInput; } else { @@ -2633,7 +2633,7 @@ static void HandleChooseMoveAfterDma3(void) { gBattle_BG0_X = 0; gBattle_BG0_Y = 320; - gBattlerFuncs[gActiveBattler] = HandleInputChooseMove; + gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; } } @@ -2642,7 +2642,7 @@ static void PlayerChooseMoveInBattlePalace(void) if (--*(gBattleStruct->field_298 + gActiveBattler) == 0) { gBattlePalaceMoveSelectionRngValue = gRngValue; - EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + BtlController_EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); PlayerBufferExecCompleted(); } } @@ -2652,12 +2652,12 @@ static void PlayerHandleChooseMove(void) if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { *(gBattleStruct->field_298 + gActiveBattler) = 8; - gBattlerFuncs[gActiveBattler] = PlayerChooseMoveInBattlePalace; + gBattlerControllerFuncs[gActiveBattler] = PlayerChooseMoveInBattlePalace; } else { InitMoveSelectionsVarsAndStrings(); - gBattlerFuncs[gActiveBattler] = HandleChooseMoveAfterDma3; + gBattlerControllerFuncs[gActiveBattler] = HandleChooseMoveAfterDma3; } } @@ -2676,7 +2676,7 @@ static void PlayerHandleChooseItem(void) s32 i; BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); - gBattlerFuncs[gActiveBattler] = OpenBagAndChooseItem; + gBattlerControllerFuncs[gActiveBattler] = OpenBagAndChooseItem; gBankInMenu = gActiveBattler; for (i = 0; i < 3; i++) @@ -2692,7 +2692,7 @@ static void PlayerHandleChoosePokemon(void) if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleBufferA[gActiveBattler][1] & 0xF) != 2) { - EmitChosenMonReturnValue(1, gBattlePartyID[gActiveBattler] + 1, gUnknown_0203CF00); + BtlController_EmitChosenMonReturnValue(1, gBattlerPartyIndexes[gActiveBattler] + 1, gUnknown_0203CF00); PlayerBufferExecCompleted(); } else @@ -2703,7 +2703,7 @@ static void PlayerHandleChoosePokemon(void) *(&gBattleStruct->field_8B) = gBattleBufferA[gActiveBattler][2]; *(&gBattleStruct->field_B0) = gBattleBufferA[gActiveBattler][3]; BeginNormalPaletteFade(-1, 0, 0, 16, 0); - gBattlerFuncs[gActiveBattler] = sub_80597CC; + gBattlerControllerFuncs[gActiveBattler] = sub_80597CC; gBankInMenu = gActiveBattler; } } @@ -2727,20 +2727,20 @@ static void PlayerHandleHealthBarUpdate(void) if (hpVal != INSTANT_HP_BAR_DROP) { - u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_HP); + u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, curHP, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); } else { - u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); + u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, 0, hpVal); - UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], 0, HP_CURRENT); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], 0, HP_CURRENT); } - gBattlerFuncs[gActiveBattler] = CompleteOnHealthbarDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; } static void PlayerHandleExpUpdate(void) @@ -2763,7 +2763,7 @@ static void PlayerHandleExpUpdate(void) gTasks[taskId].tExpTask_monId = monId; gTasks[taskId].tExpTask_gainedExp = expPointsToGive; gTasks[taskId].tExpTask_bank = gActiveBattler; - gBattlerFuncs[gActiveBattler] = nullsub_21; + gBattlerControllerFuncs[gActiveBattler] = nullsub_21; } } @@ -2778,10 +2778,10 @@ static void PlayerHandleStatusIconUpdate(void) { u8 bank; - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_STATUS_ICON); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); bank = gActiveBattler; gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -2791,15 +2791,15 @@ static void PlayerHandleStatusAnimation(void) { InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8) | (gBattleBufferA[gActiveBattler][4] << 16) | (gBattleBufferA[gActiveBattler][5] << 24)); - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } static void PlayerHandleStatusXor(void) { - u8 val = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_STATUS) ^ gBattleBufferA[gActiveBattler][1]; + u8 val = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_STATUS) ^ gBattleBufferA[gActiveBattler][1]; - SetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_STATUS, &val); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_STATUS, &val); PlayerBufferExecCompleted(); } @@ -2848,25 +2848,25 @@ static void PlayerHandleCmd32(void) static void PlayerHandleTwoReturnValues(void) { - EmitTwoReturnValues(1, 0, 0); + BtlController_EmitTwoReturnValues(1, 0, 0); PlayerBufferExecCompleted(); } static void PlayerHandleChosenMonReturnValue(void) { - EmitChosenMonReturnValue(1, 0, NULL); + BtlController_EmitChosenMonReturnValue(1, 0, NULL); PlayerBufferExecCompleted(); } static void PlayerHandleOneReturnValue(void) { - EmitOneReturnValue(1, 0); + BtlController_EmitOneReturnValue(1, 0); PlayerBufferExecCompleted(); } static void PlayerHandleOneReturnValue_Duplicate(void) { - EmitOneReturnValue_Duplicate(1, 0); + BtlController_EmitOneReturnValue_Duplicate(1, 0); PlayerBufferExecCompleted(); } @@ -2896,16 +2896,16 @@ static void PlayerHandleCmd40(void) static void PlayerHandleHitAnimation(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].invisible == TRUE) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) { PlayerBufferExecCompleted(); } else { gDoingBattleAnim = TRUE; - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; + gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; } } @@ -2944,7 +2944,7 @@ static void PlayerHandlePlayFanfareOrBGM(void) static void PlayerHandleFaintingCry(void) { - u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); PlayCry3(species, -25, 5); PlayerBufferExecCompleted(); @@ -2962,20 +2962,20 @@ static void PlayerHandleIntroTrainerBallThrow(void) u8 paletteNum; u8 taskId; - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - gSprites[gBankSpriteIds[gActiveBattler]].data[5] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], sub_805CC00); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F8); LoadCompressedPalette(gTrainerBackPicPaletteTable[gSaveBlock2Ptr->playerGender].data, 0x100 + paletteNum * 16, 32); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; taskId = CreateTask(task05_08033660, 5); gTasks[taskId].data[0] = gActiveBattler; @@ -2984,7 +2984,7 @@ static void PlayerHandleIntroTrainerBallThrow(void) gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30; gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerFuncs[gActiveBattler] = nullsub_21; + gBattlerControllerFuncs[gActiveBattler] = nullsub_21; } void sub_805CC00(struct Sprite *sprite) @@ -2994,8 +2994,8 @@ void sub_805CC00(struct Sprite *sprite) FreeSpriteOamMatrix(sprite); FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum)); DestroySprite(sprite); - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[bank]], bank); - StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], 0); + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[bank]], bank); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], 0); } static void task05_08033660(u8 taskId) @@ -3011,20 +3011,20 @@ static void task05_08033660(u8 taskId) gActiveBattler = gTasks[taskId].data[0]; if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_805B258(gActiveBattler, FALSE); } else { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_805B258(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); sub_805B258(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerFuncs[gActiveBattler] = sub_8058B40; + gBattlerControllerFuncs[gActiveBattler] = sub_8058B40; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -3045,7 +3045,7 @@ static void PlayerHandleDrawPartyStatusSummary(void) if (gBattleBufferA[gActiveBattler][2] != 0) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; - gBattlerFuncs[gActiveBattler] = sub_805CE38; + gBattlerControllerFuncs[gActiveBattler] = sub_805CE38; } } @@ -3074,9 +3074,9 @@ static void PlayerHandleCmd50(void) static void PlayerHandleSpriteInvisibility(void) { - if (IsBankSpritePresent(gActiveBattler)) + if (IsBattlerSpritePresent(gActiveBattler)) { - gSprites[gBankSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; + gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; CopyBattleSpriteInvisibility(gActiveBattler); } PlayerBufferExecCompleted(); @@ -3092,7 +3092,7 @@ static void PlayerHandleBattleAnimation(void) if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) PlayerBufferExecCompleted(); else - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; sub_817E32C(animationId); } @@ -3143,7 +3143,7 @@ static void PlayerHandleCmd55(void) FadeOutMapMusic(5); BeginFastPaletteFade(3); PlayerBufferExecCompleted(); - gBattlerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; } static void nullsub_22(void) diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index 2b21dab94..c44a8d31e 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -23,21 +23,21 @@ #include "pokeball.h" #include "data2.h" -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u8 gActiveBattler; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gBattlersCount; extern bool8 gDoingBattleAnim; -extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void); +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern void (*gPreBattleCallback1)(void); -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; extern struct SpriteTemplate gUnknown_0202499C; extern u16 gSpecialVar_ItemId; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleOutcome; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; @@ -47,7 +47,7 @@ extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; extern u16 gPartnerTrainerId; extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); -extern u8 gBattleDefender; +extern u8 gBattleMoveTarget; extern u8 gAbsentBattlerFlags; extern u8 gUnknown_020244B4[]; extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT]; @@ -213,12 +213,12 @@ static void nullsub_77(void) void SetControllerToPlayerPartner(void) { - gBattlerFuncs[gActiveBattler] = PlayerPartnerBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerBufferRunCommand; } static void PlayerPartnerBufferRunCommand(void) { - if (gBattleExecBuffer & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) { if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sPlayerPartnerBufferCommands)) sPlayerPartnerBufferCommands[gBattleBufferA[gActiveBattler][0]](); @@ -229,17 +229,17 @@ static void PlayerPartnerBufferRunCommand(void) static void CompleteOnBankSpriteCallbackDummy(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) PlayerPartnerBufferExecCompleted(); } static void sub_81BAE98(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { nullsub_25(0); - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); PlayerPartnerBufferExecCompleted(); } } @@ -259,13 +259,13 @@ static void sub_81BAF48(void) if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) r6 = TRUE; } else { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { r6 = TRUE; } @@ -277,7 +277,7 @@ static void sub_81BAF48(void) if (r6) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerFuncs[gActiveBattler] = sub_81BAF00; + gBattlerControllerFuncs[gActiveBattler] = sub_81BAF00; } } @@ -286,7 +286,7 @@ static void sub_81BB02C(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive && gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 != 1) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; @@ -294,41 +294,41 @@ static void sub_81BB02C(void) if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); sub_8076918(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); gBattleSpritesDataPtr->animationData->field_9_x1 = 0; - gBattlerFuncs[gActiveBattler] = sub_81BAF48; + gBattlerControllerFuncs[gActiveBattler] = sub_81BAF48; } } static void sub_81BB1D4(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].animEnded && gSprites[gBankSpriteIds[gActiveBattler]].pos2.x == 0) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) PlayerPartnerBufferExecCompleted(); } static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBattler, gHealthBoxesIds[gActiveBattler], HEALTH_BAR, 0); + s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); if (hpValue != -1) { - UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], hpValue, HP_CURRENT); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], hpValue, HP_CURRENT); } else { - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlayerPartnerBufferExecCompleted(); } } @@ -351,7 +351,7 @@ static void Task_GiveExpToMon(u8 taskId) u8 bank = gTasks[taskId].tExpTask_bank; s16 gainedExp = gTasks[taskId].tExpTask_gainedExp; - if (IsDoubleBattle() == TRUE || monId != gBattlePartyID[bank]) // give exp without the expbar + if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[bank]) // give exp without the expbar { struct Pokemon *mon = &gPlayerParty[monId]; u16 species = GetMonData(mon, MON_DATA_SPECIES); @@ -368,11 +368,11 @@ static void Task_GiveExpToMon(u8 taskId) gainedExp -= nextLvlExp - currExp; savedActiveBank = gActiveBattler; gActiveBattler = bank; - EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); + BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); gActiveBattler = savedActiveBank; if (IsDoubleBattle() == TRUE - && ((u16)(monId) == gBattlePartyID[bank] || (u16)(monId) == gBattlePartyID[bank ^ BIT_FLANK])) + && ((u16)(monId) == gBattlerPartyIndexes[bank] || (u16)(monId) == gBattlerPartyIndexes[bank ^ BIT_FLANK])) gTasks[taskId].func = sub_81BB628; else gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; @@ -381,7 +381,7 @@ static void Task_GiveExpToMon(u8 taskId) { currExp += gainedExp; SetMonData(mon, MON_DATA_EXP, &currExp); - gBattlerFuncs[bank] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter; DestroyTask(taskId); } } @@ -405,7 +405,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId) exp -= currLvlExp; expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp; - SetBattleBarStruct(bank, gHealthBoxesIds[bank], expToNextLvl, exp, -gainedExp); + SetBattleBarStruct(bank, gHealthboxSpriteIds[bank], expToNextLvl, exp, -gainedExp); PlaySE(SE_EXP); gTasks[taskId].func = sub_81BB4E4; } @@ -423,8 +423,8 @@ static void sub_81BB4E4(u8 taskId) u8 bank = gTasks[taskId].tExpTask_bank; s16 r4; - r4 = sub_8074AA0(bank, gHealthBoxesIds[bank], EXP_BAR, 0); - SetHealthboxSpriteVisible(gHealthBoxesIds[bank]); + r4 = sub_8074AA0(bank, gHealthboxSpriteIds[bank], EXP_BAR, 0); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[bank]); if (r4 == -1) { u8 level; @@ -447,7 +447,7 @@ static void sub_81BB4E4(u8 taskId) gainedExp -= expOnNextLvl - currExp; savedActiveBank = gActiveBattler; gActiveBattler = bank; - EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); + BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp); gActiveBattler = savedActiveBank; gTasks[taskId].func = sub_81BB628; } @@ -455,7 +455,7 @@ static void sub_81BB4E4(u8 taskId) { currExp += gainedExp; SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &currExp); - gBattlerFuncs[bank] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter; DestroyTask(taskId); } } @@ -467,7 +467,7 @@ static void sub_81BB628(u8 taskId) u8 bank = gTasks[taskId].tExpTask_bank; u8 monIndex = gTasks[taskId].tExpTask_monId; - if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_FLANK]) + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK]) bank ^= BIT_FLANK; InitAndLaunchSpecialAnimation(bank, bank, bank, B_ANIM_LVL_UP); @@ -484,10 +484,10 @@ static void sub_81BB688(u8 taskId) GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value - if (IsDoubleBattle() == TRUE && monIndex == gBattlePartyID[bank ^ BIT_FLANK]) - UpdateHealthboxAttribute(gHealthBoxesIds[bank ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL); + if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[bank ^ BIT_FLANK]) + UpdateHealthboxAttribute(gHealthboxSpriteIds[bank ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL); else - UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[bank], &gPlayerParty[monIndex], HEALTHBOX_ALL); gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; } @@ -501,20 +501,20 @@ static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) monIndex = gTasks[taskId].tExpTask_monId; GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value bank = gTasks[taskId].tExpTask_bank; - gBattlerFuncs[bank] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[bank] = CompleteOnInactiveTextPrinter; DestroyTask(taskId); } static void sub_81BB78C(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].pos1.y + gSprites[gBankSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) { - u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); nullsub_24(species); - FreeOamMatrix(gSprites[gBankSpriteIds[gActiveBattler]].oam.matrixNum); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); PlayerPartnerBufferExecCompleted(); } } @@ -523,9 +523,9 @@ static void sub_81BB828(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); PlayerPartnerBufferExecCompleted(); } } @@ -538,7 +538,7 @@ static void CompleteOnInactiveTextPrinter2(void) static void DoHitAnimBlinkSpriteEffect(void) { - u8 spriteId = gBankSpriteIds[gActiveBattler]; + u8 spriteId = gBattlerSpriteIds[gActiveBattler]; if (gSprites[spriteId].data[1] == 32) { @@ -557,20 +557,20 @@ static void DoHitAnimBlinkSpriteEffect(void) static void sub_81BB92C(void) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { CopyBattleSpriteInvisibility(gActiveBattler); if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerFuncs[gActiveBattler] = sub_81BB9A0; + gBattlerControllerFuncs[gActiveBattler] = sub_81BB9A0; } } static void sub_81BB9A0(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { PlayerPartnerBufferExecCompleted(); } @@ -587,13 +587,13 @@ static void sub_81BB9F4(void) FreeSpritePaletteByTag(0x27F9); CreateTask(c3_0802FDF4, 10); - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 0); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattlerFuncs[gActiveBattler] = sub_81BB92C; + gBattlerControllerFuncs[gActiveBattler] = sub_81BB92C; } } @@ -602,20 +602,20 @@ static void sub_81BBAE8(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); } if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - gBattlerFuncs[gActiveBattler] = sub_81BB9F4; + gBattlerControllerFuncs[gActiveBattler] = sub_81BB9F4; } } static void PlayerPartnerBufferExecCompleted(void) { - gBattlerFuncs[gActiveBattler] = PlayerPartnerBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); @@ -625,7 +625,7 @@ static void PlayerPartnerBufferExecCompleted(void) } else { - gBattleExecBuffer &= ~gBitTable[gActiveBattler]; + gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; } } @@ -650,7 +650,7 @@ static void PlayerPartnerHandleGetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - size += CopyPlayerPartnerMonData(gBattlePartyID[gActiveBattler], monData); + size += CopyPlayerPartnerMonData(gBattlerPartyIndexes[gActiveBattler], monData); } else { @@ -662,7 +662,7 @@ static void PlayerPartnerHandleGetMonData(void) monToCheck >>= 1; } } - EmitDataTransfer(1, size, monData); + BtlController_EmitDataTransfer(1, size, monData); PlayerPartnerBufferExecCompleted(); } @@ -984,7 +984,7 @@ static void PlayerPartnerHandleSetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - SetPlayerPartnerMonData(gBattlePartyID[gActiveBattler]); + SetPlayerPartnerMonData(gBattlerPartyIndexes[gActiveBattler]); } else { @@ -1214,12 +1214,12 @@ static void SetPlayerPartnerMonData(u8 monId) break; } - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); } static void PlayerPartnerHandleSetRawMonData(void) { - u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; + u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; u8 i; for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++) @@ -1232,28 +1232,28 @@ static void PlayerPartnerHandleLoadMonSprite(void) { u16 species; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); - species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); sub_806A068(species, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, - GetBankCoord(gActiveBattler, 2), - GetBankSpriteDefault_Y(gActiveBattler), + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, + GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteDefault_Y(gActiveBattler), sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - gBattlerFuncs[gActiveBattler] = sub_81BB1D4; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); + gBattlerControllerFuncs[gActiveBattler] = sub_81BB1D4; } static void PlayerPartnerHandleSwitchInAnim(void) { ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlePartyID[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + gBattlerPartyIndexes[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); sub_81BD0E4(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlerFuncs[gActiveBattler] = sub_81BBAE8; + gBattlerControllerFuncs[gActiveBattler] = sub_81BBAE8; } static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit) @@ -1261,28 +1261,28 @@ static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit) u16 species; ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); - gBattlePartyID[bank] = gBattleBufferA[bank][1]; - species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); sub_806A068(species, GetBattlerPosition(bank)); - gBankSpriteIds[bank] = CreateSprite( + gBattlerSpriteIds[bank] = CreateSprite( &gUnknown_0202499C, - GetBankCoord(bank, 2), - GetBankSpriteDefault_Y(bank), + GetBattlerSpriteCoord(bank, 2), + GetBattlerSpriteDefault_Y(bank), sub_80A82E4(bank)); - gSprites[gUnknown_03005D7C[bank]].data[1] = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank]; gSprites[gUnknown_03005D7C[bank]].data[2] = bank; - gSprites[gBankSpriteIds[bank]].data[0] = bank; - gSprites[gBankSpriteIds[bank]].data[2] = species; - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].data[2] = species; + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; - StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]); - gSprites[gBankSpriteIds[bank]].invisible = TRUE; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[bank]].invisible = TRUE; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); } @@ -1292,13 +1292,13 @@ static void PlayerPartnerHandleReturnMonToBall(void) if (gBattleBufferA[gActiveBattler][1] == 0) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = DoSwitchOutAnimation; + gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; } else { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); PlayerPartnerBufferExecCompleted(); } } @@ -1318,7 +1318,7 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerFuncs[gActiveBattler] = sub_81BB828; + gBattlerControllerFuncs[gActiveBattler] = sub_81BB828; } break; } @@ -1350,29 +1350,29 @@ static void PlayerPartnerHandleDrawTrainerPic(void) { DecompressTrainerBackPic(trainerPicId, gActiveBattler); sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; } else // otherwise use front sprite { DecompressTrainerFrontPic(trainerPicId, gActiveBattler); sub_806A1C0(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBankSpriteIds[gActiveBattler]].pos2.y = 48; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gSprites[gBankSpriteIds[gActiveBattler]].oam.affineMode = 0; - gSprites[gBankSpriteIds[gActiveBattler]].hFlip = 1; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y = 48; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1; } - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; } static void PlayerPartnerHandleTrainerSlide(void) @@ -1382,13 +1382,13 @@ static void PlayerPartnerHandleTrainerSlide(void) static void PlayerPartnerHandleTrainerSlideBack(void) { - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerFuncs[gActiveBattler] = sub_81BAE98; + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); + gBattlerControllerFuncs[gActiveBattler] = sub_81BAE98; } static void PlayerPartnerHandleFaintAnimation(void) @@ -1404,12 +1404,12 @@ static void PlayerPartnerHandleFaintAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER); - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 5; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_8039C00; - gBattlerFuncs[gActiveBattler] = sub_81BB78C; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00; + gBattlerControllerFuncs[gActiveBattler] = sub_81BB78C; } } } @@ -1454,7 +1454,7 @@ static void PlayerPartnerHandleMoveAnimation(void) else { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = PlayerPartnerDoMoveAnimation; + gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerDoMoveAnimation; } } } @@ -1517,7 +1517,7 @@ static void PlayerPartnerHandlePrintString(void) stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]); BufferStringBattle(*stringId); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); - gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2; } static void PlayerPartnerHandlePrintSelectionString(void) @@ -1545,15 +1545,15 @@ static void PlayerPartnerHandleChooseMove(void) chosenMoveId = BattleAI_ChooseMoveOrAction(); if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_x10 | MOVE_TARGET_USER)) - gBattleDefender = gActiveBattler; + gBattleMoveTarget = gActiveBattler; if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH) { - gBattleDefender = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - if (gAbsentBattlerFlags & gBitTable[gBattleDefender]) - gBattleDefender = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + if (gAbsentBattlerFlags & gBitTable[gBattleMoveTarget]) + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); } - EmitTwoReturnValues(1, 10, chosenMoveId | (gBattleDefender << 8)); + BtlController_EmitTwoReturnValues(1, 10, chosenMoveId | (gBattleMoveTarget << 8)); PlayerPartnerBufferExecCompleted(); } @@ -1574,8 +1574,8 @@ static void PlayerPartnerHandleChoosePokemon(void) for (chosenMonId = 3; chosenMonId < 6; chosenMonId++) { if (GetMonData(&gPlayerParty[chosenMonId], MON_DATA_HP) != 0 - && chosenMonId != gBattlePartyID[playerMonIdentity] - && chosenMonId != gBattlePartyID[selfIdentity]) + && chosenMonId != gBattlerPartyIndexes[playerMonIdentity] + && chosenMonId != gBattlerPartyIndexes[selfIdentity]) { break; } @@ -1583,7 +1583,7 @@ static void PlayerPartnerHandleChoosePokemon(void) } *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = chosenMonId; - EmitChosenMonReturnValue(1, chosenMonId, NULL); + BtlController_EmitChosenMonReturnValue(1, chosenMonId, NULL); PlayerPartnerBufferExecCompleted(); } @@ -1601,19 +1601,19 @@ static void PlayerPartnerHandleHealthBarUpdate(void) if (hpVal != INSTANT_HP_BAR_DROP) { - u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_HP); + u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, curHP, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); } else { - u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); + u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, 0, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); } - gBattlerFuncs[gActiveBattler] = CompleteOnHealthbarDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; } static void PlayerPartnerHandleExpUpdate(void) @@ -1636,7 +1636,7 @@ static void PlayerPartnerHandleExpUpdate(void) gTasks[taskId].tExpTask_monId = monId; gTasks[taskId].tExpTask_gainedExp = expPointsToGive; gTasks[taskId].tExpTask_bank = gActiveBattler; - gBattlerFuncs[gActiveBattler] = nullsub_21; + gBattlerControllerFuncs[gActiveBattler] = nullsub_21; } } @@ -1651,10 +1651,10 @@ static void PlayerPartnerHandleStatusIconUpdate(void) { u8 bank; - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_STATUS_ICON); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); bank = gActiveBattler; gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1664,7 +1664,7 @@ static void PlayerPartnerHandleStatusAnimation(void) { InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8) | (gBattleBufferA[gActiveBattler][4] << 16) | (gBattleBufferA[gActiveBattler][5] << 24)); - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1739,16 +1739,16 @@ static void PlayerPartnerHandleCmd40(void) static void PlayerPartnerHandleHitAnimation(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].invisible == TRUE) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) { PlayerPartnerBufferExecCompleted(); } else { gDoingBattleAnim = TRUE; - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; + gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; } } @@ -1787,7 +1787,7 @@ static void PlayerPartnerHandlePlayFanfareOrBGM(void) static void PlayerPartnerHandleFaintingCry(void) { - u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); PlayCry3(species, -25, 5); PlayerPartnerBufferExecCompleted(); @@ -1805,16 +1805,16 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(void) u8 paletteNum; u8 taskId; - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - gSprites[gBankSpriteIds[gActiveBattler]].data[5] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], sub_805CC00); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F9); if (gPartnerTrainerId == STEVEN_PARTNER_ID) @@ -1829,7 +1829,7 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(void) } - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; taskId = CreateTask(sub_81BE2C8, 5); gTasks[taskId].data[0] = gActiveBattler; @@ -1838,7 +1838,7 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(void) gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30; gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerFuncs[gActiveBattler] = nullsub_77; + gBattlerControllerFuncs[gActiveBattler] = nullsub_77; } static void sub_81BE2C8(u8 taskId) @@ -1854,20 +1854,20 @@ static void sub_81BE2C8(u8 taskId) gActiveBattler = gTasks[taskId].data[0]; if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_81BD0E4(gActiveBattler, FALSE); } else { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_81BD0E4(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); sub_81BD0E4(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerFuncs[gActiveBattler] = sub_81BB02C; + gBattlerControllerFuncs[gActiveBattler] = sub_81BB02C; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1888,7 +1888,7 @@ static void PlayerPartnerHandleDrawPartyStatusSummary(void) if (gBattleBufferA[gActiveBattler][2] != 0) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; - gBattlerFuncs[gActiveBattler] = sub_81BE498; + gBattlerControllerFuncs[gActiveBattler] = sub_81BE498; } } @@ -1915,9 +1915,9 @@ static void PlayerPartnerHandleCmd50(void) static void PlayerPartnerHandleSpriteInvisibility(void) { - if (IsBankSpritePresent(gActiveBattler)) + if (IsBattlerSpritePresent(gActiveBattler)) { - gSprites[gBankSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; + gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; CopyBattleSpriteInvisibility(gActiveBattler); } PlayerPartnerBufferExecCompleted(); @@ -1933,7 +1933,7 @@ static void PlayerPartnerHandleBattleAnimation(void) if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) PlayerPartnerBufferExecCompleted(); else - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; } } @@ -1953,7 +1953,7 @@ static void PlayerPartnerHandleCmd55(void) FadeOutMapMusic(5); BeginFastPaletteFade(3); PlayerPartnerBufferExecCompleted(); - gBattlerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; } static void nullsub_128(void) diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 290eee61b..22cd63fb3 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -25,21 +25,21 @@ #include "pokeball.h" #include "data2.h" -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u8 gActiveBattler; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gBattlersCount; extern bool8 gDoingBattleAnim; -extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void); +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern void (*gPreBattleCallback1)(void); -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; extern struct SpriteTemplate gUnknown_0202499C; extern u16 gSpecialVar_ItemId; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleOutcome; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; @@ -48,7 +48,7 @@ extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; extern u16 gPartnerTrainerId; extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); -extern u8 gBattleDefender; +extern u8 gBattleMoveTarget; extern u8 gAbsentBattlerFlags; extern u8 gUnknown_020244B4[]; extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT]; @@ -202,12 +202,12 @@ static void nullsub_70(void) void SetControllerToRecordedOpponent(void) { - gBattlerFuncs[gActiveBattler] = RecordedOpponentBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentBufferRunCommand; } static void RecordedOpponentBufferRunCommand(void) { - if (gBattleExecBuffer & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) { if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sRecordedOpponentBufferCommands)) sRecordedOpponentBufferCommands[gBattleBufferA[gActiveBattler][0]](); @@ -218,23 +218,23 @@ static void RecordedOpponentBufferRunCommand(void) static void CompleteOnBankSpriteCallbackDummy(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) RecordedOpponentBufferExecCompleted(); } static void CompleteOnBankSpriteCallbackDummy2(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) RecordedOpponentBufferExecCompleted(); } static void sub_81865C8(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - FreeTrainerFrontPicPalette(gSprites[gBankSpriteIds[gActiveBattler]].oam.affineParam); - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); + FreeTrainerFrontPicPalette(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); RecordedOpponentBufferExecCompleted(); } } @@ -254,8 +254,8 @@ static void sub_8186678(void) if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].animEnded) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded) { var = TRUE; } @@ -263,10 +263,10 @@ static void sub_8186678(void) } else { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].animEnded - && gSprites[gBankSpriteIds[gActiveBattler ^ BIT_FLANK]].animEnded) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded + && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].animEnded) { var = TRUE; } @@ -290,7 +290,7 @@ static void sub_8186678(void) } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerFuncs[gActiveBattler] = sub_8186630; + gBattlerControllerFuncs[gActiveBattler] = sub_8186630; } } @@ -300,9 +300,9 @@ static void sub_818686C(void) bool32 r8 = FALSE; if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) - sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) - sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]]); + sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) { @@ -310,13 +310,13 @@ static void sub_818686C(void) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); sub_8076918(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gEnemyParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 1; } @@ -345,7 +345,7 @@ static void sub_818686C(void) if (!IsDoubleBattle()) { if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { r8 = TRUE; } @@ -353,9 +353,9 @@ static void sub_818686C(void) else { if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { r8 = TRUE; } @@ -366,28 +366,28 @@ static void sub_818686C(void) if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); - SetBankEnemyShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); + SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); } DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - SetBankEnemyShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES)); + SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); gBattleSpritesDataPtr->animationData->field_9_x1 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; - gBattlerFuncs[gActiveBattler] = sub_8186678; + gBattlerControllerFuncs[gActiveBattler] = sub_8186678; } } static void sub_8186C48(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].pos2.x == 0) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80) { - sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); } else { @@ -405,13 +405,13 @@ static void sub_8186C48(void) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBattler, gHealthBoxesIds[gActiveBattler], HEALTH_BAR, 0); + s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); if (hpValue != -1) { - UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], hpValue, HP_CURRENT); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], hpValue, HP_CURRENT); } else { @@ -421,9 +421,9 @@ static void CompleteOnHealthbarDone(void) static void sub_8186D58(void) { - if (!gSprites[gBankSpriteIds[gActiveBattler]].inUse) + if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse) { - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); RecordedOpponentBufferExecCompleted(); } } @@ -432,10 +432,10 @@ static void sub_8186D9C(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - EnemyShadowCallbackToSetInvisible(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + HideBattlerShadowSprite(gActiveBattler); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); RecordedOpponentBufferExecCompleted(); } } @@ -448,7 +448,7 @@ static void CompleteOnInactiveTextPrinter(void) static void DoHitAnimBlinkSpriteEffect(void) { - u8 spriteId = gBankSpriteIds[gActiveBattler]; + u8 spriteId = gBattlerSpriteIds[gActiveBattler]; if (gSprites[spriteId].data[1] == 32) { @@ -467,12 +467,12 @@ static void DoHitAnimBlinkSpriteEffect(void) static void sub_8186EA4(void) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerFuncs[gActiveBattler] = sub_8186F14; + gBattlerControllerFuncs[gActiveBattler] = sub_8186F14; } } @@ -481,8 +481,8 @@ static void sub_8186F14(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - || gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + || gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) { m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); RecordedOpponentBufferExecCompleted(); @@ -493,7 +493,7 @@ static void sub_8186F14(void) static void sub_8186F94(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 = 0; @@ -501,13 +501,13 @@ static void sub_8186F94(void) FreeSpriteTilesByTag(0x27F9); FreeSpritePaletteByTag(0x27F9); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 0); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gEnemyParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); CopyBattleSpriteInvisibility(gActiveBattler); - gBattlerFuncs[gActiveBattler] = sub_8186EA4; + gBattlerControllerFuncs[gActiveBattler] = sub_8186EA4; } } @@ -516,15 +516,15 @@ static void sub_8187084(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80) { - sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); } if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - SetBankEnemyShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerFuncs[gActiveBattler] = sub_8186F94; + SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); + gBattlerControllerFuncs[gActiveBattler] = sub_8186F94; } } @@ -542,7 +542,7 @@ static void CompleteOnFinishedBattleAnimation(void) static void RecordedOpponentBufferExecCompleted(void) { - gBattlerFuncs[gActiveBattler] = RecordedOpponentBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); @@ -552,7 +552,7 @@ static void RecordedOpponentBufferExecCompleted(void) } else { - gBattleExecBuffer &= ~gBitTable[gActiveBattler]; + gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; } } @@ -565,7 +565,7 @@ static void RecordedOpponentHandleGetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - size += CopyRecordedOpponentMonData(gBattlePartyID[gActiveBattler], monData); + size += CopyRecordedOpponentMonData(gBattlerPartyIndexes[gActiveBattler], monData); } else { @@ -577,7 +577,7 @@ static void RecordedOpponentHandleGetMonData(void) monToCheck >>= 1; } } - EmitDataTransfer(1, size, monData); + BtlController_EmitDataTransfer(1, size, monData); RecordedOpponentBufferExecCompleted(); } @@ -899,7 +899,7 @@ static void RecordedOpponentHandleSetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - SetRecordedOpponentMonData(gBattlePartyID[gActiveBattler]); + SetRecordedOpponentMonData(gBattlerPartyIndexes[gActiveBattler]); } else { @@ -1132,7 +1132,7 @@ static void SetRecordedOpponentMonData(u8 monId) static void RecordedOpponentHandleSetRawMonData(void) { - u8 *dst = (u8 *)&gEnemyParty[gBattlePartyID[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; + u8 *dst = (u8 *)&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; u8 i; for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++) @@ -1143,33 +1143,33 @@ static void RecordedOpponentHandleSetRawMonData(void) static void RecordedOpponentHandleLoadMonSprite(void) { - u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); sub_806A068(species, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, - GetBankCoord(gActiveBattler, 2), - GetBankSpriteDefault_Y(gActiveBattler), + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, + GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteDefault_Y(gActiveBattler), sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - SetBankEnemyShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES)); + SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerFuncs[gActiveBattler] = sub_8186C48; + gBattlerControllerFuncs[gActiveBattler] = sub_8186C48; } static void RecordedOpponentHandleSwitchInAnim(void) { - gBattlePartyID[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; + gBattlerPartyIndexes[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; sub_81885D8(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlerFuncs[gActiveBattler] = sub_8187084; + gBattlerControllerFuncs[gActiveBattler] = sub_8187084; } static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit) @@ -1177,28 +1177,28 @@ static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit) u16 species; ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); - gBattlePartyID[bank] = gBattleBufferA[bank][1]; - species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank); sub_806A068(species, GetBattlerPosition(bank)); - gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, - GetBankCoord(bank, 2), - GetBankSpriteDefault_Y(bank), + gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, + GetBattlerSpriteCoord(bank, 2), + GetBattlerSpriteDefault_Y(bank), sub_80A82E4(bank)); - gSprites[gUnknown_03005D7C[bank]].data[1] = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank]; gSprites[gUnknown_03005D7C[bank]].data[2] = bank; - gSprites[gBankSpriteIds[bank]].data[0] = bank; - gSprites[gBankSpriteIds[bank]].data[2] = species; - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].data[2] = species; + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; - StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]); - gSprites[gBankSpriteIds[bank]].invisible = TRUE; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[bank]].invisible = TRUE; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); } @@ -1208,14 +1208,14 @@ static void RecordedOpponentHandleReturnMonToBall(void) if (gBattleBufferA[gActiveBattler][1] == 0) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = DoSwitchOutAnimation; + gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; } else { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - EnemyShadowCallbackToSetInvisible(gActiveBattler); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + HideBattlerShadowSprite(gActiveBattler); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); RecordedOpponentBufferExecCompleted(); } } @@ -1235,7 +1235,7 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON); - gBattlerFuncs[gActiveBattler] = sub_8186D9C; + gBattlerControllerFuncs[gActiveBattler] = sub_8186D9C; } break; } @@ -1280,18 +1280,18 @@ static void RecordedOpponentHandleDrawTrainerPic(void) DecompressTrainerFrontPic(trainerPicId, gActiveBattler); sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 2; - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBankSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; } static void RecordedOpponentHandleTrainerSlide(void) @@ -1301,13 +1301,13 @@ static void RecordedOpponentHandleTrainerSlide(void) static void RecordedOpponentHandleTrainerSlideBack(void) { - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerFuncs[gActiveBattler] = sub_81865C8; + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); + gBattlerControllerFuncs[gActiveBattler] = sub_81865C8; } static void RecordedOpponentHandleFaintAnimation(void) @@ -1324,8 +1324,8 @@ static void RecordedOpponentHandleFaintAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT); - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_8039934; - gBattlerFuncs[gActiveBattler] = sub_8186D58; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039934; + gBattlerControllerFuncs[gActiveBattler] = sub_8186D58; } } } @@ -1370,7 +1370,7 @@ static void RecordedOpponentHandleMoveAnimation(void) else { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = RecordedOpponentDoMoveAnimation; + gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentDoMoveAnimation; } } } @@ -1433,7 +1433,7 @@ static void RecordedOpponentHandlePrintString(void) stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]); BufferStringBattle(*stringId); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); - gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; } static void RecordedOpponentHandlePrintSelectionString(void) @@ -1443,7 +1443,7 @@ static void RecordedOpponentHandlePrintSelectionString(void) static void RecordedOpponentHandleChooseAction(void) { - EmitTwoReturnValues(1, RecordedBattle_ReadBankAction(gActiveBattler), 0); + BtlController_EmitTwoReturnValues(1, RecordedBattle_GetBankAction(gActiveBattler), 0); RecordedOpponentBufferExecCompleted(); } @@ -1456,13 +1456,13 @@ static void RecordedOpponentHandleChooseMove(void) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + BtlController_EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); } else { - u8 moveId = RecordedBattle_ReadBankAction(gActiveBattler); - u8 target = RecordedBattle_ReadBankAction(gActiveBattler); - EmitTwoReturnValues(1, 10, moveId | (target << 8)); + u8 moveId = RecordedBattle_GetBankAction(gActiveBattler); + u8 target = RecordedBattle_GetBankAction(gActiveBattler); + BtlController_EmitTwoReturnValues(1, 10, moveId | (target << 8)); } RecordedOpponentBufferExecCompleted(); @@ -1475,8 +1475,8 @@ static void RecordedOpponentHandleChooseItem(void) static void RecordedOpponentHandleChoosePokemon(void) { - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = RecordedBattle_ReadBankAction(gActiveBattler); - EmitChosenMonReturnValue(1, *(gBattleStruct->monToSwitchIntoId + gActiveBattler), NULL); + *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = RecordedBattle_GetBankAction(gActiveBattler); + BtlController_EmitChosenMonReturnValue(1, *(gBattleStruct->monToSwitchIntoId + gActiveBattler), NULL); RecordedOpponentBufferExecCompleted(); } @@ -1494,19 +1494,19 @@ static void RecordedOpponentHandleHealthBarUpdate(void) if (hpVal != INSTANT_HP_BAR_DROP) { - u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_HP); + u32 maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, curHP, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); } else { - u32 maxHP = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); + u32 maxHP = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, 0, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); } - gBattlerFuncs[gActiveBattler] = CompleteOnHealthbarDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; } static void RecordedOpponentHandleExpUpdate(void) @@ -1520,10 +1520,10 @@ static void RecordedOpponentHandleStatusIconUpdate(void) { u8 bank; - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gEnemyParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_STATUS_ICON); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); bank = gActiveBattler; gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1533,7 +1533,7 @@ static void RecordedOpponentHandleStatusAnimation(void) { InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8) | (gBattleBufferA[gActiveBattler][4] << 16) | (gBattleBufferA[gActiveBattler][5] << 24)); - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1608,16 +1608,16 @@ static void RecordedOpponentHandleCmd40(void) static void RecordedOpponentHandleHitAnimation(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].invisible == TRUE) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) { RecordedOpponentBufferExecCompleted(); } else { gDoingBattleAnim = TRUE; - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; + gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; } } @@ -1656,7 +1656,7 @@ static void RecordedOpponentHandlePlayFanfareOrBGM(void) static void RecordedOpponentHandleFaintingCry(void) { - u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); PlayCry3(species, 25, 5); RecordedOpponentBufferExecCompleted(); @@ -1674,14 +1674,14 @@ static void RecordedOpponentHandleIntroTrainerBallThrow(void) u8 paletteNum; u8 taskId; - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 280; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], sub_818962C); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_818962C); taskId = CreateTask(sub_8189548, 5); gTasks[taskId].data[0] = gActiveBattler; @@ -1690,7 +1690,7 @@ static void RecordedOpponentHandleIntroTrainerBallThrow(void) gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30; gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerFuncs[gActiveBattler] = nullsub_70; + gBattlerControllerFuncs[gActiveBattler] = nullsub_70; } static void sub_8189548(u8 taskId) @@ -1700,19 +1700,19 @@ static void sub_8189548(u8 taskId) gActiveBattler = gTasks[taskId].data[0]; if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_81885D8(gActiveBattler, FALSE); } else { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_81885D8(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_81885D8(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerFuncs[gActiveBattler] = sub_818686C; + gBattlerControllerFuncs[gActiveBattler] = sub_818686C; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1753,7 +1753,7 @@ static void RecordedOpponentHandleDrawPartyStatusSummary(void) if (gBattleBufferA[gActiveBattler][2] != 0) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; - gBattlerFuncs[gActiveBattler] = sub_818975C; + gBattlerControllerFuncs[gActiveBattler] = sub_818975C; } } @@ -1780,9 +1780,9 @@ static void RecordedOpponentHandleCmd50(void) static void RecordedOpponentHandleSpriteInvisibility(void) { - if (IsBankSpritePresent(gActiveBattler)) + if (IsBattlerSpritePresent(gActiveBattler)) { - gSprites[gBankSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; + gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; CopyBattleSpriteInvisibility(gActiveBattler); } RecordedOpponentBufferExecCompleted(); @@ -1798,7 +1798,7 @@ static void RecordedOpponentHandleBattleAnimation(void) if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) RecordedOpponentBufferExecCompleted(); else - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; } } @@ -1822,7 +1822,7 @@ static void RecordedOpponentHandleCmd55(void) FadeOutMapMusic(5); BeginFastPaletteFade(3); RecordedOpponentBufferExecCompleted(); - gBattlerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; } static void nullsub_119(void) diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index ad8cb3a05..109d71733 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -24,21 +24,21 @@ #include "pokeball.h" #include "data2.h" -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u8 gActiveBattler; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gBattlersCount; extern bool8 gDoingBattleAnim; -extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void); +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern void (*gPreBattleCallback1)(void); -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; extern struct SpriteTemplate gUnknown_0202499C; extern u16 gSpecialVar_ItemId; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleOutcome; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; @@ -48,7 +48,7 @@ extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; extern u16 gPartnerTrainerId; extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); -extern u8 gBattleDefender; +extern u8 gBattleMoveTarget; extern u8 gAbsentBattlerFlags; extern u8 gUnknown_020244B4[]; extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT]; @@ -201,12 +201,12 @@ static void nullsub_120(void) void SetControllerToRecordedPlayer(void) { - gBattlerFuncs[gActiveBattler] = RecordedPlayerBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = RecordedPlayerBufferRunCommand; } static void RecordedPlayerBufferRunCommand(void) { - if (gBattleExecBuffer & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) { if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sRecordedPlayerBufferCommands)) sRecordedPlayerBufferCommands[gBattleBufferA[gActiveBattler][0]](); @@ -217,17 +217,17 @@ static void RecordedPlayerBufferRunCommand(void) static void CompleteOnBankSpriteCallbackDummy(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) RecordedPlayerBufferExecCompleted(); } static void sub_81899F0(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { nullsub_25(0); - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); RecordedPlayerBufferExecCompleted(); } } @@ -249,13 +249,13 @@ static void sub_8189AA0(void) { if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) r6 = TRUE; } else { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { r6 = TRUE; } @@ -273,25 +273,25 @@ static void sub_8189AA0(void) FreeSpriteTilesByTag(0x27F9); FreeSpritePaletteByTag(0x27F9); - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); if (IsDoubleBattle()) - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerFuncs[gActiveBattler] = sub_8189A58; + gBattlerControllerFuncs[gActiveBattler] = sub_8189A58; } } else { if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) r6 = TRUE; } else { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { r6 = TRUE; } @@ -303,7 +303,7 @@ static void sub_8189AA0(void) if (r6) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerFuncs[gActiveBattler] = sub_8189A58; + gBattlerControllerFuncs[gActiveBattler] = sub_8189A58; } } } @@ -317,12 +317,12 @@ static void sub_8189D40(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); } if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) { - sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]]); + sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); } } @@ -333,13 +333,13 @@ static void sub_8189D40(void) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); sub_8076918(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); } gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 1; } @@ -367,7 +367,7 @@ static void sub_8189D40(void) } if (r10 && gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); @@ -376,43 +376,43 @@ static void sub_8189D40(void) gBattleSpritesDataPtr->animationData->field_9_x1 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; - gBattlerFuncs[gActiveBattler] = sub_8189AA0; + gBattlerControllerFuncs[gActiveBattler] = sub_8189AA0; } } static void sub_818A064(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].animEnded && gSprites[gBankSpriteIds[gActiveBattler]].pos2.x == 0) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) RecordedPlayerBufferExecCompleted(); } static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBattler, gHealthBoxesIds[gActiveBattler], HEALTH_BAR, 0); + s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); if (hpValue != -1) { - UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], hpValue, HP_CURRENT); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], hpValue, HP_CURRENT); } else { - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); RecordedPlayerBufferExecCompleted(); } } static void sub_818A114(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].pos1.y + gSprites[gBankSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) { - u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); nullsub_24(species); - FreeOamMatrix(gSprites[gBankSpriteIds[gActiveBattler]].oam.matrixNum); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); RecordedPlayerBufferExecCompleted(); } } @@ -421,9 +421,9 @@ static void sub_818A1B0(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); RecordedPlayerBufferExecCompleted(); } } @@ -436,7 +436,7 @@ static void CompleteOnInactiveTextPrinter(void) static void DoHitAnimBlinkSpriteEffect(void) { - u8 spriteId = gBankSpriteIds[gActiveBattler]; + u8 spriteId = gBattlerSpriteIds[gActiveBattler]; if (gSprites[spriteId].data[1] == 32) { @@ -455,20 +455,20 @@ static void DoHitAnimBlinkSpriteEffect(void) static void sub_818A2B4(void) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { CopyBattleSpriteInvisibility(gActiveBattler); if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerFuncs[gActiveBattler] = sub_818A328; + gBattlerControllerFuncs[gActiveBattler] = sub_818A328; } } static void sub_818A328(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { RecordedPlayerBufferExecCompleted(); } @@ -485,13 +485,13 @@ static void sub_818A37C(void) FreeSpritePaletteByTag(0x27F9); CreateTask(c3_0802FDF4, 10); - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 0); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattlerFuncs[gActiveBattler] = sub_818A2B4; + gBattlerControllerFuncs[gActiveBattler] = sub_818A2B4; } } @@ -500,20 +500,20 @@ static void sub_818A470(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); } if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - gBattlerFuncs[gActiveBattler] = sub_818A37C; + gBattlerControllerFuncs[gActiveBattler] = sub_818A37C; } } static void RecordedPlayerBufferExecCompleted(void) { - gBattlerFuncs[gActiveBattler] = RecordedPlayerBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = RecordedPlayerBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); @@ -523,7 +523,7 @@ static void RecordedPlayerBufferExecCompleted(void) } else { - gBattleExecBuffer &= ~gBitTable[gActiveBattler]; + gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; } } @@ -548,7 +548,7 @@ static void RecordedPlayerHandleGetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - size += CopyRecordedPlayerMonData(gBattlePartyID[gActiveBattler], monData); + size += CopyRecordedPlayerMonData(gBattlerPartyIndexes[gActiveBattler], monData); } else { @@ -560,7 +560,7 @@ static void RecordedPlayerHandleGetMonData(void) monToCheck >>= 1; } } - EmitDataTransfer(1, size, monData); + BtlController_EmitDataTransfer(1, size, monData); RecordedPlayerBufferExecCompleted(); } @@ -882,7 +882,7 @@ static void RecordedPlayerHandleSetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - SetRecordedPlayerMonData(gBattlePartyID[gActiveBattler]); + SetRecordedPlayerMonData(gBattlerPartyIndexes[gActiveBattler]); } else { @@ -1112,12 +1112,12 @@ static void SetRecordedPlayerMonData(u8 monId) break; } - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); } static void RecordedPlayerHandleSetRawMonData(void) { - u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; + u8 *dst = (u8 *)&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]] + gBattleBufferA[gActiveBattler][1]; u8 i; for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++) @@ -1130,28 +1130,28 @@ static void RecordedPlayerHandleLoadMonSprite(void) { u16 species; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); - species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); sub_806A068(species, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, - GetBankCoord(gActiveBattler, 2), - GetBankSpriteDefault_Y(gActiveBattler), + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, + GetBattlerSpriteCoord(gActiveBattler, 2), + GetBattlerSpriteDefault_Y(gActiveBattler), sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - gBattlerFuncs[gActiveBattler] = sub_818A064; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); + gBattlerControllerFuncs[gActiveBattler] = sub_818A064; } static void RecordedPlayerHandleSwitchInAnim(void) { ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlePartyID[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + gBattlerPartyIndexes[gActiveBattler] = gBattleBufferA[gActiveBattler][1]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); sub_818BA6C(gActiveBattler, gBattleBufferA[gActiveBattler][2]); - gBattlerFuncs[gActiveBattler] = sub_818A470; + gBattlerControllerFuncs[gActiveBattler] = sub_818A470; } static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit) @@ -1159,28 +1159,28 @@ static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit) u16 species; ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit); - gBattlePartyID[bank] = gBattleBufferA[bank][1]; - species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); sub_806A068(species, GetBattlerPosition(bank)); - gBankSpriteIds[bank] = CreateSprite( + gBattlerSpriteIds[bank] = CreateSprite( &gUnknown_0202499C, - GetBankCoord(bank, 2), - GetBankSpriteDefault_Y(bank), + GetBattlerSpriteCoord(bank, 2), + GetBattlerSpriteDefault_Y(bank), sub_80A82E4(bank)); - gSprites[gUnknown_03005D7C[bank]].data[1] = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank]; gSprites[gUnknown_03005D7C[bank]].data[2] = bank; - gSprites[gBankSpriteIds[bank]].data[0] = bank; - gSprites[gBankSpriteIds[bank]].data[2] = species; - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].data[2] = species; + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; - StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]); - gSprites[gBankSpriteIds[bank]].invisible = TRUE; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[bank]].invisible = TRUE; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); } @@ -1190,13 +1190,13 @@ static void RecordedPlayerHandleReturnMonToBall(void) if (gBattleBufferA[gActiveBattler][1] == 0) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = DoSwitchOutAnimation; + gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; } else { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); RecordedPlayerBufferExecCompleted(); } } @@ -1216,7 +1216,7 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerFuncs[gActiveBattler] = sub_818A1B0; + gBattlerControllerFuncs[gActiveBattler] = sub_818A1B0; } break; } @@ -1268,29 +1268,29 @@ static void RecordedPlayerHandleDrawTrainerPic(void) trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); DecompressTrainerFrontPic(trainerPicId, gActiveBattler); sub_806A1C0(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBankSpriteIds[gActiveBattler]].pos2.y = 48; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gSprites[gBankSpriteIds[gActiveBattler]].oam.affineMode = 0; - gSprites[gBankSpriteIds[gActiveBattler]].hFlip = 1; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y = 48; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1; } else { DecompressTrainerBackPic(trainerPicId, gActiveBattler); sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler)); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; } - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; } static void RecordedPlayerHandleTrainerSlide(void) @@ -1300,13 +1300,13 @@ static void RecordedPlayerHandleTrainerSlide(void) static void RecordedPlayerHandleTrainerSlideBack(void) { - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerFuncs[gActiveBattler] = sub_81899F0; + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); + gBattlerControllerFuncs[gActiveBattler] = sub_81899F0; } static void RecordedPlayerHandleFaintAnimation(void) @@ -1322,12 +1322,12 @@ static void RecordedPlayerHandleFaintAnimation(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlaySE12WithPanning(SE_POKE_DEAD, -64); - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 5; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_8039C00; - gBattlerFuncs[gActiveBattler] = sub_818A114; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00; + gBattlerControllerFuncs[gActiveBattler] = sub_818A114; } } } @@ -1372,7 +1372,7 @@ static void RecordedPlayerHandleMoveAnimation(void) else { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = RecordedPlayerDoMoveAnimation; + gBattlerControllerFuncs[gActiveBattler] = RecordedPlayerDoMoveAnimation; } } } @@ -1435,7 +1435,7 @@ static void RecordedPlayerHandlePrintString(void) stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]); BufferStringBattle(*stringId); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); - gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; } static void RecordedPlayerHandlePrintSelectionString(void) @@ -1447,7 +1447,7 @@ static void ChooseActionInBattlePalace(void) { if (gBattleCommunication[4] >= gBattlersCount / 2) { - EmitTwoReturnValues(1, RecordedBattle_ReadBankAction(gActiveBattler), 0); + BtlController_EmitTwoReturnValues(1, RecordedBattle_GetBankAction(gActiveBattler), 0); RecordedPlayerBufferExecCompleted(); } } @@ -1456,11 +1456,11 @@ static void RecordedPlayerHandleChooseAction(void) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gBattlerFuncs[gActiveBattler] = ChooseActionInBattlePalace; + gBattlerControllerFuncs[gActiveBattler] = ChooseActionInBattlePalace; } else { - EmitTwoReturnValues(1, RecordedBattle_ReadBankAction(gActiveBattler), 0); + BtlController_EmitTwoReturnValues(1, RecordedBattle_GetBankAction(gActiveBattler), 0); RecordedPlayerBufferExecCompleted(); } } @@ -1474,13 +1474,13 @@ static void RecordedPlayerHandleChooseMove(void) { if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); + BtlController_EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace()); } else { - u8 moveId = RecordedBattle_ReadBankAction(gActiveBattler); - u8 target = RecordedBattle_ReadBankAction(gActiveBattler); - EmitTwoReturnValues(1, 10, moveId | (target << 8)); + u8 moveId = RecordedBattle_GetBankAction(gActiveBattler); + u8 target = RecordedBattle_GetBankAction(gActiveBattler); + BtlController_EmitTwoReturnValues(1, 10, moveId | (target << 8)); } RecordedPlayerBufferExecCompleted(); @@ -1493,8 +1493,8 @@ static void RecordedPlayerHandleChooseItem(void) static void RecordedPlayerHandleChoosePokemon(void) { - *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = RecordedBattle_ReadBankAction(gActiveBattler); - EmitChosenMonReturnValue(1, *(gBattleStruct->monToSwitchIntoId + gActiveBattler), NULL); + *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = RecordedBattle_GetBankAction(gActiveBattler); + BtlController_EmitChosenMonReturnValue(1, *(gBattleStruct->monToSwitchIntoId + gActiveBattler), NULL); RecordedPlayerBufferExecCompleted(); } @@ -1512,20 +1512,20 @@ static void RecordedPlayerHandleHealthBarUpdate(void) if (hpVal != INSTANT_HP_BAR_DROP) { - u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_HP); + u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, curHP, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); } else { - u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); + u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, 0, hpVal); - UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], 0, HP_CURRENT); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], 0, HP_CURRENT); } - gBattlerFuncs[gActiveBattler] = CompleteOnHealthbarDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; } static void RecordedPlayerHandleExpUpdate(void) @@ -1539,10 +1539,10 @@ static void RecordedPlayerHandleStatusIconUpdate(void) { u8 bank; - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_STATUS_ICON); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_STATUS_ICON); bank = gActiveBattler; gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0; - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1552,7 +1552,7 @@ static void RecordedPlayerHandleStatusAnimation(void) { InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8) | (gBattleBufferA[gActiveBattler][4] << 16) | (gBattleBufferA[gActiveBattler][5] << 24)); - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation; } } @@ -1627,16 +1627,16 @@ static void RecordedPlayerHandleCmd40(void) static void RecordedPlayerHandleHitAnimation(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].invisible == TRUE) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) { RecordedPlayerBufferExecCompleted(); } else { gDoingBattleAnim = TRUE; - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; + gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; } } @@ -1675,7 +1675,7 @@ static void RecordedPlayerHandlePlayFanfareOrBGM(void) static void RecordedPlayerHandleFaintingCry(void) { - u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); PlayCry3(species, -25, 5); RecordedPlayerBufferExecCompleted(); @@ -1694,26 +1694,26 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void) u8 taskId; u32 trainerPicId; - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - gSprites[gBankSpriteIds[gActiveBattler]].data[5] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], sub_805CC00); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F9); if (gBattleTypeFlags & BATTLE_TYPE_x2000000) - trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender; + trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender; else trainerPicId = gSaveBlock2Ptr->playerGender; LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, 0x100 + paletteNum * 16, 32); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; taskId = CreateTask(sub_818CC24, 5); gTasks[taskId].data[0] = gActiveBattler; @@ -1722,7 +1722,7 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void) gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30; gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerFuncs[gActiveBattler] = nullsub_120; + gBattlerControllerFuncs[gActiveBattler] = nullsub_120; } static void sub_818CC24(u8 taskId) @@ -1738,20 +1738,20 @@ static void sub_818CC24(u8 taskId) gActiveBattler = gTasks[taskId].data[0]; if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_818BA6C(gActiveBattler, FALSE); } else { - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_818BA6C(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); sub_818BA6C(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerFuncs[gActiveBattler] = sub_8189D40; + gBattlerControllerFuncs[gActiveBattler] = sub_8189D40; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1772,7 +1772,7 @@ static void RecordedPlayerHandleDrawPartyStatusSummary(void) if (gBattleBufferA[gActiveBattler][2] != 0) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; - gBattlerFuncs[gActiveBattler] = sub_818CDF4; + gBattlerControllerFuncs[gActiveBattler] = sub_818CDF4; } } @@ -1799,9 +1799,9 @@ static void RecordedPlayerHandleCmd50(void) static void RecordedPlayerHandleSpriteInvisibility(void) { - if (IsBankSpritePresent(gActiveBattler)) + if (IsBattlerSpritePresent(gActiveBattler)) { - gSprites[gBankSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; + gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1]; CopyBattleSpriteInvisibility(gActiveBattler); } RecordedPlayerBufferExecCompleted(); @@ -1817,7 +1817,7 @@ static void RecordedPlayerHandleBattleAnimation(void) if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) RecordedPlayerBufferExecCompleted(); else - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; } } @@ -1837,7 +1837,7 @@ static void RecordedPlayerHandleCmd55(void) FadeOutMapMusic(5); BeginFastPaletteFade(3); RecordedPlayerBufferExecCompleted(); - gBattlerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; } static void nullsub_121(void) diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 9e90d660c..814ee8076 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -22,21 +22,21 @@ #include "data2.h" #include "pokeblock.h" -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u8 gActiveBattler; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gBattlersCount; extern bool8 gDoingBattleAnim; -extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void); +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern void (*gPreBattleCallback1)(void); -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; extern struct SpriteTemplate gUnknown_0202499C; extern u16 gSpecialVar_ItemId; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleOutcome; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; @@ -180,12 +180,12 @@ static void nullsub_114(void) void SetControllerToSafari(void) { - gBattlerFuncs[gActiveBattler] = SafariBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = SafariBufferRunCommand; } static void SafariBufferRunCommand(void) { - if (gBattleExecBuffer & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) { if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sSafariBufferCommands)) sSafariBufferCommands[gBattleBufferA[gActiveBattler][0]](); @@ -203,16 +203,16 @@ static void HandleInputChooseAction(void) switch (gActionSelectionCursor[gActiveBattler]) { case 0: - EmitTwoReturnValues(1, ACTION_SAFARI_ZONE_BALL, 0); + BtlController_EmitTwoReturnValues(1, ACTION_SAFARI_ZONE_BALL, 0); break; case 1: - EmitTwoReturnValues(1, ACTION_POKEBLOCK_CASE, 0); + BtlController_EmitTwoReturnValues(1, ACTION_POKEBLOCK_CASE, 0); break; case 2: - EmitTwoReturnValues(1, ACTION_GO_NEAR, 0); + BtlController_EmitTwoReturnValues(1, ACTION_GO_NEAR, 0); break; case 3: - EmitTwoReturnValues(1, ACTION_SAFARI_ZONE_RUN, 0); + BtlController_EmitTwoReturnValues(1, ACTION_SAFARI_ZONE_RUN, 0); break; } SafariBufferExecCompleted(); @@ -261,7 +261,7 @@ static void HandleInputChooseAction(void) static void CompleteOnBankSpriteCallbackDummy(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) SafariBufferExecCompleted(); } @@ -273,7 +273,7 @@ static void CompleteOnInactiveTextPrinter(void) static void CompleteOnHealthboxSpriteCallbackDummy(void) { - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) SafariBufferExecCompleted(); } @@ -297,7 +297,7 @@ static void SafariOpenPokeblockCase(void) { if (!gPaletteFade.active) { - gBattlerFuncs[gActiveBattler] = CompleteWhenChosePokeblock; + gBattlerControllerFuncs[gActiveBattler] = CompleteWhenChosePokeblock; FreeAllWindowBuffers(); OpenPokeblockCaseInBattle(); } @@ -307,7 +307,7 @@ static void CompleteWhenChosePokeblock(void) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - EmitOneReturnValue(1, gSpecialVar_ItemId); + BtlController_EmitOneReturnValue(1, gSpecialVar_ItemId); SafariBufferExecCompleted(); } } @@ -320,7 +320,7 @@ static void CompleteOnFinishedBattleAnimation(void) static void SafariBufferExecCompleted(void) { - gBattlerFuncs[gActiveBattler] = SafariBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = SafariBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); @@ -330,7 +330,7 @@ static void SafariBufferExecCompleted(void) } else { - gBattleExecBuffer &= ~gBitTable[gActiveBattler]; + gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; } } @@ -379,16 +379,16 @@ static void SafariHandleDrawTrainerPic(void) { DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBattler); sub_806A12C(gSaveBlock2Ptr->playerGender, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite( + gBattlerSpriteIds[gActiveBattler] = CreateSprite( &gUnknown_0202499C, 80, (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80, 30); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; } static void SafariHandleTrainerSlide(void) @@ -416,7 +416,7 @@ static void SafariHandleSuccessBallThrowAnim(void) gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; gDoingBattleAnim = TRUE; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW); - gBattlerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; } static void SafariHandleBallThrowAnim(void) @@ -426,7 +426,7 @@ static void SafariHandleBallThrowAnim(void) gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; gDoingBattleAnim = TRUE; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW); - gBattlerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone; } static void SafariHandlePause(void) @@ -448,7 +448,7 @@ static void SafariHandlePrintString(void) stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]); BufferStringBattle(*stringId); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); - gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; } static void SafariHandlePrintSelectionString(void) @@ -465,7 +465,7 @@ static void HandleChooseActionAfterDma3(void) { gBattle_BG0_X = 0; gBattle_BG0_Y = 160; - gBattlerFuncs[gActiveBattler] = HandleInputChooseAction; + gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseAction; } } @@ -473,7 +473,7 @@ static void SafariHandleChooseAction(void) { s32 i; - gBattlerFuncs[gActiveBattler] = HandleChooseActionAfterDma3; + gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3; BattleHandleAddTextPrinter(gText_SafariZoneMenu, 2); for (i = 0; i < 4; i++) @@ -499,7 +499,7 @@ static void SafariHandleChooseItem(void) s32 i; BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); - gBattlerFuncs[gActiveBattler] = SafariOpenPokeblockCase; + gBattlerControllerFuncs[gActiveBattler] = SafariOpenPokeblockCase; gBankInMenu = gActiveBattler; } @@ -525,7 +525,7 @@ static void SafariHandleExpUpdate(void) static void SafariHandleStatusIconUpdate(void) { - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_SAFARI_BALLS_TEXT); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_SAFARI_BALLS_TEXT); SafariBufferExecCompleted(); } @@ -639,7 +639,7 @@ static void SafariHandlePlayFanfareOrBGM(void) static void SafariHandleFaintingCry(void) { - u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); PlayCry1(species, 25); SafariBufferExecCompleted(); @@ -654,10 +654,10 @@ static void SafariHandleIntroSlide(void) static void SafariHandleIntroTrainerBallThrow(void) { - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_SAFARI_ALL_TEXT); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_SAFARI_ALL_TEXT); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); - gBattlerFuncs[gActiveBattler] = CompleteOnHealthboxSpriteCallbackDummy; + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); + gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthboxSpriteCallbackDummy; } static void SafariHandleDrawPartyStatusSummary(void) @@ -688,7 +688,7 @@ static void SafariHandleBattleAnimation(void) if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) SafariBufferExecCompleted(); else - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; } static void SafariHandleLinkStandbyMsg(void) @@ -708,7 +708,7 @@ static void SafariHandleCmd55(void) BeginFastPaletteFade(3); SafariBufferExecCompleted(); if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && !(gBattleTypeFlags & BATTLE_TYPE_WILD)) - gBattlerFuncs[gActiveBattler] = sub_81595E4; + gBattlerControllerFuncs[gActiveBattler] = sub_81595E4; } static void nullsub_115(void) diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index d12a0a907..7f5108b9b 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -28,16 +28,16 @@ #include "data2.h" #include "party_menu.h" -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u8 gActiveBattler; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gAbsentBattlerFlags; extern u8 gBattlersCount; extern bool8 gDoingBattleAnim; -extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void); -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; extern u8 gMultiUsePlayerCursor; @@ -48,7 +48,7 @@ extern struct SpriteTemplate gUnknown_0202499C; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; extern u16 gSpecialVar_ItemId; extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleOutcome; extern u8 gNumberOfMovesToChoose; extern u16 gBattle_BG0_X; @@ -204,7 +204,7 @@ static void nullsub_117(void) void SetControllerToWally(void) { - gBattlerFuncs[gActiveBattler] = WallyBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = WallyBufferRunCommand; gBattleStruct->wallyBattleState = 0; gBattleStruct->wallyMovesState = 0; gBattleStruct->wallyWaitFrames = 0; @@ -213,7 +213,7 @@ void SetControllerToWally(void) static void WallyBufferRunCommand(void) { - if (gBattleExecBuffer & gBitTable[gActiveBattler]) + if (gBattleControllerExecFlags & gBitTable[gActiveBattler]) { if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sWallyBufferCommands)) sWallyBufferCommands[gBattleBufferA[gActiveBattler][0]](); @@ -233,7 +233,7 @@ static void WallyHandleActions(void) if (--gBattleStruct->wallyWaitFrames == 0) { PlaySE(SE_SELECT); - EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); + BtlController_EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); WallyBufferExecCompleted(); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; @@ -244,7 +244,7 @@ static void WallyHandleActions(void) if (--gBattleStruct->wallyWaitFrames == 0) { PlaySE(SE_SELECT); - EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); + BtlController_EmitTwoReturnValues(1, ACTION_USE_MOVE, 0); WallyBufferExecCompleted(); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; @@ -254,7 +254,7 @@ static void WallyHandleActions(void) case 3: if (--gBattleStruct->wallyWaitFrames == 0) { - EmitTwoReturnValues(1, 9, 0); + BtlController_EmitTwoReturnValues(1, 9, 0); WallyBufferExecCompleted(); gBattleStruct->wallyBattleState++; gBattleStruct->wallyMovesState = 0; @@ -275,7 +275,7 @@ static void WallyHandleActions(void) if (--gBattleStruct->wallyWaitFrames == 0) { PlaySE(SE_SELECT); - EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); + BtlController_EmitTwoReturnValues(1, ACTION_USE_ITEM, 0); WallyBufferExecCompleted(); } break; @@ -284,7 +284,7 @@ static void WallyHandleActions(void) static void CompleteOnBankSpriteCallbackDummy(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) WallyBufferExecCompleted(); } @@ -304,7 +304,7 @@ static void OpenBagAfterPaletteFade(void) { if (!gPaletteFade.active) { - gBattlerFuncs[gActiveBattler] = CompleteOnChosenItem; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnChosenItem; nullsub_35(); FreeAllWindowBuffers(); DoWallyTutorialBagMenu(); @@ -315,7 +315,7 @@ static void CompleteOnChosenItem(void) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { - EmitOneReturnValue(1, gSpecialVar_ItemId); + BtlController_EmitOneReturnValue(1, gSpecialVar_ItemId); WallyBufferExecCompleted(); } } @@ -323,29 +323,29 @@ static void CompleteOnChosenItem(void) static void sub_816864C(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) - sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlePartyID[gActiveBattler]]); + sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) - sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]]); + sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive && gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); sub_8076918(gActiveBattler ^ BIT_FLANK); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); sub_8076918(gActiveBattler); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); gBattleSpritesDataPtr->animationData->field_9_x1 = 0; - gBattlerFuncs[gActiveBattler] = sub_8168818; + gBattlerControllerFuncs[gActiveBattler] = sub_8168818; } } @@ -354,7 +354,7 @@ static void sub_8168818(void) { bool32 r4 = FALSE; - if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) r4 = TRUE; if (r4 && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 @@ -370,7 +370,7 @@ static void sub_8168818(void) FreeSpritePaletteByTag(0x27F9); CreateTask(c3_0802FDF4, 10); - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); WallyBufferExecCompleted(); } @@ -378,24 +378,24 @@ static void sub_8168818(void) static void CompleteOnHealthbarDone(void) { - s16 hpValue = sub_8074AA0(gActiveBattler, gHealthBoxesIds[gActiveBattler], HEALTH_BAR, 0); + s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0); - SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); if (hpValue != -1) { - UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], hpValue, HP_CURRENT); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], hpValue, HP_CURRENT); } else { - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); WallyBufferExecCompleted(); } } static void DoHitAnimBlinkSpriteEffect(void) { - u8 spriteId = gBankSpriteIds[gActiveBattler]; + u8 spriteId = gBattlerSpriteIds[gActiveBattler]; if (gSprites[spriteId].data[1] == 32) { @@ -416,16 +416,16 @@ static void sub_8168A20(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); WallyBufferExecCompleted(); } } static void CompleteOnBankSpriteCallbackDummy2(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) WallyBufferExecCompleted(); } @@ -437,7 +437,7 @@ static void CompleteOnFinishedBattleAnimation(void) static void WallyBufferExecCompleted(void) { - gBattlerFuncs[gActiveBattler] = WallyBufferRunCommand; + gBattlerControllerFuncs[gActiveBattler] = WallyBufferRunCommand; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { u8 playerId = GetMultiplayerId(); @@ -447,7 +447,7 @@ static void WallyBufferExecCompleted(void) } else { - gBattleExecBuffer &= ~gBitTable[gActiveBattler]; + gBattleControllerExecFlags &= ~gBitTable[gActiveBattler]; } } @@ -466,7 +466,7 @@ static void WallyHandleGetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - size += CopyWallyMonData(gBattlePartyID[gActiveBattler], monData); + size += CopyWallyMonData(gBattlerPartyIndexes[gActiveBattler], monData); } else { @@ -478,7 +478,7 @@ static void WallyHandleGetMonData(void) monToCheck >>= 1; } } - EmitDataTransfer(1, size, monData); + BtlController_EmitDataTransfer(1, size, monData); WallyBufferExecCompleted(); } @@ -800,7 +800,7 @@ static void WallyHandleSetMonData(void) if (gBattleBufferA[gActiveBattler][2] == 0) { - SetWallyMonData(gBattlePartyID[gActiveBattler]); + SetWallyMonData(gBattlerPartyIndexes[gActiveBattler]); } else { @@ -1030,7 +1030,7 @@ static void SetWallyMonData(u8 monId) break; } - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); } static void WallyHandleSetRawMonData(void) @@ -1053,13 +1053,13 @@ static void WallyHandleReturnMonToBall(void) if (gBattleBufferA[gActiveBattler][1] == 0) { InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerFuncs[gActiveBattler] = sub_8168A20; + gBattlerControllerFuncs[gActiveBattler] = sub_8168A20; } else { - FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]); - DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]); - SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]); + FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); WallyBufferExecCompleted(); } } @@ -1068,30 +1068,30 @@ static void WallyHandleDrawTrainerPic(void) { DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBattler); sub_806A12C(BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 80, 80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords), 30); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy; } static void WallyHandleTrainerSlide(void) { DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBattler); sub_806A12C(BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler)); - gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, + gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 80, 80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords), 30); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -96; - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 2; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC; - gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -96; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; } static void WallyHandleTrainerSlideBack(void) @@ -1114,7 +1114,7 @@ static void WallyHandleSuccessBallThrowAnim(void) gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; gDoingBattleAnim = TRUE; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW); - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedAnimation; } static void WallyHandleBallThrowAnim(void) @@ -1124,7 +1124,7 @@ static void WallyHandleBallThrowAnim(void) gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; gDoingBattleAnim = TRUE; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW); - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedAnimation; } static void WallyHandlePause(void) @@ -1150,7 +1150,7 @@ static void WallyHandleMoveAnimation(void) else { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; - gBattlerFuncs[gActiveBattler] = WallyDoMoveAnimation; + gBattlerControllerFuncs[gActiveBattler] = WallyDoMoveAnimation; } } @@ -1209,7 +1209,7 @@ static void WallyHandlePrintString(void) stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]); BufferStringBattle(*stringId); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); - gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; } static void WallyHandlePrintSelectionString(void) @@ -1226,7 +1226,7 @@ static void HandleChooseActionAfterDma3(void) { gBattle_BG0_X = 0; gBattle_BG0_Y = 160; - gBattlerFuncs[gActiveBattler] = WallyHandleActions; + gBattlerControllerFuncs[gActiveBattler] = WallyHandleActions; } } @@ -1234,7 +1234,7 @@ static void WallyHandleChooseAction(void) { s32 i; - gBattlerFuncs[gActiveBattler] = HandleChooseActionAfterDma3; + gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3; BattleHandleAddTextPrinter(gText_BattleMenu, 2); for (i = 0; i < 4; i++) @@ -1271,7 +1271,7 @@ static void WallyHandleChooseMove(void) if (--gBattleStruct->wallyMoveFrames == 0) { PlaySE(SE_SELECT); - EmitTwoReturnValues(1, 10, 0x100); + BtlController_EmitTwoReturnValues(1, 10, 0x100); WallyBufferExecCompleted(); } break; @@ -1281,7 +1281,7 @@ static void WallyHandleChooseMove(void) static void WallyHandleChooseItem(void) { BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); - gBattlerFuncs[gActiveBattler] = OpenBagAfterPaletteFade; + gBattlerControllerFuncs[gActiveBattler] = OpenBagAfterPaletteFade; gBankInMenu = gActiveBattler; } @@ -1304,20 +1304,20 @@ static void WallyHandleHealthBarUpdate(void) if (hpVal != INSTANT_HP_BAR_DROP) { - u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); - u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_HP); + u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); + u32 curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, curHP, hpVal); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal); } else { - u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP); + u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP); - SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, 0, hpVal); - UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], 0, HP_CURRENT); + SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal); + UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], 0, HP_CURRENT); } - gBattlerFuncs[gActiveBattler] = CompleteOnHealthbarDone; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; } static void WallyHandleExpUpdate(void) @@ -1402,16 +1402,16 @@ static void WallyHandleCmd40(void) static void WallyHandleHitAnimation(void) { - if (gSprites[gBankSpriteIds[gActiveBattler]].invisible == TRUE) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE) { WallyBufferExecCompleted(); } else { gDoingBattleAnim = TRUE; - gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; DoHitAnimHealthboxEffect(gActiveBattler); - gBattlerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; + gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect; } } @@ -1443,7 +1443,7 @@ static void WallyHandlePlayFanfareOrBGM(void) static void WallyHandleFaintingCry(void) { - u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES); + u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); PlayCry1(species, 25); WallyBufferExecCompleted(); @@ -1461,20 +1461,20 @@ static void WallyHandleIntroTrainerBallThrow(void) u8 paletteNum; u8 taskId; - oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]); + oamt_add_pos2_onto_pos1(&gSprites[gBattlerSpriteIds[gActiveBattler]]); - gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50; - gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40; - gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y; - gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC; - gSprites[gBankSpriteIds[gActiveBattler]].data[5] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC; + gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], sub_805CC00); - StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F8); LoadCompressedPalette(gTrainerBackPicPaletteTable[BACK_PIC_WALLY].data, 0x100 + paletteNum * 16, 32); - gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; + gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; taskId = CreateTask(sub_816AC04, 5); gTasks[taskId].data[0] = gActiveBattler; @@ -1483,7 +1483,7 @@ static void WallyHandleIntroTrainerBallThrow(void) gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30; gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerFuncs[gActiveBattler] = nullsub_21; + gBattlerControllerFuncs[gActiveBattler] = nullsub_21; } static void sub_816AA80(u8 bank) @@ -1491,25 +1491,25 @@ static void sub_816AA80(u8 bank) u16 species; gBattleSpritesDataPtr->bankData[bank].transformSpecies = 0; - gBattlePartyID[bank] = gBattleBufferA[bank][1]; - species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + gBattlerPartyIndexes[bank] = gBattleBufferA[bank][1]; + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); sub_806A068(species, GetBattlerPosition(bank)); - gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, - GetBankCoord(bank, 2), - GetBankSpriteDefault_Y(bank), + gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, + GetBattlerSpriteCoord(bank, 2), + GetBattlerSpriteDefault_Y(bank), sub_80A82E4(bank)); - gSprites[gUnknown_03005D7C[bank]].data[1] = gBankSpriteIds[bank]; + gSprites[gUnknown_03005D7C[bank]].data[1] = gBattlerSpriteIds[bank]; gSprites[gUnknown_03005D7C[bank]].data[2] = bank; - gSprites[gBankSpriteIds[bank]].data[0] = bank; - gSprites[gBankSpriteIds[bank]].data[2] = species; - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].data[2] = species; + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; - StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); - gSprites[gBankSpriteIds[bank]].invisible = TRUE; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]); + gSprites[gBattlerSpriteIds[bank]].invisible = TRUE; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); } @@ -1524,9 +1524,9 @@ static void sub_816AC04(u8 taskId) u8 savedActiveBank = gActiveBattler; gActiveBattler = gTasks[taskId].data[0]; - gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler]; + gBattleBufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; sub_816AA80(gActiveBattler); - gBattlerFuncs[gActiveBattler] = sub_816864C; + gBattlerControllerFuncs[gActiveBattler] = sub_816864C; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1569,7 +1569,7 @@ static void WallyHandleBattleAnimation(void) if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument)) WallyBufferExecCompleted(); else - gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; + gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; } static void WallyHandleLinkStandbyMsg(void) @@ -1590,7 +1590,7 @@ static void WallyHandleCmd55(void) WallyBufferExecCompleted(); if (!(gBattleTypeFlags & BATTLE_TYPE_WILD) && gBattleTypeFlags & BATTLE_TYPE_LINK) - gBattlerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; } static void nullsub_118(void) diff --git a/src/battle_controllers.c b/src/battle_controllers.c index aafc106aa..4d8b63c65 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -13,9 +13,9 @@ #include "battle_message.h" extern u32 gBattleTypeFlags; -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern void (*gBattleMainFunc)(void); -extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void); +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern u8 gBattlerPositions[MAX_BATTLERS_COUNT]; extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT]; @@ -24,15 +24,15 @@ extern u8 gActiveBattler; extern u8 gUnknown_0202428C; extern u32 gUnknown_02022FF4; extern u8 gUnknown_0203C7B4; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBuffersTransferData[0x100]; extern u8 gUnknown_02022D08; extern u8 gUnknown_02022D09; extern u8 gUnknown_02022D0A; -extern u8 gBattleAttacker; -extern u8 gBattleDefender; +extern u8 gBattleMoveAttacker; +extern u8 gBattleMoveTarget; extern u8 gAbsentBattlerFlags; extern u8 gEffectBank; extern u16 gBattleWeather; @@ -51,8 +51,8 @@ extern void sub_81B8D64(u8 bank, u8 arg1); // party_menu // this file's funcionts static void CreateTasksForSendRecvLinkBuffers(void); -static void SetControllersVariablesInLinkBattle(void); -static void SetControllersVariables(void); +static void InitLinkBtlControllers(void); +static void InitSinglePlayerBtlControllers(void); static void SetBattlePartyIds(void); static void Task_HandleSendLinkBuffersData(u8 taskId); static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId); @@ -78,14 +78,14 @@ void SetUpBattleVarsAndBirchZigzagoon(void) for (i = 0; i < MAX_BATTLERS_COUNT; i++) { - gBattlerFuncs[i] = nullsub_21; + gBattlerControllerFuncs[i] = nullsub_21; gBattlerPositions[i] = 0xFF; gActionSelectionCursor[i] = 0; gMoveSelectionCursor[i] = 0; } HandleLinkBattleSetup(); - gBattleExecBuffer = 0; + gBattleControllerExecFlags = 0; ClearBattleAnimationVars(); ClearBattleMonForms(); BattleAI_HandleItemUseBeforeAISetup(0xF); @@ -116,9 +116,9 @@ void sub_8032768(void) RecordedBattle_SaveParties(); if (gBattleTypeFlags & BATTLE_TYPE_LINK) - SetControllersVariablesInLinkBattle(); + InitLinkBtlControllers(); else - SetControllersVariables(); + InitSinglePlayerBtlControllers(); SetBattlePartyIds(); @@ -135,7 +135,7 @@ void sub_8032768(void) *(gBattleStruct->field_204 + i) = 0; } -static void SetControllersVariables(void) +static void InitSinglePlayerBtlControllers(void) { s32 i; @@ -145,30 +145,30 @@ static void SetControllersVariables(void) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) { - gBattlerFuncs[0] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[0] = SetControllerToRecordedPlayer; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[1] = SetControllerToOpponent; + gBattlerControllerFuncs[1] = SetControllerToOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; - gBattlerFuncs[2] = SetControllerToPlayerPartner; + gBattlerControllerFuncs[2] = SetControllerToPlayerPartner; gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; - gBattlerFuncs[3] = SetControllerToOpponent; + gBattlerControllerFuncs[3] = SetControllerToOpponent; gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; } else { - gBattlerFuncs[0] = SetControllerToPlayer; + gBattlerControllerFuncs[0] = SetControllerToPlayer; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[1] = SetControllerToOpponent; + gBattlerControllerFuncs[1] = SetControllerToOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; - gBattlerFuncs[2] = SetControllerToPlayerPartner; + gBattlerControllerFuncs[2] = SetControllerToPlayerPartner; gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; - gBattlerFuncs[3] = SetControllerToOpponent; + gBattlerControllerFuncs[3] = SetControllerToOpponent; gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; } @@ -179,25 +179,25 @@ static void SetControllersVariables(void) sub_81B8D64(2, 1); sub_81B8D64(3, 1); - gBattlePartyID[0] = 0; - gBattlePartyID[1] = 0; - gBattlePartyID[2] = 3; - gBattlePartyID[3] = 3; + gBattlerPartyIndexes[0] = 0; + gBattlerPartyIndexes[1] = 0; + gBattlerPartyIndexes[2] = 3; + gBattlerPartyIndexes[3] = 3; } else if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { gBattleMainFunc = BeginBattleIntro; if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) - gBattlerFuncs[0] = SetControllerToSafari; + gBattlerControllerFuncs[0] = SetControllerToSafari; else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) - gBattlerFuncs[0] = SetControllerToWally; + gBattlerControllerFuncs[0] = SetControllerToWally; else - gBattlerFuncs[0] = SetControllerToPlayer; + gBattlerControllerFuncs[0] = SetControllerToPlayer; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[1] = SetControllerToOpponent; + gBattlerControllerFuncs[1] = SetControllerToOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; gBattlersCount = 2; @@ -210,20 +210,20 @@ static void SetControllersVariables(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerFuncs[0] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[0] = SetControllerToRecordedPlayer; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[1] = SetControllerToRecordedOpponent; + gBattlerControllerFuncs[1] = SetControllerToRecordedOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; gBattlersCount = 2; } else // see how the banks are switched { - gBattlerFuncs[1] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[1] = SetControllerToRecordedPlayer; gBattlerPositions[1] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[0] = SetControllerToRecordedOpponent; + gBattlerControllerFuncs[0] = SetControllerToRecordedOpponent; gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT; gBattlersCount = 2; @@ -231,10 +231,10 @@ static void SetControllersVariables(void) } else { - gBattlerFuncs[0] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[0] = SetControllerToRecordedPlayer; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[1] = SetControllerToOpponent; + gBattlerControllerFuncs[1] = SetControllerToOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; } } @@ -243,16 +243,16 @@ static void SetControllersVariables(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerFuncs[0] = SetControllerToPlayer; + gBattlerControllerFuncs[0] = SetControllerToPlayer; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[1] = SetControllerToOpponent; + gBattlerControllerFuncs[1] = SetControllerToOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; - gBattlerFuncs[2] = SetControllerToPlayer; + gBattlerControllerFuncs[2] = SetControllerToPlayer; gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; - gBattlerFuncs[3] = SetControllerToOpponent; + gBattlerControllerFuncs[3] = SetControllerToOpponent; gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; gBattlersCount = 4; @@ -263,16 +263,16 @@ static void SetControllersVariables(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerFuncs[0] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[0] = SetControllerToRecordedPlayer; gBattlerPositions[0] = 0; - gBattlerFuncs[1] = SetControllerToOpponent; + gBattlerControllerFuncs[1] = SetControllerToOpponent; gBattlerPositions[1] = 1; - gBattlerFuncs[2] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[2] = SetControllerToRecordedPlayer; gBattlerPositions[2] = 2; - gBattlerFuncs[3] = SetControllerToOpponent; + gBattlerControllerFuncs[3] = SetControllerToOpponent; gBattlerPositions[3] = 3; gBattlersCount = 4; @@ -282,10 +282,10 @@ static void SetControllersVariables(void) sub_81B8D64(2, 1); sub_81B8D64(3, 1); - gBattlePartyID[0] = 0; - gBattlePartyID[1] = 0; - gBattlePartyID[2] = 3; - gBattlePartyID[3] = 3; + gBattlerPartyIndexes[0] = 0; + gBattlerPartyIndexes[1] = 0; + gBattlerPartyIndexes[2] = 3; + gBattlerPartyIndexes[3] = 3; } else if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { @@ -307,53 +307,53 @@ static void SetControllersVariables(void) if (i == var) { - gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer; switch (gLinkPlayers[i].lp_field_18) { case 0: case 3: gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_LEFT; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; break; case 1: case 2: gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_RIGHT; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; break; } } else if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[var].lp_field_18 & 1)) || ((gLinkPlayers[i].lp_field_18 & 1) && (gLinkPlayers[var].lp_field_18 & 1))) { - gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer; switch (gLinkPlayers[i].lp_field_18) { case 0: case 3: gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_LEFT; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; break; case 1: case 2: gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_RIGHT; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; break; } } else { - gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedOpponent; + gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedOpponent; switch (gLinkPlayers[i].lp_field_18) { case 0: case 3: gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_OPPONENT_LEFT; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; break; case 1: case 2: gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_OPPONENT_RIGHT; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; break; } } @@ -361,51 +361,51 @@ static void SetControllersVariables(void) } else if (gBattleTypeFlags & BATTLE_TYPE_WILD) { - gBattlerFuncs[0] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[0] = SetControllerToRecordedPlayer; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[2] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[2] = SetControllerToRecordedPlayer; gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; if (gBattleTypeFlags & BATTLE_TYPE_x2000000) { - gBattlerFuncs[1] = SetControllerToRecordedOpponent; + gBattlerControllerFuncs[1] = SetControllerToRecordedOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; - gBattlerFuncs[3] = SetControllerToRecordedOpponent; + gBattlerControllerFuncs[3] = SetControllerToRecordedOpponent; gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; } else { - gBattlerFuncs[1] = SetControllerToOpponent; + gBattlerControllerFuncs[1] = SetControllerToOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; - gBattlerFuncs[3] = SetControllerToOpponent; + gBattlerControllerFuncs[3] = SetControllerToOpponent; gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; } } else { - gBattlerFuncs[1] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[1] = SetControllerToRecordedPlayer; gBattlerPositions[1] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[3] = SetControllerToRecordedPlayer; + gBattlerControllerFuncs[3] = SetControllerToRecordedPlayer; gBattlerPositions[3] = B_POSITION_PLAYER_RIGHT; if (gBattleTypeFlags & BATTLE_TYPE_x2000000) { - gBattlerFuncs[0] = SetControllerToRecordedOpponent; + gBattlerControllerFuncs[0] = SetControllerToRecordedOpponent; gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT; - gBattlerFuncs[2] = SetControllerToRecordedOpponent; + gBattlerControllerFuncs[2] = SetControllerToRecordedOpponent; gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT; } else { - gBattlerFuncs[0] = SetControllerToOpponent; + gBattlerControllerFuncs[0] = SetControllerToOpponent; gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT; - gBattlerFuncs[2] = SetControllerToOpponent; + gBattlerControllerFuncs[2] = SetControllerToOpponent; gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT; } } @@ -413,7 +413,7 @@ static void SetControllersVariables(void) } } -static void SetControllersVariablesInLinkBattle(void) +static void InitLinkBtlControllers(void) { s32 i; u8 multiplayerId; @@ -424,20 +424,20 @@ static void SetControllersVariablesInLinkBattle(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerFuncs[0] = SetControllerToPlayer; + gBattlerControllerFuncs[0] = SetControllerToPlayer; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[1] = SetControllerToLinkOpponent; + gBattlerControllerFuncs[1] = SetControllerToLinkOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; gBattlersCount = 2; } else { - gBattlerFuncs[1] = SetControllerToPlayer; + gBattlerControllerFuncs[1] = SetControllerToPlayer; gBattlerPositions[1] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[0] = SetControllerToLinkOpponent; + gBattlerControllerFuncs[0] = SetControllerToLinkOpponent; gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT; gBattlersCount = 2; @@ -449,32 +449,32 @@ static void SetControllersVariablesInLinkBattle(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerFuncs[0] = SetControllerToPlayer; + gBattlerControllerFuncs[0] = SetControllerToPlayer; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[1] = SetControllerToLinkOpponent; + gBattlerControllerFuncs[1] = SetControllerToLinkOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; - gBattlerFuncs[2] = SetControllerToPlayer; + gBattlerControllerFuncs[2] = SetControllerToPlayer; gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; - gBattlerFuncs[3] = SetControllerToLinkOpponent; + gBattlerControllerFuncs[3] = SetControllerToLinkOpponent; gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; gBattlersCount = 4; } else { - gBattlerFuncs[1] = SetControllerToPlayer; + gBattlerControllerFuncs[1] = SetControllerToPlayer; gBattlerPositions[1] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[0] = SetControllerToLinkOpponent; + gBattlerControllerFuncs[0] = SetControllerToLinkOpponent; gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT; - gBattlerFuncs[3] = SetControllerToPlayer; + gBattlerControllerFuncs[3] = SetControllerToPlayer; gBattlerPositions[3] = B_POSITION_PLAYER_RIGHT; - gBattlerFuncs[2] = SetControllerToLinkOpponent; + gBattlerControllerFuncs[2] = SetControllerToLinkOpponent; gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT; gBattlersCount = 4; @@ -486,32 +486,32 @@ static void SetControllersVariablesInLinkBattle(void) { gBattleMainFunc = BeginBattleIntro; - gBattlerFuncs[0] = SetControllerToPlayer; + gBattlerControllerFuncs[0] = SetControllerToPlayer; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[1] = SetControllerToOpponent; + gBattlerControllerFuncs[1] = SetControllerToOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; - gBattlerFuncs[2] = SetControllerToLinkPartner; + gBattlerControllerFuncs[2] = SetControllerToLinkPartner; gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; - gBattlerFuncs[3] = SetControllerToOpponent; + gBattlerControllerFuncs[3] = SetControllerToOpponent; gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; gBattlersCount = 4; } else { - gBattlerFuncs[0] = SetControllerToLinkPartner; + gBattlerControllerFuncs[0] = SetControllerToLinkPartner; gBattlerPositions[0] = B_POSITION_PLAYER_LEFT; - gBattlerFuncs[1] = SetControllerToLinkOpponent; + gBattlerControllerFuncs[1] = SetControllerToLinkOpponent; gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT; - gBattlerFuncs[2] = SetControllerToPlayer; + gBattlerControllerFuncs[2] = SetControllerToPlayer; gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT; - gBattlerFuncs[3] = SetControllerToLinkOpponent; + gBattlerControllerFuncs[3] = SetControllerToLinkOpponent; gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT; gBattlersCount = 4; @@ -521,10 +521,10 @@ static void SetControllersVariablesInLinkBattle(void) sub_81B8D64(1, 0); sub_81B8D64(2, 1); sub_81B8D64(3, 1); - gBattlePartyID[0] = 0; - gBattlePartyID[1] = 0; - gBattlePartyID[2] = 3; - gBattlePartyID[3] = 3; + gBattlerPartyIndexes[0] = 0; + gBattlerPartyIndexes[1] = 0; + gBattlerPartyIndexes[2] = 3; + gBattlerPartyIndexes[3] = 3; } else { @@ -549,18 +549,18 @@ static void SetControllersVariablesInLinkBattle(void) if (i == multiplayerId) { - gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToPlayer; + gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToPlayer; switch (gLinkPlayers[i].lp_field_18) { case 0: case 3: gBattlerPositions[gLinkPlayers[i].lp_field_18] = 0; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; break; case 1: case 2: gBattlerPositions[gLinkPlayers[i].lp_field_18] = 2; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; break; } } @@ -569,35 +569,35 @@ static void SetControllersVariablesInLinkBattle(void) if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[multiplayerId].lp_field_18 & 1)) || ((gLinkPlayers[i].lp_field_18 & 1) && (gLinkPlayers[multiplayerId].lp_field_18 & 1))) { - gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToLinkPartner; + gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToLinkPartner; switch (gLinkPlayers[i].lp_field_18) { case 0: case 3: gBattlerPositions[gLinkPlayers[i].lp_field_18] = 0; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; break; case 1: case 2: gBattlerPositions[gLinkPlayers[i].lp_field_18] = 2; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; break; } } else { - gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToLinkOpponent; + gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToLinkOpponent; switch (gLinkPlayers[i].lp_field_18) { case 0: case 3: gBattlerPositions[gLinkPlayers[i].lp_field_18] = 1; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; break; case 1: case 2: gBattlerPositions[gLinkPlayers[i].lp_field_18] = 3; - gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; + gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; break; } } @@ -627,7 +627,7 @@ static void SetBattlePartyIds(void) && GetMonData(&gPlayerParty[j], MON_DATA_SPECIES2) != SPECIES_EGG && GetMonData(&gPlayerParty[j], MON_DATA_IS_EGG) == 0) { - gBattlePartyID[i] = j; + gBattlerPartyIndexes[i] = j; break; } } @@ -638,7 +638,7 @@ static void SetBattlePartyIds(void) && GetMonData(&gEnemyParty[j], MON_DATA_SPECIES2) != SPECIES_EGG && GetMonData(&gEnemyParty[j], MON_DATA_IS_EGG) == 0) { - gBattlePartyID[i] = j; + gBattlerPartyIndexes[i] = j; break; } } @@ -651,9 +651,9 @@ static void SetBattlePartyIds(void) && GetMonData(&gPlayerParty[j], MON_DATA_SPECIES) != SPECIES_NONE // Probably a typo by Game Freak. The rest use SPECIES2. && GetMonData(&gPlayerParty[j], MON_DATA_SPECIES2) != SPECIES_EGG && GetMonData(&gPlayerParty[j], MON_DATA_IS_EGG) == 0 - && gBattlePartyID[i - 2] != j) + && gBattlerPartyIndexes[i - 2] != j) { - gBattlePartyID[i] = j; + gBattlerPartyIndexes[i] = j; break; } } @@ -663,9 +663,9 @@ static void SetBattlePartyIds(void) && GetMonData(&gEnemyParty[j], MON_DATA_SPECIES2) != SPECIES_NONE && GetMonData(&gEnemyParty[j], MON_DATA_SPECIES2) != SPECIES_EGG && GetMonData(&gEnemyParty[j], MON_DATA_IS_EGG) == 0 - && gBattlePartyID[i - 2] != j) + && gBattlerPartyIndexes[i - 2] != j) { - gBattlePartyID[i] = j; + gBattlerPartyIndexes[i] = j; break; } } @@ -674,7 +674,7 @@ static void SetBattlePartyIds(void) } if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) - gBattlePartyID[1] = 0, gBattlePartyID[3] = 3; + gBattlerPartyIndexes[1] = 0, gBattlerPartyIndexes[3] = 3; } } @@ -752,8 +752,8 @@ void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data) } gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_BUFFER_ID] = bufferId; gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ACTIVE_BANK] = gActiveBattler; - gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ATTACKER] = gBattleAttacker; - gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_TARGET] = gBattleDefender; + gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ATTACKER] = gBattleMoveAttacker; + gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_TARGET] = gBattleMoveTarget; gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_SIZE_LO] = alignedSize; gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_SIZE_HI] = (alignedSize & 0x0000FF00) >> 8; gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ABSENT_BANK_FLAGS] = gAbsentBattlerFlags; @@ -912,7 +912,7 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) switch (gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 0]) { case 0: - if (gBattleExecBuffer & gBitTable[bank]) + if (gBattleControllerExecFlags & gBitTable[bank]) return; memcpy(gBattleBufferA[bank], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 8], blockSize); @@ -920,8 +920,8 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) if (!(gBattleTypeFlags & BATTLE_TYPE_WILD)) { - gBattleAttacker = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 2]; - gBattleDefender = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 3]; + gBattleMoveAttacker = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 2]; + gBattleMoveTarget = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 3]; gAbsentBattlerFlags = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 6]; gEffectBank = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 7]; } @@ -931,7 +931,7 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) break; case 2: var = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA]; - gBattleExecBuffer &= ~(gBitTable[bank] << (var * 4)); + gBattleControllerExecFlags &= ~(gBitTable[bank] << (var * 4)); break; } @@ -939,7 +939,7 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) } } -void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck) +void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck) { gBattleBuffersTransferData[0] = CONTROLLER_GETMONDATA; gBattleBuffersTransferData[1] = requestId; @@ -948,7 +948,7 @@ void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) +void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) { gBattleBuffersTransferData[0] = CONTROLLER_GETRAWMONDATA; gBattleBuffersTransferData[1] = monId; @@ -957,7 +957,7 @@ void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data) +void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data) { s32 i; @@ -969,7 +969,7 @@ void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *da PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 3 + bytes); } -void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data) +void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data) { s32 i; @@ -981,7 +981,7 @@ void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, bytes + 3); } -void EmitLoadMonSprite(u8 bufferId) +void BtlController_EmitLoadMonSprite(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_LOADMONSPRITE; gBattleBuffersTransferData[1] = CONTROLLER_LOADMONSPRITE; @@ -990,7 +990,7 @@ void EmitLoadMonSprite(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit) +void BtlController_EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit) { gBattleBuffersTransferData[0] = CONTROLLER_SWITCHINANIM; gBattleBuffersTransferData[1] = partyId; @@ -999,14 +999,14 @@ void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitReturnMonToBall(u8 bufferId, u8 arg1) +void BtlController_EmitReturnMonToBall(u8 bufferId, u8 arg1) { gBattleBuffersTransferData[0] = CONTROLLER_RETURNMONTOBALL; gBattleBuffersTransferData[1] = arg1; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); } -void EmitDrawTrainerPic(u8 bufferId) +void BtlController_EmitDrawTrainerPic(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_DRAWTRAINERPIC; gBattleBuffersTransferData[1] = CONTROLLER_DRAWTRAINERPIC; @@ -1015,7 +1015,7 @@ void EmitDrawTrainerPic(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitTrainerSlide(u8 bufferId) +void BtlController_EmitTrainerSlide(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDE; gBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDE; @@ -1024,7 +1024,7 @@ void EmitTrainerSlide(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitTrainerSlideBack(u8 bufferId) +void BtlController_EmitTrainerSlideBack(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDEBACK; gBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDEBACK; @@ -1033,7 +1033,7 @@ void EmitTrainerSlideBack(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitFaintAnimation(u8 bufferId) +void BtlController_EmitFaintAnimation(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_FAINTANIMATION; gBattleBuffersTransferData[1] = CONTROLLER_FAINTANIMATION; @@ -1042,7 +1042,7 @@ void EmitFaintAnimation(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitPaletteFade(u8 bufferId) +void BtlController_EmitPaletteFade(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_PALETTEFADE; gBattleBuffersTransferData[1] = CONTROLLER_PALETTEFADE; @@ -1051,7 +1051,7 @@ void EmitPaletteFade(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitSuccessBallThrowAnim(u8 bufferId) +void BtlController_EmitSuccessBallThrowAnim(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_SUCCESSBALLTHROWANIM; gBattleBuffersTransferData[1] = CONTROLLER_SUCCESSBALLTHROWANIM; @@ -1060,14 +1060,14 @@ void EmitSuccessBallThrowAnim(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitBallThrowAnim(u8 bufferId, u8 caseId) +void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId) { gBattleBuffersTransferData[0] = CONTROLLER_BALLTHROWANIM; gBattleBuffersTransferData[1] = caseId; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); } -void EmitPause(u8 bufferId, u8 toWait, void *data) +void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data) { s32 i; @@ -1078,7 +1078,7 @@ void EmitPause(u8 bufferId, u8 toWait, void *data) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, toWait * 3 + 2); } -void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit) +void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit) { gBattleBuffersTransferData[0] = CONTROLLER_MOVEANIMATION; gBattleBuffersTransferData[1] = move; @@ -1108,7 +1108,7 @@ void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 16 + sizeof(struct DisableStruct)); } -void EmitPrintString(u8 bufferId, u16 stringID) +void BtlController_EmitPrintString(u8 bufferId, u16 stringID) { s32 i; struct StringInfoBattle* stringInfo; @@ -1140,7 +1140,7 @@ void EmitPrintString(u8 bufferId, u16 stringID) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4); } -void EmitPrintSelectionString(u8 bufferId, u16 stringID) +void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID) { s32 i; struct StringInfoBattle *stringInfo; @@ -1169,7 +1169,7 @@ void EmitPrintSelectionString(u8 bufferId, u16 stringID) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4); } -void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2) +void BtlController_EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2) { gBattleBuffersTransferData[0] = CONTROLLER_CHOOSEACTION; gBattleBuffersTransferData[1] = arg1; @@ -1178,7 +1178,7 @@ void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitUnknownYesNoBox(u8 bufferId) +void BtlController_EmitUnknownYesNoBox(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_UNKNOWNYESNOBOX; gBattleBuffersTransferData[1] = CONTROLLER_UNKNOWNYESNOBOX; @@ -1187,7 +1187,7 @@ void EmitUnknownYesNoBox(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData) +void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData) { s32 i; @@ -1200,7 +1200,7 @@ void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(*movePpData) + 4); } -void EmitChooseItem(u8 bufferId, u8 *arg1) +void BtlController_EmitChooseItem(u8 bufferId, u8 *arg1) { s32 i; @@ -1210,7 +1210,7 @@ void EmitChooseItem(u8 bufferId, u8 *arg1) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4) +void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4) { s32 i; @@ -1223,7 +1223,7 @@ void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 8); // but only 7 bytes were written } -void EmitCmd23(u8 bufferId) +void BtlController_EmitCmd23(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_23; gBattleBuffersTransferData[1] = CONTROLLER_23; @@ -1233,7 +1233,7 @@ void EmitCmd23(u8 bufferId) } // why is the argument u16 if it's being cast to s16 anyway? -void EmitHealthBarUpdate(u8 bufferId, u16 hpValue) +void BtlController_EmitHealthBarUpdate(u8 bufferId, u16 hpValue) { gBattleBuffersTransferData[0] = CONTROLLER_HEALTHBARUPDATE; gBattleBuffersTransferData[1] = 0; @@ -1243,7 +1243,7 @@ void EmitHealthBarUpdate(u8 bufferId, u16 hpValue) } // why is the argument u16 if it's being cast to s16 anyway? -void EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints) +void BtlController_EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints) { gBattleBuffersTransferData[0] = CONTROLLER_EXPUPDATE; gBattleBuffersTransferData[1] = partyId; @@ -1252,7 +1252,7 @@ void EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2) +void BtlController_EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2) { gBattleBuffersTransferData[0] = CONTROLLER_STATUSICONUPDATE; gBattleBuffersTransferData[1] = status1; @@ -1266,7 +1266,7 @@ void EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 9); } -void EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status) +void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status) { gBattleBuffersTransferData[0] = CONTROLLER_STATUSANIMATION; gBattleBuffersTransferData[1] = status2; @@ -1277,14 +1277,14 @@ void EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 6); } -void EmitStatusXor(u8 bufferId, u8 b) +void BtlController_EmitStatusXor(u8 bufferId, u8 b) { gBattleBuffersTransferData[0] = CONTROLLER_STATUSXOR; gBattleBuffersTransferData[1] = b; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); } -void EmitDataTransfer(u8 bufferId, u16 size, void *data) +void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data) { s32 i; @@ -1297,7 +1297,7 @@ void EmitDataTransfer(u8 bufferId, u16 size, void *data) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 4); } -void EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data) +void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data) { s32 i; @@ -1313,7 +1313,7 @@ void EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 7); } -void EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter) +void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter) { s32 i; @@ -1325,7 +1325,7 @@ void EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, songId + 3); } -void EmitCmd32(u8 bufferId, u16 size, void *data) +void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data) { s32 i; @@ -1337,7 +1337,7 @@ void EmitCmd32(u8 bufferId, u16 size, void *data) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 3); } -void EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2) +void BtlController_EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2) { gBattleBuffersTransferData[0] = CONTROLLER_TWORETURNVALUES; gBattleBuffersTransferData[1] = arg1; @@ -1346,7 +1346,7 @@ void EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c) +void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c) { s32 i; @@ -1357,7 +1357,7 @@ void EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 5); } -void EmitOneReturnValue(u8 bufferId, u16 arg1) +void BtlController_EmitOneReturnValue(u8 bufferId, u16 arg1) { gBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE; gBattleBuffersTransferData[1] = arg1; @@ -1366,7 +1366,7 @@ void EmitOneReturnValue(u8 bufferId, u16 arg1) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitOneReturnValue_Duplicate(u8 bufferId, u16 b) +void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 b) { gBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE_DUPLICATE; gBattleBuffersTransferData[1] = b; @@ -1375,7 +1375,7 @@ void EmitOneReturnValue_Duplicate(u8 bufferId, u16 b) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd37(u8 bufferId) +void BtlController_EmitCmd37(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_37; gBattleBuffersTransferData[1] = CONTROLLER_37; @@ -1384,14 +1384,14 @@ void EmitCmd37(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd38(u8 bufferId, u8 b) +void BtlController_EmitCmd38(u8 bufferId, u8 b) { gBattleBuffersTransferData[0] = CONTROLLER_38; gBattleBuffersTransferData[1] = b; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); } -void EmitCmd39(u8 bufferId) +void BtlController_EmitCmd39(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_39; gBattleBuffersTransferData[1] = CONTROLLER_39; @@ -1400,7 +1400,7 @@ void EmitCmd39(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd40(u8 bufferId) +void BtlController_EmitCmd40(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_40; gBattleBuffersTransferData[1] = CONTROLLER_40; @@ -1409,7 +1409,7 @@ void EmitCmd40(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitHitAnimation(u8 bufferId) +void BtlController_EmitHitAnimation(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_HITANIMATION; gBattleBuffersTransferData[1] = CONTROLLER_HITANIMATION; @@ -1418,7 +1418,7 @@ void EmitHitAnimation(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd42(u8 bufferId) +void BtlController_EmitCmd42(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_42; gBattleBuffersTransferData[1] = CONTROLLER_42; @@ -1427,7 +1427,7 @@ void EmitCmd42(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitPlaySE(u8 bufferId, u16 songId) +void BtlController_EmitPlaySE(u8 bufferId, u16 songId) { gBattleBuffersTransferData[0] = CONTROLLER_EFFECTIVENESSSOUND; gBattleBuffersTransferData[1] = songId; @@ -1436,7 +1436,7 @@ void EmitPlaySE(u8 bufferId, u16 songId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM) +void BtlController_EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM) { gBattleBuffersTransferData[0] = CONTROLLER_PLAYFANFAREORBGM; gBattleBuffersTransferData[1] = songId; @@ -1445,7 +1445,7 @@ void EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitFaintingCry(u8 bufferId) +void BtlController_EmitFaintingCry(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_FAINTINGCRY; gBattleBuffersTransferData[1] = CONTROLLER_FAINTINGCRY; @@ -1454,14 +1454,14 @@ void EmitFaintingCry(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitIntroSlide(u8 bufferId, u8 terrainId) +void BtlController_EmitIntroSlide(u8 bufferId, u8 terrainId) { gBattleBuffersTransferData[0] = CONTROLLER_INTROSLIDE; gBattleBuffersTransferData[1] = terrainId; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); } -void EmitIntroTrainerBallThrow(u8 bufferId) +void BtlController_EmitIntroTrainerBallThrow(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_INTROTRAINERBALLTHROW; gBattleBuffersTransferData[1] = CONTROLLER_INTROTRAINERBALLTHROW; @@ -1470,7 +1470,7 @@ void EmitIntroTrainerBallThrow(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2) +void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2) { s32 i; @@ -1483,7 +1483,7 @@ void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct HpAndStatus) * 6 + 4); } -void EmitCmd49(u8 bufferId) +void BtlController_EmitCmd49(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_49; gBattleBuffersTransferData[1] = CONTROLLER_49; @@ -1492,7 +1492,7 @@ void EmitCmd49(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitCmd50(u8 bufferId) +void BtlController_EmitCmd50(u8 bufferId) { gBattleBuffersTransferData[0] = CONTROLLER_50; gBattleBuffersTransferData[1] = CONTROLLER_50; @@ -1501,7 +1501,7 @@ void EmitCmd50(u8 bufferId) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible) +void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible) { gBattleBuffersTransferData[0] = CONTROLLER_SPRITEINVISIBILITY; gBattleBuffersTransferData[1] = isInvisible; @@ -1510,7 +1510,7 @@ void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument) +void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument) { gBattleBuffersTransferData[0] = CONTROLLER_BATTLEANIMATION; gBattleBuffersTransferData[1] = animationId; @@ -1519,7 +1519,7 @@ void EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4); } -void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2) +void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2) { bool8 arg2_ = arg2; gBattleBuffersTransferData[0] = CONTROLLER_LINKSTANDBYMSG; @@ -1533,14 +1533,14 @@ void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2) PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, gBattleBuffersTransferData[2] + 4); } -void EmitResetActionMoveSelection(u8 bufferId, u8 caseId) +void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId) { gBattleBuffersTransferData[0] = CONTROLLER_RESETACTIONMOVESELECTION; gBattleBuffersTransferData[1] = caseId; PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2); } -void EmitCmd55(u8 bufferId, u8 arg1) +void BtlController_EmitCmd55(u8 bufferId, u8 arg1) { gBattleBuffersTransferData[0] = CONTROLLER_55; gBattleBuffersTransferData[1] = arg1; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index a6b6f7a09..d7806aee0 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -27,11 +27,11 @@ extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gActiveBattler; extern u8 gBattlersCount; extern u16 gUnknown_020243FC; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; extern u8 gBattlerPositions[MAX_BATTLERS_COUNT]; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT]; extern struct MusicPlayerInfo gMPlayInfo_SE1; @@ -439,15 +439,15 @@ bool8 TryHandleLaunchBattleTableAnimation(u8 activeBank, u8 atkBank, u8 defBank, } if (gBattleSpritesDataPtr->bankData[activeBank].behindSubstitute && tableId == B_ANIM_SUBSTITUTE_FADE - && gSprites[gBankSpriteIds[activeBank]].invisible) + && gSprites[gBattlerSpriteIds[activeBank]].invisible) { - LoadBattleMonGfxAndAnimate(activeBank, TRUE, gBankSpriteIds[activeBank]); + LoadBattleMonGfxAndAnimate(activeBank, TRUE, gBattlerSpriteIds[activeBank]); ClearBehindSubstituteBit(activeBank); return TRUE; } - gAnimBankAttacker = atkBank; - gAnimBankTarget = defBank; + gBattleAnimAttacker = atkBank; + gBattleAnimTarget = defBank; gBattleSpritesDataPtr->animationData->animArg = argument; LaunchBattleAnimation(gBattleAnims_VariousTable, tableId, FALSE); taskId = CreateTask(Task_ClearBitWhenBattleTableAnimDone, 10); @@ -491,8 +491,8 @@ void InitAndLaunchSpecialAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tab { u8 taskId; - gAnimBankAttacker = atkBank; - gAnimBankTarget = defBank; + gBattleAnimAttacker = atkBank; + gBattleAnimTarget = defBank; LaunchBattleAnimation(gBattleAnims_Special, tableId, FALSE); taskId = CreateTask(Task_ClearBitWhenSpecialAnimDone, 10); gTasks[taskId].tBank = activeBank; @@ -802,9 +802,9 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank) break; case 3: if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI) && *bank == 0) - gHealthBoxesIds[*bank] = CreateSafariPlayerHealthboxSprites(); + gHealthboxSpriteIds[*bank] = CreateSafariPlayerHealthboxSprites(); else - gHealthBoxesIds[*bank] = CreateBankHealthboxSprites(*bank); + gHealthboxSpriteIds[*bank] = CreateHealthboxSprites(*bank); (*bank)++; if (*bank == gBattlersCount) @@ -814,11 +814,11 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank) } break; case 4: - SetBankHealthboxSpritePos(*bank); + InitBattlerHealthboxCoords(*bank); if (gBattlerPositions[*bank] <= 1) - DummyBattleInterfaceFunc(gHealthBoxesIds[*bank], FALSE); + DummyBattleInterfaceFunc(gHealthboxSpriteIds[*bank], FALSE); else - DummyBattleInterfaceFunc(gHealthBoxesIds[*bank], TRUE); + DummyBattleInterfaceFunc(gHealthboxSpriteIds[*bank], TRUE); (*bank)++; if (*bank == gBattlersCount) @@ -831,13 +831,13 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank) if (GetBattlerSide(*bank) == B_SIDE_PLAYER) { if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) - UpdateHealthboxAttribute(gHealthBoxesIds[*bank], &gPlayerParty[gBattlePartyID[*bank]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[*bank], &gPlayerParty[gBattlerPartyIndexes[*bank]], HEALTHBOX_ALL); } else { - UpdateHealthboxAttribute(gHealthBoxesIds[*bank], &gEnemyParty[gBattlePartyID[*bank]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[*bank], &gEnemyParty[gBattlerPartyIndexes[*bank]], HEALTHBOX_ALL); } - SetHealthboxSpriteInvisible(gHealthBoxesIds[*bank]); + SetHealthboxSpriteInvisible(gHealthboxSpriteIds[*bank]); (*bank)++; if (*bank == gBattlersCount) { @@ -872,12 +872,12 @@ void CopyAllBattleSpritesInvisibilities(void) s32 i; for (i = 0; i < gBattlersCount; i++) - gBattleSpritesDataPtr->bankData[i].invisible = gSprites[gBankSpriteIds[i]].invisible; + gBattleSpritesDataPtr->bankData[i].invisible = gSprites[gBattlerSpriteIds[i]].invisible; } void CopyBattleSpriteInvisibility(u8 bank) { - gBattleSpritesDataPtr->bankData[bank].invisible = gSprites[gBankSpriteIds[bank]].invisible; + gBattleSpritesDataPtr->bankData[bank].invisible = gSprites[gBattlerSpriteIds[bank]].invisible; } void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform) @@ -890,7 +890,7 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform) if (notTransform) { - StartSpriteAnim(&gSprites[gBankSpriteIds[bankAtk]], gBattleSpritesDataPtr->animationData->animArg); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bankAtk]], gBattleSpritesDataPtr->animationData->animArg); paletteOffset = 0x100 + bankAtk * 16; LoadPalette(gBattleStruct->castformPalette[gBattleSpritesDataPtr->animationData->animArg], paletteOffset, 32); gBattleMonForms[bankAtk] = gBattleSpritesDataPtr->animationData->animArg; @@ -899,7 +899,7 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform) BlendPalette(paletteOffset, 16, 6, 0x7FFF); CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32); } - gSprites[gBankSpriteIds[bankAtk]].pos1.y = GetBankSpriteDefault_Y(bankAtk); + gSprites[gBattlerSpriteIds[bankAtk]].pos1.y = GetBattlerSpriteDefault_Y(bankAtk); } else { @@ -924,14 +924,14 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform) position = GetBattlerPosition(bankAtk); if (GetBattlerSide(bankDef) == B_SIDE_OPPONENT) - targetSpecies = GetMonData(&gEnemyParty[gBattlePartyID[bankDef]], MON_DATA_SPECIES); + targetSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bankDef]], MON_DATA_SPECIES); else - targetSpecies = GetMonData(&gPlayerParty[gBattlePartyID[bankDef]], MON_DATA_SPECIES); + targetSpecies = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bankDef]], MON_DATA_SPECIES); if (GetBattlerSide(bankAtk) == B_SIDE_PLAYER) { - personalityValue = GetMonData(&gPlayerParty[gBattlePartyID[bankAtk]], MON_DATA_PERSONALITY); - otId = GetMonData(&gPlayerParty[gBattlePartyID[bankAtk]], MON_DATA_OT_ID); + personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bankAtk]], MON_DATA_PERSONALITY); + otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bankAtk]], MON_DATA_OT_ID); HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies], gMonSpritesGfxPtr->sprites[position], @@ -940,8 +940,8 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform) } else { - personalityValue = GetMonData(&gEnemyParty[gBattlePartyID[bankAtk]], MON_DATA_PERSONALITY); - otId = GetMonData(&gEnemyParty[gBattlePartyID[bankAtk]], MON_DATA_OT_ID); + personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bankAtk]], MON_DATA_PERSONALITY); + otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bankAtk]], MON_DATA_OT_ID); HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[targetSpecies], gMonSpritesGfxPtr->sprites[position], @@ -951,7 +951,7 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform) } src = gMonSpritesGfxPtr->sprites[position]; - dst = (void *)(VRAM + 0x10000 + gSprites[gBankSpriteIds[bankAtk]].oam.tileNum * 32); + dst = (void *)(VRAM + 0x10000 + gSprites[gBattlerSpriteIds[bankAtk]].oam.tileNum * 32); DmaCopy32(3, src, dst, 0x800); paletteOffset = 0x100 + bankAtk * 16; lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue); @@ -960,7 +960,7 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform) if (targetSpecies == SPECIES_CASTFORM) { - gSprites[gBankSpriteIds[bankAtk]].anims = gMonAnimationsSpriteAnimsPtrTable[targetSpecies]; + gSprites[gBattlerSpriteIds[bankAtk]].anims = gMonAnimationsSpriteAnimsPtrTable[targetSpecies]; LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[0]); LoadPalette(gBattleStruct->castformPalette[0] + gBattleMonForms[bankDef] * 16, paletteOffset, 32); } @@ -974,8 +974,8 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform) gBattleMonForms[bankAtk] = gBattleMonForms[bankDef]; } - gSprites[gBankSpriteIds[bankAtk]].pos1.y = GetBankSpriteDefault_Y(bankAtk); - StartSpriteAnim(&gSprites[gBankSpriteIds[bankAtk]], gBattleMonForms[bankAtk]); + gSprites[gBattlerSpriteIds[bankAtk]].pos1.y = GetBattlerSpriteDefault_Y(bankAtk); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bankAtk]], gBattleMonForms[bankAtk]); } } @@ -1019,9 +1019,9 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite) if (!IsContest()) { if (GetBattlerSide(bank) != B_SIDE_PLAYER) - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank); else - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[bank]], bank); + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[bank]], bank); } } } @@ -1034,7 +1034,7 @@ void LoadBattleMonGfxAndAnimate(u8 bank, bool8 loadMonSprite, u8 spriteId) if (!loadMonSprite) gSprites[spriteId].pos1.y = GetSubstituteSpriteDefault_Y(bank); else - gSprites[spriteId].pos1.y = GetBankSpriteDefault_Y(bank); + gSprites[spriteId].pos1.y = GetBattlerSpriteDefault_Y(bank); } void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move) @@ -1103,8 +1103,8 @@ void sub_805EAE8(void) { u8 playerBank1 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); u8 playerBank2 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); - u8 bank1PartyId = pokemon_order_func(gBattlePartyID[playerBank1]); - u8 bank2PartyId = pokemon_order_func(gBattlePartyID[playerBank2]); + u8 bank1PartyId = pokemon_order_func(gBattlerPartyIndexes[playerBank1]); + u8 bank2PartyId = pokemon_order_func(gBattlerPartyIndexes[playerBank2]); if (GetMonData(&gPlayerParty[bank1PartyId], MON_DATA_HP) != 0) HandleLowHpMusicChange(&gPlayerParty[bank1PartyId], playerBank1); @@ -1119,17 +1119,17 @@ void sub_805EB9C(u8 affineMode) for (i = 0; i < gBattlersCount; i++) { - if (IsBankSpritePresent(i)) + if (IsBattlerSpritePresent(i)) { - gSprites[gBankSpriteIds[i]].oam.affineMode = affineMode; + gSprites[gBattlerSpriteIds[i]].oam.affineMode = affineMode; if (affineMode == 0) { - gBattleSpritesDataPtr->healthBoxesData[i].field_6 = gSprites[gBankSpriteIds[i]].oam.matrixNum; - gSprites[gBankSpriteIds[i]].oam.matrixNum = 0; + gBattleSpritesDataPtr->healthBoxesData[i].field_6 = gSprites[gBattlerSpriteIds[i]].oam.matrixNum; + gSprites[gBattlerSpriteIds[i]].oam.matrixNum = 0; } else { - gSprites[gBankSpriteIds[i]].oam.matrixNum = gBattleSpritesDataPtr->healthBoxesData[i].field_6; + gSprites[gBattlerSpriteIds[i]].oam.matrixNum = gBattleSpritesDataPtr->healthBoxesData[i].field_6; } } } @@ -1144,13 +1144,13 @@ void LoadAndCreateEnemyShadowSprites(void) LoadCompressedObjectPic(&gSpriteSheet_EnemyShadow); bank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankCoord(bank, 0), GetBankCoord(bank, 1) + 29, 0xC8); + gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBattlerSpriteCoord(bank, 0), GetBattlerSpriteCoord(bank, 1) + 29, 0xC8); gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank; if (IsDoubleBattle()) { bank = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); - gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankCoord(bank, 0), GetBankCoord(bank, 1) + 29, 0xC8); + gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBattlerSpriteCoord(bank, 0), GetBattlerSpriteCoord(bank, 1) + 29, 0xC8); gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank; } } @@ -1159,9 +1159,9 @@ void SpriteCB_EnemyShadow(struct Sprite *shadowSprite) { bool8 invisible = FALSE; u8 bank = shadowSprite->tBank; - struct Sprite *bankSprite = &gSprites[gBankSpriteIds[bank]]; + struct Sprite *bankSprite = &gSprites[gBattlerSpriteIds[bank]]; - if (!bankSprite->inUse || !IsBankSpritePresent(bank)) + if (!bankSprite->inUse || !IsBattlerSpritePresent(bank)) { shadowSprite->callback = SpriteCB_SetInvisible; return; @@ -1187,8 +1187,9 @@ void SpriteCB_SetInvisible(struct Sprite *sprite) sprite->invisible = 1; } -void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species) +void SetBattlerShadowSpriteCallback(u8 bank, u16 species) { + // The player's shadow is never seen if (GetBattlerSide(bank) == B_SIDE_PLAYER) return; @@ -1201,7 +1202,7 @@ void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species) gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].callback = SpriteCB_SetInvisible; } -void EnemyShadowCallbackToSetInvisible(u8 bank) +void HideBattlerShadowSprite(u8 bank) { gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].callback = SpriteCB_SetInvisible; } diff --git a/src/battle_interface.c b/src/battle_interface.c index b006a9d31..941fd20d5 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -154,9 +154,9 @@ enum }; extern u8 gBattlerPositions[MAX_BATTLERS_COUNT]; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattlersCount; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern const u8 * const gNatureNamePointers[]; extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; @@ -898,7 +898,7 @@ void sub_80724A8(s16 arg0, s16 arg1, u16 *arg2) // healthboxSpriteId_2 refers to the other part // there's also one other sprite that appears to be a black square? dont fully understand its role -u8 CreateBankHealthboxSprites(u8 bank) +u8 CreateHealthboxSprites(u8 bank) { s16 data6 = 0; u8 healthboxSpriteId_1, healthboxSpriteId_2; @@ -1089,9 +1089,9 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority) for (i = 0; i < gBattlersCount; i++) { - u8 healthboxSpriteId_1 = gHealthBoxesIds[i]; - u8 healthboxSpriteId_2 = gSprites[gHealthBoxesIds[i]].oam.affineParam; - u8 healthboxSpriteId_3 = gSprites[gHealthBoxesIds[i]].data[5]; + u8 healthboxSpriteId_1 = gHealthboxSpriteIds[i]; + u8 healthboxSpriteId_2 = gSprites[gHealthboxSpriteIds[i]].oam.affineParam; + u8 healthboxSpriteId_3 = gSprites[gHealthboxSpriteIds[i]].data[5]; gSprites[healthboxSpriteId_1].oam.priority = priority; gSprites[healthboxSpriteId_2].oam.priority = priority; @@ -1099,7 +1099,7 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority) } } -void SetBankHealthboxSpritePos(u8 bank) +void InitBattlerHealthboxCoords(u8 bank) { s16 x = 0, y = 0; @@ -1129,7 +1129,7 @@ void SetBankHealthboxSpritePos(u8 bank) } } - UpdateSpritePos(gHealthBoxesIds[bank], x, y); + UpdateSpritePos(gHealthboxSpriteIds[bank], x, y); } static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl) @@ -1417,7 +1417,7 @@ void SwapHpBarsWithHpText(void) for (i = 0; i < gBattlersCount; i++) { - if (gSprites[gHealthBoxesIds[i]].callback == SpriteCallbackDummy + if (gSprites[gHealthboxSpriteIds[i]].callback == SpriteCallbackDummy && GetBattlerSide(i) != B_SIDE_OPPONENT && (IsDoubleBattle() || GetBattlerSide(i) != B_SIDE_PLAYER)) { @@ -1434,17 +1434,17 @@ void SwapHpBarsWithHpText(void) if (noBars == TRUE) // bars to text { - spriteId = gSprites[gHealthBoxesIds[i]].data[5]; + spriteId = gSprites[gHealthboxSpriteIds[i]].data[5]; CpuFill32(0, (void*)(OBJ_VRAM0 + gSprites[spriteId].oam.tileNum * 32), 0x100); - UpdateHpTextInHealthboxInDoubles(gHealthBoxesIds[i], GetMonData(&gPlayerParty[gBattlePartyID[i]], MON_DATA_HP), HP_CURRENT); - UpdateHpTextInHealthboxInDoubles(gHealthBoxesIds[i], GetMonData(&gPlayerParty[gBattlePartyID[i]], MON_DATA_MAX_HP), HP_MAX); + UpdateHpTextInHealthboxInDoubles(gHealthboxSpriteIds[i], GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_HP), HP_CURRENT); + UpdateHpTextInHealthboxInDoubles(gHealthboxSpriteIds[i], GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_MAX_HP), HP_MAX); } else // text to bars { - UpdateStatusIconInHealthbox(gHealthBoxesIds[i]); - UpdateHealthboxAttribute(gHealthBoxesIds[i], &gPlayerParty[gBattlePartyID[i]], HEALTHBOX_HEALTH_BAR); - CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_117), (void*)(OBJ_VRAM0 + 0x680 + gSprites[gHealthBoxesIds[i]].oam.tileNum * 32), 32); + UpdateStatusIconInHealthbox(gHealthboxSpriteIds[i]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[i], &gPlayerParty[gBattlerPartyIndexes[i]], HEALTHBOX_HEALTH_BAR); + CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_117), (void*)(OBJ_VRAM0 + 0x680 + gSprites[gHealthboxSpriteIds[i]].oam.tileNum * 32), 32); } } else @@ -1453,26 +1453,26 @@ void SwapHpBarsWithHpText(void) { if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) { - sub_80730D4(gHealthBoxesIds[i], &gEnemyParty[gBattlePartyID[i]]); + sub_80730D4(gHealthboxSpriteIds[i], &gEnemyParty[gBattlerPartyIndexes[i]]); } else { - spriteId = gSprites[gHealthBoxesIds[i]].data[5]; + spriteId = gSprites[gHealthboxSpriteIds[i]].data[5]; CpuFill32(0, (void *)(OBJ_VRAM0 + gSprites[spriteId].oam.tileNum * 32), 0x100); - UpdateHpTextInHealthboxInDoubles(gHealthBoxesIds[i], GetMonData(&gEnemyParty[gBattlePartyID[i]], MON_DATA_HP), HP_CURRENT); - UpdateHpTextInHealthboxInDoubles(gHealthBoxesIds[i], GetMonData(&gEnemyParty[gBattlePartyID[i]], MON_DATA_MAX_HP), HP_MAX); + UpdateHpTextInHealthboxInDoubles(gHealthboxSpriteIds[i], GetMonData(&gEnemyParty[gBattlerPartyIndexes[i]], MON_DATA_HP), HP_CURRENT); + UpdateHpTextInHealthboxInDoubles(gHealthboxSpriteIds[i], GetMonData(&gEnemyParty[gBattlerPartyIndexes[i]], MON_DATA_MAX_HP), HP_MAX); } } else // text to bars { - UpdateStatusIconInHealthbox(gHealthBoxesIds[i]); - UpdateHealthboxAttribute(gHealthBoxesIds[i], &gEnemyParty[gBattlePartyID[i]], HEALTHBOX_HEALTH_BAR); + UpdateStatusIconInHealthbox(gHealthboxSpriteIds[i]); + UpdateHealthboxAttribute(gHealthboxSpriteIds[i], &gEnemyParty[gBattlerPartyIndexes[i]], HEALTHBOX_HEALTH_BAR); if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) - UpdateHealthboxAttribute(gHealthBoxesIds[i], &gEnemyParty[gBattlePartyID[i]], HEALTHBOX_NICK); + UpdateHealthboxAttribute(gHealthboxSpriteIds[i], &gEnemyParty[gBattlerPartyIndexes[i]], HEALTHBOX_NICK); } } - gSprites[gHealthBoxesIds[i]].data[7] ^= 1; + gSprites[gHealthboxSpriteIds[i]].data[7] ^= 1; } } } @@ -1994,7 +1994,7 @@ static void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus) bank = gSprites[healthboxSpriteId].data[6]; if (GetBattlerSide(bank) == B_SIDE_PLAYER) return; - if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES)), FLAG_GET_CAUGHT)) + if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES)), FLAG_GET_CAUGHT)) return; healthboxSpriteId_2 = gSprites[healthboxSpriteId].data[5]; @@ -2018,7 +2018,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId) healthboxSpriteId_2 = gSprites[healthboxSpriteId].data[5]; if (GetBattlerSide(bank) == B_SIDE_PLAYER) { - status = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_STATUS); + status = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_STATUS); if (!IsDoubleBattle()) tileNumAdder = 0x1A; else @@ -2026,7 +2026,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId) } else { - status = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_STATUS); + status = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_STATUS); tileNumAdder = 0x11; } @@ -2323,7 +2323,7 @@ static void sub_8074B9C(u8 bank, u8 whichBar) gBattleSpritesDataPtr->battleBars[bank].receivedValue, &gBattleSpritesDataPtr->battleBars[bank].field_10, array, 8); - level = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_LEVEL); + level = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_LEVEL); if (level == MAX_MON_LEVEL) { for (i = 0; i < 8; i++) diff --git a/src/battle_main.c b/src/battle_main.c index a0f89f019..df3fc9378 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -87,27 +87,27 @@ extern struct MusicPlayerInfo gMPlayInfo_SE1; extern struct MusicPlayerInfo gMPlayInfo_SE2; extern u8 gDecompressionBuffer[]; extern u16 gUnknown_020243FC; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; -extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void); +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; +extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; extern u8 gStringBank; extern u32 gUnknown_02022F88; extern u32 gHitMarker; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern u16 gPaydayMoney; extern u16 gBattleWeather; extern u16 gPauseCounterBattle; extern u16 gRandomTurnNumber; extern u8 gActiveBattler; extern u8 gBattlersCount; -extern u8 gBattleAttacker; -extern u8 gBattleDefender; +extern u8 gBattleMoveAttacker; +extern u8 gBattleMoveTarget; extern u8 gLeveledUpInBattle; extern u8 gAbsentBattlerFlags; -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u8 gMultiHitCounter; extern u8 gMoveResultFlags; extern s32 gBattleMoveDamage; @@ -2398,7 +2398,7 @@ static void sub_8039838(struct Sprite *sprite) if (sprite->animEnded) { sub_8076918(sprite->tBank); - SetHealthboxSpriteVisible(gHealthBoxesIds[sprite->tBank]); + SetHealthboxSpriteVisible(gHealthboxSpriteIds[sprite->tBank]); sprite->callback = sub_8039894; StartSpriteAnimIfDifferent(sprite, 0); BeginNormalPaletteFade(0x20000, 0, 10, 0, 0x2108); @@ -2456,11 +2456,11 @@ void sub_8039934(struct Sprite *sprite) else species = sprite->tSpeciesId; - GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_PERSONALITY); // Unused return value + GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_PERSONALITY); // Unused return value if (species == SPECIES_UNOWN) { - u32 personalityValue = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_PERSONALITY); + u32 personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_PERSONALITY); u16 unownForm = ((((personalityValue & 0x3000000) >> 18) | ((personalityValue & 0x30000) >> 12) | ((personalityValue & 0x300) >> 6) | (personalityValue & 3)) % 0x1C); u16 unownSpecies; @@ -2608,14 +2608,14 @@ void dp11b_obj_instanciate(u8 bank, u8 b, s8 c, s8 d) bounceHealthBoxSpriteId = CreateInvisibleSpriteWithCallback(SpriteCB_HealthBoxBounce); if (b == TRUE) { - spriteId2 = gHealthBoxesIds[bank]; + spriteId2 = gHealthboxSpriteIds[bank]; gBattleSpritesDataPtr->healthBoxesData[bank].field_2 = bounceHealthBoxSpriteId; gBattleSpritesDataPtr->healthBoxesData[bank].flag_x2 = 1; gSprites[bounceHealthBoxSpriteId].data[0] = 0x80; } else { - spriteId2 = gBankSpriteIds[bank]; + spriteId2 = gBattlerSpriteIds[bank]; gBattleSpritesDataPtr->healthBoxesData[bank].field_3 = bounceHealthBoxSpriteId; gBattleSpritesDataPtr->healthBoxesData[bank].flag_x4 = 1; gSprites[bounceHealthBoxSpriteId].data[0] = 0xC0; @@ -2710,7 +2710,7 @@ static void BattleMainCB1(void) gBattleMainFunc(); for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) - gBattlerFuncs[gActiveBattler](); + gBattlerControllerFuncs[gActiveBattler](); } static void BattleStartClearSetData(void) @@ -2752,8 +2752,8 @@ static void BattleStartClearSetData(void) dataPtr[j] = 0; } - gBattleAttacker = 0; - gBattleDefender = 0; + gBattleMoveAttacker = 0; + gBattleMoveTarget = 0; gBattleWeather = 0; dataPtr = (u8 *)&gWishFutureKnock; @@ -2774,7 +2774,7 @@ static void BattleStartClearSetData(void) gMultiHitCounter = 0; gBattleOutcome = 0; - gBattleExecBuffer = 0; + gBattleControllerExecFlags = 0; gPaydayMoney = 0; gBattleResources->battleScriptsStack->size = 0; gBattleResources->battleCallbackStack->size = 0; @@ -3040,12 +3040,12 @@ static void BattleIntroGetMonsData(void) { case 0: gActiveBattler = gBattleCommunication[1]; - EmitGetMonData(0, 0, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitGetMonData(0, 0, 0); + MarkBattlerForControllerExec(gActiveBattler); gBattleCommunication[MULTIUSE_STATE]++; break; case 1: - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gBattleCommunication[1]++; if (gBattleCommunication[1] == gBattlersCount) @@ -3059,11 +3059,11 @@ static void BattleIntroGetMonsData(void) static void BattleIntroPrepareBackgroundSlide(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gActiveBattler = GetBattlerAtPosition(0); - EmitIntroSlide(0, gBattleTerrain); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitIntroSlide(0, gBattleTerrain); + MarkBattlerForControllerExec(gActiveBattler); gBattleMainFunc = BattleIntroDrawTrainersOrMonsSprites; gBattleCommunication[0] = 0; gBattleCommunication[1] = 0; @@ -3075,7 +3075,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) u8 *ptr; s32 i; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) @@ -3107,16 +3107,16 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) { - EmitDrawTrainerPic(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitDrawTrainerPic(0); + MarkBattlerForControllerExec(gActiveBattler); } if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_LEFT) { - EmitDrawTrainerPic(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitDrawTrainerPic(0); + MarkBattlerForControllerExec(gActiveBattler); } if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT && !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER @@ -3140,9 +3140,9 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) { HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); } - EmitLoadMonSprite(0); - MarkBufferBankForExecution(gActiveBattler); - gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES, NULL); + BtlController_EmitLoadMonSprite(0); + MarkBattlerForControllerExec(gActiveBattler); + gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL); } } @@ -3151,15 +3151,15 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT || GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT) { - EmitDrawTrainerPic(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitDrawTrainerPic(0); + MarkBattlerForControllerExec(gActiveBattler); } } if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT) { - EmitDrawTrainerPic(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitDrawTrainerPic(0); + MarkBattlerForControllerExec(gActiveBattler); } if (gBattleTypeFlags & BATTLE_TYPE_ARENA) @@ -3173,7 +3173,7 @@ static void BattleIntroDrawPartySummaryScreens(void) s32 i; struct HpAndStatus hpStatus[6]; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) @@ -3193,8 +3193,8 @@ static void BattleIntroDrawPartySummaryScreens(void) } } gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - EmitDrawPartyStatusSummary(0, hpStatus, 0x80); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitDrawPartyStatusSummary(0, hpStatus, 0x80); + MarkBattlerForControllerExec(gActiveBattler); for (i = 0; i < PARTY_SIZE; i++) { @@ -3211,8 +3211,8 @@ static void BattleIntroDrawPartySummaryScreens(void) } } gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - EmitDrawPartyStatusSummary(0, hpStatus, 0x80); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitDrawPartyStatusSummary(0, hpStatus, 0x80); + MarkBattlerForControllerExec(gActiveBattler); gBattleMainFunc = BattleIntroPrintTrainerWantsToBattle; } @@ -3244,7 +3244,7 @@ static void BattleIntroDrawPartySummaryScreens(void) static void BattleIntroPrintTrainerWantsToBattle(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); PrepareStringBattle(STRINGID_INTROMSG, gActiveBattler); @@ -3254,7 +3254,7 @@ static void BattleIntroPrintTrainerWantsToBattle(void) static void BattleIntroPrintWildMonAttacked(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gBattleMainFunc = BattleIntroPrintPlayerSendsOut; PrepareStringBattle(STRINGID_INTROMSG, 0); @@ -3265,7 +3265,7 @@ static void BattleIntroPrintOpponentSendsOut(void) { u32 position; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) @@ -3304,8 +3304,8 @@ static void BattleIntroOpponent2SendsOutMonAnimation(void) { if (GetBattlerPosition(gActiveBattler) == position) { - EmitIntroTrainerBallThrow(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitIntroTrainerBallThrow(0); + MarkBattlerForControllerExec(gActiveBattler); } } @@ -3329,15 +3329,15 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void) else position = B_POSITION_OPPONENT_LEFT; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (GetBattlerPosition(gActiveBattler) == position) { - EmitIntroTrainerBallThrow(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitIntroTrainerBallThrow(0); + MarkBattlerForControllerExec(gActiveBattler); if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS)) { gBattleMainFunc = BattleIntroOpponent2SendsOutMonAnimation; @@ -3383,7 +3383,7 @@ _0803B288:\n\ _0803B298:\n\ movs r5, 0x1\n\ _0803B29A:\n\ - ldr r0, =gBattleExecBuffer\n\ + ldr r0, =gBattleControllerExecFlags\n\ ldr r2, [r0]\n\ cmp r2, 0\n\ bne _0803B2F2\n\ @@ -3403,9 +3403,9 @@ _0803B2B2:\n\ cmp r0, r5\n\ bne _0803B2D8\n\ movs r0, 0\n\ - bl EmitIntroTrainerBallThrow\n\ + bl BtlController_EmitIntroTrainerBallThrow\n\ ldrb r0, [r4]\n\ - bl MarkBufferBankForExecution\n\ + bl MarkBattlerForControllerExec\n\ ldr r0, =gBattleTypeFlags\n\ ldr r0, [r0]\n\ ldr r1, =0x00008040\n\ @@ -3440,7 +3440,7 @@ _0803B2F2:\n\ static void BattleIntroRecordMonsToDex(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { @@ -3460,13 +3460,13 @@ static void BattleIntroRecordMonsToDex(void) void sub_803B3AC(void) // unused { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) gBattleMainFunc = BattleIntroPrintPlayerSendsOut; } static void BattleIntroPrintPlayerSendsOut(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { u8 position; @@ -3509,8 +3509,8 @@ static void BattleIntroPlayer2SendsOutMonAnimation(void) { if (GetBattlerPosition(gActiveBattler) == position) { - EmitIntroTrainerBallThrow(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitIntroTrainerBallThrow(0); + MarkBattlerForControllerExec(gActiveBattler); } } @@ -3537,15 +3537,15 @@ static void BattleIntroPlayer1SendsOutMonAnimation(void) else position = B_POSITION_PLAYER_LEFT; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (GetBattlerPosition(gActiveBattler) == position) { - EmitIntroTrainerBallThrow(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitIntroTrainerBallThrow(0); + MarkBattlerForControllerExec(gActiveBattler); if (gBattleTypeFlags & (BATTLE_TYPE_MULTI)) { gBattleMainFunc = BattleIntroPlayer2SendsOutMonAnimation; @@ -3563,14 +3563,14 @@ static void BattleIntroPlayer1SendsOutMonAnimation(void) void sub_803B598(void) // unused { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) { - EmitSwitchInAnim(0, gBattlePartyID[gActiveBattler], FALSE); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSwitchInAnim(0, gBattlerPartyIndexes[gActiveBattler], FALSE); + MarkBattlerForControllerExec(gActiveBattler); } } @@ -3588,7 +3588,7 @@ static void TryDoEventsBeforeFirstTurn(void) s32 j; u8 effect = 0; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; if (gBattleStruct->switchInAbilitiesCounter == 0) @@ -3677,7 +3677,7 @@ static void HandleEndTurn_ContinueBattle(void) { s32 i; - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gBattleMainFunc = BattleTurnPassed; for (i = 0; i < BATTLE_COMMUNICATION_ENTRIES_COUNT; i++) @@ -3839,7 +3839,7 @@ void sub_803BDA0(u8 bank) for (i = 0; i < 3; i++) gUnknown_0203CF00[i] = *(bank * 3 + i + (u8*)(gBattleStruct->field_60)); - r4 = pokemon_order_func(gBattlePartyID[bank]); + r4 = pokemon_order_func(gBattlerPartyIndexes[bank]); r1 = pokemon_order_func(*(gBattleStruct->monToSwitchIntoId + bank)); sub_81B8FB0(r4, r1); @@ -3912,17 +3912,17 @@ static void HandleTurnActionSelectionState(void) } else { - EmitChooseAction(0, gActionForBanks[0], gBattleBufferB[0][1] | (gBattleBufferB[0][2] << 8)); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitChooseAction(0, gActionForBanks[0], gBattleBufferB[0][1] | (gBattleBufferB[0][2] << 8)); + MarkBattlerForControllerExec(gActiveBattler); gBattleCommunication[gActiveBattler]++; } } } break; case STATE_WAIT_ACTION_CHOSEN: // try to perform an action - if (!(gBattleExecBuffer & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) + if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) { - RecordedBattle_SetBankAction(gActiveBattler, gBattleBufferB[gActiveBattler][1]); + RecordedBattle_SetBattlerAction(gActiveBattler, gBattleBufferB[gActiveBattler][1]); gActionForBanks[gActiveBattler] = gBattleBufferB[gActiveBattler][1]; switch (gBattleBufferB[gActiveBattler][1]) @@ -3961,8 +3961,8 @@ static void HandleTurnActionSelectionState(void) i); } - EmitChooseMove(0, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0, FALSE, &moveInfo); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitChooseMove(0, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0, FALSE, &moveInfo); + MarkBattlerForControllerExec(gActiveBattler); } break; case ACTION_USE_ITEM: @@ -3971,7 +3971,7 @@ static void HandleTurnActionSelectionState(void) | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000)) { - RecordedBattle_ClearBankAction(gActiveBattler, 1); + RecordedBattle_ClearBattlerAction(gActiveBattler, 1); gSelectionBattleScripts[gActiveBattler] = BattleScript_ActionSelectionItemsCantBeUsed; gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; @@ -3980,17 +3980,17 @@ static void HandleTurnActionSelectionState(void) } else { - EmitChooseItem(0, gBattleStruct->field_60[gActiveBattler]); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitChooseItem(0, gBattleStruct->field_60[gActiveBattler]); + MarkBattlerForControllerExec(gActiveBattler); } break; case ACTION_SWITCH: - *(gBattleStruct->field_58 + gActiveBattler) = gBattlePartyID[gActiveBattler]; + *(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler]; if (gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION) || gBattleTypeFlags & BATTLE_TYPE_ARENA || gStatuses3[gActiveBattler] & STATUS3_ROOTED) { - EmitChoosePokemon(0, 2, 6, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); + BtlController_EmitChoosePokemon(0, 2, 6, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); } else if ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_SHADOW_TAG, 0, 0)) || ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_ARENA_TRAP, 0, 0)) @@ -4001,18 +4001,18 @@ static void HandleTurnActionSelectionState(void) && (gBattleMons[gActiveBattler].type1 == TYPE_STEEL || gBattleMons[gActiveBattler].type2 == TYPE_STEEL))) { - EmitChoosePokemon(0, ((i - 1) << 4) | 4, 6, gLastUsedAbility, gBattleStruct->field_60[gActiveBattler]); + BtlController_EmitChoosePokemon(0, ((i - 1) << 4) | 4, 6, gLastUsedAbility, gBattleStruct->field_60[gActiveBattler]); } else { if (gActiveBattler == 2 && gActionForBanks[0] == ACTION_SWITCH) - EmitChoosePokemon(0, 0, *(gBattleStruct->monToSwitchIntoId + 0), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); + BtlController_EmitChoosePokemon(0, 0, *(gBattleStruct->monToSwitchIntoId + 0), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); else if (gActiveBattler == 3 && gActionForBanks[1] == ACTION_SWITCH) - EmitChoosePokemon(0, 0, *(gBattleStruct->monToSwitchIntoId + 1), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); + BtlController_EmitChoosePokemon(0, 0, *(gBattleStruct->monToSwitchIntoId + 1), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); else - EmitChoosePokemon(0, 0, 6, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); + BtlController_EmitChoosePokemon(0, 0, 6, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); } - MarkBufferBankForExecution(gActiveBattler); + MarkBattlerForControllerExec(gActiveBattler); break; case ACTION_SAFARI_ZONE_BALL: if (IsPlayerPartyAndPokemonStorageFull()) @@ -4025,46 +4025,46 @@ static void HandleTurnActionSelectionState(void) } break; case ACTION_POKEBLOCK_CASE: - EmitChooseItem(0, gBattleStruct->field_60[gActiveBattler]); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitChooseItem(0, gBattleStruct->field_60[gActiveBattler]); + MarkBattlerForControllerExec(gActiveBattler); break; case ACTION_CANCEL_PARTNER: gBattleCommunication[gActiveBattler] = 7; gBattleCommunication[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)] = 1; - RecordedBattle_ClearBankAction(gActiveBattler, 1); + RecordedBattle_ClearBattlerAction(gActiveBattler, 1); if (gBattleMons[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)].status2 & STATUS2_MULTIPLETURNS || gBattleMons[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)].status2 & STATUS2_RECHARGE) { - EmitCmd50(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitCmd50(0); + MarkBattlerForControllerExec(gActiveBattler); return; } else if (gActionForBanks[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)] == ACTION_SWITCH) { - RecordedBattle_ClearBankAction(GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK), 2); + RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK), 2); } else if (gActionForBanks[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)] == ACTION_RUN) { - RecordedBattle_ClearBankAction(GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK), 1); + RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK), 1); } else if (gActionForBanks[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)] == ACTION_USE_MOVE && (gProtectStructs[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)].onlyStruggle || gDisableStructs[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)].encoredMove)) { - RecordedBattle_ClearBankAction(GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK), 1); + RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK), 1); } else if (gBattleTypeFlags & BATTLE_TYPE_PALACE && gActionForBanks[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)] == ACTION_USE_MOVE) { gRngValue = gBattlePalaceMoveSelectionRngValue; - RecordedBattle_ClearBankAction(GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK), 1); + RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK), 1); } else { - RecordedBattle_ClearBankAction(GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK), 3); + RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK), 3); } - EmitCmd50(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitCmd50(0); + MarkBattlerForControllerExec(gActiveBattler); return; } @@ -4101,7 +4101,7 @@ static void HandleTurnActionSelectionState(void) } break; case STATE_WAIT_ACTION_CASE_CHOSEN: - if (!(gBattleExecBuffer & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) + if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) { switch (gActionForBanks[gActiveBattler]) { @@ -4126,11 +4126,11 @@ static void HandleTurnActionSelectionState(void) if ((gBattleBufferB[gActiveBattler][2] | (gBattleBufferB[gActiveBattler][3] << 8)) == 0xFFFF) { gBattleCommunication[gActiveBattler] = 1; - RecordedBattle_ClearBankAction(gActiveBattler, 1); + RecordedBattle_ClearBattlerAction(gActiveBattler, 1); } else if (TrySetCantSelectMoveBattleScript()) { - RecordedBattle_ClearBankAction(gActiveBattler, 1); + RecordedBattle_ClearBattlerAction(gActiveBattler, 1); gBattleCommunication[gActiveBattler] = STATE_SELECTION_SCRIPT; *(gBattleStruct->selectionScriptFinished + gActiveBattler) = FALSE; gBattleBufferB[gActiveBattler][1] = 0; @@ -4141,8 +4141,8 @@ static void HandleTurnActionSelectionState(void) { if (!(gBattleTypeFlags & BATTLE_TYPE_PALACE)) { - RecordedBattle_SetBankAction(gActiveBattler, gBattleBufferB[gActiveBattler][2]); - RecordedBattle_SetBankAction(gActiveBattler, gBattleBufferB[gActiveBattler][3]); + RecordedBattle_SetBattlerAction(gActiveBattler, gBattleBufferB[gActiveBattler][2]); + RecordedBattle_SetBattlerAction(gActiveBattler, gBattleBufferB[gActiveBattler][3]); } *(gBattleStruct->chosenMovePositions + gActiveBattler) = gBattleBufferB[gActiveBattler][2]; gChosenMovesByBanks[gActiveBattler] = gBattleMons[gActiveBattler].moves[*(gBattleStruct->chosenMovePositions + gActiveBattler)]; @@ -4167,7 +4167,7 @@ static void HandleTurnActionSelectionState(void) if (gBattleBufferB[gActiveBattler][1] == 6) { gBattleCommunication[gActiveBattler] = 1; - RecordedBattle_ClearBankAction(gActiveBattler, 1); + RecordedBattle_ClearBattlerAction(gActiveBattler, 1); } else { @@ -4209,7 +4209,7 @@ static void HandleTurnActionSelectionState(void) } break; case STATE_WAIT_ACTION_CONFIRMED_STANDBY: - if (!(gBattleExecBuffer & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) + if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) { i = (sub_803CDB8() != 0); @@ -4217,18 +4217,18 @@ static void HandleTurnActionSelectionState(void) || (position & BIT_FLANK) || (*(&gBattleStruct->field_91) & gBitTable[GetBattlerAtPosition(position ^ BIT_FLANK)])) { - EmitLinkStandbyMsg(0, 0, i); + BtlController_EmitLinkStandbyMsg(0, 0, i); } else { - EmitLinkStandbyMsg(0, 1, i); + BtlController_EmitLinkStandbyMsg(0, 1, i); } - MarkBufferBankForExecution(gActiveBattler); + MarkBattlerForControllerExec(gActiveBattler); gBattleCommunication[gActiveBattler]++; } break; case STATE_WAIT_ACTION_CONFIRMED: - if (!(gBattleExecBuffer & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) + if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) { gBattleCommunication[ACTIONS_CONFIRMED_COUNT]++; } @@ -4240,9 +4240,9 @@ static void HandleTurnActionSelectionState(void) } else { - gBattleAttacker = gActiveBattler; + gBattleMoveAttacker = gActiveBattler; gBattlescriptCurrInstr = gSelectionBattleScripts[gActiveBattler]; - if (!(gBattleExecBuffer & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) + if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) { gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); } @@ -4250,7 +4250,7 @@ static void HandleTurnActionSelectionState(void) } break; case STATE_WAIT_SET_BEFORE_ACTION: - if (!(gBattleExecBuffer & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) + if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) { gBattleCommunication[gActiveBattler] = 1; } @@ -4266,15 +4266,15 @@ static void HandleTurnActionSelectionState(void) } else { - RecordedBattle_ClearBankAction(gActiveBattler, 1); + RecordedBattle_ClearBattlerAction(gActiveBattler, 1); gBattleCommunication[gActiveBattler] = *(gBattleStruct->stateIdAfterSelScript + gActiveBattler); } } else { - gBattleAttacker = gActiveBattler; + gBattleMoveAttacker = gActiveBattler; gBattlescriptCurrInstr = gSelectionBattleScripts[gActiveBattler]; - if (!(gBattleExecBuffer & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) + if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) { gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); } @@ -4320,7 +4320,7 @@ static bool8 sub_803CDB8(void) static void sub_803CDF8(void) { *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = gBattleBufferB[gActiveBattler][1]; - RecordedBattle_SetBankAction(gActiveBattler, gBattleBufferB[gActiveBattler][1]); + RecordedBattle_SetBattlerAction(gActiveBattler, gBattleBufferB[gActiveBattler][1]); if (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI) { @@ -4656,11 +4656,11 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void) { while (gBattleStruct->focusPunchBank < gBattlersCount) { - gActiveBattler = gBattleAttacker = gBattleStruct->focusPunchBank; + gActiveBattler = gBattleMoveAttacker = gBattleStruct->focusPunchBank; gBattleStruct->focusPunchBank++; if (gChosenMovesByBanks[gActiveBattler] == MOVE_FOCUS_PUNCH && !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP) - && !(gDisableStructs[gBattleAttacker].truantCounter) + && !(gDisableStructs[gBattleMoveAttacker].truantCounter) && !(gProtectStructs[gActiveBattler].onlyStruggle)) { BattleScriptExecute(BattleScript_FocusPunchSetUp); @@ -4716,7 +4716,7 @@ static void HandleEndTurn_BattleWon(void) { gSpecialVar_Result = gBattleOutcome; gBattleTextBuff1[0] = gBattleOutcome; - gBattleAttacker = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + gBattleMoveAttacker = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost; gBattleOutcome &= ~(B_OUTCOME_LINK_BATTLE_RAN); } @@ -4789,7 +4789,7 @@ static void HandleEndTurn_BattleLost(void) else { gBattleTextBuff1[0] = gBattleOutcome; - gBattleAttacker = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + gBattleMoveAttacker = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost; gBattleOutcome &= ~(B_OUTCOME_LINK_BATTLE_RAN); } @@ -4819,7 +4819,7 @@ static void HandleEndTurn_RanFromBattle(void) } else { - switch (gProtectStructs[gBattleAttacker].fleeFlag) + switch (gProtectStructs[gBattleMoveAttacker].fleeFlag) { default: gBattlescriptCurrInstr = BattleScript_GotAwaySafely; @@ -4840,7 +4840,7 @@ static void HandleEndTurn_MonFled(void) { gCurrentActionFuncId = 0; - PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattleAttacker, gBattlePartyID[gBattleAttacker]); + PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattleMoveAttacker, gBattlerPartyIndexes[gBattleMoveAttacker]); gBattlescriptCurrInstr = BattleScript_WildMonFled; gBattleMainFunc = HandleEndTurn_FinishBattle; @@ -4864,13 +4864,13 @@ static void HandleEndTurn_FinishBattle(void) { if (gBattleResults.playerMon1Species == SPECIES_NONE) { - gBattleResults.playerMon1Species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES, NULL); - GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_NICKNAME, gBattleResults.playerMon1Name); + gBattleResults.playerMon1Species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL); + GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_NICKNAME, gBattleResults.playerMon1Name); } else { - gBattleResults.playerMon2Species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES, NULL); - GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_NICKNAME, gBattleResults.playerMon2Name); + gBattleResults.playerMon2Species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL); + GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_NICKNAME, gBattleResults.playerMon2Name); } } } @@ -4898,7 +4898,7 @@ static void HandleEndTurn_FinishBattle(void) } else { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); } } @@ -5001,14 +5001,14 @@ void RunBattleScriptCommands_PopCallbacksStack(void) } else { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); } } void RunBattleScriptCommands(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]](); } @@ -5017,9 +5017,9 @@ static void HandleAction_UseMove(void) u8 side; u8 var = 4; - gBattleAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; + gBattleMoveAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; - if (*(&gBattleStruct->field_91) & gBitTable[gBattleAttacker]) + if (*(&gBattleStruct->field_91) & gBitTable[gBattleMoveAttacker]) { gCurrentActionFuncId = ACTION_FINISHED; return; @@ -5031,119 +5031,119 @@ static void HandleAction_UseMove(void) gMoveResultFlags = 0; gMultiHitCounter = 0; gBattleCommunication[6] = 0; - gCurrMovePos = gUnknown_020241E9 = *(gBattleStruct->chosenMovePositions + gBattleAttacker); + gCurrMovePos = gUnknown_020241E9 = *(gBattleStruct->chosenMovePositions + gBattleMoveAttacker); // choose move - if (gProtectStructs[gBattleAttacker].onlyStruggle) + if (gProtectStructs[gBattleMoveAttacker].onlyStruggle) { - gProtectStructs[gBattleAttacker].onlyStruggle = 0; + gProtectStructs[gBattleMoveAttacker].onlyStruggle = 0; gCurrentMove = gChosenMove = MOVE_STRUGGLE; gHitMarker |= HITMARKER_NO_PPDEDUCT; - *(gBattleStruct->moveTarget + gBattleAttacker) = GetMoveTarget(MOVE_STRUGGLE, 0); + *(gBattleStruct->moveTarget + gBattleMoveAttacker) = GetMoveTarget(MOVE_STRUGGLE, 0); } - else if (gBattleMons[gBattleAttacker].status2 & STATUS2_MULTIPLETURNS || gBattleMons[gBattleAttacker].status2 & STATUS2_RECHARGE) + else if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_MULTIPLETURNS || gBattleMons[gBattleMoveAttacker].status2 & STATUS2_RECHARGE) { - gCurrentMove = gChosenMove = gLockedMoves[gBattleAttacker]; + gCurrentMove = gChosenMove = gLockedMoves[gBattleMoveAttacker]; } // encore forces you to use the same move - else if (gDisableStructs[gBattleAttacker].encoredMove != MOVE_NONE - && gDisableStructs[gBattleAttacker].encoredMove == gBattleMons[gBattleAttacker].moves[gDisableStructs[gBattleAttacker].encoredMovePos]) + else if (gDisableStructs[gBattleMoveAttacker].encoredMove != MOVE_NONE + && gDisableStructs[gBattleMoveAttacker].encoredMove == gBattleMons[gBattleMoveAttacker].moves[gDisableStructs[gBattleMoveAttacker].encoredMovePos]) { - gCurrentMove = gChosenMove = gDisableStructs[gBattleAttacker].encoredMove; - gCurrMovePos = gUnknown_020241E9 = gDisableStructs[gBattleAttacker].encoredMovePos; - *(gBattleStruct->moveTarget + gBattleAttacker) = GetMoveTarget(gCurrentMove, 0); + gCurrentMove = gChosenMove = gDisableStructs[gBattleMoveAttacker].encoredMove; + gCurrMovePos = gUnknown_020241E9 = gDisableStructs[gBattleMoveAttacker].encoredMovePos; + *(gBattleStruct->moveTarget + gBattleMoveAttacker) = GetMoveTarget(gCurrentMove, 0); } // check if the encored move wasn't overwritten - else if (gDisableStructs[gBattleAttacker].encoredMove != MOVE_NONE - && gDisableStructs[gBattleAttacker].encoredMove != gBattleMons[gBattleAttacker].moves[gDisableStructs[gBattleAttacker].encoredMovePos]) + else if (gDisableStructs[gBattleMoveAttacker].encoredMove != MOVE_NONE + && gDisableStructs[gBattleMoveAttacker].encoredMove != gBattleMons[gBattleMoveAttacker].moves[gDisableStructs[gBattleMoveAttacker].encoredMovePos]) { - gCurrMovePos = gUnknown_020241E9 = gDisableStructs[gBattleAttacker].encoredMovePos; - gCurrentMove = gChosenMove = gBattleMons[gBattleAttacker].moves[gCurrMovePos]; - gDisableStructs[gBattleAttacker].encoredMove = MOVE_NONE; - gDisableStructs[gBattleAttacker].encoredMovePos = 0; - gDisableStructs[gBattleAttacker].encoreTimer1 = 0; - *(gBattleStruct->moveTarget + gBattleAttacker) = GetMoveTarget(gCurrentMove, 0); + gCurrMovePos = gUnknown_020241E9 = gDisableStructs[gBattleMoveAttacker].encoredMovePos; + gCurrentMove = gChosenMove = gBattleMons[gBattleMoveAttacker].moves[gCurrMovePos]; + gDisableStructs[gBattleMoveAttacker].encoredMove = MOVE_NONE; + gDisableStructs[gBattleMoveAttacker].encoredMovePos = 0; + gDisableStructs[gBattleMoveAttacker].encoreTimer1 = 0; + *(gBattleStruct->moveTarget + gBattleMoveAttacker) = GetMoveTarget(gCurrentMove, 0); } - else if (gBattleMons[gBattleAttacker].moves[gCurrMovePos] != gChosenMovesByBanks[gBattleAttacker]) + else if (gBattleMons[gBattleMoveAttacker].moves[gCurrMovePos] != gChosenMovesByBanks[gBattleMoveAttacker]) { - gCurrentMove = gChosenMove = gBattleMons[gBattleAttacker].moves[gCurrMovePos]; - *(gBattleStruct->moveTarget + gBattleAttacker) = GetMoveTarget(gCurrentMove, 0); + gCurrentMove = gChosenMove = gBattleMons[gBattleMoveAttacker].moves[gCurrMovePos]; + *(gBattleStruct->moveTarget + gBattleMoveAttacker) = GetMoveTarget(gCurrentMove, 0); } else { - gCurrentMove = gChosenMove = gBattleMons[gBattleAttacker].moves[gCurrMovePos]; + gCurrentMove = gChosenMove = gBattleMons[gBattleMoveAttacker].moves[gCurrMovePos]; } - if (gBattleMons[gBattleAttacker].hp != 0) + if (gBattleMons[gBattleMoveAttacker].hp != 0) { - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) gBattleResults.lastUsedMovePlayer = gCurrentMove; else gBattleResults.lastUsedMoveOpponent = gCurrentMove; } // choose target - side = GetBattlerSide(gBattleAttacker) ^ BIT_SIDE; + side = GetBattlerSide(gBattleMoveAttacker) ^ BIT_SIDE; if (gSideTimers[side].followmeTimer != 0 && gBattleMoves[gCurrentMove].target == MOVE_TARGET_SELECTED - && GetBattlerSide(gBattleAttacker) != GetBattlerSide(gSideTimers[side].followmeTarget) + && GetBattlerSide(gBattleMoveAttacker) != GetBattlerSide(gSideTimers[side].followmeTarget) && gBattleMons[gSideTimers[side].followmeTarget].hp != 0) { - gBattleDefender = gSideTimers[side].followmeTarget; + gBattleMoveTarget = gSideTimers[side].followmeTarget; } else if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gSideTimers[side].followmeTimer == 0 && (gBattleMoves[gCurrentMove].power != 0 || gBattleMoves[gCurrentMove].target != MOVE_TARGET_x10) - && gBattleMons[*(gBattleStruct->moveTarget + gBattleAttacker)].ability != ABILITY_LIGHTNING_ROD + && gBattleMons[*(gBattleStruct->moveTarget + gBattleMoveAttacker)].ability != ABILITY_LIGHTNING_ROD && gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC) { - side = GetBattlerSide(gBattleAttacker); + side = GetBattlerSide(gBattleMoveAttacker); for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (side != GetBattlerSide(gActiveBattler) - && *(gBattleStruct->moveTarget + gBattleAttacker) != gActiveBattler + && *(gBattleStruct->moveTarget + gBattleMoveAttacker) != gActiveBattler && gBattleMons[gActiveBattler].ability == ABILITY_LIGHTNING_ROD - && BankGetTurnOrder(gActiveBattler) < var) + && GetBattlerTurnOrderNum(gActiveBattler) < var) { - var = BankGetTurnOrder(gActiveBattler); + var = GetBattlerTurnOrderNum(gActiveBattler); } } if (var == 4) { if (gBattleMoves[gChosenMove].target & MOVE_TARGET_RANDOM) { - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) { if (Random() & 1) - gBattleDefender = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); else - gBattleDefender = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); } else { if (Random() & 1) - gBattleDefender = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); else - gBattleDefender = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); } } else { - gBattleDefender = *(gBattleStruct->moveTarget + gBattleAttacker); + gBattleMoveTarget = *(gBattleStruct->moveTarget + gBattleMoveAttacker); } - if (gAbsentBattlerFlags & gBitTable[gBattleDefender]) + if (gAbsentBattlerFlags & gBitTable[gBattleMoveTarget]) { - if (GetBattlerSide(gBattleAttacker) != GetBattlerSide(gBattleDefender)) + if (GetBattlerSide(gBattleMoveAttacker) != GetBattlerSide(gBattleMoveTarget)) { - gBattleDefender = GetBattlerAtPosition(GetBattlerPosition(gBattleDefender) ^ BIT_FLANK); + gBattleMoveTarget = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveTarget) ^ BIT_FLANK); } else { - gBattleDefender = GetBattlerAtPosition(GetBattlerPosition(gBattleAttacker) ^ BIT_SIDE); - if (gAbsentBattlerFlags & gBitTable[gBattleDefender]) - gBattleDefender = GetBattlerAtPosition(GetBattlerPosition(gBattleDefender) ^ BIT_FLANK); + gBattleMoveTarget = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveAttacker) ^ BIT_SIDE); + if (gAbsentBattlerFlags & gBitTable[gBattleMoveTarget]) + gBattleMoveTarget = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveTarget) ^ BIT_FLANK); } } } @@ -5152,65 +5152,65 @@ static void HandleAction_UseMove(void) gActiveBattler = gBattleTurnOrder[var]; RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability); gSpecialStatuses[gActiveBattler].lightningRodRedirected = 1; - gBattleDefender = gActiveBattler; + gBattleMoveTarget = gActiveBattler; } } else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && gBattleMoves[gChosenMove].target & MOVE_TARGET_RANDOM) { - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) { if (Random() & 1) - gBattleDefender = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); else - gBattleDefender = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); } else { if (Random() & 1) - gBattleDefender = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); else - gBattleDefender = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); } - if (gAbsentBattlerFlags & gBitTable[gBattleDefender] - && GetBattlerSide(gBattleAttacker) != GetBattlerSide(gBattleDefender)) + if (gAbsentBattlerFlags & gBitTable[gBattleMoveTarget] + && GetBattlerSide(gBattleMoveAttacker) != GetBattlerSide(gBattleMoveTarget)) { - gBattleDefender = GetBattlerAtPosition(GetBattlerPosition(gBattleDefender) ^ BIT_FLANK); + gBattleMoveTarget = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveTarget) ^ BIT_FLANK); } } else { - gBattleDefender = *(gBattleStruct->moveTarget + gBattleAttacker); - if (gAbsentBattlerFlags & gBitTable[gBattleDefender]) + gBattleMoveTarget = *(gBattleStruct->moveTarget + gBattleMoveAttacker); + if (gAbsentBattlerFlags & gBitTable[gBattleMoveTarget]) { - if (GetBattlerSide(gBattleAttacker) != GetBattlerSide(gBattleDefender)) + if (GetBattlerSide(gBattleMoveAttacker) != GetBattlerSide(gBattleMoveTarget)) { - gBattleDefender = GetBattlerAtPosition(GetBattlerPosition(gBattleDefender) ^ BIT_FLANK); + gBattleMoveTarget = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveTarget) ^ BIT_FLANK); } else { - gBattleDefender = GetBattlerAtPosition(GetBattlerPosition(gBattleAttacker) ^ BIT_SIDE); - if (gAbsentBattlerFlags & gBitTable[gBattleDefender]) - gBattleDefender = GetBattlerAtPosition(GetBattlerPosition(gBattleDefender) ^ BIT_FLANK); + gBattleMoveTarget = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveAttacker) ^ BIT_SIDE); + if (gAbsentBattlerFlags & gBitTable[gBattleMoveTarget]) + gBattleMoveTarget = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveTarget) ^ BIT_FLANK); } } } // choose battlescript if (gBattleTypeFlags & BATTLE_TYPE_PALACE - && gProtectStructs[gBattleAttacker].flag_x10) + && gProtectStructs[gBattleMoveAttacker].flag_x10) { - if (gBattleMons[gBattleAttacker].hp == 0) + if (gBattleMons[gBattleMoveAttacker].hp == 0) { gCurrentActionFuncId = 12; return; } - else if (gPalaceSelectionBattleScripts[gBattleAttacker] != NULL) + else if (gPalaceSelectionBattleScripts[gBattleMoveAttacker] != NULL) { gBattleCommunication[MULTISTRING_CHOOSER] = 4; - gBattlescriptCurrInstr = gPalaceSelectionBattleScripts[gBattleAttacker]; - gPalaceSelectionBattleScripts[gBattleAttacker] = NULL; + gBattlescriptCurrInstr = gPalaceSelectionBattleScripts[gBattleMoveAttacker]; + gPalaceSelectionBattleScripts[gBattleMoveAttacker] = NULL; } else { @@ -5224,22 +5224,22 @@ static void HandleAction_UseMove(void) } if (gBattleTypeFlags & BATTLE_TYPE_ARENA) - sub_81A56E8(gBattleAttacker); + sub_81A56E8(gBattleMoveAttacker); gCurrentActionFuncId = ACTION_RUN_BATTLESCRIPT; } static void HandleAction_Switch(void) { - gBattleAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; + gBattleMoveAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - gActionSelectionCursor[gBattleAttacker] = 0; - gMoveSelectionCursor[gBattleAttacker] = 0; + gActionSelectionCursor[gBattleMoveAttacker] = 0; + gMoveSelectionCursor[gBattleMoveAttacker] = 0; - PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattleAttacker, *(gBattleStruct->field_58 + gBattleAttacker)) + PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattleMoveAttacker, *(gBattleStruct->field_58 + gBattleMoveAttacker)) - gBattleScripting.battler = gBattleAttacker; + gBattleScripting.battler = gBattleMoveAttacker; gBattlescriptCurrInstr = BattleScript_ActionSwitch; gCurrentActionFuncId = ACTION_RUN_BATTLESCRIPT; @@ -5249,11 +5249,11 @@ static void HandleAction_Switch(void) static void HandleAction_UseItem(void) { - gBattleAttacker = gBattleDefender = gBattleTurnOrder[gCurrentTurnActionNumber]; + gBattleMoveAttacker = gBattleMoveTarget = gBattleTurnOrder[gCurrentTurnActionNumber]; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - ClearFuryCutterDestinyBondGrudge(gBattleAttacker); - gLastUsedItem = gBattleBufferB[gBattleAttacker][1] | (gBattleBufferB[gBattleAttacker][2] << 8); + ClearFuryCutterDestinyBondGrudge(gBattleMoveAttacker); + gLastUsedItem = gBattleBufferB[gBattleMoveAttacker][1] | (gBattleBufferB[gBattleMoveAttacker][2] << 8); if (gLastUsedItem <= ITEM_PREMIER_BALL) // is ball { @@ -5263,38 +5263,38 @@ static void HandleAction_UseItem(void) { gBattlescriptCurrInstr = gBattlescriptsForRunningByItem[0]; } - else if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + else if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) { gBattlescriptCurrInstr = gBattlescriptsForUsingItem[0]; } else { - gBattleScripting.battler = gBattleAttacker; + gBattleScripting.battler = gBattleMoveAttacker; - switch (*(gBattleStruct->AI_itemType + (gBattleAttacker >> 1))) + switch (*(gBattleStruct->AI_itemType + (gBattleMoveAttacker >> 1))) { case AI_ITEM_FULL_RESTORE: case AI_ITEM_HEAL_HP: break; case AI_ITEM_CURE_CONDITION: gBattleCommunication[MULTISTRING_CHOOSER] = 0; - if (*(gBattleStruct->AI_itemFlags + gBattleAttacker / 2) & 1) + if (*(gBattleStruct->AI_itemFlags + gBattleMoveAttacker / 2) & 1) { - if (*(gBattleStruct->AI_itemFlags + gBattleAttacker / 2) & 0x3E) + if (*(gBattleStruct->AI_itemFlags + gBattleMoveAttacker / 2) & 0x3E) gBattleCommunication[MULTISTRING_CHOOSER] = 5; } else { - while (!(*(gBattleStruct->AI_itemFlags + gBattleAttacker / 2) & 1)) + while (!(*(gBattleStruct->AI_itemFlags + gBattleMoveAttacker / 2) & 1)) { - *(gBattleStruct->AI_itemFlags + gBattleAttacker / 2) >>= 1; + *(gBattleStruct->AI_itemFlags + gBattleMoveAttacker / 2) >>= 1; gBattleCommunication[MULTISTRING_CHOOSER]++; } } break; case AI_ITEM_X_STAT: gBattleCommunication[MULTISTRING_CHOOSER] = 4; - if (*(gBattleStruct->AI_itemFlags + (gBattleAttacker >> 1)) & 0x80) + if (*(gBattleStruct->AI_itemFlags + (gBattleMoveAttacker >> 1)) & 0x80) { gBattleCommunication[MULTISTRING_CHOOSER] = 5; } @@ -5303,9 +5303,9 @@ static void HandleAction_UseItem(void) PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK) PREPARE_STRING_BUFFER(gBattleTextBuff2, 0xD2) - while (!((*(gBattleStruct->AI_itemFlags + (gBattleAttacker >> 1))) & 1)) + while (!((*(gBattleStruct->AI_itemFlags + (gBattleMoveAttacker >> 1))) & 1)) { - *(gBattleStruct->AI_itemFlags + gBattleAttacker / 2) >>= 1; + *(gBattleStruct->AI_itemFlags + gBattleMoveAttacker / 2) >>= 1; gBattleTextBuff1[2]++; } @@ -5321,7 +5321,7 @@ static void HandleAction_UseItem(void) break; } - gBattlescriptCurrInstr = gBattlescriptsForUsingItem[*(gBattleStruct->AI_itemType + gBattleAttacker / 2)]; + gBattlescriptCurrInstr = gBattlescriptsForUsingItem[*(gBattleStruct->AI_itemType + gBattleMoveAttacker / 2)]; } gCurrentActionFuncId = ACTION_RUN_BATTLESCRIPT; } @@ -5408,7 +5408,7 @@ bool8 TryRunFromBattle(u8 bank) static void HandleAction_Run(void) { - gBattleAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; + gBattleMoveAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) { @@ -5433,11 +5433,11 @@ static void HandleAction_Run(void) } else { - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) { - if (!TryRunFromBattle(gBattleAttacker)) // failed to run away + if (!TryRunFromBattle(gBattleMoveAttacker)) // failed to run away { - ClearFuryCutterDestinyBondGrudge(gBattleAttacker); + ClearFuryCutterDestinyBondGrudge(gBattleMoveAttacker); gBattleCommunication[MULTISTRING_CHOOSER] = 3; gBattlescriptCurrInstr = BattleScript_PrintFailedToRunString; gCurrentActionFuncId = ACTION_RUN_BATTLESCRIPT; @@ -5445,7 +5445,7 @@ static void HandleAction_Run(void) } else { - if (gBattleMons[gBattleAttacker].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)) + if (gBattleMons[gBattleMoveAttacker].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)) { gBattleCommunication[MULTISTRING_CHOOSER] = 4; gBattlescriptCurrInstr = BattleScript_PrintFailedToRunString; @@ -5462,7 +5462,7 @@ static void HandleAction_Run(void) static void HandleAction_WatchesCarefully(void) { - gBattleAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; + gBattleMoveAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; gBattlescriptCurrInstr = gBattlescriptsForSafariActions[0]; @@ -5471,7 +5471,7 @@ static void HandleAction_WatchesCarefully(void) static void HandleAction_SafariZoneBallThrow(void) { - gBattleAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; + gBattleMoveAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; gNumSafariBalls--; @@ -5482,11 +5482,11 @@ static void HandleAction_SafariZoneBallThrow(void) static void HandleAction_ThrowPokeblock(void) { - gBattleAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; + gBattleMoveAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = gBattleBufferB[gBattleAttacker][1] - 1; - gLastUsedItem = gBattleBufferB[gBattleAttacker][2]; + gBattleCommunication[MULTISTRING_CHOOSER] = gBattleBufferB[gBattleMoveAttacker][1] - 1; + gLastUsedItem = gBattleBufferB[gBattleMoveAttacker][2]; if (gBattleResults.field_1F < 0xFF) gBattleResults.field_1F++; @@ -5506,7 +5506,7 @@ static void HandleAction_ThrowPokeblock(void) static void HandleAction_GoNear(void) { - gBattleAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; + gBattleMoveAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; @@ -5533,7 +5533,7 @@ static void HandleAction_GoNear(void) static void HandleAction_SafriZoneRun(void) { - gBattleAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; + gBattleMoveAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; PlaySE(SE_NIGERU); gCurrentTurnActionNumber = gBattlersCount; gBattleOutcome = B_OUTCOME_RAN; @@ -5541,11 +5541,11 @@ static void HandleAction_SafriZoneRun(void) static void HandleAction_Action9(void) { - gBattleAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; + gBattleMoveAttacker = gBattleTurnOrder[gCurrentTurnActionNumber]; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattleAttacker, gBattlePartyID[gBattleAttacker]) + PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattleMoveAttacker, gBattlerPartyIndexes[gBattleMoveAttacker]) gBattlescriptCurrInstr = gBattlescriptsForSafariActions[3]; gCurrentActionFuncId = ACTION_RUN_BATTLESCRIPT; @@ -5589,8 +5589,8 @@ static void HandleAction_ActionFinished(void) gMoveResultFlags = 0; gBattleScripting.animTurn = 0; gBattleScripting.animTargetsHit = 0; - gLastLandedMoves[gBattleAttacker] = 0; - gLastHitByType[gBattleAttacker] = 0; + gLastLandedMoves[gBattleMoveAttacker] = 0; + gLastHitByType[gBattleMoveAttacker] = 0; gBattleStruct->dynamicMoveType = 0; gDynamicBasePower = 0; gBattleScripting.atk49_state = 0; diff --git a/src/battle_message.c b/src/battle_message.c index 3bfa5b48d..07e5b2d60 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -17,8 +17,8 @@ extern u16 gLastUsedItem; extern u8 gLastUsedAbility; extern u8 gActiveBattler; -extern u8 gBattleAttacker; -extern u8 gBattleDefender; +extern u8 gBattleMoveAttacker; +extern u8 gBattleMoveTarget; extern u8 gStringBank; extern u8 gEffectBank; extern u8 gAbilitiesPerBank[MAX_BATTLERS_COUNT]; @@ -26,7 +26,7 @@ extern u32 gBattleTypeFlags; extern u16 gTrainerBattleOpponent_A; extern u16 gTrainerBattleOpponent_B; extern u16 gPartnerTrainerId; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT]; extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT]; @@ -1836,80 +1836,80 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst) toCpy = gStringVar3; break; case B_TXT_PLAYER_MON1_NAME: // first player poke name - GetMonData(&gPlayerParty[gBattlePartyID[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]], + GetMonData(&gPlayerParty[gBattlerPartyIndexes[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]], MON_DATA_NICKNAME, text); StringGetEnd10(text); toCpy = text; break; case B_TXT_OPPONENT_MON1_NAME: // first enemy poke name - GetMonData(&gEnemyParty[gBattlePartyID[GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)]], + GetMonData(&gEnemyParty[gBattlerPartyIndexes[GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)]], MON_DATA_NICKNAME, text); StringGetEnd10(text); toCpy = text; break; case B_TXT_PLAYER_MON2_NAME: // second player poke name - GetMonData(&gPlayerParty[gBattlePartyID[GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT)]], + GetMonData(&gPlayerParty[gBattlerPartyIndexes[GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT)]], MON_DATA_NICKNAME, text); StringGetEnd10(text); toCpy = text; break; case B_TXT_OPPONENT_MON2_NAME: // second enemy poke name - GetMonData(&gEnemyParty[gBattlePartyID[GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)]], + GetMonData(&gEnemyParty[gBattlerPartyIndexes[GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)]], MON_DATA_NICKNAME, text); StringGetEnd10(text); toCpy = text; break; case B_TXT_LINK_PLAYER_MON1_NAME: // link first player poke name - GetMonData(&gPlayerParty[gBattlePartyID[gLinkPlayers[multiplayerID].lp_field_18]], + GetMonData(&gPlayerParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].lp_field_18]], MON_DATA_NICKNAME, text); StringGetEnd10(text); toCpy = text; break; case B_TXT_LINK_OPPONENT_MON1_NAME: // link first opponent poke name - GetMonData(&gEnemyParty[gBattlePartyID[gLinkPlayers[multiplayerID].lp_field_18 ^ 1]], + GetMonData(&gEnemyParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].lp_field_18 ^ 1]], MON_DATA_NICKNAME, text); StringGetEnd10(text); toCpy = text; break; case B_TXT_LINK_PLAYER_MON2_NAME: // link second player poke name - GetMonData(&gPlayerParty[gBattlePartyID[gLinkPlayers[multiplayerID].lp_field_18 ^ 2]], + GetMonData(&gPlayerParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].lp_field_18 ^ 2]], MON_DATA_NICKNAME, text); StringGetEnd10(text); toCpy = text; break; case B_TXT_LINK_OPPONENT_MON2_NAME: // link second opponent poke name - GetMonData(&gEnemyParty[gBattlePartyID[gLinkPlayers[multiplayerID].lp_field_18 ^ 3]], + GetMonData(&gEnemyParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].lp_field_18 ^ 3]], MON_DATA_NICKNAME, text); StringGetEnd10(text); toCpy = text; break; case B_TXT_ATK_NAME_WITH_PREFIX_MON1: // attacker name with prefix, only bank 0/1 - HANDLE_NICKNAME_STRING_CASE(gBattleAttacker, - gBattlePartyID[GetBattlerAtPosition(GET_BATTLER_SIDE(gBattleAttacker))]) + HANDLE_NICKNAME_STRING_CASE(gBattleMoveAttacker, + gBattlerPartyIndexes[GetBattlerAtPosition(GET_BATTLER_SIDE(gBattleMoveAttacker))]) break; case B_TXT_ATK_PARTNER_NAME: // attacker partner name - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) - GetMonData(&gPlayerParty[gBattlePartyID[GetBattlerAtPosition(GET_BATTLER_SIDE(gBattleAttacker)) + 2]], MON_DATA_NICKNAME, text); + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) + GetMonData(&gPlayerParty[gBattlerPartyIndexes[GetBattlerAtPosition(GET_BATTLER_SIDE(gBattleMoveAttacker)) + 2]], MON_DATA_NICKNAME, text); else - GetMonData(&gEnemyParty[gBattlePartyID[GetBattlerAtPosition(GET_BATTLER_SIDE(gBattleAttacker)) + 2]], MON_DATA_NICKNAME, text); + GetMonData(&gEnemyParty[gBattlerPartyIndexes[GetBattlerAtPosition(GET_BATTLER_SIDE(gBattleMoveAttacker)) + 2]], MON_DATA_NICKNAME, text); StringGetEnd10(text); toCpy = text; break; case B_TXT_ATK_NAME_WITH_PREFIX: // attacker name with prefix - HANDLE_NICKNAME_STRING_CASE(gBattleAttacker, gBattlePartyID[gBattleAttacker]) + HANDLE_NICKNAME_STRING_CASE(gBattleMoveAttacker, gBattlerPartyIndexes[gBattleMoveAttacker]) break; case B_TXT_DEF_NAME_WITH_PREFIX: // target name with prefix - HANDLE_NICKNAME_STRING_CASE(gBattleDefender, gBattlePartyID[gBattleDefender]) + HANDLE_NICKNAME_STRING_CASE(gBattleMoveTarget, gBattlerPartyIndexes[gBattleMoveTarget]) break; case B_TXT_EFF_NAME_WITH_PREFIX: // effect bank name with prefix - HANDLE_NICKNAME_STRING_CASE(gEffectBank, gBattlePartyID[gEffectBank]) + HANDLE_NICKNAME_STRING_CASE(gEffectBank, gBattlerPartyIndexes[gEffectBank]) break; case B_TXT_ACTIVE_NAME_WITH_PREFIX: // active bank name with prefix - HANDLE_NICKNAME_STRING_CASE(gActiveBattler, gBattlePartyID[gActiveBattler]) + HANDLE_NICKNAME_STRING_CASE(gActiveBattler, gBattlerPartyIndexes[gActiveBattler]) break; case B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX: // scripting active bank name with prefix - HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler, gBattlePartyID[gBattleScripting.battler]) + HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler, gBattlerPartyIndexes[gBattleScripting.battler]) break; case B_TXT_CURRENT_MOVE: // current move name if (gStringInfo->currentMove > LAST_MOVE_INDEX) @@ -1970,10 +1970,10 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst) toCpy = gAbilityNames[gLastUsedAbility]; break; case B_TXT_ATK_ABILITY: // attacker ability - toCpy = gAbilityNames[gAbilitiesPerBank[gBattleAttacker]]; + toCpy = gAbilityNames[gAbilitiesPerBank[gBattleMoveAttacker]]; break; case B_TXT_DEF_ABILITY: // target ability - toCpy = gAbilityNames[gAbilitiesPerBank[gBattleDefender]]; + toCpy = gAbilityNames[gAbilitiesPerBank[gBattleMoveTarget]]; break; case B_TXT_SCR_ACTIVE_ABILITY: // scripting active ability toCpy = gAbilityNames[gAbilitiesPerBank[gBattleScripting.battler]]; @@ -2039,16 +2039,16 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst) toCpy = gLinkPlayers[multiplayerID].name; break; case B_TXT_1F: // link partner name? - toCpy = gLinkPlayers[GetBankMultiplayerId(2 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; + toCpy = gLinkPlayers[GetBattlerMultiplayerId(2 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; break; case B_TXT_20: // link opponent 1 name? - toCpy = gLinkPlayers[GetBankMultiplayerId(1 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; + toCpy = gLinkPlayers[GetBattlerMultiplayerId(1 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; break; case B_TXT_21: // link opponent 2 name? - toCpy = gLinkPlayers[GetBankMultiplayerId(3 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; + toCpy = gLinkPlayers[GetBattlerMultiplayerId(3 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; break; case B_TXT_22: // link scripting active name - toCpy = gLinkPlayers[GetBankMultiplayerId(gBattleScripting.battler)].name; + toCpy = gLinkPlayers[GetBattlerMultiplayerId(gBattleScripting.battler)].name; break; case B_TXT_PLAYER_NAME: // player name if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) @@ -2094,37 +2094,37 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst) toCpy = gText_Someones; break; case B_TXT_ATK_PREFIX2: - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) toCpy = gText_AllyPkmnPrefix2; else toCpy = gText_FoePkmnPrefix3; break; case B_TXT_DEF_PREFIX2: - if (GetBattlerSide(gBattleDefender) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveTarget) == B_SIDE_PLAYER) toCpy = gText_AllyPkmnPrefix2; else toCpy = gText_FoePkmnPrefix3; break; case B_TXT_ATK_PREFIX1: - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) toCpy = gText_AllyPkmnPrefix; else toCpy = gText_FoePkmnPrefix2; break; case B_TXT_DEF_PREFIX1: - if (GetBattlerSide(gBattleDefender) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveTarget) == B_SIDE_PLAYER) toCpy = gText_AllyPkmnPrefix; else toCpy = gText_FoePkmnPrefix2; break; case B_TXT_ATK_PREFIX3: - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) toCpy = gText_AllyPkmnPrefix3; else toCpy = gText_FoePkmnPrefix4; break; case B_TXT_DEF_PREFIX3: - if (GetBattlerSide(gBattleDefender) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveTarget) == B_SIDE_PLAYER) toCpy = gText_AllyPkmnPrefix3; else toCpy = gText_FoePkmnPrefix4; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8f3036028..c443c5449 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -47,9 +47,9 @@ extern s32 gBattleMoveDamage; extern struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT]; extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; extern u8 gActiveBattler; -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u8 gBattlersCount; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleTurnOrder[MAX_BATTLERS_COUNT]; extern u8 gActionsByTurnOrder[MAX_BATTLERS_COUNT]; extern u16 gCurrentMove; @@ -62,8 +62,8 @@ extern u16 gChosenMovesByBanks[MAX_BATTLERS_COUNT]; extern u16 gPauseCounterBattle; extern u16 gPaydayMoney; extern u16 gRandomTurnNumber; -extern u8 gBattleAttacker; -extern u8 gBattleDefender; +extern u8 gBattleMoveAttacker; +extern u8 gBattleMoveTarget; extern const u8* gBattlescriptCurrInstr; extern u8 gCurrMovePos; extern u8 gCurrentActionFuncId; @@ -155,10 +155,10 @@ extern const u8 gText_BattleYesNoChoice[]; #define BS2ScriptRead16(ptr) ((ptr)[0] + ((ptr)[1] << 8)) #define BS2ScriptReadPtr(ptr) ((void *)BS2ScriptRead32(ptr)) -#define DEFENDER_IS_PROTECTED ((gProtectStructs[gBattleDefender].protected) && (gBattleMoves[gCurrentMove].flags & FLAG_PROTECT_AFFECTED)) +#define DEFENDER_IS_PROTECTED ((gProtectStructs[gBattleMoveTarget].protected) && (gBattleMoves[gCurrentMove].flags & FLAG_PROTECT_AFFECTED)) -#define TARGET_TURN_DAMAGED (gSpecialStatuses[gBattleDefender].moveturnLostHP_physical != 0 \ - || gSpecialStatuses[gBattleDefender].moveturnLostHP_special != 0) +#define TARGET_TURN_DAMAGED (gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_physical != 0 \ + || gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_special != 0) // this file's functions static bool8 IsTwoTurnsMove(u16 move); @@ -1027,7 +1027,7 @@ static void atk00_attackcanceler(void) gCurrentActionFuncId = ACTION_FINISHED; return; } - if (gBattleMons[gBattleAttacker].hp == 0 && !(gHitMarker & HITMARKER_NO_ATTACKSTRING)) + if (gBattleMons[gBattleMoveAttacker].hp == 0 && !(gHitMarker & HITMARKER_NO_ATTACKSTRING)) { gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; gBattlescriptCurrInstr = BattleScript_MoveEnd; @@ -1035,10 +1035,10 @@ static void atk00_attackcanceler(void) } if (AtkCanceller_UnableToUseMove()) return; - if (AbilityBattleEffects(ABILITYEFFECT_MOVES_BLOCK, gBattleDefender, 0, 0, 0)) + if (AbilityBattleEffects(ABILITYEFFECT_MOVES_BLOCK, gBattleMoveTarget, 0, 0, 0)) return; - if (!gBattleMons[gBattleAttacker].pp[gCurrMovePos] && gCurrentMove != MOVE_STRUGGLE && !(gHitMarker & 0x800200) - && !(gBattleMons[gBattleAttacker].status2 & STATUS2_MULTIPLETURNS)) + if (!gBattleMons[gBattleMoveAttacker].pp[gCurrMovePos] && gCurrentMove != MOVE_STRUGGLE && !(gHitMarker & 0x800200) + && !(gBattleMons[gBattleMoveAttacker].status2 & STATUS2_MULTIPLETURNS)) { gBattlescriptCurrInstr = BattleScript_NoPPForMove; gMoveResultFlags |= MOVE_RESULT_MISSED; @@ -1047,7 +1047,7 @@ static void atk00_attackcanceler(void) gHitMarker &= ~(HITMARKER_x800000); - if (!(gHitMarker & HITMARKER_OBEYS) && !(gBattleMons[gBattleAttacker].status2 & STATUS2_MULTIPLETURNS)) + if (!(gHitMarker & HITMARKER_OBEYS) && !(gBattleMons[gBattleMoveAttacker].status2 & STATUS2_MULTIPLETURNS)) { i = IsMonDisobedient(); // why use the 'i' variable...? switch (i) @@ -1065,10 +1065,10 @@ static void atk00_attackcanceler(void) gHitMarker |= HITMARKER_OBEYS; - if (gProtectStructs[gBattleDefender].bounceMove && gBattleMoves[gCurrentMove].flags & FLAG_MAGICCOAT_AFFECTED) + if (gProtectStructs[gBattleMoveTarget].bounceMove && gBattleMoves[gCurrentMove].flags & FLAG_MAGICCOAT_AFFECTED) { - PressurePPLose(gBattleAttacker, gBattleDefender, MOVE_MAGIC_COAT); - gProtectStructs[gBattleDefender].bounceMove = 0; + PressurePPLose(gBattleMoveAttacker, gBattleMoveTarget, MOVE_MAGIC_COAT); + gProtectStructs[gBattleMoveTarget].bounceMove = 0; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MagicCoatBounce; return; @@ -1078,7 +1078,7 @@ static void atk00_attackcanceler(void) { if ((gProtectStructs[gBattleTurnOrder[i]].stealMove) && gBattleMoves[gCurrentMove].flags & FLAG_SNATCH_AFFECTED) { - PressurePPLose(gBattleAttacker, gBattleTurnOrder[i], MOVE_SNATCH); + PressurePPLose(gBattleMoveAttacker, gBattleTurnOrder[i], MOVE_SNATCH); gProtectStructs[gBattleTurnOrder[i]].stealMove = 0; gBattleScripting.battler = gBattleTurnOrder[i]; BattleScriptPushCursor(); @@ -1087,22 +1087,22 @@ static void atk00_attackcanceler(void) } } - if (gSpecialStatuses[gBattleDefender].lightningRodRedirected) + if (gSpecialStatuses[gBattleMoveTarget].lightningRodRedirected) { - gSpecialStatuses[gBattleDefender].lightningRodRedirected = 0; + gSpecialStatuses[gBattleMoveTarget].lightningRodRedirected = 0; gLastUsedAbility = ABILITY_LIGHTNING_ROD; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_TookAttack; - RecordAbilityBattle(gBattleDefender, gLastUsedAbility); + RecordAbilityBattle(gBattleMoveTarget, gLastUsedAbility); } else if (DEFENDER_IS_PROTECTED - && (gCurrentMove != MOVE_CURSE || (gBattleMons[gBattleAttacker].type1 == TYPE_GHOST || gBattleMons[gBattleAttacker].type2 == TYPE_GHOST)) - && ((!IsTwoTurnsMove(gCurrentMove) || (gBattleMons[gBattleAttacker].status2 & STATUS2_MULTIPLETURNS)))) + && (gCurrentMove != MOVE_CURSE || (gBattleMons[gBattleMoveAttacker].type1 == TYPE_GHOST || gBattleMons[gBattleMoveAttacker].type2 == TYPE_GHOST)) + && ((!IsTwoTurnsMove(gCurrentMove) || (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_MULTIPLETURNS)))) { - CancelMultiTurnMoves(gBattleAttacker); + CancelMultiTurnMoves(gBattleMoveAttacker); gMoveResultFlags |= MOVE_RESULT_MISSED; - gLastLandedMoves[gBattleDefender] = 0; - gLastHitByType[gBattleDefender] = 0; + gLastLandedMoves[gBattleMoveTarget] = 0; + gLastHitByType[gBattleMoveTarget] = 0; gBattleCommunication[6] = 1; gBattlescriptCurrInstr++; } @@ -1117,14 +1117,14 @@ static void JumpIfMoveFailed(u8 adder, u16 move) const u8 *BS_ptr = gBattlescriptCurrInstr + adder; if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT) { - gLastLandedMoves[gBattleDefender] = 0; - gLastHitByType[gBattleDefender] = 0; + gLastLandedMoves[gBattleMoveTarget] = 0; + gLastHitByType[gBattleMoveTarget] = 0; BS_ptr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { TrySetDestinyBondToHappen(); - if (AbilityBattleEffects(ABILITYEFFECT_ABSORBING, gBattleDefender, 0, 0, move)) + if (AbilityBattleEffects(ABILITYEFFECT_ABSORBING, gBattleMoveTarget, 0, 0, move)) return; } gBattlescriptCurrInstr = BS_ptr; @@ -1159,13 +1159,13 @@ bool8 JumpIfMoveAffectedByProtect(u16 move) static bool8 AccuracyCalcHelper(u16 move) { - if (gStatuses3[gBattleDefender] & STATUS3_ALWAYS_HITS && gDisableStructs[gBattleDefender].bankWithSureHit == gBattleAttacker) + if (gStatuses3[gBattleMoveTarget] & STATUS3_ALWAYS_HITS && gDisableStructs[gBattleMoveTarget].bankWithSureHit == gBattleMoveAttacker) { JumpIfMoveFailed(7, move); return TRUE; } - if (!(gHitMarker & HITMARKER_IGNORE_ON_AIR) && gStatuses3[gBattleDefender] & STATUS3_ON_AIR) + if (!(gHitMarker & HITMARKER_IGNORE_ON_AIR) && gStatuses3[gBattleMoveTarget] & STATUS3_ON_AIR) { gMoveResultFlags |= MOVE_RESULT_MISSED; JumpIfMoveFailed(7, move); @@ -1174,7 +1174,7 @@ static bool8 AccuracyCalcHelper(u16 move) gHitMarker &= ~HITMARKER_IGNORE_ON_AIR; - if (!(gHitMarker & HITMARKER_IGNORE_UNDERGROUND) && gStatuses3[gBattleDefender] & STATUS3_UNDERGROUND) + if (!(gHitMarker & HITMARKER_IGNORE_UNDERGROUND) && gStatuses3[gBattleMoveTarget] & STATUS3_UNDERGROUND) { gMoveResultFlags |= MOVE_RESULT_MISSED; JumpIfMoveFailed(7, move); @@ -1183,7 +1183,7 @@ static bool8 AccuracyCalcHelper(u16 move) gHitMarker &= ~HITMARKER_IGNORE_UNDERGROUND; - if (!(gHitMarker & HITMARKER_IGNORE_UNDERWATER) && gStatuses3[gBattleDefender] & STATUS3_UNDERWATER) + if (!(gHitMarker & HITMARKER_IGNORE_UNDERWATER) && gStatuses3[gBattleMoveTarget] & STATUS3_UNDERWATER) { gMoveResultFlags |= MOVE_RESULT_MISSED; JumpIfMoveFailed(7, move); @@ -1208,9 +1208,9 @@ static void atk01_accuracycheck(void) if (move == 0xFFFE || move == 0xFFFF) { - if (gStatuses3[gBattleDefender] & STATUS3_ALWAYS_HITS && move == 0xFFFF && gDisableStructs[gBattleDefender].bankWithSureHit == gBattleAttacker) + if (gStatuses3[gBattleMoveTarget] & STATUS3_ALWAYS_HITS && move == 0xFFFF && gDisableStructs[gBattleMoveTarget].bankWithSureHit == gBattleMoveAttacker) gBattlescriptCurrInstr += 7; - else if (gStatuses3[gBattleDefender] & (STATUS3_ON_AIR | STATUS3_UNDERGROUND | STATUS3_UNDERWATER)) + else if (gStatuses3[gBattleMoveTarget] & (STATUS3_ON_AIR | STATUS3_UNDERGROUND | STATUS3_UNDERWATER)) gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); else if (!JumpIfMoveAffectedByProtect(0)) gBattlescriptCurrInstr += 7; @@ -1231,15 +1231,15 @@ static void atk01_accuracycheck(void) if (AccuracyCalcHelper(move)) return; - if (gBattleMons[gBattleDefender].status2 & STATUS2_FORESIGHT) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_FORESIGHT) { - u8 acc = gBattleMons[gBattleAttacker].statStages[STAT_STAGE_ACC]; + u8 acc = gBattleMons[gBattleMoveAttacker].statStages[STAT_STAGE_ACC]; buff = acc; } else { - u8 acc = gBattleMons[gBattleAttacker].statStages[STAT_STAGE_ACC]; - buff = acc + 6 - gBattleMons[gBattleDefender].statStages[STAT_STAGE_EVASION]; + u8 acc = gBattleMons[gBattleMoveAttacker].statStages[STAT_STAGE_ACC]; + buff = acc + 6 - gBattleMons[gBattleMoveTarget].statStages[STAT_STAGE_EVASION]; } if (buff < 0) @@ -1255,25 +1255,25 @@ static void atk01_accuracycheck(void) calc = sAccuracyStageRatios[buff].dividend * moveAcc; calc /= sAccuracyStageRatios[buff].divisor; - if (gBattleMons[gBattleAttacker].ability == ABILITY_COMPOUND_EYES) + if (gBattleMons[gBattleMoveAttacker].ability == ABILITY_COMPOUND_EYES) calc = (calc * 130) / 100; // 1.3 compound eyes boost - if (WEATHER_HAS_EFFECT && gBattleMons[gBattleDefender].ability == ABILITY_SAND_VEIL && gBattleWeather & WEATHER_SANDSTORM_ANY) + if (WEATHER_HAS_EFFECT && gBattleMons[gBattleMoveTarget].ability == ABILITY_SAND_VEIL && gBattleWeather & WEATHER_SANDSTORM_ANY) calc = (calc * 80) / 100; // 1.2 sand veil loss - if (gBattleMons[gBattleAttacker].ability == ABILITY_HUSTLE && type < 9) + if (gBattleMons[gBattleMoveAttacker].ability == ABILITY_HUSTLE && type < 9) calc = (calc * 80) / 100; // 1.2 hustle loss - if (gBattleMons[gBattleDefender].item == ITEM_ENIGMA_BERRY) + if (gBattleMons[gBattleMoveTarget].item == ITEM_ENIGMA_BERRY) { - holdEffect = gEnigmaBerries[gBattleDefender].holdEffect; - quality = gEnigmaBerries[gBattleDefender].holdEffectParam; + holdEffect = gEnigmaBerries[gBattleMoveTarget].holdEffect; + quality = gEnigmaBerries[gBattleMoveTarget].holdEffectParam; } else { - holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattleDefender].item); - quality = ItemId_GetHoldEffectParam(gBattleMons[gBattleDefender].item); + holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattleMoveTarget].item); + quality = ItemId_GetHoldEffectParam(gBattleMons[gBattleMoveTarget].item); } - gStringBank = gBattleDefender; + gStringBank = gBattleMoveTarget; if (holdEffect == HOLD_EFFECT_EVASION_UP) calc = (calc * (100 - quality)) / 100; @@ -1296,11 +1296,11 @@ static void atk01_accuracycheck(void) static void atk02_attackstring(void) { - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; if (!(gHitMarker & (HITMARKER_NO_ATTACKSTRING | HITMARKER_ATTACKSTRING_PRINTED))) { - PrepareStringBattle(STRINGID_USEDMOVE, gBattleAttacker); + PrepareStringBattle(STRINGID_USEDMOVE, gBattleMoveAttacker); gHitMarker |= HITMARKER_ATTACKSTRING_PRINTED; } gBattlescriptCurrInstr++; @@ -1311,42 +1311,42 @@ static void atk03_ppreduce(void) { s32 ppToDeduct = 1; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; - if (!gSpecialStatuses[gBattleAttacker].flag20) + if (!gSpecialStatuses[gBattleMoveAttacker].flag20) { switch (gBattleMoves[gCurrentMove].target) { case MOVE_TARGET_FOES_AND_ALLY: - ppToDeduct += AbilityBattleEffects(ABILITYEFFECT_COUNT_ON_FIELD, gBattleAttacker, ABILITY_PRESSURE, 0, 0); + ppToDeduct += AbilityBattleEffects(ABILITYEFFECT_COUNT_ON_FIELD, gBattleMoveAttacker, ABILITY_PRESSURE, 0, 0); break; case MOVE_TARGET_BOTH: case MOVE_TARGET_OPPONENTS_FIELD: - ppToDeduct += AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIDE, gBattleAttacker, ABILITY_PRESSURE, 0, 0); + ppToDeduct += AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIDE, gBattleMoveAttacker, ABILITY_PRESSURE, 0, 0); break; default: - if (gBattleAttacker != gBattleDefender && gBattleMons[gBattleDefender].ability == ABILITY_PRESSURE) + if (gBattleMoveAttacker != gBattleMoveTarget && gBattleMons[gBattleMoveTarget].ability == ABILITY_PRESSURE) ppToDeduct++; break; } } - if (!(gHitMarker & (HITMARKER_NO_PPDEDUCT | HITMARKER_NO_ATTACKSTRING)) && gBattleMons[gBattleAttacker].pp[gCurrMovePos]) + if (!(gHitMarker & (HITMARKER_NO_PPDEDUCT | HITMARKER_NO_ATTACKSTRING)) && gBattleMons[gBattleMoveAttacker].pp[gCurrMovePos]) { - gProtectStructs[gBattleAttacker].notFirstStrike = 1; + gProtectStructs[gBattleMoveAttacker].notFirstStrike = 1; - if (gBattleMons[gBattleAttacker].pp[gCurrMovePos] > ppToDeduct) - gBattleMons[gBattleAttacker].pp[gCurrMovePos] -= ppToDeduct; + if (gBattleMons[gBattleMoveAttacker].pp[gCurrMovePos] > ppToDeduct) + gBattleMons[gBattleMoveAttacker].pp[gCurrMovePos] -= ppToDeduct; else - gBattleMons[gBattleAttacker].pp[gCurrMovePos] = 0; + gBattleMons[gBattleMoveAttacker].pp[gCurrMovePos] = 0; - if (!(gBattleMons[gBattleAttacker].status2 & STATUS2_TRANSFORMED) - && !((gDisableStructs[gBattleAttacker].unk18_b) & gBitTable[gCurrMovePos])) + if (!(gBattleMons[gBattleMoveAttacker].status2 & STATUS2_TRANSFORMED) + && !((gDisableStructs[gBattleMoveAttacker].unk18_b) & gBitTable[gCurrMovePos])) { - gActiveBattler = gBattleAttacker; - EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + gCurrMovePos, 0, 1, &gBattleMons[gBattleAttacker].pp[gCurrMovePos]); - MarkBufferBankForExecution(gBattleAttacker); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + gCurrMovePos, 0, 1, &gBattleMons[gBattleMoveAttacker].pp[gCurrMovePos]); + MarkBattlerForControllerExec(gBattleMoveAttacker); } } @@ -1359,29 +1359,29 @@ static void atk04_critcalc(void) u8 holdEffect; u16 item, critChance; - item = gBattleMons[gBattleAttacker].item; + item = gBattleMons[gBattleMoveAttacker].item; if (item == ITEM_ENIGMA_BERRY) - holdEffect = gEnigmaBerries[gBattleAttacker].holdEffect; + holdEffect = gEnigmaBerries[gBattleMoveAttacker].holdEffect; else holdEffect = ItemId_GetHoldEffect(item); - gStringBank = gBattleAttacker; + gStringBank = gBattleMoveAttacker; - critChance = 2 * ((gBattleMons[gBattleAttacker].status2 & STATUS2_FOCUS_ENERGY) != 0) + critChance = 2 * ((gBattleMons[gBattleMoveAttacker].status2 & STATUS2_FOCUS_ENERGY) != 0) + (gBattleMoves[gCurrentMove].effect == EFFECT_HIGH_CRITICAL) + (gBattleMoves[gCurrentMove].effect == EFFECT_SKY_ATTACK) + (gBattleMoves[gCurrentMove].effect == EFFECT_BLAZE_KICK) + (gBattleMoves[gCurrentMove].effect == EFFECT_POISON_TAIL) + (holdEffect == HOLD_EFFECT_SCOPE_LENS) - + 2 * (holdEffect == HOLD_EFFECT_LUCKY_PUNCH && gBattleMons[gBattleAttacker].species == SPECIES_CHANSEY) - + 2 * (holdEffect == HOLD_EFFECT_STICK && gBattleMons[gBattleAttacker].species == SPECIES_FARFETCHD); + + 2 * (holdEffect == HOLD_EFFECT_LUCKY_PUNCH && gBattleMons[gBattleMoveAttacker].species == SPECIES_CHANSEY) + + 2 * (holdEffect == HOLD_EFFECT_STICK && gBattleMons[gBattleMoveAttacker].species == SPECIES_FARFETCHD); if (critChance > 4) critChance = 4; - if ((gBattleMons[gBattleDefender].ability != ABILITY_BATTLE_ARMOR && gBattleMons[gBattleDefender].ability != ABILITY_SHELL_ARMOR) - && !(gStatuses3[gBattleAttacker] & STATUS3_CANT_SCORE_A_CRIT) + if ((gBattleMons[gBattleMoveTarget].ability != ABILITY_BATTLE_ARMOR && gBattleMons[gBattleMoveTarget].ability != ABILITY_SHELL_ARMOR) + && !(gStatuses3[gBattleMoveAttacker] & STATUS3_CANT_SCORE_A_CRIT) && !(gBattleTypeFlags & (BATTLE_TYPE_WALLY_TUTORIAL | BATTLE_TYPE_FIRST_BATTLE)) && !(Random() % sCriticalHitChance[critChance])) gCritMultiplier = 2; @@ -1393,15 +1393,15 @@ static void atk04_critcalc(void) static void atk05_damagecalc(void) { - u16 sideStatus = gSideStatuses[GET_BATTLER_SIDE(gBattleDefender)]; - gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattleAttacker], &gBattleMons[gBattleDefender], gCurrentMove, + u16 sideStatus = gSideStatuses[GET_BATTLER_SIDE(gBattleMoveTarget)]; + gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattleMoveAttacker], &gBattleMons[gBattleMoveTarget], gCurrentMove, sideStatus, gDynamicBasePower, - gBattleStruct->dynamicMoveType, gBattleAttacker, gBattleDefender); + gBattleStruct->dynamicMoveType, gBattleMoveAttacker, gBattleMoveTarget); gBattleMoveDamage = gBattleMoveDamage * gCritMultiplier * gBattleScripting.dmgMultiplier; - if (gStatuses3[gBattleAttacker] & STATUS3_CHARGED_UP && gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC) + if (gStatuses3[gBattleMoveAttacker] & STATUS3_CHARGED_UP && gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC) gBattleMoveDamage *= 2; - if (gProtectStructs[gBattleAttacker].helpingHand) + if (gProtectStructs[gBattleMoveAttacker].helpingHand) gBattleMoveDamage = gBattleMoveDamage * 15 / 10; gBattlescriptCurrInstr++; @@ -1470,20 +1470,20 @@ static void atk06_typecalc(void) GET_MOVE_TYPE(gCurrentMove, moveType); // check stab - if (gBattleMons[gBattleAttacker].type1 == moveType || gBattleMons[gBattleAttacker].type2 == moveType) + if (gBattleMons[gBattleMoveAttacker].type1 == moveType || gBattleMons[gBattleMoveAttacker].type2 == moveType) { gBattleMoveDamage = gBattleMoveDamage * 15; gBattleMoveDamage = gBattleMoveDamage / 10; } - if (gBattleMons[gBattleDefender].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND) + if (gBattleMons[gBattleMoveTarget].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND) { - gLastUsedAbility = gBattleMons[gBattleDefender].ability; + gLastUsedAbility = gBattleMons[gBattleMoveTarget].ability; gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE); - gLastLandedMoves[gBattleDefender] = 0; - gLastHitByType[gBattleDefender] = 0; + gLastLandedMoves[gBattleMoveTarget] = 0; + gLastHitByType[gBattleMoveTarget] = 0; gBattleCommunication[6] = moveType; - RecordAbilityBattle(gBattleDefender, gLastUsedAbility); + RecordAbilityBattle(gBattleMoveTarget, gLastUsedAbility); } else { @@ -1491,7 +1491,7 @@ static void atk06_typecalc(void) { if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT) { - if (gBattleMons[gBattleDefender].status2 & STATUS2_FORESIGHT) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_FORESIGHT) break; i += 3; continue; @@ -1499,30 +1499,30 @@ static void atk06_typecalc(void) else if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type1) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type1) ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i)); // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type2 && - gBattleMons[gBattleDefender].type1 != gBattleMons[gBattleDefender].type2) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type2 && + gBattleMons[gBattleMoveTarget].type1 != gBattleMons[gBattleMoveTarget].type2) ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i)); } i += 3; } } - if (gBattleMons[gBattleDefender].ability == ABILITY_WONDER_GUARD && AttacksThisTurn(gBattleAttacker, gCurrentMove) == 2 + if (gBattleMons[gBattleMoveTarget].ability == ABILITY_WONDER_GUARD && AttacksThisTurn(gBattleMoveAttacker, gCurrentMove) == 2 && (!(gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) || ((gMoveResultFlags & (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)) == (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE))) && gBattleMoves[gCurrentMove].power) { gLastUsedAbility = ABILITY_WONDER_GUARD; gMoveResultFlags |= MOVE_RESULT_MISSED; - gLastLandedMoves[gBattleDefender] = 0; - gLastHitByType[gBattleDefender] = 0; + gLastLandedMoves[gBattleMoveTarget] = 0; + gLastHitByType[gBattleMoveTarget] = 0; gBattleCommunication[6] = 3; - RecordAbilityBattle(gBattleDefender, gLastUsedAbility); + RecordAbilityBattle(gBattleMoveTarget, gLastUsedAbility); } if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) - gProtectStructs[gBattleAttacker].targetNotAffected = 1; + gProtectStructs[gBattleMoveAttacker].targetNotAffected = 1; gBattlescriptCurrInstr++; } @@ -1538,11 +1538,11 @@ static void CheckWonderGuardAndLevitate(void) GET_MOVE_TYPE(gCurrentMove, moveType); - if (gBattleMons[gBattleDefender].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND) + if (gBattleMons[gBattleMoveTarget].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND) { gLastUsedAbility = ABILITY_LEVITATE; gBattleCommunication[6] = moveType; - RecordAbilityBattle(gBattleDefender, ABILITY_LEVITATE); + RecordAbilityBattle(gBattleMoveTarget, ABILITY_LEVITATE); return; } @@ -1550,7 +1550,7 @@ static void CheckWonderGuardAndLevitate(void) { if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT) { - if (gBattleMons[gBattleDefender].status2 & STATUS2_FORESIGHT) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_FORESIGHT) break; i += 3; continue; @@ -1558,46 +1558,46 @@ static void CheckWonderGuardAndLevitate(void) if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check no effect - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type1 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type1 && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; - gProtectStructs[gBattleAttacker].targetNotAffected = 1; + gProtectStructs[gBattleMoveAttacker].targetNotAffected = 1; } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type2 && - gBattleMons[gBattleDefender].type1 != gBattleMons[gBattleDefender].type2 && + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type2 && + gBattleMons[gBattleMoveTarget].type1 != gBattleMons[gBattleMoveTarget].type2 && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; - gProtectStructs[gBattleAttacker].targetNotAffected = 1; + gProtectStructs[gBattleMoveAttacker].targetNotAffected = 1; } // check super effective - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type1 && TYPE_EFFECT_MULTIPLIER(i) == 20) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type1 && TYPE_EFFECT_MULTIPLIER(i) == 20) flags |= 1; - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type2 - && gBattleMons[gBattleDefender].type1 != gBattleMons[gBattleDefender].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type2 + && gBattleMons[gBattleMoveTarget].type1 != gBattleMons[gBattleMoveTarget].type2 && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) flags |= 1; // check not very effective - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type1 && TYPE_EFFECT_MULTIPLIER(i) == 5) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type1 && TYPE_EFFECT_MULTIPLIER(i) == 5) flags |= 2; - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type2 - && gBattleMons[gBattleDefender].type1 != gBattleMons[gBattleDefender].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type2 + && gBattleMons[gBattleMoveTarget].type1 != gBattleMons[gBattleMoveTarget].type2 && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE) flags |= 2; } i += 3; } - if (gBattleMons[gBattleDefender].ability == ABILITY_WONDER_GUARD && AttacksThisTurn(gBattleAttacker, gCurrentMove) == 2) + if (gBattleMons[gBattleMoveTarget].ability == ABILITY_WONDER_GUARD && AttacksThisTurn(gBattleMoveAttacker, gCurrentMove) == 2) { if (((flags & 2) || !(flags & 1)) && gBattleMoves[gCurrentMove].power) { gLastUsedAbility = ABILITY_WONDER_GUARD; gBattleCommunication[6] = 3; - RecordAbilityBattle(gBattleDefender, ABILITY_WONDER_GUARD); + RecordAbilityBattle(gBattleMoveTarget, ABILITY_WONDER_GUARD); } } } @@ -1764,42 +1764,42 @@ static void atk07_adjustnormaldamage(void) ApplyRandomDmgMultiplier(); - if (gBattleMons[gBattleDefender].item == ITEM_ENIGMA_BERRY) + if (gBattleMons[gBattleMoveTarget].item == ITEM_ENIGMA_BERRY) { - holdEffect = gEnigmaBerries[gBattleDefender].holdEffect, quality = gEnigmaBerries[gBattleDefender].holdEffectParam; + holdEffect = gEnigmaBerries[gBattleMoveTarget].holdEffect, quality = gEnigmaBerries[gBattleMoveTarget].holdEffectParam; } else { - holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattleDefender].item); - quality = ItemId_GetHoldEffectParam(gBattleMons[gBattleDefender].item); + holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattleMoveTarget].item); + quality = ItemId_GetHoldEffectParam(gBattleMons[gBattleMoveTarget].item); } - gStringBank = gBattleDefender; + gStringBank = gBattleMoveTarget; if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < quality) { - RecordItemEffectBattle(gBattleDefender, holdEffect); - gSpecialStatuses[gBattleDefender].focusBanded = 1; + RecordItemEffectBattle(gBattleMoveTarget, holdEffect); + gSpecialStatuses[gBattleMoveTarget].focusBanded = 1; } - if (gBattleMons[gBattleDefender].status2 & STATUS2_SUBSTITUTE) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_SUBSTITUTE) goto END; - if (gBattleMoves[gCurrentMove].effect != EFFECT_FALSE_SWIPE && !gProtectStructs[gBattleDefender].endured - && !gSpecialStatuses[gBattleDefender].focusBanded) + if (gBattleMoves[gCurrentMove].effect != EFFECT_FALSE_SWIPE && !gProtectStructs[gBattleMoveTarget].endured + && !gSpecialStatuses[gBattleMoveTarget].focusBanded) goto END; - if (gBattleMons[gBattleDefender].hp > gBattleMoveDamage) + if (gBattleMons[gBattleMoveTarget].hp > gBattleMoveDamage) goto END; - gBattleMoveDamage = gBattleMons[gBattleDefender].hp - 1; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].hp - 1; - if (gProtectStructs[gBattleDefender].endured) + if (gProtectStructs[gBattleMoveTarget].endured) { gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED; } - else if (gSpecialStatuses[gBattleDefender].focusBanded) + else if (gSpecialStatuses[gBattleMoveTarget].focusBanded) { gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON; - gLastUsedItem = gBattleMons[gBattleDefender].item; + gLastUsedItem = gBattleMons[gBattleMoveTarget].item; } END: @@ -1812,40 +1812,40 @@ static void atk08_adjustnormaldamage2(void) // The same as 0x7 except it doesn't ApplyRandomDmgMultiplier(); - if (gBattleMons[gBattleDefender].item == ITEM_ENIGMA_BERRY) + if (gBattleMons[gBattleMoveTarget].item == ITEM_ENIGMA_BERRY) { - holdEffect = gEnigmaBerries[gBattleDefender].holdEffect, quality = gEnigmaBerries[gBattleDefender].holdEffectParam; + holdEffect = gEnigmaBerries[gBattleMoveTarget].holdEffect, quality = gEnigmaBerries[gBattleMoveTarget].holdEffectParam; } else { - holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattleDefender].item); - quality = ItemId_GetHoldEffectParam(gBattleMons[gBattleDefender].item); + holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattleMoveTarget].item); + quality = ItemId_GetHoldEffectParam(gBattleMons[gBattleMoveTarget].item); } - gStringBank = gBattleDefender; + gStringBank = gBattleMoveTarget; if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < quality) { - RecordItemEffectBattle(gBattleDefender, holdEffect); - gSpecialStatuses[gBattleDefender].focusBanded = 1; + RecordItemEffectBattle(gBattleMoveTarget, holdEffect); + gSpecialStatuses[gBattleMoveTarget].focusBanded = 1; } - if (gBattleMons[gBattleDefender].status2 & STATUS2_SUBSTITUTE) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_SUBSTITUTE) goto END; - if (!gProtectStructs[gBattleDefender].endured && !gSpecialStatuses[gBattleDefender].focusBanded) + if (!gProtectStructs[gBattleMoveTarget].endured && !gSpecialStatuses[gBattleMoveTarget].focusBanded) goto END; - if (gBattleMons[gBattleDefender].hp > gBattleMoveDamage) + if (gBattleMons[gBattleMoveTarget].hp > gBattleMoveDamage) goto END; - gBattleMoveDamage = gBattleMons[gBattleDefender].hp - 1; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].hp - 1; - if (gProtectStructs[gBattleDefender].endured) + if (gProtectStructs[gBattleMoveTarget].endured) { gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED; } - else if (gSpecialStatuses[gBattleDefender].focusBanded) + else if (gSpecialStatuses[gBattleMoveTarget].focusBanded) { gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON; - gLastUsedItem = gBattleMons[gBattleDefender].item; + gLastUsedItem = gBattleMons[gBattleMoveTarget].item; } END: @@ -1854,7 +1854,7 @@ static void atk08_adjustnormaldamage2(void) // The same as 0x7 except it doesn't static void atk09_attackanimation(void) { - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; if ((gHitMarker & HITMARKER_NO_ANIMATIONS) && (gCurrentMove != MOVE_TRANSFORM && gCurrentMove != MOVE_SUBSTITUTE)) @@ -1878,13 +1878,13 @@ static void atk09_attackanimation(void) { u8 multihit; - gActiveBattler = gBattleAttacker; + gActiveBattler = gBattleMoveAttacker; - if (gBattleMons[gBattleDefender].status2 & STATUS2_SUBSTITUTE) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_SUBSTITUTE) multihit = gMultiHitCounter; else if (gMultiHitCounter != 0 && gMultiHitCounter != 1) { - if (gBattleMons[gBattleDefender].hp <= gBattleMoveDamage) + if (gBattleMons[gBattleMoveTarget].hp <= gBattleMoveDamage) multihit = 1; else multihit = gMultiHitCounter; @@ -1892,10 +1892,10 @@ static void atk09_attackanimation(void) else multihit = gMultiHitCounter; - EmitMoveAnimation(0, gCurrentMove, gBattleScripting.animTurn, gBattleMovePower, gBattleMoveDamage, gBattleMons[gBattleAttacker].friendship, &gDisableStructs[gBattleAttacker], multihit); + BtlController_EmitMoveAnimation(0, gCurrentMove, gBattleScripting.animTurn, gBattleMovePower, gBattleMoveDamage, gBattleMons[gBattleMoveAttacker].friendship, &gDisableStructs[gBattleMoveAttacker], multihit); gBattleScripting.animTurn += 1; gBattleScripting.animTargetsHit += 1; - MarkBufferBankForExecution(gBattleAttacker); + MarkBattlerForControllerExec(gBattleMoveAttacker); gBattlescriptCurrInstr++; } else @@ -1908,13 +1908,13 @@ static void atk09_attackanimation(void) static void atk0A_waitanimation(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) gBattlescriptCurrInstr++; } static void atk0B_healthbarupdate(void) { - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) @@ -1937,8 +1937,8 @@ static void atk0B_healthbarupdate(void) else healthValue = maxPossibleDmgValue; - EmitHealthBarUpdate(0, healthValue); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitHealthBarUpdate(0, healthValue); + MarkBattlerForControllerExec(gActiveBattler); if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER && gBattleMoveDamage > 0) gBattleResults.unk5_0 = 1; @@ -1952,7 +1952,7 @@ static void atk0C_datahpupdate(void) { u32 moveType; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; if (gBattleStruct->dynamicMoveType == 0) @@ -2010,9 +2010,9 @@ static void atk0C_datahpupdate(void) { gTakenDmg[gActiveBattler] += gBattleMoveDamage; if (gBattlescriptCurrInstr[1] == BS_GET_TARGET) - gTakenDmgBanks[gActiveBattler] = gBattleAttacker; + gTakenDmgBanks[gActiveBattler] = gBattleMoveAttacker; else - gTakenDmgBanks[gActiveBattler] = gBattleDefender; + gTakenDmgBanks[gActiveBattler] = gBattleMoveTarget; } if (gBattleMons[gActiveBattler].hp > gBattleMoveDamage) @@ -2035,13 +2035,13 @@ static void atk0C_datahpupdate(void) gSpecialStatuses[gActiveBattler].moveturnLostHP_physical = gHpDealt; if (gBattlescriptCurrInstr[1] == BS_GET_TARGET) { - gProtectStructs[gActiveBattler].physicalBank = gBattleAttacker; - gSpecialStatuses[gActiveBattler].moveturnPhysicalBank = gBattleAttacker; + gProtectStructs[gActiveBattler].physicalBank = gBattleMoveAttacker; + gSpecialStatuses[gActiveBattler].moveturnPhysicalBank = gBattleMoveAttacker; } else { - gProtectStructs[gActiveBattler].physicalBank = gBattleDefender; - gSpecialStatuses[gActiveBattler].moveturnPhysicalBank = gBattleDefender; + gProtectStructs[gActiveBattler].physicalBank = gBattleMoveTarget; + gSpecialStatuses[gActiveBattler].moveturnPhysicalBank = gBattleMoveTarget; } } else if (moveType > 8 && !(gHitMarker & HITMARKER_x100000)) @@ -2050,19 +2050,19 @@ static void atk0C_datahpupdate(void) gSpecialStatuses[gActiveBattler].moveturnLostHP_special = gHpDealt; if (gBattlescriptCurrInstr[1] == BS_GET_TARGET) { - gProtectStructs[gActiveBattler].specialBank = gBattleAttacker; - gSpecialStatuses[gActiveBattler].moveturnSpecialBank = gBattleAttacker; + gProtectStructs[gActiveBattler].specialBank = gBattleMoveAttacker; + gSpecialStatuses[gActiveBattler].moveturnSpecialBank = gBattleMoveAttacker; } else { - gProtectStructs[gActiveBattler].specialBank = gBattleDefender; - gSpecialStatuses[gActiveBattler].moveturnSpecialBank = gBattleDefender; + gProtectStructs[gActiveBattler].specialBank = gBattleMoveTarget; + gSpecialStatuses[gActiveBattler].moveturnSpecialBank = gBattleMoveTarget; } } } gHitMarker &= ~(HITMARKER_x100000); - EmitSetMonData(0, REQUEST_HP_BATTLE, 0, 2, &gBattleMons[gActiveBattler].hp); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_HP_BATTLE, 0, 2, &gBattleMons[gActiveBattler].hp); + MarkBattlerForControllerExec(gActiveBattler); } } else @@ -2076,11 +2076,11 @@ static void atk0C_datahpupdate(void) static void atk0D_critmessage(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { if (gCritMultiplier == 2 && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { - PrepareStringBattle(STRINGID_CRITICALHIT, gBattleAttacker); + PrepareStringBattle(STRINGID_CRITICALHIT, gBattleMoveAttacker); gBattleCommunication[MSG_DISPLAY] = 1; } gBattlescriptCurrInstr++; @@ -2089,21 +2089,21 @@ static void atk0D_critmessage(void) static void atk0E_effectivenesssound(void) { - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; - gActiveBattler = gBattleDefender; + gActiveBattler = gBattleMoveTarget; if (!(gMoveResultFlags & MOVE_RESULT_MISSED)) { switch (gMoveResultFlags & (u8)(~(MOVE_RESULT_MISSED))) { case MOVE_RESULT_SUPER_EFFECTIVE: - EmitPlaySE(0, SE_KOUKA_H); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitPlaySE(0, SE_KOUKA_H); + MarkBattlerForControllerExec(gActiveBattler); break; case MOVE_RESULT_NOT_VERY_EFFECTIVE: - EmitPlaySE(0, SE_KOUKA_L); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitPlaySE(0, SE_KOUKA_L); + MarkBattlerForControllerExec(gActiveBattler); break; case MOVE_RESULT_DOESNT_AFFECT_FOE: case MOVE_RESULT_FAILED: @@ -2115,18 +2115,18 @@ static void atk0E_effectivenesssound(void) default: if (gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) { - EmitPlaySE(0, SE_KOUKA_H); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitPlaySE(0, SE_KOUKA_H); + MarkBattlerForControllerExec(gActiveBattler); } else if (gMoveResultFlags & MOVE_RESULT_NOT_VERY_EFFECTIVE) { - EmitPlaySE(0, SE_KOUKA_L); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitPlaySE(0, SE_KOUKA_L); + MarkBattlerForControllerExec(gActiveBattler); } else if (!(gMoveResultFlags & (MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED))) { - EmitPlaySE(0, SE_KOUKA_M); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitPlaySE(0, SE_KOUKA_M); + MarkBattlerForControllerExec(gActiveBattler); } break; } @@ -2138,7 +2138,7 @@ static void atk0F_resultmessage(void) { u32 stringId = 0; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; if (gMoveResultFlags & MOVE_RESULT_MISSED && (!(gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) || gBattleCommunication[6] > 2)) @@ -2170,8 +2170,8 @@ static void atk0F_resultmessage(void) stringId = STRINGID_ITDOESNTAFFECT; break; case MOVE_RESULT_FOE_HUNG_ON: - gLastUsedItem = gBattleMons[gBattleDefender].item; - gStringBank = gBattleDefender; + gLastUsedItem = gBattleMons[gBattleMoveTarget].item; + gStringBank = gBattleMoveTarget; gMoveResultFlags &= ~(MOVE_RESULT_FOE_ENDURED | MOVE_RESULT_FOE_HUNG_ON); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_HangedOnMsg; @@ -2199,8 +2199,8 @@ static void atk0F_resultmessage(void) } else if (gMoveResultFlags & MOVE_RESULT_FOE_HUNG_ON) { - gLastUsedItem = gBattleMons[gBattleDefender].item; - gStringBank = gBattleDefender; + gLastUsedItem = gBattleMons[gBattleMoveTarget].item; + gStringBank = gBattleMoveTarget; gMoveResultFlags &= ~(MOVE_RESULT_FOE_ENDURED | MOVE_RESULT_FOE_HUNG_ON); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_HangedOnMsg; @@ -2218,17 +2218,17 @@ static void atk0F_resultmessage(void) } if (stringId) - PrepareStringBattle(stringId, gBattleAttacker); + PrepareStringBattle(stringId, gBattleMoveAttacker); gBattlescriptCurrInstr++; } static void atk10_printstring(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { u16 var = BS2ScriptRead16(gBattlescriptCurrInstr + 1); - PrepareStringBattle(var, gBattleAttacker); + PrepareStringBattle(var, gBattleMoveAttacker); gBattlescriptCurrInstr += 3; gBattleCommunication[MSG_DISPLAY] = 1; } @@ -2236,10 +2236,10 @@ static void atk10_printstring(void) static void atk11_printselectionstring(void) { - gActiveBattler = gBattleAttacker; + gActiveBattler = gBattleMoveAttacker; - EmitPrintSelectionString(0, BS2ScriptRead16(gBattlescriptCurrInstr + 1)); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitPrintSelectionString(0, BS2ScriptRead16(gBattlescriptCurrInstr + 1)); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 3; gBattleCommunication[MSG_DISPLAY] = 1; @@ -2247,7 +2247,7 @@ static void atk11_printselectionstring(void) static void atk12_waitmessage(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { if (!gBattleCommunication[MSG_DISPLAY]) { @@ -2268,12 +2268,12 @@ static void atk12_waitmessage(void) static void atk13_printfromtable(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { const u16 *ptr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); ptr += gBattleCommunication[MULTISTRING_CHOOSER]; - PrepareStringBattle(*ptr, gBattleAttacker); + PrepareStringBattle(*ptr, gBattleMoveAttacker); gBattlescriptCurrInstr += 5; gBattleCommunication[MSG_DISPLAY] = 1; @@ -2282,21 +2282,21 @@ static void atk13_printfromtable(void) static void atk14_printselectionstringfromtable(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { const u16 *ptr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); ptr += gBattleCommunication[MULTISTRING_CHOOSER]; - gActiveBattler = gBattleAttacker; - EmitPrintSelectionString(0, *ptr); - MarkBufferBankForExecution(gActiveBattler); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitPrintSelectionString(0, *ptr); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 5; gBattleCommunication[MSG_DISPLAY] = 1; } } -u8 BankGetTurnOrder(u8 bank) +u8 GetBattlerTurnOrderNum(u8 bank) { s32 i; for (i = 0; i < gBattlersCount; i++) @@ -2328,15 +2328,15 @@ void SetMoveEffect(bool8 primary, u8 certain) if (gBattleCommunication[MOVE_EFFECT_BYTE] & MOVE_EFFECT_AFFECTS_USER) { - gEffectBank = gBattleAttacker; // bank that effects get applied on + gEffectBank = gBattleMoveAttacker; // bank that effects get applied on gBattleCommunication[MOVE_EFFECT_BYTE] &= ~(MOVE_EFFECT_AFFECTS_USER); affectsUser = MOVE_EFFECT_AFFECTS_USER; - gBattleScripting.battler = gBattleDefender; // theoretically the attacker + gBattleScripting.battler = gBattleMoveTarget; // theoretically the attacker } else { - gEffectBank = gBattleDefender; - gBattleScripting.battler = gBattleAttacker; + gEffectBank = gBattleMoveTarget; + gBattleScripting.battler = gBattleMoveAttacker; } if (gBattleMons[gEffectBank].ability == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) @@ -2584,8 +2584,8 @@ void SetMoveEffect(bool8 primary, u8 certain) gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]]; gActiveBattler = gEffectBank; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gEffectBank].status1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gEffectBank].status1); + MarkBattlerForControllerExec(gActiveBattler); if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) { @@ -2659,7 +2659,7 @@ void SetMoveEffect(bool8 primary, u8 certain) } else { - if (BankGetTurnOrder(gEffectBank) > gCurrentTurnActionNumber) + if (GetBattlerTurnOrderNum(gEffectBank) > gCurrentTurnActionNumber) gBattleMons[gEffectBank].status2 |= sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]]; gBattlescriptCurrInstr++; } @@ -2681,10 +2681,10 @@ void SetMoveEffect(bool8 primary, u8 certain) } break; case MOVE_EFFECT_PAYDAY: - if (GET_BATTLER_SIDE(gBattleAttacker) == B_SIDE_PLAYER) + if (GET_BATTLER_SIDE(gBattleMoveAttacker) == B_SIDE_PLAYER) { u16 PayDay = gPaydayMoney; - gPaydayMoney += (gBattleMons[gBattleAttacker].level * 5); + gPaydayMoney += (gBattleMons[gBattleMoveAttacker].level * 5); if (PayDay > gPaydayMoney) gPaydayMoney = 0xFFFF; } @@ -2719,7 +2719,7 @@ void SetMoveEffect(bool8 primary, u8 certain) *(gBattleStruct->wrappedMove + gEffectBank * 2 + 0) = gCurrentMove; *(gBattleStruct->wrappedMove + gEffectBank * 2 + 1) = gCurrentMove >> 8; - *(gBattleStruct->wrappedBy + gEffectBank) = gBattleAttacker; + *(gBattleStruct->wrappedBy + gEffectBank) = gBattleMoveAttacker; BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]]; @@ -2832,7 +2832,7 @@ void SetMoveEffect(bool8 primary, u8 certain) gBattlescriptCurrInstr++; break; case MOVE_EFFECT_RAGE: - gBattleMons[gBattleAttacker].status2 |= STATUS2_RAGE; + gBattleMons[gBattleMoveAttacker].status2 |= STATUS2_RAGE; gBattlescriptCurrInstr++; break; case MOVE_EFFECT_STEAL_ITEM: @@ -2843,8 +2843,8 @@ void SetMoveEffect(bool8 primary, u8 certain) break; } - side = GetBattlerSide(gBattleAttacker); - if (GetBattlerSide(gBattleAttacker) == B_SIDE_OPPONENT + side = GetBattlerSide(gBattleMoveAttacker); + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_OPPONENT && !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_FRONTIER @@ -2860,56 +2860,56 @@ void SetMoveEffect(bool8 primary, u8 certain) | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_SECRET_BASE)) - && (gWishFutureKnock.knockedOffPokes[side] & gBitTable[gBattlePartyID[gBattleAttacker]])) + && (gWishFutureKnock.knockedOffPokes[side] & gBitTable[gBattlerPartyIndexes[gBattleMoveAttacker]])) { gBattlescriptCurrInstr++; } - else if (gBattleMons[gBattleDefender].item - && gBattleMons[gBattleDefender].ability == ABILITY_STICKY_HOLD) + else if (gBattleMons[gBattleMoveTarget].item + && gBattleMons[gBattleMoveTarget].ability == ABILITY_STICKY_HOLD) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_NoItemSteal; - gLastUsedAbility = gBattleMons[gBattleDefender].ability; - RecordAbilityBattle(gBattleDefender, gLastUsedAbility); + gLastUsedAbility = gBattleMons[gBattleMoveTarget].ability; + RecordAbilityBattle(gBattleMoveTarget, gLastUsedAbility); } - else if (gBattleMons[gBattleAttacker].item != 0 - || gBattleMons[gBattleDefender].item == ITEM_ENIGMA_BERRY - || IS_ITEM_MAIL(gBattleMons[gBattleDefender].item) - || gBattleMons[gBattleDefender].item == 0) + else if (gBattleMons[gBattleMoveAttacker].item != 0 + || gBattleMons[gBattleMoveTarget].item == ITEM_ENIGMA_BERRY + || IS_ITEM_MAIL(gBattleMons[gBattleMoveTarget].item) + || gBattleMons[gBattleMoveTarget].item == 0) { gBattlescriptCurrInstr++; } else { - u16* changedItem = &gBattleStruct->changedItems[gBattleAttacker]; - gLastUsedItem = *changedItem = gBattleMons[gBattleDefender].item; - gBattleMons[gBattleDefender].item = 0; + u16* changedItem = &gBattleStruct->changedItems[gBattleMoveAttacker]; + gLastUsedItem = *changedItem = gBattleMons[gBattleMoveTarget].item; + gBattleMons[gBattleMoveTarget].item = 0; - gActiveBattler = gBattleAttacker; - EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedItem); - MarkBufferBankForExecution(gBattleAttacker); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gLastUsedItem); + MarkBattlerForControllerExec(gBattleMoveAttacker); - gActiveBattler = gBattleDefender; - EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gBattleDefender].item); - MarkBufferBankForExecution(gBattleDefender); + gActiveBattler = gBattleMoveTarget; + BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gBattleMoveTarget].item); + MarkBattlerForControllerExec(gBattleMoveTarget); BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_ItemSteal; - *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleDefender]) + 0) = 0; - *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleDefender]) + 1) = 0; + *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleMoveTarget]) + 0) = 0; + *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleMoveTarget]) + 1) = 0; } } break; case MOVE_EFFECT_PREVENT_ESCAPE: - gBattleMons[gBattleDefender].status2 |= STATUS2_ESCAPE_PREVENTION; - gDisableStructs[gBattleDefender].bankPreventingEscape = gBattleAttacker; + gBattleMons[gBattleMoveTarget].status2 |= STATUS2_ESCAPE_PREVENTION; + gDisableStructs[gBattleMoveTarget].bankPreventingEscape = gBattleMoveAttacker; gBattlescriptCurrInstr++; break; case MOVE_EFFECT_NIGHTMARE: - gBattleMons[gBattleDefender].status2 |= STATUS2_NIGHTMARE; + gBattleMons[gBattleMoveTarget].status2 |= STATUS2_NIGHTMARE; gBattlescriptCurrInstr++; break; case MOVE_EFFECT_ALL_STATS_UP: @@ -2921,17 +2921,17 @@ void SetMoveEffect(bool8 primary, u8 certain) gBattlescriptCurrInstr = BattleScript_RapidSpinAway; break; case MOVE_EFFECT_REMOVE_PARALYSIS: // Smelling salts - if (!(gBattleMons[gBattleDefender].status1 & STATUS1_PARALYSIS)) + if (!(gBattleMons[gBattleMoveTarget].status1 & STATUS1_PARALYSIS)) { gBattlescriptCurrInstr++; } else { - gBattleMons[gBattleDefender].status1 &= ~(STATUS1_PARALYSIS); + gBattleMons[gBattleMoveTarget].status1 &= ~(STATUS1_PARALYSIS); - gActiveBattler = gBattleDefender; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + gActiveBattler = gBattleMoveTarget; + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_TargetPRLZHeal; @@ -2982,7 +2982,7 @@ void SetMoveEffect(bool8 primary, u8 certain) gLastUsedItem = gBattleMons[gEffectBank].item; gBattleMons[gEffectBank].item = 0; - gWishFutureKnock.knockedOffPokes[side] |= gBitTable[gBattlePartyID[gEffectBank]]; + gWishFutureKnock.knockedOffPokes[side] |= gBitTable[gBattlerPartyIndexes[gEffectBank]]; BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_KnockedOff; @@ -3010,7 +3010,7 @@ static void atk15_seteffectwithchance(void) { u32 percentChance; - if (gBattleMons[gBattleAttacker].ability == ABILITY_SERENE_GRACE) + if (gBattleMons[gBattleMoveAttacker].ability == ABILITY_SERENE_GRACE) percentChance = gBattleMoves[gCurrentMove].secondaryEffectChance * 2; else percentChance = gBattleMoves[gCurrentMove].secondaryEffectChance; @@ -3089,14 +3089,14 @@ static void atk19_tryfaintmon(void) if (gBattlescriptCurrInstr[1] == BS_GET_ATTACKER) { - gActiveBattler = gBattleAttacker; - bank = gBattleDefender; + gActiveBattler = gBattleMoveAttacker; + bank = gBattleMoveTarget; BS_ptr = BattleScript_FaintAttacker; } else { - gActiveBattler = gBattleDefender; - bank = gBattleAttacker; + gActiveBattler = gBattleMoveTarget; + bank = gBattleMoveAttacker; BS_ptr = BattleScript_FaintTarget; } if (!(gAbsentBattlerFlags & gBitTable[gActiveBattler]) @@ -3116,31 +3116,31 @@ static void atk19_tryfaintmon(void) { if (gBattleResults.opponentFaintCounter < 0xFF) gBattleResults.opponentFaintCounter++; - gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES, NULL); + gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL); } - if ((gHitMarker & HITMARKER_DESTINYBOND) && gBattleMons[gBattleAttacker].hp != 0) + if ((gHitMarker & HITMARKER_DESTINYBOND) && gBattleMons[gBattleMoveAttacker].hp != 0) { gHitMarker &= ~(HITMARKER_DESTINYBOND); BattleScriptPush(gBattlescriptCurrInstr); gBattleMoveDamage = gBattleMons[bank].hp; gBattlescriptCurrInstr = BattleScript_DestinyBondTakesLife; } - if ((gStatuses3[gBattleDefender] & STATUS3_GRUDGE) + if ((gStatuses3[gBattleMoveTarget] & STATUS3_GRUDGE) && !(gHitMarker & HITMARKER_GRUDGE) - && GetBattlerSide(gBattleAttacker) != GetBattlerSide(gBattleDefender) - && gBattleMons[gBattleAttacker].hp != 0 + && GetBattlerSide(gBattleMoveAttacker) != GetBattlerSide(gBattleMoveTarget) + && gBattleMons[gBattleMoveAttacker].hp != 0 && gCurrentMove != MOVE_STRUGGLE) { - u8 moveIndex = *(gBattleStruct->chosenMovePositions + gBattleAttacker); + u8 moveIndex = *(gBattleStruct->chosenMovePositions + gBattleMoveAttacker); - gBattleMons[gBattleAttacker].pp[moveIndex] = 0; + gBattleMons[gBattleMoveAttacker].pp[moveIndex] = 0; BattleScriptPush(gBattlescriptCurrInstr); gBattlescriptCurrInstr = BattleScript_GrudgeTakesPp; - gActiveBattler = gBattleAttacker; - EmitSetMonData(0, moveIndex + REQUEST_PPMOVE1_BATTLE, 0, 1, &gBattleMons[gActiveBattler].pp[moveIndex]); - MarkBufferBankForExecution(gActiveBattler); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitSetMonData(0, moveIndex + REQUEST_PPMOVE1_BATTLE, 0, 1, &gBattleMons[gActiveBattler].pp[moveIndex]); + MarkBattlerForControllerExec(gActiveBattler); - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattleAttacker].moves[moveIndex]) + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattleMoveAttacker].moves[moveIndex]) } } else @@ -3152,26 +3152,26 @@ static void atk19_tryfaintmon(void) static void atk1A_dofaintanimation(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); - EmitFaintAnimation(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitFaintAnimation(0); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } } static void atk1B_cleareffectsonfaint(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); if (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || gBattleMons[gActiveBattler].hp == 0) { gBattleMons[gActiveBattler].status1 = 0; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 0x4, &gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 0x4, &gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); } FaintClearSetData(); // Effects like attractions, trapping, etc. @@ -3211,7 +3211,7 @@ static void atk1E_jumpifability(void) if (gBattlescriptCurrInstr[1] == BS_GET_ATTACKER_SIDE) { - bank = AbilityBattleEffects(ABILITYEFFECT_CHECK_BANK_SIDE, gBattleAttacker, ability, 0, 0); + bank = AbilityBattleEffects(ABILITYEFFECT_CHECK_BANK_SIDE, gBattleMoveAttacker, ability, 0, 0); if (bank) { gLastUsedAbility = ability; @@ -3224,7 +3224,7 @@ static void atk1E_jumpifability(void) } else if (gBattlescriptCurrInstr[1] == BS_GET_NOT_ATTACKER_SIDE) { - bank = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gBattleAttacker, ability, 0, 0); + bank = AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gBattleMoveAttacker, ability, 0, 0); if (bank) { gLastUsedAbility = ability; @@ -3257,9 +3257,9 @@ static void atk1F_jumpifsideaffecting(void) const u8* jumpPtr; if (gBattlescriptCurrInstr[1] == BS_GET_ATTACKER) - side = GET_BATTLER_SIDE(gBattleAttacker); + side = GET_BATTLER_SIDE(gBattleMoveAttacker); else - side = GET_BATTLER_SIDE(gBattleDefender); + side = GET_BATTLER_SIDE(gBattleMoveTarget); flags = BS2ScriptRead16(gBattlescriptCurrInstr + 2); jumpPtr = BS2ScriptReadPtr(gBattlescriptCurrInstr + 4); @@ -3377,7 +3377,7 @@ static void atk23_getexp(void) else { gBattleScripting.atk23_state++; - gBattleStruct->field_DF |= gBitTable[gBattlePartyID[gBank1]]; + gBattleStruct->field_DF |= gBitTable[gBattlerPartyIndexes[gBank1]]; } break; case 1: // calculate experience points to redistribute @@ -3429,7 +3429,7 @@ static void atk23_getexp(void) } // fall through case 2: // set exp value to the poke in expgetter_id and print message - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { item = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HELD_ITEM); @@ -3495,7 +3495,7 @@ static void atk23_getexp(void) // get exp getter bank if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - if (!(gBattlePartyID[2] != gBattleStruct->expGetterId) && !(gAbsentBattlerFlags & gBitTable[2])) + if (!(gBattlerPartyIndexes[2] != gBattleStruct->expGetterId) && !(gAbsentBattlerFlags & gBitTable[2])) gBattleStruct->expGetterBank = 2; else { @@ -3524,7 +3524,7 @@ static void atk23_getexp(void) } break; case 3: // Set stats and give exp - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gBattleBufferB[gBattleStruct->expGetterBank][0] = 0; if (GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HP) && GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL) != MAX_MON_LEVEL) @@ -3537,20 +3537,20 @@ static void atk23_getexp(void) BATTLE_LVLUP_STATS->spDef = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPDEF); gActiveBattler = gBattleStruct->expGetterBank; - EmitExpUpdate(0, gBattleStruct->expGetterId, gBattleMoveDamage); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitExpUpdate(0, gBattleStruct->expGetterId, gBattleMoveDamage); + MarkBattlerForControllerExec(gActiveBattler); } gBattleScripting.atk23_state++; } break; case 4: // lvl up if necessary - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gActiveBattler = gBattleStruct->expGetterBank; if (gBattleBufferB[gActiveBattler][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBattler][1] == RET_VALUE_LEVELLED_UP) { - if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlePartyID[gActiveBattler] == gBattleStruct->expGetterId) - HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler); + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterId) + HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattleStruct->expGetterId) @@ -3563,7 +3563,7 @@ static void atk23_getexp(void) AdjustFriendship(&gPlayerParty[gBattleStruct->expGetterId], 0); // update battle mon structure after level up - if (gBattlePartyID[0] == gBattleStruct->expGetterId && gBattleMons[0].hp) + if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId && gBattleMons[0].hp) { gBattleMons[0].level = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL); gBattleMons[0].hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HP); @@ -3578,7 +3578,7 @@ static void atk23_getexp(void) gBattleMons[0].spDefense = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPDEF); } // What is else if? - if (gBattlePartyID[2] == gBattleStruct->expGetterId && gBattleMons[2].hp && (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) + if (gBattlerPartyIndexes[2] == gBattleStruct->expGetterId && gBattleMons[2].hp && (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { gBattleMons[2].level = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL); gBattleMons[2].hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HP); @@ -3613,7 +3613,7 @@ static void atk23_getexp(void) } break; case 6: // increment instruction - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { // not sure why gf clears the item and ability here gBattleMons[gBank1].item = 0; @@ -3630,7 +3630,7 @@ static void atk24(void) u16 HP_count = 0; s32 i; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId == STEVEN_PARTNER_ID) @@ -3716,7 +3716,7 @@ static void atk24(void) mov r7, r8\n\ push {r7}\n\ movs r6, 0\n\ - ldr r0, =gBattleExecBuffer\n\ + ldr r0, =gBattleControllerExecFlags\n\ ldr r0, [r0]\n\ cmp r0, 0\n\ beq _0804ACE2\n\ @@ -4303,7 +4303,7 @@ static void atk38_bicword(void) static void atk39_pause(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { u16 value = BS2ScriptRead16(gBattlescriptCurrInstr + 1); if (++gPauseCounterBattle >= value) @@ -4316,19 +4316,19 @@ static void atk39_pause(void) static void atk3A_waitstate(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) gBattlescriptCurrInstr++; } static void atk3B_healthbar_update(void) { if (gBattlescriptCurrInstr[1] == BS_GET_TARGET) - gActiveBattler = gBattleDefender; + gActiveBattler = gBattleMoveTarget; else - gActiveBattler = gBattleAttacker; + gActiveBattler = gBattleMoveAttacker; - EmitHealthBarUpdate(0, gBattleMoveDamage); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitHealthBarUpdate(0, gBattleMoveDamage); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } @@ -4340,7 +4340,7 @@ static void atk3C_return(void) static void atk3D_end(void) { if (gBattleTypeFlags & BATTLE_TYPE_ARENA) - sub_81A5718(gBattleAttacker); + sub_81A5718(gBattleMoveAttacker); gMoveResultFlags = 0; gActiveBattler = 0; @@ -4387,7 +4387,7 @@ static void atk43_jumpifabilitypresent(void) static void atk44_endselectionscript(void) { - *(gBattleAttacker + gBattleStruct->selectionScriptFinished) = TRUE; + *(gBattleMoveAttacker + gBattleStruct->selectionScriptFinished) = TRUE; } static void atk45_playanimation(void) @@ -4401,8 +4401,8 @@ static void atk45_playanimation(void) || gBattlescriptCurrInstr[2] == B_ANIM_SNATCH_MOVE || gBattlescriptCurrInstr[2] == B_ANIM_SUBSTITUTE_FADE) { - EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 7; } else if (gHitMarker & HITMARKER_NO_ANIMATIONS) @@ -4415,8 +4415,8 @@ static void atk45_playanimation(void) || gBattlescriptCurrInstr[2] == B_ANIM_SANDSTORM_CONTINUES || gBattlescriptCurrInstr[2] == B_ANIM_HAIL_CONTINUES) { - EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 7; } else if (gStatuses3[gActiveBattler] & STATUS3_SEMI_INVULNERABLE) @@ -4425,8 +4425,8 @@ static void atk45_playanimation(void) } else { - EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBattleAnimation(0, gBattlescriptCurrInstr[2], *argumentPtr); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 7; } } @@ -4444,8 +4444,8 @@ static void atk46_playanimation2(void) // animation Id is stored in the first po || *animationIdPtr == B_ANIM_SNATCH_MOVE || *animationIdPtr == B_ANIM_SUBSTITUTE_FADE) { - EmitBattleAnimation(0, *animationIdPtr, *argumentPtr); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBattleAnimation(0, *animationIdPtr, *argumentPtr); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 10; } else if (gHitMarker & HITMARKER_NO_ANIMATIONS) @@ -4457,8 +4457,8 @@ static void atk46_playanimation2(void) // animation Id is stored in the first po || *animationIdPtr == B_ANIM_SANDSTORM_CONTINUES || *animationIdPtr == B_ANIM_HAIL_CONTINUES) { - EmitBattleAnimation(0, *animationIdPtr, *argumentPtr); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBattleAnimation(0, *animationIdPtr, *argumentPtr); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 10; } else if (gStatuses3[gActiveBattler] & STATUS3_SEMI_INVULNERABLE) @@ -4467,8 +4467,8 @@ static void atk46_playanimation2(void) // animation Id is stored in the first po } else { - EmitBattleAnimation(0, *animationIdPtr, *argumentPtr); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBattleAnimation(0, *animationIdPtr, *argumentPtr); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 10; } } @@ -4575,8 +4575,8 @@ static void atk48_playstatchangeanimation(void) } else if (changeableStats != 0 && gBattleScripting.field_1B == 0) { - EmitBattleAnimation(0, B_ANIM_STATS_CHANGE, statAnimId); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBattleAnimation(0, B_ANIM_STATS_CHANGE, statAnimId); + MarkBattlerForControllerExec(gActiveBattler); if (gBattlescriptCurrInstr[3] & ATK48_BIT_x4 && changeableStats > 1) gBattleScripting.field_1B = 1; gBattlescriptCurrInstr += 4; @@ -4803,10 +4803,10 @@ _0804BB6C:\n\ movs r1, 0x1\n\ mov r2, r8\n\ str r3, [sp]\n\ - bl EmitBattleAnimation\n\ + bl BtlController_EmitBattleAnimation\n\ ldr r0, =gActiveBattler\n\ ldrb r0, [r0]\n\ - bl MarkBufferBankForExecution\n\ + bl MarkBattlerForControllerExec\n\ ldr r0, =gBattlescriptCurrInstr\n\ ldr r0, [r0]\n\ ldrb r1, [r0, 0x3]\n\ @@ -4864,12 +4864,12 @@ static void atk49_moveend(void) arg1 = gBattlescriptCurrInstr[1]; arg2 = gBattlescriptCurrInstr[2]; - if (gBattleMons[gBattleAttacker].item == ITEM_ENIGMA_BERRY) - holdEffectAtk = gEnigmaBerries[gBattleAttacker].holdEffect; + if (gBattleMons[gBattleMoveAttacker].item == ITEM_ENIGMA_BERRY) + holdEffectAtk = gEnigmaBerries[gBattleMoveAttacker].holdEffect; else - holdEffectAtk = ItemId_GetHoldEffect(gBattleMons[gBattleAttacker].item); + holdEffectAtk = ItemId_GetHoldEffect(gBattleMons[gBattleMoveAttacker].item); - choicedMoveAtk = &gBattleStruct->choicedMove[gBattleAttacker]; + choicedMoveAtk = &gBattleStruct->choicedMove[gBattleMoveAttacker]; GET_MOVE_TYPE(gCurrentMove, moveType); @@ -4878,13 +4878,13 @@ static void atk49_moveend(void) switch (gBattleScripting.atk49_state) { case 0: // rage check - if (gBattleMons[gBattleDefender].status2 & STATUS2_RAGE - && gBattleMons[gBattleDefender].hp != 0 && gBattleAttacker != gBattleDefender - && GetBattlerSide(gBattleAttacker) != GetBattlerSide(gBattleDefender) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_RAGE + && gBattleMons[gBattleMoveTarget].hp != 0 && gBattleMoveAttacker != gBattleMoveTarget + && GetBattlerSide(gBattleMoveAttacker) != GetBattlerSide(gBattleMoveTarget) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && TARGET_TURN_DAMAGED - && gBattleMoves[gCurrentMove].power && gBattleMons[gBattleDefender].statStages[STAT_STAGE_ATK] <= 0xB) + && gBattleMoves[gCurrentMove].power && gBattleMons[gBattleMoveTarget].statStages[STAT_STAGE_ATK] <= 0xB) { - gBattleMons[gBattleDefender].statStages[STAT_STAGE_ATK]++; + gBattleMons[gBattleMoveTarget].statStages[STAT_STAGE_ATK]++; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_RageIsBuilding; effect = TRUE; @@ -4892,15 +4892,15 @@ static void atk49_moveend(void) gBattleScripting.atk49_state++; break; case 1: // defrosting check - if (gBattleMons[gBattleDefender].status1 & STATUS1_FREEZE - && gBattleMons[gBattleDefender].hp != 0 && gBattleAttacker != gBattleDefender - && gSpecialStatuses[gBattleDefender].moveturnLostHP_special + if (gBattleMons[gBattleMoveTarget].status1 & STATUS1_FREEZE + && gBattleMons[gBattleMoveTarget].hp != 0 && gBattleMoveAttacker != gBattleMoveTarget + && gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_special && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && moveType == TYPE_FIRE) { - gBattleMons[gBattleDefender].status1 &= ~(STATUS1_FREEZE); - gActiveBattler = gBattleDefender; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gBattleDefender].status1); - MarkBufferBankForExecution(gActiveBattler); + gBattleMons[gBattleMoveTarget].status1 &= ~(STATUS1_FREEZE); + gActiveBattler = gBattleMoveTarget; + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gBattleMoveTarget].status1); + MarkBattlerForControllerExec(gActiveBattler); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_DefrostedViaFireMove; effect = TRUE; @@ -4908,12 +4908,12 @@ static void atk49_moveend(void) gBattleScripting.atk49_state++; break; case 2: // target synchronize - if (AbilityBattleEffects(ABILITYEFFECT_SYNCHRONIZE, gBattleDefender, 0, 0, 0)) + if (AbilityBattleEffects(ABILITYEFFECT_SYNCHRONIZE, gBattleMoveTarget, 0, 0, 0)) effect = TRUE; gBattleScripting.atk49_state++; break; case 3: // contact abilities - if (AbilityBattleEffects(ABILITYEFFECT_CONTACT, gBattleDefender, 0, 0, 0)) + if (AbilityBattleEffects(ABILITYEFFECT_CONTACT, gBattleMoveTarget, 0, 0, 0)) effect = TRUE; gBattleScripting.atk49_state++; break; @@ -4924,7 +4924,7 @@ static void atk49_moveend(void) gBattleScripting.atk49_state++; break; case 5: // attacker synchronize - if (AbilityBattleEffects(ABILITYEFFECT_ATK_SYNCHRONIZE, gBattleAttacker, 0, 0, 0)) + if (AbilityBattleEffects(ABILITYEFFECT_ATK_SYNCHRONIZE, gBattleMoveAttacker, 0, 0, 0)) effect = TRUE; gBattleScripting.atk49_state++; break; @@ -4942,7 +4942,7 @@ static void atk49_moveend(void) { for (i = 0; i < 4; i++) { - if (gBattleMons[gBattleAttacker].moves[i] == *choicedMoveAtk) + if (gBattleMons[gBattleMoveAttacker].moves[i] == *choicedMoveAtk) break; } if (i == 4) @@ -4975,12 +4975,12 @@ static void atk49_moveend(void) gBattleScripting.atk49_state++; break; case 8: // make attacker sprite invisible - if (gStatuses3[gBattleAttacker] & (STATUS3_SEMI_INVULNERABLE) + if (gStatuses3[gBattleMoveAttacker] & (STATUS3_SEMI_INVULNERABLE) && gHitMarker & HITMARKER_NO_ANIMATIONS) { - gActiveBattler = gBattleAttacker; - EmitSpriteInvisibility(0, TRUE); - MarkBufferBankForExecution(gActiveBattler); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitSpriteInvisibility(0, TRUE); + MarkBattlerForControllerExec(gActiveBattler); gBattleScripting.atk49_state++; return; } @@ -4988,27 +4988,27 @@ static void atk49_moveend(void) break; case 9: // make attacker sprite visible if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT - || !(gStatuses3[gBattleAttacker] & (STATUS3_SEMI_INVULNERABLE)) - || WasUnableToUseMove(gBattleAttacker)) + || !(gStatuses3[gBattleMoveAttacker] & (STATUS3_SEMI_INVULNERABLE)) + || WasUnableToUseMove(gBattleMoveAttacker)) { - gActiveBattler = gBattleAttacker; - EmitSpriteInvisibility(0, FALSE); - MarkBufferBankForExecution(gActiveBattler); - gStatuses3[gBattleAttacker] &= ~(STATUS3_SEMI_INVULNERABLE); - gSpecialStatuses[gBattleAttacker].restoredBankSprite = 1; + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitSpriteInvisibility(0, FALSE); + MarkBattlerForControllerExec(gActiveBattler); + gStatuses3[gBattleMoveAttacker] &= ~(STATUS3_SEMI_INVULNERABLE); + gSpecialStatuses[gBattleMoveAttacker].restoredBankSprite = 1; gBattleScripting.atk49_state++; return; } gBattleScripting.atk49_state++; break; case 10: // make target sprite visible - if (!gSpecialStatuses[gBattleDefender].restoredBankSprite && gBattleDefender < gBattlersCount - && !(gStatuses3[gBattleDefender] & STATUS3_SEMI_INVULNERABLE)) + if (!gSpecialStatuses[gBattleMoveTarget].restoredBankSprite && gBattleMoveTarget < gBattlersCount + && !(gStatuses3[gBattleMoveTarget] & STATUS3_SEMI_INVULNERABLE)) { - gActiveBattler = gBattleDefender; - EmitSpriteInvisibility(0, FALSE); - MarkBufferBankForExecution(gActiveBattler); - gStatuses3[gBattleDefender] &= ~(STATUS3_SEMI_INVULNERABLE); + gActiveBattler = gBattleMoveTarget; + BtlController_EmitSpriteInvisibility(0, FALSE); + MarkBattlerForControllerExec(gActiveBattler); + gStatuses3[gBattleMoveTarget] &= ~(STATUS3_SEMI_INVULNERABLE); gBattleScripting.atk49_state++; return; } @@ -5025,82 +5025,82 @@ static void atk49_moveend(void) case 14: // This case looks interesting, although I am not certain what it does. Probably fine tunes edge cases. if (gHitMarker & HITMARKER_PURSUIT_TRAP) { - gActiveBattler = gBattleAttacker; - gBattleAttacker = gBattleDefender; - gBattleDefender = gActiveBattler; + gActiveBattler = gBattleMoveAttacker; + gBattleMoveAttacker = gBattleMoveTarget; + gBattleMoveTarget = gActiveBattler; gHitMarker &= ~(HITMARKER_PURSUIT_TRAP); } if (gHitMarker & HITMARKER_ATTACKSTRING_PRINTED) { - gLastPrintedMoves[gBattleAttacker] = gChosenMove; + gLastPrintedMoves[gBattleMoveAttacker] = gChosenMove; } - if (!(gAbsentBattlerFlags & gBitTable[gBattleAttacker]) - && !(gBattleStruct->field_91 & gBitTable[gBattleAttacker]) + if (!(gAbsentBattlerFlags & gBitTable[gBattleMoveAttacker]) + && !(gBattleStruct->field_91 & gBitTable[gBattleMoveAttacker]) && gBattleMoves[originallyUsedMove].effect != EFFECT_BATON_PASS) { if (gHitMarker & HITMARKER_OBEYS) { - gLastMoves[gBattleAttacker] = gChosenMove; - gLastResultingMoves[gBattleAttacker] = gCurrentMove; + gLastMoves[gBattleMoveAttacker] = gChosenMove; + gLastResultingMoves[gBattleMoveAttacker] = gCurrentMove; } else { - gLastMoves[gBattleAttacker] = 0xFFFF; - gLastResultingMoves[gBattleAttacker] = 0xFFFF; + gLastMoves[gBattleMoveAttacker] = 0xFFFF; + gLastResultingMoves[gBattleMoveAttacker] = 0xFFFF; } - if (!(gHitMarker & HITMARKER_FAINTED(gBattleDefender))) - gLastHitBy[gBattleDefender] = gBattleAttacker; + if (!(gHitMarker & HITMARKER_FAINTED(gBattleMoveTarget))) + gLastHitBy[gBattleMoveTarget] = gBattleMoveAttacker; if (gHitMarker & HITMARKER_OBEYS && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { if (gChosenMove == 0xFFFF) { - gLastLandedMoves[gBattleDefender] = gChosenMove; + gLastLandedMoves[gBattleMoveTarget] = gChosenMove; } else { - gLastLandedMoves[gBattleDefender] = gCurrentMove; - GET_MOVE_TYPE(gCurrentMove, gLastHitByType[gBattleDefender]); + gLastLandedMoves[gBattleMoveTarget] = gCurrentMove; + GET_MOVE_TYPE(gCurrentMove, gLastHitByType[gBattleMoveTarget]); } } else { - gLastLandedMoves[gBattleDefender] = 0xFFFF; + gLastLandedMoves[gBattleMoveTarget] = 0xFFFF; } } gBattleScripting.atk49_state++; break; case 15: // mirror move - if (!(gAbsentBattlerFlags & gBitTable[gBattleAttacker]) && !(gBattleStruct->field_91 & gBitTable[gBattleAttacker]) + if (!(gAbsentBattlerFlags & gBitTable[gBattleMoveAttacker]) && !(gBattleStruct->field_91 & gBitTable[gBattleMoveAttacker]) && gBattleMoves[originallyUsedMove].flags & FLAG_MIRROR_MOVE_AFFECTED && gHitMarker & HITMARKER_OBEYS - && gBattleAttacker != gBattleDefender && !(gHitMarker & HITMARKER_FAINTED(gBattleDefender)) + && gBattleMoveAttacker != gBattleMoveTarget && !(gHitMarker & HITMARKER_FAINTED(gBattleMoveTarget)) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { u8 target, attacker; - *(gBattleStruct->mirrorMoves + gBattleDefender * 2 + 0) = gChosenMove; - *(gBattleStruct->mirrorMoves + gBattleDefender * 2 + 1) = gChosenMove >> 8; + *(gBattleStruct->mirrorMoves + gBattleMoveTarget * 2 + 0) = gChosenMove; + *(gBattleStruct->mirrorMoves + gBattleMoveTarget * 2 + 1) = gChosenMove >> 8; - target = gBattleDefender; - attacker = gBattleAttacker; + target = gBattleMoveTarget; + attacker = gBattleMoveAttacker; *(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 0) = gChosenMove; - target = gBattleDefender; - attacker = gBattleAttacker; + target = gBattleMoveTarget; + attacker = gBattleMoveAttacker; *(attacker * 2 + target * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 1) = gChosenMove >> 8; } gBattleScripting.atk49_state++; break; case 16: // if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && !gProtectStructs[gBattleAttacker].chargingTurn && gBattleMoves[gCurrentMove].target == MOVE_TARGET_BOTH + && !gProtectStructs[gBattleMoveAttacker].chargingTurn && gBattleMoves[gCurrentMove].target == MOVE_TARGET_BOTH && !(gHitMarker & HITMARKER_NO_ATTACKSTRING)) { - u8 bank = GetBattlerAtPosition(B_POSITION_PARTNER(GetBattlerPosition(gBattleDefender))); + u8 bank = GetBattlerAtPosition(B_POSITION_PARTNER(GetBattlerPosition(gBattleMoveTarget))); if (gBattleMons[bank].hp != 0) { - gBattleDefender = bank; + gBattleMoveTarget = bank; gHitMarker |= HITMARKER_NO_ATTACKSTRING; gBattleScripting.atk49_state = 0; MoveValuesCleanUp(); @@ -5136,13 +5136,13 @@ static void atk4A_typecalc2(void) s32 i = 0; u8 moveType = gBattleMoves[gCurrentMove].type; - if (gBattleMons[gBattleDefender].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND) + if (gBattleMons[gBattleMoveTarget].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND) { - gLastUsedAbility = gBattleMons[gBattleDefender].ability; + gLastUsedAbility = gBattleMons[gBattleMoveTarget].ability; gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE); - gLastLandedMoves[gBattleDefender] = 0; + gLastLandedMoves[gBattleMoveTarget] = 0; gBattleCommunication[6] = moveType; - RecordAbilityBattle(gBattleDefender, gLastUsedAbility); + RecordAbilityBattle(gBattleMoveTarget, gLastUsedAbility); } else { @@ -5150,7 +5150,7 @@ static void atk4A_typecalc2(void) { if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT) { - if (gBattleMons[gBattleDefender].status2 & STATUS2_FORESIGHT) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_FORESIGHT) { break; } @@ -5164,7 +5164,7 @@ static void atk4A_typecalc2(void) if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check type1 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type1) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type1) { if (TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { @@ -5181,22 +5181,22 @@ static void atk4A_typecalc2(void) } } // check type2 - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type2) + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type2) { - if (gBattleMons[gBattleDefender].type1 != gBattleMons[gBattleDefender].type2 + if (gBattleMons[gBattleMoveTarget].type1 != gBattleMons[gBattleMoveTarget].type2 && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT) { gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE; break; } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type2 - && gBattleMons[gBattleDefender].type1 != gBattleMons[gBattleDefender].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type2 + && gBattleMons[gBattleMoveTarget].type1 != gBattleMons[gBattleMoveTarget].type2 && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE) { flags |= MOVE_RESULT_NOT_VERY_EFFECTIVE; } - if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleDefender].type2 - && gBattleMons[gBattleDefender].type1 != gBattleMons[gBattleDefender].type2 + if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattleMoveTarget].type2 + && gBattleMons[gBattleMoveTarget].type1 != gBattleMons[gBattleMoveTarget].type2 && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) { flags |= MOVE_RESULT_SUPER_EFFECTIVE; @@ -5207,46 +5207,46 @@ static void atk4A_typecalc2(void) } } - if (gBattleMons[gBattleDefender].ability == ABILITY_WONDER_GUARD + if (gBattleMons[gBattleMoveTarget].ability == ABILITY_WONDER_GUARD && !(flags & MOVE_RESULT_NO_EFFECT) - && AttacksThisTurn(gBattleAttacker, gCurrentMove) == 2 + && AttacksThisTurn(gBattleMoveAttacker, gCurrentMove) == 2 && (!(flags & MOVE_RESULT_SUPER_EFFECTIVE) || ((flags & (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)) == (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE))) && gBattleMoves[gCurrentMove].power) { gLastUsedAbility = ABILITY_WONDER_GUARD; gMoveResultFlags |= MOVE_RESULT_MISSED; - gLastLandedMoves[gBattleDefender] = 0; + gLastLandedMoves[gBattleMoveTarget] = 0; gBattleCommunication[6] = 3; - RecordAbilityBattle(gBattleDefender, gLastUsedAbility); + RecordAbilityBattle(gBattleMoveTarget, gLastUsedAbility); } if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) - gProtectStructs[gBattleAttacker].targetNotAffected = 1; + gProtectStructs[gBattleMoveAttacker].targetNotAffected = 1; gBattlescriptCurrInstr++; } static void atk4B_returnatktoball(void) { - gActiveBattler = gBattleAttacker; + gActiveBattler = gBattleMoveAttacker; if (!(gHitMarker & HITMARKER_FAINTED(gActiveBattler))) { - EmitReturnMonToBall(0, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitReturnMonToBall(0, 0); + MarkBattlerForControllerExec(gActiveBattler); } gBattlescriptCurrInstr++; } static void atk4C_getswitchedmondata(void) { - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); - gBattlePartyID[gActiveBattler] = *(gBattleStruct->monToSwitchIntoId + gActiveBattler); + gBattlerPartyIndexes[gActiveBattler] = *(gBattleStruct->monToSwitchIntoId + gActiveBattler); - EmitGetMonData(0, REQUEST_ALL_BATTLE, gBitTable[gBattlePartyID[gActiveBattler]]); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitGetMonData(0, REQUEST_ALL_BATTLE, gBitTable[gBattlerPartyIndexes[gActiveBattler]]); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } @@ -5257,7 +5257,7 @@ static void atk4D_switchindataupdate(void) s32 i; u8 *monData; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); @@ -5275,7 +5275,7 @@ static void atk4D_switchindataupdate(void) // check knocked off item i = GetBattlerSide(gActiveBattler); - if (gWishFutureKnock.knockedOffPokes[i] & gBitTable[gBattlePartyID[gActiveBattler]]) + if (gWishFutureKnock.knockedOffPokes[i] & gBitTable[gBattlerPartyIndexes[gActiveBattler]]) { gBattleMons[gActiveBattler].item = 0; } @@ -5299,14 +5299,14 @@ static void atk4D_switchindataupdate(void) gBattleScripting.battler = gActiveBattler; - PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gActiveBattler, gBattlePartyID[gActiveBattler]); + PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gActiveBattler, gBattlerPartyIndexes[gActiveBattler]); gBattlescriptCurrInstr += 2; } static void atk4E_switchinanim(void) { - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); @@ -5321,8 +5321,8 @@ static void atk4E_switchinanim(void) gAbsentBattlerFlags &= ~(gBitTable[gActiveBattler]); - EmitSwitchInAnim(0, gBattlePartyID[gActiveBattler], gBattlescriptCurrInstr[2]); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSwitchInAnim(0, gBattlerPartyIndexes[gActiveBattler], gBattlescriptCurrInstr[2]); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 3; @@ -5364,7 +5364,7 @@ static void atk4F_jumpifcantswitch(void) if (GetMonData(&party[val], MON_DATA_SPECIES) != SPECIES_NONE && !GetMonData(&party[val], MON_DATA_IS_EGG) && GetMonData(&party[val], MON_DATA_HP) != 0 - && gBattlePartyID[gActiveBattler] != val) + && gBattlerPartyIndexes[gActiveBattler] != val) break; } @@ -5382,7 +5382,7 @@ static void atk4F_jumpifcantswitch(void) party = gPlayerParty; val = 0; - if (sub_806D82C(GetBankMultiplayerId(gActiveBattler)) == TRUE) + if (sub_806D82C(GetBattlerMultiplayerId(gActiveBattler)) == TRUE) val = 3; } else @@ -5404,7 +5404,7 @@ static void atk4F_jumpifcantswitch(void) val = 0; - if (sub_806D82C(GetBankMultiplayerId(gActiveBattler)) == TRUE) + if (sub_806D82C(GetBattlerMultiplayerId(gActiveBattler)) == TRUE) val = 3; } @@ -5413,7 +5413,7 @@ static void atk4F_jumpifcantswitch(void) if (GetMonData(&party[val], MON_DATA_SPECIES) != SPECIES_NONE && !GetMonData(&party[val], MON_DATA_IS_EGG) && GetMonData(&party[val], MON_DATA_HP) != 0 - && gBattlePartyID[gActiveBattler] != val) + && gBattlerPartyIndexes[gActiveBattler] != val) break; } @@ -5435,7 +5435,7 @@ static void atk4F_jumpifcantswitch(void) if (GetMonData(&party[val], MON_DATA_SPECIES) != SPECIES_NONE && !GetMonData(&party[val], MON_DATA_IS_EGG) && GetMonData(&party[val], MON_DATA_HP) != 0 - && gBattlePartyID[gActiveBattler] != val) + && gBattlerPartyIndexes[gActiveBattler] != val) break; } @@ -5473,7 +5473,7 @@ static void atk4F_jumpifcantswitch(void) if (GetMonData(&party[val], MON_DATA_HP) != 0 && GetMonData(&party[val], MON_DATA_SPECIES) != SPECIES_NONE && !GetMonData(&party[val], MON_DATA_IS_EGG) - && val != gBattlePartyID[r7] && val != gBattlePartyID[compareVar]) + && val != gBattlerPartyIndexes[r7] && val != gBattlerPartyIndexes[compareVar]) break; } @@ -5486,12 +5486,12 @@ static void atk4F_jumpifcantswitch(void) static void sub_804CF10(u8 arg0) { - *(gBattleStruct->field_58 + gActiveBattler) = gBattlePartyID[gActiveBattler]; + *(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler]; *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = 6; gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]); - EmitChoosePokemon(0, 1, arg0, 0, gBattleStruct->field_60[gActiveBattler]); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitChoosePokemon(0, 1, arg0, 0, gBattleStruct->field_60[gActiveBattler]); + MarkBattlerForControllerExec(gActiveBattler); } static void atk50_openpartyscreen(void) @@ -5517,8 +5517,8 @@ static void atk50_openpartyscreen(void) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - EmitLinkStandbyMsg(0, 2, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitLinkStandbyMsg(0, 2, 0); + MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { @@ -5528,8 +5528,8 @@ static void atk50_openpartyscreen(void) } else { - EmitLinkStandbyMsg(0, 2, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitLinkStandbyMsg(0, 2, 0); + MarkBattlerForControllerExec(gActiveBattler); } } } @@ -5546,8 +5546,8 @@ static void atk50_openpartyscreen(void) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - EmitCmd42(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitCmd42(0); + MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { @@ -5556,8 +5556,8 @@ static void atk50_openpartyscreen(void) } else { - EmitLinkStandbyMsg(0, 2, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitLinkStandbyMsg(0, 2, 0); + MarkBattlerForControllerExec(gActiveBattler); flags |= 1; } } @@ -5568,8 +5568,8 @@ static void atk50_openpartyscreen(void) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - EmitCmd42(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitCmd42(0); + MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { @@ -5578,8 +5578,8 @@ static void atk50_openpartyscreen(void) } else if (!(flags & 1)) { - EmitLinkStandbyMsg(0, 2, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitLinkStandbyMsg(0, 2, 0); + MarkBattlerForControllerExec(gActiveBattler); } } if (gBitTable[1] & hitmarkerFaintBits) @@ -5589,8 +5589,8 @@ static void atk50_openpartyscreen(void) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - EmitCmd42(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitCmd42(0); + MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { @@ -5599,8 +5599,8 @@ static void atk50_openpartyscreen(void) } else { - EmitLinkStandbyMsg(0, 2, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitLinkStandbyMsg(0, 2, 0); + MarkBattlerForControllerExec(gActiveBattler); flags |= 2; } } @@ -5611,8 +5611,8 @@ static void atk50_openpartyscreen(void) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - EmitCmd42(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitCmd42(0); + MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { @@ -5621,8 +5621,8 @@ static void atk50_openpartyscreen(void) } else if (!(flags & 2)) { - EmitLinkStandbyMsg(0, 2, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitLinkStandbyMsg(0, 2, 0); + MarkBattlerForControllerExec(gActiveBattler); } } @@ -5637,8 +5637,8 @@ static void atk50_openpartyscreen(void) else gActiveBattler = 0; - EmitLinkStandbyMsg(0, 2, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitLinkStandbyMsg(0, 2, 0); + MarkBattlerForControllerExec(gActiveBattler); } } @@ -5653,8 +5653,8 @@ static void atk50_openpartyscreen(void) else gActiveBattler = 1; - EmitLinkStandbyMsg(0, 2, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitLinkStandbyMsg(0, 2, 0); + MarkBattlerForControllerExec(gActiveBattler); } } } @@ -5674,8 +5674,8 @@ static void atk50_openpartyscreen(void) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - EmitCmd42(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitCmd42(0); + MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { @@ -5690,8 +5690,8 @@ static void atk50_openpartyscreen(void) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - EmitCmd42(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitCmd42(0); + MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) { @@ -5748,12 +5748,12 @@ static void atk50_openpartyscreen(void) else { gActiveBattler = bank; - *(gBattleStruct->field_58 + gActiveBattler) = gBattlePartyID[gActiveBattler]; + *(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler]; *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = 6; gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]); - EmitChoosePokemon(0, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + (gActiveBattler ^ 2)), 0, gBattleStruct->field_60[gActiveBattler]); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitChoosePokemon(0, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + (gActiveBattler ^ 2)), 0, gBattleStruct->field_60[gActiveBattler]); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 6; @@ -5766,8 +5766,8 @@ static void atk50_openpartyscreen(void) { if (gActiveBattler != bank) { - EmitLinkStandbyMsg(0, 2, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitLinkStandbyMsg(0, 2, 0); + MarkBattlerForControllerExec(gActiveBattler); } } } @@ -5777,8 +5777,8 @@ static void atk50_openpartyscreen(void) if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) gActiveBattler ^= BIT_FLANK; - EmitLinkStandbyMsg(0, 2, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitLinkStandbyMsg(0, 2, 0); + MarkBattlerForControllerExec(gActiveBattler); } } } @@ -5787,7 +5787,7 @@ static void atk50_openpartyscreen(void) static void atk51_switchhandleorder(void) { s32 i; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); @@ -5802,7 +5802,7 @@ static void atk51_switchhandleorder(void) *(gBattleStruct->monToSwitchIntoId + i) = gBattleBufferB[i][1]; if (!(gBattleStruct->field_93 & gBitTable[i])) { - RecordedBattle_SetBankAction(i, gBattleBufferB[i][1]); + RecordedBattle_SetBattlerAction(i, gBattleBufferB[i][1]); gBattleStruct->field_93 |= gBitTable[i]; } } @@ -5815,7 +5815,7 @@ static void atk51_switchhandleorder(void) case 2: if (!(gBattleStruct->field_93 & gBitTable[gActiveBattler])) { - RecordedBattle_SetBankAction(gActiveBattler, gBattleBufferB[gActiveBattler][1]); + RecordedBattle_SetBattlerAction(gActiveBattler, gBattleBufferB[gActiveBattler][1]); gBattleStruct->field_93 |= gBitTable[gActiveBattler]; } // fall through @@ -5842,7 +5842,7 @@ static void atk51_switchhandleorder(void) sub_803BDA0(gActiveBattler); } - PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattleAttacker].species) + PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattleMoveAttacker].species) PREPARE_MON_NICK_BUFFER(gBattleTextBuff2, gActiveBattler, gBattleBufferB[gActiveBattler][1]) break; @@ -5935,26 +5935,26 @@ static void atk52_switchineffects(void) static void atk53_trainerslidein(void) { gActiveBattler = GetBattlerAtPosition(gBattlescriptCurrInstr[1]); - EmitTrainerSlide(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitTrainerSlide(0); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } static void atk54_playse(void) { - gActiveBattler = gBattleAttacker; - EmitPlaySE(0, BS2ScriptRead16(gBattlescriptCurrInstr + 1)); - MarkBufferBankForExecution(gActiveBattler); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitPlaySE(0, BS2ScriptRead16(gBattlescriptCurrInstr + 1)); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 3; } static void atk55_fanfare(void) { - gActiveBattler = gBattleAttacker; - EmitPlayFanfareOrBGM(0, BS2ScriptRead16(gBattlescriptCurrInstr + 1), FALSE); - MarkBufferBankForExecution(gActiveBattler); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitPlayFanfareOrBGM(0, BS2ScriptRead16(gBattlescriptCurrInstr + 1), FALSE); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 3; } @@ -5962,8 +5962,8 @@ static void atk55_fanfare(void) static void atk56_playfaintcry(void) { gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); - EmitFaintingCry(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitFaintingCry(0); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } @@ -5971,8 +5971,8 @@ static void atk56_playfaintcry(void) static void atk57(void) { gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - EmitCmd55(0, gBattleOutcome); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitCmd55(0, gBattleOutcome); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 1; } @@ -5980,8 +5980,8 @@ static void atk57(void) static void atk58_returntoball(void) { gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); - EmitReturnMonToBall(0, 1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitReturnMonToBall(0, 1); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } @@ -6007,7 +6007,7 @@ static void atk59_handlelearnnewmove(void) { gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - if (gBattlePartyID[gActiveBattler] == gBattleStruct->expGetterId + if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterId && !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) { GiveMoveToBattleMon(&gBattleMons[gActiveBattler], ret); @@ -6015,7 +6015,7 @@ static void atk59_handlelearnnewmove(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); - if (gBattlePartyID[gActiveBattler] == gBattleStruct->expGetterId + if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterId && !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) { GiveMoveToBattleMon(&gBattleMons[gActiveBattler], ret); @@ -6113,7 +6113,7 @@ static void atk5A_yesnoboxlearnmove(void) RemoveMonPPBonus(&gPlayerParty[gBattleStruct->expGetterId], movePosition); SetMonMoveSlot(&gPlayerParty[gBattleStruct->expGetterId], gMoveToLearn, movePosition); - if (gBattlePartyID[0] == gBattleStruct->expGetterId + if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId && !(gBattleMons[0].status2 & STATUS2_TRANSFORMED) && !(gDisableStructs[0].unk18_b & gBitTable[movePosition])) { @@ -6121,7 +6121,7 @@ static void atk5A_yesnoboxlearnmove(void) SetBattleMonMoveSlot(&gBattleMons[0], gMoveToLearn, movePosition); } if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && gBattlePartyID[2] == gBattleStruct->expGetterId + && gBattlerPartyIndexes[2] == gBattleStruct->expGetterId && !(gBattleMons[2].status2 & STATUS2_TRANSFORMED) && !(gDisableStructs[2].unk18_b & gBitTable[movePosition])) { @@ -6137,7 +6137,7 @@ static void atk5A_yesnoboxlearnmove(void) gBattlescriptCurrInstr += 5; break; case 6: - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gBattleScripting.learnMoveState = 2; } @@ -6202,8 +6202,8 @@ static void atk5C_hitanimation(void) } else if (!(gHitMarker & HITMARKER_IGNORE_SUBSTITUTE) || !(gBattleMons[gActiveBattler].status2 & STATUS2_SUBSTITUTE) || gDisableStructs[gActiveBattler].substituteHP == 0) { - EmitHitAnimation(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitHitAnimation(0); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } else @@ -6289,12 +6289,12 @@ static void atk5E(void) switch (gBattleCommunication[0]) { case 0: - EmitGetMonData(0, REQUEST_ALL_BATTLE, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitGetMonData(0, REQUEST_ALL_BATTLE, 0); + MarkBattlerForControllerExec(gActiveBattler); gBattleCommunication[0]++; break; case 1: - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { s32 i; struct BattlePokemon* bufferPoke = (struct BattlePokemon*) &gBattleBufferB[gActiveBattler][4]; @@ -6311,9 +6311,9 @@ static void atk5E(void) static void atk5F(void) { - gActiveBattler = gBattleAttacker; - gBattleAttacker = gBattleDefender; - gBattleDefender = gActiveBattler; + gActiveBattler = gBattleMoveAttacker; + gBattleMoveAttacker = gBattleMoveTarget; + gBattleMoveTarget = gActiveBattler; if (gHitMarker & HITMARKER_PURSUIT_TRAP) gHitMarker &= ~(HITMARKER_PURSUIT_TRAP); @@ -6325,7 +6325,7 @@ static void atk5F(void) static void atk60_incrementgamestat(void) { - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) IncrementGameStat(gBattlescriptCurrInstr[1]); gBattlescriptCurrInstr += 2; @@ -6337,7 +6337,7 @@ static void atk61_drawpartystatussummary(void) struct Pokemon* party; struct HpAndStatus hpStatuses[6]; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); @@ -6362,8 +6362,8 @@ static void atk61_drawpartystatussummary(void) } } - EmitDrawPartyStatusSummary(0, hpStatuses, 1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitDrawPartyStatusSummary(0, hpStatuses, 1); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } @@ -6371,8 +6371,8 @@ static void atk61_drawpartystatussummary(void) static void atk62(void) { gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); - EmitCmd49(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitCmd49(0); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } @@ -6389,15 +6389,15 @@ static void atk63_jumptorandomattack(void) static void atk64_statusanimation(void) { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); if (!(gStatuses3[gActiveBattler] & STATUS3_SEMI_INVULNERABLE) && gDisableStructs[gActiveBattler].substituteHP == 0 && !(gHitMarker & HITMARKER_NO_ANIMATIONS)) { - EmitStatusAnimation(0, FALSE, gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitStatusAnimation(0, FALSE, gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); } gBattlescriptCurrInstr += 2; } @@ -6407,7 +6407,7 @@ static void atk65_status2animation(void) { u32 wantedToAnimate; - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); wantedToAnimate = BSScriptRead32(gBattlescriptCurrInstr + 2); @@ -6415,8 +6415,8 @@ static void atk65_status2animation(void) && gDisableStructs[gActiveBattler].substituteHP == 0 && !(gHitMarker & HITMARKER_NO_ANIMATIONS)) { - EmitStatusAnimation(0, TRUE, gBattleMons[gActiveBattler].status2 & wantedToAnimate); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitStatusAnimation(0, TRUE, gBattleMons[gActiveBattler].status2 & wantedToAnimate); + MarkBattlerForControllerExec(gActiveBattler); } gBattlescriptCurrInstr += 6; } @@ -6426,7 +6426,7 @@ static void atk66_chosenstatusanimation(void) { u32 wantedStatus; - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) { gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); wantedStatus = BSScriptRead32(gBattlescriptCurrInstr + 3); @@ -6434,8 +6434,8 @@ static void atk66_chosenstatusanimation(void) && gDisableStructs[gActiveBattler].substituteHP == 0 && !(gHitMarker & HITMARKER_NO_ANIMATIONS)) { - EmitStatusAnimation(0, gBattlescriptCurrInstr[2], wantedStatus); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitStatusAnimation(0, gBattlescriptCurrInstr[2], wantedStatus); + MarkBattlerForControllerExec(gActiveBattler); } gBattlescriptCurrInstr += 7; } @@ -6498,42 +6498,42 @@ static void atk69_adjustsetdamage(void) // The same as 0x7, except there's no ra { u8 holdEffect, quality; - if (gBattleMons[gBattleDefender].item == ITEM_ENIGMA_BERRY) + if (gBattleMons[gBattleMoveTarget].item == ITEM_ENIGMA_BERRY) { - holdEffect = gEnigmaBerries[gBattleDefender].holdEffect, quality = gEnigmaBerries[gBattleDefender].holdEffectParam; + holdEffect = gEnigmaBerries[gBattleMoveTarget].holdEffect, quality = gEnigmaBerries[gBattleMoveTarget].holdEffectParam; } else { - holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattleDefender].item); - quality = ItemId_GetHoldEffectParam(gBattleMons[gBattleDefender].item); + holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattleMoveTarget].item); + quality = ItemId_GetHoldEffectParam(gBattleMons[gBattleMoveTarget].item); } - gStringBank = gBattleDefender; + gStringBank = gBattleMoveTarget; if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < quality) { - RecordItemEffectBattle(gBattleDefender, holdEffect); - gSpecialStatuses[gBattleDefender].focusBanded = 1; + RecordItemEffectBattle(gBattleMoveTarget, holdEffect); + gSpecialStatuses[gBattleMoveTarget].focusBanded = 1; } - if (gBattleMons[gBattleDefender].status2 & STATUS2_SUBSTITUTE) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_SUBSTITUTE) goto END; - if (gBattleMoves[gCurrentMove].effect != EFFECT_FALSE_SWIPE && !gProtectStructs[gBattleDefender].endured - && !gSpecialStatuses[gBattleDefender].focusBanded) + if (gBattleMoves[gCurrentMove].effect != EFFECT_FALSE_SWIPE && !gProtectStructs[gBattleMoveTarget].endured + && !gSpecialStatuses[gBattleMoveTarget].focusBanded) goto END; - if (gBattleMons[gBattleDefender].hp > gBattleMoveDamage) + if (gBattleMons[gBattleMoveTarget].hp > gBattleMoveDamage) goto END; - gBattleMoveDamage = gBattleMons[gBattleDefender].hp - 1; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].hp - 1; - if (gProtectStructs[gBattleDefender].endured) + if (gProtectStructs[gBattleMoveTarget].endured) { gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED; } - else if (gSpecialStatuses[gBattleDefender].focusBanded) + else if (gSpecialStatuses[gBattleMoveTarget].focusBanded) { gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON; - gLastUsedItem = gBattleMons[gBattleDefender].item; + gLastUsedItem = gBattleMons[gBattleMoveTarget].item; } END: @@ -6550,15 +6550,15 @@ static void atk6A_removeitem(void) *usedHeldItem = gBattleMons[gActiveBattler].item; gBattleMons[gActiveBattler].item = 0; - EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gActiveBattler].item); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gActiveBattler].item); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } static void atk6B_atknameinbuff1(void) { - PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattleAttacker, gBattlePartyID[gBattleAttacker]) + PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattleMoveAttacker, gBattlerPartyIndexes[gBattleMoveAttacker]) gBattlescriptCurrInstr++; } @@ -6829,9 +6829,9 @@ static void SpriteCB_MonIconOnLvlUpBox(struct Sprite* sprite) static bool32 IsMonGettingExpSentOut(void) { - if (gBattlePartyID[0] == gBattleStruct->expGetterId) + if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId) return TRUE; - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && gBattlePartyID[2] == gBattleStruct->expGetterId) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && gBattlerPartyIndexes[2] == gBattleStruct->expGetterId) return TRUE; return FALSE; @@ -6845,15 +6845,15 @@ static void atk6D_resetsentmonsvalue(void) static void atk6E_setatktoplayer0(void) { - gBattleAttacker = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + gBattleMoveAttacker = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); gBattlescriptCurrInstr++; } static void atk6F_makevisible(void) { gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); - EmitSpriteInvisibility(0, FALSE); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSpriteInvisibility(0, FALSE); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } @@ -6939,8 +6939,8 @@ static void atk74_hpthresholds2(void) static void atk75_useitemonopponent(void) { - gBankInMenu = gBattleAttacker; - ExecuteTableBasedItemEffect(&gEnemyParty[gBattlePartyID[gBattleAttacker]], gLastUsedItem, gBattlePartyID[gBattleAttacker], 0, 1); + gBankInMenu = gBattleMoveAttacker; + ExecuteTableBasedItemEffect(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker]], gLastUsedItem, gBattlerPartyIndexes[gBattleMoveAttacker], 0, 1); gBattlescriptCurrInstr += 1; } @@ -6958,18 +6958,18 @@ static void atk76_various(void) CancelMultiTurnMoves(gActiveBattler); break; case VARIOUS_SET_MAGIC_COAT_TARGET: - gBattleAttacker = gBattleDefender; - side = GetBattlerSide(gBattleAttacker) ^ BIT_SIDE; + gBattleMoveAttacker = gBattleMoveTarget; + side = GetBattlerSide(gBattleMoveAttacker) ^ BIT_SIDE; if (gSideTimers[side].followmeTimer != 0 && gBattleMons[gSideTimers[side].followmeTarget].hp != 0) - gBattleDefender = gSideTimers[side].followmeTarget; + gBattleMoveTarget = gSideTimers[side].followmeTarget; else - gBattleDefender = gActiveBattler; + gBattleMoveTarget = gActiveBattler; break; case VARIOUS_IS_RUNNING_IMPOSSIBLE: gBattleCommunication[0] = IsRunningFromBattleImpossible(); break; case VARIOUS_GET_MOVE_TARGET: - gBattleDefender = GetMoveTarget(gCurrentMove, 0); + gBattleMoveTarget = GetMoveTarget(gCurrentMove, 0); break; case 4: if (gHitMarker & HITMARKER_FAINTED(gActiveBattler)) @@ -6982,11 +6982,11 @@ static void atk76_various(void) gSpecialStatuses[gActiveBattler].traced = 0; break; case VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP: - if (gBattlePartyID[0] == gBattleStruct->expGetterId || gBattlePartyID[2] == gBattleStruct->expGetterId) + if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId || gBattlerPartyIndexes[2] == gBattleStruct->expGetterId) { u16 *choicedMove; - if (gBattlePartyID[0] == gBattleStruct->expGetterId) + if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId) gActiveBattler = 0; else gActiveBattler = 2; @@ -7034,14 +7034,14 @@ static void atk76_various(void) case 10: gBattleMons[1].hp = 0; gHitMarker |= HITMARKER_FAINTED(1); - gBattleStruct->field_2A1 |= gBitTable[gBattlePartyID[1]]; + gBattleStruct->field_2A1 |= gBitTable[gBattlerPartyIndexes[1]]; gDisableStructs[1].truantUnknownBit = 1; break; case 11: gBattleMons[0].hp = 0; gHitMarker |= HITMARKER_FAINTED(0); gHitMarker |= HITMARKER_x400000; - gBattleStruct->field_2A0 |= gBitTable[gBattlePartyID[0]]; + gBattleStruct->field_2A0 |= gBitTable[gBattlerPartyIndexes[0]]; gDisableStructs[0].truantUnknownBit = 1; break; case 12: @@ -7050,14 +7050,14 @@ static void atk76_various(void) gHitMarker |= HITMARKER_FAINTED(0); gHitMarker |= HITMARKER_FAINTED(1); gHitMarker |= HITMARKER_x400000; - gBattleStruct->field_2A0 |= gBitTable[gBattlePartyID[0]]; - gBattleStruct->field_2A1 |= gBitTable[gBattlePartyID[1]]; + gBattleStruct->field_2A0 |= gBitTable[gBattlerPartyIndexes[0]]; + gBattleStruct->field_2A1 |= gBitTable[gBattlerPartyIndexes[1]]; gDisableStructs[0].truantUnknownBit = 1; gDisableStructs[1].truantUnknownBit = 1; break; case VARIOUS_EMIT_YESNOBOX: - EmitUnknownYesNoBox(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitUnknownYesNoBox(0); + MarkBattlerForControllerExec(gActiveBattler); break; case 14: sub_81A5BF8(); @@ -7081,8 +7081,8 @@ static void atk76_various(void) gActiveBattler = 1; if (gBattleMons[gActiveBattler].hp != 0) { - EmitReturnMonToBall(0, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitReturnMonToBall(0, 0); + MarkBattlerForControllerExec(gActiveBattler); } break; case VARIOUS_RETURN_OPPONENT_MON2: @@ -7091,8 +7091,8 @@ static void atk76_various(void) gActiveBattler = 3; if (gBattleMons[gActiveBattler].hp != 0) { - EmitReturnMonToBall(0, 0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitReturnMonToBall(0, 0); + MarkBattlerForControllerExec(gActiveBattler); } } break; @@ -7116,8 +7116,8 @@ static void atk76_various(void) gBattleOutcome = B_OUTCOME_POKE_TELEPORTED; break; case VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC: - EmitPlayFanfareOrBGM(0, MUS_KACHI1, TRUE); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitPlayFanfareOrBGM(0, MUS_KACHI1, TRUE); + MarkBattlerForControllerExec(gActiveBattler); break; } @@ -7127,31 +7127,31 @@ static void atk76_various(void) static void atk77_setprotectlike(void) // protect and endure { bool8 notLastTurn = TRUE; - u16 lastMove = gLastResultingMoves[gBattleAttacker]; + u16 lastMove = gLastResultingMoves[gBattleMoveAttacker]; if (lastMove != MOVE_PROTECT && lastMove != MOVE_DETECT && lastMove != MOVE_ENDURE) - gDisableStructs[gBattleAttacker].protectUses = 0; + gDisableStructs[gBattleMoveAttacker].protectUses = 0; if (gCurrentTurnActionNumber == (gBattlersCount - 1)) notLastTurn = FALSE; - if (sProtectSuccessRates[gDisableStructs[gBattleAttacker].protectUses] >= Random() && notLastTurn) + if (sProtectSuccessRates[gDisableStructs[gBattleMoveAttacker].protectUses] >= Random() && notLastTurn) { if (gBattleMoves[gCurrentMove].effect == EFFECT_PROTECT) { - gProtectStructs[gBattleAttacker].protected = 1; + gProtectStructs[gBattleMoveAttacker].protected = 1; gBattleCommunication[MULTISTRING_CHOOSER] = 0; } if (gBattleMoves[gCurrentMove].effect == EFFECT_ENDURE) { - gProtectStructs[gBattleAttacker].endured = 1; + gProtectStructs[gBattleMoveAttacker].endured = 1; gBattleCommunication[MULTISTRING_CHOOSER] = 1; } - gDisableStructs[gBattleAttacker].protectUses++; + gDisableStructs[gBattleMoveAttacker].protectUses++; } else { - gDisableStructs[gBattleAttacker].protectUses = 0; + gDisableStructs[gBattleMoveAttacker].protectUses = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 2; gMoveResultFlags |= MOVE_RESULT_MISSED; } @@ -7161,48 +7161,48 @@ static void atk77_setprotectlike(void) // protect and endure static void atk78_faintifabilitynotdamp(void) { - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; - for (gBattleDefender = 0; gBattleDefender < gBattlersCount; gBattleDefender++) + for (gBattleMoveTarget = 0; gBattleMoveTarget < gBattlersCount; gBattleMoveTarget++) { - if (gBattleMons[gBattleDefender].ability == ABILITY_DAMP) + if (gBattleMons[gBattleMoveTarget].ability == ABILITY_DAMP) break; } - if (gBattleDefender == gBattlersCount) + if (gBattleMoveTarget == gBattlersCount) { - gActiveBattler = gBattleAttacker; + gActiveBattler = gBattleMoveAttacker; gBattleMoveDamage = gBattleMons[gActiveBattler].hp; - EmitHealthBarUpdate(0, INSTANT_HP_BAR_DROP); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitHealthBarUpdate(0, INSTANT_HP_BAR_DROP); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr++; - for (gBattleDefender = 0; gBattleDefender < gBattlersCount; gBattleDefender++) + for (gBattleMoveTarget = 0; gBattleMoveTarget < gBattlersCount; gBattleMoveTarget++) { - if (gBattleDefender == gBattleAttacker) + if (gBattleMoveTarget == gBattleMoveAttacker) continue; - if (!(gAbsentBattlerFlags & gBitTable[gBattleDefender])) + if (!(gAbsentBattlerFlags & gBitTable[gBattleMoveTarget])) break; } } else { gLastUsedAbility = ABILITY_DAMP; - RecordAbilityBattle(gBattleDefender, gBattleMons[gBattleDefender].ability); + RecordAbilityBattle(gBattleMoveTarget, gBattleMons[gBattleMoveTarget].ability); gBattlescriptCurrInstr = BattleScript_DampStopsExplosion; } } static void atk79_setatkhptozero(void) { - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; - gActiveBattler = gBattleAttacker; + gActiveBattler = gBattleMoveAttacker; gBattleMons[gActiveBattler].hp = 0; - EmitSetMonData(0, REQUEST_HP_BATTLE, 0, 2, &gBattleMons[gActiveBattler].hp); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_HP_BATTLE, 0, 2, &gBattleMons[gActiveBattler].hp); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr++; } @@ -7213,15 +7213,15 @@ static void atk7A_jumpifnexttargetvalid(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - for (gBattleDefender++; ; gBattleDefender++) + for (gBattleMoveTarget++; ; gBattleMoveTarget++) { - if (gBattleDefender == gBattleAttacker) + if (gBattleMoveTarget == gBattleMoveAttacker) continue; - if (!(gAbsentBattlerFlags & gBitTable[gBattleDefender])) + if (!(gAbsentBattlerFlags & gBitTable[gBattleMoveTarget])) break; } - if (gBattleDefender >= gBattlersCount) + if (gBattleMoveTarget >= gBattlersCount) gBattlescriptCurrInstr += 5; else gBattlescriptCurrInstr = jumpPtr; @@ -7237,14 +7237,14 @@ static void atk7B_tryhealhalfhealth(void) const u8* failPtr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); if (gBattlescriptCurrInstr[5] == BS_GET_ATTACKER) - gBattleDefender = gBattleAttacker; + gBattleMoveTarget = gBattleMoveAttacker; - gBattleMoveDamage = gBattleMons[gBattleDefender].maxHP / 2; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].maxHP / 2; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; - if (gBattleMons[gBattleDefender].hp == gBattleMons[gBattleDefender].maxHP) + if (gBattleMons[gBattleMoveTarget].hp == gBattleMons[gBattleMoveTarget].maxHP) gBattlescriptCurrInstr = failPtr; else gBattlescriptCurrInstr += 6; @@ -7262,10 +7262,10 @@ static void atk7C_trymirrormove(void) for (validMovesCount = 0, i = 0; i < gBattlersCount; i++) { - if (i != gBattleAttacker) + if (i != gBattleMoveAttacker) { - move = *(i * 2 + gBattleAttacker * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 0) - | (*(i * 2 + gBattleAttacker * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 1) << 8); + move = *(i * 2 + gBattleMoveAttacker * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 0) + | (*(i * 2 + gBattleMoveAttacker * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 1) << 8); if (move != 0 && move != 0xFFFF) { @@ -7275,14 +7275,14 @@ static void atk7C_trymirrormove(void) } } - move = *(gBattleStruct->mirrorMoves + gBattleAttacker * 2 + 0) - | (*(gBattleStruct->mirrorMoves + gBattleAttacker * 2 + 1) << 8); + move = *(gBattleStruct->mirrorMoves + gBattleMoveAttacker * 2 + 0) + | (*(gBattleStruct->mirrorMoves + gBattleMoveAttacker * 2 + 1) << 8); if (move != 0 && move != 0xFFFF) { gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED); gCurrentMove = move; - gBattleDefender = GetMoveTarget(gCurrentMove, 0); + gBattleMoveTarget = GetMoveTarget(gCurrentMove, 0); gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]; } else if (validMovesCount) @@ -7290,12 +7290,12 @@ static void atk7C_trymirrormove(void) gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED); i = Random() % validMovesCount; gCurrentMove = movesArray[i]; - gBattleDefender = GetMoveTarget(gCurrentMove, 0); + gBattleMoveTarget = GetMoveTarget(gCurrentMove, 0); gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]; } else { - gSpecialStatuses[gBattleAttacker].flag20 = 1; + gSpecialStatuses[gBattleMoveAttacker].flag20 = 1; gBattlescriptCurrInstr++; } } @@ -7318,16 +7318,16 @@ static void atk7D_setrain(void) static void atk7E_setreflect(void) { - if (gSideStatuses[GET_BATTLER_SIDE(gBattleAttacker)] & SIDE_STATUS_REFLECT) + if (gSideStatuses[GET_BATTLER_SIDE(gBattleMoveAttacker)] & SIDE_STATUS_REFLECT) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = 0; } else { - gSideStatuses[GET_BATTLER_SIDE(gBattleAttacker)] |= SIDE_STATUS_REFLECT; - gSideTimers[GET_BATTLER_SIDE(gBattleAttacker)].reflectTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattleAttacker)].reflectBank = gBattleAttacker; + gSideStatuses[GET_BATTLER_SIDE(gBattleMoveAttacker)] |= SIDE_STATUS_REFLECT; + gSideTimers[GET_BATTLER_SIDE(gBattleMoveAttacker)].reflectTimer = 5; + gSideTimers[GET_BATTLER_SIDE(gBattleMoveAttacker)].reflectBank = gBattleMoveAttacker; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) gBattleCommunication[MULTISTRING_CHOOSER] = 2; @@ -7339,20 +7339,20 @@ static void atk7E_setreflect(void) static void atk7F_setseeded(void) { - if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT || gStatuses3[gBattleDefender] & STATUS3_LEECHSEED) + if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT || gStatuses3[gBattleMoveTarget] & STATUS3_LEECHSEED) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = 1; } - else if (gBattleMons[gBattleDefender].type1 == TYPE_GRASS || gBattleMons[gBattleDefender].type2 == TYPE_GRASS) + else if (gBattleMons[gBattleMoveTarget].type1 == TYPE_GRASS || gBattleMons[gBattleMoveTarget].type2 == TYPE_GRASS) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = 2; } else { - gStatuses3[gBattleDefender] |= gBattleAttacker; - gStatuses3[gBattleDefender] |= STATUS3_LEECHSEED; + gStatuses3[gBattleMoveTarget] |= gBattleMoveAttacker; + gStatuses3[gBattleMoveTarget] |= STATUS3_LEECHSEED; gBattleCommunication[MULTISTRING_CHOOSER] = 0; } @@ -7370,8 +7370,8 @@ static void atk80_manipulatedamage(void) gBattleMoveDamage /= 2; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - if ((gBattleMons[gBattleDefender].maxHP / 2) < gBattleMoveDamage) - gBattleMoveDamage = gBattleMons[gBattleDefender].maxHP / 2; + if ((gBattleMons[gBattleMoveTarget].maxHP / 2) < gBattleMoveDamage) + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].maxHP / 2; break; case ATK80_DMG_DOUBLED: gBattleMoveDamage *= 2; @@ -7384,23 +7384,23 @@ static void atk80_manipulatedamage(void) static void atk81_trysetrest(void) { const u8 *failJump = BSScriptReadPtr(gBattlescriptCurrInstr + 1); - gActiveBattler = gBattleDefender = gBattleAttacker; - gBattleMoveDamage = gBattleMons[gBattleDefender].maxHP * (-1); + gActiveBattler = gBattleMoveTarget = gBattleMoveAttacker; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].maxHP * (-1); - if (gBattleMons[gBattleDefender].hp == gBattleMons[gBattleDefender].maxHP) + if (gBattleMons[gBattleMoveTarget].hp == gBattleMons[gBattleMoveTarget].maxHP) { gBattlescriptCurrInstr = failJump; } else { - if (gBattleMons[gBattleDefender].status1 & ((u8)(~STATUS1_SLEEP))) + if (gBattleMons[gBattleMoveTarget].status1 & ((u8)(~STATUS1_SLEEP))) gBattleCommunication[MULTISTRING_CHOOSER] = 1; else gBattleCommunication[MULTISTRING_CHOOSER] = 0; - gBattleMons[gBattleDefender].status1 = 3; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + gBattleMons[gBattleMoveTarget].status1 = 3; + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 5; } } @@ -7409,7 +7409,7 @@ static void atk82_jumpifnotfirstturn(void) { const u8* failJump = BSScriptReadPtr(gBattlescriptCurrInstr + 1); - if (gDisableStructs[gBattleAttacker].isFirstTurn) + if (gDisableStructs[gBattleMoveAttacker].isFirstTurn) gBattlescriptCurrInstr += 5; else gBattlescriptCurrInstr = failJump; @@ -7431,9 +7431,9 @@ bool8 UproarWakeUpCheck(u8 bank) gBattleScripting.battler = i; - if (gBattleDefender == 0xFF) - gBattleDefender = i; - else if (gBattleDefender == i) + if (gBattleMoveTarget == 0xFF) + gBattleMoveTarget = i; + else if (gBattleMoveTarget == i) gBattleCommunication[MULTISTRING_CHOOSER] = 0; else gBattleCommunication[MULTISTRING_CHOOSER] = 1; @@ -7451,17 +7451,17 @@ static void atk84_jumpifcantmakeasleep(void) { const u8 *jumpPtr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); - if (UproarWakeUpCheck(gBattleDefender)) + if (UproarWakeUpCheck(gBattleMoveTarget)) { gBattlescriptCurrInstr = jumpPtr; } - else if (gBattleMons[gBattleDefender].ability == ABILITY_INSOMNIA - || gBattleMons[gBattleDefender].ability == ABILITY_VITAL_SPIRIT) + else if (gBattleMons[gBattleMoveTarget].ability == ABILITY_INSOMNIA + || gBattleMons[gBattleMoveTarget].ability == ABILITY_VITAL_SPIRIT) { - gLastUsedAbility = gBattleMons[gBattleDefender].ability; + gLastUsedAbility = gBattleMons[gBattleMoveTarget].ability; gBattleCommunication[MULTISTRING_CHOOSER] = 2; gBattlescriptCurrInstr = jumpPtr; - RecordAbilityBattle(gBattleDefender, gLastUsedAbility); + RecordAbilityBattle(gBattleMoveTarget, gLastUsedAbility); } else { @@ -7471,16 +7471,16 @@ static void atk84_jumpifcantmakeasleep(void) static void atk85_stockpile(void) { - if (gDisableStructs[gBattleAttacker].stockpileCounter == 3) + if (gDisableStructs[gBattleMoveAttacker].stockpileCounter == 3) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = 1; } else { - gDisableStructs[gBattleAttacker].stockpileCounter++; + gDisableStructs[gBattleMoveAttacker].stockpileCounter++; - PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gBattleAttacker].stockpileCounter) + PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gBattleMoveAttacker].stockpileCounter) gBattleCommunication[MULTISTRING_CHOOSER] = 0; } @@ -7490,7 +7490,7 @@ static void atk85_stockpile(void) static void atk86_stockpiletobasedamage(void) { const u8* jumpPtr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); - if (gDisableStructs[gBattleAttacker].stockpileCounter == 0) + if (gDisableStructs[gBattleMoveAttacker].stockpileCounter == 0) { gBattlescriptCurrInstr = jumpPtr; } @@ -7498,17 +7498,17 @@ static void atk86_stockpiletobasedamage(void) { if (gBattleCommunication[6] != 1) { - gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattleAttacker], &gBattleMons[gBattleDefender], gCurrentMove, - gSideStatuses[GET_BATTLER_SIDE(gBattleDefender)], 0, - 0, gBattleAttacker, gBattleDefender) - * gDisableStructs[gBattleAttacker].stockpileCounter; - gBattleScripting.animTurn = gDisableStructs[gBattleAttacker].stockpileCounter; + gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattleMoveAttacker], &gBattleMons[gBattleMoveTarget], gCurrentMove, + gSideStatuses[GET_BATTLER_SIDE(gBattleMoveTarget)], 0, + 0, gBattleMoveAttacker, gBattleMoveTarget) + * gDisableStructs[gBattleMoveAttacker].stockpileCounter; + gBattleScripting.animTurn = gDisableStructs[gBattleMoveAttacker].stockpileCounter; - if (gProtectStructs[gBattleAttacker].helpingHand) + if (gProtectStructs[gBattleMoveAttacker].helpingHand) gBattleMoveDamage = gBattleMoveDamage * 15 / 10; } - gDisableStructs[gBattleAttacker].stockpileCounter = 0; + gDisableStructs[gBattleMoveAttacker].stockpileCounter = 0; gBattlescriptCurrInstr += 5; } } @@ -7517,30 +7517,30 @@ static void atk87_stockpiletohpheal(void) { const u8* jumpPtr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); - if (gDisableStructs[gBattleAttacker].stockpileCounter == 0) + if (gDisableStructs[gBattleMoveAttacker].stockpileCounter == 0) { gBattlescriptCurrInstr = jumpPtr; gBattleCommunication[MULTISTRING_CHOOSER] = 0; } - else if (gBattleMons[gBattleAttacker].maxHP == gBattleMons[gBattleAttacker].hp) + else if (gBattleMons[gBattleMoveAttacker].maxHP == gBattleMons[gBattleMoveAttacker].hp) { - gDisableStructs[gBattleAttacker].stockpileCounter = 0; + gDisableStructs[gBattleMoveAttacker].stockpileCounter = 0; gBattlescriptCurrInstr = jumpPtr; - gBattleDefender = gBattleAttacker; + gBattleMoveTarget = gBattleMoveAttacker; gBattleCommunication[MULTISTRING_CHOOSER] = 1; } else { - gBattleMoveDamage = gBattleMons[gBattleAttacker].maxHP / (1 << (3 - gDisableStructs[gBattleAttacker].stockpileCounter)); + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].maxHP / (1 << (3 - gDisableStructs[gBattleMoveAttacker].stockpileCounter)); if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; - gBattleScripting.animTurn = gDisableStructs[gBattleAttacker].stockpileCounter; - gDisableStructs[gBattleAttacker].stockpileCounter = 0; + gBattleScripting.animTurn = gDisableStructs[gBattleMoveAttacker].stockpileCounter; + gDisableStructs[gBattleMoveAttacker].stockpileCounter = 0; gBattlescriptCurrInstr += 5; - gBattleDefender = gBattleAttacker; + gBattleMoveTarget = gBattleMoveAttacker; } } @@ -7560,9 +7560,9 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) u32 index; if (flags & MOVE_EFFECT_AFFECTS_USER) - gActiveBattler = gBattleAttacker; + gActiveBattler = gBattleMoveAttacker; else - gActiveBattler = gBattleDefender; + gActiveBattler = gBattleMoveTarget; flags &= ~(MOVE_EFFECT_AFFECTS_USER); @@ -7678,7 +7678,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) if (gBattleMons[gActiveBattler].statStages[statId] == 0) gBattleCommunication[MULTISTRING_CHOOSER] = 2; else - gBattleCommunication[MULTISTRING_CHOOSER] = (gBattleDefender == gActiveBattler); + gBattleCommunication[MULTISTRING_CHOOSER] = (gBattleMoveTarget == gActiveBattler); } } @@ -7705,7 +7705,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) if (gBattleMons[gActiveBattler].statStages[statId] == 0xC) gBattleCommunication[MULTISTRING_CHOOSER] = 2; else - gBattleCommunication[MULTISTRING_CHOOSER] = (gBattleDefender == gActiveBattler); + gBattleCommunication[MULTISTRING_CHOOSER] = (gBattleMoveTarget == gActiveBattler); } gBattleMons[gActiveBattler].statStages[statId] += statValue; @@ -7745,17 +7745,17 @@ static void atk8A_normalisebuffs(void) // haze static void atk8B_setbide(void) { - gBattleMons[gBattleAttacker].status2 |= STATUS2_MULTIPLETURNS; - gLockedMoves[gBattleAttacker] = gCurrentMove; - gTakenDmg[gBattleAttacker] = 0; - gBattleMons[gBattleAttacker].status2 |= (STATUS2_BIDE - 0x100); // 2 turns + gBattleMons[gBattleMoveAttacker].status2 |= STATUS2_MULTIPLETURNS; + gLockedMoves[gBattleMoveAttacker] = gCurrentMove; + gTakenDmg[gBattleMoveAttacker] = 0; + gBattleMons[gBattleMoveAttacker].status2 |= (STATUS2_BIDE - 0x100); // 2 turns gBattlescriptCurrInstr++; } static void atk8C_confuseifrepeatingattackends(void) { - if (!(gBattleMons[gBattleAttacker].status2 & STATUS2_LOCK_CONFUSE)) + if (!(gBattleMons[gBattleMoveAttacker].status2 & STATUS2_LOCK_CONFUSE)) gBattleCommunication[MOVE_EFFECT_BYTE] = (MOVE_EFFECT_THRASH | MOVE_EFFECT_AFFECTS_USER); gBattlescriptCurrInstr++; @@ -7788,19 +7788,19 @@ static void atk8E_initmultihitstring(void) static bool8 TryDoForceSwitchOut(void) { - if (gBattleMons[gBattleAttacker].level >= gBattleMons[gBattleDefender].level) + if (gBattleMons[gBattleMoveAttacker].level >= gBattleMons[gBattleMoveTarget].level) { - *(gBattleStruct->field_58 + gBattleDefender) = gBattlePartyID[gBattleDefender]; + *(gBattleStruct->field_58 + gBattleMoveTarget) = gBattlerPartyIndexes[gBattleMoveTarget]; } else { u16 random = Random() & 0xFF; - if ((u32)((random * (gBattleMons[gBattleAttacker].level + gBattleMons[gBattleDefender].level) >> 8) + 1) <= (gBattleMons[gBattleDefender].level / 4)) + if ((u32)((random * (gBattleMons[gBattleMoveAttacker].level + gBattleMons[gBattleMoveTarget].level) >> 8) + 1) <= (gBattleMons[gBattleMoveTarget].level / 4)) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); return FALSE; } - *(gBattleStruct->field_58 + gBattleDefender) = gBattlePartyID[gBattleDefender]; + *(gBattleStruct->field_58 + gBattleMoveTarget) = gBattlerPartyIndexes[gBattleMoveTarget]; } gBattlescriptCurrInstr = BattleScript_SuccessForceOut; @@ -7827,7 +7827,7 @@ static void atk8F_forcerandomswitch(void) if ((gBattleTypeFlags & BATTLE_TYPE_TRAINER)) { - if (GetBattlerSide(gBattleDefender) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveTarget) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; @@ -7836,7 +7836,7 @@ static void atk8F_forcerandomswitch(void) || (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_x2000000) || (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)) { - if ((gBattleDefender & BIT_FLANK) != 0) + if ((gBattleMoveTarget & BIT_FLANK) != 0) { firstMonId = 3; lastMonId = 6; @@ -7848,13 +7848,13 @@ static void atk8F_forcerandomswitch(void) } monsCount = 3; minNeeded = 1; - bank2PartyId = gBattlePartyID[gBattleDefender]; - bank1PartyId = gBattlePartyID[gBattleDefender ^ BIT_FLANK]; + bank2PartyId = gBattlerPartyIndexes[gBattleMoveTarget]; + bank1PartyId = gBattlerPartyIndexes[gBattleMoveTarget ^ BIT_FLANK]; } else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) || (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_x2000000)) { - if (sub_806D82C(GetBankMultiplayerId(gBattleDefender)) == 1) + if (sub_806D82C(GetBattlerMultiplayerId(gBattleMoveTarget)) == 1) { firstMonId = 3; lastMonId = 6; @@ -7866,12 +7866,12 @@ static void atk8F_forcerandomswitch(void) } monsCount = 3; minNeeded = 1; - bank2PartyId = gBattlePartyID[gBattleDefender]; - bank1PartyId = gBattlePartyID[gBattleDefender ^ BIT_FLANK]; + bank2PartyId = gBattlerPartyIndexes[gBattleMoveTarget]; + bank1PartyId = gBattlerPartyIndexes[gBattleMoveTarget ^ BIT_FLANK]; } else if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) { - if (GetBattlerSide(gBattleDefender) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveTarget) == B_SIDE_PLAYER) { firstMonId = 0; lastMonId = 6; @@ -7880,7 +7880,7 @@ static void atk8F_forcerandomswitch(void) } else { - if ((gBattleDefender & BIT_FLANK) != 0) + if ((gBattleMoveTarget & BIT_FLANK) != 0) { firstMonId = 3; lastMonId = 6; @@ -7893,8 +7893,8 @@ static void atk8F_forcerandomswitch(void) monsCount = 3; minNeeded = 1; } - bank2PartyId = gBattlePartyID[gBattleDefender]; - bank1PartyId = gBattlePartyID[gBattleDefender ^ BIT_FLANK]; + bank2PartyId = gBattlerPartyIndexes[gBattleMoveTarget]; + bank1PartyId = gBattlerPartyIndexes[gBattleMoveTarget ^ BIT_FLANK]; } else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { @@ -7902,8 +7902,8 @@ static void atk8F_forcerandomswitch(void) lastMonId = 6; monsCount = 6; minNeeded = 2; - bank2PartyId = gBattlePartyID[gBattleDefender]; - bank1PartyId = gBattlePartyID[gBattleDefender ^ BIT_FLANK]; + bank2PartyId = gBattlerPartyIndexes[gBattleMoveTarget]; + bank1PartyId = gBattlerPartyIndexes[gBattleMoveTarget ^ BIT_FLANK]; } else { @@ -7911,8 +7911,8 @@ static void atk8F_forcerandomswitch(void) lastMonId = 6; monsCount = 6; minNeeded = 1; - bank2PartyId = gBattlePartyID[gBattleDefender]; // there is only one pokemon out in single battles - bank1PartyId = gBattlePartyID[gBattleDefender]; + bank2PartyId = gBattlerPartyIndexes[gBattleMoveTarget]; // there is only one pokemon out in single battles + bank1PartyId = gBattlerPartyIndexes[gBattleMoveTarget]; } for (i = firstMonId; i < lastMonId; i++) @@ -7944,22 +7944,22 @@ static void atk8F_forcerandomswitch(void) || GetMonData(&party[i], MON_DATA_IS_EGG) == TRUE || GetMonData(&party[i], MON_DATA_HP) == 0); } - *(gBattleStruct->monToSwitchIntoId + gBattleDefender) = i; + *(gBattleStruct->monToSwitchIntoId + gBattleMoveTarget) = i; if (!sub_81B1250()) - sub_803BDA0(gBattleDefender); + sub_803BDA0(gBattleMoveTarget); if ((gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) || (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI) || (gBattleTypeFlags & BATTLE_TYPE_x2000000 && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) || (gBattleTypeFlags & BATTLE_TYPE_x2000000 && gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - sub_81B8E80(gBattleDefender, i, 0); - sub_81B8E80(gBattleDefender ^ BIT_FLANK, i, 1); + sub_81B8E80(gBattleMoveTarget, i, 0); + sub_81B8E80(gBattleMoveTarget ^ BIT_FLANK, i, 1); } if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) - sub_80571DC(gBattleDefender, i); + sub_80571DC(gBattleMoveTarget, i); } } else @@ -7976,7 +7976,7 @@ static void atk90_tryconversiontypechange(void) // randomly changes user's type while (validMoves < 4) { - if (gBattleMons[gBattleAttacker].moves[validMoves] == 0) + if (gBattleMons[gBattleMoveAttacker].moves[validMoves] == 0) break; validMoves++; @@ -7984,17 +7984,17 @@ static void atk90_tryconversiontypechange(void) // randomly changes user's type for (moveChecked = 0; moveChecked < validMoves; moveChecked++) { - moveType = gBattleMoves[gBattleMons[gBattleAttacker].moves[moveChecked]].type; + moveType = gBattleMoves[gBattleMons[gBattleMoveAttacker].moves[moveChecked]].type; if (moveType == TYPE_MYSTERY) { - if (gBattleMons[gBattleAttacker].type1 == TYPE_GHOST || gBattleMons[gBattleAttacker].type2 == TYPE_GHOST) + if (gBattleMons[gBattleMoveAttacker].type1 == TYPE_GHOST || gBattleMons[gBattleMoveAttacker].type2 == TYPE_GHOST) moveType = TYPE_GHOST; else moveType = TYPE_NORMAL; } - if (moveType != gBattleMons[gBattleAttacker].type1 - && moveType != gBattleMons[gBattleAttacker].type2) + if (moveType != gBattleMons[gBattleMoveAttacker].type1 + && moveType != gBattleMons[gBattleMoveAttacker].type2) { break; } @@ -8011,20 +8011,20 @@ static void atk90_tryconversiontypechange(void) // randomly changes user's type while ((moveChecked = Random() & 3) >= validMoves); - moveType = gBattleMoves[gBattleMons[gBattleAttacker].moves[moveChecked]].type; + moveType = gBattleMoves[gBattleMons[gBattleMoveAttacker].moves[moveChecked]].type; if (moveType == TYPE_MYSTERY) { - if (gBattleMons[gBattleAttacker].type1 == TYPE_GHOST || gBattleMons[gBattleAttacker].type2 == TYPE_GHOST) + if (gBattleMons[gBattleMoveAttacker].type1 == TYPE_GHOST || gBattleMons[gBattleMoveAttacker].type2 == TYPE_GHOST) moveType = TYPE_GHOST; else moveType = TYPE_NORMAL; } } - while (moveType == gBattleMons[gBattleAttacker].type1 || moveType == gBattleMons[gBattleAttacker].type2); + while (moveType == gBattleMons[gBattleMoveAttacker].type1 || moveType == gBattleMons[gBattleMoveAttacker].type2); - gBattleMons[gBattleAttacker].type1 = moveType; - gBattleMons[gBattleAttacker].type2 = moveType; + gBattleMons[gBattleMoveAttacker].type1 = moveType; + gBattleMons[gBattleMoveAttacker].type2 = moveType; PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType) @@ -8052,16 +8052,16 @@ static void atk91_givepaydaymoney(void) static void atk92_setlightscreen(void) { - if (gSideStatuses[GET_BATTLER_SIDE(gBattleAttacker)] & SIDE_STATUS_LIGHTSCREEN) + if (gSideStatuses[GET_BATTLER_SIDE(gBattleMoveAttacker)] & SIDE_STATUS_LIGHTSCREEN) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = 0; } else { - gSideStatuses[GET_BATTLER_SIDE(gBattleAttacker)] |= SIDE_STATUS_LIGHTSCREEN; - gSideTimers[GET_BATTLER_SIDE(gBattleAttacker)].lightscreenTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattleAttacker)].lightscreenBank = gBattleAttacker; + gSideStatuses[GET_BATTLER_SIDE(gBattleMoveAttacker)] |= SIDE_STATUS_LIGHTSCREEN; + gSideTimers[GET_BATTLER_SIDE(gBattleMoveAttacker)].lightscreenTimer = 5; + gSideTimers[GET_BATTLER_SIDE(gBattleMoveAttacker)].lightscreenBank = gBattleMoveAttacker; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) gBattleCommunication[MULTISTRING_CHOOSER] = 4; @@ -8076,72 +8076,72 @@ static void atk93_tryKO(void) { u8 holdEffect, param; - if (gBattleMons[gBattleDefender].item == ITEM_ENIGMA_BERRY) + if (gBattleMons[gBattleMoveTarget].item == ITEM_ENIGMA_BERRY) { - holdEffect = gEnigmaBerries[gBattleDefender].holdEffect; - param = gEnigmaBerries[gBattleDefender].holdEffectParam; + holdEffect = gEnigmaBerries[gBattleMoveTarget].holdEffect; + param = gEnigmaBerries[gBattleMoveTarget].holdEffectParam; } else { - holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattleDefender].item); - param = ItemId_GetHoldEffectParam(gBattleMons[gBattleDefender].item); + holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattleMoveTarget].item); + param = ItemId_GetHoldEffectParam(gBattleMons[gBattleMoveTarget].item); } - gStringBank = gBattleDefender; + gStringBank = gBattleMoveTarget; if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param) { - RecordItemEffectBattle(gBattleDefender, HOLD_EFFECT_FOCUS_BAND); - gSpecialStatuses[gBattleDefender].focusBanded = 1; + RecordItemEffectBattle(gBattleMoveTarget, HOLD_EFFECT_FOCUS_BAND); + gSpecialStatuses[gBattleMoveTarget].focusBanded = 1; } - if (gBattleMons[gBattleDefender].ability == ABILITY_STURDY) + if (gBattleMons[gBattleMoveTarget].ability == ABILITY_STURDY) { gMoveResultFlags |= MOVE_RESULT_MISSED; gLastUsedAbility = ABILITY_STURDY; gBattlescriptCurrInstr = BattleScript_SturdyPreventsOHKO; - RecordAbilityBattle(gBattleDefender, ABILITY_STURDY); + RecordAbilityBattle(gBattleMoveTarget, ABILITY_STURDY); } else { u16 chance; - if (!(gStatuses3[gBattleDefender] & STATUS3_ALWAYS_HITS)) + if (!(gStatuses3[gBattleMoveTarget] & STATUS3_ALWAYS_HITS)) { - chance = gBattleMoves[gCurrentMove].accuracy + (gBattleMons[gBattleAttacker].level - gBattleMons[gBattleDefender].level); - if (Random() % 100 + 1 < chance && gBattleMons[gBattleAttacker].level >= gBattleMons[gBattleDefender].level) + chance = gBattleMoves[gCurrentMove].accuracy + (gBattleMons[gBattleMoveAttacker].level - gBattleMons[gBattleMoveTarget].level); + if (Random() % 100 + 1 < chance && gBattleMons[gBattleMoveAttacker].level >= gBattleMons[gBattleMoveTarget].level) chance = TRUE; else chance = FALSE; } - else if (gDisableStructs[gBattleDefender].bankWithSureHit == gBattleAttacker - && gBattleMons[gBattleAttacker].level >= gBattleMons[gBattleDefender].level) + else if (gDisableStructs[gBattleMoveTarget].bankWithSureHit == gBattleMoveAttacker + && gBattleMons[gBattleMoveAttacker].level >= gBattleMons[gBattleMoveTarget].level) { chance = TRUE; } else { - chance = gBattleMoves[gCurrentMove].accuracy + (gBattleMons[gBattleAttacker].level - gBattleMons[gBattleDefender].level); - if (Random() % 100 + 1 < chance && gBattleMons[gBattleAttacker].level >= gBattleMons[gBattleDefender].level) + chance = gBattleMoves[gCurrentMove].accuracy + (gBattleMons[gBattleMoveAttacker].level - gBattleMons[gBattleMoveTarget].level); + if (Random() % 100 + 1 < chance && gBattleMons[gBattleMoveAttacker].level >= gBattleMons[gBattleMoveTarget].level) chance = TRUE; else chance = FALSE; } if (chance) { - if (gProtectStructs[gBattleDefender].endured) + if (gProtectStructs[gBattleMoveTarget].endured) { - gBattleMoveDamage = gBattleMons[gBattleDefender].hp - 1; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].hp - 1; gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED; } - else if (gSpecialStatuses[gBattleDefender].focusBanded) + else if (gSpecialStatuses[gBattleMoveTarget].focusBanded) { - gBattleMoveDamage = gBattleMons[gBattleDefender].hp - 1; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].hp - 1; gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON; - gLastUsedItem = gBattleMons[gBattleDefender].item; + gLastUsedItem = gBattleMons[gBattleMoveTarget].item; } else { - gBattleMoveDamage = gBattleMons[gBattleDefender].hp; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].hp; gMoveResultFlags |= MOVE_RESULT_ONE_HIT_KO; } gBattlescriptCurrInstr += 5; @@ -8149,7 +8149,7 @@ static void atk93_tryKO(void) else { gMoveResultFlags |= MOVE_RESULT_MISSED; - if (gBattleMons[gBattleAttacker].level >= gBattleMons[gBattleDefender].level) + if (gBattleMons[gBattleMoveAttacker].level >= gBattleMons[gBattleMoveTarget].level) gBattleCommunication[MULTISTRING_CHOOSER] = 0; else gBattleCommunication[MULTISTRING_CHOOSER] = 1; @@ -8160,7 +8160,7 @@ static void atk93_tryKO(void) static void atk94_damagetohalftargethp(void) // super fang { - gBattleMoveDamage = gBattleMons[gBattleDefender].hp / 2; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].hp / 2; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -8189,17 +8189,17 @@ static void atk96_weatherdamage(void) { if (gBattleWeather & WEATHER_SANDSTORM_ANY) { - if (gBattleMons[gBattleAttacker].type1 != TYPE_ROCK - && gBattleMons[gBattleAttacker].type1 != TYPE_STEEL - && gBattleMons[gBattleAttacker].type1 != TYPE_GROUND - && gBattleMons[gBattleAttacker].type2 != TYPE_ROCK - && gBattleMons[gBattleAttacker].type2 != TYPE_STEEL - && gBattleMons[gBattleAttacker].type2 != TYPE_GROUND - && gBattleMons[gBattleAttacker].ability != ABILITY_SAND_VEIL - && !(gStatuses3[gBattleAttacker] & STATUS3_UNDERGROUND) - && !(gStatuses3[gBattleAttacker] & STATUS3_UNDERWATER)) + if (gBattleMons[gBattleMoveAttacker].type1 != TYPE_ROCK + && gBattleMons[gBattleMoveAttacker].type1 != TYPE_STEEL + && gBattleMons[gBattleMoveAttacker].type1 != TYPE_GROUND + && gBattleMons[gBattleMoveAttacker].type2 != TYPE_ROCK + && gBattleMons[gBattleMoveAttacker].type2 != TYPE_STEEL + && gBattleMons[gBattleMoveAttacker].type2 != TYPE_GROUND + && gBattleMons[gBattleMoveAttacker].ability != ABILITY_SAND_VEIL + && !(gStatuses3[gBattleMoveAttacker] & STATUS3_UNDERGROUND) + && !(gStatuses3[gBattleMoveAttacker] & STATUS3_UNDERWATER)) { - gBattleMoveDamage = gBattleMons[gBattleAttacker].maxHP / 16; + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].maxHP / 16; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; } @@ -8210,12 +8210,12 @@ static void atk96_weatherdamage(void) } if (gBattleWeather & WEATHER_HAIL) { - if (gBattleMons[gBattleAttacker].type1 != TYPE_ICE - && gBattleMons[gBattleAttacker].type2 != TYPE_ICE - && !(gStatuses3[gBattleAttacker] & STATUS3_UNDERGROUND) - && !(gStatuses3[gBattleAttacker] & STATUS3_UNDERWATER)) + if (gBattleMons[gBattleMoveAttacker].type1 != TYPE_ICE + && gBattleMons[gBattleMoveAttacker].type2 != TYPE_ICE + && !(gStatuses3[gBattleMoveAttacker] & STATUS3_UNDERGROUND) + && !(gStatuses3[gBattleMoveAttacker] & STATUS3_UNDERWATER)) { - gBattleMoveDamage = gBattleMons[gBattleAttacker].maxHP / 16; + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].maxHP / 16; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; } @@ -8230,7 +8230,7 @@ static void atk96_weatherdamage(void) gBattleMoveDamage = 0; } - if (gAbsentBattlerFlags & gBitTable[gBattleAttacker]) + if (gAbsentBattlerFlags & gBitTable[gBattleMoveAttacker]) gBattleMoveDamage = 0; gBattlescriptCurrInstr++; @@ -8242,15 +8242,15 @@ static void atk97_tryinfatuating(void) u16 speciesAttacker, speciesTarget; u32 personalityAttacker, personalityTarget; - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) - monAttacker = &gPlayerParty[gBattlePartyID[gBattleAttacker]]; + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) + monAttacker = &gPlayerParty[gBattlerPartyIndexes[gBattleMoveAttacker]]; else - monAttacker = &gEnemyParty[gBattlePartyID[gBattleAttacker]]; + monAttacker = &gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker]]; - if (GetBattlerSide(gBattleDefender) == B_SIDE_PLAYER) - monTarget = &gPlayerParty[gBattlePartyID[gBattleDefender]]; + if (GetBattlerSide(gBattleMoveTarget) == B_SIDE_PLAYER) + monTarget = &gPlayerParty[gBattlerPartyIndexes[gBattleMoveTarget]]; else - monTarget = &gEnemyParty[gBattlePartyID[gBattleDefender]]; + monTarget = &gEnemyParty[gBattlerPartyIndexes[gBattleMoveTarget]]; speciesAttacker = GetMonData(monAttacker, MON_DATA_SPECIES); personalityAttacker = GetMonData(monAttacker, MON_DATA_PERSONALITY); @@ -8258,16 +8258,16 @@ static void atk97_tryinfatuating(void) speciesTarget = GetMonData(monTarget, MON_DATA_SPECIES); personalityTarget = GetMonData(monTarget, MON_DATA_PERSONALITY); - if (gBattleMons[gBattleDefender].ability == ABILITY_OBLIVIOUS) + if (gBattleMons[gBattleMoveTarget].ability == ABILITY_OBLIVIOUS) { gBattlescriptCurrInstr = BattleScript_ObliviousPreventsAttraction; gLastUsedAbility = ABILITY_OBLIVIOUS; - RecordAbilityBattle(gBattleDefender, ABILITY_OBLIVIOUS); + RecordAbilityBattle(gBattleMoveTarget, ABILITY_OBLIVIOUS); } else { if (GetGenderFromSpeciesAndPersonality(speciesAttacker, personalityAttacker) == GetGenderFromSpeciesAndPersonality(speciesTarget, personalityTarget) - || gBattleMons[gBattleDefender].status2 & STATUS2_INFATUATION + || gBattleMons[gBattleMoveTarget].status2 & STATUS2_INFATUATION || GetGenderFromSpeciesAndPersonality(speciesAttacker, personalityAttacker) == MON_GENDERLESS || GetGenderFromSpeciesAndPersonality(speciesTarget, personalityTarget) == MON_GENDERLESS) { @@ -8275,7 +8275,7 @@ static void atk97_tryinfatuating(void) } else { - gBattleMons[gBattleDefender].status2 |= STATUS2_INFATUATED_WITH(gBattleAttacker); + gBattleMons[gBattleMoveTarget].status2 |= STATUS2_INFATUATED_WITH(gBattleMoveAttacker); gBattlescriptCurrInstr += 5; } } @@ -8283,31 +8283,31 @@ static void atk97_tryinfatuating(void) static void atk98_updatestatusicon(void) { - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; if (gBattlescriptCurrInstr[1] != BS_ATTACKER_WITH_PARTNER) { gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); - EmitStatusIconUpdate(0, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitStatusIconUpdate(0, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } else { - gActiveBattler = gBattleAttacker; + gActiveBattler = gBattleMoveAttacker; if (!(gAbsentBattlerFlags & gBitTable[gActiveBattler])) { - EmitStatusIconUpdate(0, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitStatusIconUpdate(0, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2); + MarkBattlerForControllerExec(gActiveBattler); } if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { - gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattleAttacker) ^ BIT_FLANK); + gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveAttacker) ^ BIT_FLANK); if (!(gAbsentBattlerFlags & gBitTable[gActiveBattler])) { - EmitStatusIconUpdate(0, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitStatusIconUpdate(0, gBattleMons[gActiveBattler].status1, gBattleMons[gActiveBattler].status2); + MarkBattlerForControllerExec(gActiveBattler); } } gBattlescriptCurrInstr += 2; @@ -8316,16 +8316,16 @@ static void atk98_updatestatusicon(void) static void atk99_setmist(void) { - if (gSideTimers[GET_BATTLER_SIDE(gBattleAttacker)].mistTimer) + if (gSideTimers[GET_BATTLER_SIDE(gBattleMoveAttacker)].mistTimer) { gMoveResultFlags |= MOVE_RESULT_FAILED; gBattleCommunication[MULTISTRING_CHOOSER] = 1; } else { - gSideTimers[GET_BATTLER_SIDE(gBattleAttacker)].mistTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattleAttacker)].mistBank = gBattleAttacker; - gSideStatuses[GET_BATTLER_SIDE(gBattleAttacker)] |= SIDE_STATUS_MIST; + gSideTimers[GET_BATTLER_SIDE(gBattleMoveAttacker)].mistTimer = 5; + gSideTimers[GET_BATTLER_SIDE(gBattleMoveAttacker)].mistBank = gBattleMoveAttacker; + gSideStatuses[GET_BATTLER_SIDE(gBattleMoveAttacker)] |= SIDE_STATUS_MIST; gBattleCommunication[MULTISTRING_CHOOSER] = 0; } gBattlescriptCurrInstr++; @@ -8333,14 +8333,14 @@ static void atk99_setmist(void) static void atk9A_setfocusenergy(void) { - if (gBattleMons[gBattleAttacker].status2 & STATUS2_FOCUS_ENERGY) + if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_FOCUS_ENERGY) { gMoveResultFlags |= MOVE_RESULT_FAILED; gBattleCommunication[MULTISTRING_CHOOSER] = 1; } else { - gBattleMons[gBattleAttacker].status2 |= STATUS2_FOCUS_ENERGY; + gBattleMons[gBattleMoveAttacker].status2 |= STATUS2_FOCUS_ENERGY; gBattleCommunication[MULTISTRING_CHOOSER] = 0; } gBattlescriptCurrInstr++; @@ -8350,8 +8350,8 @@ static void atk9B_transformdataexecution(void) { gChosenMove = 0xFFFF; gBattlescriptCurrInstr++; - if (gBattleMons[gBattleDefender].status2 & STATUS2_TRANSFORMED - || gStatuses3[gBattleDefender] & STATUS3_SEMI_INVULNERABLE) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_TRANSFORMED + || gStatuses3[gBattleMoveTarget] & STATUS3_SEMI_INVULNERABLE) { gMoveResultFlags |= MOVE_RESULT_FAILED; gBattleCommunication[MULTISTRING_CHOOSER] = 1; @@ -8361,55 +8361,55 @@ static void atk9B_transformdataexecution(void) s32 i; u8 *battleMonAttacker, *battleMonTarget; - gBattleMons[gBattleAttacker].status2 |= STATUS2_TRANSFORMED; - gDisableStructs[gBattleAttacker].disabledMove = 0; - gDisableStructs[gBattleAttacker].disableTimer1 = 0; - gDisableStructs[gBattleAttacker].transformedMonPersonality = gBattleMons[gBattleDefender].personality; - gDisableStructs[gBattleAttacker].unk18_b = 0; + gBattleMons[gBattleMoveAttacker].status2 |= STATUS2_TRANSFORMED; + gDisableStructs[gBattleMoveAttacker].disabledMove = 0; + gDisableStructs[gBattleMoveAttacker].disableTimer1 = 0; + gDisableStructs[gBattleMoveAttacker].transformedMonPersonality = gBattleMons[gBattleMoveTarget].personality; + gDisableStructs[gBattleMoveAttacker].unk18_b = 0; - PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattleDefender].species) + PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattleMoveTarget].species) - battleMonAttacker = (u8*)(&gBattleMons[gBattleAttacker]); - battleMonTarget = (u8*)(&gBattleMons[gBattleDefender]); + battleMonAttacker = (u8*)(&gBattleMons[gBattleMoveAttacker]); + battleMonTarget = (u8*)(&gBattleMons[gBattleMoveTarget]); for (i = 0; i < offsetof(struct BattlePokemon, pp); i++) battleMonAttacker[i] = battleMonTarget[i]; for (i = 0; i < 4; i++) { - if (gBattleMoves[gBattleMons[gBattleAttacker].moves[i]].pp < 5) - gBattleMons[gBattleAttacker].pp[i] = gBattleMoves[gBattleMons[gBattleAttacker].moves[i]].pp; + if (gBattleMoves[gBattleMons[gBattleMoveAttacker].moves[i]].pp < 5) + gBattleMons[gBattleMoveAttacker].pp[i] = gBattleMoves[gBattleMons[gBattleMoveAttacker].moves[i]].pp; else - gBattleMons[gBattleAttacker].pp[i] = 5; + gBattleMons[gBattleMoveAttacker].pp[i] = 5; } - gActiveBattler = gBattleAttacker; - EmitResetActionMoveSelection(0, RESET_MOVE_SELECTION); - MarkBufferBankForExecution(gActiveBattler); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitResetActionMoveSelection(0, RESET_MOVE_SELECTION); + MarkBattlerForControllerExec(gActiveBattler); gBattleCommunication[MULTISTRING_CHOOSER] = 0; } } static void atk9C_setsubstitute(void) { - u32 hp = gBattleMons[gBattleAttacker].maxHP / 4; - if (gBattleMons[gBattleAttacker].maxHP / 4 == 0) + u32 hp = gBattleMons[gBattleMoveAttacker].maxHP / 4; + if (gBattleMons[gBattleMoveAttacker].maxHP / 4 == 0) hp = 1; - if (gBattleMons[gBattleAttacker].hp <= hp) + if (gBattleMons[gBattleMoveAttacker].hp <= hp) { gBattleMoveDamage = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 1; } else { - gBattleMoveDamage = gBattleMons[gBattleAttacker].maxHP / 4; // one bit value will only work for pokemon which max hp can go to 1020(which is more than possible in games) + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].maxHP / 4; // one bit value will only work for pokemon which max hp can go to 1020(which is more than possible in games) if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - gBattleMons[gBattleAttacker].status2 |= STATUS2_SUBSTITUTE; - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_WRAPPED); - gDisableStructs[gBattleAttacker].substituteHP = gBattleMoveDamage; + gBattleMons[gBattleMoveAttacker].status2 |= STATUS2_SUBSTITUTE; + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_WRAPPED); + gDisableStructs[gBattleMoveAttacker].substituteHP = gBattleMoveDamage; gBattleCommunication[MULTISTRING_CHOOSER] = 0; gHitMarker |= HITMARKER_IGNORE_SUBSTITUTE; } @@ -8430,10 +8430,10 @@ static void atk9D_mimicattackcopy(void) { gChosenMove = 0xFFFF; - if (IsMoveUncopyableByMimic(gLastMoves[gBattleDefender]) - || gBattleMons[gBattleAttacker].status2 & STATUS2_TRANSFORMED - || gLastMoves[gBattleDefender] == 0 - || gLastMoves[gBattleDefender] == 0xFFFF) + if (IsMoveUncopyableByMimic(gLastMoves[gBattleMoveTarget]) + || gBattleMons[gBattleMoveAttacker].status2 & STATUS2_TRANSFORMED + || gLastMoves[gBattleMoveTarget] == 0 + || gLastMoves[gBattleMoveTarget] == 0xFFFF) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } @@ -8443,22 +8443,22 @@ static void atk9D_mimicattackcopy(void) for (i = 0; i < 4; i++) { - if (gBattleMons[gBattleAttacker].moves[i] == gLastMoves[gBattleDefender]) + if (gBattleMons[gBattleMoveAttacker].moves[i] == gLastMoves[gBattleMoveTarget]) break; } if (i == 4) { - gBattleMons[gBattleAttacker].moves[gCurrMovePos] = gLastMoves[gBattleDefender]; - if (gBattleMoves[gLastMoves[gBattleDefender]].pp < 5) - gBattleMons[gBattleAttacker].pp[gCurrMovePos] = gBattleMoves[gLastMoves[gBattleDefender]].pp; + gBattleMons[gBattleMoveAttacker].moves[gCurrMovePos] = gLastMoves[gBattleMoveTarget]; + if (gBattleMoves[gLastMoves[gBattleMoveTarget]].pp < 5) + gBattleMons[gBattleMoveAttacker].pp[gCurrMovePos] = gBattleMoves[gLastMoves[gBattleMoveTarget]].pp; else - gBattleMons[gBattleAttacker].pp[gCurrMovePos] = 5; + gBattleMons[gBattleMoveAttacker].pp[gCurrMovePos] = 5; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[gBattleDefender]) + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[gBattleMoveTarget]) - gDisableStructs[gBattleAttacker].unk18_b |= gBitTable[gCurrMovePos]; + gDisableStructs[gBattleMoveAttacker].unk18_b |= gBitTable[gCurrMovePos]; gBattlescriptCurrInstr += 5; } else @@ -8494,7 +8494,7 @@ static void atk9E_metronome(void) { gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED); gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]; - gBattleDefender = GetMoveTarget(gCurrentMove, 0); + gBattleMoveTarget = GetMoveTarget(gCurrentMove, 0); return; } } @@ -8502,7 +8502,7 @@ static void atk9E_metronome(void) static void atk9F_dmgtolevel(void) { - gBattleMoveDamage = gBattleMons[gBattleAttacker].level; + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].level; gBattlescriptCurrInstr++; } @@ -8513,54 +8513,54 @@ static void atkA0_psywavedamageeffect(void) while ((randDamage = (Random() & 0xF)) > 10); randDamage *= 10; - gBattleMoveDamage = gBattleMons[gBattleAttacker].level * (randDamage + 50) / 100; + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].level * (randDamage + 50) / 100; gBattlescriptCurrInstr++; } static void atkA1_counterdamagecalculator(void) { - u8 sideAttacker = GetBattlerSide(gBattleAttacker); - u8 sideTarget = GetBattlerSide(gProtectStructs[gBattleAttacker].physicalBank); + u8 sideAttacker = GetBattlerSide(gBattleMoveAttacker); + u8 sideTarget = GetBattlerSide(gProtectStructs[gBattleMoveAttacker].physicalBank); - if (gProtectStructs[gBattleAttacker].physicalDmg + if (gProtectStructs[gBattleMoveAttacker].physicalDmg && sideAttacker != sideTarget - && gBattleMons[gProtectStructs[gBattleAttacker].physicalBank].hp) + && gBattleMons[gProtectStructs[gBattleMoveAttacker].physicalBank].hp) { - gBattleMoveDamage = gProtectStructs[gBattleAttacker].physicalDmg * 2; + gBattleMoveDamage = gProtectStructs[gBattleMoveAttacker].physicalDmg * 2; if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp) - gBattleDefender = gSideTimers[sideTarget].followmeTarget; + gBattleMoveTarget = gSideTimers[sideTarget].followmeTarget; else - gBattleDefender = gProtectStructs[gBattleAttacker].physicalBank; + gBattleMoveTarget = gProtectStructs[gBattleMoveAttacker].physicalBank; gBattlescriptCurrInstr += 5; } else { - gSpecialStatuses[gBattleAttacker].flag20 = 1; + gSpecialStatuses[gBattleMoveAttacker].flag20 = 1; gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } } static void atkA2_mirrorcoatdamagecalculator(void) // a copy of atkA1 with the physical -> special field changes { - u8 sideAttacker = GetBattlerSide(gBattleAttacker); - u8 sideTarget = GetBattlerSide(gProtectStructs[gBattleAttacker].specialBank); + u8 sideAttacker = GetBattlerSide(gBattleMoveAttacker); + u8 sideTarget = GetBattlerSide(gProtectStructs[gBattleMoveAttacker].specialBank); - if (gProtectStructs[gBattleAttacker].specialDmg && sideAttacker != sideTarget && gBattleMons[gProtectStructs[gBattleAttacker].specialBank].hp) + if (gProtectStructs[gBattleMoveAttacker].specialDmg && sideAttacker != sideTarget && gBattleMons[gProtectStructs[gBattleMoveAttacker].specialBank].hp) { - gBattleMoveDamage = gProtectStructs[gBattleAttacker].specialDmg * 2; + gBattleMoveDamage = gProtectStructs[gBattleMoveAttacker].specialDmg * 2; if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp) - gBattleDefender = gSideTimers[sideTarget].followmeTarget; + gBattleMoveTarget = gSideTimers[sideTarget].followmeTarget; else - gBattleDefender = gProtectStructs[gBattleAttacker].specialBank; + gBattleMoveTarget = gProtectStructs[gBattleMoveAttacker].specialBank; gBattlescriptCurrInstr += 5; } else { - gSpecialStatuses[gBattleAttacker].flag20 = 1; + gSpecialStatuses[gBattleMoveAttacker].flag20 = 1; gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } } @@ -8571,17 +8571,17 @@ static void atkA3_disablelastusedattack(void) for (i = 0; i < 4; i++) { - if (gBattleMons[gBattleDefender].moves[i] == gLastMoves[gBattleDefender]) + if (gBattleMons[gBattleMoveTarget].moves[i] == gLastMoves[gBattleMoveTarget]) break; } - if (gDisableStructs[gBattleDefender].disabledMove == 0 - && i != 4 && gBattleMons[gBattleDefender].pp[i] != 0) + if (gDisableStructs[gBattleMoveTarget].disabledMove == 0 + && i != 4 && gBattleMons[gBattleMoveTarget].pp[i] != 0) { - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattleDefender].moves[i]) + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattleMoveTarget].moves[i]) - gDisableStructs[gBattleDefender].disabledMove = gBattleMons[gBattleDefender].moves[i]; - gDisableStructs[gBattleDefender].disableTimer1 = (Random() & 3) + 2; - gDisableStructs[gBattleDefender].disableTimer2 = gDisableStructs[gBattleDefender].disableTimer1; // used to save the random amount of turns? + gDisableStructs[gBattleMoveTarget].disabledMove = gBattleMons[gBattleMoveTarget].moves[i]; + gDisableStructs[gBattleMoveTarget].disableTimer1 = (Random() & 3) + 2; + gDisableStructs[gBattleMoveTarget].disableTimer2 = gDisableStructs[gBattleMoveTarget].disableTimer1; // used to save the random amount of turns? gBattlescriptCurrInstr += 5; } else @@ -8596,24 +8596,24 @@ static void atkA4_trysetencore(void) for (i = 0; i < 4; i++) { - if (gBattleMons[gBattleDefender].moves[i] == gLastMoves[gBattleDefender]) + if (gBattleMons[gBattleMoveTarget].moves[i] == gLastMoves[gBattleMoveTarget]) break; } - if (gLastMoves[gBattleDefender] == MOVE_STRUGGLE - || gLastMoves[gBattleDefender] == MOVE_ENCORE - || gLastMoves[gBattleDefender] == MOVE_MIRROR_MOVE) + if (gLastMoves[gBattleMoveTarget] == MOVE_STRUGGLE + || gLastMoves[gBattleMoveTarget] == MOVE_ENCORE + || gLastMoves[gBattleMoveTarget] == MOVE_MIRROR_MOVE) { i = 4; } - if (gDisableStructs[gBattleDefender].encoredMove == 0 - && i != 4 && gBattleMons[gBattleDefender].pp[i] != 0) + if (gDisableStructs[gBattleMoveTarget].encoredMove == 0 + && i != 4 && gBattleMons[gBattleMoveTarget].pp[i] != 0) { - gDisableStructs[gBattleDefender].encoredMove = gBattleMons[gBattleDefender].moves[i]; - gDisableStructs[gBattleDefender].encoredMovePos = i; - gDisableStructs[gBattleDefender].encoreTimer1 = (Random() & 3) + 3; - gDisableStructs[gBattleDefender].encoreTimer2 = gDisableStructs[gBattleDefender].encoreTimer1; + gDisableStructs[gBattleMoveTarget].encoredMove = gBattleMons[gBattleMoveTarget].moves[i]; + gDisableStructs[gBattleMoveTarget].encoredMovePos = i; + gDisableStructs[gBattleMoveTarget].encoreTimer1 = (Random() & 3) + 3; + gDisableStructs[gBattleMoveTarget].encoreTimer2 = gDisableStructs[gBattleMoveTarget].encoreTimer1; gBattlescriptCurrInstr += 5; } else @@ -8624,10 +8624,10 @@ static void atkA4_trysetencore(void) static void atkA5_painsplitdmgcalc(void) { - if (!(gBattleMons[gBattleDefender].status2 & STATUS2_SUBSTITUTE)) + if (!(gBattleMons[gBattleMoveTarget].status2 & STATUS2_SUBSTITUTE)) { - s32 hpDiff = (gBattleMons[gBattleAttacker].hp + gBattleMons[gBattleDefender].hp) / 2; - s32 painSplitHp = gBattleMoveDamage = gBattleMons[gBattleDefender].hp - hpDiff; + s32 hpDiff = (gBattleMons[gBattleMoveAttacker].hp + gBattleMons[gBattleMoveTarget].hp) / 2; + s32 painSplitHp = gBattleMoveDamage = gBattleMons[gBattleMoveTarget].hp - hpDiff; u8* storeLoc = (void*)(&gBattleScripting.painSplitHp); storeLoc[0] = (painSplitHp); @@ -8635,8 +8635,8 @@ static void atkA5_painsplitdmgcalc(void) storeLoc[2] = (painSplitHp & 0x00FF0000) >> 16; storeLoc[3] = (painSplitHp & 0xFF000000) >> 24; - gBattleMoveDamage = gBattleMons[gBattleAttacker].hp - hpDiff; - gSpecialStatuses[gBattleDefender].moveturnLostHP = 0xFFFF; + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].hp - hpDiff; + gSpecialStatuses[gBattleMoveTarget].moveturnLostHP = 0xFFFF; gBattlescriptCurrInstr += 5; } @@ -8648,13 +8648,13 @@ static void atkA5_painsplitdmgcalc(void) static void atkA6_settypetorandomresistance(void) // conversion 2 { - if (gLastLandedMoves[gBattleAttacker] == 0 - || gLastLandedMoves[gBattleAttacker] == 0xFFFF) + if (gLastLandedMoves[gBattleMoveAttacker] == 0 + || gLastLandedMoves[gBattleMoveAttacker] == 0xFFFF) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } - else if (IsTwoTurnsMove(gLastLandedMoves[gBattleAttacker]) - && gBattleMons[gLastHitBy[gBattleAttacker]].status2 & STATUS2_MULTIPLETURNS) + else if (IsTwoTurnsMove(gLastLandedMoves[gBattleMoveAttacker]) + && gBattleMons[gLastHitBy[gBattleMoveAttacker]].status2 & STATUS2_MULTIPLETURNS) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } @@ -8668,13 +8668,13 @@ static void atkA6_settypetorandomresistance(void) // conversion 2 i *= 3; - if (TYPE_EFFECT_ATK_TYPE(i) == gLastHitByType[gBattleAttacker] + if (TYPE_EFFECT_ATK_TYPE(i) == gLastHitByType[gBattleMoveAttacker] && TYPE_EFFECT_MULTIPLIER(i) <= TYPE_MUL_NOT_EFFECTIVE - && gBattleMons[gBattleAttacker].type1 != TYPE_EFFECT_DEF_TYPE(i) - && gBattleMons[gBattleAttacker].type2 != TYPE_EFFECT_DEF_TYPE(i)) + && gBattleMons[gBattleMoveAttacker].type1 != TYPE_EFFECT_DEF_TYPE(i) + && gBattleMons[gBattleMoveAttacker].type2 != TYPE_EFFECT_DEF_TYPE(i)) { - gBattleMons[gBattleAttacker].type1 = TYPE_EFFECT_DEF_TYPE(i); - gBattleMons[gBattleAttacker].type2 = TYPE_EFFECT_DEF_TYPE(i); + gBattleMons[gBattleMoveAttacker].type1 = TYPE_EFFECT_DEF_TYPE(i); + gBattleMons[gBattleMoveAttacker].type2 = TYPE_EFFECT_DEF_TYPE(i); PREPARE_TYPE_BUFFER(gBattleTextBuff1, TYPE_EFFECT_DEF_TYPE(i)) @@ -8691,13 +8691,13 @@ static void atkA6_settypetorandomresistance(void) // conversion 2 case TYPE_FORESIGHT: break; default: - if (TYPE_EFFECT_ATK_TYPE(j) == gLastHitByType[gBattleAttacker] + if (TYPE_EFFECT_ATK_TYPE(j) == gLastHitByType[gBattleMoveAttacker] && TYPE_EFFECT_MULTIPLIER(j) <= 5 - && gBattleMons[gBattleAttacker].type1 != TYPE_EFFECT_DEF_TYPE(i) - && gBattleMons[gBattleAttacker].type2 != TYPE_EFFECT_DEF_TYPE(i)) + && gBattleMons[gBattleMoveAttacker].type1 != TYPE_EFFECT_DEF_TYPE(i) + && gBattleMons[gBattleMoveAttacker].type2 != TYPE_EFFECT_DEF_TYPE(i)) { - gBattleMons[gBattleAttacker].type1 = TYPE_EFFECT_DEF_TYPE(rands); - gBattleMons[gBattleAttacker].type2 = TYPE_EFFECT_DEF_TYPE(rands); + gBattleMons[gBattleMoveAttacker].type1 = TYPE_EFFECT_DEF_TYPE(rands); + gBattleMons[gBattleMoveAttacker].type2 = TYPE_EFFECT_DEF_TYPE(rands); PREPARE_TYPE_BUFFER(gBattleTextBuff1, TYPE_EFFECT_DEF_TYPE(rands)) @@ -8714,9 +8714,9 @@ static void atkA6_settypetorandomresistance(void) // conversion 2 static void atkA7_setalwayshitflag(void) { - gStatuses3[gBattleDefender] &= ~(STATUS3_ALWAYS_HITS); - gStatuses3[gBattleDefender] |= 0x10; - gDisableStructs[gBattleDefender].bankWithSureHit = gBattleAttacker; + gStatuses3[gBattleMoveTarget] &= ~(STATUS3_ALWAYS_HITS); + gStatuses3[gBattleMoveTarget] |= 0x10; + gDisableStructs[gBattleMoveTarget].bankWithSureHit = gBattleMoveAttacker; gBattlescriptCurrInstr++; } @@ -8724,19 +8724,19 @@ static void atkA8_copymovepermanently(void) // sketch { gChosenMove = 0xFFFF; - if (!(gBattleMons[gBattleAttacker].status2 & STATUS2_TRANSFORMED) - && gLastPrintedMoves[gBattleDefender] != MOVE_STRUGGLE - && gLastPrintedMoves[gBattleDefender] != 0 - && gLastPrintedMoves[gBattleDefender] != 0xFFFF - && gLastPrintedMoves[gBattleDefender] != MOVE_SKETCH) + if (!(gBattleMons[gBattleMoveAttacker].status2 & STATUS2_TRANSFORMED) + && gLastPrintedMoves[gBattleMoveTarget] != MOVE_STRUGGLE + && gLastPrintedMoves[gBattleMoveTarget] != 0 + && gLastPrintedMoves[gBattleMoveTarget] != 0xFFFF + && gLastPrintedMoves[gBattleMoveTarget] != MOVE_SKETCH) { s32 i; for (i = 0; i < 4; i++) { - if (gBattleMons[gBattleAttacker].moves[i] == MOVE_SKETCH) + if (gBattleMons[gBattleMoveAttacker].moves[i] == MOVE_SKETCH) continue; - if (gBattleMons[gBattleAttacker].moves[i] == gLastPrintedMoves[gBattleDefender]) + if (gBattleMons[gBattleMoveAttacker].moves[i] == gLastPrintedMoves[gBattleMoveTarget]) break; } @@ -8748,21 +8748,21 @@ static void atkA8_copymovepermanently(void) // sketch { struct MovePpInfo movePpData; - gBattleMons[gBattleAttacker].moves[gCurrMovePos] = gLastPrintedMoves[gBattleDefender]; - gBattleMons[gBattleAttacker].pp[gCurrMovePos] = gBattleMoves[gLastPrintedMoves[gBattleDefender]].pp; - gActiveBattler = gBattleAttacker; + gBattleMons[gBattleMoveAttacker].moves[gCurrMovePos] = gLastPrintedMoves[gBattleMoveTarget]; + gBattleMons[gBattleMoveAttacker].pp[gCurrMovePos] = gBattleMoves[gLastPrintedMoves[gBattleMoveTarget]].pp; + gActiveBattler = gBattleMoveAttacker; for (i = 0; i < 4; i++) { - movePpData.moves[i] = gBattleMons[gBattleAttacker].moves[i]; - movePpData.pp[i] = gBattleMons[gBattleAttacker].pp[i]; + movePpData.moves[i] = gBattleMons[gBattleMoveAttacker].moves[i]; + movePpData.pp[i] = gBattleMons[gBattleMoveAttacker].pp[i]; } - movePpData.ppBonuses = gBattleMons[gBattleAttacker].ppBonuses; + movePpData.ppBonuses = gBattleMons[gBattleMoveAttacker].ppBonuses; - EmitSetMonData(0, REQUEST_MOVES_PP_BATTLE, 0, sizeof(struct MovePpInfo), &movePpData); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_MOVES_PP_BATTLE, 0, sizeof(struct MovePpInfo), &movePpData); + MarkBattlerForControllerExec(gActiveBattler); - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastPrintedMoves[gBattleDefender]) + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastPrintedMoves[gBattleMoveTarget]) gBattlescriptCurrInstr += 5; } @@ -8822,17 +8822,17 @@ static void atkA9_trychoosesleeptalkmove(void) for (i = 0; i < 4; i++) { - if (IsInvalidForSleepTalkOrAssist(gBattleMons[gBattleAttacker].moves[i]) - || gBattleMons[gBattleAttacker].moves[i] == MOVE_FOCUS_PUNCH - || gBattleMons[gBattleAttacker].moves[i] == MOVE_UPROAR - || IsTwoTurnsMove(gBattleMons[gBattleAttacker].moves[i])) + if (IsInvalidForSleepTalkOrAssist(gBattleMons[gBattleMoveAttacker].moves[i]) + || gBattleMons[gBattleMoveAttacker].moves[i] == MOVE_FOCUS_PUNCH + || gBattleMons[gBattleMoveAttacker].moves[i] == MOVE_UPROAR + || IsTwoTurnsMove(gBattleMons[gBattleMoveAttacker].moves[i])) { unusableMovesBits |= gBitTable[i]; } } - unusableMovesBits = CheckMoveLimitations(gBattleAttacker, unusableMovesBits, ~(MOVE_LIMITATION_PP)); + unusableMovesBits = CheckMoveLimitations(gBattleMoveAttacker, unusableMovesBits, ~(MOVE_LIMITATION_PP)); if (unusableMovesBits == 0xF) // all 4 moves cannot be chosen { gBattlescriptCurrInstr += 5; @@ -8846,25 +8846,25 @@ static void atkA9_trychoosesleeptalkmove(void) movePosition = Random() & 3; } while ((gBitTable[movePosition] & unusableMovesBits)); - gRandomMove = gBattleMons[gBattleAttacker].moves[movePosition]; + gRandomMove = gBattleMons[gBattleMoveAttacker].moves[movePosition]; gCurrMovePos = movePosition; gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED); - gBattleDefender = GetMoveTarget(gRandomMove, 0); + gBattleMoveTarget = GetMoveTarget(gRandomMove, 0); gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } } static void atkAA_setdestinybond(void) { - gBattleMons[gBattleAttacker].status2 |= STATUS2_DESTINY_BOND; + gBattleMons[gBattleMoveAttacker].status2 |= STATUS2_DESTINY_BOND; gBattlescriptCurrInstr++; } static void TrySetDestinyBondToHappen(void) { - u8 sideAttacker = GetBattlerSide(gBattleAttacker); - u8 sideTarget = GetBattlerSide(gBattleDefender); - if (gBattleMons[gBattleDefender].status2 & STATUS2_DESTINY_BOND + u8 sideAttacker = GetBattlerSide(gBattleMoveAttacker); + u8 sideTarget = GetBattlerSide(gBattleMoveTarget); + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_DESTINY_BOND && sideAttacker != sideTarget && !(gHitMarker & HITMARKER_GRUDGE)) { @@ -8881,7 +8881,7 @@ static void atkAB_trysetdestinybondtohappen(void) static void atkAC_remaininghptopower(void) { s32 i; - s32 hpFraction = GetScaledHPFraction(gBattleMons[gBattleAttacker].hp, gBattleMons[gBattleAttacker].maxHP, 48); + s32 hpFraction = GetScaledHPFraction(gBattleMons[gBattleMoveAttacker].hp, gBattleMons[gBattleMoveAttacker].maxHP, 48); for (i = 0; i < (s32) sizeof(sFlailHpScaleToPowerTable); i += 2) { @@ -8895,43 +8895,43 @@ static void atkAC_remaininghptopower(void) static void atkAD_tryspiteppreduce(void) { - if (gLastMoves[gBattleDefender] != 0 - && gLastMoves[gBattleDefender] != 0xFFFF) + if (gLastMoves[gBattleMoveTarget] != 0 + && gLastMoves[gBattleMoveTarget] != 0xFFFF) { s32 i; for (i = 0; i < 4; i++) { - if (gLastMoves[gBattleDefender] == gBattleMons[gBattleDefender].moves[i]) + if (gLastMoves[gBattleMoveTarget] == gBattleMons[gBattleMoveTarget].moves[i]) break; } - if (i != 4 && gBattleMons[gBattleDefender].pp[i] > 1) + if (i != 4 && gBattleMons[gBattleMoveTarget].pp[i] > 1) { s32 ppToDeduct = (Random() & 3) + 2; - if (gBattleMons[gBattleDefender].pp[i] < ppToDeduct) - ppToDeduct = gBattleMons[gBattleDefender].pp[i]; + if (gBattleMons[gBattleMoveTarget].pp[i] < ppToDeduct) + ppToDeduct = gBattleMons[gBattleMoveTarget].pp[i]; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[gBattleDefender]) + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gLastMoves[gBattleMoveTarget]) ConvertIntToDecimalStringN(gBattleTextBuff2, ppToDeduct, 0, 1); PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 1, ppToDeduct) - gBattleMons[gBattleDefender].pp[i] -= ppToDeduct; - gActiveBattler = gBattleDefender; + gBattleMons[gBattleMoveTarget].pp[i] -= ppToDeduct; + gActiveBattler = gBattleMoveTarget; if (!(gDisableStructs[gActiveBattler].unk18_b & gBitTable[i]) && !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) { - EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + i, 0, 1, &gBattleMons[gActiveBattler].pp[i]); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + i, 0, 1, &gBattleMons[gActiveBattler].pp[i]); + MarkBattlerForControllerExec(gActiveBattler); } gBattlescriptCurrInstr += 5; - if (gBattleMons[gBattleDefender].pp[i] == 0) - CancelMultiTurnMoves(gBattleDefender); + if (gBattleMons[gBattleMoveTarget].pp[i] == 0) + CancelMultiTurnMoves(gBattleMoveTarget); } else { @@ -8956,23 +8956,23 @@ static void atkAE_healpartystatus(void) gBattleCommunication[MULTISTRING_CHOOSER] = 0; - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; - if (gBattleMons[gBattleAttacker].ability != ABILITY_SOUNDPROOF) + if (gBattleMons[gBattleMoveAttacker].ability != ABILITY_SOUNDPROOF) { - gBattleMons[gBattleAttacker].status1 = 0; - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[gBattleMoveAttacker].status1 = 0; + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_NIGHTMARE); } else { - RecordAbilityBattle(gBattleAttacker, gBattleMons[gBattleAttacker].ability); + RecordAbilityBattle(gBattleMoveAttacker, gBattleMons[gBattleMoveAttacker].ability); gBattleCommunication[MULTISTRING_CHOOSER] |= 1; } - gActiveBattler = gBattleScripting.battler = GetBattlerAtPosition(GetBattlerPosition(gBattleAttacker) ^ BIT_FLANK); + gActiveBattler = gBattleScripting.battler = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveAttacker) ^ BIT_FLANK); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) @@ -8998,10 +8998,10 @@ static void atkAE_healpartystatus(void) { u8 ability; - if (gBattlePartyID[gBattleAttacker] == i) - ability = gBattleMons[gBattleAttacker].ability; + if (gBattlerPartyIndexes[gBattleMoveAttacker] == i) + ability = gBattleMons[gBattleMoveAttacker].ability; else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && gBattlePartyID[gActiveBattler] == i + && gBattlerPartyIndexes[gActiveBattler] == i && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) ability = gBattleMons[gActiveBattler].ability; else @@ -9017,10 +9017,10 @@ static void atkAE_healpartystatus(void) gBattleCommunication[MULTISTRING_CHOOSER] = 4; toHeal = 0x3F; - gBattleMons[gBattleAttacker].status1 = 0; - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[gBattleMoveAttacker].status1 = 0; + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_NIGHTMARE); - gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattleAttacker) ^ BIT_FLANK); + gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveAttacker) ^ BIT_FLANK); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) { @@ -9032,9 +9032,9 @@ static void atkAE_healpartystatus(void) if (toHeal) { - gActiveBattler = gBattleAttacker; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, toHeal, 4, &zero); - MarkBufferBankForExecution(gActiveBattler); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, toHeal, 4, &zero); + MarkBattlerForControllerExec(gActiveBattler); } gBattlescriptCurrInstr++; @@ -9042,14 +9042,14 @@ static void atkAE_healpartystatus(void) static void atkAF_cursetarget(void) { - if (gBattleMons[gBattleDefender].status2 & STATUS2_CURSED) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_CURSED) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { - gBattleMons[gBattleDefender].status2 |= STATUS2_CURSED; - gBattleMoveDamage = gBattleMons[gBattleAttacker].maxHP / 2; + gBattleMons[gBattleMoveTarget].status2 |= STATUS2_CURSED; + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].maxHP / 2; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -9059,11 +9059,11 @@ static void atkAF_cursetarget(void) static void atkB0_trysetspikes(void) { - u8 targetSide = GetBattlerSide(gBattleAttacker) ^ BIT_SIDE; + u8 targetSide = GetBattlerSide(gBattleMoveAttacker) ^ BIT_SIDE; if (gSideTimers[targetSide].spikesAmount == 3) { - gSpecialStatuses[gBattleAttacker].flag20 = 1; + gSpecialStatuses[gBattleMoveAttacker].flag20 = 1; gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else @@ -9076,7 +9076,7 @@ static void atkB0_trysetspikes(void) static void atkB1_setforesight(void) { - gBattleMons[gBattleDefender].status2 |= STATUS2_FORESIGHT; + gBattleMons[gBattleMoveTarget].status2 |= STATUS2_FORESIGHT; gBattlescriptCurrInstr++; } @@ -9100,7 +9100,7 @@ static void atkB2_trysetperishsong(void) } } - PressurePPLoseOnUsingPerishSong(gBattleAttacker); + PressurePPLoseOnUsingPerishSong(gBattleMoveAttacker); if (notAffectedCount == gBattlersCount) gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); @@ -9112,31 +9112,31 @@ static void atkB3_rolloutdamagecalculation(void) { if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT) { - CancelMultiTurnMoves(gBattleAttacker); + CancelMultiTurnMoves(gBattleMoveAttacker); gBattlescriptCurrInstr = BattleScript_MoveMissedPause; } else { s32 i; - if (!(gBattleMons[gBattleAttacker].status2 & STATUS2_MULTIPLETURNS)) // first hit + if (!(gBattleMons[gBattleMoveAttacker].status2 & STATUS2_MULTIPLETURNS)) // first hit { - gDisableStructs[gBattleAttacker].rolloutCounter1 = 5; - gDisableStructs[gBattleAttacker].rolloutCounter2 = 5; - gBattleMons[gBattleAttacker].status2 |= STATUS2_MULTIPLETURNS; - gLockedMoves[gBattleAttacker] = gCurrentMove; + gDisableStructs[gBattleMoveAttacker].rolloutCounter1 = 5; + gDisableStructs[gBattleMoveAttacker].rolloutCounter2 = 5; + gBattleMons[gBattleMoveAttacker].status2 |= STATUS2_MULTIPLETURNS; + gLockedMoves[gBattleMoveAttacker] = gCurrentMove; } - if (--gDisableStructs[gBattleAttacker].rolloutCounter1 == 0) // last hit + if (--gDisableStructs[gBattleMoveAttacker].rolloutCounter1 == 0) // last hit { - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_MULTIPLETURNS); + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_MULTIPLETURNS); } gDynamicBasePower = gBattleMoves[gCurrentMove].power; - for (i = 1; i < (5 - gDisableStructs[gBattleAttacker].rolloutCounter1); i++) + for (i = 1; i < (5 - gDisableStructs[gBattleMoveAttacker].rolloutCounter1); i++) gDynamicBasePower *= 2; - if (gBattleMons[gBattleAttacker].status2 & STATUS2_DEFENSE_CURL) + if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_DEFENSE_CURL) gDynamicBasePower *= 2; gBattlescriptCurrInstr++; @@ -9145,8 +9145,8 @@ static void atkB3_rolloutdamagecalculation(void) static void atkB4_jumpifconfusedandstatmaxed(void) { - if (gBattleMons[gBattleDefender].status2 & STATUS2_CONFUSION - && gBattleMons[gBattleDefender].statStages[gBattlescriptCurrInstr[1]] == 0xC) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_CONFUSION + && gBattleMons[gBattleMoveTarget].statStages[gBattlescriptCurrInstr[1]] == 0xC) gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 2); else gBattlescriptCurrInstr += 6; @@ -9156,19 +9156,19 @@ static void atkB5_furycuttercalc(void) { if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT) { - gDisableStructs[gBattleAttacker].furyCutterCounter = 0; + gDisableStructs[gBattleMoveAttacker].furyCutterCounter = 0; gBattlescriptCurrInstr = BattleScript_MoveMissedPause; } else { s32 i; - if (gDisableStructs[gBattleAttacker].furyCutterCounter != 5) - gDisableStructs[gBattleAttacker].furyCutterCounter++; + if (gDisableStructs[gBattleMoveAttacker].furyCutterCounter != 5) + gDisableStructs[gBattleMoveAttacker].furyCutterCounter++; gDynamicBasePower = gBattleMoves[gCurrentMove].power; - for (i = 1; i < gDisableStructs[gBattleAttacker].furyCutterCounter; i++) + for (i = 1; i < gDisableStructs[gBattleMoveAttacker].furyCutterCounter; i++) gDynamicBasePower *= 2; gBattlescriptCurrInstr++; @@ -9178,9 +9178,9 @@ static void atkB5_furycuttercalc(void) static void atkB6_happinesstodamagecalculation(void) { if (gBattleMoves[gCurrentMove].effect == EFFECT_RETURN) - gDynamicBasePower = 10 * (gBattleMons[gBattleAttacker].friendship) / 25; + gDynamicBasePower = 10 * (gBattleMons[gBattleMoveAttacker].friendship) / 25; else // EFFECT_FRUSTRATION - gDynamicBasePower = 10 * (255 - gBattleMons[gBattleAttacker].friendship) / 25; + gDynamicBasePower = 10 * (255 - gBattleMons[gBattleMoveAttacker].friendship) / 25; gBattlescriptCurrInstr++; } @@ -9197,14 +9197,14 @@ static void atkB7_presentdamagecalculation(void) gDynamicBasePower = 120; else { - gBattleMoveDamage = gBattleMons[gBattleDefender].maxHP / 4; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].maxHP / 4; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; } if (rand < 204) gBattlescriptCurrInstr = BattleScript_HitFromCritCalc; - else if (gBattleMons[gBattleDefender].maxHP == gBattleMons[gBattleDefender].hp) + else if (gBattleMons[gBattleMoveTarget].maxHP == gBattleMons[gBattleMoveTarget].hp) gBattlescriptCurrInstr = BattleScript_AlreadyAtFullHp; else { @@ -9215,16 +9215,16 @@ static void atkB7_presentdamagecalculation(void) static void atkB8_setsafeguard(void) { - if (gSideStatuses[GET_BATTLER_SIDE(gBattleAttacker)] & SIDE_STATUS_SAFEGUARD) + if (gSideStatuses[GET_BATTLER_SIDE(gBattleMoveAttacker)] & SIDE_STATUS_SAFEGUARD) { gMoveResultFlags |= MOVE_RESULT_MISSED; gBattleCommunication[MULTISTRING_CHOOSER] = 0; } else { - gSideStatuses[GET_BATTLER_SIDE(gBattleAttacker)] |= SIDE_STATUS_SAFEGUARD; - gSideTimers[GET_BATTLER_SIDE(gBattleAttacker)].safeguardTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattleAttacker)].safeguardBank = gBattleAttacker; + gSideStatuses[GET_BATTLER_SIDE(gBattleMoveAttacker)] |= SIDE_STATUS_SAFEGUARD; + gSideTimers[GET_BATTLER_SIDE(gBattleMoveAttacker)].safeguardTimer = 5; + gSideTimers[GET_BATTLER_SIDE(gBattleMoveAttacker)].safeguardBank = gBattleMoveAttacker; gBattleCommunication[MULTISTRING_CHOOSER] = 5; } @@ -9274,11 +9274,11 @@ static void atkB9_magnitudedamagecalculation(void) PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 2, magnitude) - for (gBattleDefender = 0; gBattleDefender < gBattlersCount; gBattleDefender++) + for (gBattleMoveTarget = 0; gBattleMoveTarget < gBattlersCount; gBattleMoveTarget++) { - if (gBattleDefender == gBattleAttacker) + if (gBattleMoveTarget == gBattleMoveAttacker) continue; - if (!(gAbsentBattlerFlags & gBitTable[gBattleDefender])) // a valid target was found + if (!(gAbsentBattlerFlags & gBitTable[gBattleMoveTarget])) // a valid target was found break; } @@ -9289,36 +9289,36 @@ static void atkBA_jumpifnopursuitswitchdmg(void) { if (gMultiHitCounter == 1) { - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) - gBattleDefender = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); else - gBattleDefender = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); } else { - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) - gBattleDefender = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); else - gBattleDefender = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); } - if (gActionForBanks[gBattleDefender] == ACTION_USE_MOVE - && gBattleAttacker == *(gBattleStruct->moveTarget + gBattleDefender) - && !(gBattleMons[gBattleDefender].status1 & (STATUS1_SLEEP | STATUS1_FREEZE)) - && gBattleMons[gBattleAttacker].hp - && !gDisableStructs[gBattleDefender].truantCounter - && gChosenMovesByBanks[gBattleDefender] == MOVE_PURSUIT) + if (gActionForBanks[gBattleMoveTarget] == ACTION_USE_MOVE + && gBattleMoveAttacker == *(gBattleStruct->moveTarget + gBattleMoveTarget) + && !(gBattleMons[gBattleMoveTarget].status1 & (STATUS1_SLEEP | STATUS1_FREEZE)) + && gBattleMons[gBattleMoveAttacker].hp + && !gDisableStructs[gBattleMoveTarget].truantCounter + && gChosenMovesByBanks[gBattleMoveTarget] == MOVE_PURSUIT) { s32 i; for (i = 0; i < gBattlersCount; i++) { - if (gBattleTurnOrder[i] == gBattleDefender) + if (gBattleTurnOrder[i] == gBattleMoveTarget) gActionsByTurnOrder[i] = 11; } gCurrentMove = MOVE_PURSUIT; - gCurrMovePos = gUnknown_020241E9 = *(gBattleStruct->chosenMovePositions + gBattleDefender); + gCurrMovePos = gUnknown_020241E9 = *(gBattleStruct->chosenMovePositions + gBattleMoveTarget); gBattlescriptCurrInstr += 5; gBattleScripting.animTurn = 1; gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED); @@ -9348,16 +9348,16 @@ static void atkBB_setsunny(void) static void atkBC_maxattackhalvehp(void) // belly drum { - u32 halfHp = gBattleMons[gBattleAttacker].maxHP / 2; + u32 halfHp = gBattleMons[gBattleMoveAttacker].maxHP / 2; - if (!(gBattleMons[gBattleAttacker].maxHP / 2)) + if (!(gBattleMons[gBattleMoveAttacker].maxHP / 2)) halfHp = 1; - if (gBattleMons[gBattleAttacker].statStages[STAT_STAGE_ATK] < 12 - && gBattleMons[gBattleAttacker].hp > halfHp) + if (gBattleMons[gBattleMoveAttacker].statStages[STAT_STAGE_ATK] < 12 + && gBattleMons[gBattleMoveAttacker].hp > halfHp) { - gBattleMons[gBattleAttacker].statStages[STAT_STAGE_ATK] = 12; - gBattleMoveDamage = gBattleMons[gBattleAttacker].maxHP / 2; + gBattleMons[gBattleMoveAttacker].statStages[STAT_STAGE_ATK] = 12; + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].maxHP / 2; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -9375,7 +9375,7 @@ static void atkBD_copyfoestats(void) // psych up for (i = 0; i < BATTLE_STATS_NO; i++) { - gBattleMons[gBattleAttacker].statStages[i] = gBattleMons[gBattleDefender].statStages[i]; + gBattleMons[gBattleMoveAttacker].statStages[i] = gBattleMons[gBattleMoveTarget].statStages[i]; } gBattlescriptCurrInstr += 5; // Has an unused jump ptr(possibly for a failed attempt) parameter. @@ -9383,32 +9383,32 @@ static void atkBD_copyfoestats(void) // psych up static void atkBE_rapidspinfree(void) { - if (gBattleMons[gBattleAttacker].status2 & STATUS2_WRAPPED) + if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_WRAPPED) { - gBattleScripting.battler = gBattleDefender; - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_WRAPPED); - gBattleDefender = *(gBattleStruct->wrappedBy + gBattleAttacker); + gBattleScripting.battler = gBattleMoveTarget; + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_WRAPPED); + gBattleMoveTarget = *(gBattleStruct->wrappedBy + gBattleMoveAttacker); gBattleTextBuff1[0] = B_BUFF_PLACEHOLDER_BEGIN; gBattleTextBuff1[1] = B_BUFF_MOVE; - gBattleTextBuff1[2] = *(gBattleStruct->wrappedMove + gBattleAttacker * 2 + 0); - gBattleTextBuff1[3] = *(gBattleStruct->wrappedMove + gBattleAttacker * 2 + 1); + gBattleTextBuff1[2] = *(gBattleStruct->wrappedMove + gBattleMoveAttacker * 2 + 0); + gBattleTextBuff1[3] = *(gBattleStruct->wrappedMove + gBattleMoveAttacker * 2 + 1); gBattleTextBuff1[4] = B_BUFF_EOS; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_WrapFree; } - else if (gStatuses3[gBattleAttacker] & STATUS3_LEECHSEED) + else if (gStatuses3[gBattleMoveAttacker] & STATUS3_LEECHSEED) { - gStatuses3[gBattleAttacker] &= ~(STATUS3_LEECHSEED); - gStatuses3[gBattleAttacker] &= ~(STATUS3_LEECHSEED_BANK); + gStatuses3[gBattleMoveAttacker] &= ~(STATUS3_LEECHSEED); + gStatuses3[gBattleMoveAttacker] &= ~(STATUS3_LEECHSEED_BANK); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_LeechSeedFree; } - else if (gSideStatuses[GetBattlerSide(gBattleAttacker)] & SIDE_STATUS_SPIKES) + else if (gSideStatuses[GetBattlerSide(gBattleMoveAttacker)] & SIDE_STATUS_SPIKES) { - gSideStatuses[GetBattlerSide(gBattleAttacker)] &= ~(SIDE_STATUS_SPIKES); - gSideTimers[GetBattlerSide(gBattleAttacker)].spikesAmount = 0; + gSideStatuses[GetBattlerSide(gBattleMoveAttacker)] &= ~(SIDE_STATUS_SPIKES); + gSideTimers[GetBattlerSide(gBattleMoveAttacker)].spikesAmount = 0; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SpikesFree; } @@ -9420,22 +9420,22 @@ static void atkBE_rapidspinfree(void) static void atkBF_setdefensecurlbit(void) { - gBattleMons[gBattleAttacker].status2 |= STATUS2_DEFENSE_CURL; + gBattleMons[gBattleMoveAttacker].status2 |= STATUS2_DEFENSE_CURL; gBattlescriptCurrInstr++; } static void atkC0_recoverbasedonsunlight(void) { - gBattleDefender = gBattleAttacker; + gBattleMoveTarget = gBattleMoveAttacker; - if (gBattleMons[gBattleAttacker].hp != gBattleMons[gBattleAttacker].maxHP) + if (gBattleMons[gBattleMoveAttacker].hp != gBattleMons[gBattleMoveAttacker].maxHP) { if (gBattleWeather == 0 || !WEATHER_HAS_EFFECT) - gBattleMoveDamage = gBattleMons[gBattleAttacker].maxHP / 2; + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].maxHP / 2; else if (gBattleWeather & WEATHER_SUN_ANY) - gBattleMoveDamage = 20 * gBattleMons[gBattleAttacker].maxHP / 30; + gBattleMoveDamage = 20 * gBattleMons[gBattleMoveAttacker].maxHP / 30; else // not sunny weather - gBattleMoveDamage = gBattleMons[gBattleAttacker].maxHP / 4; + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].maxHP / 4; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -9455,19 +9455,19 @@ static void atkC1_hiddenpowercalc(void) u32 powerBits = 0; u32 typeBits = 0; - powerBits |= ((gBattleMons[gBattleAttacker].hpIV & 2) >> 1); - powerBits |= ((gBattleMons[gBattleAttacker].attackIV & 2) << 0); - powerBits |= ((gBattleMons[gBattleAttacker].defenseIV & 2) << 1); - powerBits |= ((gBattleMons[gBattleAttacker].speedIV & 2) << 2); - powerBits |= ((gBattleMons[gBattleAttacker].spAttackIV & 2) << 3); - powerBits |= ((gBattleMons[gBattleAttacker].spDefenseIV & 2) << 4); + powerBits |= ((gBattleMons[gBattleMoveAttacker].hpIV & 2) >> 1); + powerBits |= ((gBattleMons[gBattleMoveAttacker].attackIV & 2) << 0); + powerBits |= ((gBattleMons[gBattleMoveAttacker].defenseIV & 2) << 1); + powerBits |= ((gBattleMons[gBattleMoveAttacker].speedIV & 2) << 2); + powerBits |= ((gBattleMons[gBattleMoveAttacker].spAttackIV & 2) << 3); + powerBits |= ((gBattleMons[gBattleMoveAttacker].spDefenseIV & 2) << 4); - typeBits |= ((gBattleMons[gBattleAttacker].hpIV & 1) << 0); - typeBits |= ((gBattleMons[gBattleAttacker].attackIV & 1) << 1); - typeBits |= ((gBattleMons[gBattleAttacker].defenseIV & 1) << 2); - typeBits |= ((gBattleMons[gBattleAttacker].speedIV & 1) << 3); - typeBits |= ((gBattleMons[gBattleAttacker].spAttackIV & 1) << 4); - typeBits |= ((gBattleMons[gBattleAttacker].spDefenseIV & 1) << 5); + typeBits |= ((gBattleMons[gBattleMoveAttacker].hpIV & 1) << 0); + typeBits |= ((gBattleMons[gBattleMoveAttacker].attackIV & 1) << 1); + typeBits |= ((gBattleMons[gBattleMoveAttacker].defenseIV & 1) << 2); + typeBits |= ((gBattleMons[gBattleMoveAttacker].speedIV & 1) << 3); + typeBits |= ((gBattleMons[gBattleMoveAttacker].spAttackIV & 1) << 4); + typeBits |= ((gBattleMons[gBattleMoveAttacker].spDefenseIV & 1) << 5); gDynamicBasePower = (40 * powerBits) / 63 + 30; @@ -9490,7 +9490,7 @@ static void atkC1_hiddenpowercalc(void) mov r5, r8\n\ push {r5-r7}\n\ ldr r2, =gBattleMons\n\ - ldr r0, =gBattleAttacker\n\ + ldr r0, =gBattleMoveAttacker\n\ ldrb r1, [r0]\n\ movs r0, 0x58\n\ adds r4, r1, 0\n\ @@ -9626,11 +9626,11 @@ _080544F0:\n\ static void atkC2_selectfirstvalidtarget(void) { - for (gBattleDefender = 0; gBattleDefender < gBattlersCount; gBattleDefender++) + for (gBattleMoveTarget = 0; gBattleMoveTarget < gBattlersCount; gBattleMoveTarget++) { - if (gBattleDefender == gBattleAttacker) + if (gBattleMoveTarget == gBattleMoveAttacker) continue; - if (!(gAbsentBattlerFlags & gBitTable[gBattleDefender])) + if (!(gAbsentBattlerFlags & gBitTable[gBattleMoveTarget])) break; } gBattlescriptCurrInstr++; @@ -9638,22 +9638,22 @@ static void atkC2_selectfirstvalidtarget(void) static void atkC3_trysetfutureattack(void) { - if (gWishFutureKnock.futureSightCounter[gBattleDefender] != 0) + if (gWishFutureKnock.futureSightCounter[gBattleMoveTarget] != 0) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { - gSideStatuses[GET_BATTLER_SIDE(gBattleDefender)] |= SIDE_STATUS_FUTUREATTACK; - gWishFutureKnock.futureSightMove[gBattleDefender] = gCurrentMove; - gWishFutureKnock.futureSightAttacker[gBattleDefender] = gBattleAttacker; - gWishFutureKnock.futureSightCounter[gBattleDefender] = 3; - gWishFutureKnock.futureSightDmg[gBattleDefender] = CalculateBaseDamage(&gBattleMons[gBattleAttacker], &gBattleMons[gBattleDefender], gCurrentMove, - gSideStatuses[GET_BATTLER_SIDE(gBattleDefender)], 0, - 0, gBattleAttacker, gBattleDefender); + gSideStatuses[GET_BATTLER_SIDE(gBattleMoveTarget)] |= SIDE_STATUS_FUTUREATTACK; + gWishFutureKnock.futureSightMove[gBattleMoveTarget] = gCurrentMove; + gWishFutureKnock.futureSightAttacker[gBattleMoveTarget] = gBattleMoveAttacker; + gWishFutureKnock.futureSightCounter[gBattleMoveTarget] = 3; + gWishFutureKnock.futureSightDmg[gBattleMoveTarget] = CalculateBaseDamage(&gBattleMons[gBattleMoveAttacker], &gBattleMons[gBattleMoveTarget], gCurrentMove, + gSideStatuses[GET_BATTLER_SIDE(gBattleMoveTarget)], 0, + 0, gBattleMoveAttacker, gBattleMoveTarget); - if (gProtectStructs[gBattleAttacker].helpingHand) - gWishFutureKnock.futureSightDmg[gBattleDefender] = gWishFutureKnock.futureSightDmg[gBattleDefender] * 15 / 10; + if (gProtectStructs[gBattleMoveAttacker].helpingHand) + gWishFutureKnock.futureSightDmg[gBattleMoveTarget] = gWishFutureKnock.futureSightDmg[gBattleMoveTarget] * 15 / 10; if (gCurrentMove == MOVE_DOOM_DESIRE) gBattleCommunication[MULTISTRING_CHOOSER] = 1; @@ -9668,12 +9668,12 @@ static void atkC4_trydobeatup(void) { struct Pokemon *party; - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; - if (gBattleMons[gBattleDefender].hp == 0) + if (gBattleMons[gBattleMoveTarget].hp == 0) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } @@ -9690,16 +9690,16 @@ static void atkC4_trydobeatup(void) } if (gBattleCommunication[0] < 6) { - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleAttacker, gBattleCommunication[0]) + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleMoveAttacker, gBattleCommunication[0]) gBattlescriptCurrInstr += 9; gBattleMoveDamage = gBaseStats[GetMonData(&party[gBattleCommunication[0]], MON_DATA_SPECIES)].baseAttack; gBattleMoveDamage *= gBattleMoves[gCurrentMove].power; gBattleMoveDamage *= (GetMonData(&party[gBattleCommunication[0]], MON_DATA_LEVEL) * 2 / 5 + 2); - gBattleMoveDamage /= gBaseStats[gBattleMons[gBattleDefender].species].baseDefense; + gBattleMoveDamage /= gBaseStats[gBattleMons[gBattleMoveTarget].species].baseDefense; gBattleMoveDamage = (gBattleMoveDamage / 50) + 2; - if (gProtectStructs[gBattleAttacker].helpingHand) + if (gProtectStructs[gBattleMoveAttacker].helpingHand) gBattleMoveDamage = gBattleMoveDamage * 15 / 10; gBattleCommunication[0]++; @@ -9717,13 +9717,13 @@ static void atkC5_setsemiinvulnerablebit(void) { case MOVE_FLY: case MOVE_BOUNCE: - gStatuses3[gBattleAttacker] |= STATUS3_ON_AIR; + gStatuses3[gBattleMoveAttacker] |= STATUS3_ON_AIR; break; case MOVE_DIG: - gStatuses3[gBattleAttacker] |= STATUS3_UNDERGROUND; + gStatuses3[gBattleMoveAttacker] |= STATUS3_UNDERGROUND; break; case MOVE_DIVE: - gStatuses3[gBattleAttacker] |= STATUS3_UNDERWATER; + gStatuses3[gBattleMoveAttacker] |= STATUS3_UNDERWATER; break; } @@ -9736,13 +9736,13 @@ static void atkC6_clearsemiinvulnerablebit(void) { case MOVE_FLY: case MOVE_BOUNCE: - gStatuses3[gBattleAttacker] &= ~STATUS3_ON_AIR; + gStatuses3[gBattleMoveAttacker] &= ~STATUS3_ON_AIR; break; case MOVE_DIG: - gStatuses3[gBattleAttacker] &= ~STATUS3_UNDERGROUND; + gStatuses3[gBattleMoveAttacker] &= ~STATUS3_UNDERGROUND; break; case MOVE_DIVE: - gStatuses3[gBattleAttacker] &= ~STATUS3_UNDERWATER; + gStatuses3[gBattleMoveAttacker] &= ~STATUS3_UNDERWATER; break; } @@ -9752,7 +9752,7 @@ static void atkC6_clearsemiinvulnerablebit(void) static void atkC7_setminimize(void) { if (gHitMarker & HITMARKER_OBEYS) - gStatuses3[gBattleAttacker] |= STATUS3_MINIMIZED; + gStatuses3[gBattleMoveAttacker] |= STATUS3_MINIMIZED; gBattlescriptCurrInstr++; } @@ -9776,34 +9776,34 @@ static void atkC8_sethail(void) static void atkC9_jumpifattackandspecialattackcannotfall(void) // memento { - if (gBattleMons[gBattleDefender].statStages[STAT_STAGE_ATK] == 0 - && gBattleMons[gBattleDefender].statStages[STAT_STAGE_SPATK] == 0 + if (gBattleMons[gBattleMoveTarget].statStages[STAT_STAGE_ATK] == 0 + && gBattleMons[gBattleMoveTarget].statStages[STAT_STAGE_SPATK] == 0 && gBattleCommunication[6] != 1) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { - gActiveBattler = gBattleAttacker; + gActiveBattler = gBattleMoveAttacker; gBattleMoveDamage = gBattleMons[gActiveBattler].hp; - EmitHealthBarUpdate(0, INSTANT_HP_BAR_DROP); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitHealthBarUpdate(0, INSTANT_HP_BAR_DROP); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 5; } } static void atkCA_setforcedtarget(void) // follow me { - gSideTimers[GetBattlerSide(gBattleAttacker)].followmeTimer = 1; - gSideTimers[GetBattlerSide(gBattleAttacker)].followmeTarget = gBattleAttacker; + gSideTimers[GetBattlerSide(gBattleMoveAttacker)].followmeTimer = 1; + gSideTimers[GetBattlerSide(gBattleMoveAttacker)].followmeTarget = gBattleMoveAttacker; gBattlescriptCurrInstr++; } static void atkCB_setcharge(void) { - gStatuses3[gBattleAttacker] |= STATUS3_CHARGED_UP; - gDisableStructs[gBattleAttacker].chargeTimer1 = 2; - gDisableStructs[gBattleAttacker].chargeTimer2 = 2; + gStatuses3[gBattleMoveAttacker] |= STATUS3_CHARGED_UP; + gDisableStructs[gBattleMoveAttacker].chargeTimer1 = 2; + gDisableStructs[gBattleMoveAttacker].chargeTimer2 = 2; gBattlescriptCurrInstr++; } @@ -9811,20 +9811,20 @@ static void atkCC_callterrainattack(void) // nature power { gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED); gCurrentMove = sNaturePowerMoves[gBattleTerrain]; - gBattleDefender = GetMoveTarget(gCurrentMove, 0); + gBattleMoveTarget = GetMoveTarget(gCurrentMove, 0); BattleScriptPush(gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]); gBattlescriptCurrInstr++; } static void atkCD_cureifburnedparalysedorpoisoned(void) // refresh { - if (gBattleMons[gBattleAttacker].status1 & (STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON)) + if (gBattleMons[gBattleMoveAttacker].status1 & (STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON)) { - gBattleMons[gBattleAttacker].status1 = 0; + gBattleMons[gBattleMoveAttacker].status1 = 0; gBattlescriptCurrInstr += 5; - gActiveBattler = gBattleAttacker; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); } else { @@ -9834,20 +9834,20 @@ static void atkCD_cureifburnedparalysedorpoisoned(void) // refresh static void atkCE_settorment(void) { - if (gBattleMons[gBattleDefender].status2 & STATUS2_TORMENT) + if (gBattleMons[gBattleMoveTarget].status2 & STATUS2_TORMENT) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { - gBattleMons[gBattleDefender].status2 |= STATUS2_TORMENT; + gBattleMons[gBattleMoveTarget].status2 |= STATUS2_TORMENT; gBattlescriptCurrInstr += 5; } } static void atkCF_jumpifnodamage(void) { - if (gProtectStructs[gBattleAttacker].physicalDmg || gProtectStructs[gBattleAttacker].specialDmg) + if (gProtectStructs[gBattleMoveAttacker].physicalDmg || gProtectStructs[gBattleMoveAttacker].specialDmg) gBattlescriptCurrInstr += 5; else gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); @@ -9855,10 +9855,10 @@ static void atkCF_jumpifnodamage(void) static void atkD0_settaunt(void) { - if (gDisableStructs[gBattleDefender].tauntTimer1 == 0) + if (gDisableStructs[gBattleMoveTarget].tauntTimer1 == 0) { - gDisableStructs[gBattleDefender].tauntTimer1 = 2; - gDisableStructs[gBattleDefender].tauntTimer2 = 2; + gDisableStructs[gBattleMoveTarget].tauntTimer1 = 2; + gDisableStructs[gBattleMoveTarget].tauntTimer2 = 2; gBattlescriptCurrInstr += 5; } else @@ -9869,14 +9869,14 @@ static void atkD0_settaunt(void) static void atkD1_trysethelpinghand(void) { - gBattleDefender = GetBattlerAtPosition(GetBattlerPosition(gBattleAttacker) ^ BIT_FLANK); + gBattleMoveTarget = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveAttacker) ^ BIT_FLANK); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && !(gAbsentBattlerFlags & gBitTable[gBattleDefender]) - && !gProtectStructs[gBattleAttacker].helpingHand - && !gProtectStructs[gBattleDefender].helpingHand) + && !(gAbsentBattlerFlags & gBitTable[gBattleMoveTarget]) + && !gProtectStructs[gBattleMoveAttacker].helpingHand + && !gProtectStructs[gBattleMoveTarget].helpingHand) { - gProtectStructs[gBattleDefender].helpingHand = 1; + gProtectStructs[gBattleMoveTarget].helpingHand = 1; gBattlescriptCurrInstr += 5; } else @@ -9889,7 +9889,7 @@ static void atkD2_tryswapitems(void) // trick { // opponent can't swap items with player in regular battles if (gBattleTypeFlags & BATTLE_TYPE_x4000000 - || (GetBattlerSide(gBattleAttacker) == B_SIDE_OPPONENT + || (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_OPPONENT && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_FRONTIER @@ -9900,8 +9900,8 @@ static void atkD2_tryswapitems(void) // trick } else { - u8 sideAttacker = GetBattlerSide(gBattleAttacker); - u8 sideTarget = GetBattlerSide(gBattleDefender); + u8 sideAttacker = GetBattlerSide(gBattleMoveAttacker); + u8 sideTarget = GetBattlerSide(gBattleMoveTarget); // you can't swap items if they were knocked off in regular battles if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK @@ -9909,53 +9909,53 @@ static void atkD2_tryswapitems(void) // trick | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_SECRET_BASE | BATTLE_TYPE_x2000000)) - && (gWishFutureKnock.knockedOffPokes[sideAttacker] & gBitTable[gBattlePartyID[gBattleAttacker]] - || gWishFutureKnock.knockedOffPokes[sideTarget] & gBitTable[gBattlePartyID[gBattleDefender]])) + && (gWishFutureKnock.knockedOffPokes[sideAttacker] & gBitTable[gBattlerPartyIndexes[gBattleMoveAttacker]] + || gWishFutureKnock.knockedOffPokes[sideTarget] & gBitTable[gBattlerPartyIndexes[gBattleMoveTarget]])) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } // can't swap if two pokemon don't have an item // or if either of them is an enigma berry or a mail - else if ((gBattleMons[gBattleAttacker].item == 0 && gBattleMons[gBattleDefender].item == 0) - || gBattleMons[gBattleAttacker].item == ITEM_ENIGMA_BERRY - || gBattleMons[gBattleDefender].item == ITEM_ENIGMA_BERRY - || IS_ITEM_MAIL(gBattleMons[gBattleAttacker].item) - || IS_ITEM_MAIL(gBattleMons[gBattleDefender].item)) + else if ((gBattleMons[gBattleMoveAttacker].item == 0 && gBattleMons[gBattleMoveTarget].item == 0) + || gBattleMons[gBattleMoveAttacker].item == ITEM_ENIGMA_BERRY + || gBattleMons[gBattleMoveTarget].item == ITEM_ENIGMA_BERRY + || IS_ITEM_MAIL(gBattleMons[gBattleMoveAttacker].item) + || IS_ITEM_MAIL(gBattleMons[gBattleMoveTarget].item)) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } // check if ability prevents swapping - else if (gBattleMons[gBattleDefender].ability == ABILITY_STICKY_HOLD) + else if (gBattleMons[gBattleMoveTarget].ability == ABILITY_STICKY_HOLD) { gBattlescriptCurrInstr = BattleScript_StickyHoldActivates; - gLastUsedAbility = gBattleMons[gBattleDefender].ability; - RecordAbilityBattle(gBattleDefender, gLastUsedAbility); + gLastUsedAbility = gBattleMons[gBattleMoveTarget].ability; + RecordAbilityBattle(gBattleMoveTarget, gLastUsedAbility); } // took a while, but all checks passed and items can be safely swapped else { u16 oldItemAtk, *newItemAtk; - newItemAtk = &gBattleStruct->changedItems[gBattleAttacker]; - oldItemAtk = gBattleMons[gBattleAttacker].item; - *newItemAtk = gBattleMons[gBattleDefender].item; + newItemAtk = &gBattleStruct->changedItems[gBattleMoveAttacker]; + oldItemAtk = gBattleMons[gBattleMoveAttacker].item; + *newItemAtk = gBattleMons[gBattleMoveTarget].item; - gBattleMons[gBattleAttacker].item = 0; - gBattleMons[gBattleDefender].item = oldItemAtk; + gBattleMons[gBattleMoveAttacker].item = 0; + gBattleMons[gBattleMoveTarget].item = oldItemAtk; - gActiveBattler = gBattleAttacker; - EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, newItemAtk); - MarkBufferBankForExecution(gBattleAttacker); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, newItemAtk); + MarkBattlerForControllerExec(gBattleMoveAttacker); - gActiveBattler = gBattleDefender; - EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gBattleDefender].item); - MarkBufferBankForExecution(gBattleDefender); + gActiveBattler = gBattleMoveTarget; + BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gBattleMoveTarget].item); + MarkBattlerForControllerExec(gBattleMoveTarget); - *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleDefender]) + 0) = 0; - *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleDefender]) + 1) = 0; + *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleMoveTarget]) + 0) = 0; + *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleMoveTarget]) + 1) = 0; - *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleAttacker]) + 0) = 0; - *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleAttacker]) + 1) = 0; + *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleMoveAttacker]) + 0) = 0; + *(u8*)((u8*)(&gBattleStruct->choicedMove[gBattleMoveAttacker]) + 1) = 0; gBattlescriptCurrInstr += 5; @@ -9974,11 +9974,11 @@ static void atkD2_tryswapitems(void) // trick static void atkD3_trycopyability(void) // role play { - if (gBattleMons[gBattleDefender].ability != 0 - && gBattleMons[gBattleDefender].ability != ABILITY_WONDER_GUARD) + if (gBattleMons[gBattleMoveTarget].ability != 0 + && gBattleMons[gBattleMoveTarget].ability != ABILITY_WONDER_GUARD) { - gBattleMons[gBattleAttacker].ability = gBattleMons[gBattleDefender].ability; - gLastUsedAbility = gBattleMons[gBattleDefender].ability; + gBattleMons[gBattleMoveAttacker].ability = gBattleMons[gBattleMoveTarget].ability; + gLastUsedAbility = gBattleMons[gBattleMoveTarget].ability; gBattlescriptCurrInstr += 5; } else @@ -9992,10 +9992,10 @@ static void atkD4_trywish(void) switch (gBattlescriptCurrInstr[1]) { case 0: // use wish - if (gWishFutureKnock.wishCounter[gBattleAttacker] == 0) + if (gWishFutureKnock.wishCounter[gBattleMoveAttacker] == 0) { - gWishFutureKnock.wishCounter[gBattleAttacker] = 2; - gWishFutureKnock.wishUserID[gBattleAttacker] = gBattlePartyID[gBattleAttacker]; + gWishFutureKnock.wishCounter[gBattleMoveAttacker] = 2; + gWishFutureKnock.wishUserID[gBattleMoveAttacker] = gBattlerPartyIndexes[gBattleMoveAttacker]; gBattlescriptCurrInstr += 6; } else @@ -10004,14 +10004,14 @@ static void atkD4_trywish(void) } break; case 1: // heal effect - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleDefender, gWishFutureKnock.wishUserID[gBattleDefender]) + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleMoveTarget, gWishFutureKnock.wishUserID[gBattleMoveTarget]) - gBattleMoveDamage = gBattleMons[gBattleDefender].maxHP / 2; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].maxHP / 2; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; - if (gBattleMons[gBattleDefender].hp == gBattleMons[gBattleDefender].maxHP) + if (gBattleMons[gBattleMoveTarget].hp == gBattleMons[gBattleMoveTarget].maxHP) gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 2); else gBattlescriptCurrInstr += 6; @@ -10022,23 +10022,23 @@ static void atkD4_trywish(void) static void atkD5_trysetroots(void) // ingrain { - if (gStatuses3[gBattleAttacker] & STATUS3_ROOTED) + if (gStatuses3[gBattleMoveAttacker] & STATUS3_ROOTED) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { - gStatuses3[gBattleAttacker] |= STATUS3_ROOTED; + gStatuses3[gBattleMoveAttacker] |= STATUS3_ROOTED; gBattlescriptCurrInstr += 5; } } static void atkD6_doubledamagedealtifdamaged(void) { - if ((gProtectStructs[gBattleAttacker].physicalDmg - && gProtectStructs[gBattleAttacker].physicalBank == gBattleDefender) - || (gProtectStructs[gBattleAttacker].specialDmg - && gProtectStructs[gBattleAttacker].specialBank == gBattleDefender)) + if ((gProtectStructs[gBattleMoveAttacker].physicalDmg + && gProtectStructs[gBattleMoveAttacker].physicalBank == gBattleMoveTarget) + || (gProtectStructs[gBattleMoveAttacker].specialDmg + && gProtectStructs[gBattleMoveAttacker].specialBank == gBattleMoveTarget)) { gBattleScripting.dmgMultiplier = 2; } @@ -10048,27 +10048,27 @@ static void atkD6_doubledamagedealtifdamaged(void) static void atkD7_setyawn(void) { - if (gStatuses3[gBattleDefender] & STATUS3_YAWN - || gBattleMons[gBattleDefender].status1 & STATUS1_ANY) + if (gStatuses3[gBattleMoveTarget] & STATUS3_YAWN + || gBattleMons[gBattleMoveTarget].status1 & STATUS1_ANY) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { - gStatuses3[gBattleDefender] |= 0x1000; + gStatuses3[gBattleMoveTarget] |= 0x1000; gBattlescriptCurrInstr += 5; } } static void atkD8_setdamagetohealthdifference(void) { - if (gBattleMons[gBattleDefender].hp <= gBattleMons[gBattleAttacker].hp) + if (gBattleMons[gBattleMoveTarget].hp <= gBattleMons[gBattleMoveAttacker].hp) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { - gBattleMoveDamage = gBattleMons[gBattleDefender].hp - gBattleMons[gBattleAttacker].hp; + gBattleMoveDamage = gBattleMons[gBattleMoveTarget].hp - gBattleMons[gBattleMoveAttacker].hp; gBattlescriptCurrInstr += 5; } } @@ -10078,7 +10078,7 @@ static void atkD9_scaledamagebyhealthratio(void) if (gDynamicBasePower == 0) { u8 power = gBattleMoves[gCurrentMove].power; - gDynamicBasePower = gBattleMons[gBattleAttacker].hp * power / gBattleMons[gBattleAttacker].maxHP; + gDynamicBasePower = gBattleMons[gBattleMoveAttacker].hp * power / gBattleMons[gBattleMoveAttacker].maxHP; if (gDynamicBasePower == 0) gDynamicBasePower = 1; } @@ -10087,19 +10087,19 @@ static void atkD9_scaledamagebyhealthratio(void) static void atkDA_tryswapabilities(void) // skill swap { - if ((gBattleMons[gBattleAttacker].ability == 0 - && gBattleMons[gBattleDefender].ability == 0) - || gBattleMons[gBattleAttacker].ability == ABILITY_WONDER_GUARD - || gBattleMons[gBattleDefender].ability == ABILITY_WONDER_GUARD + if ((gBattleMons[gBattleMoveAttacker].ability == 0 + && gBattleMons[gBattleMoveTarget].ability == 0) + || gBattleMons[gBattleMoveAttacker].ability == ABILITY_WONDER_GUARD + || gBattleMons[gBattleMoveTarget].ability == ABILITY_WONDER_GUARD || gMoveResultFlags & MOVE_RESULT_NO_EFFECT) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { - u8 abilityAtk = gBattleMons[gBattleAttacker].ability; - gBattleMons[gBattleAttacker].ability = gBattleMons[gBattleDefender].ability; - gBattleMons[gBattleDefender].ability = abilityAtk; + u8 abilityAtk = gBattleMons[gBattleMoveAttacker].ability; + gBattleMons[gBattleMoveAttacker].ability = gBattleMons[gBattleMoveTarget].ability; + gBattleMons[gBattleMoveTarget].ability = abilityAtk; gBattlescriptCurrInstr += 5; } @@ -10107,7 +10107,7 @@ static void atkDA_tryswapabilities(void) // skill swap static void atkDB_tryimprision(void) { - if ((gStatuses3[gBattleAttacker] & STATUS3_IMPRISONED_OTHERS)) + if ((gStatuses3[gBattleMoveAttacker] & STATUS3_IMPRISONED_OTHERS)) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } @@ -10115,8 +10115,8 @@ static void atkDB_tryimprision(void) { u8 bank, sideAttacker; - sideAttacker = GetBattlerSide(gBattleAttacker); - PressurePPLoseOnUsingImprision(gBattleAttacker); + sideAttacker = GetBattlerSide(gBattleMoveAttacker); + PressurePPLoseOnUsingImprision(gBattleMoveAttacker); for (bank = 0; bank < gBattlersCount; bank++) { if (sideAttacker != GetBattlerSide(bank)) @@ -10127,8 +10127,8 @@ static void atkDB_tryimprision(void) s32 i; for (i = 0; i < 4; i++) { - if (gBattleMons[gBattleAttacker].moves[attackerMoveId] == gBattleMons[bank].moves[i] - && gBattleMons[gBattleAttacker].moves[attackerMoveId] != MOVE_NONE) + if (gBattleMons[gBattleMoveAttacker].moves[attackerMoveId] == gBattleMons[bank].moves[i] + && gBattleMons[gBattleMoveAttacker].moves[attackerMoveId] != MOVE_NONE) break; } if (i != 4) @@ -10136,7 +10136,7 @@ static void atkDB_tryimprision(void) } if (attackerMoveId != 4) { - gStatuses3[gBattleAttacker] |= STATUS3_IMPRISONED_OTHERS; + gStatuses3[gBattleMoveAttacker] |= STATUS3_IMPRISONED_OTHERS; gBattlescriptCurrInstr += 5; break; } @@ -10149,13 +10149,13 @@ static void atkDB_tryimprision(void) static void atkDC_trysetgrudge(void) { - if (gStatuses3[gBattleAttacker] & STATUS3_GRUDGE) + if (gStatuses3[gBattleMoveAttacker] & STATUS3_GRUDGE) { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { - gStatuses3[gBattleAttacker] |= STATUS3_GRUDGE; + gStatuses3[gBattleMoveAttacker] |= STATUS3_GRUDGE; gBattlescriptCurrInstr += 5; } } @@ -10165,7 +10165,7 @@ static void atkDD_weightdamagecalculation(void) s32 i; for (i = 0; sWeightToDamageTable[i] != 0xFFFF; i += 2) { - if (sWeightToDamageTable[i] > GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[gBattleDefender].species), 1)) + if (sWeightToDamageTable[i] > GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[gBattleMoveTarget].species), 1)) break; } @@ -10184,14 +10184,14 @@ static void atkDE_asistattackselect(void) s32 monId, moveId; u16* movesArray = gBattleStruct->assistPossibleMoves; - if (GET_BATTLER_SIDE(gBattleAttacker) != B_SIDE_PLAYER) + if (GET_BATTLER_SIDE(gBattleMoveAttacker) != B_SIDE_PLAYER) party = gEnemyParty; else party = gPlayerParty; for (monId = 0; monId < 6; monId++) { - if (monId == gBattlePartyID[gBattleAttacker]) + if (monId == gBattlerPartyIndexes[gBattleMoveAttacker]) continue; if (GetMonData(&party[monId], MON_DATA_SPECIES2) == SPECIES_NONE) continue; @@ -10221,7 +10221,7 @@ static void atkDE_asistattackselect(void) { gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED); gRandomMove = movesArray[((Random() & 0xFF) * chooseableMovesNo) >> 8]; - gBattleDefender = GetMoveTarget(gRandomMove, 0); + gBattleMoveTarget = GetMoveTarget(gRandomMove, 0); gBattlescriptCurrInstr += 5; } else @@ -10232,29 +10232,29 @@ static void atkDE_asistattackselect(void) static void atkDF_trysetmagiccoat(void) { - gBattleDefender = gBattleAttacker; - gSpecialStatuses[gBattleAttacker].flag20 = 1; + gBattleMoveTarget = gBattleMoveAttacker; + gSpecialStatuses[gBattleMoveAttacker].flag20 = 1; if (gCurrentTurnActionNumber == gBattlersCount - 1) // moves last turn { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { - gProtectStructs[gBattleAttacker].bounceMove = 1; + gProtectStructs[gBattleMoveAttacker].bounceMove = 1; gBattlescriptCurrInstr += 5; } } static void atkE0_trysetsnatch(void) // snatch { - gSpecialStatuses[gBattleAttacker].flag20 = 1; + gSpecialStatuses[gBattleMoveAttacker].flag20 = 1; if (gCurrentTurnActionNumber == gBattlersCount - 1) // moves last turn { gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } else { - gProtectStructs[gBattleAttacker].stealMove = 1; + gProtectStructs[gBattleMoveAttacker].stealMove = 1; gBattlescriptCurrInstr += 5; } } @@ -10268,15 +10268,15 @@ static void atkE1_trygetintimidatetarget(void) PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gBattleMons[gBattleScripting.battler].ability) - for (;gBattleDefender < gBattlersCount; gBattleDefender++) + for (;gBattleMoveTarget < gBattlersCount; gBattleMoveTarget++) { - if (GetBattlerSide(gBattleDefender) == side) + if (GetBattlerSide(gBattleMoveTarget) == side) continue; - if (!(gAbsentBattlerFlags & gBitTable[gBattleDefender])) + if (!(gAbsentBattlerFlags & gBitTable[gBattleMoveTarget])) break; } - if (gBattleDefender >= gBattlersCount) + if (gBattleMoveTarget >= gBattlersCount) gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); else gBattlescriptCurrInstr += 5; @@ -10290,8 +10290,8 @@ static void atkE2_switchoutabilities(void) { case ABILITY_NATURAL_CURE: gBattleMons[gActiveBattler].status1 = 0; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, gBitTable[*(gBattleStruct->field_58 + gActiveBattler)], 4, &gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, gBitTable[*(gBattleStruct->field_58 + gActiveBattler)], 4, &gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); break; } @@ -10426,8 +10426,8 @@ static void atkE6_docastformchangeanimation(void) if (gBattleMons[gActiveBattler].status2 & STATUS2_SUBSTITUTE) *(&gBattleStruct->formToChangeInto) |= 0x80; - EmitBattleAnimation(0, B_ANIM_CASTFORM_CHANGE, gBattleStruct->formToChangeInto); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBattleAnimation(0, B_ANIM_CASTFORM_CHANGE, gBattleStruct->formToChangeInto); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr++; } @@ -10451,18 +10451,18 @@ static void atkE8_settypebasedhalvers(void) // water and mud sport if (gBattleMoves[gCurrentMove].effect == EFFECT_MUD_SPORT) { - if (!(gStatuses3[gBattleAttacker] & STATUS3_MUDSPORT)) + if (!(gStatuses3[gBattleMoveAttacker] & STATUS3_MUDSPORT)) { - gStatuses3[gBattleAttacker] |= STATUS3_MUDSPORT; + gStatuses3[gBattleMoveAttacker] |= STATUS3_MUDSPORT; gBattleCommunication[MULTISTRING_CHOOSER] = 0; worked = TRUE; } } else // water sport { - if (!(gStatuses3[gBattleAttacker] & STATUS3_WATERSPORT)) + if (!(gStatuses3[gBattleMoveAttacker] & STATUS3_WATERSPORT)) { - gStatuses3[gBattleAttacker] |= STATUS3_WATERSPORT; + gStatuses3[gBattleMoveAttacker] |= STATUS3_WATERSPORT; gBattleCommunication[MULTISTRING_CHOOSER] = 1; worked = TRUE; } @@ -10499,7 +10499,7 @@ static void atkEA_tryrecycleitem(void) { u16 *usedHeldItem; - gActiveBattler = gBattleAttacker; + gActiveBattler = gBattleMoveAttacker; usedHeldItem = &gBattleStruct->usedHeldItems[gActiveBattler]; if (*usedHeldItem != 0 && gBattleMons[gActiveBattler].item == 0) { @@ -10507,8 +10507,8 @@ static void atkEA_tryrecycleitem(void) *usedHeldItem = 0; gBattleMons[gActiveBattler].item = gLastUsedItem; - EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gActiveBattler].item); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gActiveBattler].item); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 5; } @@ -10520,11 +10520,11 @@ static void atkEA_tryrecycleitem(void) static void atkEB_settypetoterrain(void) { - if (gBattleMons[gBattleAttacker].type1 != sTerrainToType[gBattleTerrain] - && gBattleMons[gBattleAttacker].type2 != sTerrainToType[gBattleTerrain]) + if (gBattleMons[gBattleMoveAttacker].type1 != sTerrainToType[gBattleTerrain] + && gBattleMons[gBattleMoveAttacker].type2 != sTerrainToType[gBattleTerrain]) { - gBattleMons[gBattleAttacker].type1 = sTerrainToType[gBattleTerrain]; - gBattleMons[gBattleAttacker].type2 = sTerrainToType[gBattleTerrain]; + gBattleMons[gBattleMoveAttacker].type1 = sTerrainToType[gBattleTerrain]; + gBattleMons[gBattleMoveAttacker].type2 = sTerrainToType[gBattleTerrain]; PREPARE_TYPE_BUFFER(gBattleTextBuff1, sTerrainToType[gBattleTerrain]) @@ -10538,7 +10538,7 @@ static void atkEB_settypetoterrain(void) static void atkEC_pursuitrelated(void) { - gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattleAttacker) ^ BIT_FLANK); + gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattleMoveAttacker) ^ BIT_FLANK); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !(gAbsentBattlerFlags & gBitTable[gActiveBattler]) @@ -10549,8 +10549,8 @@ static void atkEC_pursuitrelated(void) gCurrentMove = MOVE_PURSUIT; gBattlescriptCurrInstr += 5; gBattleScripting.animTurn = 1; - gBattleScripting.field_20 = gBattleAttacker; - gBattleAttacker = gActiveBattler; + gBattleScripting.field_20 = gBattleMoveAttacker; + gBattleMoveAttacker = gActiveBattler; } else { @@ -10560,12 +10560,12 @@ static void atkEC_pursuitrelated(void) static void atkEF_snatchsetbanks(void) { - gEffectBank = gBattleAttacker; + gEffectBank = gBattleMoveAttacker; - if (gBattleAttacker == gBattleDefender) - gBattleAttacker = gBattleDefender = gBattleScripting.battler; + if (gBattleMoveAttacker == gBattleMoveTarget) + gBattleMoveAttacker = gBattleMoveTarget = gBattleScripting.battler; else - gBattleDefender = gBattleScripting.battler; + gBattleMoveTarget = gBattleScripting.battler; gBattleScripting.battler = gEffectBank; gBattlescriptCurrInstr++; @@ -10573,7 +10573,7 @@ static void atkEF_snatchsetbanks(void) static void atkEE_removelightscreenreflect(void) // brick break { - u8 opposingSide = GetBattlerSide(gBattleAttacker) ^ BIT_SIDE; + u8 opposingSide = GetBattlerSide(gBattleMoveAttacker) ^ BIT_SIDE; if (gSideTimers[opposingSide].reflectTimer || gSideTimers[opposingSide].lightscreenTimer) { @@ -10597,22 +10597,22 @@ static void atkEF_handleballthrow(void) { u8 ballMultiplier = 0; - if (gBattleExecBuffer) + if (gBattleControllerExecFlags) return; - gActiveBattler = gBattleAttacker; - gBattleDefender = gBattleAttacker ^ BIT_SIDE; + gActiveBattler = gBattleMoveAttacker; + gBattleMoveTarget = gBattleMoveAttacker ^ BIT_SIDE; if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) { - EmitBallThrowAnim(0, BALL_TRAINER_BLOCK); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBallThrowAnim(0, BALL_TRAINER_BLOCK); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr = BattleScript_TrainerBallBlock; } else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) { - EmitBallThrowAnim(0, BALL_3_SHAKES_SUCCESS); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBallThrowAnim(0, BALL_3_SHAKES_SUCCESS); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr = BattleScript_WallyBallThrow; } else @@ -10623,17 +10623,17 @@ static void atkEF_handleballthrow(void) if (gLastUsedItem == ITEM_SAFARI_BALL) catchRate = gBattleStruct->field_7C * 1275 / 100; else - catchRate = gBaseStats[gBattleMons[gBattleDefender].species].catchRate; + catchRate = gBaseStats[gBattleMons[gBattleMoveTarget].species].catchRate; if (gLastUsedItem > ITEM_SAFARI_BALL) { switch (gLastUsedItem) { case ITEM_NET_BALL: - if (gBattleMons[gBattleDefender].type1 == TYPE_WATER - || gBattleMons[gBattleDefender].type2 == TYPE_WATER - || gBattleMons[gBattleDefender].type1 == TYPE_BUG - || gBattleMons[gBattleDefender].type2 == TYPE_BUG) + if (gBattleMons[gBattleMoveTarget].type1 == TYPE_WATER + || gBattleMons[gBattleMoveTarget].type2 == TYPE_WATER + || gBattleMons[gBattleMoveTarget].type1 == TYPE_BUG + || gBattleMons[gBattleMoveTarget].type2 == TYPE_BUG) ballMultiplier = 30; else ballMultiplier = 10; @@ -10645,9 +10645,9 @@ static void atkEF_handleballthrow(void) ballMultiplier = 10; break; case ITEM_NEST_BALL: - if (gBattleMons[gBattleDefender].level < 40) + if (gBattleMons[gBattleMoveTarget].level < 40) { - ballMultiplier = 40 - gBattleMons[gBattleDefender].level; + ballMultiplier = 40 - gBattleMons[gBattleMoveTarget].level; if (ballMultiplier <= 9) ballMultiplier = 10; } @@ -10657,7 +10657,7 @@ static void atkEF_handleballthrow(void) } break; case ITEM_REPEAT_BALL: - if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattleDefender].species), FLAG_GET_CAUGHT)) + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattleMoveTarget].species), FLAG_GET_CAUGHT)) ballMultiplier = 30; else ballMultiplier = 10; @@ -10677,12 +10677,12 @@ static void atkEF_handleballthrow(void) ballMultiplier = sBallCatchBonuses[gLastUsedItem - 2]; odds = (catchRate * ballMultiplier / 10) - * (gBattleMons[gBattleDefender].maxHP * 3 - gBattleMons[gBattleDefender].hp * 2) - / (3 * gBattleMons[gBattleDefender].maxHP); + * (gBattleMons[gBattleMoveTarget].maxHP * 3 - gBattleMons[gBattleMoveTarget].hp * 2) + / (3 * gBattleMons[gBattleMoveTarget].maxHP); - if (gBattleMons[gBattleDefender].status1 & (STATUS1_SLEEP | STATUS1_FREEZE)) + if (gBattleMons[gBattleMoveTarget].status1 & (STATUS1_SLEEP | STATUS1_FREEZE)) odds *= 2; - if (gBattleMons[gBattleDefender].status1 & (STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON)) + if (gBattleMons[gBattleMoveTarget].status1 & (STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON)) odds = (odds * 15) / 10; if (gLastUsedItem != ITEM_SAFARI_BALL) @@ -10700,10 +10700,10 @@ static void atkEF_handleballthrow(void) if (odds > 254) // mon caught { - EmitBallThrowAnim(0, BALL_3_SHAKES_SUCCESS); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBallThrowAnim(0, BALL_3_SHAKES_SUCCESS); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr = BattleScript_SuccessBallThrow; - SetMonData(&gEnemyParty[gBattlePartyID[gBattleDefender]], MON_DATA_POKEBALL, &gLastUsedItem); + SetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveTarget]], MON_DATA_POKEBALL, &gLastUsedItem); if (CalculatePlayerPartyCount() == 6) gBattleCommunication[MULTISTRING_CHOOSER] = 0; @@ -10722,13 +10722,13 @@ static void atkEF_handleballthrow(void) if (gLastUsedItem == ITEM_MASTER_BALL) shakes = BALL_3_SHAKES_SUCCESS; // why calculate the shakes before that check? - EmitBallThrowAnim(0, shakes); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitBallThrowAnim(0, shakes); + MarkBattlerForControllerExec(gActiveBattler); if (shakes == BALL_3_SHAKES_SUCCESS) // mon caught, copy of the code above { gBattlescriptCurrInstr = BattleScript_SuccessBallThrow; - SetMonData(&gEnemyParty[gBattlePartyID[gBattleDefender]], MON_DATA_POKEBALL, &gLastUsedItem); + SetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveTarget]], MON_DATA_POKEBALL, &gLastUsedItem); if (CalculatePlayerPartyCount() == 6) gBattleCommunication[MULTISTRING_CHOOSER] = 0; @@ -10746,18 +10746,18 @@ static void atkEF_handleballthrow(void) static void atkF0_givecaughtmon(void) { - if (GiveMonToPlayer(&gEnemyParty[gBattlePartyID[gBattleAttacker ^ BIT_SIDE]]) != MON_GIVEN_TO_PARTY) + if (GiveMonToPlayer(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker ^ BIT_SIDE]]) != MON_GIVEN_TO_PARTY) { if (!sub_813B21C()) { gBattleCommunication[MULTISTRING_CHOOSER] = 0; StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_STORAGE_UNKNOWN))); - GetMonData(&gEnemyParty[gBattlePartyID[gBattleAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2); + GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2); } else { StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_STORAGE_UNKNOWN))); - GetMonData(&gEnemyParty[gBattlePartyID[gBattleAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2); + GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gStringVar2); StringCopy(gStringVar3, GetBoxNamePtr(get_unknown_box_id())); gBattleCommunication[MULTISTRING_CHOOSER] = 2; } @@ -10766,9 +10766,9 @@ static void atkF0_givecaughtmon(void) gBattleCommunication[MULTISTRING_CHOOSER]++; } - gBattleResults.caughtMonSpecies = GetMonData(&gEnemyParty[gBattlePartyID[gBattleAttacker ^ BIT_SIDE]], MON_DATA_SPECIES, NULL); - GetMonData(&gEnemyParty[gBattlePartyID[gBattleAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleResults.caughtMonNick); - gBattleResults.caughtMonBall = GetMonData(&gEnemyParty[gBattlePartyID[gBattleAttacker ^ BIT_SIDE]], MON_DATA_POKEBALL, NULL); + gBattleResults.caughtMonSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker ^ BIT_SIDE]], MON_DATA_SPECIES, NULL); + GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleResults.caughtMonNick); + gBattleResults.caughtMonBall = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker ^ BIT_SIDE]], MON_DATA_POKEBALL, NULL); gBattlescriptCurrInstr++; } @@ -10804,8 +10804,8 @@ static void atkF2_displaydexinfo(void) { FreeAllWindowBuffers(); gBattleCommunication[TASK_ID] = CreateDexDisplayMonDataTask(SpeciesToNationalPokedexNum(species), - gBattleMons[gBattleDefender].otId, - gBattleMons[gBattleDefender].personality); + gBattleMons[gBattleMoveTarget].otId, + gBattleMons[gBattleMoveTarget].personality); gBattleCommunication[0]++; } break; @@ -10956,13 +10956,13 @@ static void atkF3_trygivecaughtmonnick(void) case 2: if (!gPaletteFade.active) { - GetMonData(&gEnemyParty[gBattlePartyID[gBattleAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick); + GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick); FreeAllWindowBuffers(); DoNamingScreen(NAMING_SCREEN_CAUGHT_MON, gBattleStruct->caughtMonNick, - GetMonData(&gEnemyParty[gBattlePartyID[gBattleAttacker ^ BIT_SIDE]], MON_DATA_SPECIES), - GetMonGender(&gEnemyParty[gBattlePartyID[gBattleAttacker ^ BIT_SIDE]]), - GetMonData(&gEnemyParty[gBattlePartyID[gBattleAttacker ^ BIT_SIDE]], MON_DATA_PERSONALITY, NULL), + GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker ^ BIT_SIDE]], MON_DATA_SPECIES), + GetMonGender(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker ^ BIT_SIDE]]), + GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker ^ BIT_SIDE]], MON_DATA_PERSONALITY, NULL), BattleMainCB2); gBattleCommunication[MULTIUSE_STATE]++; @@ -10971,7 +10971,7 @@ static void atkF3_trygivecaughtmonnick(void) case 3: if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active ) { - SetMonData(&gEnemyParty[gBattlePartyID[gBattleAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick); + SetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker ^ BIT_SIDE]], MON_DATA_NICKNAME, gBattleStruct->caughtMonNick); gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); } break; @@ -10986,13 +10986,13 @@ static void atkF3_trygivecaughtmonnick(void) static void atkF4_subattackerhpbydmg(void) { - gBattleMons[gBattleAttacker].hp -= gBattleMoveDamage; + gBattleMons[gBattleMoveAttacker].hp -= gBattleMoveDamage; gBattlescriptCurrInstr++; } static void atkF5_removeattackerstatus1(void) { - gBattleMons[gBattleAttacker].status1 = 0; + gBattleMons[gBattleMoveAttacker].status1 = 0; gBattlescriptCurrInstr++; } @@ -11010,8 +11010,8 @@ static void atkF7_finishturn(void) static void atkF8_trainerslideout(void) { gActiveBattler = GetBattlerAtPosition(gBattlescriptCurrInstr[1]); - EmitTrainerSlideBack(0); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitTrainerSlideBack(0); + MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 2; } diff --git a/src/battle_util.c b/src/battle_util.c index 135f4f7f2..228727585 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -33,8 +33,8 @@ extern u16 gCurrentMove; extern u16 gLastUsedItem; extern u8 gBattlersCount; extern u32 gStatuses3[MAX_BATTLERS_COUNT]; -extern u8 gBattleAttacker; -extern u8 gBattleDefender; +extern u8 gBattleMoveAttacker; +extern u8 gBattleMoveTarget; extern u8 gAbsentBattlerFlags; extern u16 gBattleWeather; extern u8 gBattleTurnOrder[MAX_BATTLERS_COUNT]; @@ -48,7 +48,7 @@ extern u32 gBattleTypeFlags; extern u16 gLastMoves[MAX_BATTLERS_COUNT]; extern u32 gHitMarker; extern u8 gEffectBank; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBank1; extern u16 gChosenMovesByBanks[MAX_BATTLERS_COUNT]; extern u8 gMoveResultFlags; @@ -56,7 +56,7 @@ extern s32 gTakenDmg[MAX_BATTLERS_COUNT]; extern u8 gTakenDmgBanks[MAX_BATTLERS_COUNT]; extern u8 gLastUsedAbility; extern u8 gCurrentActionFuncId; -extern u32 gBattleExecBuffer; +extern u32 gBattleControllerExecFlags; extern u16 gRandomMove; extern u8 gCurrMovePos; extern u8 gUnknown_020241E9; @@ -79,10 +79,10 @@ u8 GetBattleBank(u8 caseId) switch (caseId) { case BS_GET_TARGET: - ret = gBattleDefender; + ret = gBattleMoveTarget; break; case BS_GET_ATTACKER: - ret = gBattleAttacker; + ret = gBattleMoveAttacker; break; case BS_GET_EFFECT_BANK: ret = gEffectBank; @@ -142,8 +142,8 @@ void PressurePPLose(u8 defender, u8 attacker, u16 move) && !(gDisableStructs[attacker].unk18_b & gBitTable[i])) { gActiveBattler = attacker; - EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + i, 0, 1, &gBattleMons[gActiveBattler].pp[i]); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + i, 0, 1, &gBattleMons[gActiveBattler].pp[i]); + MarkBattlerForControllerExec(gActiveBattler); } } @@ -176,8 +176,8 @@ void PressurePPLoseOnUsingImprision(u8 attacker) && !(gDisableStructs[attacker].unk18_b & gBitTable[imprisionPos])) { gActiveBattler = attacker; - EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + imprisionPos, 0, 1, &gBattleMons[gActiveBattler].pp[imprisionPos]); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + imprisionPos, 0, 1, &gBattleMons[gActiveBattler].pp[imprisionPos]); + MarkBattlerForControllerExec(gActiveBattler); } } @@ -209,37 +209,33 @@ void PressurePPLoseOnUsingPerishSong(u8 attacker) && !(gDisableStructs[attacker].unk18_b & gBitTable[perishSongPos])) { gActiveBattler = attacker; - EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + perishSongPos, 0, 1, &gBattleMons[gActiveBattler].pp[perishSongPos]); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + perishSongPos, 0, 1, &gBattleMons[gActiveBattler].pp[perishSongPos]); + MarkBattlerForControllerExec(gActiveBattler); } } -void MarkAllBufferBanksForExecution(void) // unused +void MarkAllBattlersForControllerExec(void) // unused { s32 i; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { for (i = 0; i < gBattlersCount; i++) - gBattleExecBuffer |= gBitTable[i] << 0x1C; + gBattleControllerExecFlags |= gBitTable[i] << 0x1C; } else { for (i = 0; i < gBattlersCount; i++) - gBattleExecBuffer |= gBitTable[i]; + gBattleControllerExecFlags |= gBitTable[i]; } } -void MarkBufferBankForExecution(u8 battler) +void MarkBattlerForControllerExec(u8 battlerId) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) - { - gBattleExecBuffer |= gBitTable[battler] << 0x1C; - } + gBattleControllerExecFlags |= gBitTable[battlerId] << 0x1C; else - { - gBattleExecBuffer |= gBitTable[battler]; - } + gBattleControllerExecFlags |= gBitTable[battlerId]; } void sub_803F850(u8 arg0) @@ -247,9 +243,9 @@ void sub_803F850(u8 arg0) s32 i; for (i = 0; i < GetLinkPlayerCount(); i++) - gBattleExecBuffer |= gBitTable[arg0] << (i << 2); + gBattleControllerExecFlags |= gBitTable[arg0] << (i << 2); - gBattleExecBuffer &= ~(0x10000000 << arg0); + gBattleControllerExecFlags &= ~(0x10000000 << arg0); } void CancelMultiTurnMoves(u8 battler) @@ -284,8 +280,8 @@ bool8 WasUnableToUseMove(u8 battler) void PrepareStringBattle(u16 stringId, u8 battler) { gActiveBattler = battler; - EmitPrintString(0, stringId); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitPrintString(0, stringId); + MarkBattlerForControllerExec(gActiveBattler); } void ResetSentPokesToOpponentValue(void) @@ -297,7 +293,7 @@ void ResetSentPokesToOpponentValue(void) gSentPokesToOpponent[1] = 0; for (i = 0; i < gBattlersCount; i += 2) - bits |= gBitTable[gBattlePartyID[i]]; + bits |= gBitTable[gBattlerPartyIndexes[i]]; for (i = 1; i < gBattlersCount; i += 2) gSentPokesToOpponent[(i & BIT_FLANK) >> 1] = bits; @@ -316,7 +312,7 @@ void sub_803F9EC(u8 battler) for (i = 0; i < gBattlersCount; i += 2) { if (!(gAbsentBattlerFlags & gBitTable[i])) - bits |= gBitTable[gBattlePartyID[i]]; + bits |= gBitTable[gBattlerPartyIndexes[i]]; } gSentPokesToOpponent[flank] = bits; @@ -333,7 +329,7 @@ void sub_803FA70(u8 battler) { s32 i; for (i = 1; i < gBattlersCount; i++) - gSentPokesToOpponent[(i & BIT_FLANK) >> 1] |= gBitTable[gBattlePartyID[battler]]; + gSentPokesToOpponent[(i & BIT_FLANK) >> 1] |= gBitTable[gBattlerPartyIndexes[battler]]; } } @@ -540,10 +536,10 @@ u8 UpdateTurnCounters(void) u8 effect = 0; s32 i; - for (gBattleAttacker = 0; gBattleAttacker < gBattlersCount && gAbsentBattlerFlags & gBitTable[gBattleAttacker]; gBattleAttacker++) + for (gBattleMoveAttacker = 0; gBattleMoveAttacker < gBattlersCount && gAbsentBattlerFlags & gBitTable[gBattleMoveAttacker]; gBattleMoveAttacker++) { } - for (gBattleDefender = 0; gBattleDefender < gBattlersCount && gAbsentBattlerFlags & gBitTable[gBattleDefender]; gBattleDefender++) + for (gBattleMoveTarget = 0; gBattleMoveTarget < gBattlersCount && gAbsentBattlerFlags & gBitTable[gBattleMoveTarget]; gBattleMoveTarget++) { } @@ -579,7 +575,7 @@ u8 UpdateTurnCounters(void) while (gBattleStruct->turnSideTracker < 2) { sideBank = gBattleStruct->turnSideTracker; - gActiveBattler = gBattleAttacker = gSideTimers[sideBank].reflectBank; + gActiveBattler = gBattleMoveAttacker = gSideTimers[sideBank].reflectBank; if (gSideStatuses[sideBank] & SIDE_STATUS_REFLECT) { if (--gSideTimers[sideBank].reflectTimer == 0) @@ -604,7 +600,7 @@ u8 UpdateTurnCounters(void) while (gBattleStruct->turnSideTracker < 2) { sideBank = gBattleStruct->turnSideTracker; - gActiveBattler = gBattleAttacker = gSideTimers[sideBank].lightscreenBank; + gActiveBattler = gBattleMoveAttacker = gSideTimers[sideBank].lightscreenBank; if (gSideStatuses[sideBank] & SIDE_STATUS_LIGHTSCREEN) { if (--gSideTimers[sideBank].lightscreenTimer == 0) @@ -630,7 +626,7 @@ u8 UpdateTurnCounters(void) while (gBattleStruct->turnSideTracker < 2) { sideBank = gBattleStruct->turnSideTracker; - gActiveBattler = gBattleAttacker = gSideTimers[sideBank].mistBank; + gActiveBattler = gBattleMoveAttacker = gSideTimers[sideBank].mistBank; if (gSideTimers[sideBank].mistTimer != 0 && --gSideTimers[sideBank].mistTimer == 0) { @@ -654,7 +650,7 @@ u8 UpdateTurnCounters(void) while (gBattleStruct->turnSideTracker < 2) { sideBank = gBattleStruct->turnSideTracker; - gActiveBattler = gBattleAttacker = gSideTimers[sideBank].safeguardBank; + gActiveBattler = gBattleMoveAttacker = gSideTimers[sideBank].safeguardBank; if (gSideStatuses[sideBank] & SIDE_STATUS_SAFEGUARD) { if (--gSideTimers[sideBank].safeguardTimer == 0) @@ -682,7 +678,7 @@ u8 UpdateTurnCounters(void) && --gWishFutureKnock.wishCounter[gActiveBattler] == 0 && gBattleMons[gActiveBattler].hp != 0) { - gBattleDefender = gActiveBattler; + gBattleMoveTarget = gActiveBattler; BattleScriptExecute(BattleScript_WishComesTrue); effect++; } @@ -800,7 +796,7 @@ u8 TurnBasedEffects(void) gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20); while (gBattleStruct->turnEffectsBank < gBattlersCount && gBattleStruct->turnEffectsTracker <= TURNBASED_MAX_CASE) { - gActiveBattler = gBattleAttacker = gBattleTurnOrder[gBattleStruct->turnEffectsBank]; + gActiveBattler = gBattleMoveAttacker = gBattleTurnOrder[gBattleStruct->turnEffectsBank]; if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) { gBattleStruct->turnEffectsBank++; @@ -843,12 +839,12 @@ u8 TurnBasedEffects(void) && gBattleMons[gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BANK].hp != 0 && gBattleMons[gActiveBattler].hp != 0) { - gBattleDefender = gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BANK; //funny how the 'target' is actually the bank that receives HP + gBattleMoveTarget = gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BANK; //funny how the 'target' is actually the bank that receives HP gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - gBattleScripting.animArg1 = gBattleDefender; - gBattleScripting.animArg2 = gBattleAttacker; + gBattleScripting.animArg1 = gBattleMoveTarget; + gBattleScripting.animArg2 = gBattleMoveAttacker; BattleScriptExecute(BattleScript_LeechSeedTurnDrain); effect++; } @@ -957,29 +953,29 @@ u8 TurnBasedEffects(void) case 10: // uproar if (gBattleMons[gActiveBattler].status2 & STATUS2_UPROAR) { - for (gBattleAttacker = 0; gBattleAttacker < gBattlersCount; gBattleAttacker++) + for (gBattleMoveAttacker = 0; gBattleMoveAttacker < gBattlersCount; gBattleMoveAttacker++) { - if ((gBattleMons[gBattleAttacker].status1 & STATUS1_SLEEP) - && gBattleMons[gBattleAttacker].ability != ABILITY_SOUNDPROOF) + if ((gBattleMons[gBattleMoveAttacker].status1 & STATUS1_SLEEP) + && gBattleMons[gBattleMoveAttacker].ability != ABILITY_SOUNDPROOF) { - gBattleMons[gBattleAttacker].status1 &= ~(STATUS1_SLEEP); - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[gBattleMoveAttacker].status1 &= ~(STATUS1_SLEEP); + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_NIGHTMARE); gBattleCommunication[MULTISTRING_CHOOSER] = 1; BattleScriptExecute(BattleScript_MonWokeUpInUproar); - gActiveBattler = gBattleAttacker; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); break; } } - if (gBattleAttacker != gBattlersCount) + if (gBattleMoveAttacker != gBattlersCount) { effect = 2; // a pokemon was awaken break; } else { - gBattleAttacker = gActiveBattler; + gBattleMoveAttacker = gActiveBattler; gBattleMons[gActiveBattler].status2 -= 0x10; // uproar timer goes down if (WasUnableToUseMove(gActiveBattler)) { @@ -1092,8 +1088,8 @@ u8 TurnBasedEffects(void) { CancelMultiTurnMoves(gActiveBattler); gBattleMons[gActiveBattler].status1 |= (Random() & 3) + 2; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); gEffectBank = gActiveBattler; BattleScriptExecute(BattleScript_YawnMakesAsleep); effect++; @@ -1142,16 +1138,16 @@ bool8 HandleWishPerishSongOnTurnEnd(void) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gWishFutureKnock.futureSightMove[gActiveBattler]); - gBattleDefender = gActiveBattler; - gBattleAttacker = gWishFutureKnock.futureSightAttacker[gActiveBattler]; + gBattleMoveTarget = gActiveBattler; + gBattleMoveAttacker = gWishFutureKnock.futureSightAttacker[gActiveBattler]; gBattleMoveDamage = gWishFutureKnock.futureSightDmg[gActiveBattler]; - gSpecialStatuses[gBattleDefender].moveturnLostHP = 0xFFFF; + gSpecialStatuses[gBattleMoveTarget].moveturnLostHP = 0xFFFF; BattleScriptExecute(BattleScript_MonTookFutureAttack); if (gWishFutureKnock.futureSightCounter[gActiveBattler] == 0 && gWishFutureKnock.futureSightCounter[gActiveBattler ^ BIT_FLANK] == 0) { - gSideStatuses[GET_BATTLER_SIDE(gBattleDefender)] &= ~(SIDE_STATUS_FUTUREATTACK); + gSideStatuses[GET_BATTLER_SIDE(gBattleMoveTarget)] &= ~(SIDE_STATUS_FUTUREATTACK); } return TRUE; } @@ -1166,7 +1162,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void) case 1: while (gBattleStruct->wishPerishSongBank < gBattlersCount) { - gActiveBattler = gBattleAttacker = gBattleTurnOrder[gBattleStruct->wishPerishSongBank]; + gActiveBattler = gBattleMoveAttacker = gBattleTurnOrder[gBattleStruct->wishPerishSongBank]; if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) { gBattleStruct->wishPerishSongBank++; @@ -1244,9 +1240,9 @@ bool8 HandleFaintedMonActions(void) case 1: do { - gBank1 = gBattleDefender = gBattleStruct->faintedActionsBank; + gBank1 = gBattleMoveTarget = gBattleStruct->faintedActionsBank; if (gBattleMons[gBattleStruct->faintedActionsBank].hp == 0 - && !(gBattleStruct->field_DF & gBitTable[gBattlePartyID[gBattleStruct->faintedActionsBank]]) + && !(gBattleStruct->field_DF & gBitTable[gBattlerPartyIndexes[gBattleStruct->faintedActionsBank]]) && !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBank])) { BattleScriptExecute(BattleScript_GiveExp); @@ -1270,7 +1266,7 @@ bool8 HandleFaintedMonActions(void) case 4: do { - gBank1 = gBattleDefender = gBattleStruct->faintedActionsBank; + gBank1 = gBattleMoveTarget = gBattleStruct->faintedActionsBank; if (gBattleMons[gBattleStruct->faintedActionsBank].hp == 0 && !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBank])) { @@ -1320,17 +1316,17 @@ u8 AtkCanceller_UnableToUseMove(void) switch (gBattleStruct->atkCancellerTracker) { case 0: // flags clear - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_DESTINY_BOND); - gStatuses3[gBattleAttacker] &= ~(STATUS3_GRUDGE); + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_DESTINY_BOND); + gStatuses3[gBattleMoveAttacker] &= ~(STATUS3_GRUDGE); gBattleStruct->atkCancellerTracker++; break; case 1: // check being asleep - if (gBattleMons[gBattleAttacker].status1 & STATUS1_SLEEP) + if (gBattleMons[gBattleMoveAttacker].status1 & STATUS1_SLEEP) { - if (UproarWakeUpCheck(gBattleAttacker)) + if (UproarWakeUpCheck(gBattleMoveAttacker)) { - gBattleMons[gBattleAttacker].status1 &= ~(STATUS1_SLEEP); - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[gBattleMoveAttacker].status1 &= ~(STATUS1_SLEEP); + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_NIGHTMARE); BattleScriptPushCursor(); gBattleCommunication[MULTISTRING_CHOOSER] = 1; gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; @@ -1339,15 +1335,15 @@ u8 AtkCanceller_UnableToUseMove(void) else { u8 toSub; - if (gBattleMons[gBattleAttacker].ability == ABILITY_EARLY_BIRD) + if (gBattleMons[gBattleMoveAttacker].ability == ABILITY_EARLY_BIRD) toSub = 2; else toSub = 1; - if ((gBattleMons[gBattleAttacker].status1 & STATUS1_SLEEP) < toSub) - gBattleMons[gBattleAttacker].status1 &= ~(STATUS1_SLEEP); + if ((gBattleMons[gBattleMoveAttacker].status1 & STATUS1_SLEEP) < toSub) + gBattleMons[gBattleMoveAttacker].status1 &= ~(STATUS1_SLEEP); else - gBattleMons[gBattleAttacker].status1 -= toSub; - if (gBattleMons[gBattleAttacker].status1 & STATUS1_SLEEP) + gBattleMons[gBattleMoveAttacker].status1 -= toSub; + if (gBattleMons[gBattleMoveAttacker].status1 & STATUS1_SLEEP) { if (gCurrentMove != MOVE_SNORE && gCurrentMove != MOVE_SLEEP_TALK) { @@ -1358,7 +1354,7 @@ u8 AtkCanceller_UnableToUseMove(void) } else { - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_NIGHTMARE); BattleScriptPushCursor(); gBattleCommunication[MULTISTRING_CHOOSER] = 0; gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; @@ -1369,7 +1365,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 2: // check being frozen - if (gBattleMons[gBattleAttacker].status1 & STATUS1_FREEZE) + if (gBattleMons[gBattleMoveAttacker].status1 & STATUS1_FREEZE) { if (Random() % 5) { @@ -1386,7 +1382,7 @@ u8 AtkCanceller_UnableToUseMove(void) } else // unfreeze { - gBattleMons[gBattleAttacker].status1 &= ~(STATUS1_FREEZE); + gBattleMons[gBattleMoveAttacker].status1 &= ~(STATUS1_FREEZE); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze; gBattleCommunication[MULTISTRING_CHOOSER] = 0; @@ -1396,9 +1392,9 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 3: // truant - if (gBattleMons[gBattleAttacker].ability == ABILITY_TRUANT && gDisableStructs[gBattleAttacker].truantCounter) + if (gBattleMons[gBattleMoveAttacker].ability == ABILITY_TRUANT && gDisableStructs[gBattleMoveAttacker].truantCounter) { - CancelMultiTurnMoves(gBattleAttacker); + CancelMultiTurnMoves(gBattleMoveAttacker); gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; gBattleCommunication[MULTISTRING_CHOOSER] = 0; gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; @@ -1408,11 +1404,11 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 4: // recharge - if (gBattleMons[gBattleAttacker].status2 & STATUS2_RECHARGE) + if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_RECHARGE) { - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_RECHARGE); - gDisableStructs[gBattleAttacker].rechargeCounter = 0; - CancelMultiTurnMoves(gBattleAttacker); + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_RECHARGE); + gDisableStructs[gBattleMoveAttacker].rechargeCounter = 0; + CancelMultiTurnMoves(gBattleMoveAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedMustRecharge; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; @@ -1420,11 +1416,11 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 5: // flinch - if (gBattleMons[gBattleAttacker].status2 & STATUS2_FLINCHED) + if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_FLINCHED) { - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_FLINCHED); - gProtectStructs[gBattleAttacker].flinchImmobility = 1; - CancelMultiTurnMoves(gBattleAttacker); + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_FLINCHED); + gProtectStructs[gBattleMoveAttacker].flinchImmobility = 1; + CancelMultiTurnMoves(gBattleMoveAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedFlinched; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; @@ -1432,11 +1428,11 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 6: // disabled move - if (gDisableStructs[gBattleAttacker].disabledMove == gCurrentMove && gDisableStructs[gBattleAttacker].disabledMove != 0) + if (gDisableStructs[gBattleMoveAttacker].disabledMove == gCurrentMove && gDisableStructs[gBattleMoveAttacker].disabledMove != 0) { - gProtectStructs[gBattleAttacker].usedDisabledMove = 1; - gBattleScripting.battler = gBattleAttacker; - CancelMultiTurnMoves(gBattleAttacker); + gProtectStructs[gBattleMoveAttacker].usedDisabledMove = 1; + gBattleScripting.battler = gBattleMoveAttacker; + CancelMultiTurnMoves(gBattleMoveAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsDisabled; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; @@ -1444,10 +1440,10 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 7: // taunt - if (gDisableStructs[gBattleAttacker].tauntTimer1 && gBattleMoves[gCurrentMove].power == 0) + if (gDisableStructs[gBattleMoveAttacker].tauntTimer1 && gBattleMoves[gCurrentMove].power == 0) { - gProtectStructs[gBattleAttacker].usedTauntedMove = 1; - CancelMultiTurnMoves(gBattleAttacker); + gProtectStructs[gBattleMoveAttacker].usedTauntedMove = 1; + CancelMultiTurnMoves(gBattleMoveAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsTaunted; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; @@ -1455,10 +1451,10 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 8: // imprisoned - if (GetImprisonedMovesCount(gBattleAttacker, gCurrentMove)) + if (GetImprisonedMovesCount(gBattleMoveAttacker, gCurrentMove)) { - gProtectStructs[gBattleAttacker].usedImprisionedMove = 1; - CancelMultiTurnMoves(gBattleAttacker); + gProtectStructs[gBattleMoveAttacker].usedImprisionedMove = 1; + CancelMultiTurnMoves(gBattleMoveAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsImprisoned; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; @@ -1466,10 +1462,10 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 9: // confusion - if (gBattleMons[gBattleAttacker].status2 & STATUS2_CONFUSION) + if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_CONFUSION) { - gBattleMons[gBattleAttacker].status2--; - if (gBattleMons[gBattleAttacker].status2 & STATUS2_CONFUSION) + gBattleMons[gBattleMoveAttacker].status2--; + if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_CONFUSION) { if (Random() & 1) { @@ -1479,9 +1475,9 @@ u8 AtkCanceller_UnableToUseMove(void) else // confusion dmg { gBattleCommunication[MULTISTRING_CHOOSER] = 1; - gBattleDefender = gBattleAttacker; - gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattleAttacker], &gBattleMons[gBattleAttacker], MOVE_POUND, 0, 40, 0, gBattleAttacker, gBattleAttacker); - gProtectStructs[gBattleAttacker].confusionSelfDmg = 1; + gBattleMoveTarget = gBattleMoveAttacker; + gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattleMoveAttacker], &gBattleMons[gBattleMoveAttacker], MOVE_POUND, 0, 40, 0, gBattleMoveAttacker, gBattleMoveAttacker); + gProtectStructs[gBattleMoveAttacker].confusionSelfDmg = 1; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; } gBattlescriptCurrInstr = BattleScript_MoveUsedIsConfused; @@ -1496,11 +1492,11 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 10: // paralysis - if ((gBattleMons[gBattleAttacker].status1 & STATUS1_PARALYSIS) && (Random() % 4) == 0) + if ((gBattleMons[gBattleMoveAttacker].status1 & STATUS1_PARALYSIS) && (Random() % 4) == 0) { - gProtectStructs[gBattleAttacker].prlzImmobility = 1; + gProtectStructs[gBattleMoveAttacker].prlzImmobility = 1; // This is removed in Emerald for some reason - //CancelMultiTurnMoves(gBattleAttacker); + //CancelMultiTurnMoves(gBattleMoveAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsParalyzed; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; @@ -1508,17 +1504,17 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 11: // infatuation - if (gBattleMons[gBattleAttacker].status2 & STATUS2_INFATUATION) + if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_INFATUATION) { - gBattleScripting.battler = CountTrailingZeroBits((gBattleMons[gBattleAttacker].status2 & STATUS2_INFATUATION) >> 0x10); + gBattleScripting.battler = CountTrailingZeroBits((gBattleMons[gBattleMoveAttacker].status2 & STATUS2_INFATUATION) >> 0x10); if (Random() & 1) BattleScriptPushCursor(); else { BattleScriptPush(BattleScript_MoveUsedIsParalyzedCantAttack); gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; - gProtectStructs[gBattleAttacker].loveImmobility = 1; - CancelMultiTurnMoves(gBattleAttacker); + gProtectStructs[gBattleMoveAttacker].loveImmobility = 1; + CancelMultiTurnMoves(gBattleMoveAttacker); } gBattlescriptCurrInstr = BattleScript_MoveUsedIsInLove; effect = 1; @@ -1526,22 +1522,22 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 12: // bide - if (gBattleMons[gBattleAttacker].status2 & STATUS2_BIDE) + if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_BIDE) { - gBattleMons[gBattleAttacker].status2 -= 0x100; - if (gBattleMons[gBattleAttacker].status2 & STATUS2_BIDE) + gBattleMons[gBattleMoveAttacker].status2 -= 0x100; + if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_BIDE) gBattlescriptCurrInstr = BattleScript_BideStoringEnergy; else { // This is removed in Emerald for some reason - //gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_MULTIPLETURNS); - if (gTakenDmg[gBattleAttacker]) + //gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_MULTIPLETURNS); + if (gTakenDmg[gBattleMoveAttacker]) { gCurrentMove = MOVE_BIDE; - *bideDmg = gTakenDmg[gBattleAttacker] * 2; - gBattleDefender = gTakenDmgBanks[gBattleAttacker]; - if (gAbsentBattlerFlags & gBitTable[gBattleDefender]) - gBattleDefender = GetMoveTarget(MOVE_BIDE, 1); + *bideDmg = gTakenDmg[gBattleMoveAttacker] * 2; + gBattleMoveTarget = gTakenDmgBanks[gBattleMoveAttacker]; + if (gAbsentBattlerFlags & gBitTable[gBattleMoveTarget]) + gBattleMoveTarget = GetMoveTarget(MOVE_BIDE, 1); gBattlescriptCurrInstr = BattleScript_BideAttack; } else @@ -1552,11 +1548,11 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case 13: // move thawing - if (gBattleMons[gBattleAttacker].status1 & STATUS1_FREEZE) + if (gBattleMons[gBattleMoveAttacker].status1 & STATUS1_FREEZE) { if (gBattleMoves[gCurrentMove].effect == EFFECT_THAW_HIT) { - gBattleMons[gBattleAttacker].status1 &= ~(STATUS1_FREEZE); + gBattleMons[gBattleMoveAttacker].status1 &= ~(STATUS1_FREEZE); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze; gBattleCommunication[MULTISTRING_CHOOSER] = 1; @@ -1573,9 +1569,9 @@ u8 AtkCanceller_UnableToUseMove(void) if (effect == 2) { - gActiveBattler = gBattleAttacker; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + gActiveBattler = gBattleMoveAttacker; + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); } return effect; } @@ -1611,7 +1607,7 @@ bool8 sub_80423F4(u8 battler, u8 r1, u8 r2) if (GetBattlerSide(battler) == B_SIDE_PLAYER) { party = gPlayerParty; - r7 = GetBankMultiplayerId(battler); + r7 = GetBattlerMultiplayerId(battler); r6 = sub_806D82C(r7); } else @@ -1630,7 +1626,7 @@ bool8 sub_80423F4(u8 battler, u8 r1, u8 r2) } else { - r7 = GetBankMultiplayerId(battler); + r7 = GetBattlerMultiplayerId(battler); if (GetBattlerSide(battler) == B_SIDE_PLAYER) party = gPlayerParty; else @@ -1678,9 +1674,9 @@ bool8 sub_80423F4(u8 battler, u8 r1, u8 r2) party = gPlayerParty; } if (r1 == 6) - r1 = gBattlePartyID[r7]; + r1 = gBattlerPartyIndexes[r7]; if (r2 == 6) - r2 = gBattlePartyID[r6]; + r2 = gBattlerPartyIndexes[r6]; for (i = 0; i < 6; i++) { if (GetMonData(&party[i], MON_DATA_HP) != 0 @@ -1754,19 +1750,19 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA u32 pidAtk; u32 pidDef; - if (gBattleAttacker >= gBattlersCount) - gBattleAttacker = battler; - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) - pokeAtk = &gPlayerParty[gBattlePartyID[gBattleAttacker]]; + if (gBattleMoveAttacker >= gBattlersCount) + gBattleMoveAttacker = battler; + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) + pokeAtk = &gPlayerParty[gBattlerPartyIndexes[gBattleMoveAttacker]]; else - pokeAtk = &gEnemyParty[gBattlePartyID[gBattleAttacker]]; + pokeAtk = &gEnemyParty[gBattlerPartyIndexes[gBattleMoveAttacker]]; - if (gBattleDefender >= gBattlersCount) - gBattleDefender = battler; - if (GetBattlerSide(gBattleDefender) == B_SIDE_PLAYER) - pokeDef = &gPlayerParty[gBattlePartyID[gBattleDefender]]; + if (gBattleMoveTarget >= gBattlersCount) + gBattleMoveTarget = battler; + if (GetBattlerSide(gBattleMoveTarget) == B_SIDE_PLAYER) + pokeDef = &gPlayerParty[gBattlerPartyIndexes[gBattleMoveTarget]]; else - pokeDef = &gEnemyParty[gBattlePartyID[gBattleDefender]]; + pokeDef = &gEnemyParty[gBattlerPartyIndexes[gBattleMoveTarget]]; speciesAtk = GetMonData(pokeAtk, MON_DATA_SPECIES); pidAtk = GetMonData(pokeAtk, MON_DATA_PERSONALITY); @@ -1797,8 +1793,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA switch (caseID) { case ABILITYEFFECT_ON_SWITCHIN: // 0 - if (gBattleAttacker >= gBattlersCount) - gBattleAttacker = battler; + if (gBattleMoveAttacker >= gBattlersCount) + gBattleMoveAttacker = battler; switch (gLastUsedAbility) { case ABILITYEFFECT_SWITCH_IN_WEATHER: @@ -1915,7 +1911,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA case ABILITYEFFECT_ENDTURN: // 1 if (gBattleMons[battler].hp != 0) { - gBattleAttacker = battler; + gBattleMoveAttacker = battler; switch (gLastUsedAbility) { case ABILITY_RAIN_DISH: @@ -1948,8 +1944,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleMons[battler].status2 &= ~(STATUS2_NIGHTMARE); // fix nightmare glitch gBattleScripting.battler = gActiveBattler = battler; BattleScriptPushCursorAndCallback(BattleScript_ShedSkinActivates); - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + MarkBattlerForControllerExec(gActiveBattler); effect++; } break; @@ -1965,7 +1961,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } break; case ABILITY_TRUANT: - gDisableStructs[gBattleAttacker].truantCounter ^= 1; + gDisableStructs[gBattleMoveAttacker].truantCounter ^= 1; break; } } @@ -1980,7 +1976,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } if (sSoundMovesTable[i] != 0xFFFF) { - if (gBattleMons[gBattleAttacker].status2 & STATUS2_MULTIPLETURNS) + if (gBattleMons[gBattleMoveAttacker].status2 & STATUS2_MULTIPLETURNS) gHitMarker |= HITMARKER_NO_PPDEDUCT; gBattlescriptCurrInstr = BattleScript_SoundproofProtected; effect = 1; @@ -1995,7 +1991,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA case ABILITY_VOLT_ABSORB: if (moveType == TYPE_ELECTRIC && gBattleMoves[move].power != 0) { - if (gProtectStructs[gBattleAttacker].notFirstStrike) + if (gProtectStructs[gBattleMoveAttacker].notFirstStrike) gBattlescriptCurrInstr = BattleScript_MoveHPDrain; else gBattlescriptCurrInstr = BattleScript_MoveHPDrain_PPLoss; @@ -2006,7 +2002,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA case ABILITY_WATER_ABSORB: if (moveType == TYPE_WATER && gBattleMoves[move].power != 0) { - if (gProtectStructs[gBattleAttacker].notFirstStrike) + if (gProtectStructs[gBattleMoveAttacker].notFirstStrike) gBattlescriptCurrInstr = BattleScript_MoveHPDrain; else gBattlescriptCurrInstr = BattleScript_MoveHPDrain_PPLoss; @@ -2020,7 +2016,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (!(gBattleResources->flags->flags[battler] & UNKNOWN_FLAG_FLASH_FIRE)) { gBattleCommunication[MULTISTRING_CHOOSER] = 0; - if (gProtectStructs[gBattleAttacker].notFirstStrike) + if (gProtectStructs[gBattleMoveAttacker].notFirstStrike) gBattlescriptCurrInstr = BattleScript_FlashFireBoost; else gBattlescriptCurrInstr = BattleScript_FlashFireBoost_PPLoss; @@ -2031,7 +2027,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA else { gBattleCommunication[MULTISTRING_CHOOSER] = 1; - if (gProtectStructs[gBattleAttacker].notFirstStrike) + if (gProtectStructs[gBattleMoveAttacker].notFirstStrike) gBattlescriptCurrInstr = BattleScript_FlashFireBoost; else gBattlescriptCurrInstr = BattleScript_FlashFireBoost_PPLoss; @@ -2045,7 +2041,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA { if (gBattleMons[battler].maxHP == gBattleMons[battler].hp) { - if ((gProtectStructs[gBattleAttacker].notFirstStrike)) + if ((gProtectStructs[gBattleMoveAttacker].notFirstStrike)) gBattlescriptCurrInstr = BattleScript_MonMadeMoveUseless; else gBattlescriptCurrInstr = BattleScript_MonMadeMoveUseless_PPLoss; @@ -2067,7 +2063,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && move != MOVE_STRUGGLE && gBattleMoves[move].power != 0 - && (gSpecialStatuses[gBattleDefender].moveturnLostHP_physical || gSpecialStatuses[gBattleDefender].moveturnLostHP_special) + && (gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_physical || gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_special) && gBattleMons[battler].type1 != moveType && gBattleMons[battler].type2 != moveType && gBattleMons[battler].hp != 0) @@ -2082,12 +2078,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; case ABILITY_ROUGH_SKIN: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && gBattleMons[gBattleAttacker].hp != 0 - && !gProtectStructs[gBattleAttacker].confusionSelfDmg - && (gSpecialStatuses[gBattleDefender].moveturnLostHP_physical || gSpecialStatuses[gBattleDefender].moveturnLostHP_special) + && gBattleMons[gBattleMoveAttacker].hp != 0 + && !gProtectStructs[gBattleMoveAttacker].confusionSelfDmg + && (gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_physical || gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_special) && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) { - gBattleMoveDamage = gBattleMons[gBattleAttacker].maxHP / 16; + gBattleMoveDamage = gBattleMons[gBattleMoveAttacker].maxHP / 16; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; BattleScriptPushCursor(); @@ -2097,9 +2093,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; case ABILITY_EFFECT_SPORE: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && gBattleMons[gBattleAttacker].hp != 0 - && !gProtectStructs[gBattleAttacker].confusionSelfDmg - && (gSpecialStatuses[gBattleDefender].moveturnLostHP_physical || gSpecialStatuses[gBattleDefender].moveturnLostHP_special) + && gBattleMons[gBattleMoveAttacker].hp != 0 + && !gProtectStructs[gBattleMoveAttacker].confusionSelfDmg + && (gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_physical || gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_special) && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) && (Random() % 10) == 0) { @@ -2120,9 +2116,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; case ABILITY_POISON_POINT: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && gBattleMons[gBattleAttacker].hp != 0 - && !gProtectStructs[gBattleAttacker].confusionSelfDmg - && (gSpecialStatuses[gBattleDefender].moveturnLostHP_physical || gSpecialStatuses[gBattleDefender].moveturnLostHP_special) + && gBattleMons[gBattleMoveAttacker].hp != 0 + && !gProtectStructs[gBattleMoveAttacker].confusionSelfDmg + && (gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_physical || gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_special) && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) && (Random() % 3) == 0) { @@ -2135,9 +2131,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; case ABILITY_STATIC: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && gBattleMons[gBattleAttacker].hp != 0 - && !gProtectStructs[gBattleAttacker].confusionSelfDmg - && (gSpecialStatuses[gBattleDefender].moveturnLostHP_physical || gSpecialStatuses[gBattleDefender].moveturnLostHP_special) + && gBattleMons[gBattleMoveAttacker].hp != 0 + && !gProtectStructs[gBattleMoveAttacker].confusionSelfDmg + && (gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_physical || gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_special) && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) && (Random() % 3) == 0) { @@ -2150,10 +2146,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; case ABILITY_FLAME_BODY: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && gBattleMons[gBattleAttacker].hp != 0 - && !gProtectStructs[gBattleAttacker].confusionSelfDmg + && gBattleMons[gBattleMoveAttacker].hp != 0 + && !gProtectStructs[gBattleMoveAttacker].confusionSelfDmg && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) - && (gSpecialStatuses[gBattleDefender].moveturnLostHP_physical || gSpecialStatuses[gBattleDefender].moveturnLostHP_special) + && (gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_physical || gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_special) && (Random() % 3) == 0) { gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN; @@ -2165,19 +2161,19 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; case ABILITY_CUTE_CHARM: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && gBattleMons[gBattleAttacker].hp != 0 - && !gProtectStructs[gBattleAttacker].confusionSelfDmg + && gBattleMons[gBattleMoveAttacker].hp != 0 + && !gProtectStructs[gBattleMoveAttacker].confusionSelfDmg && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) - && (gSpecialStatuses[gBattleDefender].moveturnLostHP_physical || gSpecialStatuses[gBattleDefender].moveturnLostHP_special) - && gBattleMons[gBattleDefender].hp != 0 + && (gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_physical || gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_special) + && gBattleMons[gBattleMoveTarget].hp != 0 && (Random() % 3) == 0 - && gBattleMons[gBattleAttacker].ability != ABILITY_OBLIVIOUS + && gBattleMons[gBattleMoveAttacker].ability != ABILITY_OBLIVIOUS && GetGenderFromSpeciesAndPersonality(speciesAtk, pidAtk) != GetGenderFromSpeciesAndPersonality(speciesDef, pidDef) - && !(gBattleMons[gBattleAttacker].status2 & STATUS2_INFATUATION) + && !(gBattleMons[gBattleMoveAttacker].status2 & STATUS2_INFATUATION) && GetGenderFromSpeciesAndPersonality(speciesAtk, pidAtk) != MON_GENDERLESS && GetGenderFromSpeciesAndPersonality(speciesDef, pidDef) != MON_GENDERLESS) { - gBattleMons[gBattleAttacker].status2 |= STATUS2_INFATUATED_WITH(gBattleDefender); + gBattleMons[gBattleMoveAttacker].status2 |= STATUS2_INFATUATED_WITH(gBattleMoveTarget); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_CuteCharmActivates; effect++; @@ -2261,8 +2257,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattlescriptCurrInstr = BattleScript_AbilityCuredStatus; gBattleScripting.battler = battler; gActiveBattler = battler; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); return effect; } } @@ -2292,7 +2288,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON; gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleStruct->synchronizeMoveEffect + MOVE_EFFECT_AFFECTS_USER; - gBattleScripting.battler = gBattleDefender; + gBattleScripting.battler = gBattleMoveTarget; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; @@ -2308,7 +2304,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON; gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleStruct->synchronizeMoveEffect; - gBattleScripting.battler = gBattleAttacker; + gBattleScripting.battler = gBattleMoveAttacker; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; @@ -2379,7 +2375,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gStatuses3[i] &= ~(STATUS3_TRACE); gBattleScripting.battler = i; - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattlePartyID[gActiveBattler]) + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattlerPartyIndexes[gActiveBattler]) PREPARE_ABILITY_BUFFER(gBattleTextBuff2, gLastUsedAbility) break; } @@ -2560,11 +2556,11 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) bankQuality = ItemId_GetHoldEffectParam(gLastUsedItem); } - atkItem = gBattleMons[gBattleAttacker].item; + atkItem = gBattleMons[gBattleMoveAttacker].item; if (atkItem == ITEM_ENIGMA_BERRY) { - atkHoldEffect = gEnigmaBerries[gBattleAttacker].holdEffect; - atkQuality = gEnigmaBerries[gBattleAttacker].holdEffectParam; + atkHoldEffect = gEnigmaBerries[gBattleMoveAttacker].holdEffect; + atkQuality = gEnigmaBerries[gBattleMoveAttacker].holdEffectParam; } else { @@ -2573,11 +2569,11 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) } // def variables are unused - defItem = gBattleMons[gBattleDefender].item; + defItem = gBattleMons[gBattleMoveTarget].item; if (defItem == ITEM_ENIGMA_BERRY) { - defHoldEffect = gEnigmaBerries[gBattleDefender].holdEffect; - defQuality = gEnigmaBerries[gBattleDefender].holdEffectParam; + defHoldEffect = gEnigmaBerries[gBattleMoveTarget].holdEffect; + defQuality = gEnigmaBerries[gBattleMoveTarget].holdEffectParam; } else { @@ -2607,7 +2603,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) { gBattleScripting.battler = bank; gStringBank = bank; - gActiveBattler = gBattleAttacker = bank; + gActiveBattler = gBattleMoveAttacker = bank; BattleScriptExecute(BattleScript_WhiteHerbEnd2); } break; @@ -2637,9 +2633,9 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) u16 move; if (GetBattlerSide(bank) == B_SIDE_PLAYER) - mon = &gPlayerParty[gBattlePartyID[bank]]; + mon = &gPlayerParty[gBattlerPartyIndexes[bank]]; else - mon = &gEnemyParty[gBattlePartyID[bank]]; + mon = &gEnemyParty[gBattlerPartyIndexes[bank]]; for (i = 0; i < 4; i++) { move = GetMonData(mon, MON_DATA_MOVE1 + i); @@ -2659,8 +2655,8 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) PREPARE_MOVE_BUFFER(gBattleTextBuff1, move); BattleScriptExecute(BattleScript_BerryPPHealEnd2); - EmitSetMonData(0, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP); + MarkBattlerForControllerExec(gActiveBattler); effect = ITEM_PP_CHANGE; } } @@ -2678,7 +2674,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) { gBattleScripting.battler = bank; gStringBank = bank; - gActiveBattler = gBattleAttacker = bank; + gActiveBattler = gBattleMoveAttacker = bank; BattleScriptExecute(BattleScript_WhiteHerbEnd2); } break; @@ -3006,12 +3002,12 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) { gBattleScripting.battler = bank; gStringBank = bank; - gActiveBattler = gBattleAttacker = bank; + gActiveBattler = gBattleMoveAttacker = bank; switch (effect) { case ITEM_STATUS_CHANGE: - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[bank].status1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[bank].status1); + MarkBattlerForControllerExec(gActiveBattler); break; case ITEM_PP_CHANGE: if (!(gBattleMons[bank].status2 & STATUS2_TRANSFORMED) && !(gDisableStructs[bank].unk18_b & gBitTable[i])) @@ -3165,8 +3161,8 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) gBattleScripting.battler = bank; gStringBank = bank; gActiveBattler = bank; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); break; } } @@ -3178,10 +3174,10 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) { case HOLD_EFFECT_FLINCH: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && (gSpecialStatuses[gBattleDefender].moveturnLostHP_physical || gSpecialStatuses[gBattleDefender].moveturnLostHP_special) + && (gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_physical || gSpecialStatuses[gBattleMoveTarget].moveturnLostHP_special) && (Random() % 100) < atkQuality && gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED - && gBattleMons[gBattleDefender].hp) + && gBattleMons[gBattleMoveTarget].hp) { gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_FLINCH; BattleScriptPushCursor(); @@ -3191,19 +3187,19 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) break; case HOLD_EFFECT_SHELL_BELL: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && gSpecialStatuses[gBattleDefender].moveturnLostHP != 0 - && gSpecialStatuses[gBattleDefender].moveturnLostHP != 0xFFFF - && gBattleAttacker != gBattleDefender - && gBattleMons[gBattleAttacker].hp != gBattleMons[gBattleAttacker].maxHP - && gBattleMons[gBattleAttacker].hp != 0) + && gSpecialStatuses[gBattleMoveTarget].moveturnLostHP != 0 + && gSpecialStatuses[gBattleMoveTarget].moveturnLostHP != 0xFFFF + && gBattleMoveAttacker != gBattleMoveTarget + && gBattleMons[gBattleMoveAttacker].hp != gBattleMons[gBattleMoveAttacker].maxHP + && gBattleMons[gBattleMoveAttacker].hp != 0) { gLastUsedItem = atkItem; - gStringBank = gBattleAttacker; - gBattleScripting.battler = gBattleAttacker; - gBattleMoveDamage = (gSpecialStatuses[gBattleDefender].moveturnLostHP / atkQuality) * -1; + gStringBank = gBattleMoveAttacker; + gBattleScripting.battler = gBattleMoveAttacker; + gBattleMoveDamage = (gSpecialStatuses[gBattleMoveTarget].moveturnLostHP / atkQuality) * -1; if (gBattleMoveDamage == 0) gBattleMoveDamage = -1; - gSpecialStatuses[gBattleDefender].moveturnLostHP = 0; + gSpecialStatuses[gBattleMoveTarget].moveturnLostHP = 0; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ItemHealHP_Ret; effect++; @@ -3226,7 +3222,7 @@ void ClearFuryCutterDestinyBondGrudge(u8 bank) void HandleAction_RunBattleScript(void) // identical to RunBattleScriptCommands { - if (gBattleExecBuffer == 0) + if (gBattleControllerExecFlags == 0) gBattleScriptingCommandsTable[*gBattlescriptCurrInstr](); } @@ -3244,18 +3240,18 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget) switch (moveTarget) { case MOVE_TARGET_SELECTED: - side = GetBattlerSide(gBattleAttacker) ^ BIT_SIDE; + side = GetBattlerSide(gBattleMoveAttacker) ^ BIT_SIDE; if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp) targetBank = gSideTimers[side].followmeTarget; else { - side = GetBattlerSide(gBattleAttacker); + side = GetBattlerSide(gBattleMoveAttacker); do { targetBank = Random() % gBattlersCount; - } while (targetBank == gBattleAttacker || side == GetBattlerSide(targetBank) || gAbsentBattlerFlags & gBitTable[targetBank]); + } while (targetBank == gBattleMoveAttacker || side == GetBattlerSide(targetBank) || gAbsentBattlerFlags & gBitTable[targetBank]); if (gBattleMoves[move].type == TYPE_ELECTRIC - && AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIDE, gBattleAttacker, ABILITY_LIGHTNING_ROD, 0, 0) + && AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIDE, gBattleMoveAttacker, ABILITY_LIGHTNING_ROD, 0, 0) && gBattleMons[targetBank].ability != ABILITY_LIGHTNING_ROD) { targetBank ^= BIT_FLANK; @@ -3268,17 +3264,17 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget) case MOVE_TARGET_BOTH: case MOVE_TARGET_FOES_AND_ALLY: case MOVE_TARGET_OPPONENTS_FIELD: - targetBank = GetBattlerAtPosition((GetBattlerPosition(gBattleAttacker) & BIT_SIDE) ^ BIT_SIDE); + targetBank = GetBattlerAtPosition((GetBattlerPosition(gBattleMoveAttacker) & BIT_SIDE) ^ BIT_SIDE); if (gAbsentBattlerFlags & gBitTable[targetBank]) targetBank ^= BIT_FLANK; break; case MOVE_TARGET_RANDOM: - side = GetBattlerSide(gBattleAttacker) ^ BIT_SIDE; + side = GetBattlerSide(gBattleMoveAttacker) ^ BIT_SIDE; if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp) targetBank = gSideTimers[side].followmeTarget; else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM) { - if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_PLAYER) { if (Random() & 1) targetBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); @@ -3296,15 +3292,15 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget) targetBank ^= BIT_FLANK; } else - targetBank = GetBattlerAtPosition((GetBattlerPosition(gBattleAttacker) & BIT_SIDE) ^ BIT_SIDE); + targetBank = GetBattlerAtPosition((GetBattlerPosition(gBattleMoveAttacker) & BIT_SIDE) ^ BIT_SIDE); break; case MOVE_TARGET_USER: case MOVE_TARGET_x10: - targetBank = gBattleAttacker; + targetBank = gBattleMoveAttacker; break; } - *(gBattleStruct->moveTarget + gBattleAttacker) = targetBank; + *(gBattleStruct->moveTarget + gBattleMoveAttacker) = targetBank; return targetBank; } @@ -3313,10 +3309,10 @@ static bool32 HasObedientBitSet(u8 bank) { if (GetBattlerSide(bank) == B_SIDE_OPPONENT) return TRUE; - if (GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS - && GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES, NULL) != SPECIES_MEW) + if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS + && GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES, NULL) != SPECIES_MEW) return TRUE; - return GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_OBEDIENCE, NULL); + return GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_OBEDIENCE, NULL); } u8 IsMonDisobedient(void) @@ -3327,18 +3323,18 @@ u8 IsMonDisobedient(void) if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) return 0; - if (GetBattlerSide(gBattleAttacker) == B_SIDE_OPPONENT) + if (GetBattlerSide(gBattleMoveAttacker) == B_SIDE_OPPONENT) return 0; - if (HasObedientBitSet(gBattleAttacker)) // only if species is Mew or Deoxys + if (HasObedientBitSet(gBattleMoveAttacker)) // only if species is Mew or Deoxys { - if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gBattleAttacker) == 2) + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gBattleMoveAttacker) == 2) return 0; if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) return 0; if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) return 0; - if (!IsOtherTrainer(gBattleMons[gBattleAttacker].otId, gBattleMons[gBattleAttacker].otName)) + if (!IsOtherTrainer(gBattleMons[gBattleMoveAttacker].otId, gBattleMons[gBattleMoveAttacker].otName)) return 0; if (FlagGet(FLAG_BADGE08_GET)) return 0; @@ -3353,27 +3349,27 @@ u8 IsMonDisobedient(void) obedienceLevel = 70; } - if (gBattleMons[gBattleAttacker].level <= obedienceLevel) + if (gBattleMons[gBattleMoveAttacker].level <= obedienceLevel) return 0; rnd = (Random() & 255); - calc = (gBattleMons[gBattleAttacker].level + obedienceLevel) * rnd >> 8; + calc = (gBattleMons[gBattleMoveAttacker].level + obedienceLevel) * rnd >> 8; if (calc < obedienceLevel) return 0; // is not obedient if (gCurrentMove == MOVE_RAGE) - gBattleMons[gBattleAttacker].status2 &= ~(STATUS2_RAGE); - if (gBattleMons[gBattleAttacker].status1 & STATUS1_SLEEP && (gCurrentMove == MOVE_SNORE || gCurrentMove == MOVE_SLEEP_TALK)) + gBattleMons[gBattleMoveAttacker].status2 &= ~(STATUS2_RAGE); + if (gBattleMons[gBattleMoveAttacker].status1 & STATUS1_SLEEP && (gCurrentMove == MOVE_SNORE || gCurrentMove == MOVE_SLEEP_TALK)) { gBattlescriptCurrInstr = BattleScript_82DB695; return 1; } rnd = (Random() & 255); - calc = (gBattleMons[gBattleAttacker].level + obedienceLevel) * rnd >> 8; + calc = (gBattleMons[gBattleMoveAttacker].level + obedienceLevel) * rnd >> 8; if (calc < obedienceLevel) { - calc = CheckMoveLimitations(gBattleAttacker, gBitTable[gCurrMovePos], 0xFF); + calc = CheckMoveLimitations(gBattleMoveAttacker, gBitTable[gCurrMovePos], 0xFF); if (calc == 0xF) // all moves cannot be used { gBattleCommunication[MULTISTRING_CHOOSER] = Random() & 3; @@ -3387,19 +3383,19 @@ u8 IsMonDisobedient(void) gCurrMovePos = gUnknown_020241E9 = Random() & 3; } while (gBitTable[gCurrMovePos] & calc); - gRandomMove = gBattleMons[gBattleAttacker].moves[gCurrMovePos]; + gRandomMove = gBattleMons[gBattleMoveAttacker].moves[gCurrMovePos]; gBattlescriptCurrInstr = BattleScript_IgnoresAndUsesRandomMove; - gBattleDefender = GetMoveTarget(gRandomMove, 0); + gBattleMoveTarget = GetMoveTarget(gRandomMove, 0); gHitMarker |= HITMARKER_x200000; return 2; } } else { - obedienceLevel = gBattleMons[gBattleAttacker].level - obedienceLevel; + obedienceLevel = gBattleMons[gBattleMoveAttacker].level - obedienceLevel; calc = (Random() & 255); - if (calc < obedienceLevel && !(gBattleMons[gBattleAttacker].status1 & STATUS1_ANY) && gBattleMons[gBattleAttacker].ability != ABILITY_VITAL_SPIRIT && gBattleMons[gBattleAttacker].ability != ABILITY_INSOMNIA) + if (calc < obedienceLevel && !(gBattleMons[gBattleMoveAttacker].status1 & STATUS1_ANY) && gBattleMons[gBattleMoveAttacker].ability != ABILITY_VITAL_SPIRIT && gBattleMons[gBattleMoveAttacker].ability != ABILITY_INSOMNIA) { // try putting asleep int i; @@ -3417,8 +3413,8 @@ u8 IsMonDisobedient(void) calc -= obedienceLevel; if (calc < obedienceLevel) { - gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattleAttacker], &gBattleMons[gBattleAttacker], MOVE_POUND, 0, 40, 0, gBattleAttacker, gBattleAttacker); - gBattleDefender = gBattleAttacker; + gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattleMoveAttacker], &gBattleMons[gBattleMoveAttacker], MOVE_POUND, 0, 40, 0, gBattleMoveAttacker, gBattleMoveAttacker); + gBattleMoveTarget = gBattleMoveAttacker; gBattlescriptCurrInstr = BattleScript_82DB6F0; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; return 2; diff --git a/src/battle_util2.c b/src/battle_util2.c index 5c7434aa0..ba42d4ea9 100644 --- a/src/battle_util2.c +++ b/src/battle_util2.c @@ -9,7 +9,7 @@ #include "battle_scripts.h" extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gUnknown_0203CF00[]; extern const u8 *gBattlescriptCurrInstr; extern u8 gBattleCommunication[]; @@ -101,13 +101,13 @@ void AdjustFriendshipOnBattleFaint(u8 bank) if (gBattleMons[opposingBank].level > gBattleMons[bank].level) { if (gBattleMons[opposingBank].level - gBattleMons[bank].level > 29) - AdjustFriendship(&gPlayerParty[gBattlePartyID[bank]], 8); + AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[bank]], 8); else - AdjustFriendship(&gPlayerParty[gBattlePartyID[bank]], 6); + AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[bank]], 6); } else { - AdjustFriendship(&gPlayerParty[gBattlePartyID[bank]], 6); + AdjustFriendship(&gPlayerParty[gBattlerPartyIndexes[bank]], 6); } } @@ -122,7 +122,7 @@ void sub_80571DC(u8 bank, u8 arg1) for (i = 0; i < 3; i++) gUnknown_0203CF00[i] = *(0 * 3 + i + (u8*)(gBattleStruct->field_60)); - sub_81B8FB0(pokemon_order_func(gBattlePartyID[bank]), pokemon_order_func(arg1)); + sub_81B8FB0(pokemon_order_func(gBattlerPartyIndexes[bank]), pokemon_order_func(arg1)); for (i = 0; i < 3; i++) *(0 * 3 + i + (u8*)(gBattleStruct->field_60)) = gUnknown_0203CF00[i]; @@ -207,8 +207,8 @@ u32 sub_805725C(u8 bank) if (effect == 2) { gActiveBattler = bank; - EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); - MarkBufferBankForExecution(gActiveBattler); + BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + MarkBattlerForControllerExec(gActiveBattler); } return effect; diff --git a/src/item_use.c b/src/item_use.c index 8fe705a50..9cb2a4546 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -89,7 +89,7 @@ extern void flagmods_08054D70(void); extern u8* sub_806CF78(u16); extern bool8 ExecuteTableBasedItemEffect_(struct Pokemon*, u16, u8, u8); extern u8 gBankInMenu; -extern u16 gBattlePartyID[]; +extern u16 gBattlerPartyIndexes[]; extern void sub_81B89F0(void); extern u8 GetItemEffectType(u16); @@ -1131,7 +1131,7 @@ void sub_80FE440(u8 taskId) void ItemUseInBattle_StatIncrease(u8 taskId) { - u16 partyId = gBattlePartyID[gBankInMenu]; + u16 partyId = gBattlerPartyIndexes[gBankInMenu]; if (ExecuteTableBasedItemEffect_(&gPlayerParty[partyId], gSpecialVar_ItemId, partyId, 0) != FALSE) { diff --git a/src/pokeball.c b/src/pokeball.c index 424ecb0eb..87802d6ba 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -17,10 +17,10 @@ extern bool8 gDoingBattleAnim; extern u8 gActiveBattler; -extern u8 gBattleDefender; -extern u16 gBattlePartyID[]; -extern u8 gBankSpriteIds[]; -extern u8 gHealthBoxesIds[]; +extern u8 gBattleMoveTarget; +extern u16 gBattlerPartyIndexes[]; +extern u8 gBattlerSpriteIds[]; +extern u8 gHealthboxSpriteIds[]; extern struct MusicPlayerInfo gMPlayInfo_BGM; // this file's functions @@ -364,9 +364,9 @@ static void Task_DoPokeballSendOutAnim(u8 taskId) bank = gTasks[taskId].tBank; if (GetBattlerSide(bank) != B_SIDE_PLAYER) - itemId = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_POKEBALL); + itemId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL); else - itemId = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_POKEBALL); + itemId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL); ballId = ItemIdToBallId(itemId); LoadBallGfx(ballId); @@ -378,25 +378,25 @@ static void Task_DoPokeballSendOutAnim(u8 taskId) switch (throwCaseId) { case POKEBALL_PLAYER_SENDOUT: - gBattleDefender = bank; + gBattleMoveTarget = bank; gSprites[ballSpriteId].pos1.x = 24; gSprites[ballSpriteId].pos1.y = 68; gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1; break; case POKEBALL_OPPONENT_SENDOUT: - gSprites[ballSpriteId].pos1.x = GetBankCoord(bank, BANK_X_POS); - gSprites[ballSpriteId].pos1.y = GetBankCoord(bank, BANK_Y_POS) + 24; - gBattleDefender = bank; + gSprites[ballSpriteId].pos1.x = GetBattlerSpriteCoord(bank, BANK_X_POS); + gSprites[ballSpriteId].pos1.y = GetBattlerSpriteCoord(bank, BANK_Y_POS) + 24; + gBattleMoveTarget = bank; gSprites[ballSpriteId].data[0] = 0; gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut; break; default: - gBattleDefender = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + gBattleMoveTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); notSendOut = TRUE; break; } - gSprites[ballSpriteId].sBank = gBattleDefender; + gSprites[ballSpriteId].sBank = gBattleMoveTarget; if (!notSendOut) { DestroyTask(taskId); @@ -405,12 +405,12 @@ static void Task_DoPokeballSendOutAnim(u8 taskId) // this will perform an unused ball throw animation gSprites[ballSpriteId].data[0] = 0x22; - gSprites[ballSpriteId].data[2] = GetBankCoord(gBattleDefender, BANK_X_POS); - gSprites[ballSpriteId].data[4] = GetBankCoord(gBattleDefender, BANK_Y_POS) - 16; + gSprites[ballSpriteId].data[2] = GetBattlerSpriteCoord(gBattleMoveTarget, BANK_X_POS); + gSprites[ballSpriteId].data[4] = GetBattlerSpriteCoord(gBattleMoveTarget, BANK_Y_POS) - 16; gSprites[ballSpriteId].data[5] = -40; sub_80A68D4(&gSprites[ballSpriteId]); gSprites[ballSpriteId].oam.affineParam = taskId; - gTasks[taskId].tOpponentBank = gBattleDefender; + gTasks[taskId].tOpponentBank = gBattleMoveTarget; gTasks[taskId].func = TaskDummy; PlaySE(SE_NAGERU); } @@ -458,9 +458,9 @@ static void sub_80756E0(struct Sprite *sprite) { sprite->data[5] = 0; sprite->callback = sub_807574C; - StartSpriteAffineAnim(&gSprites[gBankSpriteIds[sprite->sBank]], 2); - AnimateSprite(&gSprites[gBankSpriteIds[sprite->sBank]]); - gSprites[gBankSpriteIds[sprite->sBank]].data[1] = 0; + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBank]], 2); + AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBank]]); + gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] = 0; } } @@ -469,17 +469,17 @@ static void sub_807574C(struct Sprite *sprite) sprite->data[5]++; if (sprite->data[5] == 11) PlaySE(SE_SUIKOMU); - if (gSprites[gBankSpriteIds[sprite->sBank]].affineAnimEnded) + if (gSprites[gBattlerSpriteIds[sprite->sBank]].affineAnimEnded) { StartSpriteAnim(sprite, 2); - gSprites[gBankSpriteIds[sprite->sBank]].invisible = TRUE; + gSprites[gBattlerSpriteIds[sprite->sBank]].invisible = TRUE; sprite->data[5] = 0; sprite->callback = sub_80757E4; } else { - gSprites[gBankSpriteIds[sprite->sBank]].data[1] += 0x60; - gSprites[gBankSpriteIds[sprite->sBank]].pos2.y = -gSprites[gBankSpriteIds[sprite->sBank]].data[1] >> 8; + gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] += 0x60; + gSprites[gBattlerSpriteIds[sprite->sBank]].pos2.y = -gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] >> 8; } } @@ -757,12 +757,12 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) if (GetBattlerSide(bank) != B_SIDE_PLAYER) { - mon = &gEnemyParty[gBattlePartyID[bank]]; + mon = &gEnemyParty[gBattlerPartyIndexes[bank]]; pan = 25; } else { - mon = &gPlayerParty[gBattlePartyID[bank]]; + mon = &gPlayerParty[gBattlerPartyIndexes[bank]]; pan = -25; } @@ -795,21 +795,21 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) gTasks[taskId].tCryTaskPan = pan; gTasks[taskId].tCryTaskWantedCry = wantedCryCase; gTasks[taskId].tCryTaskBank = bank; - gTasks[taskId].tCryTaskMonSpriteId = gBankSpriteIds[sprite->sBank]; + gTasks[taskId].tCryTaskMonSpriteId = gBattlerSpriteIds[sprite->sBank]; gTasks[taskId].tCryTaskMonPtr1 = (u32)(mon) >> 0x10; gTasks[taskId].tCryTaskMonPtr2 = (u32)(mon); gTasks[taskId].tCryTaskState = 0; } - StartSpriteAffineAnim(&gSprites[gBankSpriteIds[sprite->sBank]], 1); + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBank]], 1); if (GetBattlerSide(sprite->sBank) == B_SIDE_OPPONENT) - gSprites[gBankSpriteIds[sprite->sBank]].callback = sub_8039B58; + gSprites[gBattlerSpriteIds[sprite->sBank]].callback = sub_8039B58; else - gSprites[gBankSpriteIds[sprite->sBank]].callback = sub_8039E44; + gSprites[gBattlerSpriteIds[sprite->sBank]].callback = sub_8039E44; - AnimateSprite(&gSprites[gBankSpriteIds[sprite->sBank]]); - gSprites[gBankSpriteIds[sprite->sBank]].data[1] = 0x1000; + AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBank]]); + gSprites[gBattlerSpriteIds[sprite->sBank]].data[1] = 0x1000; } #undef tCryTaskSpecies @@ -836,24 +836,24 @@ static void HandleBallAnimEnd(struct Sprite *sprite) bool8 affineAnimEnded = FALSE; u8 bank = sprite->sBank; - gSprites[gBankSpriteIds[bank]].invisible = FALSE; + gSprites[gBattlerSpriteIds[bank]].invisible = FALSE; if (sprite->animEnded) sprite->invisible = TRUE; - if (gSprites[gBankSpriteIds[bank]].affineAnimEnded) + if (gSprites[gBattlerSpriteIds[bank]].affineAnimEnded) { - StartSpriteAffineAnim(&gSprites[gBankSpriteIds[bank]], 0); + StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[bank]], 0); affineAnimEnded = TRUE; } else { - gSprites[gBankSpriteIds[bank]].data[1] -= 288; - gSprites[gBankSpriteIds[bank]].pos2.y = gSprites[gBankSpriteIds[bank]].data[1] >> 8; + gSprites[gBattlerSpriteIds[bank]].data[1] -= 288; + gSprites[gBattlerSpriteIds[bank]].pos2.y = gSprites[gBattlerSpriteIds[bank]].data[1] >> 8; } if (sprite->animEnded && affineAnimEnded) { s32 i, doneBanks; - gSprites[gBankSpriteIds[bank]].pos2.y = 0; + gSprites[gBattlerSpriteIds[bank]].pos2.y = 0; gDoingBattleAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[bank].ballAnimActive = 0; FreeSpriteOamMatrix(sprite); @@ -889,8 +889,8 @@ static void sub_80760F8(struct Sprite *sprite) } else if (sprite->data[4] == 315) { - FreeOamMatrix(gSprites[gBankSpriteIds[sprite->sBank]].oam.matrixNum); - DestroySprite(&gSprites[gBankSpriteIds[sprite->sBank]]); + FreeOamMatrix(gSprites[gBattlerSpriteIds[sprite->sBank]].oam.matrixNum); + DestroySprite(&gSprites[gBattlerSpriteIds[sprite->sBank]]); DestroySpriteAndFreeResources(sprite); if (gMain.inBattle) gBattleSpritesDataPtr->healthBoxesData[bank].ballAnimActive = 0; @@ -900,8 +900,8 @@ static void sub_80760F8(struct Sprite *sprite) static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite) { sprite->data[0] = 25; - sprite->data[2] = GetBankCoord(sprite->sBank, 2); - sprite->data[4] = GetBankCoord(sprite->sBank, 3) + 24; + sprite->data[2] = GetBattlerSpriteCoord(sprite->sBank, 2); + sprite->data[4] = GetBattlerSpriteCoord(sprite->sBank, 3) + 24; sprite->data[5] = -30; sprite->oam.affineParam = sprite->sBank; sub_80A68D4(sprite); @@ -1183,7 +1183,7 @@ static void DestroySpriteAndFreeResources_(struct Sprite *sprite) void sub_8076918(u8 bank) { - struct Sprite *healthboxSprite = &gSprites[gHealthBoxesIds[bank]]; + struct Sprite *healthboxSprite = &gSprites[gHealthboxSpriteIds[bank]]; healthboxSprite->data[0] = 5; healthboxSprite->data[1] = 0; @@ -1226,7 +1226,7 @@ void DoHitAnimHealthboxEffect(u8 bank) spriteId = CreateInvisibleSpriteWithCallback(SpriteCB_HitAnimHealthoxEffect); gSprites[spriteId].data[0] = 1; - gSprites[spriteId].data[1] = gHealthBoxesIds[bank]; + gSprites[spriteId].data[1] = gHealthboxSpriteIds[bank]; gSprites[spriteId].callback = SpriteCB_HitAnimHealthoxEffect; } @@ -1276,7 +1276,7 @@ void FreeBallGfx(u8 ballId) static u16 GetBankPokeballItemId(u8 bank) { if (GetBattlerSide(bank) == B_SIDE_PLAYER) - return GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_POKEBALL); + return GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL); else - return GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_POKEBALL); + return GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_POKEBALL); } diff --git a/src/pokemon_2.c b/src/pokemon_2.c index d4ccd5ca1..4e3364486 100644 --- a/src/pokemon_2.c +++ b/src/pokemon_2.c @@ -16,8 +16,8 @@ struct Unknown_020249B4 extern u8 gAbsentBattlerFlags; extern u8 gActiveBattler; -extern u8 gBattleAttacker; -extern u8 gBattleDefender; +extern u8 gBattleMoveAttacker; +extern u8 gBattleMoveTarget; extern u8 gLastUsedAbility; extern u16 gTrainerBattleOpponent_A; extern u32 gBattleTypeFlags; @@ -55,14 +55,14 @@ u8 CountAliveMonsInBattle(u8 caseId) case BATTLE_ALIVE_ATK_SIDE: for (i = 0; i < 4; i++) { - if (GetBattlerSide(i) == GetBattlerSide(gBattleAttacker) && !(gAbsentBattlerFlags & gBitTable[i])) + if (GetBattlerSide(i) == GetBattlerSide(gBattleMoveAttacker) && !(gAbsentBattlerFlags & gBitTable[i])) retVal++; } break; case BATTLE_ALIVE_DEF_SIDE: for (i = 0; i < 4; i++) { - if (GetBattlerSide(i) == GetBattlerSide(gBattleDefender) && !(gAbsentBattlerFlags & gBitTable[i])) + if (GetBattlerSide(i) == GetBattlerSide(gBattleMoveTarget) && !(gAbsentBattlerFlags & gBitTable[i])) retVal++; } break; diff --git a/src/pokemon_3.c b/src/pokemon_3.c index d6413c455..e11afa91e 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -27,13 +27,13 @@ extern struct BattlePokemon gBattleMons[4]; extern struct BattleEnigmaBerry gEnigmaBerries[4]; extern u8 gActiveBattler; extern u8 gBankInMenu; -extern u8 gBattleDefender; -extern u8 gBattleAttacker; +extern u8 gBattleMoveTarget; +extern u8 gBattleMoveAttacker; extern u8 gStringBank; extern u16 gTrainerBattleOpponent_A; extern u32 gBattleTypeFlags; extern u8 gBattleMonForms[4]; -extern u16 gBattlePartyID[4]; +extern u16 gBattlerPartyIndexes[4]; extern u8 gLastUsedAbility; extern u16 gPartnerTrainerId; extern u32 gHitMarker; @@ -210,7 +210,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit) void sub_806CF24(s32 stat) { - gBattleDefender = gBankInMenu; + gBattleMoveTarget = gBankInMenu; StringCopy(gBattleTextBuff1, gStatNamesTable[gUnknown_08329EC8[stat]]); StringCopy(gBattleTextBuff2, gText_StatRose); BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnsStatChanged2); @@ -247,7 +247,7 @@ u8 *sub_806CF78(u16 itemId) } else { - gBattleAttacker = gBankInMenu; + gBattleMoveAttacker = gBankInMenu; BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnGettingPumped); } } @@ -255,7 +255,7 @@ u8 *sub_806CF78(u16 itemId) if (itemEffect[3] & 0x80) { - gBattleAttacker = gBankInMenu; + gBattleMoveAttacker = gBankInMenu; BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnShroudedInMist); } @@ -615,7 +615,7 @@ bool16 sub_806D82C(u8 id) return retVal; } -s32 GetBankMultiplayerId(u16 a1) +s32 GetBattlerMultiplayerId(u16 a1) { s32 id; for (id = 0; id < MAX_LINK_PLAYERS; id++) @@ -1367,11 +1367,11 @@ void sub_806E994(void) gBattleTextBuff1[4] = B_BUFF_EOS; if (!GetBattlerSide(gBattleStruct->field_49)) - gBattleTextBuff1[3] = pokemon_order_func(gBattlePartyID[gBattleStruct->field_49]); + gBattleTextBuff1[3] = pokemon_order_func(gBattlerPartyIndexes[gBattleStruct->field_49]); else - gBattleTextBuff1[3] = gBattlePartyID[gBattleStruct->field_49]; + gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->field_49]; - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBankInMenu, pokemon_order_func(gBattlePartyID[gBankInMenu])) + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBankInMenu, pokemon_order_func(gBattlerPartyIndexes[gBankInMenu])) BattleStringExpandPlaceholders(gText_PkmnsXPreventsSwitching, gStringVar4); } @@ -1478,7 +1478,7 @@ const u8 *GetTrainerPartnerName(void) else { u8 id = GetMultiplayerId(); - return gLinkPlayers[GetBankMultiplayerId(gLinkPlayers[id].lp_field_18 ^ 2)].name; + return gLinkPlayers[GetBattlerMultiplayerId(gLinkPlayers[id].lp_field_18 ^ 2)].name; } } diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 2bd4e3ef9..02755fe40 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -16,7 +16,7 @@ struct UnkAnimStruct s16 field_8; }; -extern u16 gBattlePartyID[]; +extern u16 gBattlerPartyIndexes[]; // this file's functions static void pokemonanimfunc_00(struct Sprite *sprite); @@ -945,7 +945,7 @@ void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimSet) gTasks[taskId].tPtrHI = (u32)(sprite); bank = sprite->data[0]; - nature = GetNature(&gPlayerParty[gBattlePartyID[bank]]); + nature = GetNature(&gPlayerParty[gBattlerPartyIndexes[bank]]); animId = 3 * backAnimSet + sBackAnimNatureModTable[nature]; gTasks[taskId].tAnimId = sBackAnimationIds[animId]; diff --git a/src/recorded_battle.c b/src/recorded_battle.c index cd54495fc..34611b509 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -27,7 +27,7 @@ extern u16 gTrainerBattleOpponent_B; extern u16 gPartnerTrainerId; extern u8 gActiveBattler; extern u8 gBattlersCount; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; extern u16 gChosenMovesByBanks[MAX_BATTLERS_COUNT]; extern u8 gUnknown_03001278; @@ -200,7 +200,7 @@ void sub_8184E58(void) } } -void RecordedBattle_SetBankAction(u8 bank, u8 action) +void RecordedBattle_SetBattlerAction(u8 bank, u8 action) { if (sRecordedBytesNo[bank] < BANK_RECORD_SIZE && sUnknown_0203C7AC != 2) { @@ -208,7 +208,7 @@ void RecordedBattle_SetBankAction(u8 bank, u8 action) } } -void RecordedBattle_ClearBankAction(u8 bank, u8 bytesToClear) +void RecordedBattle_ClearBattlerAction(u8 bank, u8 bytesToClear) { s32 i; @@ -221,7 +221,7 @@ void RecordedBattle_ClearBankAction(u8 bank, u8 bytesToClear) } } -u8 RecordedBattle_ReadBankAction(u8 bank) +u8 RecordedBattle_GetBankAction(u8 bank) { // trying to read past array or invalid action byte, battle is over if (sRecordedBytesNo[bank] >= BANK_RECORD_SIZE || sBattleRecords[bank][sRecordedBytesNo[bank]] == 0xFF) @@ -1536,14 +1536,14 @@ void sub_818603C(u8 arg0) } if (j != 4) // player's mon's move has been changed { - RecordedBattle_SetBankAction(bank, ACTION_MOVE_CHANGE); + RecordedBattle_SetBattlerAction(bank, ACTION_MOVE_CHANGE); for (j = 0; j < 4; j++) { for (k = 0; k < 4; k++) { if (gBattleMons[bank].moves[j] == sRecordedBattle_PlayerMonMoves[bank / 2][k]) { - RecordedBattle_SetBankAction(bank, k); + RecordedBattle_SetBattlerAction(bank, k); break; } } @@ -1561,14 +1561,14 @@ void sub_818603C(u8 arg0) u8 array3[8]; u8 var; - RecordedBattle_ReadBankAction(bank); + RecordedBattle_GetBankAction(bank); for (j = 0; j < 4; j++) { ppBonuses[j] = ((gBattleMons[bank].ppBonuses & ((3 << (j << 1)))) >> (j << 1)); } for (j = 0; j < 4; j++) { - array1[j] = RecordedBattle_ReadBankAction(bank); + array1[j] = RecordedBattle_GetBankAction(bank); movePp.moves[j] = gBattleMons[bank].moves[array1[j]]; movePp.pp[j] = gBattleMons[bank].pp[array1[j]]; array3[j] = ppBonuses[array1[j]]; @@ -1591,25 +1591,25 @@ void sub_818603C(u8 arg0) { for (j = 0; j < 4; j++) { - ppBonuses[j] = ((GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_PP_BONUSES, NULL) & ((3 << (j << 1)))) >> (j << 1)); + ppBonuses[j] = ((GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_PP_BONUSES, NULL) & ((3 << (j << 1)))) >> (j << 1)); } for (j = 0; j < 4; j++) { - movePp.moves[j] = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_MOVE1 + array1[j], NULL); - movePp.pp[j] = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_PP1 + array1[j], NULL); + movePp.moves[j] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_MOVE1 + array1[j], NULL); + movePp.pp[j] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_PP1 + array1[j], NULL); array3[j] = ppBonuses[array1[j]]; } for (j = 0; j < 4; j++) { - SetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_MOVE1 + j, &movePp.moves[j]); - SetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_PP1 + j, &movePp.pp[j]); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_MOVE1 + j, &movePp.moves[j]); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_PP1 + j, &movePp.pp[j]); } var = 0; for (j = 0; j < 4; j++) { var |= (array3[j]) << (j << 1); } - SetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_PP_BONUSES, &var); + SetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_PP_BONUSES, &var); } gChosenMovesByBanks[bank] = gBattleMons[bank].moves[*(gBattleStruct->chosenMovePositions + bank)]; diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 92a9c4074..c1e37a9ac 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -24,12 +24,12 @@ extern u16 gBattle_BG3_Y; extern u8 gReservedSpritePaletteCount; extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; extern u8 gBankInMenu; -extern u16 gBattlePartyID[MAX_BATTLERS_COUNT]; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattlersCount; extern u32 gBattleTypeFlags; -extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT]; +extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; -extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT]; +extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern struct SpriteTemplate gUnknown_0202499C; extern const union AnimCmd * const * const gMonAnimationsSpriteAnimsPtrTable[]; @@ -38,11 +38,11 @@ extern void ScanlineEffect_Clear(void); extern void sub_8035658(void); extern bool8 IsDoubleBattle(void); extern u8 GetSubstituteSpriteDefault_Y(u8 bank); -extern u8 GetBankSpriteDefault_Y(u8 bank); +extern u8 GetBattlerSpriteDefault_Y(u8 bank); extern u8 sub_80A82E4(u8 bank); extern void sub_806A068(u16 species, u8 bankIdentity); extern void sub_806A12C(u16 backPicId, u8 bankIdentity); -extern u8 GetBankCoord(u8 bank, u8 caseId); +extern u8 GetBattlerSpriteCoord(u8 bank, u8 caseId); // this file's functions static void CB2_ReshowBattleScreenAfterMenu(void); @@ -165,14 +165,14 @@ static void CB2_ReshowBattleScreenAfterMenu(void) LoadAndCreateEnemyShadowSprites(); opponentBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - species = GetMonData(&gEnemyParty[gBattlePartyID[opponentBank]], MON_DATA_SPECIES); - SetBankEnemyShadowSpriteCallback(opponentBank, species); + species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[opponentBank]], MON_DATA_SPECIES); + SetBattlerShadowSpriteCallback(opponentBank, species); if (IsDoubleBattle()) { opponentBank = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); - species = GetMonData(&gEnemyParty[gBattlePartyID[opponentBank]], MON_DATA_SPECIES); - SetBankEnemyShadowSpriteCallback(opponentBank, species); + species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[opponentBank]], MON_DATA_SPECIES); + SetBattlerShadowSpriteCallback(opponentBank, species); } ActionSelectionCreateCursorAt(gActionSelectionCursor[gBankInMenu], 0); @@ -215,7 +215,7 @@ static bool8 LoadBankSpriteGfx(u8 bank) if (GetBattlerSide(bank) != B_SIDE_PLAYER) { if (!gBattleSpritesDataPtr->bankData[bank].behindSubstitute) - BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); + BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[bank]], bank); else BattleLoadSubstituteOrMonSpriteGfx(bank, FALSE); } @@ -224,7 +224,7 @@ static bool8 LoadBankSpriteGfx(u8 bank) else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && bank == 0) DecompressTrainerBackPic(BACK_PIC_WALLY, bank); else if (!gBattleSpritesDataPtr->bankData[bank].behindSubstitute) - BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[bank]], bank); + BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[bank]], bank); else BattleLoadSubstituteOrMonSpriteGfx(bank, FALSE); @@ -252,62 +252,62 @@ static void CreateBankSprite(u8 bank) if (gBattleSpritesDataPtr->bankData[bank].behindSubstitute) posY = GetSubstituteSpriteDefault_Y(bank); else - posY = GetBankSpriteDefault_Y(bank); + posY = GetBattlerSpriteDefault_Y(bank); if (GetBattlerSide(bank) != B_SIDE_PLAYER) { - if (GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_HP) == 0) + if (GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_HP) == 0) return; - sub_806A068(GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBattlerPosition(bank)); - gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBankCoord(bank, 2), posY, sub_80A82E4(bank)); - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; - gSprites[gBankSpriteIds[bank]].data[0] = bank; - gSprites[gBankSpriteIds[bank]].data[2] = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + sub_806A068(GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES), GetBattlerPosition(bank)); + gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBattlerSpriteCoord(bank, 2), posY, sub_80A82E4(bank)); + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].data[2] = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES); - StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]); if (gBattleSpritesDataPtr->bankData[bank].transformSpecies == SPECIES_CASTFORM) - gSprites[gBankSpriteIds[bank]].anims = gMonAnimationsSpriteAnimsPtrTable[SPECIES_CASTFORM]; + gSprites[gBattlerSpriteIds[bank]].anims = gMonAnimationsSpriteAnimsPtrTable[SPECIES_CASTFORM]; } else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && bank == 0) { sub_806A12C(gSaveBlock2Ptr->playerGender, GetBattlerPosition(B_POSITION_PLAYER_LEFT)); - gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, 0x50, + gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, 0x50, (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80, sub_80A82E4(0)); - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; - gSprites[gBankSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; } else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && bank == 0) { sub_806A12C(BACK_PIC_WALLY, GetBattlerPosition(0)); - gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, 0x50, + gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, 0x50, (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords) * 4 + 80, sub_80A82E4(0)); - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; - gSprites[gBankSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; } else { - if (GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_HP) == 0) + if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_HP) == 0) return; - sub_806A068(GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBattlerPosition(bank)); - gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBankCoord(bank, 2), posY, sub_80A82E4(bank)); - gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; - gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; - gSprites[gBankSpriteIds[bank]].data[0] = bank; - gSprites[gBankSpriteIds[bank]].data[2] = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); + sub_806A068(GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES), GetBattlerPosition(bank)); + gBattlerSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBattlerSpriteCoord(bank, 2), posY, sub_80A82E4(bank)); + gSprites[gBattlerSpriteIds[bank]].oam.paletteNum = bank; + gSprites[gBattlerSpriteIds[bank]].callback = SpriteCallbackDummy; + gSprites[gBattlerSpriteIds[bank]].data[0] = bank; + gSprites[gBattlerSpriteIds[bank]].data[2] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_SPECIES); - StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]); + StartSpriteAnim(&gSprites[gBattlerSpriteIds[bank]], gBattleMonForms[bank]); if (gBattleSpritesDataPtr->bankData[bank].transformSpecies == SPECIES_CASTFORM) - gSprites[gBankSpriteIds[bank]].anims = gMonAnimationsSpriteAnimsPtrTable[SPECIES_CASTFORM]; + gSprites[gBattlerSpriteIds[bank]].anims = gMonAnimationsSpriteAnimsPtrTable[SPECIES_CASTFORM]; } - gSprites[gBankSpriteIds[bank]].invisible = gBattleSpritesDataPtr->bankData[bank].invisible; + gSprites[gBattlerSpriteIds[bank]].invisible = gBattleSpritesDataPtr->bankData[bank].invisible; } } @@ -322,32 +322,32 @@ static void CreateHealthboxSprite(u8 bank) else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && bank == 0) return; else - healthboxSpriteId = CreateBankHealthboxSprites(bank); + healthboxSpriteId = CreateHealthboxSprites(bank); - gHealthBoxesIds[bank] = healthboxSpriteId; - SetBankHealthboxSpritePos(bank); + gHealthboxSpriteIds[bank] = healthboxSpriteId; + InitBattlerHealthboxCoords(bank); SetHealthboxSpriteVisible(healthboxSpriteId); if (GetBattlerSide(bank) != B_SIDE_PLAYER) - UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gEnemyParty[gBattlePartyID[bank]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[bank], &gEnemyParty[gBattlerPartyIndexes[bank]], HEALTHBOX_ALL); else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) - UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gPlayerParty[gBattlePartyID[bank]], HEALTHBOX_SAFARI_ALL_TEXT); + UpdateHealthboxAttribute(gHealthboxSpriteIds[bank], &gPlayerParty[gBattlerPartyIndexes[bank]], HEALTHBOX_SAFARI_ALL_TEXT); else - UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gPlayerParty[gBattlePartyID[bank]], HEALTHBOX_ALL); + UpdateHealthboxAttribute(gHealthboxSpriteIds[bank], &gPlayerParty[gBattlerPartyIndexes[bank]], HEALTHBOX_ALL); if (GetBattlerPosition(bank) == B_POSITION_OPPONENT_RIGHT || GetBattlerPosition(bank) == B_POSITION_PLAYER_RIGHT) - DummyBattleInterfaceFunc(gHealthBoxesIds[bank], TRUE); + DummyBattleInterfaceFunc(gHealthboxSpriteIds[bank], TRUE); else - DummyBattleInterfaceFunc(gHealthBoxesIds[bank], FALSE); + DummyBattleInterfaceFunc(gHealthboxSpriteIds[bank], FALSE); if (GetBattlerSide(bank) != B_SIDE_PLAYER) { - if (GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_HP) == 0) + if (GetMonData(&gEnemyParty[gBattlerPartyIndexes[bank]], MON_DATA_HP) == 0) SetHealthboxSpriteInvisible(healthboxSpriteId); } else if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) { - if (GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_HP) == 0) + if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[bank]], MON_DATA_HP) == 0) SetHealthboxSpriteInvisible(healthboxSpriteId); } } diff --git a/sym_common.txt b/sym_common.txt index d724a46d5..ec6c95b20 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -215,10 +215,10 @@ gBattleResults: @ 3005D10 gLeveledUpInBattle: @ 3005D54 .space 0xC -gBattlerFuncs: @ 3005D60 +gBattlerControllerFuncs: @ 3005D60 .space 0x10 -gHealthBoxesIds: @ 3005D70 +gHealthboxSpriteIds: @ 3005D70 .space 0x4 gMultiUsePlayerCursor: @ 3005D74 diff --git a/sym_ewram.txt b/sym_ewram.txt index ca117d1e5..a35bd4bf0 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -273,13 +273,13 @@ gBattleBufferB: @ 2023864 gActiveBattler: @ 2024064 .space 0x4 -gBattleExecBuffer: @ 2024068 +gBattleControllerExecFlags: @ 2024068 .space 0x4 gBattlersCount: @ 202406C .space 0x2 -gBattlePartyID: @ 202406E +gBattlerPartyIndexes: @ 202406E .space 0x8 gBattlerPositions: @ 2024076 @@ -300,7 +300,7 @@ gCurrentActionFuncId: @ 2024083 gBattleMons: @ 2024084 .space 0x160 -gBankSpriteIds: @ 20241E4 +gBattlerSpriteIds: @ 20241E4 .space 0x4 gCurrMovePos: @ 20241E8 @@ -333,10 +333,10 @@ gLastUsedItem: @ 2024208 gLastUsedAbility: @ 202420A .space 0x1 -gBattleAttacker: @ 202420B +gBattleMoveAttacker: @ 202420B .space 0x1 -gBattleDefender: @ 202420C +gBattleMoveTarget: @ 202420C .space 0x1 gBank1: @ 202420D